WordPress.org

Make WordPress Core

Changeset 38814


Ignore:
Timestamp:
10/19/2016 04:46:14 AM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Use get_network() and get_current_network_id() for current network data.

get_network() falls back to the current network when called without any arguments. Between this and get_current_network_id(), we can replace almost all instances of the global $current_site and all instances of get_current_site().

This effectively deprecates get_current_site(), something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

Location:
trunk/src
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-header.php

    r38705 r38814  
    3434
    3535if ( is_network_admin() )
    36     $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_current_site()->site_name ) );
     36    $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) );
    3737elseif ( is_user_admin() )
    38     $admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_current_site()->site_name ) );
     38    $admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) );
    3939else
    4040    $admin_title = get_bloginfo( 'name' );
  • trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php

    r38201 r38814  
    519519        $actions['edit']    = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>';
    520520        $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>';
    521         if ( get_current_site()->blog_id != $blog['blog_id'] ) {
     521        if ( get_network()->site_id != $blog['blog_id'] ) {
    522522            if ( $blog['deleted'] == '1' ) {
    523523                $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>';
  • trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php

    r37488 r38814  
    330330            $path   = ( $val->path === '/' ) ? '' : $val->path;
    331331            echo '<span class="site-' . $val->site_id . '" >';
    332             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>';
     332            echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_network()->domain, '', $val->domain . $path ) . '</a>';
    333333            echo ' <small class="row-actions">';
    334334            $actions = array();
  • trunk/src/wp-admin/includes/ms.php

    r38334 r38814  
    8989    update_blog_status( $blog_id, 'deleted', 1 );
    9090
    91     $current_site = get_current_site();
     91    $current_network = get_network();
    9292
    9393    // If a full blog object is not available, do not destroy anything.
     
    9797
    9898    // Don't destroy the initial, main, or root blog.
    99     if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) {
     99    if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_network->path && $blog->domain == $current_network->domain ) ) ) {
    100100        $drop = false;
    101101    }
  • trunk/src/wp-admin/includes/schema.php

    r38590 r38814  
    528528    if ( is_multisite() ) {
    529529        /* translators: site tagline */
    530         $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name );
     530        $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_network()->site_name );
    531531        $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/';
    532532    }
  • trunk/src/wp-admin/includes/upgrade.php

    r38591 r38814  
    162162
    163163        $first_post = sprintf( $first_post,
    164             sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_current_site()->site_name )
     164            sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_network()->site_name )
    165165        );
    166166
    167167        // Back-compat for pre-4.4
    168168        $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post );
    169         $first_post = str_replace( 'SITE_NAME', get_current_site()->site_name, $first_post );
     169        $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
    170170    } else {
    171171        $first_post = __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' );
  • trunk/src/wp-admin/ms-delete-site.php

    r38633 r38814  
    1919    if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
    2020        wpmu_delete_blog( $wpdb->blogid );
    21         wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );
     21        wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_network()->site_name ) );
    2222    } else {
    2323        wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
     
    7171    $content = str_replace( '###USERNAME###', $user->user_login, $content );
    7272    $content = str_replace( '###URL_DELETE###', $url_delete, $content );
    73     $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
     73    $content = str_replace( '###SITE_NAME###', get_network()->site_name, $content );
    7474
    7575    wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content );
     
    8080<?php } else {
    8181    ?>
    82     <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>
     82    <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), get_network()->site_name); ?></p>
    8383    <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
    8484
  • trunk/src/wp-admin/network/settings.php

    r38721 r38814  
    105105                <th scope="row"><label for="site_name"><?php _e( 'Network Title' ) ?></label></th>
    106106                <td>
    107                     <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />
     107                    <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( get_network()->site_name ) ?>" />
    108108                </td>
    109109            </tr>
  • trunk/src/wp-admin/network/site-new.php

    r38721 r38814  
    8787
    8888    if ( is_subdomain_install() ) {
    89         $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    90         $path      = $current_site->path;
     89        $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', get_network()->domain );
     90        $path      = get_network()->path;
    9191    } else {
    92         $newdomain = $current_site->domain;
    93         $path      = $current_site->path . $domain . '/';
     92        $newdomain = get_network()->domain;
     93        $path      = get_network()->path . $domain . '/';
    9494    }
    9595
     
    127127
    128128    $wpdb->hide_errors();
    129     $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, $current_site->id );
     129    $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, get_current_network_id() );
    130130    $wpdb->show_errors();
    131131    if ( ! is_wp_error( $id ) ) {
     
    139139                /* translators: %s: network name */
    140140                __( '[%s] New Site Created' ),
    141                 $current_site->site_name
     141                get_network()->site_name
    142142            ),
    143143            sprintf(
     
    199199            <td>
    200200            <?php if ( is_subdomain_install() ) { ?>
    201                 <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>
     201                <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span>
    202202            <?php } else {
    203                 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc"  autocapitalize="none" autocorrect="off" />
     203                echo get_network()->domain . get_network()->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc"  autocapitalize="none" autocorrect="off" />
    204204            <?php }
    205205            echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>';
  • trunk/src/wp-admin/network/sites.php

    r38721 r38814  
    8888        }
    8989
    90         if ( $current_site->blog_id == $id ) {
     90        if ( get_network()->site_id == $id ) {
    9191            wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
    9292        }
     
    127127
    128128            $updated_action = 'not_deleted';
    129             if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
     129            if ( $id != '0' && $id != get_network()->site_id && current_user_can( 'delete_site', $id ) ) {
    130130                wpmu_delete_blog( $id, true );
    131131                $updated_action = 'delete';
     
    138138
    139139                foreach ( (array) $_POST['allblogs'] as $key => $val ) {
    140                     if ( $val != '0' && $val != $current_site->blog_id ) {
     140                    if ( $val != '0' && $val != get_network()->site_id ) {
    141141                        switch ( $doaction ) {
    142142                            case 'delete':
  • trunk/src/wp-admin/network/users.php

    r38721 r38814  
    7373                                $blogs = get_blogs_of_user( $user_id, true );
    7474                                foreach ( (array) $blogs as $details ) {
    75                                     if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
     75                                    if ( $details->userblog_id != get_network()->site_id ) // main blog not a spam !
    7676                                        update_blog_status( $details->userblog_id, 'spam', '1' );
    7777                                }
  • trunk/src/wp-includes/admin-bar.php

    r38810 r38814  
    313313    if ( is_network_admin() ) {
    314314        /* translators: %s: site name */
    315         $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_current_site()->site_name ) );
     315        $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) );
    316316    } elseif ( is_user_admin() ) {
    317317        /* translators: %s: site name */
    318         $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_current_site()->site_name ) );
     318        $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) );
    319319    }
    320320
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r38775 r38814  
    629629        foreach ( $blogs as $blog ) {
    630630            // Don't include blogs that aren't hosted at this site.
    631             if ( $blog->site_id != get_current_site()->id )
     631            if ( $blog->site_id != get_current_network_id() )
    632632                continue;
    633633
  • trunk/src/wp-includes/functions.php

    r38810 r38814  
    43034303 * @since 3.0.0
    43044304 *
    4305  * @global object $current_site
    4306  *
    43074305 * @param int $site_id Optional. Site ID to test. Defaults to current site.
    43084306 * @return bool True if $site_id is the main site of the network, or if not
     
    43104308 */
    43114309function is_main_site( $site_id = null ) {
    4312     // This is the current network's information; 'site' is old terminology.
    4313     global $current_site;
    4314 
    43154310    if ( ! is_multisite() )
    43164311        return true;
     
    43194314        $site_id = get_current_blog_id();
    43204315
    4321     return (int) $site_id === (int) $current_site->blog_id;
     4316    return (int) $site_id === (int) get_network()->site_id;
    43224317}
    43234318
     
    43354330    }
    43364331
    4337     $current_network_id = (int) get_current_site()->id;
    4338 
    43394332    if ( null === $network_id ) {
    4340         $network_id = $current_network_id;
     4333        $network_id = get_current_network_id();
    43414334    }
    43424335
     
    43584351    }
    43594352
    4360     $current_site = get_current_site();
     4353    $current_network = get_network();
    43614354
    43624355    if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
    43634356        $main_network_id = PRIMARY_NETWORK_ID;
    4364     } elseif ( isset( $current_site->id ) && 1 === (int) $current_site->id ) {
     4357    } elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) {
    43654358        // If the current network has an ID of 1, assume it is the main network.
    43664359        $main_network_id = 1;
  • trunk/src/wp-includes/http.php

    r38730 r38814  
    618618    if ( $is_external )
    619619        return $is_external;
    620     if ( $host === get_current_site()->domain )
     620    if ( $host === get_network()->domain )
    621621        return true;
    622622    if ( isset( $queried[ $host ] ) )
  • trunk/src/wp-includes/link-template.php

    r38698 r38814  
    32563256        return site_url($path, $scheme);
    32573257
    3258     $current_site = get_current_site();
     3258    $current_network = get_network();
    32593259
    32603260    if ( 'relative' == $scheme )
    3261         $url = $current_site->path;
     3261        $url = $current_network->path;
    32623262    else
    3263         $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     3263        $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
    32643264
    32653265    if ( $path && is_string( $path ) )
     
    32983298        return home_url($path, $scheme);
    32993299
    3300     $current_site = get_current_site();
     3300    $current_network = get_network();
    33013301    $orig_scheme = $scheme;
    33023302
     
    33053305
    33063306    if ( 'relative' == $scheme )
    3307         $url = $current_site->path;
     3307        $url = $current_network->path;
    33083308    else
    3309         $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     3309        $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
    33103310
    33113311    if ( $path && is_string( $path ) )
  • trunk/src/wp-includes/load.php

    r38636 r38814  
    815815 * @since 4.6.0
    816816 *
    817  * @global WP_Network $current_site The current network.
    818  *
    819817 * @return int The ID of the current network.
    820818 */
     
    824822    }
    825823
    826     $current_site = get_current_site();
    827 
    828     if ( ! isset( $current_site->id ) ) {
     824    $current_network = get_network();
     825
     826    if ( ! isset( $current_network->id ) ) {
    829827        return get_main_network_id();
    830828    }
    831829
    832     return absint( $current_site->id );
     830    return absint( $current_network->id );
    833831}
    834832
  • trunk/src/wp-includes/ms-blogs.php

    r38659 r38814  
    8282 */
    8383function get_id_from_blogname( $slug ) {
    84     $current_site = get_current_site();
     84    $current_network = get_network();
    8585    $slug = trim( $slug, '/' );
    8686
    8787    if ( is_subdomain_install() ) {
    88         $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    89         $path = $current_site->path;
     88        $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain );
     89        $path = $current_network->path;
    9090    } else {
    91         $domain = $current_site->domain;
    92         $path = $current_site->path . $slug . '/';
     91        $domain = $current_network->domain;
     92        $path = $current_network->path . $slug . '/';
    9393    }
    9494
  • trunk/src/wp-includes/ms-default-constants.php

    r37985 r38814  
    4848 */
    4949function ms_cookie_constants(  ) {
    50     $current_site = get_current_site();
     50    $current_network = get_network();
    5151
    5252    /**
     
    5454     */
    5555    if ( !defined( 'COOKIEPATH' ) )
    56         define( 'COOKIEPATH', $current_site->path );
     56        define( 'COOKIEPATH', $current_network->path );
    5757
    5858    /**
     
    6060     */
    6161    if ( !defined( 'SITECOOKIEPATH' ) )
    62         define( 'SITECOOKIEPATH', $current_site->path );
     62        define( 'SITECOOKIEPATH', $current_network->path );
    6363
    6464    /**
     
    7777     */
    7878    if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
    79         if ( !empty( $current_site->cookie_domain ) )
    80             define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
     79        if ( !empty( $current_network->cookie_domain ) )
     80            define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain);
    8181        else
    82             define('COOKIE_DOMAIN', '.' . $current_site->domain);
     82            define('COOKIE_DOMAIN', '.' . $current_network->domain);
    8383    }
    8484}
  • trunk/src/wp-includes/ms-deprecated.php

    r38458 r38814  
    2929        return get_blog_details( $blog );
    3030
    31     return get_blog_details( get_current_site()->blog_id );
     31    return get_blog_details( get_network()->site_id );
    3232}
    3333
  • trunk/src/wp-includes/ms-functions.php

    r38655 r38814  
    547547    global $wpdb, $domain;
    548548
    549     $current_site = get_current_site();
    550     $base = $current_site->path;
     549    $current_network = get_network();
     550    $base = $current_network->path;
    551551
    552552    $blog_title = strip_tags( $blog_title );
     
    581581
    582582    // do not allow users to create a blog that conflicts with a page on the main blog.
    583     if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
     583    if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_network->site_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
    584584        $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
    585585
     
    613613        $path = $base.$blogname.'/';
    614614    }
    615     if ( domain_exists($mydomain, $path, $current_site->id) )
     615    if ( domain_exists($mydomain, $path, $current_network->id) )
    616616        $errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
    617617
     
    790790
    791791    // Send email with activation link.
    792     if ( !is_subdomain_install() || get_current_site()->id != 1 )
     792    if ( !is_subdomain_install() || get_current_network_id() != 1 )
    793793        $activate_url = network_site_url("wp-activate.php?key=$key");
    794794    else
     
    13351335 */
    13361336function install_blog( $blog_id, $blog_title = '' ) {
    1337     global $wpdb, $wp_roles, $current_site;
     1337    global $wpdb, $wp_roles;
    13381338
    13391339    // Cast for security
     
    13641364            $siteurl = set_url_scheme( $siteurl, 'https' );
    13651365        }
    1366         if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) {
     1366        if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) {
    13671367            $home = set_url_scheme( $home, 'https' );
    13681368        }
     
    13761376        update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    13771377    else
    1378         update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
     1378        update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) );
    13791379
    13801380    update_option( 'blogname', wp_unslash( $blog_title ) );
     
    14311431 */
    14321432function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
    1433     $current_site = get_current_site();
     1433    $current_network = get_network();
    14341434
    14351435    /**
     
    14711471    $user = get_userdata( $user_id );
    14721472
    1473     $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
     1473    $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email );
    14741474    $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
    14751475    $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
     
    15011501    $message = $welcome_email;
    15021502
    1503     if ( empty( $current_site->site_name ) )
    1504         $current_site->site_name = 'WordPress';
     1503    if ( empty( $current_network->site_name ) )
     1504        $current_network->site_name = 'WordPress';
    15051505
    15061506    /**
     
    15111511     * @param string $subject Subject of the email.
    15121512     */
    1513     $subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
     1513    $subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_network->site_name, wp_unslash( $title ) ) );
    15141514    wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
    15151515    return true;
     
    15321532 */
    15331533function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
    1534     $current_site = get_current_site();
     1534    $current_network = get_network();
    15351535
    15361536    /**
     
    15651565     */
    15661566    $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );
    1567     $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
     1567    $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email );
    15681568    $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
    15691569    $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
     
    15791579    $message = $welcome_email;
    15801580
    1581     if ( empty( $current_site->site_name ) )
    1582         $current_site->site_name = 'WordPress';
     1581    if ( empty( $current_network->site_name ) )
     1582        $current_network->site_name = 'WordPress';
    15831583
    15841584    /**
     
    15891589     * @param string $subject Subject of the email.
    15901590     */
    1591     $subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
     1591    $subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_network->site_name, $user->user_login) );
    15921592    wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
    15931593    return true;
     
    18781878 */
    18791879function redirect_this_site( $deprecated = '' ) {
    1880     return array( get_current_site()->domain );
     1880    return array( get_network()->domain );
    18811881}
    18821882
     
    20252025        $blog_id = $meta[ 'add_to_blog' ];
    20262026        $role = $meta[ 'new_role' ];
    2027         remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
     2027        remove_user_from_blog($user_id, get_network()->site_id); // remove user from main blog.
    20282028        add_user_to_blog( $blog_id, $user_id, $role );
    20292029        update_user_meta( $user_id, 'primary_blog', $blog_id );
     
    20392039 */
    20402040function fix_phpmailer_messageid( $phpmailer ) {
    2041     $phpmailer->Hostname = get_current_site()->domain;
     2041    $phpmailer->Hostname = get_network()->domain;
    20422042}
    20432043
  • trunk/src/wp-includes/ms-load.php

    r38781 r38814  
    9898            return WP_CONTENT_DIR . '/blog-inactive.php';
    9999        } else {
    100             $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) );
     100            $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
    101101            wp_die(
    102102                /* translators: %s: admin email link */
  • trunk/src/wp-includes/option.php

    r38687 r38814  
    10701070 * @see get_option()
    10711071 *
    1072  * @global wpdb   $wpdb
    1073  * @global object $current_site
     1072 * @global wpdb $wpdb
    10741073 *
    10751074 * @param int      $network_id ID of the network. Can be null to default to the current network ID.
     
    10791078 */
    10801079function get_network_option( $network_id, $option, $default = false ) {
    1081     global $wpdb, $current_site;
     1080    global $wpdb;
    10821081
    10831082    if ( $network_id && ! is_numeric( $network_id ) ) {
     
    10881087
    10891088    // Fallback to the current network if a network ID is not specified.
    1090     if ( ! $network_id && is_multisite() ) {
    1091         $network_id = $current_site->id;
     1089    if ( ! $network_id ) {
     1090        $network_id = get_current_network_id();
    10921091    }
    10931092
     
    11871186 * @see add_option()
    11881187 *
    1189  * @global wpdb   $wpdb
    1190  * @global object $current_site
     1188 * @global wpdb $wpdb
    11911189 *
    11921190 * @param int    $network_id ID of the network. Can be null to default to the current network ID.
     
    11961194 */
    11971195function add_network_option( $network_id, $option, $value ) {
    1198     global $wpdb, $current_site;
     1196    global $wpdb;
    11991197
    12001198    if ( $network_id && ! is_numeric( $network_id ) ) {
     
    12051203
    12061204    // Fallback to the current network if a network ID is not specified.
    1207     if ( ! $network_id && is_multisite() ) {
    1208         $network_id = $current_site->id;
     1205    if ( ! $network_id ) {
     1206        $network_id = get_current_network_id();
    12091207    }
    12101208
     
    12971295 * @see delete_option()
    12981296 *
    1299  * @global wpdb   $wpdb
    1300  * @global object $current_site
     1297 * @global wpdb $wpdb
    13011298 *
    13021299 * @param int    $network_id ID of the network. Can be null to default to the current network ID.
     
    13051302 */
    13061303function delete_network_option( $network_id, $option ) {
    1307     global $wpdb, $current_site;
     1304    global $wpdb;
    13081305
    13091306    if ( $network_id && ! is_numeric( $network_id ) ) {
     
    13141311
    13151312    // Fallback to the current network if a network ID is not specified.
    1316     if ( ! $network_id && is_multisite() ) {
    1317         $network_id = $current_site->id;
     1313    if ( ! $network_id ) {
     1314        $network_id = get_current_network_id();
    13181315    }
    13191316
     
    13791376 * @see update_option()
    13801377 *
    1381  * @global wpdb   $wpdb
    1382  * @global object $current_site
     1378 * @global wpdb $wpdb
    13831379 *
    13841380 * @param int      $network_id ID of the network. Can be null to default to the current network ID.
     
    13881384 */
    13891385function update_network_option( $network_id, $option, $value ) {
    1390     global $wpdb, $current_site;
     1386    global $wpdb;
    13911387
    13921388    if ( $network_id && ! is_numeric( $network_id ) ) {
     
    13971393
    13981394    // Fallback to the current network if a network ID is not specified.
    1399     if ( ! $network_id && is_multisite() ) {
    1400         $network_id = $current_site->id;
     1395    if ( ! $network_id ) {
     1396        $network_id = get_current_network_id();
    14011397    }
    14021398
  • trunk/src/wp-login.php

    r38739 r38814  
    9999    if ( is_multisite() ) {
    100100        $login_header_url   = network_home_url();
    101         $login_header_title = get_current_site()->site_name;
     101        $login_header_title = get_network()->site_name;
    102102    } else {
    103103        $login_header_url   = __( 'https://wordpress.org/' );
     
    333333
    334334    if ( is_multisite() ) {
    335         $blogname = get_current_site()->site_name;
     335        $blogname = get_network()->site_name;
    336336    } else {
    337337        /*
  • trunk/src/wp-signup.php

    r37551 r38814  
    101101    }
    102102
    103     $current_site = get_current_site();
     103    $current_network = get_network();
    104104    // Blog name
    105105    if ( !is_subdomain_install() )
     
    113113
    114114    if ( !is_subdomain_install() )
    115         echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
     115        echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
    116116    else
    117         echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
     117        echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '</span><br />';
    118118
    119119    if ( ! is_user_logged_in() ) {
    120120        if ( ! is_subdomain_install() ) {
    121             $site = $current_site->domain . $current_site->path . __( 'sitename' );
     121            $site = $current_network->domain . $current_network->path . __( 'sitename' );
    122122        } else {
    123             $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
     123            $site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
    124124        }
    125125
     
    305305    $errors = $filtered_results['errors'];
    306306
    307     echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
     307    echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
    308308
    309309    if ( $errors->get_error_code() ) {
     
    533533    <h2><?php
    534534        /* translators: %s: name of the network */
    535         printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name );
     535        printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
    536536    ?></h2>
    537537    <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
Note: See TracChangeset for help on using the changeset viewer.