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. git-svn-id: https://develop.svn.wordpress.org/trunk@28387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a2122e6f7b
commit
fac2faee93
|
@ -925,25 +925,26 @@ class WP_List_Table {
|
|||
function ajax_response() {
|
||||
$this->prepare_items();
|
||||
|
||||
extract( $this->_args );
|
||||
extract( $this->_pagination_args, EXTR_SKIP );
|
||||
|
||||
ob_start();
|
||||
if ( ! empty( $_REQUEST['no_placeholder'] ) )
|
||||
if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
|
||||
$this->display_rows();
|
||||
else
|
||||
} else {
|
||||
$this->display_rows_or_placeholder();
|
||||
}
|
||||
|
||||
$rows = ob_get_clean();
|
||||
|
||||
$response = array( 'rows' => $rows );
|
||||
|
||||
if ( isset( $total_items ) )
|
||||
$response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
|
||||
|
||||
if ( isset( $total_pages ) ) {
|
||||
$response['total_pages'] = $total_pages;
|
||||
$response['total_pages_i18n'] = number_format_i18n( $total_pages );
|
||||
if ( isset( $this->_pagination_args['total_items'] ) ) {
|
||||
$response['total_items_i18n'] = sprintf(
|
||||
_n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
|
||||
number_format_i18n( $this->_pagination_args['total_items'] )
|
||||
);
|
||||
}
|
||||
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 ) );
|
||||
|
|
Loading…
Reference in New Issue