Make WordPress Core


Ignore:
Timestamp:
04/01/2010 09:21:27 PM (16 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/ms-sites.php

    r13733 r13918  
    11<?php
    2 require_once('admin.php');
     2require_once( './admin.php' );
    33
    44if ( !is_multisite() )
    5         wp_die( __('Multisite support is not enabled.') );
    6 
    7 $title = __('Sites');
     5        wp_die( __( 'Multisite support is not enabled.' ) );
     6
     7$title = __( 'Sites' );
    88$parent_file = 'ms-admin.php';
    99
    1010wp_enqueue_script( 'admin-forms' );
    1111
    12 require_once('admin-header.php');
     12require_once( './admin-header.php' );
    1313
    1414if ( ! current_user_can( 'manage_sites' ) )
    15         wp_die( __('You do not have permission to access this page.') );
    16 
    17 $id = isset($_GET['id']) ? intval( $_GET['id'] ) : 0;
    18 $protocol = is_ssl() ? 'https://' : 'http://';
    19 
    20 if ( isset($_GET['updated']) && $_GET['updated'] == 'true' ) {
     15        wp_die( __( 'You do not have permission to access this page.' ) );
     16
     17$id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
     18
     19if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
    2120        ?>
    2221        <div id="message" class="updated fade"><p>
    2322                <?php
    24                 switch ($_GET['action']) {
     23                switch ( $_GET['action'] ) {
    2524                        case 'all_notspam':
    26                                 _e('Sites mark as not spam !');
     25                                _e( 'Sites mark as not spam.' );
    2726                        break;
    2827                        case 'all_spam':
    29                                 _e('Sites mark as spam !');
     28                                _e( 'Sites mark as spam.' );
    3029                        break;
    3130                        case 'all_delete':
    32                                 _e('Sites deleted !');
     31                                _e( 'Sites deleted.' );
    3332                        break;
    3433                        case 'delete':
    35                                 _e('Site deleted !');
     34                                _e( 'Site deleted.' );
    3635                        break;
    3736                        case 'add-blog':
    38                                 _e('Site added !');
     37                                _e( 'Site added.' );
    3938                        break;
    4039                        case 'archive':
    41                                 _e('Site archived !');
     40                                _e( 'Site archived.' );
    4241                        break;
    4342                        case 'unarchive':
    44                                 _e('Site unarchived !');
     43                                _e( 'Site unarchived.' );
    4544                        break;
    4645                        case 'activate':
    47                                 _e('Site activated !');
     46                                _e( 'Site activated.' );
    4847                        break;
    4948                        case 'deactivate':
    50                                 _e('Site deactivated !');
     49                                _e( 'Site deactivated.' );
    5150                        break;
    5251                        case 'unspam':
    53                                 _e('Site mark as not spam !');
     52                                _e( 'Site mark as not spam.' );
    5453                        break;
    5554                        case 'spam':
    56                                 _e('Site mark as spam !');
    57                         break;
    58                         case 'umature':
    59                                 _e('Site mark as not mature !');
     55                                _e( 'Site mark as spam.' );
     56                        break;
     57                        case 'unmature':
     58                                _e( 'Site mark as not mature.' );
    6059                        break;
    6160                        case 'mature':
    62                                 _e('Site mark as mature !');
     61                                _e( 'Site mark as mature.' );
    6362                        break;
    6463                        default:
    65                                 _e('Options saved !');
     64                                _e( 'Settings saved.' );
    6665                        break;
    6766                }
     
    7170}
    7271
    73 $action = isset($_GET['action']) ? $_GET['action'] : 'list';
     72$action = isset( $_GET['action'] ) ? $_GET['action'] : 'list';
    7473
    7574switch ( $action ) {
    76         // Edit blog
    77         case "editblog":
     75        // Edit site
     76        case 'editblog':
    7877                $blog_prefix = $wpdb->get_blog_prefix( $id );
    7978                $options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '\_%' AND option_name NOT LIKE '%user_roles'" );
    80                 $details = get_blog_details($id);
     79                $details = get_blog_details( $id );
    8180                $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
    8281                $is_main_site = is_main_site( $id );
     
    8483                <div class="wrap">
    8584                <?php screen_icon(); ?>
    86                 <h2><?php _e('Edit Site'); ?> - <a href='<?php echo get_home_url($id); ?>'><?php echo get_home_url($id); ?></a></h2>
     85                <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2>
    8786                <form method="post" action="ms-edit.php?action=updateblog">
    88                         <?php wp_nonce_field('editblog'); ?>
    89                         <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" />
    90                         <div class='metabox-holder' style='width:49%;float:left;'>
    91                         <div id="blogedit_bloginfo" class="postbox " >
    92                         <h3 class='hndle'><span><?php _e('Site info (wp_blogs)'); ?></span></h3>
    93                         <div class="inside">
    94                                 <table class="form-table">
    95                                                         <tr class="form-field form-required">
    96                                                                 <th scope="row"><?php _e('Domain') ?></th>
    97 <?php if ( $is_main_site ) { ?>
    98                                                                 <td>http://<?php echo esc_attr($details->domain) ?></td>
    99 <?php } else { ?>
    100                                                                 <td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr($details->domain) ?>" size="33" /></td>
    101 <?php } ?>
     87                        <?php wp_nonce_field( 'editblog' ); ?>
     88                        <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
     89                        <div class="metabox-holder" style="width:49%;float:left;">
     90                                <div id="blogedit_bloginfo" class="postbox">
     91                                <h3 class="hndle"><span><?php _e( 'Site info (wp_blogs)' ); ?></span></h3>
     92                                <div class="inside">
     93                                        <table class="form-table">
     94                                                <tr class="form-field form-required">
     95                                                        <th scope="row"><?php _e( 'Domain' ) ?></th>
     96                                                        <?php
     97                                                        $protocol = is_ssl() ? 'https://' : 'http://';
     98                                                        if ( $is_main_site ) { ?>
     99                                                        <td><code><?php echo $protocol; echo esc_attr( $details->domain ) ?></code></td>
     100                                                        <?php } else { ?>
     101                                                        <td><?php echo $protocol; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" size="33" /></td>
     102                                                        <?php } ?>
     103                                                </tr>
     104                                                <tr class="form-field form-required">
     105                                                        <th scope="row"><?php _e( 'Path' ) ?></th>
     106                                                        <?php if ( $is_main_site ) { ?>
     107                                                        <td><code><?php echo esc_attr( $details->path ) ?></code></td>
     108                                                        <?php } else { ?>
     109                                                        <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" size="40" style='margin-bottom:5px;' />
     110                                                        <br /><input type="checkbox" style="width:20px;" name="update_home_url" value="update" <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></td>
     111                                                        <?php } ?>
     112                                                </tr>
     113                                                <tr class="form-field">
     114                                                        <th scope="row"><?php _e( 'Registered') ?></th>
     115                                                        <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" size="40" /></td>
     116                                                </tr>
     117                                                <tr class="form-field">
     118                                                        <th scope="row"><?php _e('Last Updated') ?></th>
     119                                                        <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" size="40" /></td>
     120                                                </tr>
     121                                                <tr class="form-field">
     122                                                        <th scope="row"><?php _e('Public') ?></th>
     123                                                        <td>
     124                                                                <label><input type="radio" style="width:20px;" name="blog[public]" value="1" <?php checked( $details->public, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
     125                                                                <label><input type="radio" style="width:20px;" name="blog[public]" value="0" <?php checked( $details->public, 0 ); ?> /> <?php _e( 'No' ) ?></label>
     126                                                        </td>
     127                                                </tr>
     128                                                <tr class="form-field">
     129                                                        <th scope="row"><?php _e( 'Archived' ); ?></th>
     130                                                        <td>
     131                                                                <label><input type="radio" style="width:20px;" name="blog[archived]" value="1" <?php checked( $details->archived, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
     132                                                                <label><input type="radio" style="width:20px;" name="blog[archived]" value="0" <?php checked( $details->archived, 0 ); ?> /> <?php _e( 'No' ) ?></label>
     133                                                        </td>
     134                                                </tr>
     135                                                <tr class="form-field">
     136                                                        <th scope="row"><?php _e( 'Mature' ); ?></th>
     137                                                        <td>
     138                                                                <label><input type="radio" style="width:20px;" name="blog[mature]" value="1" <?php checked( $details->mature, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
     139                                                                <label><input type="radio" style="width:20px;" name="blog[mature]" value="0" <?php checked( $details->mature, 0); ?> /> <?php _e( 'No' ) ?></label>
     140                                                        </td>
     141                                                </tr>
     142                                                <tr class="form-field">
     143                                                        <th scope="row"><?php _e( 'Spam' ); ?></th>
     144                                                        <td>
     145                                                                <label><input type="radio" style="width:20px;" name="blog[spam]" value="1" <?php checked( $details->spam, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
     146                                                                <label><input type="radio" style="width:20px;" name="blog[spam]" value="0" <?php checked( $details->spam, 0 ); ?> /> <?php _e( 'No' ) ?></label>
     147                                                        </td>
     148                                                </tr>
     149                                                <tr class="form-field">
     150                                                        <th scope="row"><?php _e( 'Deleted' ); ?></th>
     151                                                        <td>
     152                                                                <label><input type="radio" style="width:20px;" name="blog[deleted]" value="1" <?php checked( $details->deleted, 1 ); ?> /> <?php _e( 'Yes' ) ?></label>
     153                                                                <label><input type="radio" style="width:20px;" name="blog[deleted]" value="0" <?php checked( $details->deleted, 0 ); ?> /> <?php _e( 'No' ) ?></label>
     154                                                        </td>
     155                                                </tr>
     156                                        </table>
     157                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
     158                                </div>
     159                                </div>
     160
     161                                <div id="blogedit_blogoptions" class="postbox" >
     162                                <h3 class="hndle"><span><?php printf( __( 'Site options (%soptions)' ), $blog_prefix ); ?></span></h3>
     163                                <div class="inside">
     164                                        <table class="form-table">
     165                                                <?php
     166                                                $editblog_default_role = 'subscriber';
     167                                                foreach ( $options as $option ) {
     168                                                        if ( $option->option_name == 'default_role' )
     169                                                                $editblog_default_role = $option->option_value;
     170                                                        $disabled = false;
     171                                                        $class = 'all-options';
     172                                                        if ( is_serialized( $option->option_value ) ) {
     173                                                                if ( is_serialized_string( $option->option_value ) ) {
     174                                                                        $option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' );
     175                                                                } else {
     176                                                                        $option->option_value = 'SERIALIZED DATA';
     177                                                                        $disabled = true;
     178                                                                        $class = 'all-options disabled';
     179                                                                }
     180                                                        }
     181                                                        if ( strpos( $option->option_value, "\n" ) !== false ) {
     182                                                        ?>
     183                                                                <tr class="form-field">
     184                                                                        <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
     185                                                                        <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php wp_htmledit_pre( $option->option_value ) ?></textarea></td>
     186                                                                </tr>
     187                                                        <?php
     188                                                        } else {
     189                                                        ?>
     190                                                                <tr class="form-field">
     191                                                                        <th scope="row"><?php esc_html_e( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
     192                                                                        <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
     193                                                                        <td><code><?php esc_html_e( $option->option_value ) ?></code></td>
     194                                                                        <?php } else { ?>
     195                                                                        <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
     196                                                                        <?php } ?>
     197                                                                </tr>
     198                                                        <?php
     199                                                        }
     200                                                } // End foreach
     201                                                ?>
     202                                        </table>
     203                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
     204                                </div>
     205                                </div>
     206                        </div>
     207
     208                        <div class="metabox-holder" style="width:49%;float:right;">
     209                                <?php
     210                                // Site Themes
     211                                $themes = get_themes();
     212                                $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
     213                                $allowed_themes = get_site_option( 'allowedthemes' );
     214
     215                                if ( ! $allowed_themes )
     216                                        $allowed_themes = array_keys( $themes );
     217
     218                                $out = '';
     219                                foreach ( $themes as $key => $theme ) {
     220                                        $theme_key = esc_html( $theme['Stylesheet'] );
     221                                        if ( ! isset( $allowed_themes[$theme_key] ) ) {
     222                                                $checked = isset( $blog_allowed_themes[ $theme_key ] ) ? 'checked="checked"' : '';
     223                                                $out .= '<tr class="form-field form-required">
     224                                                                <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html( $key ) . '</th>
     225                                                                <td><label><input name="theme[' . esc_attr( $theme_key ) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/> ' . __( 'Active' ) . '</label></td>
     226                                                        </tr>';
     227                                        }
     228                                }
     229
     230                                if ( $out != '' ) {
     231                                ?>
     232                                <div id="blogedit_blogthemes" class="postbox">
     233                                <h3 class="hndle"><span><?php esc_html_e( 'Site Themes' ); ?></span></h3>
     234                                <div class="inside">
     235                                        <p class="description"><?php _e( 'Activate the themename of an existing theme and hit "Update Options" to allow the theme for this site.' ) ?></p>
     236                                        <table class="form-table">
     237                                                <?php echo $out; ?>
     238                                        </table>
     239                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
     240                                </div></div>
     241                                <?php }
     242
     243                                // Site users
     244                                $blogusers = get_users_of_blog( $id );
     245                                if ( is_array( $blogusers ) ) {
     246                                        echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">';
     247                                        echo '<table class="form-table">';
     248                                        echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>";
     249                                        reset( $blogusers );
     250                                        foreach ( (array) $blogusers as $key => $val ) {
     251                                                if ( isset( $val->meta_value ) && ! $val->meta_value )
     252                                                        continue;
     253                                                $t = @unserialize( $val->meta_value );
     254                                                if ( is_array( $t ) ) {
     255                                                        reset( $t );
     256                                                        $existing_role = key( $t );
     257                                                }
     258                                                echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
     259                                                if ( $val->user_id != $current_user->data->ID ) {
     260                                                        ?>
     261                                                        <td>
     262                                                                <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
     263                                                                        foreach ( $editblog_roles as $role => $role_assoc ){
     264                                                                                $name = translate_user_role( $role_assoc['name'] );
     265                                                                                echo '<option ' . selected( $role, $existing_role ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
     266                                                                        }
     267                                                                        ?>
     268                                                                </select>
     269                                                        </td>
     270                                                        <td>
     271                                                                <input type="text" name="user_password[<?php echo esc_attr( $val->user_id ) ?>]" />
     272                                                        </td>
     273                                                        <?php
     274                                                        echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $val->user_id ) . ']" /></td>';
     275                                                } else {
     276                                                        echo "<td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __( 'N/A' ) . "</strong></td>";
     277                                                }
     278                                                echo '</tr>';
     279                                        }
     280                                        echo "</table>";
     281                                        echo '<p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="' . esc_attr__( 'Update Options' ) . '" /></p>';
     282                                        echo "</div></div>";
     283                                }
     284                                ?>
     285
     286                                <div id="blogedit_blogadduser" class="postbox">
     287                                <h3 class="hndle"><span><?php _e( 'Add a new user' ); ?></span></h3>
     288                                <div class="inside">
     289                                        <p class="description"><?php _e( 'Enter the username of an existing user and hit "Update Options" to add the user.' ) ?></p>
     290                                        <table class="form-table">
     291                                                        <tr>
     292                                                                <th scope="row"><?php _e( 'User&nbsp;Login:' ) ?></th>
     293                                                                <td><input type="text" name="newuser" id="newuser" /></td>
    102294                                                        </tr>
    103                                                         <tr class="form-field form-required">
    104                                                                 <th scope="row"><?php _e('Path') ?></th>
    105 <?php if ( $is_main_site ) { ?>
    106                                                                 <td><?php echo esc_attr($details->path) ?></td>
    107 <?php } else { ?>
    108                                                                 <td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details->path) ?>" size="40" style='margin-bottom:5px;' />
    109                                                                 <br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == untrailingslashit( get_blogaddress_by_id($id) ) || get_blog_option( $id, 'home' ) == untrailingslashit( get_blogaddress_by_id($id) ) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
    110 <?php } ?>
    111                                                         </tr>
    112                                                         <tr class="form-field">
    113                                                                 <th scope="row"><?php _e('Registered') ?></th>
    114                                                                 <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" size="40" /></td>
    115                                                         </tr>
    116                                                         <tr class="form-field">
    117                                                                 <th scope="row"><?php _e('Last Updated') ?></th>
    118                                                                 <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" size="40" /></td>
    119                                                         </tr>
    120                                                         <tr class="form-field">
    121                                                                 <th scope="row"><?php _e('Public') ?></th>
     295                                                        <tr>
     296                                                                <th scope="row"><?php _e( 'Role:' ) ?></th>
    122297                                                                <td>
    123                                                                         <input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details->public == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
    124                                                                         <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details->public == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
    125                                                                 </td>
    126                                                         </tr>
    127                                                         <tr class="form-field">
    128                                                                 <th scope="row"><?php _e( 'Archived' ); ?></th>
    129                                                                 <td>
    130                                                                         <input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details->archived == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
    131                                                                         <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details->archived == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
    132                                                                 </td>
    133                                                         </tr>
    134                                                         <tr class="form-field">
    135                                                                 <th scope="row"><?php _e( 'Mature' ); ?></th>
    136                                                                 <td>
    137                                                                         <input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details->mature == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
    138                                                                         <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details->mature == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
    139                                                                 </td>
    140                                                         </tr>
    141                                                         <tr class="form-field">
    142                                                                 <th scope="row"><?php _e( 'Spam' ); ?></th>
    143                                                                 <td>
    144                                                                         <input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details->spam == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
    145                                                                         <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details->spam == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
    146                                                                 </td>
    147                                                         </tr>
    148                                                         <tr class="form-field">
    149                                                                 <th scope="row"><?php _e( 'Deleted' ); ?></th>
    150                                                                 <td>
    151                                                                         <input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details->deleted == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
    152                                                                         <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details->deleted == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
     298                                                                        <select name="new_role" id="new_role">
     299                                                                        <?php
     300                                                                        reset( $editblog_roles );
     301                                                                        foreach ( $editblog_roles as $role => $role_assoc ){
     302                                                                                $name = translate_user_role( $role_assoc['name'] );
     303                                                                                $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
     304                                                                                echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
     305                                                                        }
     306                                                                        ?>
     307                                                                        </select>
    153308                                                                </td>
    154309                                                        </tr>
    155310                                                </table>
    156                                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
    157                         </div></div>
    158 
    159                         <div id="blogedit_blogoptions" class="postbox" >
    160                         <h3 class='hndle'><span><?php printf( __('Site options (%soptions)'), $blog_prefix ); ?></span></h3>
    161                         <div class="inside">
    162                                 <table class="form-table">
    163                                                         <?php
    164                                                         $editblog_default_role = 'subscriber';
    165                                                         foreach ( $options as $option ) {
    166                                                                 if ( $option->option_name == 'default_role' )
    167                                                                         $editblog_default_role = $option->option_value;
    168                                                                 $disabled = false;
    169                                                                 if ( is_serialized($option->option_value) ) {
    170                                                                         if ( is_serialized_string($option->option_value) ) {
    171                                                                                 $option->option_value = esc_html(maybe_unserialize($option->option_value), 'single');
    172                                                                         } else {
    173                                                                                 $option->option_value = "SERIALIZED DATA";
    174                                                                                 $disabled = true;
    175                                                                         }
    176                                                                 }
    177                                                                 if ( stristr($option->option_value, "\r") || stristr($option->option_value, "\n") || stristr($option->option_value, "\r\n") ) {
    178                                                                 ?>
    179                                                                         <tr class="form-field">
    180                                                                                 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
    181                                                                                 <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php disabled( $disabled ) ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
    182                                                                         </tr>
    183                                                                 <?php
    184                                                                 } else {
    185                                                                 ?>
    186                                                                         <tr class="form-field">
    187                                                                                 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
    188 <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
    189                                                                                 <td><?php echo esc_attr( $option->option_value ) ?></td>
    190 <?php } else { ?>
    191                                                                                 <td><input name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
    192 <?php } ?>
    193                                                                         </tr>
    194                                                                 <?php
    195                                                                 }
    196                                                         } // End foreach
    197                                                         ?>
    198                                                 </table>
    199                                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
    200                         </div></div>
    201                         </div>
    202 
    203                         <div class='metabox-holder' style='width:49%;float:right;'>
    204                         <?php
    205                                         // Blog Themes
    206                                         $themes = get_themes();
    207                                         $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
    208                                         $allowed_themes = get_site_option( "allowedthemes" );
    209                                         if ( ! $allowed_themes )
    210                                                 $allowed_themes = array_keys( $themes );
    211                                         $out = '';
    212                                         foreach ( $themes as $key => $theme ) {
    213                                                 $theme_key = esc_html( $theme['Stylesheet'] );
    214                                                 if ( ! isset($allowed_themes[$theme_key] ) ) {
    215                                                         $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
    216                                                         $out .= '<tr class="form-field form-required">
    217                                                                         <th title="' . esc_attr( $theme["Description"] ).'" scope="row">' . esc_html($key) . '</th>
    218                                                                         <td><input name="theme[' . esc_attr($theme_key) . ']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
    219                                                                 </tr>';
    220                                                 }
    221                                         }
    222 
    223                                         if ( $out != '' ) {
    224                         ?>
    225                         <div id="blogedit_blogthemes" class="postbox">
    226                         <h3 class='hndle'><span><?php esc_html_e('Site Themes'); ?></span></h3>
    227                         <div class="inside">
    228                                 <table class="form-table">
    229                                         <tr><th style="font-weight:bold;"><?php esc_html_e('Theme'); ?></th></tr>
    230                                         <?php echo $out; ?>
    231                                 </table>
    232                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
    233                         </div></div>
    234                         <?php } ?>
    235 
    236                         <?php
    237                                         // Blog users
    238                                         $blogusers = get_users_of_blog( $id );
    239                                         if ( is_array( $blogusers ) ) {
    240                                                 echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Site Users') . '</span></h3><div class="inside">';
    241                                                 echo '<table class="form-table">';
    242                                                 echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>";
    243                                                 reset($blogusers);
    244                                                 foreach ( (array) $blogusers as $key => $val ) {
    245                                                         if ( isset( $val->meta_value ) && ! $val->meta_value )
    246                                                                 continue;
    247                                                         $t = @unserialize( $val->meta_value );
    248                                                         if ( is_array( $t ) ) {
    249                                                                 reset( $t );
    250                                                                 $existing_role = key( $t );
    251                                                         }
    252                                                         echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
    253                                                         if ( $val->user_id != $current_user->data->ID ) {
    254                                                                 ?>
    255                                                                 <td>
    256                                                                         <select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
    257                                                                                 foreach ( $editblog_roles as $role => $role_assoc ){
    258                                                                                         $name = translate_user_role($role_assoc['name']);
    259                                                                                         $selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
    260                                                                                         echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>";
    261                                                                                 }
    262                                                                                 ?>
    263                                                                         </select>
    264                                                                 </td>
    265                                                                 <td>
    266                                                                                 <input type='text' name='user_password[<?php echo esc_attr($val->user_id) ?>]' />
    267                                                                 </td>
    268                                                                 <?php
    269                                                                 echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . esc_attr($val->user_id) . ']" /></td>';
    270                                                         } else {
    271                                                                 echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>";
    272                                                         }
    273                                                         echo '</tr>';
    274                                                 }
    275                                                 echo "</table>";
    276                                                 echo '<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="' . esc_attr__('Update Options') . '" /></p>';
    277                                                 echo "</div></div>";
    278                                         }
    279                         ?>
    280 
    281                         <div id="blogedit_blogadduser" class="postbox">
    282                         <h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
    283                         <div class="inside">
    284                                 <p style="margin:10px 0 0px;padding:0px 10px 10px;border-bottom:1px solid #DFDFDF;"><?php _e('Enter the username of an existing user and hit <em>Update Options</em> to add the user.') ?></p>
    285                                 <table class="form-table">
    286                                                 <tr>
    287                                                         <th scope="row"><?php _e('User&nbsp;Login:') ?></th>
    288                                                         <td><input type="text" name="newuser" id="newuser" /></td>
    289                                                 </tr>
    290                                                 <tr>
    291                                                         <th scope="row"><?php _e('Role:') ?></th>
    292                                                         <td>
    293                                                                 <select name="new_role" id="new_role">
    294                                                                 <?php
    295                                                                 reset( $editblog_roles );
    296                                                                 foreach ( $editblog_roles as $role => $role_assoc ){
    297                                                                         $name = translate_user_role( $role_assoc['name'] );
    298                                                                         $selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
    299                                                                         echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>";
    300                                                                 }
    301                                                                 ?>
    302                                                                 </select>
    303                                                         </td>
    304                                                 </tr>
     311                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
     312                                </div>
     313                                </div>
     314
     315                                <div id="blogedit_miscoptions" class="postbox">
     316                                <h3 class="hndle"><span><?php _e( 'Misc Site Actions' ) ?></span></h3>
     317                                <div class="inside">
     318                                        <table class="form-table">
     319                                                        <?php do_action( 'wpmueditblogaction', $id ); ?>
    305320                                        </table>
    306                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
    307                         </div></div>
    308 
    309                         <div id="blogedit_miscoptions" class="postbox">
    310                         <h3 class='hndle'><span><?php _e('Misc Site Actions') ?></span></h3>
    311                         <div class="inside">
    312                                 <table class="form-table">
    313                                                 <?php do_action( 'wpmueditblogaction', $id ); ?>
    314                                 </table>
    315                                 <p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
    316                         </div></div>
    317 
     321                                        <p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options' ) ?>" /></p>
     322                                </div>
     323                                </div>
    318324                        </div>
    319325
     
    324330        break;
    325331
    326         // List blogs
     332        // List sites
    327333        case 'list':
    328334        default:
     
    337343                $per_page = apply_filters( 'ms_sites_per_page', $per_page );
    338344
    339                 $s = isset($_GET['s']) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
     345                $s = isset( $_GET['s'] ) ? stripslashes( trim( $_GET[ 's' ] ) ) : '';
    340346                $like_s = esc_sql( like_escape( $s ) );
    341347
    342348                $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
    343 
    344                 if ( isset( $_GET['blogstatus'] ) ) {
    345                         if ( 'deleted' == $_GET['blogstatus'] ) {
    346                                 $query .= " AND {$wpdb->blogs}.deleted = '1' ";
    347                         } elseif ( 'archived' == $_GET['blogstatus'] ) {
    348                                 $query .= " AND {$wpdb->blogs}.archived = '1' ";
    349                         } elseif ( 'spam' == $_GET['blogstatus'] ) {
    350                                 $query .= " AND {$wpdb->blogs}.spam = '1' ";
    351                         }
    352                 }
    353349
    354350                if ( isset( $_GET['searchaction'] ) ) {
     
    381377                $query .= $order;
    382378
    383                 $total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
    384 
    385                 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page );
     379                $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(blog_id)', $query ) );
     380
     381                $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page );
    386382                $blog_list = $wpdb->get_results( $query, ARRAY_A );
    387383
     
    390386                        'base' => add_query_arg( 'paged', '%#%' ),
    391387                        'format' => '',
    392                         'prev_text' => __('&laquo;'),
    393                         'next_text' => __('&raquo;'),
     388                        'prev_text' => __( '&laquo;' ),
     389                        'next_text' => __( '&raquo;' ),
    394390                        'total' => $num_pages,
    395391                        'current' => $pagenum
    396392                ));
    397393
    398                 if ( empty($_GET['mode']) )
     394                if ( empty( $_GET['mode'] ) )
    399395                        $mode = 'list';
    400396                else
    401397                        $mode = esc_attr( $_GET['mode'] );
    402 
    403                 // for subsubsub and $blog_list
    404                 $status_list = array( 'archived' => array( 'site-archived', __('Archived') ), 'spam' => array( 'site-spammed', __('Spam') ), 'deleted' => array( 'site-deleted', __('Deleted') ) );
    405398                ?>
    406399
     
    408401                <?php screen_icon(); ?>
    409402                <h2><?php _e('Sites') ?>
    410                 <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x('Add New', 'sites'); ?></a>
     403                <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a>
    411404                <?php
    412                 if ( isset($_GET['s']) && $_GET['s'] )
    413                 printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) );
     405                if ( isset( $_GET['s'] ) && $_GET['s'] )
     406                printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
    414407                ?>
    415408                </h2>
    416 
    417                 <ul class="subsubsub">
    418                 <?php
    419                 $status_links = array();
    420                 $status_class = '';
    421                 $count = get_blog_count();
    422 
    423                 if ( empty($_GET['blogstatus']) || $_GET['blogstatus'] == 'all' )
    424                                 $status_class = ' class="current"';
    425 
    426                 $status_links[] = "<li><a href='ms-sites.php?blogstatus=all'$status_class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'sites' ), number_format_i18n( $count ) ) . '</a>';
    427 
    428                 foreach ( $status_list as $status => $col ) {
    429                         $status_class = '';
    430 
    431                         if ( empty( $count->$status ) )
    432                                 continue;
    433 
    434                         if ( isset( $_GET['blogstatus'] ) && ( $_GET['blogstatus'] == $status ) )
    435                                 $status_class = ' class="current"';
    436 
    437                         $status_links[] = "<li><a href='ms-sites.php?blogstatus=$status'$status_class>" . sprintf(  $col[1] . ' <span class="count">(%s)</span>' , number_format_i18n( $count->$status ) ) . '</a>';
    438                 };
    439 
    440                 echo implode( " |</li>\n", $status_links ) . '</li>';
    441                 unset( $status_links );
    442                 ?>
    443                 </ul>
    444409
    445410                <form action="ms-sites.php" method="get" id="ms-search">
    446411                <p class="search-box">
    447412                <input type="hidden" name="action" value="blogs" />
    448                 <input type="text" name="s" value="<?php esc_attr_e( $s ); ?>" />
    449                 <input type="submit" class="button" value="<?php esc_attr_e('Search Site by') ?>" />
     413                <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" />
     414                <input type="submit" class="button" value="<?php esc_attr_e( 'Search Site by' ) ?>" />
    450415                <select name="searchaction">
    451                         <option value="name" selected="selected"><?php _e('Name'); ?></option>
    452                         <option value="id"><?php _e('ID'); ?></option>
    453                         <option value="ip"><?php _e('IP address'); ?></option>
     416                        <option value="name" selected="selected"><?php _e( 'Name' ); ?></option>
     417                        <option value="id"><?php _e( 'ID' ); ?></option>
     418                        <option value="ip"><?php _e( 'IP address' ); ?></option>
    454419                </select>
    455420                </p>
     
    457422
    458423                <form id="form-site-list" action="ms-edit.php?action=allblogs" method="post">
    459                 <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
     424                <input type="hidden" name="mode" value="<?php echo esc_attr( $mode ); ?>" />
    460425                <div class="tablenav">
    461426                <div class="alignleft actions">
    462427                        <select name="action">
    463                                 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
    464                                 <option value="delete"><?php _e('Delete'); ?></option>
    465                                 <option value="spam"><?php _e('Mark as Spam'); ?></option>
    466                                 <option value="notspam"><?php _e('Not Spam'); ?></option>
     428                                <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
     429                                <option value="delete"><?php _e( 'Delete' ); ?></option>
     430                                <option value="spam"><?php _e( 'Mark as Spam' ); ?></option>
     431                                <option value="notspam"><?php _e( 'Not Spam' ); ?></option>
    467432                        </select>
    468                         <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    469                         <?php wp_nonce_field('bulk-sites'); ?>
     433                        <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
     434                        <?php wp_nonce_field( 'bulk-ms-sites' ); ?>
    470435                </div>
    471436
     
    482447
    483448                <div class="view-switch">
    484                         <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
    485                         <a href="<?php echo esc_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
     449                        <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'List View' ) ?>" alt="<?php _e( 'List View' ) ?>" /></a>
     450                        <a href="<?php echo esc_url( add_query_arg( 'mode', 'excerpt', $_SERVER['REQUEST_URI'] ) ) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" width="20" height="20" title="<?php _e( 'Excerpt View' ) ?>" alt="<?php _e( 'Excerpt View' ) ?>" /></a>
    486451                </div>
    487452
     
    492457                <?php
    493458                // define the columns to display, the syntax is 'internal name' => 'display name'
    494                 $blogname_columns = ( is_subdomain_install() ) ? __('Domain') : __('Path');
    495                 $posts_columns = array(
    496                         'id'           => __('ID'),
     459                $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' );
     460                $sites_columns = array(
     461                        'id'           => __( 'ID' ),
    497462                        'blogname'     => $blogname_columns,
    498                         'lastupdated'  => __('Last Updated'),
    499                         'registered'   => __('Registered'),
    500                         'users'        => __('Users')
     463                        'lastupdated'  => __( 'Last Updated'),
     464                        'registered'   => __( 'Registered' ),
     465                        'users'        => __( 'Users' )
    501466                );
    502467
    503468                if ( has_filter( 'wpmublogsaction' ) )
    504                         $posts_columns['plugins'] = __('Actions');
    505 
    506                 $posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
     469                        $sites_columns['plugins'] = __( 'Actions' );
     470
     471                $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns );
    507472                ?>
    508473
     
    510475                        <thead>
    511476                                <tr>
    512                                 <th style="" class="manage-column column-cb check-column" id="cb" scope="col">
     477                                <th class="manage-column column-cb check-column" id="cb" scope="col">
    513478                                        <input type="checkbox" />
    514479                                </th>
    515480                                <?php
    516                                 foreach($posts_columns as $column_id => $column_display_name) {
     481                                $col_url = '';
     482                                foreach($sites_columns as $column_id => $column_display_name) {
    517483                                        $column_link = "<a href='";
    518484                                        $order2 = '';
    519485                                        if ( $order_by == $column_id )
    520                                                 $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
    521 
    522                                         $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), $_SERVER['REQUEST_URI'] ) );
     486                                                $order2 = ( $order == 'DESC' ) ? 'ASC' : 'DESC';
     487
     488                                        $column_link .= esc_url( add_query_arg( array( 'order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );
    523489                                        $column_link .= "'>{$column_display_name}</a>";
    524                                         $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
    525                                 ?>
    526                                 <th scope="col">
    527                                         <?php echo $col_url ?>
    528                                 </th>
    529                                 <?php } ?>
     490                                        $col_url .= '<th scope="col">' . ( ( $column_id == 'users' || $column_id == 'plugins' ) ? $column_display_name : $column_link ) . '</th>';
     491                                }
     492                                echo $col_url ?>
    530493                                </tr>
    531494                        </thead>
    532495                        <tfoot>
    533496                                <tr>
    534                                 <th class="manage-column column-cb check-column" id="cb" scope="col">
     497                                <th class="manage-column column-cb check-column" id="cb1" scope="col">
    535498                                        <input type="checkbox" />
    536499                                </th>
    537                                 <?php foreach($posts_columns as $column_id => $column_display_name) {
    538                                         $column_link = "<a href='";
    539                                         $order2 = '';
    540                                         if ( $order_by == $column_id )
    541                                                 $order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
    542 
    543                                         $column_link .= esc_url(add_query_arg( array('order' => $order2, 'paged' => $pagenum, 'sortby' => $column_id ), remove_query_arg( array('action', 'updated'), $_SERVER['REQUEST_URI'] ) ) );
    544                                         $column_link .= "'>{$column_display_name}</a>";
    545                                         $col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
    546                                 ?>
    547                                 <th scope="col">
    548500                                        <?php echo $col_url ?>
    549                                 </th>
    550                                 <?php } ?>
    551501                                </tr>
    552502                        </tfoot>
    553                         <tbody id="the-list">
     503                        <tbody id="the-site-list" class="list:site">
    554504                        <?php
     505                        $status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', __( 'Spam' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ) );
    555506                        if ( $blog_list ) {
    556507                                $class = '';
    557508                                foreach ( $blog_list as $blog ) {
    558                                         $class = ('alternate' == $class) ? '' : 'alternate';
     509                                        $class = ( 'alternate' == $class ) ? '' : 'alternate';
    559510                                        reset( $status_list );
    560511
     
    567518                                        }
    568519                                        $blog_state = '';
    569                                         if ( ! empty($blog_states) ) {
    570                                                 $state_count = count($blog_states);
     520                                        if ( ! empty( $blog_states ) ) {
     521                                                $state_count = count( $blog_states );
    571522                                                $i = 0;
    572523                                                $blog_state .= ' - ';
     
    579530                                        echo "<tr class='$class'>";
    580531
    581                                         $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
    582                                         foreach ( $posts_columns as $column_name=>$column_display_name ) {
     532                                        $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
     533                                        foreach ( $sites_columns as $column_name=>$column_display_name ) {
    583534                                                switch ( $column_name ) {
    584535                                                        case 'id': ?>
    585536                                                                <th scope="row" class="check-column">
    586                                                                         <input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo esc_attr($blog['blog_id']) ?>' />
     537                                                                        <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
    587538                                                                </th>
    588539                                                                <th valign="top" scope="row">
     
    594545                                                        case 'blogname': ?>
    595546                                                                <td class="column-title">
    596                                                                         <a href="ms-sites.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
     547                                                                        <a href="<?php echo esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
    597548                                                                        <?php
    598549                                                                        if ( 'list' != $mode )
     
    600551
    601552                                                                        $actions        = array();
    602                                                                         $actions[]      = '<a href="ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
    603                                                                         $actions[]      = "<a href='" . get_admin_url($blog['blog_id']) . "' class='edit'>" . __('Backend') . '</a>';
    604 
    605                                                                         if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
    606                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=activateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';
    607                                                                         else
    608                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';
    609 
    610                                                                         if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
    611                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' .  $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';
    612                                                                         else
    613                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the site %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';
    614 
    615                                                                         if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
    616                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the site %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';
    617                                                                         else
    618                                                                                 $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';
    619 
    620                                                                         $actions[]      = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to delete the site %s" ), $blogname ) ) . '">' . __("Delete") . '</a>';
    621 
    622                                                                         $actions[]      = "<a href='" . get_home_url($blog['blog_id']) . "' rel='permalink'>" . __('Visit') . '</a>';
    623                                                                         ?>
    624 
    625                                                                         <?php if ( count($actions) ) : ?>
     553                                                                        $actions[]      = '<span class="edit"><a href="' . esc_url( admin_url( 'ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a><span>';
     554                                                                        $actions[]      = "<span class='backend'><a href='" . esc_url( get_admin_url($blog['blog_id']) ) . "' class='edit'>" . __( 'Backend' ) . '</a></span>';
     555                                                                        if ( $current_site->blog_id != $blog['blog_id'] ) {
     556                                                                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
     557                                                                                        $actions[]      = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Activate' ) . '</a></span>';
     558                                                                                else
     559                                                                                        $actions[]      = '<span class="activate"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the site %s" ), $blogname ) ) ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
     560       
     561                                                                                if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
     562                                                                                        $actions[]      = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' .  $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
     563                                                                                else
     564                                                                                        $actions[]      = '<span class="archive"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the site %s." ), $blogname ) ) ) ) . '">' . __( 'Archive' ) . '</a></span>';
     565       
     566                                                                                if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
     567                                                                                        $actions[]      = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Spam' ) . '</a></span>';
     568                                                                                else
     569                                                                                        $actions[]      = '<span class="spam"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as spam." ), $blogname ) ) ) ) . '">' . __( 'Spam' ) . '</a></span>';
     570       
     571                                                                                if ( get_blog_status( $blog['blog_id'], 'mature' ) == '1' )
     572                                                                                        $actions[]      = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=unmatureblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unmature the site %s." ), $blogname ) ) ) ) . '">' . __( 'Not Mature' ) . '</a></span>';
     573                                                                                else
     574                                                                                        $actions[]      = '<span class="mature"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=matureblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the site %s as mature." ), $blogname ) ) ) ) . '">' . __( 'Mature' ) . '</a></span>';
     575       
     576                                                                                $actions[]      = '<span class="delete"><a href="' . esc_url( admin_url( 'ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to delete the site %s." ), $blogname ) ) ) ) . '">' . __( 'Delete' ) . '</a></span>';
     577                                                                        }
     578
     579                                                                        $actions[]      = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a>';
     580
     581                                                                        if ( count( $actions ) ) : ?>
    626582                                                                        <div class="row-actions">
    627                                                                                 <?php echo implode(' | ', $actions); ?>
     583                                                                                <?php echo implode( ' | ', $actions ); ?>
    628584                                                                        </div>
    629585                                                                        <?php endif; ?>
     
    639595                                                                        else
    640596                                                                                $date = 'Y/m/d \<\b\r \/\> g:i:s a';
    641                                                                         echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date( __( $date ), $blog['last_updated'] ); ?>
     597                                                                        echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( __( $date ), $blog['last_updated'] ); ?>
    642598                                                                </td>
    643599                                                        <?php
     
    645601                                                case 'registered': ?>
    646602                                                                <td valign="top">
    647                                                                 <?php echo mysql2date(__( $date ), $blog['registered'] ); ?>
     603                                                                <?php
     604                                                                if ( $blog['registered'] == '0000-00-00 00:00:00' )
     605                                                                        echo '&#x2014;';
     606                                                                else
     607                                                                        echo mysql2date( __( $date ), $blog['registered'] );
     608                                                                ?>
    648609                                                                </td>
    649610                                                <?php
     
    657618                                                                                if ( count( $blogusers ) > 5 ) {
    658619                                                                                        $blogusers = array_slice( $blogusers, 0, 5 );
    659                                                                                         $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . get_admin_url($blog['blog_id'], 'users.php') . '">' . __( 'More' ) . '</a>';
     620                                                                                        $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>';
    660621                                                                                }
    661622                                                                                foreach ( $blogusers as $key => $val ) {
    662                                                                                         echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ';
     623                                                                                        echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> ';
    663624                                                                                        if ( 'list' != $mode )
    664625                                                                                                echo '(' . $val->user_email . ')';
     
    676637                                                                <?php if ( has_filter( 'wpmublogsaction' ) ) { ?>
    677638                                                                <td valign="top">
    678                                                                         <?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
     639                                                                        <?php do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
    679640                                                                </td>
    680641                                                                <?php } ?>
     
    684645                                                                <?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?>
    685646                                                                <td valign="top">
    686                                                                         <?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
     647                                                                        <?php do_action( 'manage_blogs_custom_column', $column_name, $blog['blog_id'] ); ?>
    687648                                                                </td>
    688649                                                                <?php } ?>
     
    696657                        } else { ?>
    697658                                <tr>
    698                                         <td colspan="8"><?php _e('No blogs found.') ?></td>
     659                                        <td colspan="<?php echo (int) count( $sites_columns ); ?>"><?php _e( 'No blogs found.' ) ?></td>
    699660                                </tr>
    700661                        <?php
     
    712673                        <div class="alignleft actions">
    713674                        <select name="action2">
    714                                 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
    715                                 <option value="delete"><?php _e('Delete'); ?></option>
    716                                 <option value="spam"><?php _e('Mark as Spam'); ?></option>
    717                                 <option value="notspam"><?php _e('Not Spam'); ?></option>
     675                                <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
     676                                <option value="delete"><?php _e( 'Delete' ); ?></option>
     677                                <option value="spam"><?php _e( 'Mark as Spam' ); ?></option>
     678                                <option value="notspam"><?php _e( 'Not Spam' ); ?></option>
    718679                        </select>
    719                         <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
     680                        <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
    720681                        </div>
    721682                        <br class="clear" />
     
    727688                <div class="wrap">
    728689                        <a name="form-add-site"></a>
    729                         <h2><?php _e('Add Site') ?></h2>
     690                        <h2><?php _e( 'Add Site' ) ?></h2>
    730691                        <form method="post" action="ms-edit.php?action=addblog">
    731                                 <?php wp_nonce_field('add-blog') ?>
     692                                <?php wp_nonce_field( 'add-blog' ) ?>
    732693                                <table class="form-table">
    733694                                        <tr class="form-field form-required">
    734                                                 <th scope='row'><?php _e('Site Address') ?></th>
     695                                                <th scope="row"><?php _e( 'Site Address' ) ?></th>
    735696                                                <td>
    736697                                                <?php if ( is_subdomain_install() ) { ?>
    737                                                         <input name="blog[domain]" type="text" class="regular-text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
     698                                                        <input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'Domain' ) ?>"/>.<?php echo $current_site->domain;?>
    738699                                                <?php } else {
    739                                                         echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e('Domain') ?>"/>
     700                                                        echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e( 'Domain' ) ?>"/>
    740701                                                <?php }
    741                                                 echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
     702                                                echo '<p>' . __( 'Only the characters a-z and 0-9 recommended.' ) . '</p>';
    742703                                                ?>
    743704                                                </td>
    744705                                        </tr>
    745706                                        <tr class="form-field form-required">
    746                                                 <th scope='row'><?php _e('Site Title') ?></th>
    747                                                 <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e('Title') ?>"/></td>
     707                                                <th scope="row"><?php _e( 'Site Title' ) ?></th>
     708                                                <td><input name="blog[title]" type="text" class="regular-text" title="<?php _e( 'Title' ) ?>"/></td>
    748709                                        </tr>
    749710                                        <tr class="form-field form-required">
    750                                                 <th scope='row'><?php _e('Admin Email') ?></th>
    751                                                 <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e('Email') ?>"/></td>
     711                                                <th scope="row"><?php _e( 'Admin Email' ) ?></th>
     712                                                <td><input name="blog[email]" type="text" class="regular-text" title="<?php _e( 'Email' ) ?>"/></td>
    752713                                        </tr>
    753714                                        <tr class="form-field">
    754                                                 <td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td>
     715                                                <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td>
    755716                                        </tr>
    756717                                </table>
    757718                                <p class="submit">
    758                                         <input class="button" type="submit" name="go" value="<?php esc_attr_e('Add Site') ?>" /></p>
     719                                        <input class="button" type="submit" name="go" value="<?php esc_attr_e( 'Add Site' ) ?>" /></p>
    759720                        </form>
    760721                </div>
     
    763724} // end switch( $action )
    764725
    765 include('admin-footer.php'); ?>
     726include( './admin-footer.php' ); ?>
Note: See TracChangeset for help on using the changeset viewer.