Changeset 46254
- Timestamp:
- 09/23/2019 05:50:22 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r46212 r46254 161 161 } 162 162 163 // Take into account the role the user has selected. 164 $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; 165 if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) { 166 $args[ $status ] = 1; 167 } 168 163 169 /** 164 170 * Filters the arguments for the site query in the sites list table. … … 200 206 public function no_items() { 201 207 _e( 'No sites found.' ); 208 } 209 210 /** 211 * Gets links to filter sites by status. 212 * 213 * @since 5.3.0 214 * 215 * @return array 216 * 217 */ 218 protected function get_views() { 219 $counts = wp_count_sites(); 220 221 $statuses = array( 222 'all' => _n_noop( 'All <span class="count">(%s)</span>', 'All <span class="count">(%1$s)</span>' ), 223 'public' => _n_noop( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%1$s)</span>' ), 224 'archived' => _n_noop( 'Archived <span class="count">(%1$s)</span>', 'Archived <span class="count">(%1$s)</span>' ), 225 'mature' => _n_noop( 'Mature <span class="count">(%1$s)</span>', 'Mature <span class="count">(%1$s)</span>' ), 226 'spam' => _n_noop( 'Spam <span class="count">(%1$s)</span>', 'Spam <span class="count">(%1$s)</span>' ), 227 'deleted' => _n_noop( 'Deleted <span class="count">(%1$s)</span>', 'Deleted <span class="count">(%1$s)</span>' ), 228 ); 229 230 $view_links = array(); 231 $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; 232 $url = 'sites.php'; 233 234 foreach ( $statuses as $status => $label_count ) { 235 $current_link_attributes = $requested_status === $status || ( $requested_status === '' && 'all' === $status ) 236 ? ' class="current" aria-current="page"' 237 : ''; 238 if ( (int) $counts[ $status ] > 0 ) { 239 $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); 240 $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); 241 242 $view_links[ $status ] = sprintf( 243 '<a href="%1$s"%2$s>%3$s</a>', 244 esc_url( $full_url ), 245 $current_link_attributes, 246 $label 247 ); 248 } 249 } 250 251 return $view_links; 202 252 } 203 253
Note: See TracChangeset
for help on using the changeset viewer.