Use get_current_site() instead of the $current_site global when possible.

props jeremyfelt.
fixes #25158.
Built from https://develop.svn.wordpress.org/trunk@26120


git-svn-id: http://core.svn.wordpress.org/trunk@26032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2013-11-13 03:23:10 +00:00
parent fdc8f7dcff
commit 74f77b85a6
16 changed files with 54 additions and 58 deletions

View File

@@ -21,7 +21,9 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
function prepare_items() {
global $s, $mode, $wpdb, $current_site;
global $s, $mode, $wpdb;
$current_site = get_current_site();
$mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
@@ -168,7 +170,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
function display_rows() {
global $current_site, $mode;
global $mode;
$status_list = array(
'archived' => array( 'site-archived', __( 'Archived' ) ),
@@ -202,7 +204,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
echo "<tr class='$class'>";
$blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
$blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path'];
list( $columns, $hidden ) = $this->get_column_info();
@@ -251,7 +253,7 @@ 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 ( $current_site->blog_id != $blog['blog_id'] ) {
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&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
else

View File

@@ -133,7 +133,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
}
function display_rows() {
global $current_site, $mode;
global $mode;
$alt = '';
$super_admins = get_super_admins();
@@ -223,7 +223,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$path = ( $val->path == '/' ) ? '' : $val->path;
echo '<span class="site-' . $val->site_id . '" >';
echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_current_site()->domain, '', $val->domain . $path ) . '</a>';
echo ' <small class="row-actions">';
$actions = array();
$actions['edit'] = '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>';

View File

@@ -52,7 +52,7 @@ add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
* @return void
*/
function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb, $current_site;
global $wpdb;
$switch = false;
if ( get_current_blog_id() != $blog_id ) {
@@ -82,6 +82,8 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
update_blog_status( $blog_id, 'deleted', 1 );
$current_site = get_current_site();
// Don't destroy the initial, main, or root blog.
if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) )
$drop = false;

View File

@@ -327,7 +327,7 @@ $wp_queries = wp_get_db_schema( 'all' );
* @uses $wp_db_version
*/
function populate_options() {
global $wpdb, $wp_db_version, $current_site, $wp_current_db_version;
global $wpdb, $wp_db_version, $wp_current_db_version;
$guessurl = wp_guess_url();
/**
@@ -495,7 +495,7 @@ function populate_options() {
// 3.0 multisite
if ( is_multisite() ) {
/* translators: blog tagline */
$options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name );
$options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name );
$options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/';
}

View File

@@ -100,8 +100,8 @@ if ( !function_exists('wp_install_defaults') ) :
*
* @param int $user_id User ID.
*/
function wp_install_defaults($user_id) {
global $wpdb, $wp_rewrite, $current_site, $table_prefix;
function wp_install_defaults( $user_id ) {
global $wpdb, $wp_rewrite, $table_prefix;
// Default category
$cat_name = __('Uncategorized');
@@ -135,7 +135,7 @@ function wp_install_defaults($user_id) {
$first_post = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' );
$first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post );
$first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
$first_post = str_replace( "SITE_NAME", get_current_site()->site_name, $first_post );
} else {
$first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
}