Fix notices in WP_List_Table::ajax_response(). Props Utkarsh. Fixes #15185

git-svn-id: https://develop.svn.wordpress.org/trunk@15894 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-10-21 15:30:35 +00:00
parent 82a68a8979
commit bb3325a6df
1 changed files with 9 additions and 5 deletions

View File

@ -782,11 +782,15 @@ class WP_List_Table {
$this->display_rows();
$rows = ob_get_clean();
die( json_encode( array(
'rows' => $rows,
'total_items' => sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ),
'total_pages' => $total_pages
) ) );
$response = array( 'rows' => $rows );
if ( isset( $total_items ) )
$response['total_items'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
if ( isset( $total_pages ) )
$response['total_pages'] = $total_pages;
die( json_encode( $response ) );
}
/**