Make WordPress Core

Ticket #25158: 25158.2.diff

File 25158.2.diff, 20.1 KB (added by jeremyfelt, 11 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
     17$current_site = get_current_site();
     18
    1719// Catch plugins that include admin-header.php before admin.php completes.
    1820if ( empty( $current_screen ) )
    1921        set_current_screen();
  • 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
     26                $current_site = get_current_site();
     27
    2628                $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
    2729
    2830                $per_page = $this->get_items_per_page( 'sites_network_per_page' );
     
    168170        }
    169171
    170172        function display_rows() {
    171                 global $current_site, $mode;
     173                global $mode;
    172174
    173175                $status_list = array(
    174176                        'archived' => array( 'site-archived', __( 'Archived' ) ),
     
    202204                        }
    203205                        echo "<tr class='$class'>";
    204206
    205                         $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
     207                        $blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path'];
    206208
    207209                        list( $columns, $hidden ) = $this->get_column_info();
    208210
     
    251253
    252254                                                        $actions['edit']        = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
    253255                                                        $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'] ) {
     256                                                        if ( get_current_site()->blog_id != $blog['blog_id'] ) {
    255257                                                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
    256258                                                                        $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>';
    257259                                                                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

     
    100100 *
    101101 * @param int $user_id User ID.
    102102 */
    103 function wp_install_defaults($user_id) {
    104         global $wpdb, $wp_rewrite, $current_site, $table_prefix;
     103function wp_install_defaults( $user_id ) {
     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-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
     95        $current_site = get_current_site();
    9596        $slug = trim( $slug, '/' );
    9697
    9798        $blog_id = wp_cache_get( 'get_id_from_blogname_' . $slug, 'blog-details' );
  • src/wp-includes/ms-default-constants.php

     
    4545 * @since 3.0.0
    4646 */
    4747function ms_cookie_constants(  ) {
    48         global $current_site;
     48        $current_site = get_current_site();
    4949
    5050        /**
    5151         * @since 1.2.0
  • src/wp-includes/ms-functions.php

     
    532532 * @param string $blog_title The blog title provided by the user.
    533533 * @return array Contains the new site data and error messages.
    534534 */
    535 function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
    536         global $wpdb, $domain, $current_site;
     535function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
     536        global $wpdb, $domain;
    537537
     538        $current_site = get_current_site();
    538539        $base = $current_site->path;
    539540
    540541        $blog_title = strip_tags( $blog_title );
     
    705706 * @param string $key The activation key created in wpmu_signup_blog()
    706707 * @return bool
    707708 */
    708 function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') {
    709         global $current_site;
    710 
     709function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = '' ) {
    711710        if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
    712711                return false;
    713712
    714713        // Send email with activation link.
    715         if ( !is_subdomain_install() || $current_site->id != 1 )
     714        if ( !is_subdomain_install() || get_current_site()->id != 1 )
    716715                $activate_url = network_site_url("wp-activate.php?key=$key");
    717716        else
    718717                $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
     
    11181117 * @param int $blog_id The value returned by insert_blog().
    11191118 * @param string $blog_title The title of the new site.
    11201119 */
    1121 function install_blog($blog_id, $blog_title = '') {
    1122         global $wpdb, $wp_roles, $current_site;
     1120function install_blog( $blog_id, $blog_title = '' ) {
     1121        global $wpdb, $wp_roles;
    11231122
    11241123        // Cast for security
    11251124        $blog_id = (int) $blog_id;
     
    11471146        if ( get_site_option( 'ms_files_rewriting' ) )
    11481147                update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    11491148        else
    1150                 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );
     1149                update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
    11511150
    11521151        update_option( 'blogname', wp_unslash( $blog_title ) );
    11531152        update_option( 'admin_email', '' );
     
    12001199 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
    12011200 * @return bool
    12021201 */
    1203 function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') {
    1204         global $current_site;
     1202function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = '' ) {
     1203        $current_site = get_current_site();
    12051204
    12061205        if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
    12071206                return false;
     
    12641263 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
    12651264 * @return bool
    12661265 */
    1267 function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
    1268         global $current_site;
     1266function wpmu_welcome_user_notification( $user_id, $password, $meta = '' ) {
     1267        $current_site = get_current_site();
    12691268
    12701269        if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
    12711270                return false;
     
    15531552 * @return array The current site's domain
    15541553 */
    15551554function redirect_this_site( $deprecated = '' ) {
    1556         global $current_site;
    1557         return array( $current_site->domain );
     1555        return array( get_current_site()->domain );
    15581556}
    15591557
    15601558/**
     
    16821680 * @param array $meta
    16831681 */
    16841682function add_new_user_to_blog( $user_id, $password, $meta ) {
    1685         global $current_site;
    16861683        if ( !empty( $meta[ 'add_to_blog' ] ) ) {
    16871684                $blog_id = $meta[ 'add_to_blog' ];
    16881685                $role = $meta[ 'new_role' ];
    1689                 remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog.
     1686                remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
    16901687                add_user_to_blog( $blog_id, $user_id, $role );
    16911688                update_user_meta( $user_id, 'primary_blog', $blog_id );
    16921689        }
     
    16981695 * @since MU
    16991696 */
    17001697function fix_phpmailer_messageid( $phpmailer ) {
    1701         global $current_site;
    1702         $phpmailer->Hostname = $current_site->domain;
     1698        $phpmailer->Hostname = get_current_site()->domain;
    17031699}
    17041700
    17051701/**
  • 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;
    73 
    7472        $blog = get_blog_details();
    7573
    7674        // Allow short-circuiting
     
    9391                if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
    9492                        return WP_CONTENT_DIR . '/blog-inactive.php';
    9593                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}" ) ) ) );
     94                        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 ) ) ) );
    9795        }
    9896
    9997        if ( $blog->archived == '1' || $blog->spam == '1' ) {
  • src/wp-login.php

     
    3838 * @param string $message Optional. Message to display in header.
    3939 * @param WP_Error $wp_error Optional. WordPress Error Object
    4040 */
    41 function login_header($title = 'Log In', $message = '', $wp_error = '') {
    42         global $error, $interim_login, $current_site, $action;
     41function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
     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

     
    7777 * @param string $blog_title The new site title
    7878 * @param array $errors
    7979 */
    80 function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
    81         global $current_site;
     80function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
     81        $current_site = get_current_site();
    8282        // Blog name
    8383        if ( !is_subdomain_install() )
    8484                echo '<label for="blogname">' . __('Site Name:') . '</label>';
     
    201201 * @param string $blog_title The new blog title
    202202 * @param array $errors
    203203 */
    204 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
    205         global $current_site;
     204function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
    206205        $current_user = wp_get_current_user();
    207206
    208207        if ( ! is_wp_error($errors) ) {
     
    215214        $blog_title = $filtered_results['blog_title'];
    216215        $errors = $filtered_results['errors'];
    217216
    218         echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';
     217        echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
    219218
    220219        if ( $errors->get_error_code() ) {
    221220                echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
     
    311310 * @param string $user_email The user's email
    312311 * @param array $errors
    313312 */
    314 function signup_user($user_name = '', $user_email = '', $errors = '') {
    315         global $current_site, $active_signup;
     313function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
     314        global $active_signup;
    316315
    317316        if ( !is_wp_error($errors) )
    318317                $errors = new WP_Error();
     
    327326
    328327        ?>
    329328
    330         <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
     329        <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2>
    331330        <form id="setupform" method="post" action="wp-signup.php">
    332331                <input type="hidden" name="stage" value="validate-user-signup" />
    333332                <?php do_action( 'signup_hidden_fields' ); ?>