wp/wp-admin/includes/class-wp-ms-sites-list-table.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   394 
   394 
   395 	/**
   395 	/**
   396 	 * Handles the checkbox column output.
   396 	 * Handles the checkbox column output.
   397 	 *
   397 	 *
   398 	 * @since 4.3.0
   398 	 * @since 4.3.0
   399 	 *
   399 	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
   400 	 * @param array $blog Current site.
   400 	 *
   401 	 */
   401 	 * @param array $item Current site.
   402 	public function column_cb( $blog ) {
   402 	 */
       
   403 	public function column_cb( $item ) {
       
   404 		// Restores the more descriptive, specific name for use within this method.
       
   405 		$blog = $item;
       
   406 
   403 		if ( ! is_main_site( $blog['blog_id'] ) ) :
   407 		if ( ! is_main_site( $blog['blog_id'] ) ) :
   404 			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   408 			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   405 			?>
   409 			?>
   406 			<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>">
   410 			<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>">
   407 				<?php
   411 				<?php
   558 
   562 
   559 	/**
   563 	/**
   560 	 * Handles output for the default column.
   564 	 * Handles output for the default column.
   561 	 *
   565 	 *
   562 	 * @since 4.3.0
   566 	 * @since 4.3.0
   563 	 *
   567 	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
   564 	 * @param array  $blog        Current site.
   568 	 *
       
   569 	 * @param array  $item        Current site.
   565 	 * @param string $column_name Current column name.
   570 	 * @param string $column_name Current column name.
   566 	 */
   571 	 */
   567 	public function column_default( $blog, $column_name ) {
   572 	public function column_default( $item, $column_name ) {
   568 		/**
   573 		/**
   569 		 * Fires for each registered custom column in the Sites list table.
   574 		 * Fires for each registered custom column in the Sites list table.
   570 		 *
   575 		 *
   571 		 * @since 3.1.0
   576 		 * @since 3.1.0
   572 		 *
   577 		 *
   573 		 * @param string $column_name The name of the column to display.
   578 		 * @param string $column_name The name of the column to display.
   574 		 * @param int    $blog_id     The site ID.
   579 		 * @param int    $blog_id     The site ID.
   575 		 */
   580 		 */
   576 		do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
   581 		do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
   577 	}
   582 	}
   578 
   583 
   579 	/**
   584 	/**
   580 	 * @global string $mode List table view mode.
   585 	 * @global string $mode List table view mode.
   581 	 */
   586 	 */
   628 		/**
   633 		/**
   629 		 * Filters the default site display states for items in the Sites list table.
   634 		 * Filters the default site display states for items in the Sites list table.
   630 		 *
   635 		 *
   631 		 * @since 5.3.0
   636 		 * @since 5.3.0
   632 		 *
   637 		 *
   633 		 * @param array $site_states An array of site states. Default 'Main',
   638 		 * @param string[] $site_states An array of site states. Default 'Main',
   634 		 *                           'Archived', 'Mature', 'Spam', 'Deleted'.
   639 		 *                              'Archived', 'Mature', 'Spam', 'Deleted'.
   635 		 * @param WP_Site $site The current site object.
   640 		 * @param WP_Site  $site        The current site object.
   636 		 */
   641 		 */
   637 		$site_states = apply_filters( 'display_site_states', $site_states, $_site );
   642 		$site_states = apply_filters( 'display_site_states', $site_states, $_site );
   638 
   643 
   639 		if ( ! empty( $site_states ) ) {
   644 		if ( ! empty( $site_states ) ) {
   640 			$state_count = count( $site_states );
   645 			$state_count = count( $site_states );
   641 			$i           = 0;
   646 
       
   647 			$i = 0;
       
   648 
   642 			echo ' &mdash; ';
   649 			echo ' &mdash; ';
       
   650 
   643 			foreach ( $site_states as $state ) {
   651 			foreach ( $site_states as $state ) {
   644 				++$i;
   652 				++$i;
   645 				( $i == $state_count ) ? $sep = '' : $sep = ', ';
   653 
       
   654 				$sep = ( $i < $state_count ) ? ', ' : '';
       
   655 
   646 				echo "<span class='post-state'>{$state}{$sep}</span>";
   656 				echo "<span class='post-state'>{$state}{$sep}</span>";
   647 			}
   657 			}
   648 		}
   658 		}
   649 	}
   659 	}
   650 
   660 
   661 
   671 
   662 	/**
   672 	/**
   663 	 * Generates and displays row action links.
   673 	 * Generates and displays row action links.
   664 	 *
   674 	 *
   665 	 * @since 4.3.0
   675 	 * @since 4.3.0
   666 	 *
   676 	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
   667 	 * @param array  $blog        Site being acted upon.
   677 	 *
       
   678 	 * @param array  $item        Site being acted upon.
   668 	 * @param string $column_name Current column name.
   679 	 * @param string $column_name Current column name.
   669 	 * @param string $primary     Primary column name.
   680 	 * @param string $primary     Primary column name.
   670 	 * @return string Row actions output for sites in Multisite, or an empty string
   681 	 * @return string Row actions output for sites in Multisite, or an empty string
   671 	 *                if the current column is not the primary column.
   682 	 *                if the current column is not the primary column.
   672 	 */
   683 	 */
   673 	protected function handle_row_actions( $blog, $column_name, $primary ) {
   684 	protected function handle_row_actions( $item, $column_name, $primary ) {
   674 		if ( $primary !== $column_name ) {
   685 		if ( $primary !== $column_name ) {
   675 			return '';
   686 			return '';
   676 		}
   687 		}
   677 
   688 
       
   689 		// Restores the more descriptive, specific name for use within this method.
       
   690 		$blog     = $item;
   678 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   691 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   679 
   692 
   680 		// Preordered.
   693 		// Preordered.
   681 		$actions = array(
   694 		$actions = array(
   682 			'edit'       => '',
   695 			'edit'       => '',