WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2012 06:44:31 PM (9 years ago)
Author:
koopersmith
Message:

Theme Customizer: Ensure that JS color controls always use real color values, even if the server-side value is a hex value without a hash. fixes #20448, see #19910.

Adds WP_Customize_Setting->sanitize_js_callback and 'customize_sanitize_js_$settingID' filter, to filter values before they're passed to JS using WP_Customize_Setting->js_value().

Adds support for regular hex colors to the color picker.

Changes color methods:

  • sanitize_hex_color() accepts 3 and 6 digit hex colors (with hashes) and the empty string.
  • sanitize_hex_color_no_hash() accepts 3 and 6 digit hex colors (without hashes) and the empty string.
  • maybe_hash_hex_color() ensures that a hex color has a hash, and otherwise leaves the value untouched.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-control.php

    r20928 r20936  
    266266                    <div class="dropdown-arrow"></div>
    267267                </div>
    268                 <div class="color-picker-hex">
    269                     <span>#</span>
    270                     <input type="text" <?php $this->link(); ?> />
    271                 </div>
     268                <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e('Hex Value'); ?>" />
    272269            </div>
    273270            <div class="farbtastic-placeholder"></div>
Note: See TracChangeset for help on using the changeset viewer.