From 05edcb0c450395bcd44f3f9f81c86fbe8f0e5158 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 22 Feb 2010 20:15:06 +0000 Subject: [PATCH] Grammar fix. Don't show empty img. Cleanup POST handler. see #12186 git-svn-id: http://svn.automattic.com/wordpress/trunk@13307 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/custom-background.php | 35 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index b168268619..3547a02696 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -89,12 +89,14 @@ class Custom_Background { if ( ! current_user_can('switch_themes') ) return; - if ( isset($_POST['reset-background']) ) { - check_admin_referer('custom-background'); + if ( empty($_POST) ) + return; + + check_admin_referer('custom-background'); + + if ( isset($_POST['reset-background']) ) remove_theme_mods(); - } if ( isset($_POST['background-repeat']) ) { - check_admin_referer('custom-background'); if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat')) ) $repeat = $_POST['background-repeat']; else @@ -102,7 +104,6 @@ class Custom_Background { set_theme_mod('background_repeat', $repeat); } if ( isset($_POST['background-position']) ) { - check_admin_referer('custom-background'); if ( in_array($_POST['background-position'], array('center', 'right', 'left')) ) $position = $_POST['background-position']; else @@ -110,17 +111,14 @@ class Custom_Background { set_theme_mod('background_position', $position); } if ( isset($_POST['background-attachment']) ) { - check_admin_referer('custom-background'); if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) $attachment = $_POST['background-attachment']; else $attachment = 'fixed'; set_theme_mod('background_attachment', $attachment); } - if ( isset($_POST['remove-background']) ) { - check_admin_referer('custom-background'); + if ( isset($_POST['remove-background']) ) set_theme_mod('background_image', ''); - } } /** @@ -141,20 +139,19 @@ class Custom_Background {

-

admin_image_div_callback ) { - call_user_func($this->admin_image_div_callback); -} else { + if ( $this->admin_image_div_callback ) { + call_user_func($this->admin_image_div_callback); + } else { ?>
- + +

+if ( get_background_image() ) : ?>

@@ -226,7 +223,7 @@ if ( $this->admin_image_div_callback ) {

-

+