From 6a680c8c0358678083c902a1f3cbba7cc6969a82 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Mon, 28 Jan 2019 21:54:48 +0000 Subject: [PATCH] Privacy: Use `label_count` property of post status for request counts in the list table views. See #44952. Fixes #46112. git-svn-id: https://develop.svn.wordpress.org/trunk@44708 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/user.php | 38 +++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php index 27c3fa2a52..a40ff6b9f0 100644 --- a/src/wp-admin/includes/user.php +++ b/src/wp-admin/includes/user.php @@ -1167,12 +1167,44 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table { $total_requests = absint( array_sum( (array) $counts ) ); $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : ''; - $views['all'] = '" . sprintf( _nx( 'All (%s)', 'All (%d)', $total_requests, 'requests' ), number_format_i18n( $total_requests ) ) . ''; + $status_label = sprintf( + /* translators: %s: all requests count */ + _nx( + 'All (%s)', + 'All (%s)', + $total_requests, + 'requests' + ), + number_format_i18n( $total_requests ) + ); + + $views['all'] = sprintf( + '%s', + esc_url( $admin_url ), + $current_link_attributes, + $status_label + ); foreach ( $statuses as $status => $label ) { + $post_status = get_post_status_object( $status ); + if ( ! $post_status ) { + continue; + } + $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : ''; - $total_status_requests = absint( $counts->$status ); - $views[ $status ] = '" . sprintf( _nx( '%1$s (%2$d)', '%1$s (%2$d)', $total_status_requests, 'requests' ), esc_html( $label ), number_format_i18n( $total_status_requests ) ) . ''; + $total_status_requests = absint( $counts->{$status} ); + $status_label = sprintf( + translate_nooped_plural( $post_status->label_count, $total_status_requests ), + number_format_i18n( $total_status_requests ) + ); + $status_link = add_query_arg( 'filter-status', $status, $admin_url ); + + $views[ $status ] = sprintf( + '%s', + esc_url( $status_link ), + $current_link_attributes, + $status_label + ); } return $views;