Make WordPress Core

Changeset 28387


Ignore:
Timestamp:
05/13/2014 05:13:09 AM (10 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in WP_List_Table::ajax_response():

  • Extracting $this->_args is unnecessary since none of the variables produced are present in the method.
  • total_items and total_pages can be read directly from $this->_pagination_args

See #22400.

File:
1 edited

Legend:

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

    r28386 r28387  
    926926        $this->prepare_items();
    927927
    928         extract( $this->_args );
    929         extract( $this->_pagination_args, EXTR_SKIP );
    930 
    931928        ob_start();
    932         if ( ! empty( $_REQUEST['no_placeholder'] ) )
     929        if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
    933930            $this->display_rows();
    934         else
     931        } else {
    935932            $this->display_rows_or_placeholder();
     933        }
    936934
    937935        $rows = ob_get_clean();
     
    939937        $response = array( 'rows' => $rows );
    940938
    941         if ( isset( $total_items ) )
    942             $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
    943 
    944         if ( isset( $total_pages ) ) {
    945             $response['total_pages'] = $total_pages;
    946             $response['total_pages_i18n'] = number_format_i18n( $total_pages );
     939        if ( isset( $this->_pagination_args['total_items'] ) ) {
     940            $response['total_items_i18n'] = sprintf(
     941                _n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
     942                number_format_i18n( $this->_pagination_args['total_items'] )
     943            );
     944        }
     945        if ( isset( $this->_pagination_args['total_pages'] ) ) {
     946            $response['total_pages'] = $this->_pagination_args['total_pages'];
     947            $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
    947948        }
    948949
Note: See TracChangeset for help on using the changeset viewer.