- Timestamp:
- 09/16/2019 11:33:45 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r45932 r46153 314 314 global $mode; 315 315 316 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 317 $blog_states = array(); 318 reset( $this->status_list ); 319 320 foreach ( $this->status_list as $status => $col ) { 321 if ( $blog[ $status ] == 1 ) { 322 $blog_states[] = $col[1]; 323 } 324 } 325 $blog_state = ''; 326 if ( ! empty( $blog_states ) ) { 327 $state_count = count( $blog_states ); 328 $i = 0; 329 $blog_state .= ' — '; 330 foreach ( $blog_states as $state ) { 331 ++$i; 332 $sep = ( $i == $state_count ) ? '' : ', '; 333 $blog_state .= "<span class='post-state'>$state$sep</span>"; 334 } 335 } 316 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 336 317 337 318 ?> 338 319 <strong> 339 320 <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a> 340 <?php echo $blog_state; ?>321 <?php $this->site_states( $blog ); ?> 341 322 </strong> 342 323 <?php … … 348 329 __( '%1$s – %2$s' ), 349 330 get_option( 'blogname' ), 350 '<em>' . get_option( 'blogdescription 331 '<em>' . get_option( 'blogdescription' ) . '</em>' 351 332 ); 352 333 echo '</p>'; … … 496 477 497 478 /** 479 * Maybe output comma-separated site states. 480 * 481 * @since 5.3.0 482 * 483 * @param array $site 484 */ 485 protected function site_states( $site ) { 486 $site_states = array(); 487 488 // $site is still an array, so get the object. 489 $_site = WP_Site::get_instance( $site['blog_id'] ); 490 491 if ( is_main_site( $_site->id ) ) { 492 $site_states['main'] = __( 'Main' ); 493 } 494 495 reset( $this->status_list ); 496 497 foreach ( $this->status_list as $status => $col ) { 498 if ( $_site->{$status} == 1 ) { 499 $site_states[ $col[0] ] = $col[1]; 500 } 501 } 502 503 /** 504 * Filter the default site display states for items in the Sites list table. 505 * 506 * @since 5.3.0 507 * 508 * @param array $site_states An array of site states. Default 'Main', 509 * 'Archived', 'Mature', 'Spam', 'Deleted'. 510 * @param WP_Site $site The current site object. 511 */ 512 $site_states = apply_filters( 'display_site_states', $site_states, $_site ); 513 514 if ( ! empty( $site_states ) ) { 515 $state_count = count( $site_states ); 516 $i = 0; 517 echo ' — '; 518 foreach ( $site_states as $state ) { 519 ++$i; 520 ( $i == $state_count ) ? $sep = '' : $sep = ', '; 521 echo "<span class='post-state'>{$state}{$sep}</span>"; 522 } 523 } 524 } 525 526 /** 498 527 * Gets the name of the default primary column. 499 528 *
Note: See TracChangeset
for help on using the changeset viewer.