<!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>[12948] trunk: ms-functions pruning and cleanup.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12948">12948</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-04 18:57:32 +0000 (Thu, 04 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>ms-functions pruning and cleanup. Props nacin. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesfilephp">trunk/wp-admin/includes/file.php</a></li>
<li><a href="#trunkwpincludesmsdefaultfiltersphp">trunk/wp-includes/ms-default-filters.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwploginphp">trunk/wp-login.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/file.php (12947 => 12948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/file.php        2010-02-04 18:50:36 UTC (rev 12947)
+++ trunk/wp-admin/includes/file.php        2010-02-04 18:57:32 UTC (rev 12948)
</span><span class="lines">@@ -325,6 +325,9 @@
</span><span class="cx">         // Compute the URL
</span><span class="cx">         $url = $uploads['url'] . &quot;/$filename&quot;;
</span><span class="cx"> 
</span><ins>+        if ( is_multisite() )
+                delete_transient( 'dirsize_cache' );
+
</ins><span class="cx">         return apply_filters( 'wp_handle_upload', array( 'file' =&gt; $new_file, 'url' =&gt; $url, 'type' =&gt; $type ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesmsdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-default-filters.php (12947 => 12948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-default-filters.php        2010-02-04 18:50:36 UTC (rev 12947)
+++ trunk/wp-includes/ms-default-filters.php        2010-02-04 18:57:32 UTC (rev 12948)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> add_action ( 'init', 'maybe_add_existing_user_to_blog' );
</span><span class="cx"> add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
</span><span class="cx"> add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
</span><del>-add_action ( 'sanitize_user', 'strtolower_usernames', 10, 3 );
</del><ins>+add_action ( 'sanitize_user', 'strtolower' );
</ins><span class="cx"> 
</span><span class="cx"> // Blogs
</span><span class="cx"> add_filter ( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12947 => 12948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-02-04 18:50:36 UTC (rev 12947)
+++ trunk/wp-includes/ms-functions.php        2010-02-04 18:57:32 UTC (rev 12948)
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> 
</span><span class="cx"> function get_blogaddress_by_id( $blog_id ) {
</span><span class="cx">         $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
</span><del>-        return clean_url(&quot;http://&quot; . $bloginfo-&gt;domain . $bloginfo-&gt;path);
</del><ins>+        return esc_url( 'http://' . $bloginfo-&gt;domain . $bloginfo-&gt;path );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function get_blogaddress_by_name( $blogname ) {
</span><span class="lines">@@ -26,9 +26,9 @@
</span><span class="cx">         if ( is_subdomain_install() ) {
</span><span class="cx">                 if ( $blogname == 'main' )
</span><span class="cx">                         $blogname = 'www';
</span><del>-                return clean_url( &quot;http://&quot; . $blogname . &quot;.&quot; . $current_site-&gt;domain . $current_site-&gt;path );
</del><ins>+                return esc_url( 'http://' . $blogname . '.' . $current_site-&gt;domain . $current_site-&gt;path );
</ins><span class="cx">         } else {
</span><del>-                return clean_url( &quot;http://&quot; . $current_site-&gt;domain . $current_site-&gt;path . $blogname . '/' );
</del><ins>+                return esc_url( 'http://' . $current_site-&gt;domain . $current_site-&gt;path . $blogname . '/' );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -38,16 +38,15 @@
</span><span class="cx">         } else {
</span><span class="cx">                 if ( $domain != $_SERVER['HTTP_HOST'] ) {
</span><span class="cx">                         $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
</span><del>-                        if ( $blogname != 'www.' ) {
-                                $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path . $blogname . '/';
-                        } else { // we're installing the main blog
-                                $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
-                        }
</del><ins>+                        $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
+                        // we're not installing the main blog
+                        if ( $blogname != 'www.' )
+                                $url .= $blogname . '/';
</ins><span class="cx">                 } else { // main blog
</span><span class="cx">                         $url = 'http://' . $domain . $path;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        return clean_url($url);
</del><ins>+        return esc_url( $url );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function get_sitestats() {
</span><span class="lines">@@ -55,13 +54,13 @@
</span><span class="cx"> 
</span><span class="cx">         $stats['blogs'] = get_blog_count();
</span><span class="cx"> 
</span><del>-        $count_ts = get_site_option( &quot;get_user_count_ts&quot; );
</del><ins>+        $count_ts = get_site_option( 'user_count_ts' );
</ins><span class="cx">         if ( time() - $count_ts &gt; 3600 ) {
</span><del>-                $count = $wpdb-&gt;get_var( &quot;SELECT COUNT(ID) FROM {$wpdb-&gt;users}&quot; );
-                update_site_option( &quot;user_count&quot;, $count );
-                update_site_option( &quot;user_count_ts&quot;, time() );
</del><ins>+                $count = $wpdb-&gt;get_var( &quot;SELECT COUNT(ID) FROM $wpdb-&gt;users&quot; );
+                update_site_option( 'user_count', $count );
+                update_site_option( 'user_count_ts', time() );
</ins><span class="cx">         } else {
</span><del>-                $count = get_site_option( &quot;user_count&quot; );
</del><ins>+                $count = get_site_option( 'user_count' );
</ins><span class="cx">         }
</span><span class="cx">         $stats['users'] = $count;
</span><span class="cx">         return $stats;
</span><span class="lines">@@ -70,13 +69,13 @@
</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><span class="cx">         else
</span><del>-                $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) );
</del><ins>+                $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 ) );
</ins><span class="cx"> 
</span><del>-        if ( $site_id != false )
-                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 );
</del><ins>+        if ( $site_id )
+                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 );
</ins><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="lines">@@ -119,34 +118,32 @@
</span><span class="cx">         $details = wp_cache_get( $blog_id . $all, 'blog-details' );
</span><span class="cx"> 
</span><span class="cx">         if ( $details ) {
</span><del>-                if ( !is_object($details) &amp;&amp; $details == -1 )
-                        return false;
-                elseif ( !is_object($details) ) // Clear old pre-serialized objects. Cache clients do better with that.
-                        wp_cache_delete( $blog_id . $all, 'blog-details' );
-                else
-                        return $details;
</del><ins>+                if ( ! is_object( $details ) ) {
+                        if ( $details == -1 )
+                                return false;
+                        else
+                                // Clear old pre-serialized objects. Cache clients do better with that.
+                                wp_cache_delete( $blog_id . $all, 'blog-details' );
+                }
+                return $details;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $details = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;blogs WHERE blog_id = %d /* get_blog_details */&quot;, $blog_id) );
-        if ( !$details ) {
</del><ins>+        $details = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT * FROM $wpdb-&gt;blogs WHERE blog_id = %d&quot;, $blog_id ) );
+        if ( ! $details ) {
</ins><span class="cx">                 wp_cache_set( $blog_id . $all, -1, 'blog-details' );
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( !$get_all ) {
</del><ins>+        if ( ! $get_all ) {
</ins><span class="cx">                 wp_cache_set( $blog_id . $all, $details, 'blog-details' );
</span><span class="cx">                 return $details;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $wpdb-&gt;suppress_errors();
-        switch_to_blog( $blog_id );
-        $details-&gt;blogname                = get_option( 'blogname' );
-        $details-&gt;siteurl                = get_option( 'siteurl' );
-        $details-&gt;post_count        = get_option( 'post_count' );
-        restore_current_blog();
-        $wpdb-&gt;suppress_errors( false );
</del><ins>+        $details-&gt;blogname                = get_blog_option( $blog_id, 'blogname' );
+        $details-&gt;siteurl                = get_blog_option( $blog_id, 'siteurl' );
+        $details-&gt;post_count        = get_blog_option( $blog_id, 'post_count' );
</ins><span class="cx"> 
</span><del>-        $details = apply_filters('blog_details', $details);
</del><ins>+        $details = apply_filters( 'blog_details', $details );
</ins><span class="cx"> 
</span><span class="cx">         wp_cache_set( $blog_id . $all, $details, 'blog-details' );
</span><span class="cx"> 
</span><span class="lines">@@ -629,7 +626,7 @@
</span><span class="cx">                 if ( is_array( $most_active ) ) {
</span><span class="cx">                         reset( $most_active );
</span><span class="cx">                         foreach ( (array) $most_active as $key =&gt; $details ) {
</span><del>-                                $url = clean_url(&quot;http://&quot; . $details['domain'] . $details['path']);
</del><ins>+                                $url = esc_url(&quot;http://&quot; . $details['domain'] . $details['path']);
</ins><span class="cx">                                 echo &quot;&lt;li&gt;&quot; . $details['postcount'] . &quot; &lt;a href='$url'&gt;$url&lt;/a&gt;&lt;/li&gt;&quot;;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -1151,15 +1148,15 @@
</span><span class="cx">         else
</span><span class="cx">                 $activate_url = &quot;http://{$domain}{$path}wp-activate.php?key=$key&quot;;
</span><span class="cx"> 
</span><del>-        $activate_url = clean_url($activate_url);
</del><ins>+        $activate_url = esc_url($activate_url);
</ins><span class="cx">         $admin_email = get_site_option( &quot;admin_email&quot; );
</span><span class="cx">         if ( $admin_email == '' )
</span><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><del>-        $message = sprintf( apply_filters( 'wpmu_signup_blog_notification_email', __( &quot;To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s&quot; ) ), $activate_url, clean_url( &quot;http://{$domain}{$path}&quot; ), $key );
</del><ins>+        $message = sprintf( apply_filters( 'wpmu_signup_blog_notification_email', __( &quot;To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s&quot; ) ), $activate_url, esc_url( &quot;http://{$domain}{$path}&quot; ), $key );
</ins><span class="cx">         // TODO: Don't hard code activation link.
</span><del>-        $subject = sprintf( apply_filters( 'wpmu_signup_blog_notification_subject', __( '[%1s] Activate %2s' ) ), $from_name, clean_url( 'http://' . $domain . $path ) );
</del><ins>+        $subject = sprintf( apply_filters( 'wpmu_signup_blog_notification_subject', __( '[%1s] Activate %2s' ) ), $from_name, esc_url( 'http://' . $domain . $path ) );
</ins><span class="cx">         wp_mail($user_email, $subject, $message, $message_headers);
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -1326,7 +1323,7 @@
</span><span class="cx">         if ( is_email($email) == false )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        $options_site_url = clean_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</del><ins>+        $options_site_url = esc_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</ins><span class="cx"> 
</span><span class="cx">         switch_to_blog( $blog_id );
</span><span class="cx">         $blogname = get_option( 'blogname' );
</span><span class="lines">@@ -1357,7 +1354,7 @@
</span><span class="cx"> 
</span><span class="cx">         $user = new WP_User($user_id);
</span><span class="cx"> 
</span><del>-        $options_site_url = clean_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</del><ins>+        $options_site_url = esc_url(&quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}wp-admin/ms-options.php&quot;);
</ins><span class="cx">         $msg = sprintf(__(&quot;New User: %1s
</span><span class="cx"> Remote IP: %2s
</span><span class="cx"> 
</span><span class="lines">@@ -1594,13 +1591,6 @@
</span><span class="cx">         return $dirsize[ $directory ][ 'size' ];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function clear_dirsize_cache( $file = true ) {
-        delete_transient( 'dirsize_cache' );
-        return $file;
-}
-add_filter( 'wp_handle_upload', 'clear_dirsize_cache' );
-add_action( 'delete_attachment', 'clear_dirsize_cache' );
-
</del><span class="cx"> function recurse_dirsize( $directory ) {
</span><span class="cx">         $size = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -1835,11 +1825,7 @@
</span><span class="cx">         update_blog_status( $wpdb-&gt;blogid, 'public', (int) $value );
</span><span class="cx"> }
</span><span class="cx"> add_action('update_option_blog_public', 'update_blog_public', 10, 2);
</span><del>-
-function strtolower_usernames( $username, $raw, $strict ) {
-        return strtolower( $username );
-}
-
</del><ins>+        
</ins><span class="cx"> /* Redirect all hits to &quot;dashboard&quot; blog to wp-admin/ Dashboard. */
</span><span class="cx"> function redirect_mu_dashboard() {
</span><span class="cx">         global $current_site, $current_blog;
</span><span class="lines">@@ -1854,12 +1840,10 @@
</span><span class="cx"> add_action( 'template_redirect', 'redirect_mu_dashboard' );
</span><span class="cx"> 
</span><span class="cx"> function get_dashboard_blog() {
</span><del>-        global $current_site;
</del><ins>+        if ( $blog = get_site_option( 'dashboard_blog' ) )
+                return get_blog_details( $blog );
</ins><span class="cx"> 
</span><del>-        if ( get_site_option( 'dashboard_blog' ) == false )
-                return get_blog_details( $current_site-&gt;blog_id );
-        else
-                return get_blog_details( get_site_option( 'dashboard_blog' ) );
</del><ins>+        return get_blog_details( $GLOBALS['current_site']-&gt;blog_id );
</ins><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="lines">@@ -1878,29 +1862,12 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function retrieve_password_sitename( $title ) {
-        global $current_site;
-        return sprintf( __( '[%s] Password Reset' ), $current_site-&gt;site_name );
-}
-add_filter( 'retrieve_password_title', 'retrieve_password_sitename' );
-
-function reset_password_sitename( $title ) {
-        global $current_site;
-        return sprintf( __( '[%s] Your new password' ), $current_site-&gt;site_name );
-}
-add_filter( 'password_reset_title', 'reset_password_sitename' );
-
-function lowercase_username( $username, $raw_username, $strict ) {
-        return strtolower( $username );
-}
-add_filter( 'sanitize_user', 'lowercase_username', 10, 3 );
-
</del><span class="cx"> function users_can_register_signup_filter() {
</span><span class="cx">         $registration = get_site_option('registration');
</span><span class="cx">         if ( $registration == 'all' || $registration == 'user' )
</span><span class="cx">                 return true;
</span><del>-        else
-                return false;
</del><ins>+
+        return false;
</ins><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">@@ -1949,7 +1916,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.8.5
</span><span class="cx">  **/
</span><del>-function filter_SSL( $url) {
</del><ins>+function filter_SSL( $url ) {
</ins><span class="cx">         if ( !is_string( $url ) )
</span><span class="cx">                 return get_bloginfo( 'url' ); //return home blog url with proper scheme
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12947 => 12948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-02-04 18:50:36 UTC (rev 12947)
+++ trunk/wp-includes/post.php        2010-02-04 18:57:32 UTC (rev 12948)
</span><span class="lines">@@ -3186,6 +3186,9 @@
</span><span class="cx">         $backup_sizes = get_post_meta( $post-&gt;ID, '_wp_attachment_backup_sizes', true );
</span><span class="cx">         $file = get_attached_file( $post_id );
</span><span class="cx"> 
</span><ins>+        if ( is_multisite() )
+                delete_transient( 'dirsize_cache' );
+
</ins><span class="cx">         do_action('delete_attachment', $post_id);
</span><span class="cx"> 
</span><span class="cx">         wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
</span></span></pre></div>
<a id="trunkwploginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-login.php (12947 => 12948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-login.php        2010-02-04 18:50:36 UTC (rev 12947)
+++ trunk/wp-login.php        2010-02-04 18:57:32 UTC (rev 12948)
</span><span class="lines">@@ -195,11 +195,14 @@
</span><span class="cx">         else
</span><span class="cx">                 $message .= 'http://' . trailingslashit( $current_site-&gt;domain . $current_site-&gt;path ) . &quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login) . &quot;\r\n&quot;;
</span><span class="cx"> 
</span><del>-        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
-        // we want to reverse this for the plain text arena of emails.
-        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</del><ins>+        if ( is_multisite() )
+                $blogname = $GLOBALS['current_site']-&gt;site_name;
+        else
+                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+                // we want to reverse this for the plain text arena of emails.
+                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</ins><span class="cx"> 
</span><del>-        $title = sprintf(__('[%s] Password Reset'), $blogname);
</del><ins>+        $title = sprintf( __('[%s] Password Reset'), $blogname );
</ins><span class="cx"> 
</span><span class="cx">         $title = apply_filters('retrieve_password_title', $title);
</span><span class="cx">         $message = apply_filters('retrieve_password_message', $message, $key);
</span><span class="lines">@@ -244,11 +247,14 @@
</span><span class="cx">         $message .= sprintf(__('Password: %s'), $new_pass) . &quot;\r\n&quot;;
</span><span class="cx">         $message .= site_url('wp-login.php', 'login') . &quot;\r\n&quot;;
</span><span class="cx"> 
</span><del>-        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
-        // we want to reverse this for the plain text arena of emails.
-        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</del><ins>+        if ( is_multisite() )
+                $blogname = $GLOBALS['current_site']-&gt;site_name;
+        else
+                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+                // we want to reverse this for the plain text arena of emails.
+                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</ins><span class="cx"> 
</span><del>-        $title = sprintf(__('[%s] Your new password'), $blogname);
</del><ins>+        $title = sprintf( __('[%s] Your new password'), $blogname );
</ins><span class="cx"> 
</span><span class="cx">         $title = apply_filters('password_reset_title', $title);
</span><span class="cx">         $message = apply_filters('password_reset_message', $message, $new_pass);
</span></span></pre>
</div>
</div>

</body>
</html>