diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index c5e5d20e0a..c54d9a9241 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -11,17 +11,27 @@ class Custom_Image_Header { $page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page')); add_action("admin_print_scripts-$page", array(&$this, 'js_includes')); + add_action("admin_head-$page", array(&$this, 'take_action'), 50); add_action("admin_head-$page", array(&$this, 'js'), 50); add_action("admin_head-$page", $this->admin_header_callback, 51); } - function js_includes() { - wp_enqueue_script('cropper'); - wp_enqueue_script('colorpicker'); + function step() { + $step = (int) @$_GET['step']; + if ( $step < 1 || 3 < $step ) + $step = 1; + return $step; } - function js() { + function js_includes() { + $step = $this->step(); + if ( 1 == $step ) + wp_enqueue_script('colorpicker'); + elseif ( 2 == $step ) + wp_enqueue_script('cropper'); + } + function take_action() { if ( isset( $_POST['textcolor'] ) ) { check_admin_referer('custom-header'); if ( 'blank' == $_POST['textcolor'] ) { @@ -36,48 +46,18 @@ class Custom_Image_Header { check_admin_referer('custom-header'); remove_theme_mods(); } - ?> - +
@@ -252,7 +276,7 @@ Event.observe( window, 'load', hide_text );

-
+
@@ -327,19 +351,13 @@ Event.observe( window, 'load', hide_text ); } function admin_page() { - if ( !isset( $_GET['step'] ) ) - $step = 1; - else - $step = (int) $_GET['step']; - - if ( 1 == $step ) { + $step = $this->step(); + if ( 1 == $step ) $this->step_1(); - } elseif ( 2 == $step ) { + elseif ( 2 == $step ) $this->step_2(); - } elseif ( 3 == $step ) { + elseif ( 3 == $step ) $this->step_3(); - } - } } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 0daeece70b..b114447a14 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -27,7 +27,7 @@ class WP_Scripts { 'enterImageDescription' => __('Enter a description of the image') ) ); - $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); + $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' ); // Let a plugin replace the visual editor $visual_editor = apply_filters('visual_editor', array('tiny_mce'));