mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Use site objects rather than get_blog_status() in MS list tables.
Removes several repetitive calls to `get_blog_status()` that are not needed, as the data is already available as part of each site's object. Fixes #32512. Built from https://develop.svn.wordpress.org/trunk@32630 git-svn-id: http://core.svn.wordpress.org/trunk@32600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b4eccbd5a0
commit
a5c688e817
@ -214,7 +214,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
|
||||
$blog_states = array();
|
||||
foreach ( $status_list as $status => $col ) {
|
||||
if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
|
||||
if ( $blog[ $status ] == 1 ) {
|
||||
$class = " class='{$col[0]}'";
|
||||
$blog_states[] = $col[1];
|
||||
}
|
||||
@ -283,23 +283,27 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
$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>';
|
||||
if ( get_current_site()->blog_id != $blog['blog_id'] ) {
|
||||
if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
|
||||
$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>';
|
||||
else
|
||||
$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>';
|
||||
if ( $blog['deleted'] == '1' ) {
|
||||
$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>';
|
||||
} else {
|
||||
$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>';
|
||||
}
|
||||
|
||||
if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
|
||||
$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>';
|
||||
else
|
||||
$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>';
|
||||
if ( $blog['archived'] == '1' ) {
|
||||
$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>';
|
||||
} else {
|
||||
$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>';
|
||||
}
|
||||
|
||||
if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
|
||||
$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>';
|
||||
else
|
||||
$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>';
|
||||
if ( $blog['spam'] == '1' ) {
|
||||
$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>';
|
||||
} else {
|
||||
$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>';
|
||||
}
|
||||
|
||||
if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
|
||||
$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>';
|
||||
if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
||||
$actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
|
||||
|
@ -252,14 +252,18 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
$actions['edit'] = '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>';
|
||||
|
||||
$class = '';
|
||||
if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
|
||||
if ( $val->spam == 1 ) {
|
||||
$class .= 'site-spammed ';
|
||||
if ( get_blog_status( $val->userblog_id, 'mature' ) == 1 )
|
||||
}
|
||||
if ( $val->mature == 1 ) {
|
||||
$class .= 'site-mature ';
|
||||
if ( get_blog_status( $val->userblog_id, 'deleted' ) == 1 )
|
||||
}
|
||||
if ( $val->deleted == 1 ) {
|
||||
$class .= 'site-deleted ';
|
||||
if ( get_blog_status( $val->userblog_id, 'archived' ) == 1 )
|
||||
}
|
||||
if ( $val->archived == 1 ) {
|
||||
$class .= 'site-archived ';
|
||||
}
|
||||
|
||||
$actions['view'] = '<a class="' . $class . '" href="' . esc_url( get_home_url( $val->userblog_id ) ) . '">' . __( 'View' ) . '</a>';
|
||||
|
||||
|
@ -1176,6 +1176,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
|
||||
'site_id' => $blog->site_id,
|
||||
'siteurl' => $blog->siteurl,
|
||||
'archived' => $blog->archived,
|
||||
'mature' => $blog->mature,
|
||||
'spam' => $blog->spam,
|
||||
'deleted' => $blog->deleted,
|
||||
);
|
||||
@ -1205,6 +1206,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
|
||||
'site_id' => $blog->site_id,
|
||||
'siteurl' => $blog->siteurl,
|
||||
'archived' => $blog->archived,
|
||||
'mature' => $blog->mature,
|
||||
'spam' => $blog->spam,
|
||||
'deleted' => $blog->deleted,
|
||||
);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32629';
|
||||
$wp_version = '4.3-alpha-32630';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user