WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/07/2010 04:27:46 AM (12 years ago)
Author:
ryan
Message:

Strip trailing whites from ms files. see #11644

File:
1 edited

Legend:

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

    r12628 r12632  
    7878function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
    7979    global $wpdb;
    80    
     80
    8181    if( $sitedomain == '' ) {
    8282        $site_id = $wpdb->siteid;
     
    188188 *
    189189 * @deprecated Use {@link is_keymaster()}
    190  * 
     190 *
    191191 */
    192192function is_site_admin( $user_login = '' ) {
     
    270270function add_blog_option( $id, $key, $value ) {
    271271    $id = (int) $id;
    272    
     272
    273273    switch_to_blog($id);
    274274    add_option( $key, $value );
     
    279279function delete_blog_option( $id, $key ) {
    280280    $id = (int) $id;
    281    
     281
    282282    switch_to_blog($id);
    283283    delete_option( $key );
     
    288288function update_blog_option( $id, $key, $value, $refresh = true ) {
    289289    $id = (int) $id;
    290    
     290
    291291    switch_to_blog($id);
    292292    update_option( $key, $value );
     
    309309    $switched_stack[] = $blog_id;
    310310
    311     /* If we're switching to the same blog id that we're on, 
    312     * set the right vars, do the associated actions, but skip 
     311    /* If we're switching to the same blog id that we're on,
     312    * set the right vars, do the associated actions, but skip
    313313    * the extra unnecessary work */
    314314    if ( $blog_id == $new_blog ) {
     
    408408    do_action('switch_blog', $blog_id, $prev_blog_id);
    409409
    410     /* If we still have items in the switched stack, consider ourselves still 'switched' */ 
     410    /* If we still have items in the switched stack, consider ourselves still 'switched' */
    411411    $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 );
    412412    return true;
     
    512512    $user_id = (int) $user_id;
    513513    $blog_id = (int) $blog_id;
    514    
     514
    515515    if( $blog_id == 0 ) {
    516516        global $wpdb;
    517517        $blog_id = $wpdb->blogid;
    518518    }
    519    
     519
    520520    $blogs = get_blogs_of_user( $user_id );
    521521    if( is_array( $blogs ) ) {
     
    907907function is_email_address_unsafe( $user_email ) {
    908908    $banned_names = get_site_option( "banned_email_domains" );
    909     if ($banned_names && !is_array( $banned_names )) { 
    910         $banned_names = explode( "\n", $banned_names); 
    911     } 
     909    if ($banned_names && !is_array( $banned_names )) {
     910        $banned_names = explode( "\n", $banned_names);
     911    }
    912912    if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
    913913        $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
     
    11171117    $path = $wpdb->escape($path);
    11181118    $title = $wpdb->escape($title);
    1119                    
     1119
    11201120    $wpdb->insert( $wpdb->signups, array(
    1121         'domain' => $domain, 
    1122         'path' => $path, 
     1121        'domain' => $domain,
     1122        'path' => $path,
    11231123        'title' => $title,
    1124         'user_login' => $user, 
    1125         'user_email' => $user_email, 
     1124        'user_login' => $user,
     1125        'user_email' => $user_email,
    11261126        'registered' => current_time('mysql', true),
    1127         'activation_key' => $key, 
     1127        'activation_key' => $key,
    11281128        'meta' => $meta
    11291129    ) );
     
    11401140    $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
    11411141    $meta = serialize($meta);
    1142                    
     1142
    11431143    $wpdb->insert( $wpdb->signups, array(
    1144         'domain' => '', 
    1145         'path' => '', 
     1144        'domain' => '',
     1145        'path' => '',
    11461146        'title' => '',
    1147         'user_login' => $user, 
    1148         'user_email' => $user_email, 
     1147        'user_login' => $user,
     1148        'user_email' => $user_email,
    11491149        'registered' => current_time('mysql', true),
    1150         'activation_key' => $key, 
     1150        'activation_key' => $key,
    11511151        'meta' => $meta
    11521152    ) );
     
    13441344    if( get_site_option( 'registrationnotification' ) != 'yes' )
    13451345        return false;
    1346        
     1346
    13471347    $email = get_site_option( 'admin_email' );
    13481348    if( is_email($email) == false )
    13491349        return false;
    1350    
     1350
    13511351    $options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
    13521352
     
    13551355    $siteurl = get_option( 'siteurl' );
    13561356    restore_current_blog();
    1357    
     1357
    13581358    $msg = sprintf( __( "New Blog: %1s
    13591359URL: %2s
     
    13621362Disable these notifications: %4s"), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url);
    13631363    $msg = apply_filters( 'newblog_notify_siteadmin', $msg );
    1364    
     1364
    13651365    wp_mail( $email, sprintf( __( "New Blog Registration: %s" ), $siteurl ), $msg );
    13661366    return true;
     
    13711371    if( get_site_option( 'registrationnotification' ) != 'yes' )
    13721372        return false;
    1373        
     1373
    13741374    $email = get_site_option( 'admin_email' );
    13751375    if( is_email($email) == false )
     
    13821382
    13831383Disable these notifications: %3s"), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url);
    1384    
     1384
    13851385    $msg = apply_filters( 'newuser_notify_siteadmin', $msg );
    13861386    wp_mail( $email, sprintf(__("New User Registration: %s"), $user->user_login), $msg );
     
    14171417    require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
    14181418
    1419     if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") ) 
     1419    if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
    14201420        die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
    14211421    $wpdb->suppress_errors( false);
     
    14451445    $cat_name = __('Blogroll');
    14461446    $cat_slug = sanitize_title($cat_name);
    1447    
     1447
    14481448    $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    14491449    if( $blogroll_id == null ) {
     
    14881488    $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
    14891489    $wpdb->insert( $wpdb->posts, array(
    1490         'post_author' => $user_id, 
    1491         'post_date' => $now, 
     1490        'post_author' => $user_id,
     1491        'post_date' => $now,
    14921492        'post_date_gmt' => $now_gmt,
    1493         'post_content' => stripslashes( $first_post ), 
    1494         'post_excerpt' => '', 
     1493        'post_content' => stripslashes( $first_post ),
     1494        'post_excerpt' => '',
    14951495        'post_title' => __('Hello world!'),
    14961496        'post_name' => __('hello-world'),
     
    15071507    // First page
    15081508    $wpdb->insert( $wpdb->posts, array(
    1509         'post_author' => $user_id, 
    1510         'post_date' => $now, 
     1509        'post_author' => $user_id,
     1510        'post_date' => $now,
    15111511        'post_date_gmt' => $now_gmt,
    15121512        'post_content' => get_site_option( 'first_page' ),
    1513         'post_excerpt' => '', 
     1513        'post_excerpt' => '',
    15141514        'post_title' => __('About'),
    15151515        'post_name' => __('about'),
     
    15221522        'post_content_filtered' => ''
    15231523    ) );
    1524    
     1524
    15251525    // Flush rules to pick up the new page.
    15261526    $wp_rewrite->init();
     
    15291529    // Default comment
    15301530    $wpdb->insert( $wpdb->comments, array(
    1531         'comment_post_ID' => '1', 
     1531        'comment_post_ID' => '1',
    15321532        'comment_author' => __( get_site_option( 'first_comment_author' ) ),
    15331533        'comment_author_email' => '',
    15341534        'comment_author_url' => get_site_option( 'first_comment_url' ),
    1535         'comment_author_IP' => '127.0.0.1', 
     1535        'comment_author_IP' => '127.0.0.1',
    15361536        'comment_date' => $now,
    1537         'comment_date_gmt' => $now_gmt, 
     1537        'comment_date_gmt' => $now_gmt,
    15381538        'comment_content' => __( get_site_option( 'first_comment' ) )
    15391539    ) );
    1540    
     1540
    15411541    $user = new WP_User($user_id);
    15421542    $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
     
    15451545    $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') );
    15461546    $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
    1547    
     1547
    15481548    // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
    15491549    if ( !is_site_admin( $user->user_login ) && $user_id != 1 )
     
    16061606        return false;
    16071607
    1608     $welcome_email = get_site_option( 'welcome_user_email' ); 
     1608    $welcome_email = get_site_option( 'welcome_user_email' );
    16091609
    16101610    $user = new WP_User($user_id);
     
    17471747    $spaceAllowed = get_space_allowed();
    17481748    if(empty($spaceAllowed) || !is_numeric($spaceAllowed))
    1749         $spaceAllowed = 10; // Default space allowed is 10 MB 
    1750    
     1749        $spaceAllowed = 10; // Default space allowed is 10 MB
     1750
    17511751    $dirName = BLOGUPLOADDIR;
    17521752    $size = get_dirsize($dirName) / 1024 / 1024;
    1753    
    1754     if( ($spaceAllowed-$size) < 0 ) { 
     1753
     1754    if( ($spaceAllowed-$size) < 0 ) {
    17551755        if( $echo )
    17561756            _e( "Sorry, you have used your space allocation. Please delete some files to upload more files." ); //No space left
     
    17881788        return 0;
    17891789    }
    1790    
     1790
    17911791    $spaceAllowed = 1024 * 1024 * get_space_allowed();
    17921792    $dirName = BLOGUPLOADDIR;
     
    18021802function graceful_fail( $message ) {
    18031803    $message = apply_filters('graceful_fail', $message);
    1804     $message_template = apply_filters( 'graceful_fail_template', 
     1804    $message_template = apply_filters( 'graceful_fail_template',
    18051805'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    18061806<html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
     
    18441844
    18451845        if( $this->reallydeleteblog == true ) {
    1846             wpmu_delete_blog( $wpdb->blogid ); 
     1846            wpmu_delete_blog( $wpdb->blogid );
    18471847        }
    18481848    }
     
    18631863            $url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash;
    18641864            $msg = __("Dear User,
    1865 You recently clicked the 'Delete Blog' link on your blog and filled in a 
     1865You recently clicked the 'Delete Blog' link on your blog and filled in a
    18661866form on that page.
    18671867If you really want to delete your blog, click the link below. You will not
     
    18701870
    18711871If you delete your blog, please consider opening a new blog here
    1872 some time in the future! (But remember your current blog and username 
     1872some time in the future! (But remember your current blog and username
    18731873are gone forever.)
    18741874
     
    19331933    clean_term_cache($term_id);
    19341934
    1935     return $global_id; 
    1936 }   
     1935    return $global_id;
     1936}
    19371937
    19381938function redirect_this_site( $deprecated = '' ) {
     
    19451945        return $upload;
    19461946    if( strlen( $upload[ 'bits' ] )  > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
    1947         return sprintf(__( "This file is too big. Files must be less than %dKb in size.<br />" ), get_site_option( 'fileupload_maxk', 1500 )); 
     1947        return sprintf(__( "This file is too big. Files must be less than %dKb in size.<br />" ), get_site_option( 'fileupload_maxk', 1500 ));
    19481948    }
    19491949
     
    21132113}
    21142114
    2115 /* Short circuit the update checks. Make sure update informtion is 
     2115/* Short circuit the update checks. Make sure update informtion is
    21162116   stored in wp_sitemeta rather than the options table of individual blogs */
    21172117
     
    21982198
    21992199    $dashboard_blog = get_dashboard_blog();
    2200     if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) { 
    2201         $protocol = ( is_ssl() ? 'https://' : 'http://' ); 
     2200    if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
     2201        $protocol = ( is_ssl() ? 'https://' : 'http://' );
    22022202        wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' );
    22032203        die();
     
    22232223    if( $blog_id == 0 )
    22242224        $blog_id = $wpdb->blogid;
    2225    
     2225
    22262226    $local_key = $wpdb->base_prefix . $blog_id . "_" . $key;
    22272227    if( isset( $current_user->$local_key ) )
     
    23472347    if ( !$active_sitewide_plugins )
    23482348        return $active_plugins;
    2349    
     2349
    23502350    $plugins = array_merge( (array) $active_plugins, array_keys( (array) $active_sitewide_plugins ) );
    23512351    sort( $plugins );
Note: See TracChangeset for help on using the changeset viewer.