WordPress.org

Make WordPress Core

Changeset 7249


Ignore:
Timestamp:
03/11/2008 09:06:03 PM (10 years ago)
Author:
ryan
Message:

Admin color selector. see #6167

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r7230 r7249  
    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", array('#07273E', '#14568A', '#D54E21', '#2683AE'));
     32wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . "/wp-admin/css/colors-fresh.css", array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
    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]>
  • trunk/wp-admin/includes/user.php

    r7130 r7249  
    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
  • trunk/wp-admin/user-edit.php

    r7246 r7249  
    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>
    154 </table>
    155 <?php endif; ?>
     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<table>
     166<tr>
     167<?php
     168foreach ( $color_info->colors as $color ): ?>
     169<td style="background-color: <?php echo $color ?>" title="<?php echo $color ?>"></td>
     170<?php endforeach; ?>
     171</tr>
     172</table>
     173</p>
     174<?php endforeach; ?>
     175</td>
     176</table>
     177
    156178
    157179<?php
  • trunk/wp-includes/general-template.php

    r7130 r7249  
    11011101}
    11021102
     1103function wp_admin_css_color($key, $name, $url, $colors = array()) {
     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, 'colors' => $colors);
     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" );
    1109     }
     1116        if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
     1117            global $_wp_admin_css_colors;
     1118            $color = get_user_option('admin_color');
     1119            if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
     1120                $color = 'classic';
     1121            $color = $_wp_admin_css_colors[$color];
     1122            $_file = $color->url;
     1123        } else {
     1124            $_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
     1125        }
     1126    }
     1127    $_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
     1128
    11101129    return apply_filters( 'wp_admin_css_uri', $_file, $file );
    11111130}
    11121131
    11131132function wp_admin_css( $file = 'wp-admin' ) {
     1133
    11141134    echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
    11151135    if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
  • trunk/wp-includes/registration.php

    r6656 r7249  
    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');
     
    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) ) {
Note: See TracChangeset for help on using the changeset viewer.