2010-10-25 04:57:43 +02:00
< ? php
/**
2010-10-25 06:04:18 +02:00
* Sites List Table class .
2010-10-25 04:57:43 +02:00
*
* @ package WordPress
2010-10-25 06:04:18 +02:00
* @ subpackage List_Table
* @ since 3.1 . 0
2011-01-16 22:47:24 +01:00
* @ access private
2010-10-25 04:57:43 +02:00
*/
2010-11-04 09:07:03 +01:00
class WP_MS_Sites_List_Table extends WP_List_Table {
2010-10-25 04:57:43 +02:00
2014-08-10 04:17:14 +02:00
/**
* Constructor .
2014-09-04 17:22:58 +02:00
*
2014-08-10 04:17:14 +02:00
* @ since 3.1 . 0
2014-08-10 04:21:56 +02:00
* @ access public
2014-08-10 04:17:14 +02:00
*
* @ see WP_List_Table :: __construct () for more information on default arguments .
*
* @ param array $args An associative array of arguments .
2014-09-04 17:22:58 +02:00
*/
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
public function __construct ( $args = array () ) {
2011-04-29 22:05:12 +02:00
parent :: __construct ( array (
2010-10-25 04:57:43 +02:00
'plural' => 'sites' ,
2012-09-19 14:43:31 +02:00
'screen' => isset ( $args [ 'screen' ] ) ? $args [ 'screen' ] : null ,
2010-10-25 04:57:43 +02:00
) );
}
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
public function ajax_user_can () {
2010-12-16 10:18:28 +01:00
return current_user_can ( 'manage_sites' );
2010-10-25 04:57:43 +02:00
}
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
public function prepare_items () {
2013-11-13 04:22:48 +01:00
global $s , $mode , $wpdb ;
$current_site = get_current_site ();
2010-10-25 04:57:43 +02:00
$mode = ( empty ( $_REQUEST [ 'mode' ] ) ) ? 'list' : $_REQUEST [ 'mode' ];
$per_page = $this -> get_items_per_page ( 'sites_network_per_page' );
$pagenum = $this -> get_pagenum ();
2013-03-01 18:00:25 +01:00
$s = isset ( $_REQUEST [ 's' ] ) ? wp_unslash ( trim ( $_REQUEST [ 's' ] ) ) : '' ;
2010-11-03 20:26:23 +01:00
$wild = '' ;
if ( false !== strpos ( $s , '*' ) ) {
$wild = '%' ;
$s = trim ( $s , '*' );
}
2014-07-17 11:13:53 +02:00
/*
* If the network is large and a search is not being performed , show only
* the latest blogs with no paging in order to avoid expensive count queries .
*/
2011-10-03 18:30:07 +02:00
if ( ! $s && wp_is_large_network () ) {
2010-11-01 18:53:03 +01:00
if ( ! isset ( $_REQUEST [ 'orderby' ]) )
2010-12-30 19:06:33 +01:00
$_GET [ 'orderby' ] = $_REQUEST [ 'orderby' ] = '' ;
2010-11-01 18:53:03 +01:00
if ( ! isset ( $_REQUEST [ 'order' ]) )
$_GET [ 'order' ] = $_REQUEST [ 'order' ] = 'DESC' ;
}
2010-10-25 04:57:43 +02:00
$query = " SELECT * FROM { $wpdb -> blogs } WHERE site_id = ' { $wpdb -> siteid } ' " ;
2010-11-03 19:28:02 +01:00
if ( empty ( $s ) ) {
// Nothing to do.
2011-07-15 17:42:26 +02:00
} elseif ( preg_match ( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/' , $s ) ||
preg_match ( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/' , $s ) ||
preg_match ( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/' , $s ) ||
preg_match ( '/^[0-9]{1,3}\.$/' , $s ) ) {
// IPv4 address
2014-06-10 02:43:32 +02:00
$sql = $wpdb -> prepare ( " SELECT blog_id FROM { $wpdb -> registration_log } WHERE { $wpdb -> registration_log } .IP LIKE %s " , $wpdb -> esc_like ( $s ) . $wild );
$reg_blog_ids = $wpdb -> get_col ( $sql );
2010-11-19 19:16:03 +01:00
if ( ! $reg_blog_ids )
$reg_blog_ids = array ( 0 );
2010-11-03 19:28:02 +01:00
$query = " SELECT *
2010-11-19 19:16:03 +01:00
FROM { $wpdb -> blogs }
2010-11-03 19:28:02 +01:00
WHERE site_id = '{$wpdb->siteid}'
2010-11-19 19:16:03 +01:00
AND { $wpdb -> blogs } . blog_id IN ( " . implode( ', ', $reg_blog_ids ) . " ) " ;
2010-11-03 19:28:02 +01:00
} else {
2011-07-15 17:42:26 +02:00
if ( is_numeric ( $s ) && empty ( $wild ) ) {
2014-06-10 02:43:32 +02:00
$query .= $wpdb -> prepare ( " AND ( { $wpdb -> blogs } .blog_id = %s ) " , $s );
2010-11-19 19:16:03 +01:00
} elseif ( is_subdomain_install () ) {
2014-06-10 02:43:32 +02:00
$blog_s = str_replace ( '.' . $current_site -> domain , '' , $s );
$blog_s = $wpdb -> esc_like ( $blog_s ) . $wild . $wpdb -> esc_like ( '.' . $current_site -> domain );
$query .= $wpdb -> prepare ( " AND ( { $wpdb -> blogs } .domain LIKE %s ) " , $blog_s );
2010-11-03 19:28:02 +01:00
} else {
2014-06-10 02:43:32 +02:00
if ( $s != trim ( '/' , $current_site -> path ) ) {
$blog_s = $wpdb -> esc_like ( $current_site -> path . $s ) . $wild . $wpdb -> esc_like ( '/' );
} else {
$blog_s = $wpdb -> esc_like ( $s );
}
$query .= $wpdb -> prepare ( " AND ( { $wpdb -> blogs } .path LIKE %s ) " , $blog_s );
2010-10-25 04:57:43 +02:00
}
}
2010-12-30 19:06:33 +01:00
$order_by = isset ( $_REQUEST [ 'orderby' ] ) ? $_REQUEST [ 'orderby' ] : '' ;
2010-10-25 04:57:43 +02:00
if ( $order_by == 'registered' ) {
$query .= ' ORDER BY registered ' ;
} elseif ( $order_by == 'lastupdated' ) {
$query .= ' ORDER BY last_updated ' ;
} elseif ( $order_by == 'blogname' ) {
2010-12-30 19:06:33 +01:00
if ( is_subdomain_install () )
$query .= ' ORDER BY domain ' ;
else
$query .= ' ORDER BY path ' ;
} elseif ( $order_by == 'blog_id' ) {
$query .= ' ORDER BY blog_id ' ;
2010-10-25 04:57:43 +02:00
} else {
2010-11-19 19:16:03 +01:00
$order_by = null ;
2010-10-25 04:57:43 +02:00
}
2010-11-19 19:16:03 +01:00
if ( isset ( $order_by ) ) {
$order = ( isset ( $_REQUEST [ 'order' ] ) && 'DESC' == strtoupper ( $_REQUEST [ 'order' ] ) ) ? " DESC " : " ASC " ;
$query .= $order ;
}
2010-10-25 04:57:43 +02:00
2010-11-01 18:53:03 +01:00
// Don't do an unbounded count on large networks
2011-10-03 18:30:07 +02:00
if ( ! wp_is_large_network () )
2010-11-01 18:53:03 +01:00
$total = $wpdb -> get_var ( str_replace ( 'SELECT *' , 'SELECT COUNT( blog_id )' , $query ) );
2010-10-25 04:57:43 +02:00
$query .= " LIMIT " . intval ( ( $pagenum - 1 ) * $per_page ) . " , " . intval ( $per_page );
$this -> items = $wpdb -> get_results ( $query , ARRAY_A );
2011-10-03 18:30:07 +02:00
if ( wp_is_large_network () )
2010-11-01 18:53:03 +01:00
$total = count ( $this -> items );
2010-10-25 04:57:43 +02:00
$this -> set_pagination_args ( array (
'total_items' => $total ,
'per_page' => $per_page ,
) );
}
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
public function no_items () {
2010-10-25 04:57:43 +02:00
_e ( 'No sites found.' );
}
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
protected function get_bulk_actions () {
2010-10-25 04:57:43 +02:00
$actions = array ();
2010-11-12 17:35:28 +01:00
if ( current_user_can ( 'delete_sites' ) )
$actions [ 'delete' ] = __ ( 'Delete' );
2010-10-25 04:57:43 +02:00
$actions [ 'spam' ] = _x ( 'Mark as Spam' , 'site' );
$actions [ 'notspam' ] = _x ( 'Not Spam' , 'site' );
return $actions ;
}
2014-12-01 01:32:19 +01:00
/**
* @ param string $which
*/
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
protected function pagination ( $which ) {
2010-10-25 04:57:43 +02:00
global $mode ;
parent :: pagination ( $which );
if ( 'top' == $which )
$this -> view_switcher ( $mode );
}
2014-07-12 05:26:40 +02:00
public function get_columns () {
2010-10-25 04:57:43 +02:00
$blogname_columns = ( is_subdomain_install () ) ? __ ( 'Domain' ) : __ ( 'Path' );
$sites_columns = array (
'cb' => '<input type="checkbox" />' ,
'blogname' => $blogname_columns ,
'lastupdated' => __ ( 'Last Updated' ),
'registered' => _x ( 'Registered' , 'site' ),
'users' => __ ( 'Users' )
);
if ( has_filter ( 'wpmublogsaction' ) )
$sites_columns [ 'plugins' ] = __ ( 'Actions' );
2013-11-23 22:57:24 +01:00
/**
* Filter the displayed site columns in Sites list table .
*
* @ since MU
*
* @ param array $sites_columns An array of displayed site columns . Default 'cb' ,
* 'blogname' , 'lastupdated' , 'registered' , 'users' .
*/
2010-10-25 04:57:43 +02:00
$sites_columns = apply_filters ( 'wpmu_blogs_columns' , $sites_columns );
return $sites_columns ;
}
Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`
See #27881, #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 03:16:16 +02:00
protected function get_sortable_columns () {
2010-10-25 04:57:43 +02:00
return array (
'blogname' => 'blogname' ,
'lastupdated' => 'lastupdated' ,
2010-12-30 19:06:33 +01:00
'registered' => 'blog_id' ,
2010-10-25 04:57:43 +02:00
);
}
2014-07-14 17:41:53 +02:00
public function display_rows () {
2013-11-13 04:22:48 +01:00
global $mode ;
2010-10-25 04:57:43 +02:00
$status_list = array (
'archived' => array ( 'site-archived' , __ ( 'Archived' ) ),
'spam' => array ( 'site-spammed' , _x ( 'Spam' , 'site' ) ),
'deleted' => array ( 'site-deleted' , __ ( 'Deleted' ) ),
'mature' => array ( 'site-mature' , __ ( 'Mature' ) )
);
2014-06-29 20:10:52 +02:00
if ( 'list' == $mode ) {
2015-03-19 17:21:46 +01:00
$date = __ ( 'Y/m/d' );
2014-06-29 20:10:52 +02:00
} else {
2015-03-19 17:21:46 +01:00
$date = __ ( 'Y/m/d g:i:s a' );
2014-06-29 20:10:52 +02:00
}
2010-10-25 04:57:43 +02:00
foreach ( $this -> items as $blog ) {
2015-01-14 23:13:03 +01:00
$class = '' ;
2010-10-25 04:57:43 +02:00
reset ( $status_list );
$blog_states = array ();
foreach ( $status_list as $status => $col ) {
if ( get_blog_status ( $blog [ 'blog_id' ], $status ) == 1 ) {
2015-01-14 23:13:03 +01:00
$class = " class=' { $col [ 0 ] } ' " ;
2010-10-25 04:57:43 +02:00
$blog_states [] = $col [ 1 ];
}
}
$blog_state = '' ;
if ( ! empty ( $blog_states ) ) {
$state_count = count ( $blog_states );
$i = 0 ;
$blog_state .= ' - ' ;
foreach ( $blog_states as $state ) {
++ $i ;
( $i == $state_count ) ? $sep = '' : $sep = ', ' ;
$blog_state .= " <span class='post-state'> $state $sep </span> " ;
}
}
2015-01-14 23:13:03 +01:00
echo " <tr { $class } > " ;
2010-10-25 04:57:43 +02:00
2013-11-13 04:22:48 +01:00
$blogname = ( is_subdomain_install () ) ? str_replace ( '.' . get_current_site () -> domain , '' , $blog [ 'domain' ] ) : $blog [ 'path' ];
2010-11-17 19:47:34 +01:00
2010-10-25 04:57:43 +02:00
list ( $columns , $hidden ) = $this -> get_column_info ();
foreach ( $columns as $column_name => $column_display_name ) {
2010-11-23 12:39:50 +01:00
$style = '' ;
if ( in_array ( $column_name , $hidden ) )
$style = ' style="display:none;"' ;
2010-10-25 04:57:43 +02:00
switch ( $column_name ) {
case 'cb' : ?>
< th scope = " row " class = " check-column " >
2013-08-26 20:45:30 +02:00
< ? php if ( ! is_main_site ( $blog [ 'blog_id' ] ) ) : ?>
2012-07-25 18:18:14 +02:00
< label class = " screen-reader-text " for = " blog_<?php echo $blog['blog_id'] ; ?> " >< ? php printf ( __ ( 'Select %s' ), $blogname ); ?> </label>
2010-10-25 04:57:43 +02:00
< input type = " checkbox " id = " blog_<?php echo $blog['blog_id'] ?> " name = " allblogs[] " value = " <?php echo esc_attr( $blog['blog_id'] ) ?> " />
2013-08-26 20:45:30 +02:00
< ? php endif ; ?>
2010-10-25 04:57:43 +02:00
</ th >
< ? php
break ;
2010-11-23 12:39:50 +01:00
case 'id' : ?>
2014-01-24 20:05:15 +01:00
< th scope = " row " >
2010-10-25 04:57:43 +02:00
< ? php echo $blog [ 'blog_id' ] ?>
</ th >
< ? php
break ;
2010-11-23 12:39:50 +01:00
case 'blogname' :
echo " <td class='column- $column_name $column_name ' $style > " ; ?>
2010-10-25 04:57:43 +02:00
< a href = " <?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?> " class = " edit " >< ? php echo $blogname . $blog_state ; ?> </a>
< ? php
2012-08-03 19:51:42 +02:00
if ( 'list' != $mode ) {
switch_to_blog ( $blog [ 'blog_id' ] );
echo '<p>' . sprintf ( _x ( '%1$s – <em>%2$s</em>' , '%1$s: site name. %2$s: site tagline.' ), get_option ( 'blogname' ), get_option ( 'blogdescription ' ) ) . '</p>' ;
restore_current_blog ();
}
2010-10-25 04:57:43 +02:00
// Preordered.
$actions = array (
'edit' => '' , 'backend' => '' ,
'activate' => '' , 'deactivate' => '' ,
'archive' => '' , 'unarchive' => '' ,
'spam' => '' , 'unspam' => '' ,
'delete' => '' ,
'visit' => '' ,
);
$actions [ 'edit' ] = '<span class="edit"><a href="' . esc_url ( network_admin_url ( 'site-info.php?id=' . $blog [ 'blog_id' ] ) ) . '">' . __ ( 'Edit' ) . '</a></span>' ;
$actions [ 'backend' ] = " <span class='backend'><a href=' " . esc_url ( get_admin_url ( $blog [ 'blog_id' ] ) ) . " ' class='edit'> " . __ ( 'Dashboard' ) . '</a></span>' ;
2013-11-13 04:22:48 +01:00
if ( get_current_site () -> blog_id != $blog [ 'blog_id' ] ) {
2010-10-25 04:57:43 +02:00
if ( get_blog_status ( $blog [ 'blog_id' ], 'deleted' ) == '1' )
2011-08-18 04:29:06 +02:00
$actions [ 'activate' ] = '<span class="activate"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=activateblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __ ( 'Activate' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
else
2011-08-18 04:29:06 +02:00
$actions [ 'deactivate' ] = '<span class="activate"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __ ( 'Deactivate' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
if ( get_blog_status ( $blog [ 'blog_id' ], 'archived' ) == '1' )
2011-12-14 00:45:31 +01:00
$actions [ 'unarchive' ] = '<span class="archive"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __ ( 'Unarchive' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
else
2011-08-18 04:29:06 +02:00
$actions [ 'archive' ] = '<span class="archive"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x ( 'Archive' , 'verb; site' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
if ( get_blog_status ( $blog [ 'blog_id' ], 'spam' ) == '1' )
2011-08-18 04:29:06 +02:00
$actions [ 'unspam' ] = '<span class="spam"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x ( 'Not Spam' , 'site' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
else
2011-08-18 04:29:06 +02:00
$actions [ 'spam' ] = '<span class="spam"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=spamblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x ( 'Spam' , 'site' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
2010-11-12 17:35:28 +01:00
if ( current_user_can ( 'delete_site' , $blog [ 'blog_id' ] ) )
2011-08-18 04:29:06 +02:00
$actions [ 'delete' ] = '<span class="delete"><a href="' . esc_url ( wp_nonce_url ( network_admin_url ( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog [ 'blog_id' ] . '&msg=' . urlencode ( sprintf ( __ ( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __ ( 'Delete' ) . '</a></span>' ;
2010-10-25 04:57:43 +02:00
}
2012-10-11 19:48:42 +02:00
$actions [ 'visit' ] = " <span class='view'><a href=' " . esc_url ( get_home_url ( $blog [ 'blog_id' ], '/' ) ) . " ' rel='permalink'> " . __ ( 'Visit' ) . '</a></span>' ;
2010-12-03 13:12:44 +01:00
2013-11-23 22:57:24 +01:00
/**
* Filter the action links displayed for each site in the Sites list table .
*
* The 'Edit' , 'Dashboard' , 'Delete' , and 'Visit' links are displayed by
* default for each site . The site ' s status determines whether to show the
* 'Activate' or 'Deactivate' link , 'Unarchive' or 'Archive' links , and
* 'Not Spam' or 'Spam' link for each site .
*
* @ since 3.1 . 0
*
* @ param array $actions An array of action links to be displayed .
* @ param int $blog_id The site ID .
* @ param string $blogname Site path , formatted depending on whether it is a sub - domain
* or subdirectory multisite install .
*/
2010-12-03 13:12:44 +01:00
$actions = apply_filters ( 'manage_sites_action_links' , array_filter ( $actions ), $blog [ 'blog_id' ], $blogname );
2010-10-25 04:57:43 +02:00
echo $this -> row_actions ( $actions );
?>
</ td >
< ? php
break ;
2010-11-23 12:39:50 +01:00
case 'lastupdated' :
2014-01-24 20:05:15 +01:00
echo " <td class=' $column_name column- $column_name ' $style > " ;
2010-10-25 04:57:43 +02:00
echo ( $blog [ 'last_updated' ] == '0000-00-00 00:00:00' ) ? __ ( 'Never' ) : mysql2date ( $date , $blog [ 'last_updated' ] ); ?>
</ td >
< ? php
break ;
2010-11-23 12:39:50 +01:00
case 'registered' :
2014-01-24 20:05:15 +01:00
echo " <td class=' $column_name column- $column_name ' $style > " ;
2010-10-25 04:57:43 +02:00
if ( $blog [ 'registered' ] == '0000-00-00 00:00:00' )
echo '—' ;
else
echo mysql2date ( $date , $blog [ 'registered' ] );
?>
</ td >
2010-11-01 09:43:24 +01:00
< ? php
break ;
2010-11-23 12:39:50 +01:00
case 'users' :
2014-01-24 20:05:15 +01:00
echo " <td class=' $column_name column- $column_name ' $style > " ;
2010-10-25 04:57:43 +02:00
$blogusers = get_users ( array ( 'blog_id' => $blog [ 'blog_id' ], 'number' => 6 ) );
if ( is_array ( $blogusers ) ) {
$blogusers_warning = '' ;
if ( count ( $blogusers ) > 5 ) {
$blogusers = array_slice ( $blogusers , 0 , 5 );
2011-01-20 23:08:24 +01:00
$blogusers_warning = __ ( 'Only showing first 5 users.' ) . ' <a href="' . esc_url ( network_admin_url ( 'site-users.php?id=' . $blog [ 'blog_id' ] ) ) . '">' . __ ( 'More' ) . '</a>' ;
2010-10-25 04:57:43 +02:00
}
foreach ( $blogusers as $user_object ) {
2011-01-20 23:08:24 +01:00
echo '<a href="' . esc_url ( network_admin_url ( 'user-edit.php?user_id=' . $user_object -> ID ) ) . '">' . esc_html ( $user_object -> user_login ) . '</a> ' ;
2010-10-25 04:57:43 +02:00
if ( 'list' != $mode )
echo '( ' . $user_object -> user_email . ' )' ;
echo '<br />' ;
}
if ( $blogusers_warning != '' )
echo '<strong>' . $blogusers_warning . '</strong><br />' ;
}
?>
</ td >
< ? php
break ;
2010-11-01 09:43:24 +01:00
case 'plugins' : ?>
2010-11-28 18:39:44 +01:00
< ? php if ( has_filter ( 'wpmublogsaction' ) ) {
2014-01-24 20:05:15 +01:00
echo " <td class=' $column_name column- $column_name ' $style > " ;
2013-11-23 22:57:24 +01:00
/**
* Fires inside the auxiliary 'Actions' column of the Sites list table .
*
* By default this column is hidden unless something is hooked to the action .
*
* @ since MU
*
* @ param int $blog_id The site ID .
*/
2010-11-28 18:39:44 +01:00
do_action ( 'wpmublogsaction' , $blog [ 'blog_id' ] ); ?>
</ td >
< ? php }
break ;
2010-12-13 22:21:50 +01:00
2010-11-23 12:39:50 +01:00
default :
echo " <td class=' $column_name column- $column_name ' $style > " ;
2013-11-23 22:57:24 +01:00
/**
* Fires for each registered custom column in the Sites list table .
*
* @ since 3.1 . 0
*
* @ param string $column_name The name of the column to display .
* @ param int $blog_id The site ID .
*/
2010-11-23 14:50:23 +01:00
do_action ( 'manage_sites_custom_column' , $column_name , $blog [ 'blog_id' ] );
2010-11-23 12:39:50 +01:00
echo " </td> " ;
break ;
2010-10-25 04:57:43 +02:00
}
}
?>
</ tr >
< ? php
}
}
}