diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 313965384c..1dd01663e6 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -517,10 +517,16 @@ class WP_List_Table { * @access protected */ function pagination( $which ) { - if ( empty( $this->_pagination_args ) ) + if ( empty( $this->_pagination_args ) ) { return; + } - extract( $this->_pagination_args, EXTR_SKIP ); + $total_items = $this->_pagination_args['total_items']; + $total_pages = $this->_pagination_args['total_pages']; + $infinite_scroll = false; + if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { + $infinite_scroll = $this->_pagination_args['infinite_scroll']; + } $output = '' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . ''; @@ -533,11 +539,12 @@ class WP_List_Table { $page_links = array(); $disable_first = $disable_last = ''; - if ( $current == 1 ) + if ( $current == 1 ) { $disable_first = ' disabled'; - if ( $current == $total_pages ) + } + if ( $current == $total_pages ) { $disable_last = ' disabled'; - + } $page_links[] = sprintf( "%s", 'first-page' . $disable_first, esc_attr__( 'Go to the first page' ), @@ -552,15 +559,15 @@ class WP_List_Table { '‹' ); - if ( 'bottom' == $which ) + if ( 'bottom' == $which ) { $html_current_page = $current; - else + } else { $html_current_page = sprintf( "", esc_attr__( 'Current page' ), $current, strlen( $total_pages ) ); - + } $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); $page_links[] = '' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . ''; @@ -579,15 +586,16 @@ class WP_List_Table { ); $pagination_links_class = 'pagination-links'; - if ( ! empty( $infinite_scroll ) ) + if ( ! empty( $infinite_scroll ) ) { $pagination_links_class = ' hide-if-js'; + } $output .= "\n" . join( "\n", $page_links ) . ''; - if ( $total_pages ) + if ( $total_pages ) { $page_class = $total_pages < 2 ? ' one-page' : ''; - else + } else { $page_class = ' no-pages'; - + } $this->_pagination = "
$output
"; echo $this->_pagination;