Changeset 565719
- Timestamp:
- 06/30/2012 10:04:55 AM (14 years ago)
- Location:
- 3pagination
- Files:
-
- 10 added
- 2 deleted
- 4 edited
-
tags/1.2b (added)
-
tags/1.2b/3pagination.php (added)
-
tags/1.2b/README (added)
-
tags/1.2b/class.settings.php (added)
-
tags/1.2b/examples (added)
-
tags/1.2b/examples/style.css (added)
-
tags/1.2b/js (added)
-
tags/1.2b/js/3pagination.js (added)
-
tags/1.2b/l10n (added)
-
tags/1.2b/readme.txt (added)
-
trunk/3pagination.php (modified) (17 diffs)
-
trunk/class.settings.php (modified) (15 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/screenshot-2.jpg (modified) (previous)
-
trunk/screenshot-3.jpg (deleted)
-
trunk/screenshot-4.jpg (deleted)
Legend:
- Unmodified
- Added
- Removed
-
3pagination/trunk/3pagination.php
r565111 r565719 4 4 * Plugin Name: 3pagination 5 5 * Description: Reach any page with no more than 3 clicks 6 * Version: 1. 2b6 * Version: 1.3b 7 7 * Author: Michael Schröder <ms@ts-webdesign.net> 8 8 * TextDomain: 3pagination 9 * DomainPath: /l 10n9 * DomainPath: /languages 10 10 */ 11 12 11 if ( !class_exists( 'threepagination' ) ) { 13 12 13 if ( function_exists( 'add_filter' ) ) 14 add_filter( 'plugins_loaded', array( 'threepagination', 'get_object' ) ); 15 14 16 class threepagination { 15 17 … … 22 24 23 25 /** 26 * Class object 27 * 28 * @var object 29 */ 30 static $_object; 31 32 /** 33 * Create class object 34 * 35 * @access public 36 * @return object $_object 37 * @since 0.1a 38 */ 39 public static function get_object() { 40 41 if ( NULL == self::$_object ) { 42 self::$_object = new self; 43 } 44 return self::$_object; 45 } 46 47 /** 24 48 * Class init 25 49 * … … 27 51 */ 28 52 public function __construct() { 29 53 30 54 // Get files 31 55 $this->include_files(); 32 56 33 57 // Set textdomain string 34 add_filter( 'admin_init', array( $this, 'set_textdomain' ), 1 ); 35 58 add_filter( 'init', array( $this, 'set_textdomain' ), 1 ); 59 add_filter( 'init', array( $this, 'load_textdomain' ), 2 ); 60 36 61 add_filter( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); 37 62 add_filter( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); 38 63 } 39 64 40 65 /** 41 66 * Include files … … 43 68 * @since 1.2b 44 69 */ 45 p rivatefunction include_files() {46 47 require_once( plugin_dir_path( __FILE__ ) . 'class.settings.php' );70 public function include_files() { 71 72 require_once( plugin_dir_path( __FILE__ ) . 'class.settings.php' ); 48 73 } 49 74 … … 57 82 $this->textdomain = '3pagination'; 58 83 } 59 84 85 public function load_textdomain() { 86 87 load_plugin_textdomain( $this->textdomain, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 88 } 89 60 90 /** 61 91 * Load admin scripts … … 64 94 */ 65 95 public function admin_scripts() { 66 96 67 97 wp_enqueue_style( 'threepagination-css', plugins_url( 'examples/style.css', __FILE__ ) ); 68 98 } 69 99 70 100 /** 71 101 * Load frontend scripts … … 74 104 */ 75 105 public function frontend_scripts() { 76 106 77 107 wp_enqueue_style( 'threepagination-css', plugins_url( 'examples/style.css', __FILE__ ) ); 78 108 79 109 wp_enqueue_script( '3pagination-js', plugins_url( '/js/3pagination.js', __FILE__ ), array( 'jquery', 'json2' ) ); 80 wp_localize_script( '3pagination-js', 'threepag_vars', $this->frontend_vars() ); 81 } 82 110 wp_localize_script( '3pagination-js', 'threepag_vars', $this->frontend_vars() ); 111 } 112 83 113 /** 84 114 * Set frontend vars … … 88 118 */ 89 119 private function frontend_vars() { 90 91 $vars = array( );92 120 121 $vars = array( ); 122 93 123 $settings = get_option( '3pagination_settings' ); 94 124 95 125 // Check placement 96 126 if ( 'on' == $this->init_var( $settings, 'placement_header_index' ) && is_home() || … … 98 128 'on' == $this->init_var( $settings, 'placement_header_category' ) && is_category() || 99 129 'on' == $this->init_var( $settings, 'placement_header_search' ) && is_search() ) 100 $vars[ 'placement_header' ] = TRUE;101 130 $vars[ 'placement_header' ] = TRUE; 131 102 132 if ( 'on' == $this->init_var( $settings, 'placement_footer_index' ) && is_home() || 103 133 'on' == $this->init_var( $settings, 'placement_footer_archive' ) && is_archive() || 104 134 'on' == $this->init_var( $settings, 'placement_footer_category' ) && is_category() || 105 135 'on' == $this->init_var( $settings, 'placement_footer_search' ) && is_search() ) 106 $vars[ 'placement_footer' ] = TRUE;107 136 $vars[ 'placement_footer' ] = TRUE; 137 108 138 if ( 'on' == $this->init_var( $settings, 'placement_prepend_index' ) && is_home() || 109 139 'on' == $this->init_var( $settings, 'placement_prepend_archive' ) && is_archive() || 110 140 'on' == $this->init_var( $settings, 'placement_prepend_category' ) && is_category() || 111 141 'on' == $this->init_var( $settings, 'placement_prepend_search' ) && is_search() ) { 112 $vars[ 'placement_prepend' ] = TRUE;113 $vars[ 'placement_prepend_id' ] = $settings[ 'placement_prepend_id' ];114 }115 142 $vars[ 'placement_prepend' ] = TRUE; 143 $vars[ 'placement_prepend_id' ] = $settings[ 'placement_prepend_id' ]; 144 } 145 116 146 if ( 'on' == $this->init_var( $settings, 'placement_append_index' ) && is_home() || 117 147 'on' == $this->init_var( $settings, 'placement_append_archive' ) && is_archive() || 118 148 'on' == $this->init_var( $settings, 'placement_append_category' ) && is_category() || 119 149 'on' == $this->init_var( $settings, 'placement_append_search' ) && is_search() ) { 120 $vars[ 'placement_append' ] = TRUE;121 $vars[ 'placement_append_id' ] = $settings[ 'placement_append_id' ];122 }123 150 $vars[ 'placement_append' ] = TRUE; 151 $vars[ 'placement_append_id' ] = $settings[ 'placement_append_id' ]; 152 } 153 124 154 // HTML output 125 155 $vars[ 'html' ] = json_encode( self::get() ); 126 156 127 157 return $vars; 128 158 } … … 143 173 144 174 global $wp_query, $wp; 145 146 // Get the page count 175 176 // Get global settings 177 $settings = get_option( '3pagination_settings' ); 178 179 // Permalink structure 180 $pretty = ( 'on' == $settings[ 'other_pretty' ] ) ? TRUE : FALSE; 181 182 // Get the page count. 147 183 $total_pages = ( FALSE == $max_num_pages ) ? $wp_query->max_num_pages : $max_num_pages; 148 184 … … 150 186 if ( 1 == $total_pages ) 151 187 return; 152 188 153 189 // For now, 3pagination supports up to 999 pages only 154 if ( 999< $total_pages )155 $total_pages = 999;190 if ( intval( $settings[ 'other_maxnumpages' ] ) < $total_pages ) 191 $total_pages = intval( $settings[ 'other_maxnumpages' ] ); 156 192 157 193 // Get currently visited page … … 222 258 break; 223 259 } 224 225 $settings = get_option( '3pagination_settings' ); 226 227 $css = isset( $settings[ 'css_class' ] ) ? $settings[ 'css_class' ] : $css; 260 261 $css = isset( $settings[ 'css_class' ] ) ? $settings[ 'css_class' ] : $css; 228 262 229 263 // Navigation labels 230 264 if ( FALSE !== $labels && 'on' == $settings[ 'labels_show' ] ) { 231 265 232 266 if ( $on_page > 1 ) { 233 267 $i = $on_page - 1; … … 272 306 * Create link href 273 307 * 308 * @TODO: _always_ append possibly existing URL parameters 309 * 274 310 * @param object $wp | WP object 275 311 * @param int $i | current element … … 279 315 private static function url( $wp, $i, $pretty ) { 280 316 281 // Pretty permalinks317 // Pretty URLs 282 318 if ( TRUE == $pretty ) { 283 319 if ( get_query_var( 'paged' ) ) … … 286 322 $url = home_url( $wp->request ) . '/page/' . $i; 287 323 } 288 // GET parameters289 else 324 // Default URLs 325 else 290 326 $url = home_url( $wp->request ) . '?paged=' . $i; 291 292 //This might be a search query, where WP uses GET parameters (who knows why): 293 $params = parse_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ); 294 if ( isset( $params[ 'query' ] ) ) 295 $url.= '?' . $params[ 'query' ]; 327 328 // Does the current URL have any parameters? If so, 329 // we will always append them to the new link url, even 330 // if pretty URLs = on 331 $base_url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ]; 332 if ( strpos( $base_url, '=' ) ) { 333 // has at least one param 334 $params = parse_url( $base_url ); 335 $url.= ( TRUE == $pretty ) ? '?' . $params[ 'query' ] : '&' . $params[ 'query' ]; 336 } 296 337 297 338 return $url; … … 314 355 * @since 0.1a 315 356 */ 316 public function init_var ( $var, $index, $default = FALSE, $override_set_empty = FALSE ) {357 public function init_var( $var, $index, $default = FALSE, $override_set_empty = FALSE ) { 317 358 318 359 // is the $index of $var not yet set or (optional) set but empty? … … 322 363 return $var[ $index ]; 323 364 } 365 324 366 } 325 367 326 // Instantiate class327 new threepagination();328 368 } 329 330 369 ?> -
3pagination/trunk/class.settings.php
r565111 r565719 1 1 <?php 2 /** 3 * @TODO: 4 * - Set placement template globally, not for each option 5 * - Pretty URLs or not 6 * - Max no. of pages 7 * 8 * 9 */ 2 10 if ( !class_exists( 'threepagination_settings' ) ) { 3 11 … … 17 25 */ 18 26 public function __construct() { 19 27 20 28 // Management page submenu 21 29 add_filter( 'admin_menu', array( $this, 'add_submenu' ) ); … … 32 40 public function add_submenu() { 33 41 34 add_ management_page( __( '3pagination Configuration', $this->textdomain ), '3pagination', 'activate_plugins', '3pagination', array( $this, 'draw_settings_page' ) );42 add_options_page( __( '3pagination Configuration', parent::$_object->textdomain ), '3pagination', 'activate_plugins', '3pagination', array( $this, 'draw_settings_page' ) ); 35 43 } 36 44 … … 39 47 <div class="wrap"> 40 48 <?php screen_icon( 'options-general' ); ?> 41 <h2><?php _e( '3pagination Settings', $this->textdomain ); ?></h2>49 <h2><?php _e( '3pagination Settings', parent::$_object->textdomain ); ?></h2> 42 50 43 51 <form action="options.php" method="post"> … … 45 53 settings_fields( '3pagination_settings' ); 46 54 do_settings_sections( '3pagination' ); 47 submit_button( __( 'Save Changes', $this->textdomain ), 'button-primary', 'submit', TRUE );55 submit_button( __( 'Save Changes', parent::$_object->textdomain ), 'button-primary', 'submit', TRUE ); 48 56 ?> 49 57 </form> … … 55 63 * Init the settings API 56 64 * 65 * @TODO checkbox "I am using pretty URLS" 66 * 57 67 * @since 0.1 58 68 */ … … 65 75 // Add the section to reading settings so we can add our 66 76 // fields to it 67 add_settings_section( '3pagination_preview', __( 'Preview', $this->textdomain ), array( $this, 'section_preview' ), '3pagination' ); 68 add_settings_section( '3pagination_labels', __( 'Labels', $this->textdomain ), array( $this, 'section_labels' ), '3pagination' ); 69 add_settings_section( '3pagination_placement', __( 'Placement', $this->textdomain ), array( $this, 'section_placement' ), '3pagination' ); 70 add_settings_section( '3pagination_css', __( 'DOM & CSS', $this->textdomain ), array( $this, 'section_css' ), '3pagination' ); 77 add_settings_section( '3pagination_preview', __( 'Preview', parent::$_object->textdomain ), array( $this, 'section_preview' ), '3pagination' ); 78 add_settings_section( '3pagination_labels', __( 'Labels', parent::$_object->textdomain ), array( $this, 'section_labels' ), '3pagination' ); 79 add_settings_section( '3pagination_placement', __( 'Placement', parent::$_object->textdomain ), array( $this, 'section_placement' ), '3pagination' ); 80 add_settings_section( '3pagination_css', __( 'DOM & CSS', parent::$_object->textdomain ), array( $this, 'section_css' ), '3pagination' ); 81 add_settings_section( '3pagination_other', __( 'Other options', parent::$_object->textdomain ), array( $this, 'section_other' ), '3pagination' ); 71 82 72 83 // Add the field with the names and function to use for our new 73 84 // settings, put it in our new section 74 add_settings_field( 'threepagination_preview', __( 'Preview of pagination', $this->textdomain ), array( $this, 'preview' ), '3pagination', '3pagination_preview' ); 75 76 add_settings_field( 'threepagination_labels_show', __( 'Show labels', $this->textdomain ), array( $this, 'labels_show' ), '3pagination', '3pagination_labels' ); 77 add_settings_field( 'threepagination_labels_previous', __( 'Previous page', $this->textdomain ), array( $this, 'labels_previous' ), '3pagination', '3pagination_labels' ); 78 add_settings_field( 'threepagination_labels_next', __( 'Next page', $this->textdomain ), array( $this, 'labels_next' ), '3pagination', '3pagination_labels' ); 79 add_settings_field( 'threepagination_labels_first', __( 'First page', $this->textdomain ), array( $this, 'labels_first' ), '3pagination', '3pagination_labels' ); 80 add_settings_field( 'threepagination_labels_last', __( 'Last page', $this->textdomain ), array( $this, 'labels_last' ), '3pagination', '3pagination_labels' ); 81 82 add_settings_field( 'threepagination_css_class', __( 'Set CSS class', $this->textdomain ), array( $this, 'css_class' ), '3pagination', '3pagination_css' ); 83 84 add_settings_field( 'threepagination_placement_header', __( 'Inject below header', $this->textdomain ), array( $this, 'placement_header' ), '3pagination', '3pagination_placement' ); 85 add_settings_field( 'threepagination_placement_footer', __( 'Inject above footer', $this->textdomain ), array( $this, 'placement_footer' ), '3pagination', '3pagination_placement' ); 86 87 add_settings_field( 'threepagination_placement_prepend', __( 'Prepend to', $this->textdomain ), array( $this, 'placement_prepend' ), '3pagination', '3pagination_placement' ); 88 add_settings_field( 'threepagination_placement_append', __( 'Append to', $this->textdomain ), array( $this, 'placement_append' ), '3pagination', '3pagination_placement' ); 89 85 add_settings_field( 'threepagination_preview', __( 'Preview of pagination', parent::$_object->textdomain ), array( $this, 'preview' ), '3pagination', '3pagination_preview' ); 86 87 add_settings_field( 'threepagination_labels_show', __( 'Show labels', parent::$_object->textdomain ), array( $this, 'labels_show' ), '3pagination', '3pagination_labels' ); 88 add_settings_field( 'threepagination_labels_previous', __( 'Previous page', parent::$_object->textdomain ), array( $this, 'labels_previous' ), '3pagination', '3pagination_labels' ); 89 add_settings_field( 'threepagination_labels_next', __( 'Next page', parent::$_object->textdomain ), array( $this, 'labels_next' ), '3pagination', '3pagination_labels' ); 90 add_settings_field( 'threepagination_labels_first', __( 'First page', parent::$_object->textdomain ), array( $this, 'labels_first' ), '3pagination', '3pagination_labels' ); 91 add_settings_field( 'threepagination_labels_last', __( 'Last page', parent::$_object->textdomain ), array( $this, 'labels_last' ), '3pagination', '3pagination_labels' ); 92 93 add_settings_field( 'threepagination_css_class', __( 'Set CSS class', parent::$_object->textdomain ), array( $this, 'css_class' ), '3pagination', '3pagination_css' ); 94 95 add_settings_field( 'threepagination_placement_header', __( 'Inject below header', parent::$_object->textdomain ), array( $this, 'placement_header' ), '3pagination', '3pagination_placement' ); 96 add_settings_field( 'threepagination_placement_footer', __( 'Inject above footer', parent::$_object->textdomain ), array( $this, 'placement_footer' ), '3pagination', '3pagination_placement' ); 97 98 add_settings_field( 'threepagination_placement_prepend', __( 'Prepend to', parent::$_object->textdomain ), array( $this, 'placement_prepend' ), '3pagination', '3pagination_placement' ); 99 add_settings_field( 'threepagination_placement_append', __( 'Append to', parent::$_object->textdomain ), array( $this, 'placement_append' ), '3pagination', '3pagination_placement' ); 100 101 add_settings_field( 'threepagination_other_maxnumpages', __( 'Max no. of pages', parent::$_object->textdomain ), array( $this, 'other_maxnumpages' ), '3pagination', '3pagination_other' ); 102 add_settings_field( 'threepagination_other_pretty', __( 'Pretty URLs enabled?', parent::$_object->textdomain ), array( $this, 'other_pretty' ), '3pagination', '3pagination_other' ); 103 90 104 } 91 105 … … 97 111 public function section_preview() { 98 112 ?> 99 <!--<span class="description"><?php _e( 'Preview of pagination' ); ?></span>-->113 <!--<span class="description"><?php _e( 'Preview of pagination', parent::$_object->textdomain ); ?></span>--> 100 114 <?php 101 115 } … … 108 122 public function section_labels() { 109 123 ?> 110 <span class="description"><?php _e( 'Define the navigation labels characters' ); ?></span>124 <span class="description"><?php _e( 'Define the navigation labels characters', parent::$_object->textdomain ); ?></span> 111 125 <?php 112 126 } … … 119 133 public function section_css() { 120 134 ?> 121 <span class="description"><?php _e( 'Set your stylesheet for the pagination' ); ?></span> 122 <?php 123 } 135 <span class="description"><?php _e( 'Set your stylesheet for the pagination', parent::$_object->textdomain ); ?></span> 136 <?php 137 } 138 139 /** 140 * Head of "Other options" section 141 * 142 * @since 0.1 143 */ 144 public function section_other() { 145 ?> 146 <span class="description"><?php _e( '', parent::$_object->textdomain ); ?></span> 147 <?php 148 } 124 149 125 150 /** … … 131 156 ?> 132 157 <p> 133 <span class="description"><?php _e( '<b>Inject:</b> You can "inject" the navigation bar below the header or above the footer div. Your theme needs to have an according HTML structure (which most WordPress themes do).' ); ?></span>158 <span class="description"><?php _e( '<b>Inject:</b> You can "inject" the navigation bar below the header or above the footer div. Your theme needs to have an according HTML structure (which most WordPress themes do).', parent::$_object->textdomain ); ?></span> 134 159 <br /> 135 <span class="description"><?php _e( '<b>Append/Prepend:</b> You can specifiy a container into which the pagination will be prepended/appended. Write it CSS-style, i.e. #mycontainer' ); ?></span>160 <span class="description"><?php _e( '<b>Append/Prepend:</b> You can specifiy a container into which the pagination will be prepended/appended. Write it CSS-style, i.e. #mycontainer', parent::$_object->textdomain ); ?></span> 136 161 <br /> 137 <span class="description"><?php _e( '<b>Note:</b> If you want your site to degrade gracefully, you should additionaly hardcode the pagination function into your theme files: <input style="background-color:lightgrey" size="45" type="text" value="<noscript><?php threepagination::draw(); ?></noscript>"' ); ?></span>162 <span class="description"><?php _e( '<b>Note:</b> If you want your site to degrade gracefully, you should additionaly hardcode the pagination function into your theme files: <input style="background-color:lightgrey" size="45" type="text" value="<noscript><?php threepagination::draw(); ?></noscript>"', parent::$_object->textdomain ); ?></span> 138 163 </p> 139 164 <?php … … 215 240 } 216 241 242 /** 243 * Inject below header 244 * 245 * @since 0.1 246 */ 247 public function placement_header() { 248 249 $settings = get_option( '3pagination_settings', TRUE ); 250 ?> 251 <input type="checkbox" name="3pagination_settings[placement_header_index]" <?php checked( $this->init_var( $settings, 'placement_header_index', FALSE ), 'on' ); ?> /> 252 <label for="3pagination_settings[placement_header_index]"><?php _e( 'Index pages', parent::$_object->textdomain ); ?></label> 253 <input type="checkbox" name="3pagination_settings[placement_header_archive]" <?php checked( $this->init_var( $settings, 'placement_header_archive', FALSE ), 'on' ); ?> /> 254 <label for="3pagination_settings[placement_header_archive]"><?php _e( 'Archive pages', parent::$_object->textdomain ); ?></label> 255 <input type="checkbox" name="3pagination_settings[placement_header_category]" <?php checked( $this->init_var( $settings, 'placement_header_category', FALSE ), 'on' ); ?> /> 256 <label for="3pagination_settings[placement_header_category]"><?php _e( 'Category pages', parent::$_object->textdomain ); ?></label> 257 <input type="checkbox" name="3pagination_settings[placement_header_search]" <?php checked( $this->init_var( $settings, 'placement_header_search', FALSE ), 'on' ); ?> /> 258 <label for="3pagination_settings[placement_header_search]"><?php _e( 'Search pages', parent::$_object->textdomain ); ?></label> 259 <?php 260 } 261 262 /** 263 * Inject above footer 264 * 265 * @since 0.1 266 */ 267 public function placement_footer() { 268 269 $settings = get_option( '3pagination_settings', TRUE ); 270 ?> 271 <input type="checkbox" name="3pagination_settings[placement_footer_index]" <?php checked( $this->init_var( $settings, 'placement_footer_index', FALSE ), 'on' ); ?> /> 272 <label for="3pagination_settings[placement_footer_index]"><?php _e( 'Index pages', parent::$_object->textdomain ); ?></label> 273 <input type="checkbox" name="3pagination_settings[placement_footer_archive]" <?php checked( $this->init_var( $settings, 'placement_footer_archive', FALSE ), 'on' ); ?> /> 274 <label for="3pagination_settings[placement_footer_archive]"><?php _e( 'Archive pages', parent::$_object->textdomain ); ?></label> 275 <input type="checkbox" name="3pagination_settings[placement_footer_category]" <?php checked( $this->init_var( $settings, 'placement_footer_category', FALSE ), 'on' ); ?> /> 276 <label for="3pagination_settings[placement_footer_category]"><?php _e( 'Category pages', parent::$_object->textdomain ); ?></label> 277 <input type="checkbox" name="3pagination_settings[placement_footer_search]" <?php checked( $this->init_var( $settings, 'placement_footer_search', FALSE ), 'on' ); ?> /> 278 <label for="3pagination_settings[placement_footer_search]"><?php _e( 'Search pages', parent::$_object->textdomain ); ?></label> 279 <?php 280 } 281 282 /** 283 * Prepend to custom container 284 * 285 * @since 0.1 286 */ 287 public function placement_prepend() { 288 289 $settings = get_option( '3pagination_settings', TRUE ); 290 ?> 291 <input type="text" name="3pagination_settings[placement_prepend_id]" value="<?php echo $this->init_var( $settings, 'placement_prepend_id', FALSE ); ?>" /> 292 <label for="3pagination_settings[placement_prepend_id]"><?php _e( 'in', parent::$_object->textdomain ); ?></label> 293 <input type="checkbox" name="3pagination_settings[placement_prepend_index]" <?php checked( $this->init_var( $settings, 'placement_prepend_index', FALSE ), 'on' ); ?> /> 294 <label for="3pagination_settings[placement_prepend_index]"><?php _e( 'Index pages', parent::$_object->textdomain ); ?></label> 295 <input type="checkbox" name="3pagination_settings[placement_prepend_archive]" <?php checked( $this->init_var( $settings, 'placement_prepend_archive', FALSE ), 'on' ); ?> /> 296 <label for="3pagination_settings[placement_prepend_archive]"><?php _e( 'Archive pages', parent::$_object->textdomain ); ?></label> 297 <input type="checkbox" name="3pagination_settings[placement_prepend_category]" <?php checked( $this->init_var( $settings, 'placement_prepend_category', FALSE ), 'on' ); ?> /> 298 <label for="3pagination_settings[placement_prepend_category]"><?php _e( 'Category pages', parent::$_object->textdomain ); ?></label> 299 <input type="checkbox" name="3pagination_settings[placement_prepend_search]" <?php checked( $this->init_var( $settings, 'placement_prepend_search', FALSE ), 'on' ); ?> /> 300 <label for="3pagination_settings[placement_prepend_search]"><?php _e( 'Search pages', parent::$_object->textdomain ); ?></label> 301 <?php 302 } 303 304 /** 305 * Append to custom container 306 * 307 * @since 0.1 308 */ 309 public function placement_append() { 310 311 $settings = get_option( '3pagination_settings', TRUE ); 312 ?> 313 <input type="text" name="3pagination_settings[placement_append_id]" value="<?php echo $this->init_var( $settings, 'placement_append_id', FALSE ); ?>" /> 314 <label for="3pagination_settings[placement_append_id]"><?php echo _x( 'in', 'Zeige Pagination "in" diesen Seiten an', parent::$_object->textdomain ); ?></label> 315 <input type="checkbox" name="3pagination_settings[placement_append_index]" <?php checked( $this->init_var( $settings, 'placement_append_index', FALSE ), 'on' ); ?> /> 316 <label for="3pagination_settings[placement_append_index]"><?php _e( 'Index pages', parent::$_object->textdomain ); ?></label> 317 <input type="checkbox" name="3pagination_settings[placement_append_archive]" <?php checked( $this->init_var( $settings, 'placement_append_archive', FALSE ), 'on' ); ?> /> 318 <label for="3pagination_settings[placement_append_archive]"><?php _e( 'Archive pages', parent::$_object->textdomain ); ?></label> 319 <input type="checkbox" name="3pagination_settings[placement_append_category]" <?php checked( $this->init_var( $settings, 'placement_append_category', FALSE ), 'on' ); ?> /> 320 <label for="3pagination_settings[placement_append_category]"><?php _e( 'Category pages', parent::$_object->textdomain ); ?></label> 321 <input type="checkbox" name="3pagination_settings[placement_append_search]" <?php checked( $this->init_var( $settings, 'placement_append_search', FALSE ), 'on' ); ?> /> 322 <label for="3pagination_settings[placement_append_search]"><?php _e( 'Search pages', parent::$_object->textdomain ); ?></label> 323 <?php 324 } 325 217 326 /** 218 327 * Set CSS class … … 230 339 } 231 340 232 /** 233 * Inject below header 234 * 235 * @since 0.1 236 */ 237 public function placement_header() { 238 239 $settings = get_option( '3pagination_settings', TRUE ); 240 ?> 241 <input type="checkbox" name="3pagination_settings[placement_header_index]" <?php checked( $this->init_var( $settings, 'placement_header_index', FALSE ), 'on' ); ?> /> 242 <label for="3pagination_settings[placement_header_index]"><?php _e( 'Index pages' ); ?></label> 243 <input type="checkbox" name="3pagination_settings[placement_header_archive]" <?php checked( $this->init_var( $settings, 'placement_header_archive', FALSE ), 'on' ); ?> /> 244 <label for="3pagination_settings[placement_header_archive]"><?php _e( 'Archive pages' ); ?></label> 245 <input type="checkbox" name="3pagination_settings[placement_header_category]" <?php checked( $this->init_var( $settings, 'placement_header_category', FALSE ), 'on' ); ?> /> 246 <label for="3pagination_settings[placement_header_category]"><?php _e( 'Category pages' ); ?></label> 247 <input type="checkbox" name="3pagination_settings[placement_header_search]" <?php checked( $this->init_var( $settings, 'placement_header_search', FALSE ), 'on' ); ?> /> 248 <label for="3pagination_settings[placement_header_search]"><?php _e( 'Search pages' ); ?></label> 249 <?php 250 } 251 252 /** 253 * Inject above footer 254 * 255 * @since 0.1 256 */ 257 public function placement_footer() { 258 259 $settings = get_option( '3pagination_settings', TRUE ); 260 ?> 261 <input type="checkbox" name="3pagination_settings[placement_footer_index]" <?php checked( $this->init_var( $settings, 'placement_footer_index', FALSE ), 'on' ); ?> /> 262 <label for="3pagination_settings[placement_footer_index]"><?php _e( 'Index pages' ); ?></label> 263 <input type="checkbox" name="3pagination_settings[placement_footer_archive]" <?php checked( $this->init_var( $settings, 'placement_footer_archive', FALSE ), 'on' ); ?> /> 264 <label for="3pagination_settings[placement_footer_archive]"><?php _e( 'Archive pages' ); ?></label> 265 <input type="checkbox" name="3pagination_settings[placement_footer_category]" <?php checked( $this->init_var( $settings, 'placement_footer_category', FALSE ), 'on' ); ?> /> 266 <label for="3pagination_settings[placement_footer_category]"><?php _e( 'Category pages' ); ?></label> 267 <input type="checkbox" name="3pagination_settings[placement_footer_search]" <?php checked( $this->init_var( $settings, 'placement_footer_search', FALSE ), 'on' ); ?> /> 268 <label for="3pagination_settings[placement_footer_search]"><?php _e( 'Search pages' ); ?></label> 269 <?php 270 } 271 272 /** 273 * Prepend to custom container 274 * 275 * @since 0.1 276 */ 277 public function placement_prepend() { 278 279 $settings = get_option( '3pagination_settings', TRUE ); 280 ?> 281 <input type="text" name="3pagination_settings[placement_prepend_id]" value="<?php echo $this->init_var( $settings, 'placement_prepend_id', FALSE ); ?>" /> 282 <label for="3pagination_settings[placement_prepend_id]"><?php _e( 'in' ); ?></label> 283 <input type="checkbox" name="3pagination_settings[placement_prepend_index]" <?php checked( $this->init_var( $settings, 'placement_prepend_index', FALSE ), 'on' ); ?> /> 284 <label for="3pagination_settings[placement_prepend_index]"><?php _e( 'Index pages' ); ?></label> 285 <input type="checkbox" name="3pagination_settings[placement_prepend_archive]" <?php checked( $this->init_var( $settings, 'placement_prepend_archive', FALSE ), 'on' ); ?> /> 286 <label for="3pagination_settings[placement_prepend_archive]"><?php _e( 'Archive pages' ); ?></label> 287 <input type="checkbox" name="3pagination_settings[placement_prepend_category]" <?php checked( $this->init_var( $settings, 'placement_prepend_category', FALSE ), 'on' ); ?> /> 288 <label for="3pagination_settings[placement_prepend_category]"><?php _e( 'Category pages' ); ?></label> 289 <input type="checkbox" name="3pagination_settings[placement_prepend_search]" <?php checked( $this->init_var( $settings, 'placement_prepend_search', FALSE ), 'on' ); ?> /> 290 <label for="3pagination_settings[placement_prepend_search]"><?php _e( 'Search pages' ); ?></label> 291 <?php 292 } 293 294 /** 295 * Append to custom container 296 * 297 * @since 0.1 298 */ 299 public function placement_append() { 300 301 $settings = get_option( '3pagination_settings', TRUE ); 302 ?> 303 <input type="text" name="3pagination_settings[placement_append_id]" value="<?php echo $this->init_var( $settings, 'placement_append_id', FALSE ); ?>" /> 304 <label for="3pagination_settings[placement_append_id]"><?php _e( 'in' ); ?></label> 305 <input type="checkbox" name="3pagination_settings[placement_append_index]" <?php checked( $this->init_var( $settings, 'placement_append_index', FALSE ), 'on' ); ?> /> 306 <label for="3pagination_settings[placement_append_index]"><?php _e( 'Index pages' ); ?></label> 307 <input type="checkbox" name="3pagination_settings[placement_append_archive]" <?php checked( $this->init_var( $settings, 'placement_append_archive', FALSE ), 'on' ); ?> /> 308 <label for="3pagination_settings[placement_append_archive]"><?php _e( 'Archive pages' ); ?></label> 309 <input type="checkbox" name="3pagination_settings[placement_append_category]" <?php checked( $this->init_var( $settings, 'placement_append_category', FALSE ), 'on' ); ?> /> 310 <label for="3pagination_settings[placement_append_category]"><?php _e( 'Category pages' ); ?></label> 311 <input type="checkbox" name="3pagination_settings[placement_append_search]" <?php checked( $this->init_var( $settings, 'placement_append_search', FALSE ), 'on' ); ?> /> 312 <label for="3pagination_settings[placement_append_search]"><?php _e( 'Search pages' ); ?></label> 313 <?php 314 } 315 316 341 public function other_maxnumpages() { 342 343 $settings = get_option( '3pagination_settings', TRUE ); 344 ?> 345 <input type="text" name="3pagination_settings[other_maxnumpages]" value="<?php echo $this->init_var( $settings, 'other_maxnumpages', '999', TRUE ); ?>" /> 346 <br /> 347 <span class="description">Limit to a maximum number of pagelinks</span> 348 <?php 349 } 350 351 public function other_pretty() { 352 353 $settings = get_option( '3pagination_settings', TRUE ); 354 355 ?> 356 <input type="checkbox" name="3pagination_settings[other_pretty]" <?php checked( $this->init_var( $settings, 'other_pretty', 'on' ), 'on' ); ?> /> 357 <?php 358 } 359 317 360 /** 318 361 * Validate user input … … 325 368 */ 326 369 public function threepagination_validate( $data ) { 327 370 328 371 $settings = get_option( '3pagination_settings' ); 329 372 … … 358 401 $settings[ 'placement_append_category' ] = esc_attr( $data[ 'placement_append_category' ] ); 359 402 360 361 // Set this option to determine whether to display serverside fallback pagination 362 foreach( $settings AS $key => $value ) { 363 if ( 0 === strpos( $key, 'placement_' ) && ! empty( $value ) ) { 364 $settings[ 'hide_serverside' ] = TRUE; 365 break; 366 } 367 } 403 $settings[ 'other_maxnumpages' ] = intval( $data[ 'other_maxnumpages' ] ); 404 $settings[ 'other_pretty' ] = esc_attr( $data[ 'other_pretty' ] ); 368 405 369 406 return $settings; -
3pagination/trunk/readme.txt
r565375 r565719 4 4 Requires at least: 3.3.2 5 5 Tested up to: 3.4.1 6 Stable tag: 1. 2b6 Stable tag: 1.3b 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 1. Upload `3pagination.php` to the `/wp-content/plugins/` directory OR choose `Plugins->Add New` and type "3pagination". 29 29 2. Activate the plugin through the `Plugins` menu in WordPress 30 3. Go to ` Tools->3pagination` to set labels, placement and CSS.30 3. Go to `Settings->3pagination` to set labels, placement and CSS. 31 31 4. Done! 32 32 33 <h4> Implementation</h4>33 <h4>How to use</h4> 34 34 All options can be set in an options page, the pagination container can be injected or appended to the existing DOM. 35 35 If you are unsure about the HTML structure of your Website, you can do the following (in Firefox): … … 37 37 <li>Right click the spot where you wish the pagination to appear and choose `Inspect Element (Q)` from the menu list</li> 38 38 <li>Copy the id of the container, i.e. #wrapper.someclass</li> 39 <li>To append or prepend the pagination to this container, paste it's id into the appropriate field of the Placement section under ` Tools->3pagination`</li>39 <li>To append or prepend the pagination to this container, paste it's id into the appropriate field of the Placement section under `Settings->3pagination`</li> 40 40 <li>Choose on which pages (archives, search etc.) the pagination should appear. Done!</li> 41 41 </ol> 42 42 43 43 44 <h4> Implementation- old school</h4>44 <h4>How to use - old school</h4> 45 45 You can, if you want (or to have your website degrade gracefully), call the class methods in your theme files. 46 46 … … 66 66 == Screenshots == 67 67 68 1. Option page: preview, label, placement and CSS 69 2. Example of a pagination display, 'classic' style 70 3. 'classic-glow' style 71 4. 'classic-small' style 68 1. Settings page: preview, label, placement, CSS and other settings 69 2. Injected below header 72 70 73 71 == Changelog == … … 90 88 - Support for search templates 91 89 90 = 1.3b = 91 - Added checkbox for pretty URLs; 92 - Added option for max no. of pages 93 - Fixed link URL building; 94 - German localization; 95 - Plugin loading enqueued; 96 - Fixed bug with pagination link; 97 92 98 == A brief Markdown Example == 93 99
Note: See TracChangeset
for help on using the changeset viewer.