mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Multisite/Sites: supplemental commit to r46251.
This commit adds the links to the list-table class itself (that were missed in r46251.) See #37392. Props pbiron, thomaswm. Built from https://develop.svn.wordpress.org/trunk@46254 git-svn-id: http://core.svn.wordpress.org/trunk@46066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
22ae908ede
commit
e5302dff26
@ -160,6 +160,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
$args['no_found_rows'] = false;
|
||||
}
|
||||
|
||||
// Take into account the role the user has selected.
|
||||
$status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
|
||||
if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) {
|
||||
$args[ $status ] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the arguments for the site query in the sites list table.
|
||||
*
|
||||
@ -201,6 +207,50 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
_e( 'No sites found.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets links to filter sites by status.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
protected function get_views() {
|
||||
$counts = wp_count_sites();
|
||||
|
||||
$statuses = array(
|
||||
'all' => _n_noop( 'All <span class="count">(%s)</span>', 'All <span class="count">(%1$s)</span>' ),
|
||||
'public' => _n_noop( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%1$s)</span>' ),
|
||||
'archived' => _n_noop( 'Archived <span class="count">(%1$s)</span>', 'Archived <span class="count">(%1$s)</span>' ),
|
||||
'mature' => _n_noop( 'Mature <span class="count">(%1$s)</span>', 'Mature <span class="count">(%1$s)</span>' ),
|
||||
'spam' => _n_noop( 'Spam <span class="count">(%1$s)</span>', 'Spam <span class="count">(%1$s)</span>' ),
|
||||
'deleted' => _n_noop( 'Deleted <span class="count">(%1$s)</span>', 'Deleted <span class="count">(%1$s)</span>' ),
|
||||
);
|
||||
|
||||
$view_links = array();
|
||||
$requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
|
||||
$url = 'sites.php';
|
||||
|
||||
foreach ( $statuses as $status => $label_count ) {
|
||||
$current_link_attributes = $requested_status === $status || ( $requested_status === '' && 'all' === $status )
|
||||
? ' class="current" aria-current="page"'
|
||||
: '';
|
||||
if ( (int) $counts[ $status ] > 0 ) {
|
||||
$label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) );
|
||||
$full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
|
||||
|
||||
$view_links[ $status ] = sprintf(
|
||||
'<a href="%1$s"%2$s>%3$s</a>',
|
||||
esc_url( $full_url ),
|
||||
$current_link_attributes,
|
||||
$label
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $view_links;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-46253';
|
||||
$wp_version = '5.3-alpha-46254';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user