<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12709] trunk/wp-includes/ms-functions.php: Formatting cleanup.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12709">12709</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-12 18:40:40 +0000 (Tue, 12 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Formatting cleanup. Props Simek. fixes <a href="http://trac.wordpress.org/ticket/11876">#11876</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12708 => 12709)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-01-12 16:50:37 UTC (rev 12708)
+++ trunk/wp-includes/ms-functions.php        2010-01-12 18:40:40 UTC (rev 12709)
</span><span class="lines">@@ -31,8 +31,8 @@
</span><span class="cx"> function get_blogaddress_by_name( $blogname ) {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if( is_subdomain_install() ) {
-                if( $blogname == 'main' )
</del><ins>+        if ( is_subdomain_install() ) {
+                if ( $blogname == 'main' )
</ins><span class="cx">                         $blogname = 'www';
</span><span class="cx">                 return clean_url( &quot;http://&quot; . $blogname . &quot;.&quot; . $current_site-&gt;domain . $current_site-&gt;path );
</span><span class="cx">         } else {
</span><span class="lines">@@ -41,12 +41,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function get_blogaddress_by_domain( $domain, $path ){
</span><del>-        if( is_subdomain_install() ) {
</del><ins>+        if ( is_subdomain_install() ) {
</ins><span class="cx">                 $url = &quot;http://&quot;.$domain.$path;
</span><span class="cx">         } else {
</span><del>-                if( $domain != $_SERVER['HTTP_HOST'] ) {
</del><ins>+                if ( $domain != $_SERVER['HTTP_HOST'] ) {
</ins><span class="cx">                         $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
</span><del>-                        if( $blogname != 'www.' ) {
</del><ins>+                        if ( $blogname != 'www.' ) {
</ins><span class="cx">                                 $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path . $blogname . '/';
</span><span class="cx">                         } else { // we're installing the main blog
</span><span class="cx">                                 $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         $stats['blogs'] = get_blog_count();
</span><span class="cx"> 
</span><span class="cx">         $count_ts = get_site_option( &quot;get_user_count_ts&quot; );
</span><del>-        if( time() - $count_ts &gt; 3600 ) {
</del><ins>+        if ( time() - $count_ts &gt; 3600 ) {
</ins><span class="cx">                 $count = $wpdb-&gt;get_var( &quot;SELECT COUNT(ID) FROM {$wpdb-&gt;users}&quot; );
</span><span class="cx">                 update_site_option( &quot;user_count&quot;, $count );
</span><span class="cx">                 update_site_option( &quot;user_count_ts&quot;, time() );
</span><span class="lines">@@ -78,15 +78,14 @@
</span><span class="cx"> function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><del>-        if( $sitedomain == '' ) {
</del><ins>+        if ( $sitedomain == '' )
</ins><span class="cx">                 $site_id = $wpdb-&gt;siteid;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $site_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT id FROM $wpdb-&gt;site WHERE domain = %s AND path = %s&quot;, $sitedomain, $path) );
</span><del>-        }
</del><span class="cx"> 
</span><del>-        if( $site_id != false ) {
</del><ins>+        if ( $site_id != false )
</ins><span class="cx">                 return $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT u.ID, u.user_login, u.user_pass FROM $wpdb-&gt;users AS u, $wpdb-&gt;sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d&quot;, $site_id), ARRAY_A );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -97,7 +96,7 @@
</span><span class="cx"> 
</span><span class="cx"> function is_main_blog() {
</span><span class="cx">         global $current_blog, $current_site;
</span><del>-        if( $current_blog-&gt;domain == $current_site-&gt;domain &amp;&amp; $current_blog-&gt;path == $current_site-&gt;path )
</del><ins>+        if ( $current_blog-&gt;domain == $current_site-&gt;domain &amp;&amp; $current_blog-&gt;path == $current_site-&gt;path )
</ins><span class="cx">                 return true;
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="lines">@@ -123,9 +122,9 @@
</span><span class="cx"> function get_blog_details( $id, $getall = true ) {
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><del>-        if( !is_numeric( $id ) ) {
</del><ins>+        if ( !is_numeric( $id ) )
</ins><span class="cx">                 $id = get_id_from_blogname( $id );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         $all = $getall == true ? '' : 'short';
</span><span class="cx">         $details = wp_cache_get( $id . $all, 'blog-details' );
</span><span class="cx"> 
</span><span class="lines">@@ -151,9 +150,9 @@
</span><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;suppress_errors();
</span><span class="cx">         switch_to_blog( $id );
</span><del>-        $details-&gt;blogname   = get_option( 'blogname' );
-        $details-&gt;siteurl    = get_option( 'siteurl' );
-        $details-&gt;post_count = get_option( 'post_count' );
</del><ins>+        $details-&gt;blogname                = get_option( 'blogname' );
+        $details-&gt;siteurl                = get_option( 'siteurl' );
+        $details-&gt;post_count        = get_option( 'post_count' );
</ins><span class="cx">         restore_current_blog();
</span><span class="cx">         $wpdb-&gt;suppress_errors( false );
</span><span class="cx"> 
</span><span class="lines">@@ -216,18 +215,17 @@
</span><span class="cx">                 $row = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM {$blog_prefix}options WHERE option_name = %s&quot;, $setting ) );
</span><span class="cx">                 if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
</span><span class="cx">                         $value = $row-&gt;option_value;
</span><del>-                        if ( $value == false ) {
</del><ins>+                        if ( $value == false )
</ins><span class="cx">                                 wp_cache_set( $key, 'falsevalue', 'site-options' );
</span><del>-                        } else {
</del><ins>+                        else
</ins><span class="cx">                                 wp_cache_set( $key, $value, 'site-options' );
</span><del>-                        }
</del><span class="cx">                 } else { // option does not exist, so we must cache its non-existence
</span><span class="cx">                         wp_cache_set( $key, 'noop', 'site-options' );
</span><span class="cx">                         $value = $default;
</span><span class="cx">                 }
</span><del>-        } elseif( $value == 'noop' ) {
</del><ins>+        } elseif ( $value == 'noop' ) {
</ins><span class="cx">                 $value = $default;
</span><del>-        } elseif( $value == 'falsevalue' ) {
</del><ins>+        } elseif ( $value == 'falsevalue' ) {
</ins><span class="cx">                 $value = false;
</span><span class="cx">         }
</span><span class="cx">         // If home is not set use siteurl.
</span><span class="lines">@@ -268,7 +266,7 @@
</span><span class="cx">         update_option( $key, $value );
</span><span class="cx">         restore_current_blog();
</span><span class="cx"> 
</span><del>-        if( $refresh == true )
</del><ins>+        if ( $refresh == true )
</ins><span class="cx">                 refresh_blog_details( $id );
</span><span class="cx">         wp_cache_set( $id.&quot;-&quot;.$key.&quot;-blog_option&quot;, $value, 'site-options');
</span><span class="cx"> }
</span><span class="lines">@@ -298,31 +296,29 @@
</span><span class="cx">         $prev_blog_id = $blog_id;
</span><span class="cx">         $blog_id = $new_blog;
</span><span class="cx"> 
</span><del>-        if( is_object( $wp_roles ) ) {
</del><ins>+        if ( is_object( $wp_roles ) ) {
</ins><span class="cx">                 $wpdb-&gt;suppress_errors();
</span><del>-                if ( method_exists( $wp_roles ,'_init' ) ) {
</del><ins>+                if ( method_exists( $wp_roles ,'_init' ) )
</ins><span class="cx">                         $wp_roles-&gt;_init();
</span><del>-                } elseif( method_exists( $wp_roles, '__construct' ) ) {
</del><ins>+                elseif ( method_exists( $wp_roles, '__construct' ) )
</ins><span class="cx">                         $wp_roles-&gt;__construct();
</span><del>-                }
</del><span class="cx">                 $wpdb-&gt;suppress_errors( false );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( is_object( $current_user ) )
</span><span class="cx">                 $current_user-&gt;_init_caps();
</span><span class="cx"> 
</span><del>-        if ( is_object( $wp_object_cache ) ) {
</del><ins>+        if ( is_object( $wp_object_cache ) )
</ins><span class="cx">                 $global_groups = $wp_object_cache-&gt;global_groups;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $global_groups = false;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         wp_cache_init();
</span><span class="cx">         if ( function_exists('wp_cache_add_global_groups') ) {
</span><del>-                if ( is_array( $global_groups ) ) {
</del><ins>+                if ( is_array( $global_groups ) )
</ins><span class="cx">                         wp_cache_add_global_groups( $global_groups );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'site-transient', 'global-posts' ) );
</span><del>-                }
</del><span class="cx">                 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -353,31 +349,29 @@
</span><span class="cx">         $blog_id = $blog;
</span><span class="cx">         $table_prefix = $wpdb-&gt;prefix;
</span><span class="cx"> 
</span><del>-        if( is_object( $wp_roles ) ) {
</del><ins>+        if ( is_object( $wp_roles ) ) {
</ins><span class="cx">                 $wpdb-&gt;suppress_errors();
</span><del>-                if ( method_exists( $wp_roles ,'_init' ) ) {
</del><ins>+                if ( method_exists( $wp_roles ,'_init' ) )
</ins><span class="cx">                         $wp_roles-&gt;_init();
</span><del>-                } elseif( method_exists( $wp_roles, '__construct' ) ) {
</del><ins>+                elseif ( method_exists( $wp_roles, '__construct' ) )
</ins><span class="cx">                         $wp_roles-&gt;__construct();
</span><del>-                }
</del><span class="cx">                 $wpdb-&gt;suppress_errors( false );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( is_object( $current_user ) )
</span><span class="cx">                 $current_user-&gt;_init_caps();
</span><span class="cx"> 
</span><del>-        if ( is_object( $wp_object_cache ) ) {
</del><ins>+        if ( is_object( $wp_object_cache ) )
</ins><span class="cx">                 $global_groups = $wp_object_cache-&gt;global_groups;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $global_groups = false;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         wp_cache_init();
</span><span class="cx">         if ( function_exists('wp_cache_add_global_groups') ) {
</span><del>-                if ( is_array( $global_groups ) ) {
</del><ins>+                if ( is_array( $global_groups ) )
</ins><span class="cx">                         wp_cache_add_global_groups( $global_groups );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'site-transient' ) );
</span><del>-                }
</del><span class="cx">                 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -393,9 +387,8 @@
</span><span class="cx"> 
</span><span class="cx">         $cache_suffix = $all ? '_all' : '_short';
</span><span class="cx">         $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' );
</span><del>-        if ( $return ) {
</del><ins>+        if ( $return )
</ins><span class="cx">                 return apply_filters( 'get_blogs_of_user', $return, $id, $all );
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         $user = get_userdata( (int) $id );
</span><span class="cx">         if ( !$user )
</span><span class="lines">@@ -406,12 +399,12 @@
</span><span class="cx">                 if ( false !== strpos( $key, '_capabilities') &amp;&amp; 0 === strpos( $key, $wpdb-&gt;base_prefix ) &amp;&amp; preg_match( '/' . $wpdb-&gt;base_prefix . '(\d+)_capabilities/', $key, $match ) ) {
</span><span class="cx">                         $blog = get_blog_details( $match[1] );
</span><span class="cx">                         if ( $blog &amp;&amp; isset( $blog-&gt;domain ) &amp;&amp; ( $all == true || $all == false &amp;&amp; ( $blog-&gt;archived == 0 &amp;&amp; $blog-&gt;spam == 0 &amp;&amp; $blog-&gt;deleted == 0 ) ) ) {
</span><del>-                                $blogs[$match[1]]-&gt;userblog_id = $match[1];
-                                $blogs[$match[1]]-&gt;blogname    = $blog-&gt;blogname;
-                                $blogs[$match[1]]-&gt;domain      = $blog-&gt;domain;
-                                $blogs[$match[1]]-&gt;path        = $blog-&gt;path;
-                                $blogs[$match[1]]-&gt;site_id     = $blog-&gt;site_id;
-                                $blogs[$match[1]]-&gt;siteurl     = $blog-&gt;siteurl;
</del><ins>+                                $blogs[$match[1]]-&gt;userblog_id        = $match[1];
+                                $blogs[$match[1]]-&gt;blogname                = $blog-&gt;blogname;
+                                $blogs[$match[1]]-&gt;domain                = $blog-&gt;domain;
+                                $blogs[$match[1]]-&gt;path                        = $blog-&gt;path;
+                                $blogs[$match[1]]-&gt;site_id                = $blog-&gt;site_id;
+                                $blogs[$match[1]]-&gt;siteurl                = $blog-&gt;siteurl;
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -488,17 +481,16 @@
</span><span class="cx">         $user_id = (int) $user_id;
</span><span class="cx">         $blog_id = (int) $blog_id;
</span><span class="cx"> 
</span><del>-        if( $blog_id == 0 ) {
</del><ins>+        if ( $blog_id == 0 ) {
</ins><span class="cx">                 global $wpdb;
</span><span class="cx">                 $blog_id = $wpdb-&gt;blogid;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $blogs = get_blogs_of_user( $user_id );
</span><del>-        if( is_array( $blogs ) ) {
</del><ins>+        if ( is_array( $blogs ) )
</ins><span class="cx">                 return array_key_exists( $blog_id, $blogs );
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 return false;
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function is_archived( $id ) {
</span><span class="lines">@@ -517,15 +509,14 @@
</span><span class="cx">                 return $value;
</span><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;update( $wpdb-&gt;blogs, array($pref =&gt; $value, 'last_updated' =&gt; current_time('mysql', true)), array('blog_id' =&gt; $id) );
</span><del>-        if( $refresh == 1 )
</del><ins>+        if ( $refresh == 1 )
</ins><span class="cx">                 refresh_blog_details($id);
</span><span class="cx"> 
</span><del>-        if( $pref == 'spam' ) {
-                if( $value == 1 ) {
</del><ins>+        if ( $pref == 'spam' ) {
+                if ( $value == 1 )
</ins><span class="cx">                         do_action( &quot;make_spam_blog&quot;, $id );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         do_action( &quot;make_ham_blog&quot;, $id );
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $value;
</span><span class="lines">@@ -535,9 +526,9 @@
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><span class="cx">         $details = get_blog_details( $id, false );
</span><del>-        if( $details ) {
</del><ins>+        if ( $details )
</ins><span class="cx">                 return $details-&gt;$pref;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT $pref FROM {$wpdb-&gt;blogs} WHERE blog_id = %d&quot;, $id) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -549,18 +540,18 @@
</span><span class="cx"> function get_most_active_blogs( $num = 10, $display = true ) {
</span><span class="cx">         $most_active = get_site_option( &quot;most_active&quot; );
</span><span class="cx">         $update = false;
</span><del>-        if( is_array( $most_active ) ) {
-                if( ( $most_active['time'] + 60 ) &lt; time() ) { // cache for 60 seconds.
</del><ins>+        if ( is_array( $most_active ) ) {
+                if ( ( $most_active['time'] + 60 ) &lt; time() ) { // cache for 60 seconds.
</ins><span class="cx">                         $update = true;
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 $update = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if( $update == true ) {
</del><ins>+        if ( $update == true ) {
</ins><span class="cx">                 unset( $most_active );
</span><span class="cx">                 $blogs = get_blog_list( 0, 'all', false ); // $blog_id -&gt; $details
</span><del>-                if( is_array( $blogs ) ) {
</del><ins>+                if ( is_array( $blogs ) ) {
</ins><span class="cx">                         reset( $blogs );
</span><span class="cx">                         foreach ( (array) $blogs as $key =&gt; $details ) {
</span><span class="cx">                                 $most_active[ $details['blog_id'] ] = $details['postcount'];
</span><span class="lines">@@ -568,17 +559,17 @@
</span><span class="cx">                         }
</span><span class="cx">                         arsort( $most_active );
</span><span class="cx">                         reset( $most_active );
</span><del>-                        foreach ( (array) $most_active as $key =&gt; $details ) {
</del><ins>+                        foreach ( (array) $most_active as $key =&gt; $details )
</ins><span class="cx">                                 $t[ $key ] = $blog_list[ $key ];
</span><del>-                        }
</del><ins>+
</ins><span class="cx">                         unset( $most_active );
</span><span class="cx">                         $most_active = $t;
</span><span class="cx">                 }
</span><span class="cx">                 update_site_option( &quot;most_active&quot;, $most_active );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if( $display == true ) {
-                if( is_array( $most_active ) ) {
</del><ins>+        if ( $display == true ) {
+                if ( is_array( $most_active ) ) {
</ins><span class="cx">                         reset( $most_active );
</span><span class="cx">                         foreach ( (array) $most_active as $key =&gt; $details ) {
</span><span class="cx">                                 $url = clean_url(&quot;http://&quot; . $details['domain'] . $details['path']);
</span><span class="lines">@@ -594,15 +585,15 @@
</span><span class="cx"> 
</span><span class="cx">         $blogs = get_site_option( &quot;blog_list&quot; );
</span><span class="cx">         $update = false;
</span><del>-        if( is_array( $blogs ) ) {
-                if( ( $blogs['time'] + 60 ) &lt; time() ) { // cache for 60 seconds.
</del><ins>+        if ( is_array( $blogs ) ) {
+                if ( ( $blogs['time'] + 60 ) &lt; time() ) { // cache for 60 seconds.
</ins><span class="cx">                         $update = true;
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 $update = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if( $update == true ) {
</del><ins>+        if ( $update == true ) {
</ins><span class="cx">                 unset( $blogs );
</span><span class="cx">                 $blogs = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT blog_id, domain, path FROM $wpdb-&gt;blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC&quot;, $wpdb-&gt;siteid), ARRAY_A );
</span><span class="cx"> 
</span><span class="lines">@@ -615,21 +606,20 @@
</span><span class="cx">                 update_site_option( &quot;blog_list&quot;, $blogs );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if( false == is_array( $blogs ) )
</del><ins>+        if ( false == is_array( $blogs ) )
</ins><span class="cx">                 return array();
</span><span class="cx"> 
</span><del>-        if( $num == 'all' ) {
</del><ins>+        if ( $num == 'all' )
</ins><span class="cx">                 return array_slice( $blogs, $start, count( $blogs ) );
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 return array_slice( $blogs, $start, $num );
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function get_user_count() {
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><span class="cx">         $count_ts = get_site_option( &quot;user_count_ts&quot; );
</span><del>-        if( time() - $count_ts &gt; 3600 ) {
</del><ins>+        if ( time() - $count_ts &gt; 3600 ) {
</ins><span class="cx">                 $count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(ID) as c FROM $wpdb-&gt;users WHERE spam = '0' AND deleted = '0'&quot;) );
</span><span class="cx">                 update_site_option( &quot;user_count&quot;, $count );
</span><span class="cx">                 update_site_option( &quot;user_count_ts&quot;, time() );
</span><span class="lines">@@ -643,11 +633,11 @@
</span><span class="cx"> function get_blog_count( $id = 0 ) {
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><del>-        if( $id == 0 )
</del><ins>+        if ( $id == 0 )
</ins><span class="cx">                 $id = $wpdb-&gt;siteid;
</span><span class="cx"> 
</span><span class="cx">         $count_ts = get_site_option( &quot;blog_count_ts&quot; );
</span><del>-        if( time() - $count_ts &gt; 3600 ) {
</del><ins>+        if ( time() - $count_ts &gt; 3600 ) {
</ins><span class="cx">                 $count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(blog_id) as c FROM $wpdb-&gt;blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'&quot;, $id) );
</span><span class="cx">                 update_site_option( &quot;blog_count&quot;, $count );
</span><span class="cx">                 update_site_option( &quot;blog_count_ts&quot;, time() );
</span><span class="lines">@@ -663,7 +653,7 @@
</span><span class="cx"> 
</span><span class="cx">         $key = $blog_id . &quot;-&quot; . $post_id;
</span><span class="cx">         $post = wp_cache_get( $key, &quot;global-posts&quot; );
</span><del>-        if( $post == false ) {
</del><ins>+        if ( $post == false ) {
</ins><span class="cx">                 $post = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM &quot; . $wpdb-&gt;get_blog_prefix( $blog_id ) . &quot;posts WHERE ID = %d&quot;, $post_id ) );
</span><span class="cx">                 wp_cache_add( $key, $post, &quot;global-posts&quot; );
</span><span class="cx">         }
</span><span class="lines">@@ -736,7 +726,7 @@
</span><span class="cx">                 update_usermeta($user_id, 'source_domain', '');
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if( $reassign != '' ) {
</del><ins>+        if ( $reassign != '' ) {
</ins><span class="cx">                 $reassign = (int) $reassign;
</span><span class="cx">                 $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_author = %d WHERE post_author = %d&quot;, $reassign, $user_id) );
</span><span class="cx">                 $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;links SET link_owner = %d WHERE link_owner = %d&quot;, $reassign, $user_id) );
</span><span class="lines">@@ -746,10 +736,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
</span><del>-        $domain       = addslashes( $domain );
-        $weblog_title = addslashes( $weblog_title );
</del><ins>+        $domain                        = addslashes( $domain );
+        $weblog_title        = addslashes( $weblog_title );
</ins><span class="cx"> 
</span><del>-        if( empty($path) )
</del><ins>+        if ( empty($path) )
</ins><span class="cx">                 $path = '/';
</span><span class="cx"> 
</span><span class="cx">         // Check if the domain has been used already. We should return an error message.
</span><span class="lines">@@ -773,7 +763,7 @@
</span><span class="cx"> function get_blog_permalink( $_blog_id, $post_id ) {
</span><span class="cx">         $key = &quot;{$_blog_id}-{$post_id}-blog_permalink&quot;;
</span><span class="cx">         $link = wp_cache_get( $key, 'site-options' );
</span><del>-        if( $link == false ) {
</del><ins>+        if ( $link == false ) {
</ins><span class="cx">                 switch_to_blog( $_blog_id );
</span><span class="cx">                 $link = get_permalink( $post_id );
</span><span class="cx">                 restore_current_blog();
</span><span class="lines">@@ -789,9 +779,9 @@
</span><span class="cx">         $path = strtolower( $wpdb-&gt;escape( $path ) );
</span><span class="cx">         $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
</span><span class="cx"> 
</span><del>-        if( $id == -1 ) { // blog does not exist
</del><ins>+        if ( $id == -1 ) { // blog does not exist
</ins><span class="cx">                 return 0;
</span><del>-        } elseif( $id ) {
</del><ins>+        } elseif ( $id ) {
</ins><span class="cx">                 return (int)$id;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -815,22 +805,21 @@
</span><span class="cx">         if ( isset( $_POST['ref'] ) )
</span><span class="cx">                 $ref = $_POST['ref'];
</span><span class="cx"> 
</span><del>-        if( $ref ) {
</del><ins>+        if ( $ref ) {
</ins><span class="cx">                 $ref = wpmu_admin_redirect_add_updated_param( $ref );
</span><span class="cx">                 wp_redirect( $ref );
</span><span class="cx">                 exit();
</span><span class="cx">         }
</span><del>-        if( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
</del><ins>+        if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
</ins><span class="cx">                 wp_redirect( $_SERVER['HTTP_REFERER'] );
</span><span class="cx">                 exit();
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $url = wpmu_admin_redirect_add_updated_param( $url );
</span><del>-        if( isset( $_GET['redirect'] ) ) {
-                if( substr( $_GET['redirect'], 0, 2 ) == 's_' ) {
</del><ins>+        if ( isset( $_GET['redirect'] ) ) {
+                if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
</ins><span class="cx">                         $url .= &quot;&amp;action=blogs&amp;s=&quot;. wp_specialchars( substr( $_GET['redirect'], 2 ) );
</span><del>-                }
-        } elseif( isset( $_POST['redirect'] ) ) {
</del><ins>+        } elseif ( isset( $_POST['redirect'] ) ) {
</ins><span class="cx">                 $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
</span><span class="cx">         }
</span><span class="cx">         wp_redirect( $url );
</span><span class="lines">@@ -838,12 +827,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wpmu_admin_redirect_add_updated_param( $url = '' ) {
</span><del>-        if( strpos( $url, 'updated=true' ) === false ) {
-                if( strpos( $url, '?' ) === false ) {
</del><ins>+        if ( strpos( $url, 'updated=true' ) === false ) {
+                if ( strpos( $url, '?' ) === false )
</ins><span class="cx">                         return $url . '?updated=true';
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         return $url . '&amp;updated=true';
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx">         return $url;
</span><span class="cx"> }
</span><span class="lines">@@ -863,32 +851,31 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function validate_email( $email, $check_domain = true) {
</span><del>-    if (ereg('^[-!#$%&amp;\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
-        '[-!#$%&amp;\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
-        '[-!#$%&amp;\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
-    {
-        if ($check_domain &amp;&amp; function_exists('checkdnsrr')) {
-            list (, $domain)  = explode('@', $email);
</del><ins>+        if (ereg('^[-!#$%&amp;\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
+                '[-!#$%&amp;\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
+                '[-!#$%&amp;\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
+        {
+                if ($check_domain &amp;&amp; function_exists('checkdnsrr')) {
+                        list (, $domain)  = explode('@', $email);
</ins><span class="cx"> 
</span><del>-            if (checkdnsrr($domain.'.', 'MX') || checkdnsrr($domain.'.', 'A')) {
-                return true;
-            }
-            return false;
-        }
-        return true;
-    }
-    return false;
</del><ins>+                        if (checkdnsrr($domain.'.', 'MX') || checkdnsrr($domain.'.', 'A'))
+                                return true;
+                        return false;
+                }
+                return true;
+        }
+        return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function is_email_address_unsafe( $user_email ) {
</span><span class="cx">         $banned_names = get_site_option( &quot;banned_email_domains&quot; );
</span><del>-        if ($banned_names &amp;&amp; !is_array( $banned_names )) {
</del><ins>+        if ($banned_names &amp;&amp; !is_array( $banned_names ))
</ins><span class="cx">                 $banned_names = explode( &quot;\n&quot;, $banned_names);
</span><del>-        }
</del><ins>+
</ins><span class="cx">         if ( is_array( $banned_names ) &amp;&amp; empty( $banned_names ) == false ) {
</span><span class="cx">                 $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
</span><span class="cx">                 foreach( (array) $banned_names as $banned_domain ) {
</span><del>-                        if( $banned_domain == '' )
</del><ins>+                        if ( $banned_domain == '' )
</ins><span class="cx">                                 continue;
</span><span class="cx">                         if (
</span><span class="cx">                                 strstr( $email_domain, $banned_domain ) ||
</span><span class="lines">@@ -917,25 +904,22 @@
</span><span class="cx">         $maybe = array();
</span><span class="cx">         preg_match( &quot;/[a-z0-9]+/&quot;, $user_name, $maybe );
</span><span class="cx"> 
</span><del>-        if( $user_name != $maybe[0] ) {
-            $errors-&gt;add('user_name', __(&quot;Only lowercase letters and numbers allowed&quot;));
-        }
</del><ins>+        if ( $user_name != $maybe[0] )
+                $errors-&gt;add('user_name', __(&quot;Only lowercase letters and numbers allowed&quot;));
</ins><span class="cx"> 
</span><span class="cx">         $illegal_names = get_site_option( &quot;illegal_names&quot; );
</span><del>-        if( is_array( $illegal_names ) == false ) {
</del><ins>+        if ( is_array( $illegal_names ) == false ) {
</ins><span class="cx">                 $illegal_names = array(  &quot;www&quot;, &quot;web&quot;, &quot;root&quot;, &quot;admin&quot;, &quot;main&quot;, &quot;invite&quot;, &quot;administrator&quot; );
</span><span class="cx">                 add_site_option( &quot;illegal_names&quot;, $illegal_names );
</span><span class="cx">         }
</span><del>-        if( in_array( $user_name, $illegal_names ) == true ) {
-            $errors-&gt;add('user_name',  __(&quot;That username is not allowed&quot;));
-        }
</del><ins>+        if ( in_array( $user_name, $illegal_names ) == true )
+                $errors-&gt;add('user_name',  __(&quot;That username is not allowed&quot;));
</ins><span class="cx"> 
</span><del>-        if( is_email_address_unsafe( $user_email ) )
</del><ins>+        if ( is_email_address_unsafe( $user_email ) )
</ins><span class="cx">                 $errors-&gt;add('user_email',  __(&quot;You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.&quot;));
</span><span class="cx"> 
</span><del>-        if( strlen( $user_name ) &lt; 4 ) {
-            $errors-&gt;add('user_name',  __(&quot;Username must be at least 4 characters&quot;));
-        }
</del><ins>+        if ( strlen( $user_name ) &lt; 4 )
+                $errors-&gt;add('user_name',  __(&quot;Username must be at least 4 characters&quot;));
</ins><span class="cx"> 
</span><span class="cx">         if ( strpos( &quot; &quot; . $user_name, &quot;_&quot; ) != false )
</span><span class="cx">                 $errors-&gt;add('user_name', __(&quot;Sorry, usernames may not contain the character '_'!&quot;));
</span><span class="lines">@@ -947,7 +931,7 @@
</span><span class="cx">                 $errors-&gt;add('user_name', __(&quot;Sorry, usernames must have letters too!&quot;));
</span><span class="cx"> 
</span><span class="cx">         if ( !is_email( $user_email ) )
</span><del>-            $errors-&gt;add('user_email', __(&quot;Please enter a correct email address&quot;));
</del><ins>+                $errors-&gt;add('user_email', __(&quot;Please enter a correct email address&quot;));
</ins><span class="cx"> 
</span><span class="cx">         if ( !validate_email( $user_email ) )
</span><span class="cx">                 $errors-&gt;add('user_email', __(&quot;Please check your email address.&quot;));
</span><span class="lines">@@ -955,9 +939,8 @@
</span><span class="cx">         $limited_email_domains = get_site_option( 'limited_email_domains' );
</span><span class="cx">         if ( is_array( $limited_email_domains ) &amp;&amp; empty( $limited_email_domains ) == false ) {
</span><span class="cx">                 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
</span><del>-                if( in_array( $emaildomain, $limited_email_domains ) == false ) {
</del><ins>+                if ( in_array( $emaildomain, $limited_email_domains ) == false )
</ins><span class="cx">                         $errors-&gt;add('user_email', __(&quot;Sorry, that email address is not allowed!&quot;));
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Check if the username has been used already.
</span><span class="lines">@@ -975,12 +958,12 @@
</span><span class="cx">                 $now = current_time( 'timestamp', true );
</span><span class="cx">                 $diff = $now - $registered_at;
</span><span class="cx">                 // If registered more than two days ago, cancel registration and let this signup go through.
</span><del>-                if ( $diff &gt; 172800 ) {
</del><ins>+                if ( $diff &gt; 172800 )
</ins><span class="cx">                         $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;signups WHERE user_login = %s&quot;, $user_name) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $errors-&gt;add('user_name', __(&quot;That username is currently reserved but may be available in a couple of days.&quot;));
</span><del>-                }
-                if( $signup-&gt;active == 0 &amp;&amp; $signup-&gt;user_email == $user_email )
</del><ins>+
+                if ( $signup-&gt;active == 0 &amp;&amp; $signup-&gt;user_email == $user_email )
</ins><span class="cx">                         $errors-&gt;add('user_email_used', __(&quot;username and email used&quot;));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -988,11 +971,10 @@
</span><span class="cx">         if ( $signup != null ) {
</span><span class="cx">                 $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup-&gt;registered);
</span><span class="cx">                 // If registered more than two days ago, cancel registration and let this signup go through.
</span><del>-                if ( $diff &gt; 172800 ) {
</del><ins>+                if ( $diff &gt; 172800 )
</ins><span class="cx">                         $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;signups WHERE user_email = %s&quot;, $user_email) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $errors-&gt;add('user_email', __(&quot;That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.&quot;));
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $result = array('user_name' =&gt; $user_name, 'user_email' =&gt; $user_email,        'errors' =&gt; $errors);
</span><span class="lines">@@ -1009,33 +991,31 @@
</span><span class="cx"> 
</span><span class="cx">         $errors = new WP_Error();
</span><span class="cx">         $illegal_names = get_site_option( &quot;illegal_names&quot; );
</span><del>-        if( $illegal_names == false ) {
-            $illegal_names = array( &quot;www&quot;, &quot;web&quot;, &quot;root&quot;, &quot;admin&quot;, &quot;main&quot;, &quot;invite&quot;, &quot;administrator&quot; );
-            add_site_option( &quot;illegal_names&quot;, $illegal_names );
</del><ins>+        if ( $illegal_names == false ) {
+                $illegal_names = array( &quot;www&quot;, &quot;web&quot;, &quot;root&quot;, &quot;admin&quot;, &quot;main&quot;, &quot;invite&quot;, &quot;administrator&quot; );
+                add_site_option( &quot;illegal_names&quot;, $illegal_names );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( empty( $blogname ) )
</span><del>-            $errors-&gt;add('blogname', __(&quot;Please enter a blog name&quot;));
</del><ins>+                $errors-&gt;add('blogname', __(&quot;Please enter a blog name&quot;));
</ins><span class="cx"> 
</span><span class="cx">         $maybe = array();
</span><span class="cx">         preg_match( &quot;/[a-z0-9]+/&quot;, $blogname, $maybe );
</span><del>-        if( $blogname != $maybe[0] ) {
-            $errors-&gt;add('blogname', __(&quot;Only lowercase letters and numbers allowed&quot;));
-        }
-        if( in_array( $blogname, $illegal_names ) == true ) {
-            $errors-&gt;add('blogname',  __(&quot;That name is not allowed&quot;));
-        }
-        if( strlen( $blogname ) &lt; 4 &amp;&amp; !is_super_admin() ) {
-            $errors-&gt;add('blogname',  __(&quot;Blog name must be at least 4 characters&quot;));
-        }
</del><ins>+        if ( $blogname != $maybe[0] )
+                $errors-&gt;add('blogname', __(&quot;Only lowercase letters and numbers allowed&quot;));
</ins><span class="cx"> 
</span><ins>+        if ( in_array( $blogname, $illegal_names ) == true )
+                $errors-&gt;add('blogname',  __(&quot;That name is not allowed&quot;));
+
+        if ( strlen( $blogname ) &lt; 4 &amp;&amp; !is_super_admin() )
+                $errors-&gt;add('blogname',  __(&quot;Blog name must be at least 4 characters&quot;));
+
</ins><span class="cx">         if ( strpos( &quot; &quot; . $blogname, &quot;_&quot; ) != false )
</span><span class="cx">                 $errors-&gt;add('blogname', __(&quot;Sorry, blog names may not contain the character '_'!&quot;));
</span><span class="cx"> 
</span><span class="cx">         // do not allow users to create a blog that conflicts with a page on the main blog.
</span><del>-        if ( !is_subdomain_install() &amp;&amp; $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT post_name FROM &quot; . $wpdb-&gt;get_blog_prefix( $current_site-&gt;blog_id ) . &quot;posts WHERE post_type = 'page' AND post_name = %s&quot;, $blogname ) ) ) {
</del><ins>+        if ( !is_subdomain_install() &amp;&amp; $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT post_name FROM &quot; . $wpdb-&gt;get_blog_prefix( $current_site-&gt;blog_id ) . &quot;posts WHERE post_type = 'page' AND post_name = %s&quot;, $blogname ) ) )
</ins><span class="cx">                 $errors-&gt;add( 'blogname', __( &quot;Sorry, you may not use that blog name&quot; ) );
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         // all numeric?
</span><span class="cx">         $match = array();
</span><span class="lines">@@ -1048,10 +1028,10 @@
</span><span class="cx">         $blog_title = stripslashes(  $blog_title );
</span><span class="cx"> 
</span><span class="cx">         if ( empty( $blog_title ) )
</span><del>-            $errors-&gt;add('blog_title', __(&quot;Please enter a blog title&quot;));
</del><ins>+                $errors-&gt;add('blog_title', __(&quot;Please enter a blog title&quot;));
</ins><span class="cx"> 
</span><span class="cx">         // Check if the domain/path has been used already.
</span><del>-        if( is_subdomain_install() ) {
</del><ins>+        if ( is_subdomain_install() ) {
</ins><span class="cx">                 $mydomain = &quot;$blogname.$domain&quot;;
</span><span class="cx">                 $path = $base;
</span><span class="cx">         } else {
</span><span class="lines">@@ -1071,11 +1051,10 @@
</span><span class="cx">         if ( ! empty($signup) ) {
</span><span class="cx">                 $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup-&gt;registered);
</span><span class="cx">                 // If registered more than two days ago, cancel registration and let this signup go through.
</span><del>-                if ( $diff &gt; 172800 ) {
</del><ins>+                if ( $diff &gt; 172800 )
</ins><span class="cx">                         $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;signups WHERE domain = %s AND path = %s&quot;, $mydomain, $path) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $errors-&gt;add('blogname', __(&quot;That blog is currently reserved but may be available in a couple days.&quot;));
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $result = array('domain' =&gt; $mydomain, 'path' =&gt; $path, 'blogname' =&gt; $blogname, 'blog_title' =&gt; $blog_title, 'errors' =&gt; $errors);
</span><span class="lines">@@ -1134,18 +1113,18 @@
</span><span class="cx"> function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
</del><ins>+        if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         // Send email with activation link.
</span><del>-        if( !is_subdomain_install() || $current_site-&gt;id != 1 ) {
</del><ins>+        if ( !is_subdomain_install() || $current_site-&gt;id != 1 )
</ins><span class="cx">                 $activate_url = &quot;http://&quot; . $current_site-&gt;domain . $current_site-&gt;path . &quot;wp-activate.php?key=$key&quot;;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $activate_url = &quot;http://{$domain}{$path}wp-activate.php?key=$key&quot;;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         $activate_url = clean_url($activate_url);
</span><span class="cx">         $admin_email = get_site_option( &quot;admin_email&quot; );
</span><del>-        if( $admin_email == '' )
</del><ins>+        if ( $admin_email == '' )
</ins><span class="cx">                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
</span><span class="cx">         $from_name = get_site_option( &quot;site_name&quot; ) == '' ? 'WordPress' : wp_specialchars( get_site_option( &quot;site_name&quot; ) );
</span><span class="cx">         $message_headers = &quot;MIME-Version: 1.0\n&quot; . &quot;From: \&quot;{$from_name}\&quot; &lt;{$admin_email}&gt;\n&quot; . &quot;Content-Type: text/plain; charset=\&quot;&quot; . get_option('blog_charset') . &quot;\&quot;\n&quot;;
</span><span class="lines">@@ -1159,12 +1138,12 @@
</span><span class="cx"> function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
</del><ins>+        if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         // Send email with activation link.
</span><span class="cx">         $admin_email = get_site_option( &quot;admin_email&quot; );
</span><del>-        if( $admin_email == '' )
</del><ins>+        if ( $admin_email == '' )
</ins><span class="cx">                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
</span><span class="cx">         $from_name = get_site_option( &quot;site_name&quot; ) == '' ? 'WordPress' : wp_specialchars( get_site_option( &quot;site_name&quot; ) );
</span><span class="cx">         $message_headers = &quot;MIME-Version: 1.0\n&quot; . &quot;From: \&quot;{$from_name}\&quot; &lt;{$admin_email}&gt;\n&quot; . &quot;Content-Type: text/plain; charset=\&quot;&quot; . get_option('blog_charset') . &quot;\&quot;\n&quot;;
</span><span class="lines">@@ -1206,15 +1185,18 @@
</span><span class="cx"> 
</span><span class="cx">         if ( empty($signup-&gt;domain) ) {
</span><span class="cx">                 $wpdb-&gt;update( $wpdb-&gt;signups, array('active' =&gt; 1, 'activated' =&gt; $now), array('activation_key' =&gt; $key) );
</span><ins>+
</ins><span class="cx">                 if ( isset( $user_already_exists ) )
</span><span class="cx">                         return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
</span><ins>+
</ins><span class="cx">                 wpmu_welcome_user_notification($user_id, $password, $meta);
</span><span class="cx">                 $user_site = get_site_option( 'dashboard_blog', $current_site-&gt;blog_id );
</span><del>-                if ( $user_site == false ) {
</del><ins>+
+                if ( $user_site == false )
</ins><span class="cx">                         add_user_to_blog( '1', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         add_user_to_blog( $user_site, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
</span><del>-                }
</del><ins>+
</ins><span class="cx">                 add_new_user_to_blog( $user_id, $user_email, $meta );
</span><span class="cx">                 do_action('wpmu_activate_user', $user_id, $password, $meta);
</span><span class="cx">                 return array('user_id' =&gt; $user_id, 'password' =&gt; $password, 'meta' =&gt; $meta);
</span><span class="lines">@@ -1231,14 +1213,11 @@
</span><span class="cx">                         $blog_id-&gt;add_data( $signup );
</span><span class="cx">                         $wpdb-&gt;update( $wpdb-&gt;signups, array( 'active' =&gt; 1, 'activated' =&gt; $now ), array( 'activation_key' =&gt; $key ) );
</span><span class="cx">                 }
</span><del>-
</del><span class="cx">                 return $blog_id;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;update( $wpdb-&gt;signups, array('active' =&gt; 1, 'activated' =&gt; $now), array('activation_key' =&gt; $key) );
</span><del>-
</del><span class="cx">         wpmu_welcome_notification($blog_id, $user_id, $password, $signup-&gt;title, $meta);
</span><del>-
</del><span class="cx">         do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup-&gt;title, $meta);
</span><span class="cx"> 
</span><span class="cx">         return array('blog_id' =&gt; $blog_id, 'user_id' =&gt; $user_id, 'password' =&gt; $password, 'title' =&gt; $signup-&gt;title, 'meta' =&gt; $meta);
</span><span class="lines">@@ -1267,12 +1246,14 @@
</span><span class="cx"> 
</span><span class="cx"> function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) {
</span><span class="cx">         $domain = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $domain, true ) );
</span><del>-        if( is_subdomain_install() )
</del><ins>+
+        if ( is_subdomain_install() )
</ins><span class="cx">                 $domain = str_replace( '@', '', $domain );
</span><ins>+
</ins><span class="cx">         $title = strip_tags( $title );
</span><span class="cx">         $user_id = (int) $user_id;
</span><span class="cx"> 
</span><del>-        if( empty($path) )
</del><ins>+        if ( empty($path) )
</ins><span class="cx">                 $path = '/';
</span><span class="cx"> 
</span><span class="cx">         // Check if the domain has been used already. We should return an error message.
</span><span class="lines">@@ -1286,30 +1267,25 @@
</span><span class="cx">                 return new WP_Error('insert_blog', __('Could not create blog.'));
</span><span class="cx"> 
</span><span class="cx">         switch_to_blog($blog_id);
</span><del>-
</del><span class="cx">         install_blog($blog_id, $title);
</span><del>-
</del><span class="cx">         install_blog_defaults($blog_id, $user_id);
</span><span class="cx"> 
</span><span class="cx">         add_user_to_blog($blog_id, $user_id, 'administrator');
</span><span class="cx"> 
</span><span class="cx">         if ( is_array($meta) ) foreach ($meta as $key =&gt; $value) {
</span><del>-                if( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' ) {
</del><ins>+                if ( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' )
</ins><span class="cx">                         update_blog_status( $blog_id, $key, $value );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         update_option( $key, $value );
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
</span><del>-
</del><span class="cx">         update_option( 'blog_public', $meta['public'] );
</span><span class="cx"> 
</span><span class="cx">         if ( !is_super_admin() &amp;&amp; get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
</span><span class="cx">                 update_usermeta( $user_id, 'primary_blog', $blog_id );
</span><span class="cx"> 
</span><span class="cx">         restore_current_blog();
</span><del>-
</del><span class="cx">         do_action( 'wpmu_new_blog', $blog_id, $user_id );
</span><span class="cx"> 
</span><span class="cx">         return $blog_id;
</span><span class="lines">@@ -1317,11 +1293,11 @@
</span><span class="cx"> 
</span><span class="cx"> function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
</span><span class="cx">         global $current_site;
</span><del>-        if( get_site_option( 'registrationnotification' ) != 'yes' )
</del><ins>+        if ( get_site_option( 'registrationnotification' ) != 'yes' )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $email = get_site_option( 'admin_email' );
</span><del>-        if( is_email($email) == false )
</del><ins>+        if ( is_email($email) == false )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $options_site_url = clean_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</span><span class="lines">@@ -1344,12 +1320,15 @@
</span><span class="cx"> 
</span><span class="cx"> function newuser_notify_siteadmin( $user_id ) {
</span><span class="cx">         global $current_site;
</span><del>-        if( get_site_option( 'registrationnotification' ) != 'yes' )
</del><ins>+
+        if ( get_site_option( 'registrationnotification' ) != 'yes' )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $email = get_site_option( 'admin_email' );
</span><del>-        if( is_email($email) == false )
</del><ins>+
+        if ( is_email($email) == false )
</ins><span class="cx">                 return false;
</span><ins>+
</ins><span class="cx">         $user = new WP_User($user_id);
</span><span class="cx"> 
</span><span class="cx">         $options_site_url = clean_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</span><span class="lines">@@ -1390,11 +1369,12 @@
</span><span class="cx">         // Cast for security
</span><span class="cx">         $blog_id = (int) $blog_id;
</span><span class="cx"> 
</span><del>-        require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
</del><ins>+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
</ins><span class="cx"> 
</span><span class="cx">         if ( $wpdb-&gt;get_results(&quot;SELECT ID FROM $wpdb-&gt;posts&quot;) )
</span><span class="cx">                 die(__('&lt;h1&gt;Already Installed&lt;/h1&gt;&lt;p&gt;You appear to have already installed WordPress. To reinstall please clear your old database tables first.&lt;/p&gt;') . '&lt;/body&gt;&lt;/html&gt;');
</span><del>-        $wpdb-&gt;suppress_errors( false);
</del><ins>+                
+        $wpdb-&gt;suppress_errors(false);
</ins><span class="cx"> 
</span><span class="cx">         $url = get_blogaddress_by_id($blog_id);
</span><span class="cx"> 
</span><span class="lines">@@ -1422,7 +1402,8 @@
</span><span class="cx">         $cat_slug = sanitize_title($cat_name);
</span><span class="cx"> 
</span><span class="cx">         $blogroll_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT cat_ID FROM {$wpdb-&gt;sitecategories} WHERE category_nicename = %s&quot;, $cat_slug ) );
</span><del>-        if( $blogroll_id == null ) {
</del><ins>+        
+        if ( $blogroll_id == null ) {
</ins><span class="cx">                 $wpdb-&gt;insert( $wpdb-&gt;sitecategories, array('cat_ID' =&gt; 0, 'cat_name' =&gt; $cat_name, 'category_nicename' =&gt; $cat_slug, 'last_updated' =&gt; current_time('mysql', true)) );
</span><span class="cx">                 $blogroll_id = $wpdb-&gt;insert_id;
</span><span class="cx">         }
</span><span class="lines">@@ -1457,9 +1438,10 @@
</span><span class="cx">         $now = date('Y-m-d H:i:s');
</span><span class="cx">         $now_gmt = gmdate('Y-m-d H:i:s');
</span><span class="cx">         $first_post = get_site_option( 'first_post' );
</span><del>-        if( $first_post == false ) {
</del><ins>+
+        if ( $first_post == false )
</ins><span class="cx">                 $first_post = stripslashes( __( 'Welcome to &lt;a href=&quot;SITE_URL&quot;&gt;SITE_NAME&lt;/a&gt;. This is your first post. Edit or delete it, then start blogging!' ) );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         $first_post = str_replace( &quot;SITE_URL&quot;, clean_url(&quot;http://&quot; . $current_site-&gt;domain . $current_site-&gt;path), $first_post );
</span><span class="cx">         $first_post = str_replace( &quot;SITE_NAME&quot;, $current_site-&gt;site_name, $first_post );
</span><span class="cx">         $wpdb-&gt;insert( $wpdb-&gt;posts, array(
</span><span class="lines">@@ -1531,11 +1513,11 @@
</span><span class="cx"> function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
</del><ins>+        if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $welcome_email = stripslashes( get_site_option( 'welcome_email' ) );
</span><del>-        if( $welcome_email == false )
</del><ins>+        if ( $welcome_email == false )
</ins><span class="cx">                 $welcome_email = stripslashes( __( &quot;Dear User,
</span><span class="cx"> 
</span><span class="cx"> Your new SITE_NAME blog has been successfully set up at:
</span><span class="lines">@@ -1563,13 +1545,17 @@
</span><span class="cx"> 
</span><span class="cx">         $welcome_email = apply_filters( &quot;update_welcome_email&quot;, $welcome_email, $blog_id, $user_id, $password, $title, $meta);
</span><span class="cx">         $admin_email = get_site_option( &quot;admin_email&quot; );
</span><del>-        if( $admin_email == '' )
</del><ins>+
+        if ( $admin_email == '' )
</ins><span class="cx">                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
</span><ins>+
</ins><span class="cx">         $from_name = get_site_option( &quot;site_name&quot; ) == '' ? 'WordPress' : wp_specialchars( get_site_option( &quot;site_name&quot; ) );
</span><span class="cx">         $message_headers = &quot;MIME-Version: 1.0\n&quot; . &quot;From: \&quot;{$from_name}\&quot; &lt;{$admin_email}&gt;\n&quot; . &quot;Content-Type: text/plain; charset=\&quot;&quot; . get_option('blog_charset') . &quot;\&quot;\n&quot;;
</span><span class="cx">         $message = $welcome_email;
</span><del>-        if( empty( $current_site-&gt;site_name ) )
</del><ins>+
+        if ( empty( $current_site-&gt;site_name ) )
</ins><span class="cx">                 $current_site-&gt;site_name = &quot;WordPress MU&quot;;
</span><ins>+
</ins><span class="cx">         $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Blog: %2$s'), $current_site-&gt;site_name, stripslashes( $title ) ) );
</span><span class="cx">         wp_mail($user-&gt;user_email, $subject, $message, $message_headers);
</span><span class="cx">         return true;
</span><span class="lines">@@ -1578,7 +1564,7 @@
</span><span class="cx"> function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
</del><ins>+        if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $welcome_email = get_site_option( 'welcome_user_email' );
</span><span class="lines">@@ -1592,13 +1578,17 @@
</span><span class="cx">         $welcome_email = str_replace( &quot;LOGINLINK&quot;, wp_login_url(), $welcome_email );
</span><span class="cx"> 
</span><span class="cx">         $admin_email = get_site_option( &quot;admin_email&quot; );
</span><del>-        if( $admin_email == '' )
</del><ins>+
+        if ( $admin_email == '' )
</ins><span class="cx">                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
</span><ins>+
</ins><span class="cx">         $from_name = get_site_option( &quot;site_name&quot; ) == '' ? 'WordPress' : wp_specialchars( get_site_option( &quot;site_name&quot; ) );
</span><span class="cx">         $message_headers = &quot;MIME-Version: 1.0\n&quot; . &quot;From: \&quot;{$from_name}\&quot; &lt;{$admin_email}&gt;\n&quot; . &quot;Content-Type: text/plain; charset=\&quot;&quot; . get_option('blog_charset') . &quot;\&quot;\n&quot;;
</span><span class="cx">         $message = $welcome_email;
</span><del>-        if( empty( $current_site-&gt;site_name ) )
</del><ins>+
+        if ( empty( $current_site-&gt;site_name ) )
</ins><span class="cx">                 $current_site-&gt;site_name = &quot;WordPress MU&quot;;
</span><ins>+
</ins><span class="cx">         $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site-&gt;site_name, $user-&gt;user_login) );
</span><span class="cx">         wp_mail($user-&gt;user_email, $subject, $message, $message_headers);
</span><span class="cx">         return true;
</span><span class="lines">@@ -1646,10 +1636,7 @@
</span><span class="cx">                         // If this is the first post checked or if this post is
</span><span class="cx">                         // newer than the current recent post, make it the new
</span><span class="cx">                         // most recent post.
</span><del>-                        if (
-                                !isset($most_recent_post['post_gmt_ts'])
-                                || ($post_gmt_ts &gt; $most_recent_post['post_gmt_ts'])
-                        ) {
</del><ins>+                        if ( !isset($most_recent_post['post_gmt_ts']) || ( $post_gmt_ts &gt; $most_recent_post['post_gmt_ts'] ) ) {
</ins><span class="cx">                                 $most_recent_post = array(
</span><span class="cx">                                         'blog_id'                =&gt; $blog-&gt;userblog_id,
</span><span class="cx">                                         'post_id'                =&gt; $recent_post['ID'],
</span><span class="lines">@@ -1672,12 +1659,12 @@
</span><span class="cx"> 
</span><span class="cx"> function get_dirsize( $directory ) {
</span><span class="cx">         $dirsize = get_transient( 'dirsize_cache' );
</span><del>-        if ( is_array( $dirsize ) &amp;&amp; isset( $dirsize[ $directory ][ 'size' ] ) ) {
</del><ins>+        if ( is_array( $dirsize ) &amp;&amp; isset( $dirsize[ $directory ][ 'size' ] ) )
</ins><span class="cx">                 return $dirsize[ $directory ][ 'size' ];
</span><del>-        }
-        if ( false == is_array( $dirsize ) ) {
</del><ins>+
+        if ( false == is_array( $dirsize ) )
</ins><span class="cx">                 $dirsize = array();
</span><del>-        }
</del><ins>+
</ins><span class="cx">         $dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
</span><span class="cx"> 
</span><span class="cx">         set_transient( 'dirsize_cache', $dirsize, 3600 );
</span><span class="lines">@@ -1693,21 +1680,25 @@
</span><span class="cx"> 
</span><span class="cx"> function recurse_dirsize( $directory ) {
</span><span class="cx">         $size = 0;
</span><del>-        if(substr($directory,-1) == '/') $directory = substr($directory,0,-1);
-        if(!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) return false;
-        if($handle = opendir($directory)) {
</del><ins>+
+        if ( substr( $directory, -1 ) == '/' )
+                $directory = substr($directory,0,-1);
+
+        if ( !file_exists($directory) || !is_dir( $directory ) || !is_readable( $directory ) )
+                return false;
+
+        if ($handle = opendir($directory)) {
</ins><span class="cx">                 while(($file = readdir($handle)) !== false) {
</span><span class="cx">                         $path = $directory.'/'.$file;
</span><del>-                        if($file != '.' &amp;&amp; $file != '..') {
-                                if(is_file($path)) {
</del><ins>+                        if ($file != '.' &amp;&amp; $file != '..') {
+                                if (is_file($path)) {
</ins><span class="cx">                                         $size += filesize($path);
</span><del>-                                } elseif(is_dir($path)) {
</del><ins>+                                } elseif (is_dir($path)) {
</ins><span class="cx">                                         $handlesize = recurse_dirsize($path);
</span><del>-                                        if($handlesize &gt;= 0) {
</del><ins>+                                        if ($handlesize &gt;= 0)
</ins><span class="cx">                                                 $size += $handlesize;
</span><del>-                                        } else {
</del><ins>+                                        else
</ins><span class="cx">                                                 return false;
</span><del>-                                        }
</del><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -1717,18 +1708,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function upload_is_user_over_quota( $echo = true ) {
</span><del>-        if ( get_site_option( 'upload_space_check_disabled' ) ) {
</del><ins>+        if ( get_site_option( 'upload_space_check_disabled' ) )
</ins><span class="cx">                 return true;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         $spaceAllowed = get_space_allowed();
</span><del>-        if(empty($spaceAllowed) || !is_numeric($spaceAllowed))
</del><ins>+        if ( empty( $spaceAllowed ) || !is_numeric( $spaceAllowed ) )
</ins><span class="cx">                 $spaceAllowed = 10;        // Default space allowed is 10 MB
</span><span class="cx"> 
</span><span class="cx">         $dirName = BLOGUPLOADDIR;
</span><span class="cx">         $size = get_dirsize($dirName) / 1024 / 1024;
</span><span class="cx"> 
</span><del>-        if( ($spaceAllowed-$size) &lt; 0 ) {
-                if( $echo )
</del><ins>+        if ( ($spaceAllowed-$size) &lt; 0 ) {
+                if ( $echo )
</ins><span class="cx">                         _e( &quot;Sorry, you have used your space allocation. Please delete some files to upload more files.&quot; ); //No space left
</span><span class="cx">                 return true;
</span><span class="cx">         } else {
</span><span class="lines">@@ -1736,13 +1727,12 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function check_upload_mimes($mimes) {
</del><ins>+function check_upload_mimes( $mimes ) {
</ins><span class="cx">         $site_exts = explode( &quot; &quot;, get_site_option( &quot;upload_filetypes&quot; ) );
</span><span class="cx">         foreach ( $site_exts as $ext ) {
</span><del>-                foreach ( $mimes as $ext_pattern =&gt; $mime ) {
-                        if( $ext != '' &amp;&amp; strpos( $ext_pattern, $ext ) !== false ) {
</del><ins>+                foreach ( $mimes as $ext_pattern =&gt; $mime )
+                        if ( $ext != '' &amp;&amp; strpos( $ext_pattern, $ext ) !== false ) {
</ins><span class="cx">                                 $site_mimes[$ext_pattern] = $mime;
</span><del>-                        }
</del><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         return $site_mimes;
</span><span class="lines">@@ -1760,18 +1750,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function fix_import_form_size( $size ) {
</span><del>-        if( upload_is_user_over_quota( false ) == true ) {
</del><ins>+        if ( upload_is_user_over_quota( false ) == true )
</ins><span class="cx">                 return 0;
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         $spaceAllowed = 1024 * 1024 * get_space_allowed();
</span><span class="cx">         $dirName = BLOGUPLOADDIR;
</span><span class="cx">         $dirsize = get_dirsize($dirName) ;
</span><del>-        if( $size &gt; $spaceAllowed - $dirsize ) {
</del><ins>+        if ( $size &gt; $spaceAllowed - $dirsize )
</ins><span class="cx">                 return $spaceAllowed - $dirsize; // remaining space
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 return $size; // default
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( !function_exists('graceful_fail') ) :
</span><span class="lines">@@ -1815,17 +1803,16 @@
</span><span class="cx"> 
</span><span class="cx">         function admin_footer() {
</span><span class="cx">                 global $wpdb, $current_blog, $current_site;
</span><del>-                if( $current_blog-&gt;domain . $current_blog-&gt;path == $current_site-&gt;domain . $current_site-&gt;path )
</del><ins>+                if ( $current_blog-&gt;domain . $current_blog-&gt;path == $current_site-&gt;domain . $current_site-&gt;path )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><del>-                if( $this-&gt;reallydeleteblog == true ) {
</del><ins>+                if ( $this-&gt;reallydeleteblog == true )
</ins><span class="cx">                         wpmu_delete_blog( $wpdb-&gt;blogid );
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function admin_menu() {
</span><span class="cx">                 global $current_blog, $current_site;
</span><del>-                if( $current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path )
</del><ins>+                if ( $current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path )
</ins><span class="cx">                         add_submenu_page('options-general.php', __('Delete Blog'), __('Delete Blog'), 'manage_options', 'delete-blog', array(&amp;$this, 'plugin_content'));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1833,7 +1820,7 @@
</span><span class="cx">                 global $current_blog, $current_site;
</span><span class="cx">                 $this-&gt;delete_blog_hash = get_settings('delete_blog_hash');
</span><span class="cx">                 echo '&lt;div class=&quot;wrap&quot;&gt;&lt;h2&gt;' . __('Delete Blog') . '&lt;/h2&gt;';
</span><del>-                if( $_POST['action'] == &quot;deleteblog&quot; &amp;&amp; $_POST['confirmdelete'] == '1' ) {
</del><ins>+                if ( $_POST['action'] == &quot;deleteblog&quot; &amp;&amp; $_POST['confirmdelete'] == '1' ) {
</ins><span class="cx">                         $hash = substr( md5( $_SERVER['REQUEST_URI'] . time() ), 0, 6 );
</span><span class="cx">                         update_option( &quot;delete_blog_hash&quot;, $hash );
</span><span class="cx">                         $url_delete = get_option( &quot;siteurl&quot; ) . &quot;/wp-admin/options-general.php?page=delete-blog&amp;h=&quot; . $hash;
</span><span class="lines">@@ -1858,8 +1845,8 @@
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;p&gt;&lt;?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?&gt;&lt;/p&gt;
</span><span class="cx">                         &lt;?php
</span><del>-                } elseif( isset( $_GET['h'] ) &amp;&amp; $_GET['h'] != '' &amp;&amp; get_option('delete_blog_hash') != false ) {
-                        if( get_option('delete_blog_hash') == $_GET['h'] ) {
</del><ins>+                } elseif ( isset( $_GET['h'] ) &amp;&amp; $_GET['h'] != '' &amp;&amp; get_option('delete_blog_hash') != false ) {
+                        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
</ins><span class="cx">                                 $this-&gt;reallydeleteblog = true;
</span><span class="cx">                                 echo &quot;&lt;p&gt;&quot; . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site-&gt;site_name) . &quot;&lt;/p&gt;&quot;;
</span><span class="cx">                         } else {
</span><span class="lines">@@ -1899,7 +1886,7 @@
</span><span class="cx">         if ( $global_id == $term_id )
</span><span class="cx">                 return $global_id;
</span><span class="cx"> 
</span><del>-        if( get_option( 'default_category' ) == $term_id )
</del><ins>+        if ( get_option( 'default_category' ) == $term_id )
</ins><span class="cx">                 update_option( 'default_category', $global_id );
</span><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;update( $wpdb-&gt;terms, array('term_id' =&gt; $global_id), array('term_id' =&gt; $term_id) );
</span><span class="lines">@@ -1917,27 +1904,26 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function upload_is_file_too_big( $upload ) {
</span><del>-        if( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) )
</del><ins>+        if ( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) )
</ins><span class="cx">                 return $upload;
</span><del>-        if( strlen( $upload[ 'bits' ] )  &gt; ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
</del><ins>+
+        if ( strlen( $upload[ 'bits' ] )  &gt; ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
</ins><span class="cx">                 return sprintf(__( &quot;This file is too big. Files must be less than %dKb in size.&lt;br /&gt;&quot; ), get_site_option( 'fileupload_maxk', 1500 ));
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         return $upload;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wordpressmu_authenticate_siteadmin( $user, $password = '' ) {
</span><del>-        if( is_super_admin( $user-&gt;user_login ) == false &amp;&amp; ( $primary_blog = get_usermeta( $user-&gt;user_id, &quot;primary_blog&quot; ) ) ) {
</del><ins>+        if ( is_super_admin( $user-&gt;user_login ) == false &amp;&amp; ( $primary_blog = get_usermeta( $user-&gt;user_id, &quot;primary_blog&quot; ) ) ) {
</ins><span class="cx">                 $details = get_blog_details( $primary_blog );
</span><del>-                if( is_object( $details ) &amp;&amp; $details-&gt;spam == 1 ) {
</del><ins>+                if ( is_object( $details ) &amp;&amp; $details-&gt;spam == 1 )
</ins><span class="cx">                         return new WP_Error('blog_suspended', __('Blog Suspended.'));
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx">         return $user;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wordpressmu_wp_mail_from( $email ) {
</span><del>-        if( strpos( $email, 'wordpress@' ) !== false )
</del><ins>+        if ( strpos( $email, 'wordpress@' ) !== false )
</ins><span class="cx">                 $email = get_option( 'admin_email' );
</span><span class="cx">         return $email;
</span><span class="cx"> }
</span><span class="lines">@@ -1946,7 +1932,7 @@
</span><span class="cx"> XMLRPC getUsersBlogs() for a multiblog environment
</span><span class="cx"> http://trac.mu.wordpress.org/attachment/ticket/551/xmlrpc-mu.php
</span><span class="cx"> */
</span><del>-function wpmu_blogger_getUsersBlogs($args) {
</del><ins>+function wpmu_blogger_getUsersBlogs( $args ) {
</ins><span class="cx">         global $current_blog;
</span><span class="cx">         $domain = $current_blog-&gt;domain;
</span><span class="cx">         $path = $current_blog-&gt;path . 'xmlrpc.php';
</span><span class="lines">@@ -1955,9 +1941,8 @@
</span><span class="cx">         $rpc-&gt;query('wp.getUsersBlogs', $args[1], $args[2]);
</span><span class="cx">         $blogs = $rpc-&gt;getResponse();
</span><span class="cx"> 
</span><del>-        if ( isset($blogs['faultCode']) ) {
</del><ins>+        if ( isset($blogs['faultCode']) )
</ins><span class="cx">                 return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         if ( $_SERVER['HTTP_HOST'] == $domain &amp;&amp; $_SERVER['REQUEST_URI'] == $path ) {
</span><span class="cx">                 return $blogs;
</span><span class="lines">@@ -1970,18 +1955,18 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function attach_wpmu_xmlrpc($methods) {
</del><ins>+function attach_wpmu_xmlrpc( $methods ) {
</ins><span class="cx">         $methods['blogger.getUsersBlogs'] = 'wpmu_blogger_getUsersBlogs';
</span><span class="cx">         return $methods;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function mu_locale( $locale ) {
</span><del>-        if( defined('WP_INSTALLING') == false ) {
</del><ins>+        if ( defined('WP_INSTALLING') == false ) {
</ins><span class="cx">                 $mu_locale = get_option('WPLANG');
</span><del>-                if( $mu_locale === false )
</del><ins>+                if ( $mu_locale === false )
</ins><span class="cx">                         $mu_locale = get_site_option('WPLANG');
</span><span class="cx"> 
</span><del>-                if( $mu_locale !== false )
</del><ins>+                if ( $mu_locale !== false )
</ins><span class="cx">                         return $mu_locale;
</span><span class="cx">         }
</span><span class="cx">         return $locale;
</span><span class="lines">@@ -1994,7 +1979,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function signup_nonce_check( $result ) {
</span><del>-        if( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
</del><ins>+        if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
</ins><span class="cx">                 return $result;
</span><span class="cx"> 
</span><span class="cx">         if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
</span><span class="lines">@@ -2005,7 +1990,7 @@
</span><span class="cx"> 
</span><span class="cx"> function maybe_redirect_404() {
</span><span class="cx">         global $current_site;
</span><del>-        if( is_main_blog() &amp;&amp; is_404() &amp;&amp; defined( 'NOBLOGREDIRECT' ) &amp;&amp; constant( 'NOBLOGREDIRECT' ) != '' ) {
</del><ins>+        if ( is_main_blog() &amp;&amp; is_404() &amp;&amp; defined( 'NOBLOGREDIRECT' ) &amp;&amp; constant( 'NOBLOGREDIRECT' ) != '' ) {
</ins><span class="cx">                 $destination = constant( 'NOBLOGREDIRECT' );
</span><span class="cx">                 if ( $destination == '%siteurl%' )
</span><span class="cx">                         $destination = $current_site-&gt;domain . $current_site-&gt;path;
</span><span class="lines">@@ -2020,14 +2005,15 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function maybe_add_existing_user_to_blog() {
</span><del>-        if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) {
</del><ins>+        if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
</ins><span class="cx">                 return false;
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         $parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
</span><span class="cx">         $key = array_pop( $parts );
</span><ins>+
</ins><span class="cx">         if ( $key == '' )
</span><span class="cx">                 $key = array_pop( $parts );
</span><ins>+
</ins><span class="cx">         $details = get_option( &quot;new_user_&quot; . $key );
</span><span class="cx">         add_existing_user_to_blog( $details );
</span><span class="cx">         delete_option( 'new_user_' . $key );
</span><span class="lines">@@ -2043,7 +2029,7 @@
</span><span class="cx"> 
</span><span class="cx"> function add_new_user_to_blog( $user_id, $email, $meta ) {
</span><span class="cx">         global $current_site;
</span><del>-        if( $meta[ 'add_to_blog' ] ) {
</del><ins>+        if ( $meta[ 'add_to_blog' ] ) {
</ins><span class="cx">                 $blog_id = $meta[ 'add_to_blog' ];
</span><span class="cx">                 $role = $meta[ 'new_role' ];
</span><span class="cx">                 remove_user_from_blog($user_id, $current_site-&gt;blogid); // remove user from main blog.
</span><span class="lines">@@ -2058,20 +2044,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function is_user_spammy( $username = 0 ) {
</span><del>-        if( $username == 0 ) {
</del><ins>+        if ( $username == 0 ) {
</ins><span class="cx">                 global $current_user;
</span><span class="cx">                 $user_id = $current_user-&gt;ID;
</span><span class="cx">         } else {
</span><span class="cx">                 $user_id = get_user_id_from_string( $username );
</span><span class="cx">         }
</span><span class="cx">         $u = new WP_User( $user_id );
</span><del>-        if( $u-&gt;spam == 1 )
</del><ins>+
+        if ( $u-&gt;spam == 1 )
</ins><span class="cx">                 return true;
</span><ins>+
</ins><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function login_spam_check( $user, $password ) {
</span><del>-        if( is_user_spammy( $user-&gt;ID ) )
</del><ins>+        if ( is_user_spammy( $user-&gt;ID ) )
</ins><span class="cx">                 return new WP_Error('invalid_username', __('&lt;strong&gt;ERROR&lt;/strong&gt;: your account has been marked as a spammer.'));
</span><span class="cx">         return $user;
</span><span class="cx"> }
</span><span class="lines">@@ -2104,29 +2092,30 @@
</span><span class="cx"> function get_dashboard_blog() {
</span><span class="cx">         global $current_site;
</span><span class="cx"> 
</span><del>-        if ( get_site_option( 'dashboard_blog' ) == false ) {
</del><ins>+        if ( get_site_option( 'dashboard_blog' ) == false )
</ins><span class="cx">                 return get_blog_details( $current_site-&gt;blog_id );
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 return get_blog_details( get_site_option( 'dashboard_blog' ) );
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
</span><span class="cx">         global $current_user, $wpdb;
</span><span class="cx"> 
</span><del>-        if( $user_id == 0 )
</del><ins>+        if ( $user_id == 0 )
</ins><span class="cx">                 $user_id = $current_user-&gt;ID;
</span><del>-        if( $blog_id == 0 )
</del><ins>+        if ( $blog_id == 0 )
</ins><span class="cx">                 $blog_id = $wpdb-&gt;blogid;
</span><span class="cx"> 
</span><span class="cx">         $local_key = $wpdb-&gt;base_prefix . $blog_id . &quot;_&quot; . $key;
</span><del>-        if( isset( $current_user-&gt;$local_key ) )
</del><ins>+
+        if ( isset( $current_user-&gt;$local_key ) )
</ins><span class="cx">                 return true;
</span><ins>+
</ins><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function fix_active_plugins( $value ) {
</span><del>-        if( false == is_array( $value ) )
</del><ins>+        if ( false == is_array( $value ) )
</ins><span class="cx">                 $value = array();
</span><span class="cx">         return $value;
</span><span class="cx"> }
</span><span class="lines">@@ -2137,7 +2126,7 @@
</span><span class="cx">         global $wpdb;
</span><span class="cx">         // Garbage Collection
</span><span class="cx">         $rows = $wpdb-&gt;get_results( &quot;SELECT meta_key FROM {$wpdb-&gt;sitemeta} WHERE meta_key LIKE 'rss\_%\_ts' AND meta_value &lt; unix_timestamp( date_sub( NOW(), interval 7200 second ) )&quot; );
</span><del>-        if( is_array( $rows ) ) {
</del><ins>+        if ( is_array( $rows ) ) {
</ins><span class="cx">                 foreach( $rows as $row ) {
</span><span class="cx">                         $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;DELETE FROM {$wpdb-&gt;sitemeta} WHERE meta_key = %s&quot;, $row-&gt;meta_key ) );
</span><span class="cx">                         $wpdb-&gt;query( $wpdb-&gt;prepare( &quot;DELETE FROM {$wpdb-&gt;sitemeta} WHERE meta_key = %s&quot;, str_replace( '_ts', '', $row-&gt;meta_key ) ) );
</span><span class="lines">@@ -2166,7 +2155,7 @@
</span><span class="cx"> 
</span><span class="cx"> function mu_upload_dir( $uploads ) {
</span><span class="cx">         $dir = $uploads[ 'basedir' ];
</span><del>-        if( defined( 'BLOGUPLOADDIR' ) )
</del><ins>+        if ( defined( 'BLOGUPLOADDIR' ) )
</ins><span class="cx">                 $dir = constant( 'BLOGUPLOADDIR' );
</span><span class="cx">         $dir = untrailingslashit( $dir ) . $uploads[ 'subdir' ];
</span><span class="cx">         $uploads[ 'path' ] = $dir;
</span><span class="lines">@@ -2177,11 +2166,10 @@
</span><span class="cx"> 
</span><span class="cx"> function users_can_register_signup_filter() {
</span><span class="cx">         $registration = get_site_option('registration');
</span><del>-        if ( $registration == 'all' || $registration == 'user' ) {
</del><ins>+        if ( $registration == 'all' || $registration == 'user' )
</ins><span class="cx">                 return true;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 return false;
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> add_filter('option_users_can_register', 'users_can_register_signup_filter');
</span><span class="cx"> 
</span><span class="lines">@@ -2205,34 +2193,34 @@
</span><span class="cx"> add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
</span><span class="cx"> 
</span><span class="cx"> function first_page_filter( $text ) {
</span><del>-        if ( !$text ) {
</del><ins>+        if ( !$text )
</ins><span class="cx">                 return __( &quot;This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.&quot; );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return $text;
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'site_option_first_page', 'first_page_filter' );
</span><span class="cx"> 
</span><span class="cx"> function first_comment_filter( $text ) {
</span><del>-        if ( !$text ) {
</del><ins>+        if ( !$text )
</ins><span class="cx">                 return __( &quot;This is an example of a WordPress comment, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many comments like this one or sub-comments as you like and manage all of your content inside of WordPress.&quot; );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return $text;
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'site_option_first_comment', 'first_comment_filter' );
</span><span class="cx"> 
</span><span class="cx"> function first_comment_author_filter( $text ) {
</span><del>-        if ( !$text ) {
</del><ins>+        if ( !$text )
</ins><span class="cx">                 return __( &quot;Mr WordPress&quot; );
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return $text;
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'site_option_first_comment_author', 'first_comment_author_filter' );
</span><span class="cx"> 
</span><span class="cx"> function first_comment_url_filter( $text ) {
</span><span class="cx">         global $current_site;
</span><del>-        if ( !$text ) {
</del><ins>+        if ( !$text )
</ins><span class="cx">                 return 'http://' . $current_site-&gt;domain . $current_site-&gt;path;
</span><del>-        }
</del><ins>+
</ins><span class="cx">         return $text;
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'site_option_first_comment_url', 'first_comment_url_filter' );
</span><span class="lines">@@ -2258,14 +2246,15 @@
</span><span class="cx">  * @return bool True if forced, false if not forced.
</span><span class="cx">  */
</span><span class="cx"> function force_ssl_content( $force = '' ) {
</span><del>-        static $forced_content;
</del><ins>+        static $forced_content;
</ins><span class="cx"> 
</span><del>-        if ( '' != $force ) {
-                $old_forced = $forced_content;
-                $forced_content = $force;
-                return $old_forced;
-        }
-        return $forced_content;
</del><ins>+        if ( '' != $force ) {
+                $old_forced = $forced_content;
+                $forced_content = $force;
+                return $old_forced;
+        }
+
+        return $forced_content;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -2275,25 +2264,22 @@
</span><span class="cx">  * @since 2.8.5
</span><span class="cx">  **/
</span><span class="cx"> function filter_SSL( $url) {
</span><del>-        if ( !is_string( $url ) ) {
</del><ins>+        if ( !is_string( $url ) )
</ins><span class="cx">                 return get_bloginfo( 'url' ); //return home blog url with proper scheme
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         $arrURL = parse_url( $url );
</span><span class="cx"> 
</span><span class="cx">         if ( force_ssl_content() &amp;&amp; is_ssl() ) {
</span><del>-                if ( 'http' === $arrURL['scheme'] &amp;&amp; 'https' !== $arrURL['scheme'] ) {
</del><ins>+                if ( 'http' === $arrURL['scheme'] &amp;&amp; 'https' !== $arrURL['scheme'] )
</ins><span class="cx">                         $url = str_replace( $arrURL['scheme'], 'https', $url );
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $url;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function maybe_cancel_post_by_email() {
</span><del>-        if ( !defined( 'POST_BY_EMAIL' ) || !POST_BY_EMAIL ) {
</del><ins>+        if ( !defined( 'POST_BY_EMAIL' ) || !POST_BY_EMAIL )
</ins><span class="cx">                 die( __( 'This action has been disabled by the administrator' ) );
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx"> add_action( 'wp-mail.php', 'maybe_cancel_post_by_email' );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>