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

git-svn-id: http://svn.automattic.com/wordpress/trunk@15894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-10-21 15:30:35 +00:00
parent db6cb9d47f
commit 26f95f26d7
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 ) );
}
/**