diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index c0e8c54bb..31701dfc8 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -1,12 +1,45 @@ admin_header_callback = $admin_header_callback; } + /** + * Setup the hooks for the Custom Header admin page. + * + * @since unknown + */ function init() { $page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page')); @@ -16,21 +49,43 @@ class Custom_Image_Header { add_action("admin_head-$page", $this->admin_header_callback, 51); } + /** + * Get the current step. + * + * @since unknown + * + * @return int Current step + */ function step() { - $step = (int) @$_GET['step']; + if ( ! isset( $_GET['step'] ) ) + return 1; + + $step = (int) $_GET['step']; if ( $step < 1 || 3 < $step ) $step = 1; + return $step; } + /** + * Setup the enqueue for the JavaScript files. + * + * @since unknown + */ function js_includes() { $step = $this->step(); + if ( 1 == $step ) wp_enqueue_script('colorpicker'); elseif ( 2 == $step ) wp_enqueue_script('cropper'); } + /** + * Execute custom header modification. + * + * @since unknown + */ function take_action() { if ( isset( $_POST['textcolor'] ) ) { check_admin_referer('custom-header'); @@ -48,6 +103,11 @@ class Custom_Image_Header { } } + /** + * Execute Javascript depending on step. + * + * @since unknown + */ function js() { $step = $this->step(); if ( 1 == $step ) @@ -56,6 +116,11 @@ class Custom_Image_Header { $this->js_2(); } + /** + * Display Javascript based on Step 1. + * + * @since unknown + */ function js_1() { ?>