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.

Built from https://develop.svn.wordpress.org/trunk@28387


git-svn-id: http://core.svn.wordpress.org/trunk@28215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-13 05:14:14 +00:00
parent 08d73b9e23
commit 192e235672
1 changed files with 12 additions and 11 deletions

View File

@ -925,25 +925,26 @@ class WP_List_Table {
function ajax_response() { function ajax_response() {
$this->prepare_items(); $this->prepare_items();
extract( $this->_args );
extract( $this->_pagination_args, EXTR_SKIP );
ob_start(); ob_start();
if ( ! empty( $_REQUEST['no_placeholder'] ) ) if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
$this->display_rows(); $this->display_rows();
else } else {
$this->display_rows_or_placeholder(); $this->display_rows_or_placeholder();
}
$rows = ob_get_clean(); $rows = ob_get_clean();
$response = array( 'rows' => $rows ); $response = array( 'rows' => $rows );
if ( isset( $total_items ) ) if ( isset( $this->_pagination_args['total_items'] ) ) {
$response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ); $response['total_items_i18n'] = sprintf(
_n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
if ( isset( $total_pages ) ) { number_format_i18n( $this->_pagination_args['total_items'] )
$response['total_pages'] = $total_pages; );
$response['total_pages_i18n'] = number_format_i18n( $total_pages ); }
if ( isset( $this->_pagination_args['total_pages'] ) ) {
$response['total_pages'] = $this->_pagination_args['total_pages'];
$response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
} }
die( json_encode( $response ) ); die( json_encode( $response ) );