Make WordPress Core


Ignore:
Timestamp:
04/01/2010 09:21:27 PM (17 years ago)
Author:
markjaquith
Message:

Huge MS refactoring and code cleanup. see #12460. props ocean90.

File:
1 edited

Legend:

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

    r13896 r13918  
    2828                $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s Kb in size.'), get_site_option( 'fileupload_maxk', 1500 ) );
    2929        if ( upload_is_user_over_quota( false ) ) {
    30                 $file['error'] = __('You have used your space quota. Please delete files before uploading.');
     30                $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
    3131        }
    3232        if ( $file['error'] != '0' )
    … …  
    4646 * @return void
    4747 */
    48 function wpmu_delete_blog($blog_id, $drop = false) {
     48function wpmu_delete_blog( $blog_id, $drop = false ) {
    4949        global $wpdb;
    5050
    51         $switched = false;
     51        $switch = false;
    5252        if ( $blog_id != $wpdb->blogid ) {
    5353                $switch = true;
    54                 switch_to_blog($blog_id);
    55         }
    56 
    57         do_action('delete_blog', $blog_id, $drop);
    58 
    59         $users = get_users_of_blog($blog_id);
     54                switch_to_blog( $blog_id );
     55        }
     56
     57        $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
     58
     59        do_action( 'delete_blog', $blog_id, $drop );
     60
     61        $users = get_users_of_blog( $blog_id );
    6062
    6163        // Remove users from this blog.
    62         if ( !empty($users) ) {
    63                 foreach ($users as $user) {
    64                         remove_user_from_blog($user->user_id, $blog_id);
     64        if ( ! empty( $users ) ) {
     65                foreach ( $users as $user ) {
     66                        remove_user_from_blog( $user->user_id, $blog_id) ;
    6567                }
    6668        }
    … …  
    6971
    7072        if ( $drop ) {
    71                 $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
     73                $drop_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A );
    7274                $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
    7375
    … …  
    7678                        $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" );
    7779                }
    78                 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) );
     80                $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
    7981                $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
    80                 $dir = rtrim($dir, DIRECTORY_SEPARATOR);
     82                $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
    8183                $top_dir = $dir;
    8284                $stack = array($dir);
    8385                $index = 0;
    8486
    85                 while ( $index < count($stack) ) {
     87                while ( $index < count( $stack ) ) {
    8688                        # Get indexed directory from stack
    8789                        $dir = $stack[$index];
    8890
    89                         $dh = @ opendir($dir);
     91                        $dh = @opendir( $dir );
    9092                        if ( $dh ) {
    91                                 while ( ($file = @ readdir($dh)) !== false ) {
    92                                         if ($file == '.' or $file == '..')
     93                                while ( ( $file = @readdir( $dh ) ) !== false ) {
     94                                        if ( $file == '.' || $file == '..' )
    9395                                                continue;
    9496
    95                                         if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
     97                                        if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) )
    9698                                                $stack[] = $dir . DIRECTORY_SEPARATOR . $file;
    97                                         else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
    98                                                 @ unlink($dir . DIRECTORY_SEPARATOR . $file);
     99                                        else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) )
     100                                                @unlink( $dir . DIRECTORY_SEPARATOR . $file );
    99101                                }
    100102                        }
    … …  
    102104                }
    103105
    104                 $stack = array_reverse($stack);  // Last added dirs are deepest
     106                $stack = array_reverse( $stack );  // Last added dirs are deepest
    105107                foreach( (array) $stack as $dir ) {
    106108                        if ( $dir != $top_dir)
    107                         @rmdir($dir);
    108                 }
    109         }
    110         $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", 'wp_{$blog_id}_autosave_draft_ids') );
    111         $blogs = get_site_option( "blog_list" );
     109                        @rmdir( $dir );
     110                }
     111        }
     112
     113        $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '{$blog_prefix}autosave_draft_ids'" );
     114        $blogs = get_site_option( 'blog_list' );
    112115        if ( is_array( $blogs ) ) {
    113116                foreach ( $blogs as $n => $blog ) {
    114                         if ( $blog[ 'blog_id' ] == $blog_id )
    115                                 unset( $blogs[ $n ] );
     117                        if ( $blog['blog_id'] == $blog_id )
     118                                unset( $blogs[$n] );
    116119                }
    117120                update_site_option( 'blog_list', $blogs );
    … …  
    123126
    124127// @todo Merge with wp_delete_user() ?
    125 function wpmu_delete_user($id) {
     128function wpmu_delete_user( $id ) {
    126129        global $wpdb;
    127130
    128131        $id = (int) $id;
    129132
    130         do_action('wpmu_delete_user', $id);
    131 
    132         $blogs = get_blogs_of_user($id);
    133 
    134         if ( ! empty($blogs) ) {
    135                 foreach ($blogs as $blog) {
    136                         switch_to_blog($blog->userblog_id);
    137                         remove_user_from_blog($id, $blog->userblog_id);
    138 
    139                         $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
     133        do_action( 'wpmu_delete_user', $id );
     134
     135        $blogs = get_blogs_of_user( $id );
     136
     137        if ( ! empty( $blogs ) ) {
     138                foreach ( $blogs as $blog ) {
     139                        switch_to_blog( $blog->userblog_id );
     140                        remove_user_from_blog( $id, $blog->userblog_id );
     141
     142                        $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
    140143                        foreach ( (array) $post_ids as $post_id ) {
    141                                 wp_delete_post($post_id);
     144                                wp_delete_post( $post_id );
    142145                        }
    143146
    144147                        // Clean links
    145                         $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
     148                        $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
    146149
    147150                        if ( $link_ids ) {
    148151                                foreach ( $link_ids as $link_id )
    149                                         wp_delete_link($link_id);
     152                                        wp_delete_link( $link_id );
    150153                        }
    151154
    … …  
    154157        }
    155158
    156         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
    157         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
    158 
    159         clean_user_cache($id);
     159        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) );
     160        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
     161
     162        clean_user_cache( $id );
    160163
    161164        // allow for commit transaction
    162         do_action('deleted_user', $id);
     165        do_action( 'deleted_user', $id );
    163166
    164167        return true;
    … …  
    170173                return false;
    171174
    172     screen_icon('tools');
     175    screen_icon();
    173176    ?>
    174         <h2><?php esc_html_e('Users'); ?></h2>
    175         <p><?php _e( 'Transfer posts before deleting users:' ); ?></p>
    176         <form action="ms-edit.php?action=allusers" method="post">
    177         <input type="hidden" name="alluser_transfer_delete" />
     177        <h2><?php esc_html_e( 'Users' ); ?></h2>
     178        <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
     179        <form action="ms-edit.php?action=dodelete" method="post">
     180        <input type="hidden" name="dodelete" />
    178181    <?php
    179         wp_nonce_field( 'allusers' );
     182        wp_nonce_field( 'ms-users-delete' );
    180183        $site_admins = get_site_option( 'site_admins', array( 'admin' ) );
    181184        $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
    … …  
    192195
    193196                        if ( !empty( $blogs ) ) {
    194                                 echo '<p><strong>' . sprintf( __( 'Sites from %s:' ), $delete_user->user_login ) . '</strong></p>';
     197                                ?>
     198                                <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
     199                                <?php
    195200                                foreach ( (array) $blogs as $key => $details ) {
    196201                                        $blog_users = get_users_of_blog( $details->userblog_id );
    197202                                        if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
    198                                                 echo "<p><a href='http://{$details->domain}{$details->path}'>{$details->blogname}</a> ";
    199                                                 echo "<select name='blog[$val][{$key}]'>";
    200                                                 $out = '';
     203                                                $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
     204                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";
     205                                                $user_list = '';
    201206                                                foreach ( $blog_users as $user ) {
    202207                                                        if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
    203                                                                 $out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
     208                                                                $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
    204209                                                }
    205                                                 if ( $out == '' )
    206                                                         $out = $admin_out;
    207                                                 echo $out;
    208                                                 echo "</select>\n";
     210                                                if ( '' == $user_list )
     211                                                        $user_list = $admin_out;
     212                                                $user_dropdown .= $user_list;
     213                                                $user_dropdown .= "</select>\n";
     214                                                ?>
     215                                                <ul style="list-style:none;">
     216                                                        <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
     217                                                        <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
     218                                                        <?php _e( 'Delete all posts and links.' ); ?></label></li>
     219                                                        <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
     220                                                        <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
     221                                                </ul>
     222                                                <?php
    209223                                        }
    210224                                }
     225                                echo "</fieldset>";
    211226                        }
    212227                }
    213228        }
    214229        ?>
    215     <br class="clear" />
    216     <input type="submit" class="button-secondary delete" value="<?php _e( 'Delete user and transfer posts' ); ?> " />
     230        <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
    217231        </form>
    218232    <?php
    … …  
    226240                switch_to_blog( $blog_id );
    227241
    228         $blog_allowed_themes = get_option( "allowedthemes" );
     242        $blog_allowed_themes = get_option( 'allowedthemes' );
    229243        if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
    230                 $blog_allowed_themes = get_option( "allowed_themes" );
     244                $blog_allowed_themes = get_option( 'allowed_themes' );
    231245
    232246                if ( is_array( $blog_allowed_themes ) ) {
    233247                        foreach( (array) $themes as $key => $theme ) {
    234                                 $theme_key = esc_html( $theme[ 'Stylesheet' ] );
    235                                 if ( isset( $blog_allowed_themes[ $key ] ) == true ) {
    236                                         $blog_allowedthemes[ $theme_key ] = 1;
     248                                $theme_key = esc_html( $theme['Stylesheet'] );
     249                                if ( isset( $blog_allowed_themes[$key] ) == true ) {
     250                                        $blog_allowedthemes[$theme_key] = 1;
    237251                                }
    238252                        }
    239253                        $blog_allowed_themes = $blog_allowedthemes;
    240                         add_option( "allowedthemes", $blog_allowed_themes );
    241                         delete_option( "allowed_themes" );
     254                        add_option( 'allowedthemes', $blog_allowed_themes );
     255                        delete_option( 'allowed_themes' );
    242256                }
    243257        }
    … …  
    249263}
    250264
    251 function update_option_new_admin_email($old_value, $value) {
     265function update_option_new_admin_email( $old_value, $value ) {
    252266        if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
    253267                return;
    … …  
    255269        $hash = md5( $value. time() .mt_rand() );
    256270        $new_admin_email = array(
    257                 "hash" => $hash,
    258                 "newemail" => $value
     271                'hash' => $hash,
     272                'newemail' => $value
    259273        );
    260274        update_option( 'adminhash', $new_admin_email );
    261275
    262         $content = apply_filters( 'new_admin_email_content', __("Dear user,
     276        $content = apply_filters( 'new_admin_email_content', __( "Dear user,
    263277
    264278You recently requested to have the administration email address on
    … …  
    274288Regards,
    275289All at ###SITENAME###
    276 ###SITEURL###"), $new_admin_email );
    277 
    278         $content = str_replace('###ADMIN_URL###', esc_url(admin_url('options.php?adminhash='.$hash)), $content);
    279         $content = str_replace('###EMAIL###', $value, $content);
    280         $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
    281         $content = str_replace('###SITEURL###', network_home_url(), $content);
    282 
    283         wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
    284 }
    285 add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);
     290###SITEURL### "), $new_admin_email );
     291
     292        $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
     293        $content = str_replace( '###EMAIL###', $value, $content );
     294        $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
     295        $content = str_replace( '###SITEURL###', network_home_url(), $content );
     296
     297        wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content );
     298}
     299add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
    286300
    287301function send_confirmation_on_profile_email() {
    … …  
    290304                $errors = new WP_Error();
    291305
    292         if ( $current_user->id != $_POST[ 'user_id' ] )
     306        if ( $current_user->id != $_POST['user_id'] )
    293307                return false;
    294308
    295         if ( $current_user->user_email != $_POST[ 'email' ] ) {
    296                 if ( !is_email( $_POST[ 'email' ] ) ) {
     309        if ( $current_user->user_email != $_POST['email'] ) {
     310                if ( !is_email( $_POST['email'] ) ) {
    297311                        $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
    298312                        return;
    299313                }
    300314
    301                 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) {
     315                if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
    302316                        $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) );
    303317                        delete_option( $current_user->ID . '_new_email' );
    … …  
    305319                }
    306320
    307                 $hash = md5( $_POST[ 'email' ] . time() . mt_rand() );
     321                $hash = md5( $_POST['email'] . time() . mt_rand() );
    308322                $new_user_email = array(
    309                                 "hash" => $hash,
    310                                 "newemail" => $_POST[ 'email' ]
     323                                'hash' => $hash,
     324                                'newemail' => $_POST['email']
    311325                                );
    312326                update_option( $current_user->ID . '_new_email', $new_user_email );
    313327
    314                 $content = apply_filters( 'new_user_email_content', __("Dear user,
     328                $content = apply_filters( 'new_user_email_content', __( "Dear user,
    315329
    316330You recently requested to have the email address on your account changed.
    … …  
    325339Regards,
    326340All at ###SITENAME###
    327 ###SITEURL###"), $new_user_email );
    328 
    329                 $content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);
    330                 $content = str_replace('###EMAIL###', $_POST[ 'email' ], $content);
    331                 $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
    332                 $content = str_replace('###SITEURL###', network_home_url(), $content);
    333 
    334                 wp_mail( $_POST[ 'email' ], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content );
    335                 $_POST[ 'email' ] = $current_user->user_email;
     341###SITEURL###" ), $new_user_email );
     342
     343                $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
     344                $content = str_replace( '###EMAIL###', $_POST['email'], $content);
     345                $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
     346                $content = str_replace( '###SITEURL###', network_home_url(), $content );
     347
     348                wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content );
     349                $_POST['email'] = $current_user->user_email;
    336350        }
    337351}
    … …  
    340354function new_user_email_admin_notice() {
    341355        global $current_user;
    342         if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) )
    343                 echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail' ] ) . "</div>";
     356        if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( $current_user->ID . '_new_email' ) )
     357                echo "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
    344358}
    345359add_action( 'admin_notices', 'new_user_email_admin_notice' );
    … …  
    349363        $allowed_themes = get_site_option( 'allowedthemes' );
    350364        if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
    351                 $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format
     365                $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format
    352366                if ( !is_array( $allowed_themes ) ) {
    353367                        $allowed_themes = array();
    354368                } else {
    355369                        foreach( (array) $themes as $key => $theme ) {
    356                                 $theme_key = esc_html( $theme[ 'Stylesheet' ] );
     370                                $theme_key = esc_html( $theme['Stylesheet'] );
    357371                                if ( isset( $allowed_themes[ $key ] ) == true ) {
    358372                                        $allowedthemes[ $theme_key ] = 1;
    … …  
    377391
    378392        $dir_name = trailingslashit( BLOGUPLOADDIR );
    379         if ( !(is_dir($dir_name) && is_readable($dir_name)) )
     393        if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) )
    380394                return true;
    381395
    382         $dir = dir($dir_name);
     396        $dir = dir( $dir_name );
    383397        $size = 0;
    384398
    … …  
    386400                if ( $file != '.' && $file != '..' ) {
    387401                        if ( is_dir( $dir_name . $file) ) {
    388                                 $size += get_dirsize($dir_name . $file);
     402                                $size += get_dirsize( $dir_name . $file );
    389403                        } else {
    390                                 $size += filesize($dir_name . $file);
     404                                $size += filesize( $dir_name . $file );
    391405                        }
    392406                }
    … …  
    395409        $size = $size / 1024 / 1024;
    396410
    397         if ( ($space_allowed - $size) <= 0 )
     411        if ( ( $space_allowed - $size ) <= 0 )
    398412                return false;
    399413
    … …  
    407421 */
    408422function get_space_allowed() {
    409         $space_allowed = get_option('blog_upload_space');
     423        $space_allowed = get_option( 'blog_upload_space' );
    410424        if ( $space_allowed == false )
    411                 $space_allowed = get_site_option('blog_upload_space');
    412         if ( empty($space_allowed) || !is_numeric($space_allowed) )
     425                $space_allowed = get_site_option( 'blog_upload_space' );
     426        if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) )
    413427                $space_allowed = 50;
    414428
    … …  
    418432function display_space_usage() {
    419433        $space = get_space_allowed();
    420         $used = get_dirsize( BLOGUPLOADDIR )/1024/1024;
     434        $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
    421435
    422436        if ( $used > $space )
    … …  
    427441        if ( $space > 1000 ) {
    428442                $space = number_format( $space / 1024 );
    429                 $space .= __('GB');
     443                $space .= __( 'GB' );
    430444        } else {
    431                 $space .= __('MB');
     445                $space .= __( 'MB' );
    432446        }
    433447        ?>
    434         <strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>
     448        <strong><?php printf( __( 'Used: %1s%% of %2s' ), number_format( $percentused ), $space );?></strong>
    435449        <?php
    436450}
    … …  
    442456
    443457        $quota = get_space_allowed();
    444         $used = get_dirsize( BLOGUPLOADDIR )/1024/1024;
     458        $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
    445459
    446460        if ( $used > $quota )
    … …  
    448462        else
    449463                $percentused = ( $used / $quota ) * 100;
    450         $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved') : 'spam';
     464        $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
    451465        $used = round( $used, 2 );
    452466        $percentused = number_format( $percentused );
    453467
    454468        ?>
    455         <p class="sub musub"><?php _e('Storage Space'); ?></p>
    456         <div class="table">
     469        <p class="sub musub"><?php _e( 'Storage Space' ); ?></p>
     470        <div class="table table_content musubtable">
    457471        <table>
    458472                <tr class="first">
    459                         <td class="first b b-posts"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td>
    460                         <td class="t posts"><?php _e('Space Allowed'); ?></td>
    461                         <td class="b b-comments"><?php printf( __( '<a href="upload.php" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td>
    462                         <td class="last t comments <?php echo $used_color;?>"><?php _e('Space Used');?></td>
     473                        <td class="first b b-posts"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%sMB</a>' ), $quota ); ?></td>
     474                        <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
    463475                </tr>
    464476        </table>
    465477        </div>
     478        <div class="table table_discussion musubtable">
     479        <table>
     480                <tr class="first">
     481                        <td class="b b-comments"><?php printf( __( '<a href="' . esc_url( admin_url( 'upload.php' ) ) . '" title="Manage Uploads" class="musublink">%1sMB (%2$s%%)</a>' ), $used, $percentused ); ?></td>
     482                        <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
     483                </tr>
     484        </table>
     485        </div>
     486        <br class="clear" />
    466487        <?php
    467488}
    468 if ( current_user_can('edit_posts') )
    469         add_action('activity_box_end', 'dashboard_quota');
     489if ( current_user_can( 'edit_posts' ) )
     490        add_action( 'activity_box_end', 'dashboard_quota' );
    470491
    471492// Edit blog upload space setting on Edit Blog page
    472493function upload_space_setting( $id ) {
    473         $quota = get_blog_option($id, "blog_upload_space");
     494        $quota = get_blog_option( $id, 'blog_upload_space' );
    474495        if ( !$quota )
    475496                $quota = '';
    … …  
    477498        ?>
    478499        <tr>
    479                 <th><?php _e('Site Upload Space Quota'); ?></th>
    480                 <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /><?php _e('MB (Leave blank for network default)'); ?></td>
     500                <th><?php _e( 'Site Upload Space Quota '); ?></th>
     501                <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
    481502        </tr>
    482503        <?php
    483504}
    484 add_action('wpmueditblogaction', 'upload_space_setting');
     505add_action( 'wpmueditblogaction', 'upload_space_setting' );
    485506
    486507function update_user_status( $id, $pref, $value, $refresh = 1 ) {
    … …  
    490511
    491512        if ( $refresh == 1 )
    492                 refresh_user_details($id);
     513                refresh_user_details( $id );
    493514
    494515        if ( $pref == 'spam' ) {
    495516                if ( $value == 1 )
    496                         do_action( "make_spam_user", $id );
     517                        do_action( 'make_spam_user', $id );
    497518                else
    498                         do_action( "make_ham_user", $id );
     519                        do_action( 'make_ham_user', $id );
    499520        }
    500521
    … …  
    502523}
    503524
    504 function refresh_user_details($id) {
     525function refresh_user_details( $id ) {
    505526        $id = (int) $id;
    506527
    … …  
    508529                return false;
    509530
    510         clean_user_cache($id);
     531        clean_user_cache( $id );
    511532
    512533        return $id;
    … …  
    514535
    515536function format_code_lang( $code = '' ) {
    516         $code = strtolower(substr($code, 0, 2));
    517         $lang_codes = array('aa' => 'Afar',  'ab' => 'Abkhazian',  'af' => 'Afrikaans',  'ak' => 'Akan',  'sq' => 'Albanian',  'am' => 'Amharic',  'ar' => 'Arabic',  'an' => 'Aragonese',  'hy' => 'Armenian',  'as' => 'Assamese',  'av' => 'Avaric',  'ae' => 'Avestan',  'ay' => 'Aymara',  'az' => 'Azerbaijani',  'ba' => 'Bashkir',  'bm' => 'Bambara',  'eu' => 'Basque',  'be' => 'Belarusian',  'bn' => 'Bengali',  'bh' => 'Bihari',  'bi' => 'Bislama',  'bs' => 'Bosnian',  'br' => 'Breton',  'bg' => 'Bulgarian',  'my' => 'Burmese',  'ca' => 'Catalan; Valencian',  'ch' => 'Chamorro',  'ce' => 'Chechen',  'zh' => 'Chinese',  'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic',  'cv' => 'Chuvash',  'kw' => 'Cornish',  'co' => 'Corsican',  'cr' => 'Cree',  'cs' => 'Czech',  'da' => 'Danish',  'dv' => 'Divehi; Dhivehi; Maldivian',  'nl' => 'Dutch; Flemish',  'dz' => 'Dzongkha',  'en' => 'English',  'eo' => 'Esperanto',  'et' => 'Estonian',  'ee' => 'Ewe',  'fo' => 'Faroese',  'fj' => 'Fijian',  'fi' => 'Finnish',  'fr' => 'French',  'fy' => 'Western Frisian',  'ff' => 'Fulah',  'ka' => 'Georgian',  'de' => 'German',  'gd' => 'Gaelic; Scottish Gaelic',  'ga' => 'Irish',  'gl' => 'Galician',  'gv' => 'Manx',  'el' => 'Greek, Modern',  'gn' => 'Guarani',  'gu' => 'Gujarati',  'ht' => 'Haitian; Haitian Creole',  'ha' => 'Hausa',  'he' => 'Hebrew',  'hz' => 'Herero',  'hi' => 'Hindi',  'ho' => 'Hiri Motu',  'hu' => 'Hungarian',  'ig' => 'Igbo',  'is' => 'Icelandic',  'io' => 'Ido',  'ii' => 'Sichuan Yi',  'iu' => 'Inuktitut',  'ie' => 'Interlingue',  'ia' => 'Interlingua (International Auxiliary Language Association)',  'id' => 'Indonesian',  'ik' => 'Inupiaq',  'it' => 'Italian',  'jv' => 'Javanese',  'ja' => 'Japanese',  'kl' => 'Kalaallisut; Greenlandic',  'kn' => 'Kannada',  'ks' => 'Kashmiri',  'kr' => 'Kanuri',  'kk' => 'Kazakh',  'km' => 'Central Khmer',  'ki' => 'Kikuyu; Gikuyu',  'rw' => 'Kinyarwanda',  'ky' => 'Kirghiz; Kyrgyz',  'kv' => 'Komi',  'kg' => 'Kongo',  'ko' => 'Korean',  'kj' => 'Kuanyama; Kwanyama',  'ku' => 'Kurdish',  'lo' => 'Lao',  'la' => 'Latin',  'lv' => 'Latvian',  'li' => 'Limburgan; Limburger; Limburgish',  'ln' => 'Lingala',  'lt' => 'Lithuanian',  'lb' => 'Luxembourgish; Letzeburgesch',  'lu' => 'Luba-Katanga',  'lg' => 'Ganda',  'mk' => 'Macedonian',  'mh' => 'Marshallese',  'ml' => 'Malayalam',  'mi' => 'Maori',  'mr' => 'Marathi',  'ms' => 'Malay',  'mg' => 'Malagasy',  'mt' => 'Maltese',  'mo' => 'Moldavian',  'mn' => 'Mongolian',  'na' => 'Nauru',  'nv' => 'Navajo; Navaho',  'nr' => 'Ndebele, South; South Ndebele',  'nd' => 'Ndebele, North; North Ndebele',  'ng' => 'Ndonga',  'ne' => 'Nepali',  'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian',  'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',  'no' => 'Norwegian',  'ny' => 'Chichewa; Chewa; Nyanja',  'oc' => 'Occitan, Provençal',  'oj' => 'Ojibwa',  'or' => 'Oriya',  'om' => 'Oromo',  'os' => 'Ossetian; Ossetic',  'pa' => 'Panjabi; Punjabi',  'fa' => 'Persian',  'pi' => 'Pali',  'pl' => 'Polish',  'pt' => 'Portuguese',  'ps' => 'Pushto',  'qu' => 'Quechua',  'rm' => 'Romansh',  'ro' => 'Romanian',  'rn' => 'Rundi',  'ru' => 'Russian',  'sg' => 'Sango',  'sa' => 'Sanskrit',  'sr' => 'Serbian',  'hr' => 'Croatian',  'si' => 'Sinhala; Sinhalese',  'sk' => 'Slovak',  'sl' => 'Slovenian',  'se' => 'Northern Sami',  'sm' => 'Samoan',  'sn' => 'Shona',  'sd' => 'Sindhi',  'so' => 'Somali',  'st' => 'Sotho, Southern',  'es' => 'Spanish; Castilian',  'sc' => 'Sardinian',  'ss' => 'Swati',  'su' => 'Sundanese',  'sw' => 'Swahili',  'sv' => 'Swedish',  'ty' => 'Tahitian',  'ta' => 'Tamil',  'tt' => 'Tatar',  'te' => 'Telugu',  'tg' => 'Tajik',  'tl' => 'Tagalog',  'th' => 'Thai',  'bo' => 'Tibetan',  'ti' => 'Tigrinya',  'to' => 'Tonga (Tonga Islands)',  'tn' => 'Tswana',  'ts' => 'Tsonga',  'tk' => 'Turkmen',  'tr' => 'Turkish',  'tw' => 'Twi',  'ug' => 'Uighur; Uyghur',  'uk' => 'Ukrainian',  'ur' => 'Urdu',  'uz' => 'Uzbek',  've' => 'Venda',  'vi' => 'Vietnamese',  'vo' => 'Volapük',  'cy' => 'Welsh',  'wa' => 'Walloon'
    518 ,  'wo' => 'Wolof',  'xh' => 'Xhosa',  'yi' => 'Yiddish',  'yo' => 'Yoruba',  'za' => 'Zhuang; Chuang',  'zu' => 'Zulu');
    519         $lang_codes = apply_filters('lang_codes', $lang_codes, $code);
     537        $code = strtolower( substr( $code, 0, 2 ) );
     538        $lang_codes = array(
     539                'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
     540                'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
     541                'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',
     542                'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',
     543                'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',
     544                'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',
     545                'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',
     546                'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
     547                'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
     548                'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
     549                've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
     550        $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
    520551        return strtr( $code, $lang_codes );
    521552}
    … …  
    526557                        $term->slug = sanitize_title( $term->name );
    527558                } else {
    528                         $term[ 'slug' ] = sanitize_title( $term[ 'name' ] );
     559                        $term['slug'] = sanitize_title( $term['name'] );
    529560                }
    530561        }
    … …  
    536567        global $current_user;
    537568        $c = 0;
    538         if ( isset( $_GET[ 'c' ] ) )
    539                 $c = (int)$_GET[ 'c' ];
     569        if ( isset( $_GET['c'] ) )
     570                $c = (int) $_GET['c'];
    540571
    541572        if ( $c >= 5 ) {
    … …  
    547578        $dashboard_blog = get_dashboard_blog();
    548579        if ( is_object( $blog ) ) {
    549                 wp_redirect( get_admin_url($blog->blog_id, '?c=' . $c) ); // redirect and count to 5, "just in case"
     580                wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
    550581                exit;
    551582        }
    … …  
    565596                }
    566597                $blog = get_blog_details( get_user_meta( $current_user->ID, 'primary_blog', true ) );
    567                 $protocol = ( is_ssl() ? 'https://' : 'http://' );
    568                 wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
     598                        wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
    569599                exit;
    570600        }
    … …  
    590620                if ( $code_lang == 'en_US' ) { // American English
    591621                        $flag = true;
    592                         $ae = __('American English');
    593                         $output[$ae] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$ae.'</option>';
     622                        $ae = __( 'American English' );
     623                        $output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $ae . '</option>';
    594624                } elseif ( $code_lang == 'en_GB' ) { // British English
    595625                        $flag = true;
    596                         $be = __('British English');
    597                         $output[$be] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$be.'</option>';
     626                        $be = __( 'British English' );
     627                        $output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . $be . '</option>';
    598628                } else {
    599                         $translated = format_code_lang($code_lang);
    600                         $output[$translated] =  '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$translated.'</option>';
    601                 }
    602 
    603         }
    604 
    605         if ( $flag === false ) { // WordPress english
    606                 $output[] = '<option value=""'.((empty($current)) ? ' selected="selected"' : '').'>'.__('English')."</option>";
    607         }
     629                        $translated = format_code_lang( $code_lang );
     630                        $output[$translated] =  '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang ) . '> ' . esc_html ( $translated ) . '</option>';
     631                }
     632
     633        }
     634
     635        if ( $flag === false ) // WordPress english
     636                $output[] = '<option value=""' . selected( $current, '' ) . '>' . __( 'English' ) . "</option>";
    608637
    609638        // Order by name
    610         uksort($output, 'strnatcasecmp');
    611 
    612         $output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
    613         echo implode("\n\t", $output);
     639        uksort( $output, 'strnatcasecmp' );
     640
     641        $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
     642        echo implode( "\n\t", $output );
    614643}
    615644
    … …  
    638667                return;
    639668
    640         if ( !empty( $_GET[ 'feed_dismiss' ] ) )
    641                 update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss' ], true );
     669        if ( !empty( $_GET['feed_dismiss'] ) )
     670                update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
    642671
    643672        $url = get_site_option( 'admin_notice_feed' );
    … …  
    667696                return false;
    668697        if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
    669                 echo "<div id='update-nag'>" . __( 'Thank you for Updating! Please visit the <a href="ms-upgrade-network.php">Update Network</a> page to update all your sites.' ) . "</div>";
     698                echo "<div id='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "</div>";
    670699}
    671700add_action( 'admin_notices', 'site_admin_notice' );
    … …  
    674703        if ( is_subdomain_install() )
    675704                return $data;
    676         if ( $data[ 'post_type' ] != 'page' )
     705        if ( $data['post_type'] != 'page' )
    677706                return $data;
    678         if ( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' )
     707        if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
    679708                return $data;
    680709        if ( !is_main_site() )
    681710                return $data;
    682711
    683         $post_name = $data[ 'post_name' ];
     712        $post_name = $data['post_name'];
    684713        $c = 0;
    685714        while( $c < 10 && get_id_from_blogname( $post_name ) ) {
    … …  
    687716                $c ++;
    688717        }
    689         if ( $post_name != $data[ 'post_name' ] ) {
    690                 $data[ 'post_name' ] = $post_name;
     718        if ( $post_name != $data['post_name'] ) {
     719                $data['post_name'] = $post_name;
    691720        }
    692721        return $data;
    … …  
    700729        <tr>
    701730        <?php /* translators: My sites label */ ?>
    702                 <th scope="row"><?php _e('Primary Site'); ?></th>
     731                <th scope="row"><?php _e( 'Primary Site' ); ?></th>
    703732                <td>
    704733                <?php
    705734                $all_blogs = get_blogs_of_user( $current_user->ID );
    706                 $primary_blog = get_user_meta($current_user->ID, 'primary_blog', true);
     735                $primary_blog = get_user_meta( $current_user->ID, 'primary_blog', true );
    707736                if ( count( $all_blogs ) > 1 ) {
    708737                        $found = false;
    … …  
    712741                                        if ( $primary_blog == $blog->userblog_id )
    713742                                                $found = true;
    714                                         ?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>><?php echo get_home_url($blog->userblog_id) ?></option><?php
     743                                        ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog,  $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
    715744                                } ?>
    716745                        </select>
    … …  
    739768                return;
    740769        $mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
    741         if ( empty($mu_media_buttons[ 'image' ]) && current_theme_supports( 'post-thumbnails' ) ) {
    742                 echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), admin_url( 'ms-options.php' ) ) . "</div>";
     770        if ( empty($mu_media_buttons['image']) && current_theme_supports( 'post-thumbnails' ) ) {
     771                echo "<div id='update-nag'>" . sprintf( __( "Warning! The current theme supports post thumbnails. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "</div>";
    743772        }
    744773}
    … …  
    761790 */
    762791function _admin_notice_multisite_activate_plugins_page() {
    763         $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="ms-options.php#menu">' . __( 'Activate' ) . '</a>' );
     792        $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="' . esc_url( admin_url( 'ms-options.php#menu' ) ) . '">' . __( 'Activate' ) . '</a>' );
    764793        echo "<div class='error'><p>$message</p></div>";
    765794}
Note: See TracChangeset for help on using the changeset viewer.