wp/wp-admin/includes/class-wp-ms-sites-list-table.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     9 
     9 
    10 /**
    10 /**
    11  * Core class used to implement displaying sites in a list table for the network admin.
    11  * Core class used to implement displaying sites in a list table for the network admin.
    12  *
    12  *
    13  * @since 3.1.0
    13  * @since 3.1.0
    14  * @access private
       
    15  *
    14  *
    16  * @see WP_List_Table
    15  * @see WP_List_Table
    17  */
    16  */
    18 class WP_MS_Sites_List_Table extends WP_List_Table {
    17 class WP_MS_Sites_List_Table extends WP_List_Table {
    19 
    18 
    80 
    79 
    81 		$pagenum = $this->get_pagenum();
    80 		$pagenum = $this->get_pagenum();
    82 
    81 
    83 		$s    = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
    82 		$s    = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
    84 		$wild = '';
    83 		$wild = '';
    85 		if ( false !== strpos( $s, '*' ) ) {
    84 		if ( str_contains( $s, '*' ) ) {
    86 			$wild = '*';
    85 			$wild = '*';
    87 			$s    = trim( $s, '*' );
    86 			$s    = trim( $s, '*' );
    88 		}
    87 		}
    89 
    88 
    90 		/*
    89 		/*
   108 			'network_id' => get_current_network_id(),
   107 			'network_id' => get_current_network_id(),
   109 		);
   108 		);
   110 
   109 
   111 		if ( empty( $s ) ) {
   110 		if ( empty( $s ) ) {
   112 			// Nothing to do.
   111 			// Nothing to do.
   113 		} elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) ||
   112 		} elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s )
   114 					preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
   113 			|| preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s )
   115 					preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
   114 			|| preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s )
   116 					preg_match( '/^[0-9]{1,3}\.$/', $s ) ) {
   115 			|| preg_match( '/^[0-9]{1,3}\.$/', $s )
       
   116 		) {
   117 			// IPv4 address.
   117 			// IPv4 address.
   118 			$sql          = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) );
   118 			$sql = $wpdb->prepare(
       
   119 				"SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s",
       
   120 				$wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' )
       
   121 			);
       
   122 
   119 			$reg_blog_ids = $wpdb->get_col( $sql );
   123 			$reg_blog_ids = $wpdb->get_col( $sql );
   120 
   124 
   121 			if ( $reg_blog_ids ) {
   125 			if ( $reg_blog_ids ) {
   122 				$args['site__in'] = $reg_blog_ids;
   126 				$args['site__in'] = $reg_blog_ids;
   123 			}
   127 			}
   260 		$view_links       = array();
   264 		$view_links       = array();
   261 		$requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
   265 		$requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
   262 		$url              = 'sites.php';
   266 		$url              = 'sites.php';
   263 
   267 
   264 		foreach ( $statuses as $status => $label_count ) {
   268 		foreach ( $statuses as $status => $label_count ) {
   265 			$current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status )
       
   266 				? ' class="current" aria-current="page"'
       
   267 				: '';
       
   268 			if ( (int) $counts[ $status ] > 0 ) {
   269 			if ( (int) $counts[ $status ] > 0 ) {
   269 				$label    = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) );
   270 				$label = sprintf(
       
   271 					translate_nooped_plural( $label_count, $counts[ $status ] ),
       
   272 					number_format_i18n( $counts[ $status ] )
       
   273 				);
       
   274 
   270 				$full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
   275 				$full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
   271 
   276 
   272 				$view_links[ $status ] = sprintf(
   277 				$view_links[ $status ] = array(
   273 					'<a href="%1$s"%2$s>%3$s</a>',
   278 					'url'     => esc_url( $full_url ),
   274 					esc_url( $full_url ),
   279 					'label'   => $label,
   275 					$current_link_attributes,
   280 					'current' => $requested_status === $status || ( '' === $requested_status && 'all' === $status ),
   276 					$label
       
   277 				);
   281 				);
   278 			}
   282 			}
   279 		}
   283 		}
   280 
   284 
   281 		return $view_links;
   285 		return $this->get_views_links( $view_links );
   282 	}
   286 	}
   283 
   287 
   284 	/**
   288 	/**
   285 	 * @return array
   289 	 * @return array
   286 	 */
   290 	 */
   296 	}
   300 	}
   297 
   301 
   298 	/**
   302 	/**
   299 	 * @global string $mode List table view mode.
   303 	 * @global string $mode List table view mode.
   300 	 *
   304 	 *
   301 	 * @param string $which The location of the pagination nav markup: 'top' or 'bottom'.
   305 	 * @param string $which The location of the pagination nav markup: Either 'top' or 'bottom'.
   302 	 */
   306 	 */
   303 	protected function pagination( $which ) {
   307 	protected function pagination( $which ) {
   304 		global $mode;
   308 		global $mode;
   305 
   309 
   306 		parent::pagination( $which );
   310 		parent::pagination( $which );
   309 			$this->view_switcher( $mode );
   313 			$this->view_switcher( $mode );
   310 		}
   314 		}
   311 	}
   315 	}
   312 
   316 
   313 	/**
   317 	/**
   314 	 * Extra controls to be displayed between bulk actions and pagination.
   318 	 * Displays extra controls between bulk actions and pagination.
   315 	 *
   319 	 *
   316 	 * @since 5.3.0
   320 	 * @since 5.3.0
   317 	 *
   321 	 *
   318 	 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
   322 	 * @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'.
   319 	 */
   323 	 */
   320 	protected function extra_tablenav( $which ) {
   324 	protected function extra_tablenav( $which ) {
   321 		?>
   325 		?>
   322 		<div class="alignleft actions">
   326 		<div class="alignleft actions">
   323 		<?php
   327 		<?php
   327 			/**
   331 			/**
   328 			 * Fires before the Filter button on the MS sites list table.
   332 			 * Fires before the Filter button on the MS sites list table.
   329 			 *
   333 			 *
   330 			 * @since 5.3.0
   334 			 * @since 5.3.0
   331 			 *
   335 			 *
   332 			 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
   336 			 * @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'.
   333 			 */
   337 			 */
   334 			do_action( 'restrict_manage_sites', $which );
   338 			do_action( 'restrict_manage_sites', $which );
   335 
   339 
   336 			$output = ob_get_clean();
   340 			$output = ob_get_clean();
   337 
   341 
   347 		 * Fires immediately following the closing "actions" div in the tablenav for the
   351 		 * Fires immediately following the closing "actions" div in the tablenav for the
   348 		 * MS sites list table.
   352 		 * MS sites list table.
   349 		 *
   353 		 *
   350 		 * @since 5.3.0
   354 		 * @since 5.3.0
   351 		 *
   355 		 *
   352 		 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
   356 		 * @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'.
   353 		 */
   357 		 */
   354 		do_action( 'manage_sites_extra_tablenav', $which );
   358 		do_action( 'manage_sites_extra_tablenav', $which );
   355 	}
   359 	}
   356 
   360 
   357 	/**
   361 	/**
   358 	 * @return array
   362 	 * @return string[] Array of column titles keyed by their column name.
   359 	 */
   363 	 */
   360 	public function get_columns() {
   364 	public function get_columns() {
   361 		$sites_columns = array(
   365 		$sites_columns = array(
   362 			'cb'          => '<input type="checkbox" />',
   366 			'cb'          => '<input type="checkbox" />',
   363 			'blogname'    => __( 'URL' ),
   367 			'blogname'    => __( 'URL' ),
   383 
   387 
   384 	/**
   388 	/**
   385 	 * @return array
   389 	 * @return array
   386 	 */
   390 	 */
   387 	protected function get_sortable_columns() {
   391 	protected function get_sortable_columns() {
       
   392 
       
   393 		if ( is_subdomain_install() ) {
       
   394 			$blogname_abbr         = __( 'Domain' );
       
   395 			$blogname_orderby_text = __( 'Table ordered by Site Domain Name.' );
       
   396 		} else {
       
   397 			$blogname_abbr         = __( 'Path' );
       
   398 			$blogname_orderby_text = __( 'Table ordered by Site Path.' );
       
   399 		}
       
   400 
   388 		return array(
   401 		return array(
   389 			'blogname'    => 'blogname',
   402 			'blogname'    => array( 'blogname', false, $blogname_abbr, $blogname_orderby_text ),
   390 			'lastupdated' => 'lastupdated',
   403 			'lastupdated' => array( 'lastupdated', true, __( 'Last Updated' ), __( 'Table ordered by Last Updated.' ) ),
   391 			'registered'  => 'blog_id',
   404 			'registered'  => array( 'blog_id', true, _x( 'Registered', 'site' ), __( 'Table ordered by Site Registered Date.' ), 'desc' ),
   392 		);
   405 		);
   393 	}
   406 	}
   394 
   407 
   395 	/**
   408 	/**
   396 	 * Handles the checkbox column output.
   409 	 * Handles the checkbox column output.
   405 		$blog = $item;
   418 		$blog = $item;
   406 
   419 
   407 		if ( ! is_main_site( $blog['blog_id'] ) ) :
   420 		if ( ! is_main_site( $blog['blog_id'] ) ) :
   408 			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   421 			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   409 			?>
   422 			?>
   410 			<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>">
   423 			<input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" />
       
   424 			<label for="blog_<?php echo $blog['blog_id']; ?>">
       
   425 				<span class="screen-reader-text">
   411 				<?php
   426 				<?php
   412 				/* translators: %s: Site URL. */
   427 				/* translators: %s: Site URL. */
   413 				printf( __( 'Select %s' ), $blogname );
   428 				printf( __( 'Select %s' ), $blogname );
   414 				?>
   429 				?>
       
   430 				</span>
   415 			</label>
   431 			</label>
   416 			<input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" />
       
   417 			<?php
   432 			<?php
   418 		endif;
   433 		endif;
   419 	}
   434 	}
   420 
   435 
   421 	/**
   436 	/**
   443 
   458 
   444 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   459 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   445 
   460 
   446 		?>
   461 		?>
   447 		<strong>
   462 		<strong>
   448 			<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a>
   463 			<?php
   449 			<?php $this->site_states( $blog ); ?>
   464 			printf(
       
   465 				'<a href="%1$s" class="edit">%2$s</a>',
       
   466 				esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),
       
   467 				$blogname
       
   468 			);
       
   469 
       
   470 			$this->site_states( $blog );
       
   471 			?>
   450 		</strong>
   472 		</strong>
   451 		<?php
   473 		<?php
   452 		if ( 'list' !== $mode ) {
   474 		if ( 'list' !== $mode ) {
   453 			switch_to_blog( $blog['blog_id'] );
   475 			switch_to_blog( $blog['blog_id'] );
   454 			echo '<p>';
   476 			echo '<p>';
   479 			$date = __( 'Y/m/d' );
   501 			$date = __( 'Y/m/d' );
   480 		} else {
   502 		} else {
   481 			$date = __( 'Y/m/d g:i:s a' );
   503 			$date = __( 'Y/m/d g:i:s a' );
   482 		}
   504 		}
   483 
   505 
   484 		echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
   506 		if ( '0000-00-00 00:00:00' === $blog['last_updated'] ) {
       
   507 			_e( 'Never' );
       
   508 		} else {
       
   509 			echo mysql2date( $date, $blog['last_updated'] );
       
   510 		}
   485 	}
   511 	}
   486 
   512 
   487 	/**
   513 	/**
   488 	 * Handles the registered column output.
   514 	 * Handles the registered column output.
   489 	 *
   515 	 *
   530 			$user_count = $blog_users->get_total();
   556 			$user_count = $blog_users->get_total();
   531 			wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
   557 			wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
   532 		}
   558 		}
   533 
   559 
   534 		printf(
   560 		printf(
   535 			'<a href="%s">%s</a>',
   561 			'<a href="%1$s">%2$s</a>',
   536 			esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ),
   562 			esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ),
   537 			number_format_i18n( $user_count )
   563 			number_format_i18n( $user_count )
   538 		);
   564 		);
   539 	}
   565 	}
   540 
   566 
   568 	 *
   594 	 *
   569 	 * @param array  $item        Current site.
   595 	 * @param array  $item        Current site.
   570 	 * @param string $column_name Current column name.
   596 	 * @param string $column_name Current column name.
   571 	 */
   597 	 */
   572 	public function column_default( $item, $column_name ) {
   598 	public function column_default( $item, $column_name ) {
       
   599 		// Restores the more descriptive, specific name for use within this method.
       
   600 		$blog = $item;
       
   601 
   573 		/**
   602 		/**
   574 		 * Fires for each registered custom column in the Sites list table.
   603 		 * Fires for each registered custom column in the Sites list table.
   575 		 *
   604 		 *
   576 		 * @since 3.1.0
   605 		 * @since 3.1.0
   577 		 *
   606 		 *
   578 		 * @param string $column_name The name of the column to display.
   607 		 * @param string $column_name The name of the column to display.
   579 		 * @param int    $blog_id     The site ID.
   608 		 * @param int    $blog_id     The site ID.
   580 		 */
   609 		 */
   581 		do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
   610 		do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
   582 	}
   611 	}
   583 
   612 
   584 	/**
   613 	/**
   585 	 * @global string $mode List table view mode.
   614 	 * @global string $mode List table view mode.
   586 	 */
   615 	 */
   589 			$blog  = $blog->to_array();
   618 			$blog  = $blog->to_array();
   590 			$class = '';
   619 			$class = '';
   591 			reset( $this->status_list );
   620 			reset( $this->status_list );
   592 
   621 
   593 			foreach ( $this->status_list as $status => $col ) {
   622 			foreach ( $this->status_list as $status => $col ) {
   594 				if ( 1 == $blog[ $status ] ) {
   623 				if ( '1' === $blog[ $status ] ) {
   595 					$class = " class='{$col[0]}'";
   624 					$class = " class='{$col[0]}'";
   596 				}
   625 				}
   597 			}
   626 			}
   598 
   627 
   599 			echo "<tr{$class}>";
   628 			echo "<tr{$class}>";
   603 			echo '</tr>';
   632 			echo '</tr>';
   604 		}
   633 		}
   605 	}
   634 	}
   606 
   635 
   607 	/**
   636 	/**
   608 	 * Maybe output comma-separated site states.
   637 	 * Determines whether to output comma-separated site states.
   609 	 *
   638 	 *
   610 	 * @since 5.3.0
   639 	 * @since 5.3.0
   611 	 *
   640 	 *
   612 	 * @param array $site
   641 	 * @param array $site
   613 	 */
   642 	 */
   623 
   652 
   624 		reset( $this->status_list );
   653 		reset( $this->status_list );
   625 
   654 
   626 		$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
   655 		$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
   627 		foreach ( $this->status_list as $status => $col ) {
   656 		foreach ( $this->status_list as $status => $col ) {
   628 			if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) {
   657 			if ( '1' === $_site->{$status} && $site_status !== $status ) {
   629 				$site_states[ $col[0] ] = $col[1];
   658 				$site_states[ $col[0] ] = $col[1];
   630 			}
   659 			}
   631 		}
   660 		}
   632 
   661 
   633 		/**
   662 		/**
   649 			echo ' &mdash; ';
   678 			echo ' &mdash; ';
   650 
   679 
   651 			foreach ( $site_states as $state ) {
   680 			foreach ( $site_states as $state ) {
   652 				++$i;
   681 				++$i;
   653 
   682 
   654 				$sep = ( $i < $state_count ) ? ', ' : '';
   683 				$separator = ( $i < $state_count ) ? ', ' : '';
   655 
   684 
   656 				echo "<span class='post-state'>{$state}{$sep}</span>";
   685 				echo "<span class='post-state'>{$state}{$separator}</span>";
   657 			}
   686 			}
   658 		}
   687 		}
   659 	}
   688 	}
   660 
   689 
   661 	/**
   690 	/**
   685 		if ( $primary !== $column_name ) {
   714 		if ( $primary !== $column_name ) {
   686 			return '';
   715 			return '';
   687 		}
   716 		}
   688 
   717 
   689 		// Restores the more descriptive, specific name for use within this method.
   718 		// Restores the more descriptive, specific name for use within this method.
   690 		$blog     = $item;
   719 		$blog = $item;
       
   720 
   691 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   721 		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
   692 
   722 
   693 		// Preordered.
   723 		// Preordered.
   694 		$actions = array(
   724 		$actions = array(
   695 			'edit'       => '',
   725 			'edit'       => '',
   702 			'unspam'     => '',
   732 			'unspam'     => '',
   703 			'delete'     => '',
   733 			'delete'     => '',
   704 			'visit'      => '',
   734 			'visit'      => '',
   705 		);
   735 		);
   706 
   736 
   707 		$actions['edit']    = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>';
   737 		$actions['edit'] = sprintf(
   708 		$actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>';
   738 			'<a href="%1$s">%2$s</a>',
   709 		if ( get_network()->site_id != $blog['blog_id'] ) {
   739 			esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),
   710 			if ( '1' == $blog['deleted'] ) {
   740 			__( 'Edit' )
   711 				$actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>';
   741 		);
       
   742 
       
   743 		$actions['backend'] = sprintf(
       
   744 			'<a href="%1$s" class="edit">%2$s</a>',
       
   745 			esc_url( get_admin_url( $blog['blog_id'] ) ),
       
   746 			__( 'Dashboard' )
       
   747 		);
       
   748 
       
   749 		if ( ! is_main_site( $blog['blog_id'] ) ) {
       
   750 			if ( '1' === $blog['deleted'] ) {
       
   751 				$actions['activate'] = sprintf(
       
   752 					'<a href="%1$s">%2$s</a>',
       
   753 					esc_url(
       
   754 						wp_nonce_url(
       
   755 							network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ),
       
   756 							'activateblog_' . $blog['blog_id']
       
   757 						)
       
   758 					),
       
   759 					_x( 'Activate', 'site' )
       
   760 				);
   712 			} else {
   761 			} else {
   713 				$actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
   762 				$actions['deactivate'] = sprintf(
   714 			}
   763 					'<a href="%1$s">%2$s</a>',
   715 
   764 					esc_url(
   716 			if ( '1' == $blog['archived'] ) {
   765 						wp_nonce_url(
   717 				$actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>';
   766 							network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ),
       
   767 							'deactivateblog_' . $blog['blog_id']
       
   768 						)
       
   769 					),
       
   770 					__( 'Deactivate' )
       
   771 				);
       
   772 			}
       
   773 
       
   774 			if ( '1' === $blog['archived'] ) {
       
   775 				$actions['unarchive'] = sprintf(
       
   776 					'<a href="%1$s">%2$s</a>',
       
   777 					esc_url(
       
   778 						wp_nonce_url(
       
   779 							network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ),
       
   780 							'unarchiveblog_' . $blog['blog_id']
       
   781 						)
       
   782 					),
       
   783 					__( 'Unarchive' )
       
   784 				);
   718 			} else {
   785 			} else {
   719 				$actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>';
   786 				$actions['archive'] = sprintf(
   720 			}
   787 					'<a href="%1$s">%2$s</a>',
   721 
   788 					esc_url(
   722 			if ( '1' == $blog['spam'] ) {
   789 						wp_nonce_url(
   723 				$actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>';
   790 							network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ),
       
   791 							'archiveblog_' . $blog['blog_id']
       
   792 						)
       
   793 					),
       
   794 					_x( 'Archive', 'verb; site' )
       
   795 				);
       
   796 			}
       
   797 
       
   798 			if ( '1' === $blog['spam'] ) {
       
   799 				$actions['unspam'] = sprintf(
       
   800 					'<a href="%1$s">%2$s</a>',
       
   801 					esc_url(
       
   802 						wp_nonce_url(
       
   803 							network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ),
       
   804 							'unspamblog_' . $blog['blog_id']
       
   805 						)
       
   806 					),
       
   807 					_x( 'Not Spam', 'site' )
       
   808 				);
   724 			} else {
   809 			} else {
   725 				$actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>';
   810 				$actions['spam'] = sprintf(
       
   811 					'<a href="%1$s">%2$s</a>',
       
   812 					esc_url(
       
   813 						wp_nonce_url(
       
   814 							network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ),
       
   815 							'spamblog_' . $blog['blog_id']
       
   816 						)
       
   817 					),
       
   818 					_x( 'Spam', 'site' )
       
   819 				);
   726 			}
   820 			}
   727 
   821 
   728 			if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
   822 			if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
   729 				$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>';
   823 				$actions['delete'] = sprintf(
   730 			}
   824 					'<a href="%1$s">%2$s</a>',
   731 		}
   825 					esc_url(
   732 
   826 						wp_nonce_url(
   733 		$actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>';
   827 							network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] ),
       
   828 							'deleteblog_' . $blog['blog_id']
       
   829 						)
       
   830 					),
       
   831 					__( 'Delete' )
       
   832 				);
       
   833 			}
       
   834 		}
       
   835 
       
   836 		$actions['visit'] = sprintf(
       
   837 			'<a href="%1$s" rel="bookmark">%2$s</a>',
       
   838 			esc_url( get_home_url( $blog['blog_id'], '/' ) ),
       
   839 			__( 'Visit' )
       
   840 		);
   734 
   841 
   735 		/**
   842 		/**
   736 		 * Filters the action links displayed for each site in the Sites list table.
   843 		 * Filters the action links displayed for each site in the Sites list table.
   737 		 *
   844 		 *
   738 		 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
   845 		 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by