Make WordPress Core


Ignore:
Timestamp:
11/13/2013 03:22:48 AM (11 years ago)
Author:
SergeyBiryukov
Message:

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

props jeremyfelt.
fixes #25158.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r25862 r26120  
    536536 * @return array Contains the new site data and error messages.
    537537 */
    538 function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
    539     global $wpdb, $domain, $current_site;
    540 
     538function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
     539    global $wpdb, $domain;
     540
     541    $current_site = get_current_site();
    541542    $base = $current_site->path;
    542543
     
    710711 */
    711712function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {
    712     global $current_site;
    713 
    714713    if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
    715714        return false;
    716715
    717716    // Send email with activation link.
    718     if ( !is_subdomain_install() || $current_site->id != 1 )
     717    if ( !is_subdomain_install() || get_current_site()->id != 1 )
    719718        $activate_url = network_site_url("wp-activate.php?key=$key");
    720719    else
     
    11231122 * @param string $blog_title The title of the new site.
    11241123 */
    1125 function install_blog($blog_id, $blog_title = '') {
    1126     global $wpdb, $wp_roles, $current_site;
     1124function install_blog( $blog_id, $blog_title = '' ) {
     1125    global $wpdb, $wp_roles;
    11271126
    11281127    // Cast for security
     
    11521151        update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    11531152    else
    1154         update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );
     1153        update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
    11551154
    11561155    update_option( 'blogname', wp_unslash( $blog_title ) );
     
    12061205 */
    12071206function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
    1208     global $current_site;
     1207    $current_site = get_current_site();
    12091208
    12101209    if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
     
    12701269 */
    12711270function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
    1272     global $current_site;
     1271    $current_site = get_current_site();
    12731272
    12741273    if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
     
    15611560 */
    15621561function redirect_this_site( $deprecated = '' ) {
    1563     global $current_site;
    1564     return array( $current_site->domain );
     1562    return array( get_current_site()->domain );
    15651563}
    15661564
     
    16901688 */
    16911689function add_new_user_to_blog( $user_id, $password, $meta ) {
    1692     global $current_site;
    16931690    if ( !empty( $meta[ 'add_to_blog' ] ) ) {
    16941691        $blog_id = $meta[ 'add_to_blog' ];
    16951692        $role = $meta[ 'new_role' ];
    1696         remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog.
     1693        remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
    16971694        add_user_to_blog( $blog_id, $user_id, $role );
    16981695        update_user_meta( $user_id, 'primary_blog', $blog_id );
     
    17061703 */
    17071704function fix_phpmailer_messageid( $phpmailer ) {
    1708     global $current_site;
    1709     $phpmailer->Hostname = $current_site->domain;
     1705    $phpmailer->Hostname = get_current_site()->domain;
    17101706}
    17111707
Note: See TracChangeset for help on using the changeset viewer.