Make WordPress Core

Changeset 13487


Ignore:
Timestamp:
02/28/2010 06:34:31 AM (12 years ago)
Author:
dd32
Message:

Move Admin Colour Scheme picker to a hook. Props Jick. s/register_admin_color_themes()/register_admin_color_schemes/g. See #11625, Fixes #6837

Location:
trunk
Files:
4 edited

Legend:

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

    r13425 r13487  
    663663    @header( 'X-Content-Type-Options: nosniff' );
    664664}
     665/**
     666 * Display the default admin color scheme picker (Used in user-edit.php)
     667 *
     668 * @since 3.0
     669 */
     670function admin_color_scheme_picker() {
     671    global $_wp_admin_css_colors, $user_id; ?>
     672<fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
     673<?php
     674$current_color = get_user_option('admin_color', $user_id);
     675if ( empty($current_color) )
     676    $current_color = 'fresh';
     677foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
     678<div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo esc_attr($color) ?>" class="tog" <?php checked($color, $current_color); ?> />
     679    <table class="color-palette">
     680    <tr>
     681    <?php foreach ( $color_info->colors as $html_color ): ?>
     682    <td style="background-color: <?php echo $html_color ?>" title="<?php echo $color ?>">&nbsp;</td>
     683    <?php endforeach; ?>
     684    </tr>
     685    </table>
     686
     687    <label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
     688</div>
     689    <?php endforeach; ?>
     690</fieldset>
     691<?php
     692}
    665693?>
  • trunk/wp-admin/user-edit.php

    r13311 r13487  
    185185    </tr>
    186186<?php endif; ?>
    187 <?php if ( count($_wp_admin_css_colors) > 1 ) : ?>
     187<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
    188188<tr>
    189189<th scope="row"><?php _e('Admin Color Scheme')?></th>
    190 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
    191 <?php
    192 $current_color = get_user_option('admin_color', $user_id);
    193 if ( empty($current_color) )
    194     $current_color = 'fresh';
    195 foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
    196 <div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo esc_attr($color) ?>" class="tog" <?php checked($color, $current_color); ?> />
    197     <table class="color-palette">
    198     <tr>
    199     <?php foreach ( $color_info->colors as $html_color ): ?>
    200     <td style="background-color: <?php echo $html_color ?>" title="<?php echo $color ?>">&nbsp;</td>
    201     <?php endforeach; ?>
    202     </tr>
    203     </table>
    204 
    205     <label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
    206 </div>
    207     <?php endforeach; ?>
    208 </fieldset></td>
    209 </tr>
    210 <?php
    211 endif;
     190<td><?php do_action( 'admin_color_scheme_picker' ); ?></td>
     191</tr>
     192<?php
     193endif; // $_wp_admin_css_colors
    212194if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
    213195<tr>
  • trunk/wp-includes/default-filters.php

    r13467 r13487  
    239239add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
    240240
    241 // Admin Themes
    242 add_action('admin_init', 'register_admin_color_themes', 1);
     241// Admin Color Schemes
     242add_action( 'admin_init', 'register_admin_color_schemes', 1);
     243add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
  • trunk/wp-includes/general-template.php

    r13478 r13487  
    20302030
    20312031/**
    2032  * Registers the default Admin color themes
     2032 * Registers the default Admin color schemes
    20332033 *
    20342034 * @since 3.0.0
    20352035 */
    2036 function register_admin_color_themes() {
     2036function register_admin_color_schemes() {
    20372037    wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
    20382038    wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));}
Note: See TracChangeset for help on using the changeset viewer.