web/wp-admin/includes/class-wp-ms-sites-list-table.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     7  * @since 3.1.0
     7  * @since 3.1.0
     8  * @access private
     8  * @access private
     9  */
     9  */
    10 class WP_MS_Sites_List_Table extends WP_List_Table {
    10 class WP_MS_Sites_List_Table extends WP_List_Table {
    11 
    11 
    12 	function __construct() {
    12 	function __construct( $args = array() ) {
    13 		parent::__construct( array(
    13 		parent::__construct( array(
    14 			'plural' => 'sites',
    14 			'plural' => 'sites',
       
    15 			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
    15 		) );
    16 		) );
    16 	}
    17 	}
    17 
    18 
    18 	function ajax_user_can() {
    19 	function ajax_user_can() {
    19 		return current_user_can( 'manage_sites' );
    20 		return current_user_can( 'manage_sites' );
   211 					$style = ' style="display:none;"';
   212 					$style = ' style="display:none;"';
   212 
   213 
   213 				switch ( $column_name ) {
   214 				switch ( $column_name ) {
   214 					case 'cb': ?>
   215 					case 'cb': ?>
   215 						<th scope="row" class="check-column">
   216 						<th scope="row" class="check-column">
       
   217 							<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
   216 							<input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
   218 							<input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
   217 						</th>
   219 						</th>
   218 					<?php
   220 					<?php
   219 					break;
   221 					break;
   220 
   222 
   227 
   229 
   228 					case 'blogname':
   230 					case 'blogname':
   229 						echo "<td class='column-$column_name $column_name'$style>"; ?>
   231 						echo "<td class='column-$column_name $column_name'$style>"; ?>
   230 							<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
   232 							<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
   231 							<?php
   233 							<?php
   232 							if ( 'list' != $mode )
   234 							if ( 'list' != $mode ) {
   233 								echo '<p>' . sprintf( _x( '%1$s &#8211; <em>%2$s</em>', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '</p>';
   235 								switch_to_blog( $blog['blog_id'] );
       
   236 								echo '<p>' . sprintf( _x( '%1$s &#8211; <em>%2$s</em>', '%1$s: site name. %2$s: site tagline.' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
       
   237 								restore_current_blog();
       
   238 							}
   234 
   239 
   235 							// Preordered.
   240 							// Preordered.
   236 							$actions = array(
   241 							$actions = array(
   237 								'edit' => '', 'backend' => '',
   242 								'edit' => '', 'backend' => '',
   238 								'activate' => '', 'deactivate' => '',
   243 								'activate' => '', 'deactivate' => '',
   262 
   267 
   263 								if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
   268 								if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
   264 									$actions['delete']	= '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';
   269 									$actions['delete']	= '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';
   265 							}
   270 							}
   266 
   271 
   267 							$actions['visit']	= "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
   272 							$actions['visit']	= "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
   268 
   273 
   269 							$actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
   274 							$actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
   270 							echo $this->row_actions( $actions );
   275 							echo $this->row_actions( $actions );
   271 					?>
   276 					?>
   272 						</td>
   277 						</td>