<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13307] trunk/wp-admin/custom-background.php: Grammar fix.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13307">13307</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-22 20:15:06 +0000 (Mon, 22 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Grammar fix. Don't show empty img.  Cleanup POST handler. see <a href="http://trac.wordpress.org/ticket/12186">#12186</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincustombackgroundphp">trunk/wp-admin/custom-background.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincustombackgroundphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/custom-background.php (13306 => 13307)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/custom-background.php        2010-02-22 19:48:38 UTC (rev 13306)
+++ trunk/wp-admin/custom-background.php        2010-02-22 20:15:06 UTC (rev 13307)
</span><span class="lines">@@ -89,12 +89,14 @@
</span><span class="cx">                 if ( ! current_user_can('switch_themes') )
</span><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                if ( isset($_POST['reset-background']) ) {
-                        check_admin_referer('custom-background');
</del><ins>+                if ( empty($_POST) )
+                        return;
+
+                check_admin_referer('custom-background');
+
+                if ( isset($_POST['reset-background']) )
</ins><span class="cx">                         remove_theme_mods();
</span><del>-                }
</del><span class="cx">                 if ( isset($_POST['background-repeat']) ) {
</span><del>-                        check_admin_referer('custom-background');
</del><span class="cx">                         if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat')) )
</span><span class="cx">                                 $repeat = $_POST['background-repeat'];
</span><span class="cx">                         else
</span><span class="lines">@@ -102,7 +104,6 @@
</span><span class="cx">                         set_theme_mod('background_repeat', $repeat);
</span><span class="cx">                 }
</span><span class="cx">                 if ( isset($_POST['background-position']) ) {
</span><del>-                        check_admin_referer('custom-background');
</del><span class="cx">                         if ( in_array($_POST['background-position'], array('center', 'right', 'left')) )
</span><span class="cx">                                 $position = $_POST['background-position'];
</span><span class="cx">                         else
</span><span class="lines">@@ -110,17 +111,14 @@
</span><span class="cx">                         set_theme_mod('background_position', $position);
</span><span class="cx">                 }
</span><span class="cx">                 if ( isset($_POST['background-attachment']) ) {
</span><del>-                        check_admin_referer('custom-background');
</del><span class="cx">                         if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
</span><span class="cx">                                 $attachment = $_POST['background-attachment'];
</span><span class="cx">                         else
</span><span class="cx">                                 $attachment = 'fixed';
</span><span class="cx">                         set_theme_mod('background_attachment', $attachment);
</span><span class="cx">                 }
</span><del>-                if ( isset($_POST['remove-background']) ) {
-                        check_admin_referer('custom-background');
</del><ins>+                if ( isset($_POST['remove-background']) )
</ins><span class="cx">                         set_theme_mod('background_image', '');
</span><del>-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -141,20 +139,19 @@
</span><span class="cx"> &lt;?php if ( get_background_image() ) { ?&gt;
</span><span class="cx"> &lt;p&gt;&lt;?php _e('This is your current background image.'); ?&gt;&lt;/p&gt;
</span><span class="cx"> &lt;?php
</span><del>-} else { ?&gt;
-&lt;p&gt;&lt;?php _e('There is currently no background image.'); ?&gt;&lt;/p&gt; &lt;?php
-}
-
-if ( $this-&gt;admin_image_div_callback ) {
-  call_user_func($this-&gt;admin_image_div_callback);
-} else {
</del><ins>+        if ( $this-&gt;admin_image_div_callback ) {
+                call_user_func($this-&gt;admin_image_div_callback);
+        } else {
</ins><span class="cx"> ?&gt;
</span><span class="cx"> &lt;div id=&quot;custom-background-image&quot;&gt;
</span><span class="cx"> &lt;img class=&quot;custom-background-image&quot; src=&quot;&lt;?php background_image(); ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;/div&gt;
</span><del>-&lt;?php } ?&gt;
</del><ins>+&lt;?php }
+} else { ?&gt;
+&lt;p&gt;&lt;?php _e('There is currently no background image.'); ?&gt;&lt;/p&gt; &lt;?php
+}
</ins><span class="cx"> 
</span><del>-&lt;?php if ( get_background_image() ) : ?&gt;
</del><ins>+if ( get_background_image() ) : ?&gt;
</ins><span class="cx">         
</span><span class="cx"> &lt;h2&gt;&lt;?php _e('Change Display Options') ?&gt;&lt;/h2&gt;
</span><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo esc_attr(add_query_arg('step', 1)) ?&gt;&quot;&gt;
</span><span class="lines">@@ -226,7 +223,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php if ( get_background_image() ) : ?&gt;
</span><span class="cx"> &lt;h2&gt;&lt;?php _e('Remove Background Image'); ?&gt;&lt;/h2&gt;
</span><del>-&lt;p&gt;&lt;?php _e('This will remove background image. You will not be able to retrieve any customizations.') ?&gt;&lt;/p&gt;
</del><ins>+&lt;p&gt;&lt;?php _e('This will remove the background image. You will not be able to retrieve any customizations.') ?&gt;&lt;/p&gt;
</ins><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo esc_attr(add_query_arg('step', 1)) ?&gt;&quot;&gt;
</span><span class="cx"> &lt;?php wp_nonce_field('custom-background'); ?&gt;
</span><span class="cx"> &lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;remove-background&quot; value=&quot;&lt;?php esc_attr_e('Remove Background'); ?&gt;&quot; /&gt;
</span></span></pre>
</div>
</div>

</body>
</html>