WordPress.org

Make WordPress Core

Changeset 44708


Ignore:
Timestamp:
01/28/2019 09:54:48 PM (8 months ago)
Author:
ocean90
Message:

Privacy: Use label_count property of post status for request counts in the list table views.

See #44952.
Fixes #46112.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r44668 r44708  
    11681168
    11691169        $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
    1170         $views['all']            = '<a href="' . esc_url( $admin_url ) . "\" $current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%d)</span>', $total_requests, 'requests' ), number_format_i18n( $total_requests ) ) . '</a>';
     1170        $status_label            = sprintf(
     1171            /* translators: %s: all requests count */
     1172            _nx(
     1173                'All <span class="count">(%s)</span>',
     1174                'All <span class="count">(%s)</span>',
     1175                $total_requests,
     1176                'requests'
     1177            ),
     1178            number_format_i18n( $total_requests )
     1179        );
     1180
     1181        $views['all'] = sprintf(
     1182            '<a href="%s"%s>%s</a>',
     1183            esc_url( $admin_url ),
     1184            $current_link_attributes,
     1185            $status_label
     1186        );
    11711187
    11721188        foreach ( $statuses as $status => $label ) {
     1189            $post_status = get_post_status_object( $status );
     1190            if ( ! $post_status ) {
     1191                continue;
     1192            }
     1193
    11731194            $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
    1174             $total_status_requests   = absint( $counts->$status );
    1175             $views[ $status ]        = '<a href="' . esc_url( add_query_arg( 'filter-status', $status, $admin_url ) ) . "\" $current_link_attributes>" . sprintf( _nx( '%1$s <span class="count">(%2$d)</span>', '%1$s <span class="count">(%2$d)</span>', $total_status_requests, 'requests' ), esc_html( $label ), number_format_i18n( $total_status_requests ) ) . '</a>';
     1195            $total_status_requests   = absint( $counts->{$status} );
     1196            $status_label            = sprintf(
     1197                translate_nooped_plural( $post_status->label_count, $total_status_requests ),
     1198                number_format_i18n( $total_status_requests )
     1199            );
     1200            $status_link             = add_query_arg( 'filter-status', $status, $admin_url );
     1201
     1202            $views[ $status ] = sprintf(
     1203                '<a href="%s"%s>%s</a>',
     1204                esc_url( $status_link ),
     1205                $current_link_attributes,
     1206                $status_label
     1207            );
    11761208        }
    11771209
Note: See TracChangeset for help on using the changeset viewer.