diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index fc231c4c3..77cd50900 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -1,15 +1,15 @@ admin_header_callback ) add_action("admin_head-$page", $this->admin_header_callback, 51); } /** - * Get the current step. + * Set up the enqueue for the CSS & JavaScript files. * - * @since unknown - * - * @return int Current step + * @since 3.0 */ - function step() { - if ( ! isset( $_GET['step'] ) ) - return 1; - - $step = (int) $_GET['step']; - if ( $step < 1 || 3 < $step ) - $step = 1; - - return $step; - } - - /** - * Set up the enqueue for the JavaScript files. - * - * @since unknown - */ - function js_includes() { - wp_enqueue_script('farbtastic'); - } - - /** - * Set up the enqueue for the CSS files - * - * @since unknown - */ - function css_includes() { + function admin_load() { + wp_enqueue_script('custom-background'); wp_enqueue_style('farbtastic'); } /** * Execute custom background modification. * - * @since unknown + * @since 3.0 */ function take_action() { - if ( ! current_user_can('switch_themes') ) - return; if ( empty($_POST) ) return; check_admin_referer('custom-background'); - if ( isset($_POST['reset-background']) ) + // @TODO: No UI entry point for this: + if ( isset($_POST['reset-background']) ) { remove_theme_mods(); + return; + } + if ( isset($_POST['remove-background']) ) { + // @TODO: Uploaded files are not removed here. + set_theme_mod('background_image', ''); + } + if ( isset($_POST['background-repeat']) ) { if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat')) ) $repeat = $_POST['background-repeat']; @@ -138,9 +118,7 @@ class Custom_Background { $attachment = 'fixed'; set_theme_mod('background_attachment', $attachment); } - if ( isset($_POST['remove-background']) ) - set_theme_mod('background_image', ''); - if ( isset( $_POST['background-color'] ) ) { + if ( isset($_POST['background-color']) ) { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('background_color', $color); @@ -152,78 +130,11 @@ class Custom_Background { } /** - * Execute Javascript depending on step. + * Display the custom background page. * - * @since unknown + * @since 3.0 */ - function js() { - $this->js_1(); - } - - /** - * Display Javascript based on Step 1. - * - * @since unknown - */ - function js_1() { ?> - -