WordPress.org

Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.