Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-list-table.php

    r17482 r18254  
    7878         * @access protected
    7979         */
    80         function WP_List_Table( $args = array() ) {
     80        function __construct( $args = array() ) {
    8181                $args = wp_parse_args( $args, array(
    8282                        'plural' => '',
    … …  
    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;
    … …  
    283289                echo "<select name='action$two'>\n";
    284290                echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
    285                 foreach ( $this->_actions as $name => $title )
    286                         echo "\t<option value='$name'>$title</option>\n";
     291
     292                foreach ( $this->_actions as $name => $title ) {
     293                        $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
     294
     295                        echo "\t<option value='$name'$class>$title</option>\n";
     296                }
     297
    287298                echo "</select>\n";
    288299
    … …  
    529540                );
    530541
    531                 $output .= "\n" . join( "\n", $page_links );
    532 
    533                 $page_class = $total_pages < 2 ? ' one-page' : '';
     542                $output .= "\n<span class='pagination-links'>" . join( "\n", $page_links ) . '</span>';
     543
     544                if ( $total_pages )
     545                        $page_class = $total_pages < 2 ? ' one-page' : '';
     546                else
     547                        $page_class = ' no-pages';
    534548
    535549                $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
Note: See TracChangeset for help on using the changeset viewer.