From 9531bd8378967eaa37348c58dc683ad81e22fce2 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 28 Jan 2019 21:55:51 +0000 Subject: [PATCH] Privacy: Use `label_count` property of post status for request counts in the list table views. See #44952. Fixes #46112. Built from https://develop.svn.wordpress.org/trunk@44708 git-svn-id: http://core.svn.wordpress.org/trunk@44539 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/user.php | 38 +++++++++++++++++++++++++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 27c3fa2a52..a40ff6b9f0 100644 --- a/wp-admin/includes/user.php +++ b/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; diff --git a/wp-includes/version.php b/wp-includes/version.php index d7a7c45824..677b87a62c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta2-44707'; +$wp_version = '5.1-beta2-44708'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.