WordPress.org

Make WordPress Core

Ticket #25158: 25158.diff

File 25158.diff, 37.1 KB (added by jeremyfelt, 7 years ago)
  • src/wp-admin/admin-header.php

     
    1212
    1313// In case admin-header.php is included in a function.
    1414global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
    15         $current_site, $update_title, $total_update_count, $parent_file;
     15        $update_title, $total_update_count, $parent_file;
    1616
    1717// Catch plugins that include admin-header.php before admin.php completes.
    1818if ( empty( $current_screen ) )
     
    2222$title = esc_html( strip_tags( $title ) );
    2323
    2424if ( is_network_admin() )
    25         $admin_title = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) );
     25        $admin_title = sprintf( __('Network Admin: %s'), esc_html( get_current_site()->site_name ) );
    2626elseif ( is_user_admin() )
    27         $admin_title = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );
     27        $admin_title = sprintf( __('Global Dashboard: %s'), esc_html( get_current_site()->site_name ) );
    2828else
    2929        $admin_title = get_bloginfo( 'name' );
    3030
  • src/wp-admin/import.php

     
    102102                                                                                esc_attr__('Install importer') . '">' . $data[0] . '</a>';
    103103                                } else {
    104104                                        $action = $data[0];
    105                                         $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) );
     105                                        $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( get_current_site()->blog_id, 'import.php' ) );
    106106                                }
    107107                        }
    108108                } else {
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

     
    2121        }
    2222
    2323        function prepare_items() {
    24                 global $s, $mode, $wpdb, $current_site;
     24                global $s, $mode, $wpdb;
    2525
    2626                $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
    2727
     
    6969                        if ( is_numeric($s) && empty( $wild ) ) {
    7070                                $query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )";
    7171                        } elseif ( is_subdomain_install() ) {
    72                                 $blog_s = str_replace( '.' . $current_site->domain, '', $like_s );
    73                                 $blog_s .= $wild . '.' . $current_site->domain;
     72                                $blog_s = str_replace( '.' . get_current_site()->domain, '', $like_s );
     73                                $blog_s .= $wild . '.' . get_current_site()->domain;
    7474                                $query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ) ";
    7575                        } else {
    76                                 if ( $like_s != trim('/', $current_site->path) )
    77                                         $blog_s = $current_site->path . $like_s . $wild . '/';
     76                                if ( $like_s != trim('/', get_current_site()->path) )
     77                                        $blog_s = get_current_site()->path . $like_s . $wild . '/';
    7878                                else
    7979                                        $blog_s = $like_s;
    8080                                $query .= " AND  ( {$wpdb->blogs}.path LIKE '$blog_s' )";
     
    168168        }
    169169
    170170        function display_rows() {
    171                 global $current_site, $mode;
     171                global $mode;
    172172
    173173                $status_list = array(
    174174                        'archived' => array( 'site-archived', __( 'Archived' ) ),
     
    202202                        }
    203203                        echo "<tr class='$class'>";
    204204
    205                         $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
     205                        $blogname = ( is_subdomain_install() ) ? str_replace( '.'.get_current_site()->domain, '', $blog['domain'] ) : $blog['path'];
    206206
    207207                        list( $columns, $hidden ) = $this->get_column_info();
    208208
     
    251251
    252252                                                        $actions['edit']        = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
    253253                                                        $actions['backend']     = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
    254                                                         if ( $current_site->blog_id != $blog['blog_id'] ) {
     254                                                        if ( get_current_site()->blog_id != $blog['blog_id'] ) {
    255255                                                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
    256256                                                                        $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>';
    257257                                                                else
  • src/wp-admin/includes/class-wp-ms-users-list-table.php

     
    133133        }
    134134
    135135        function display_rows() {
    136                 global $current_site, $mode;
     136                global $mode;
    137137
    138138                $alt = '';
    139139                $super_admins = get_super_admins();
     
    223223
    224224                                                                        $path   = ( $val->path == '/' ) ? '' : $val->path;
    225225                                                                        echo '<span class="site-' . $val->site_id . '" >';
    226                                                                         echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
     226                                                                        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>';
    227227                                                                        echo ' <small class="row-actions">';
    228228                                                                        $actions = array();
    229229                                                                        $actions['edit'] = '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>';
  • src/wp-admin/includes/ms.php

     
    5252 * @return void
    5353 */
    5454function wpmu_delete_blog( $blog_id, $drop = false ) {
    55         global $wpdb, $current_site;
     55        global $wpdb;
    5656
    5757        $switch = false;
    5858        if ( get_current_blog_id() != $blog_id ) {
     
    7676        update_blog_status( $blog_id, 'deleted', 1 );
    7777
    7878        // Don't destroy the initial, main, or root blog.
    79         if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) )
     79        if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == get_current_site()->path && $blog->domain == get_current_site()->domain ) ) )
    8080                $drop = false;
    8181
    8282        if ( $drop ) {
  • src/wp-admin/includes/schema.php

     
    323323 * @uses $wp_db_version
    324324 */
    325325function populate_options() {
    326         global $wpdb, $wp_db_version, $current_site, $wp_current_db_version;
     326        global $wpdb, $wp_db_version, $wp_current_db_version;
    327327
    328328        $guessurl = wp_guess_url();
    329329
     
    487487        // 3.0 multisite
    488488        if ( is_multisite() ) {
    489489                /* translators: blog tagline */
    490                 $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name );
     490                $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name );
    491491                $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/';
    492492        }
    493493
  • src/wp-admin/includes/upgrade.php

     
    101101 * @param int $user_id User ID.
    102102 */
    103103function wp_install_defaults($user_id) {
    104         global $wpdb, $wp_rewrite, $current_site, $table_prefix;
     104        global $wpdb, $wp_rewrite, $table_prefix;
    105105
    106106        // Default category
    107107        $cat_name = __('Uncategorized');
     
    135135                        $first_post = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' );
    136136
    137137                $first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post );
    138                 $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
     138                $first_post = str_replace( "SITE_NAME", get_current_site()->site_name, $first_post );
    139139        } else {
    140140                $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!');
    141141        }
  • src/wp-admin/ms-delete-site.php

     
    1919if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
    2020        if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) {
    2121                wpmu_delete_blog( $wpdb->blogid );
    22                 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 ) );
     22                wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_current_site()->site_name ) );
    2323        } else {
    2424                wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
    2525        }
     
    5959###SITE_NAME###" ) );
    6060
    6161        $content = str_replace( '###URL_DELETE###', $url_delete, $content );
    62         $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
     62        $content = str_replace( '###SITE_NAME###', get_current_site()->site_name, $content );
    6363
    6464        wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content );
    6565        ?>
     
    6868
    6969<?php } else {
    7070        ?>
    71         <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>
     71        <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_current_site()->site_name); ?></p>
    7272        <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
    7373
    7474        <form method="post" name="deletedirect">
  • src/wp-admin/network/admin.php

     
    1515if ( ! is_multisite() )
    1616        wp_die( __( 'Multisite support is not enabled.' ) );
    1717
    18 $redirect_network_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
     18$redirect_network_admin_request = ( ( $current_blog->domain != get_current_site()->domain ) || ( $current_blog->path != get_current_site()->path ) );
    1919$redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request );
    2020if ( $redirect_network_admin_request ) {
    2121        wp_redirect( network_admin_url() );
  • src/wp-admin/network/settings.php

     
    8888                        <tr valign="top">
    8989                                <th scope="row"><label for="site_name"><?php _e( 'Network Name' ) ?></label></th>
    9090                                <td>
    91                                         <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />
     91                                        <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( get_current_site()->site_name ) ?>" />
    9292                                        <br />
    9393                                        <?php _e( 'What you would like to call this network.' ) ?>
    9494                                </td>
     
    9999                                <td>
    100100                                        <input name="admin_email" type="text" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option('admin_email') ) ?>" />
    101101                                        <br />
    102                                         <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), $current_site->domain ); ?>
     102                                        <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), get_current_site()->domain ); ?>
    103103                                </td>
    104104                        </tr>
    105105                </table>
  • src/wp-admin/network/site-new.php

     
    6161                wp_die( __( 'Invalid email address.' ) );
    6262
    6363        if ( is_subdomain_install() ) {
    64                 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    65                 $path      = $current_site->path;
     64                $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', get_current_site()->domain );
     65                $path      = get_current_site()->path;
    6666        } else {
    67                 $newdomain = $current_site->domain;
    68                 $path      = $current_site->path . $domain . '/';
     67                $newdomain = get_current_site()->domain;
     68                $path      = get_current_site()->path . $domain . '/';
    6969        }
    7070
    7171        $password = 'N/A';
     
    8080        }
    8181
    8282        $wpdb->hide_errors();
    83         $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
     83        $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), get_current_site()->id );
    8484        $wpdb->show_errors();
    8585        if ( !is_wp_error( $id ) ) {
    8686                if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
     
    8989
    9090Address: %2$s
    9191Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $title ) );
    92                 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
     92                wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), get_current_site()->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
    9393                wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
    9494                wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
    9595                exit;
     
    126126                        <th scope="row"><?php _e( 'Site Address' ) ?></th>
    127127                        <td>
    128128                        <?php if ( is_subdomain_install() ) { ?>
    129                                 <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>
     129                                <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_current_site()->domain ); ?></span>
    130130                        <?php } else {
    131                                 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/>
     131                                echo get_current_site()->domain . get_current_site()->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/>
    132132                        <?php }
    133133                        echo '<p>' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>';
    134134                        ?>
  • src/wp-admin/network/sites.php

     
    5858                        nocache_headers();
    5959                        header( 'Content-Type: text/html; charset=utf-8' );
    6060                }
    61                 if ( $current_site->blog_id == $id )
     61                if ( get_current_site()->blog_id == $id )
    6262                        wp_die( __( 'You are not allowed to change the current site.' ) );
    6363                ?>
    6464                <!DOCTYPE html>
     
    106106                                wp_die( __( 'You do not have permission to access this page.' ) );
    107107
    108108                        $updated_action = 'not_deleted';
    109                         if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
     109                        if ( $id != '0' && $id != get_current_site()->blog_id && current_user_can( 'delete_site', $id ) ) {
    110110                                wpmu_delete_blog( $id, true );
    111111                                $updated_action = 'delete';
    112112                        }
     
    117117                                $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
    118118
    119119                                foreach ( (array) $_POST['allblogs'] as $key => $val ) {
    120                                         if ( $val != '0' && $val != $current_site->blog_id ) {
     120                                        if ( $val != '0' && $val != get_current_site()->blog_id ) {
    121121                                                switch ( $doaction ) {
    122122                                                        case 'delete':
    123123                                                                if ( ! current_user_can( 'delete_site', $val ) )
  • src/wp-admin/network/users.php

     
    146146                                                                $userfunction = 'all_spam';
    147147                                                                $blogs = get_blogs_of_user( $val, true );
    148148                                                                foreach ( (array) $blogs as $key => $details ) {
    149                                                                         if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
     149                                                                        if ( $details->userblog_id != get_current_site()->blog_id ) // main blog not a spam !
    150150                                                                                update_blog_status( $details->userblog_id, 'spam', '1' );
    151151                                                                }
    152152                                                                update_user_status( $val, 'spam', '1' );
  • src/wp-admin/user/admin.php

     
    1616        exit;
    1717}
    1818
    19 $redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
     19$redirect_user_admin_request = ( ( $current_blog->domain != get_current_site()->domain ) || ( $current_blog->path != get_current_site()->path ) );
    2020$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request );
    2121if ( $redirect_user_admin_request ) {
    2222        wp_redirect( user_admin_url() );
  • src/wp-includes/admin-bar.php

     
    216216 * @param WP_Admin_Bar $wp_admin_bar
    217217 */
    218218function wp_admin_bar_site_menu( $wp_admin_bar ) {
    219         global $current_site;
    220 
    221219        // Don't show for logged out users.
    222220        if ( ! is_user_logged_in() )
    223221                return;
     
    232230                $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
    233231
    234232        if ( is_network_admin() ) {
    235                 $blogname = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) );
     233                $blogname = sprintf( __('Network Admin: %s'), esc_html( get_current_site()->site_name ) );
    236234        } elseif ( is_user_admin() ) {
    237                 $blogname = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );
     235                $blogname = sprintf( __('Global Dashboard: %s'), esc_html( get_current_site()->site_name ) );
    238236        }
    239237
    240238        $title = wp_html_excerpt( $blogname, 40, '&hellip;' );
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    459459         *  - 'xmlrpc' - url of xmlrpc endpoint
    460460         */
    461461        function wp_getUsersBlogs( $args ) {
    462                 global $current_site;
    463462                // If this isn't on WPMU then just use blogger_getUsersBlogs
    464463                if ( !is_multisite() ) {
    465464                        array_unshift( $args, 1 );
     
    481480
    482481                foreach ( $blogs as $blog ) {
    483482                        // Don't include blogs that aren't hosted at this site
    484                         if ( $blog->site_id != $current_site->id )
     483                        if ( $blog->site_id != get_current_site()->id )
    485484                                continue;
    486485
    487486                        $blog_id = $blog->userblog_id;
  • src/wp-includes/http.php

     
    506506 * @return bool
    507507 */
    508508function ms_allowed_http_request_hosts( $is_external, $host ) {
    509         global $wpdb, $current_site;
     509        global $wpdb;
    510510        static $queried = array();
    511511        if ( $is_external )
    512512                return $is_external;
    513         if ( $host === $current_site->domain )
     513        if ( $host === get_current_site()->domain )
    514514                return true;
    515515        if ( isset( $queried[ $host ] ) )
    516516                return $queried[ $host ];
  • src/wp-includes/link-template.php

     
    21042104 * @return string Site url link with optional path appended.
    21052105*/
    21062106function network_site_url( $path = '', $scheme = null ) {
    2107         global $current_site;
    2108 
    21092107        if ( ! is_multisite() )
    21102108                return site_url($path, $scheme);
    21112109
    21122110        if ( 'relative' == $scheme )
    2113                 $url = $current_site->path;
     2111                $url = get_current_site()->path;
    21142112        else
    2115                 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     2113                $url = set_url_scheme( 'http://' . get_current_site()->domain . get_current_site()->path, $scheme );
    21162114
    21172115        if ( $path && is_string( $path ) )
    21182116                $url .= ltrim( $path, '/' );
     
    21352133 * @return string Home url link with optional path appended.
    21362134*/
    21372135function network_home_url( $path = '', $scheme = null ) {
    2138         global $current_site;
    2139 
    21402136        if ( ! is_multisite() )
    21412137                return home_url($path, $scheme);
    21422138
     
    21462142                $scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
    21472143
    21482144        if ( 'relative' == $scheme )
    2149                 $url = $current_site->path;
     2145                $url = get_current_site()->path;
    21502146        else
    2151                 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     2147                $url = set_url_scheme( 'http://' . get_current_site()->domain . get_current_site()->path, $scheme );
    21522148
    21532149        if ( $path && is_string( $path ) )
    21542150                $url .= ltrim( $path, '/' );
  • src/wp-includes/ms-blogs.php

     
    9090 * @return int A blog id
    9191 */
    9292function get_id_from_blogname( $slug ) {
    93         global $wpdb, $current_site;
     93        global $wpdb;
    9494
    9595        $slug = trim( $slug, '/' );
    9696
     
    9999                return $blog_id;
    100100
    101101        if ( is_subdomain_install() ) {
    102                 $domain = $slug . '.' . $current_site->domain;
    103                 $path = $current_site->path;
     102                $domain = $slug . '.' . get_current_site()->domain;
     103                $path = get_current_site()->path;
    104104        } else {
    105                 $domain = $current_site->domain;
    106                 $path = $current_site->path . $slug . '/';
     105                $domain = get_current_site()->domain;
     106                $path = get_current_site()->path . $slug . '/';
    107107        }
    108108
    109109        $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) );
  • src/wp-includes/ms-default-constants.php

     
    4545 * @since 3.0.0
    4646 */
    4747function ms_cookie_constants(  ) {
    48         global $current_site;
    49 
    5048        /**
    5149         * @since 1.2.0
    5250         */
    5351        if ( !defined( 'COOKIEPATH' ) )
    54                 define( 'COOKIEPATH', $current_site->path );
     52                define( 'COOKIEPATH', get_current_site()->path );
    5553
    5654        /**
    5755         * @since 1.5.0
    5856         */
    5957        if ( !defined( 'SITECOOKIEPATH' ) )
    60                 define( 'SITECOOKIEPATH', $current_site->path );
     58                define( 'SITECOOKIEPATH', get_current_site()->path );
    6159
    6260        /**
    6361         * @since 2.6.0
     
    7472         * @since 2.0.0
    7573         */
    7674        if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
    77                 if ( !empty( $current_site->cookie_domain ) )
    78                         define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
     75                if ( !empty( get_current_site()->cookie_domain ) )
     76                        define('COOKIE_DOMAIN', '.' . get_current_site()->cookie_domain);
    7977                else
    80                         define('COOKIE_DOMAIN', '.' . $current_site->domain);
     78                        define('COOKIE_DOMAIN', '.' . get_current_site()->domain);
    8179        }
    8280}
    8381
  • src/wp-includes/ms-functions.php

     
    533533 * @return array Contains the new site data and error messages.
    534534 */
    535535function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
    536         global $wpdb, $domain, $current_site;
     536        global $wpdb, $domain;
    537537
    538         $base = $current_site->path;
     538        $base = get_current_site()->path;
    539539
    540540        $blog_title = strip_tags( $blog_title );
    541541        $blog_title = substr( $blog_title, 0, 50 );
     
    567567                $errors->add( 'blogname', __( 'Sorry, site names may not contain the character &#8220;_&#8221;!' ) );
    568568
    569569        // do not allow users to create a blog that conflicts with a page on the main blog.
    570         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 ) ) )
     570        if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( get_current_site()->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
    571571                $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
    572572
    573573        // all numeric?
     
    589589                $mydomain = "$domain";
    590590                $path = $base.$blogname.'/';
    591591        }
    592         if ( domain_exists($mydomain, $path, $current_site->id) )
     592        if ( domain_exists( $mydomain, $path, get_current_site()->id ) )
    593593                $errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
    594594
    595595        if ( username_exists( $blogname ) ) {
     
    705705 * @param string $key The activation key created in wpmu_signup_blog()
    706706 * @return bool
    707707 */
    708 function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') {
    709         global $current_site;
    710 
     708function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = '' ) {
    711709        if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
    712710                return false;
    713711
    714712        // Send email with activation link.
    715         if ( !is_subdomain_install() || $current_site->id != 1 )
     713        if ( !is_subdomain_install() || get_current_site()->id != 1 )
    716714                $activate_url = network_site_url("wp-activate.php?key=$key");
    717715        else
    718716                $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
     
    11181116 * @param int $blog_id The value returned by insert_blog().
    11191117 * @param string $blog_title The title of the new site.
    11201118 */
    1121 function install_blog($blog_id, $blog_title = '') {
    1122         global $wpdb, $wp_roles, $current_site;
     1119function install_blog( $blog_id, $blog_title = '' ) {
     1120        global $wpdb, $wp_roles;
    11231121
    11241122        // Cast for security
    11251123        $blog_id = (int) $blog_id;
     
    11471145        if ( get_site_option( 'ms_files_rewriting' ) )
    11481146                update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    11491147        else
    1150                 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );
     1148                update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
    11511149
    11521150        update_option( 'blogname', wp_unslash( $blog_title ) );
    11531151        update_option( 'admin_email', '' );
     
    12001198 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
    12011199 * @return bool
    12021200 */
    1203 function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') {
    1204         global $current_site;
    1205 
     1201function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = '' ) {
    12061202        if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
    12071203                return false;
    12081204
     
    12251221        $url = get_blogaddress_by_id($blog_id);
    12261222        $user = get_userdata( $user_id );
    12271223
    1228         $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
     1224        $welcome_email = str_replace( 'SITE_NAME', get_current_site()->site_name, $welcome_email );
    12291225        $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
    12301226        $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
    12311227        $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
     
    12411237        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    12421238        $message = $welcome_email;
    12431239
    1244         if ( empty( $current_site->site_name ) )
    1245                 $current_site->site_name = 'WordPress';
     1240        if ( empty( get_current_site()->site_name ) )
     1241                get_current_site()->site_name = 'WordPress';
    12461242
    1247         $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, wp_unslash( $title ) ) );
     1243        $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), get_current_site()->site_name, wp_unslash( $title ) ) );
    12481244        wp_mail($user->user_email, $subject, $message, $message_headers);
    12491245        return true;
    12501246}
     
    12641260 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
    12651261 * @return bool
    12661262 */
    1267 function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
    1268         global $current_site;
    1269 
     1263function wpmu_welcome_user_notification( $user_id, $password, $meta = '' ) {
    12701264        if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
    12711265                return false;
    12721266
     
    12751269        $user = get_userdata( $user_id );
    12761270
    12771271        $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
    1278         $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
     1272        $welcome_email = str_replace( 'SITE_NAME', get_current_site()->site_name, $welcome_email );
    12791273        $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
    12801274        $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
    12811275        $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
     
    12891283        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    12901284        $message = $welcome_email;
    12911285
    1292         if ( empty( $current_site->site_name ) )
    1293                 $current_site->site_name = 'WordPress';
     1286        if ( empty( get_current_site()->site_name ) )
     1287                get_current_site()->site_name = 'WordPress';
    12941288
    1295         $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login) );
     1289        $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), get_current_site()->site_name, $user->user_login) );
    12961290        wp_mail($user->user_email, $subject, $message, $message_headers);
    12971291        return true;
    12981292}
     
    15531547 * @return array The current site's domain
    15541548 */
    15551549function redirect_this_site( $deprecated = '' ) {
    1556         global $current_site;
    1557         return array( $current_site->domain );
     1550        return array( get_current_site()->domain );
    15581551}
    15591552
    15601553/**
     
    16821675 * @param array $meta
    16831676 */
    16841677function add_new_user_to_blog( $user_id, $password, $meta ) {
    1685         global $current_site;
    16861678        if ( !empty( $meta[ 'add_to_blog' ] ) ) {
    16871679                $blog_id = $meta[ 'add_to_blog' ];
    16881680                $role = $meta[ 'new_role' ];
    1689                 remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog.
     1681                remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
    16901682                add_user_to_blog( $blog_id, $user_id, $role );
    16911683                update_user_meta( $user_id, 'primary_blog', $blog_id );
    16921684        }
     
    16981690 * @since MU
    16991691 */
    17001692function fix_phpmailer_messageid( $phpmailer ) {
    1701         global $current_site;
    1702         $phpmailer->Hostname = $current_site->domain;
     1693        $phpmailer->Hostname = get_current_site()->domain;
    17031694}
    17041695
    17051696/**
  • src/wp-includes/ms-load.php

     
    6969 * @return bool|string Returns true on success, or drop-in file to include.
    7070 */
    7171function ms_site_check() {
    72         global $wpdb, $current_site;
     72        global $wpdb;
    7373
    7474        $blog = get_blog_details();
    7575
     
    9393                if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
    9494                        return WP_CONTENT_DIR . '/blog-inactive.php';
    9595                else
    96                         wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
     96                        wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) ) ) );
    9797        }
    9898
    9999        if ( $blog->archived == '1' || $blog->spam == '1' ) {
  • src/wp-login.php

     
    3939 * @param WP_Error $wp_error Optional. WordPress Error Object
    4040 */
    4141function login_header($title = 'Log In', $message = '', $wp_error = '') {
    42         global $error, $interim_login, $current_site, $action;
     42        global $error, $interim_login, $action;
    4343
    4444        // Don't index any of these forms
    4545        add_action( 'login_head', 'wp_no_robots' );
     
    8282
    8383        if ( is_multisite() ) {
    8484                $login_header_url   = network_home_url();
    85                 $login_header_title = $current_site->site_name;
     85                $login_header_title = get_current_site()->site_name;
    8686        } else {
    8787                $login_header_url   = __( 'http://wordpress.org/' );
    8888                $login_header_title = __( 'Powered by WordPress' );
     
    197197 * @return bool|WP_Error True: when finish. WP_Error on error
    198198 */
    199199function retrieve_password() {
    200         global $wpdb, $current_site;
     200        global $wpdb;
    201201
    202202        $errors = new WP_Error();
    203203
  • src/wp-signup.php

     
    7878 * @param array $errors
    7979 */
    8080function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
    81         global $current_site;
    8281        // Blog name
    8382        if ( !is_subdomain_install() )
    8483                echo '<label for="blogname">' . __('Site Name:') . '</label>';
     
    9089        <?php }
    9190
    9291        if ( !is_subdomain_install() )
    93                 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 />';
     92                echo '<span class="prefix_address">' . get_current_site()->domain . get_current_site()->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
    9493        else
    95                 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 />';
     94                echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', get_current_site()->domain ) ) . '</span><br />';
    9695
    9796        if ( !is_user_logged_in() ) {
    9897                if ( !is_subdomain_install() )
    99                         $site = $current_site->domain . $current_site->path . __( 'sitename' );
     98                        $site = get_current_site()->domain . get_current_site()->path . __( 'sitename' );
    10099                else
    101                         $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
     100                        $site = __( 'domain' ) . '.' . $site_domain . get_current_site()->path;
    102101                echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
    103102        }
    104103
     
    202201 * @param array $errors
    203202 */
    204203function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
    205         global $current_site;
    206204        $current_user = wp_get_current_user();
    207205
    208206        if ( ! is_wp_error($errors) ) {
     
    215213        $blog_title = $filtered_results['blog_title'];
    216214        $errors = $filtered_results['errors'];
    217215
    218         echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';
     216        echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
    219217
    220218        if ( $errors->get_error_code() ) {
    221219                echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
     
    312310 * @param array $errors
    313311 */
    314312function signup_user($user_name = '', $user_email = '', $errors = '') {
    315         global $current_site, $active_signup;
     313        global $active_signup;
    316314
    317315        if ( !is_wp_error($errors) )
    318316                $errors = new WP_Error();
     
    327325
    328326        ?>
    329327
    330         <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
     328        <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2>
    331329        <form id="setupform" method="post" action="wp-signup.php">
    332330                <input type="hidden" name="stage" value="validate-user-signup" />
    333331                <?php do_action( 'signup_hidden_fields' ); ?>