WordPress.org

Make WordPress Core

Changeset 17900


Ignore:
Timestamp:
05/12/11 06:09:42 (3 years ago)
Author:
markjaquith
Message:

Centralize pagination bound exceeding redirects for list tables. props garyc40. props johnjamesjacoby. fixes #16208

Location:
trunk/wp-admin
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r17748 r17900  
    102102$wp_list_table->prepare_items(); 
    103103 
    104 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    105 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    106     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    107     exit; 
    108 } 
    109  
    110104wp_enqueue_script('admin-comments'); 
    111105enqueue_comment_hotkeys_js(); 
  • trunk/wp-admin/edit.php

    r17872 r17900  
    142142 
    143143$wp_list_table->prepare_items(); 
    144  
    145 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    146 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    147     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    148     exit; 
    149 } 
    150144 
    151145wp_enqueue_script('inline-edit-post'); 
  • trunk/wp-admin/includes/class-wp-list-table.php

    r17798 r17900  
    139139        if ( !$args['total_pages'] && $args['per_page'] > 0 ) 
    140140            $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] ); 
     141 
     142        // redirect if page number is invalid and headers are not already sent 
     143        if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { 
     144            wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); 
     145            exit; 
     146        } 
    141147 
    142148        $this->_pagination_args = $args; 
  • trunk/wp-admin/network/sites.php

    r17872 r17900  
    8989$wp_list_table->prepare_items(); 
    9090 
    91 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    92 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    93     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    94     exit; 
    95 } 
    96  
    9791require_once( '../admin-header.php' ); 
    9892?> 
  • trunk/wp-admin/network/themes.php

    r17872 r17900  
    172172$wp_list_table->prepare_items(); 
    173173 
    174 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    175 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    176     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    177     exit; 
    178 } 
    179  
    180174add_thickbox(); 
    181175 
  • trunk/wp-admin/plugin-install.php

    r17748 r17900  
    2424$pagenum = $wp_list_table->get_pagenum(); 
    2525$wp_list_table->prepare_items(); 
    26 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    27 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    28     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    29     exit; 
    30 } 
    3126 
    3227$title = __('Install Plugins'); 
  • trunk/wp-admin/plugins.php

    r17872 r17900  
    314314$wp_list_table->prepare_items(); 
    315315 
    316 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    317 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    318     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    319     exit; 
    320 } 
    321  
    322316wp_enqueue_script('plugin-install'); 
    323317add_thickbox(); 
  • trunk/wp-admin/theme-install.php

    r17322 r17900  
    2424$pagenum = $wp_list_table->get_pagenum(); 
    2525$wp_list_table->prepare_items(); 
    26 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    27 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    28     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    29     exit; 
    30 } 
    3126 
    3227$title = __('Install Themes'); 
  • trunk/wp-admin/upload.php

    r17872 r17900  
    130130 
    131131$wp_list_table->prepare_items(); 
    132  
    133 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    134 if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    135     wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    136     exit; 
    137 } 
    138132 
    139133$title = __('Media Library'); 
Note: See TracChangeset for help on using the changeset viewer.