WordPress.org

Make WordPress Core

Changeset 22108


Ignore:
Timestamp:
10/04/2012 12:40:09 PM (6 years ago)
Author:
ryan
Message:

Reduce use of global. Use get_blog_details() instead. fixes #22090

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-importer.php

    r17771 r22108  
    133133            }
    134134            $blog_id = (int) $blog->blog_id;
    135             // Restore global $current_blog
    136             global $current_blog;
    137             $current_blog = $blog;
    138135        }
    139136
     
    213210     */
    214211    function is_user_over_quota() {
    215         global $current_blog;
    216 
    217212        if ( function_exists( 'upload_is_user_over_quota' ) ) {
    218213            if ( upload_is_user_over_quota( 1 ) ) {
  • trunk/wp-admin/ms-delete-site.php

    r19712 r22108  
    2525    }
    2626}
     27
     28$blog = get_blog_details();
    2729
    2830$title = __( 'Delete Site' );
     
    7375        <?php wp_nonce_field( 'delete-blog' ) ?>
    7476        <input type="hidden" name="action" value="deleteblog" />
    75         <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_blog->domain . $current_blog->path ); ?></strong></label></p>
     77        <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p>
    7678        <?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
    7779    </form>
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r22037 r22108  
    36613661     */
    36623662    function _multisite_getUsersBlogs($args) {
    3663         global $current_blog;
     3663        $current_blog = get_blog_details();
     3664
    36643665        $domain = $current_blog->domain;
    36653666        $path = $current_blog->path . 'xmlrpc.php';
  • trunk/wp-includes/functions.php

    r22106 r22108  
    31193119 */
    31203120function is_main_site( $blog_id = '' ) {
    3121     global $current_site, $current_blog;
    3122 
    3123     if ( !is_multisite() )
     3121    global $current_site;
     3122
     3123    if ( ! is_multisite() )
    31243124        return true;
    31253125
    3126     if ( !$blog_id )
    3127         $blog_id = $current_blog->blog_id;
     3126    if ( ! $blog_id )
     3127        $blog_id = get_current_blog_id();
    31283128
    31293129    return $blog_id == $current_site->blog_id;
  • trunk/wp-includes/ms-blogs.php

    r22092 r22108  
    119119 * @since MU
    120120 *
    121  * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against.
     121 * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. If not specified the current blog ID is used.
    122122 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
    123123 * @return object Blog details.
    124124 */
    125 function get_blog_details( $fields, $get_all = true ) {
     125function get_blog_details( $fields = null, $get_all = true ) {
    126126    global $wpdb;
    127127
     
    167167        }
    168168    } else {
    169         if ( !is_numeric( $fields ) )
     169        if ( ! $fields )
     170            $blog_id = get_current_blog_id();
     171        elseif ( ! is_numeric( $fields ) )
    170172            $blog_id = get_id_from_blogname( $fields );
    171173        else
  • trunk/wp-includes/ms-load.php

    r19760 r22108  
    7070 */
    7171function ms_site_check() {
    72     global $wpdb, $current_blog;
     72    global $wpdb;
     73
     74    $blog = get_blog_details();
    7375
    7476    // Allow short-circuiting
     
    8183        return true;
    8284
    83     if ( '1' == $current_blog->deleted ) {
     85    if ( '1' == $blog->deleted ) {
    8486        if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
    8587            return WP_CONTENT_DIR . '/blog-deleted.php';
     
    8890    }
    8991
    90     if ( '2' == $current_blog->deleted ) {
     92    if ( '2' == $blog->deleted ) {
    9193        if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
    9294            return WP_CONTENT_DIR . '/blog-inactive.php';
     
    9597    }
    9698
    97     if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
     99    if ( $blog->archived == '1' || $blog->spam == '1' ) {
    98100        if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
    99101            return WP_CONTENT_DIR . '/blog-suspended.php';
Note: See TracChangeset for help on using the changeset viewer.