Make WordPress Core

Ticket #6167: admin_color.diff

File admin_color.diff, 5.5 KB (added by ryan, 17 years ago)
  • wp-includes/registration.php

     
    154154        if ( empty($rich_editing) )
    155155                $rich_editing = 'true';
    156156
     157        if ( empty($admin_color) )
     158                $admin_color = 'classic';
     159        $admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
     160
    157161        if ( empty($user_registered) )
    158162                $user_registered = gmdate('Y-m-d H:i:s');
    159163
     
    176180        update_usermeta( $user_id, 'aim', $aim );
    177181        update_usermeta( $user_id, 'yim', $yim );
    178182        update_usermeta( $user_id, 'rich_editing', $rich_editing);
     183        update_usermeta( $user_id, 'admin_color', $admin_color);
    179184
    180185        if ( $update && isset($role) ) {
    181186                $user = new WP_User($user_id);
  • wp-includes/general-template.php

     
    11001100        return $r;
    11011101}
    11021102
     1103function wp_admin_css_color($key, $name, $url, $rtl_url = '') {
     1104        global $_wp_admin_css_colors;
     1105
     1106        if ( !isset($_wp_admin_css_colors) )
     1107                $_wp_admin_css_colors = array();
     1108
     1109        $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'rtl_url' => $rtl_url);
     1110}
     1111
    11031112function wp_admin_css_uri( $file = 'wp-admin' ) {
    1104         if ( defined('WP_INSTALLING') )
    1105         {
    1106                 $_file = add_query_arg( 'version', get_bloginfo( 'version' ), "./$file.css" );
     1113        if ( defined('WP_INSTALLING') ) {
     1114                $_file = "./$file.css";
    11071115        } else {
    1108                 $_file = add_query_arg( 'version', get_bloginfo( 'version' ), get_option( 'siteurl' ) . "/wp-admin/$file.css" );
     1116                if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
     1117                        $color = get_user_option('admin_color');
     1118                        if ( empty($color) )
     1119                                $color = 'classic';
     1120                        global $_wp_admin_css_colors;
     1121                        $color = $_wp_admin_css_colors[$color];
     1122                        if  ( 'css/colors-rtl' == $file )
     1123                                $_file = $color->rtl_url;
     1124                        else
     1125                                $_file = $color->url;
     1126                } else {
     1127                        $_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
     1128                }
    11091129        }
     1130        $_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
     1131
    11101132        return apply_filters( 'wp_admin_css_uri', $_file, $file );
    11111133}
    11121134
    11131135function wp_admin_css( $file = 'wp-admin' ) {
     1136       
    11141137        echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
    11151138        if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
    11161139                $rtl = ( 'wp-admin' == $file ) ? 'rtl' : "$file-rtl";
  • wp-admin/includes/user.php

     
    7373        else
    7474                $user->rich_editing = 'false';
    7575
     76        if ( !$update )
     77                $user->admin_color = 'classic';  // Default to classic for new users.
     78        else if ( isset( $_POST['admin_color'] ) )
     79                $user->admin_color = $_POST['admin_color'];
     80        else
     81                $user->admin_color = 'classic';
     82
    7683        $errors = new WP_Error();
    7784
    7885        /* checking that username has been typed */
  • wp-admin/admin-header.php

     
    2828<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    2929<title><?php bloginfo('name') ?> &rsaquo; <?php echo wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
    3030<?php
     31wp_admin_css_color('classic', __('Classic'), get_option( 'siteurl' ) . "/wp-admin/css/colors-classic.css");
     32wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . "/wp-admin/css/colors-fresh.css");
    3133wp_admin_css( 'css/global' );
    3234wp_admin_css();
    33 wp_admin_css( 'css/colors-classic' );
     35wp_admin_css( 'css/colors' );
    3436?>
    3537<!--[if gte IE 6]>
    3638<?php wp_admin_css( 'css/ie' );
  • wp-admin/user-edit.php

     
    146146
    147147<h3><?php _e('Personal Options'); ?></h3>
    148148
     149<table class="form-table">
    149150<?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
    150 <table class="form-table">
    151151        <tr>
    152                 <td colspan="2"><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></td>
     152                <th scope="row"><?php _e('Visual Editor')?></th>
     153                <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></td>
    153154        </tr>
     155<?php endif; ?>
     156<tr>
     157<th scope="row"><?php _e('Admin Color Scheme')?></th>
     158<td>
     159<?php
     160foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
     161<p><label>
     162<input name="admin_color" type="radio" value="<?php echo $color ?>" class="tog" <?php checked($color, get_user_option('admin_color')); ?> />
     163<?php echo $color_info->name ?>
     164</label>
     165</p>
     166<?php endforeach; ?>
     167</td>
    154168</table>
    155 <?php endif; ?>
    156169
     170
    157171<?php
    158172        if ( $is_profile_page ) {
    159173                do_action('profile_personal_options');
    160174        }
    161175?>
    162176
    163 <h3>Name</h3>
     177<h3><?php _e('Name') ?></h3>
    164178
    165179<table class="form-table">
    166180        <tr>
     
    232246</tr>
    233247</table>
    234248
    235 <h3>Contact Info</h3>
     249<h3><?php _e('Contact Info') ?></h3>
    236250
    237251<table class="form-table">
    238252<tr>