From 2a77254f33c92dce3610dc77c0aceaf77855848a Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 19 Mar 2010 09:33:29 +0000 Subject: [PATCH] Show Background preview and options when no Image is uploaded. Display "Updated" div upon updates. Fix Colour Picker not loading after uploading a background image. See #12186 git-svn-id: https://develop.svn.wordpress.org/trunk@13765 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-background.php | 47 ++++++++++++---------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 01a0432e00..fc231c4c3d 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -89,10 +89,7 @@ class Custom_Background { * @since unknown */ function js_includes() { - $step = $this->step(); - - if ( 1 == $step ) - wp_enqueue_script('farbtastic'); + wp_enqueue_script('farbtastic'); } /** @@ -101,10 +98,7 @@ class Custom_Background { * @since unknown */ function css_includes() { - $step = $this->step(); - - if ( 1 == $step ) - wp_enqueue_style('farbtastic'); + wp_enqueue_style('farbtastic'); } /** @@ -153,6 +147,8 @@ class Custom_Background { else set_theme_mod('background_color', ''); } + + $this->updated = true; } /** @@ -161,9 +157,7 @@ class Custom_Background { * @since unknown */ function js() { - $step = $this->step(); - if ( 1 == $step ) - $this->js_1(); + $this->js_1(); } /** @@ -234,13 +228,11 @@ class Custom_Background {

- +updated) ) { ?>

Visit your site to see how it looks.'), home_url()); ?>

- +

admin_image_div_callback ) { @@ -256,13 +248,7 @@ if ( get_background_image() || get_background_color() ) { ?>
- -

- +

@@ -327,8 +313,6 @@ if ( get_background_image() ) : ?>

- -


@@ -363,7 +347,7 @@ if ( get_background_image() ) : ?> $file = wp_handle_upload($_FILES['import'], $overrides); if ( isset($file['error']) ) - die( $file['error'] ); + wp_die( $file['error'] ); $url = $file['url']; $type = $file['type']; @@ -372,10 +356,11 @@ if ( get_background_image() ) : ?> // Construct the object array $object = array( - 'post_title' => $filename, - 'post_content' => $url, - 'post_mime_type' => $type, - 'guid' => $url); + 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url + ); // Save the data $id = wp_insert_attachment($object, $file); @@ -385,6 +370,7 @@ if ( get_background_image() ) : ?> set_theme_mod('background_image', esc_url($url)); do_action('wp_create_file_in_uploads', $file, $id); // For replication + $this->updated = true; return $this->finished(); } @@ -394,8 +380,7 @@ if ( get_background_image() ) : ?> * @since unknown */ function finished() { - $_GET['updated'] = 1; - $this->step_1(); + $this->step_1(); } /**