Instead of fetching default header_textcolor manually, return null to do so automatically. Improve hex regex. git-svn-id: https://develop.svn.wordpress.org/trunk@20910 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9aef6b843b
commit
4f72da87c9
|
@ -846,10 +846,7 @@ final class WP_Customize_Manager {
|
||||||
|
|
||||||
// Callback function for sanitizing the header textcolor setting.
|
// Callback function for sanitizing the header textcolor setting.
|
||||||
function sanitize_header_textcolor( $color ) {
|
function sanitize_header_textcolor( $color ) {
|
||||||
if ( empty( $color ) )
|
if ( $color == 'blank' )
|
||||||
return get_theme_support( 'custom-header', 'default-text-color' );
|
|
||||||
|
|
||||||
elseif ( $color == 'blank' )
|
|
||||||
return 'blank';
|
return 'blank';
|
||||||
|
|
||||||
return sanitize_hexcolor( $color );
|
return sanitize_hexcolor( $color );
|
||||||
|
@ -859,8 +856,9 @@ function sanitize_header_textcolor( $color ) {
|
||||||
function sanitize_hexcolor( $color ) {
|
function sanitize_hexcolor( $color ) {
|
||||||
$color = preg_replace( '/[^0-9a-fA-F]/', '', $color );
|
$color = preg_replace( '/[^0-9a-fA-F]/', '', $color );
|
||||||
|
|
||||||
if ( preg_match('|[A-Fa-f0-9]{3,6}|', $color ) )
|
// 3 or 6 hex digits.
|
||||||
|
if ( preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', $color ) )
|
||||||
return $color;
|
return $color;
|
||||||
|
|
||||||
return $color;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue