From 0a6a9c2a8ceda2889a2f769c112512a4c94fdd7d Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 21 Mar 2012 19:10:13 +0000 Subject: [PATCH] Use display_header_text() in custom-header.php. Rework the UI to be a 'Show header text' checkbox (rather than radio buttons). Remove lame 'blank' hack for no-JS -- checkboxes work without JS. Move 'Select a Color' to a link like it is for custom background. Nearby code cleanup. see #18887. git-svn-id: https://develop.svn.wordpress.org/trunk@20241 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-header.php | 146 +++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 78 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 291986e751..5a81102e24 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -208,16 +208,17 @@ class Custom_Image_Header { return; } - if ( isset( $_POST['text-color'] ) ) { + if ( ! isset( $_POST['display-header-text'] ) ) { + check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); + set_theme_mod( 'header_textcolor', 'blank' ); + } elseif ( isset( $_POST['text-color'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); - if ( 'blank' == $_POST['text-color'] ) { + $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); + if ( strlen($color) == 6 || strlen($color) == 3 ) + set_theme_mod('header_textcolor', $color); + elseif ( ! $color ) set_theme_mod( 'header_textcolor', 'blank' ); - } else { - $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); - if ( strlen($color) == 6 || strlen($color) == 3 ) - set_theme_mod('header_textcolor', $color); - } } if ( isset( $_POST['default-header'] ) ) { @@ -329,86 +330,75 @@ class Custom_Image_Header { function js_1() { ?> +

+ @@ -519,14 +511,13 @@ class Custom_Image_Header { ?>
-

onclick="return false;" href="">

-
>
+

onclick="return false;" href="">

+
>
@@ -618,33 +609,32 @@ class Custom_Image_Header {
- + + + +

+ - - + + - + @@ -662,7 +652,7 @@ class Custom_Image_Header {

- - - +

+ - #blank as text color.' );?> - + + + +

-