Ticket #15970: 15970.2.diff
File 15970.2.diff, 4.8 KB (added by , 13 years ago) |
---|
-
wp-admin/edit-tags.php
42 42 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 43 43 } 44 44 45 add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );45 add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => _convert_key_to_option( 'edit_' . $tax->name . '_per_page' ) ) ); 46 46 47 47 switch ( $wp_list_table->current_action() ) { 48 48 -
wp-admin/includes/class-wp-plugins-list-table.php
130 130 uasort( $this->items, array( &$this, '_order_callback' ) ); 131 131 } 132 132 133 $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_',$screen->id . '_per_page' ), 999 );133 $plugins_per_page = $this->get_items_per_page( _convert_key_to_option( $screen->id . '_per_page' ), 999 ); 134 134 135 135 $start = ( $page - 1 ) * $plugins_per_page; 136 136 -
wp-admin/includes/class-wp-posts-list-table.php
94 94 95 95 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; 96 96 97 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page');97 $per_page = $this->get_items_per_page( _convert_key_to_option( 'edit_' . $post_type . '_per_page' ) ); 98 98 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 99 99 100 100 if ( $this->hierarchical_display ) -
wp-admin/includes/class-wp-terms-list-table.php
42 42 function prepare_items() { 43 43 global $taxonomy; 44 44 45 $tags_per_page = $this->get_items_per_page( 'edit_' . $taxonomy . '_per_page');45 $tags_per_page = $this->get_items_per_page( _convert_key_to_option( 'edit_' . $taxonomy . '_per_page' ) ); 46 46 47 47 if ( 'post_tag' == $taxonomy ) { 48 48 $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); -
wp-admin/includes/misc.php
313 313 } 314 314 315 315 /** 316 * Convert a key to an appropriate option name. 317 * 318 * @since 3.3.0 319 * 320 * @param string $key A key to convert, e.g. "edit_{$post_type}_per_page". 321 * @return string Option name. 322 */ 323 function _convert_key_to_option( $key ) { 324 return str_replace( '-', '_', $key ); 325 } 326 327 /** 316 328 * Saves option for number of rows when listing posts, pages, comments, etc. 317 329 * 318 330 * @since 2.8 … … 330 342 if ( !preg_match( '/^[a-z_-]+$/', $option ) ) 331 343 return; 332 344 333 $option = str_replace('-', '_', $option);345 $option = _convert_key_to_option( $option ); 334 346 335 347 $map_option = $option; 336 348 $type = str_replace('edit_', '', $map_option); 337 349 $type = str_replace('_per_page', '', $type); 338 if ( in_array( $type, get_post_types()) )350 if ( in_array( $type, array_map( '_convert_key_to_option', get_post_types() ) ) ) 339 351 $map_option = 'edit_per_page'; 340 if ( in_array( $type, get_taxonomies()) )352 if ( in_array( $type, array_map( '_convert_key_to_option', get_taxonomies() ) ) ) 341 353 $map_option = 'edit_tags_per_page'; 342 354 343 355 -
wp-admin/includes/post.php
871 871 elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] ) 872 872 $order = 'ASC'; 873 873 874 $per_page = 'edit_' . $post_type . '_per_page';874 $per_page = _convert_key_to_option( 'edit_' . $post_type . '_per_page' ); 875 875 $posts_per_page = (int) get_user_option( $per_page ); 876 876 if ( empty( $posts_per_page ) || $posts_per_page < 1 ) 877 877 $posts_per_page = 20; -
wp-admin/includes/screen.php
881 881 882 882 $option = $this->get_option( 'per_page', 'option' ); 883 883 if ( ! $option ) 884 $option = str_replace( '-', '_',"{$this->id}_per_page" );884 $option = _convert_key_to_option( "{$this->id}_per_page" ); 885 885 886 886 $per_page = (int) get_user_option( $option ); 887 887 if ( empty( $per_page ) || $per_page < 1 ) {