Changeset 15569
- Timestamp:
- 09/05/2010 03:15:46 PM (14 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/default-list-tables.php
r15566 r15569 65 65 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; 66 66 67 $edit_per_page = 'edit_' . $post_type . '_per_page'; 68 $per_page = (int) get_user_option( $edit_per_page ); 69 if ( empty( $per_page ) || $per_page < 1 ) 70 $per_page = 20; 71 $per_page = apply_filters( $edit_per_page, $per_page ); 67 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 72 68 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 73 69 … … 1368 1364 global $taxonomy; 1369 1365 1370 $tags_per_page = (int) get_user_option( 'edit_' . $taxonomy . '_per_page' ); 1371 1372 if ( empty( $tags_per_page ) || $tags_per_page < 1 ) 1373 $tags_per_page = 20; 1366 $tags_per_page = $this->get_items_per_page( 'edit_' . $taxonomy . '_per_page' ); 1374 1367 1375 1368 if ( 'post_tag' == $taxonomy ) { … … 1378 1371 } elseif ( 'category' == $taxonomy ) { 1379 1372 $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter 1380 } else {1381 $tags_per_page = apply_filters( 'edit_' . $taxonomy . '_per_page', $tags_per_page );1382 1373 } 1383 1374 … … 1708 1699 $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; 1709 1700 1710 $users_per_page = (int) get_user_option( 'users_per_page' ); 1711 if ( empty( $users_per_page ) || $users_per_page < 1 ) 1712 $users_per_page = 20; 1713 $users_per_page = apply_filters( 'users_per_page', $users_per_page ); 1701 $users_per_page = $this->get_items_per_page( 'users_per_page' ); 1714 1702 1715 1703 $paged = $this->get_pagenum(); … … 1962 1950 $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : ''; 1963 1951 1964 if ( isset( $_POST['per_page'] ) ) 1965 $comments_per_page = $_POST['per_page']; 1966 else 1967 $comments_per_page = (int) get_user_option( 'edit_comments_per_page' ); 1968 1969 if ( empty( $comments_per_page ) || $comments_per_page < 1 ) 1970 $comments_per_page = 20; 1952 $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); 1971 1953 $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); 1972 1954 … … 2553 2535 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; 2554 2536 2537 $per_page = $this->get_items_per_page( 'ms_sites_per_page' ); 2538 2555 2539 $pagenum = $this->get_pagenum(); 2556 2557 $per_page = (int) get_user_option( 'ms_sites_per_page' );2558 if ( empty( $per_page ) || $per_page < 1 )2559 $per_page = 20;2560 2561 $per_page = apply_filters( 'ms_sites_per_page', $per_page );2562 2540 2563 2541 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; … … 2837 2815 } 2838 2816 2839 function check_permissions() { 2817 function check_permissions() { 2840 2818 if ( !is_multisite() ) 2841 2819 wp_die( __( 'Multisite support is not enabled.' ) ); … … 2850 2828 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; 2851 2829 2830 $per_page = $this->get_items_per_page( 'ms_users_per_page' ); 2831 2852 2832 $pagenum = $this->get_pagenum(); 2853 2854 $per_page = (int) get_user_option( 'ms_users_per_page' );2855 if ( empty( $per_page ) || $per_page < 1 )2856 $per_page = 20;2857 2858 $per_page = apply_filters( 'ms_users_per_page', $per_page );2859 2833 2860 2834 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; … … 3208 3182 uasort( $this->items, '_order_plugins_callback' ); 3209 3183 } 3210 3211 $plugins_per_page = (int) get_user_option( 'plugins_per_page' ); 3212 if ( empty( $plugins_per_page ) || $plugins_per_page < 1 ) 3213 $plugins_per_page = 999; 3214 $plugins_per_page = apply_filters( 'plugins_per_page', $plugins_per_page ); 3184 3185 $plugins_per_page = $this->get_items_per_page( 'plugins_per_page', 999 ); 3215 3186 3216 3187 $start = ( $page - 1 ) * $plugins_per_page; -
trunk/wp-admin/includes/list-table.php
r15535 r15569 324 324 325 325 return max( 1, $pagenum ); 326 } 327 328 /** 329 * Get number of items to display on a single page 330 * 331 * @since 3.1.0 332 * @access protected 333 * 334 * @return int 335 */ 336 function get_items_per_page( $option, $default = 20 ) { 337 $per_page = (int) get_user_option( $option ); 338 if ( empty( $per_page ) || $per_page < 1 ) 339 $per_page = $default; 340 341 return (int) apply_filters( $option, $per_page ); 326 342 } 327 343
Note: See TracChangeset
for help on using the changeset viewer.