<!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>[12890] trunk:
  Send user back to main custom header page after cropping and setting image
 .</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12890">12890</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-28 19:00:16 +0000 (Thu, 28 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Send user back to main custom header page after cropping and setting image. Add support for a custom image div callback for greather theme flexibility. Props dphiffer. see <a href="http://trac.wordpress.org/ticket/11855">#11855</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincustomheaderphp">trunk/wp-admin/custom-header.php</a></li>
<li><a href="#trunkwpincludesthemephp">trunk/wp-includes/theme.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincustomheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/custom-header.php (12889 => 12890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/custom-header.php        2010-01-28 17:30:50 UTC (rev 12889)
+++ trunk/wp-admin/custom-header.php        2010-01-28 19:00:16 UTC (rev 12890)
</span><span class="lines">@@ -25,14 +25,25 @@
</span><span class="cx">         var $admin_header_callback;
</span><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * Callback for header div.
+         *
+         * @var callback
+         * @since unknown
+         * @access private
+         */
+        var $admin_image_div_callback;
+
+        /**
</ins><span class="cx">          * PHP4 Constructor - Register administration header callback.
</span><span class="cx">          *
</span><span class="cx">          * @since unknown
</span><span class="cx">          * @param callback $admin_header_callback
</span><ins>+         * @param callback $admin_image_div_callback Optional custom image div output callback.
</ins><span class="cx">          * @return Custom_Image_Header
</span><span class="cx">          */
</span><del>-        function Custom_Image_Header($admin_header_callback) {
</del><ins>+        function Custom_Image_Header($admin_header_callback, $admin_image_div_callback = '') {
</ins><span class="cx">                 $this-&gt;admin_header_callback = $admin_header_callback;
</span><ins>+                $this-&gt;admin_image_div_callback = $admin_image_div_callback;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -267,9 +278,9 @@
</span><span class="cx">          * @since unknown
</span><span class="cx">          */
</span><span class="cx">         function step_1() {
</span><del>-                if ( $_GET['updated'] ) { ?&gt;
</del><ins>+                if ( isset($_GET['updated']) &amp;&amp; $_GET['updated'] ) { ?&gt;
</ins><span class="cx"> &lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;
</span><del>-&lt;p&gt;&lt;?php _e('Header updated.') ?&gt;&lt;/p&gt;
</del><ins>+&lt;p&gt;&lt;?php printf(__('Header updated. &lt;a href=&quot;%s&quot;&gt;Visit your site&lt;/a&gt; to see how it looks.'), home_url()); ?&gt;&lt;/p&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx">                 &lt;?php } ?&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -277,11 +288,18 @@
</span><span class="cx"> &lt;?php screen_icon(); ?&gt;
</span><span class="cx"> &lt;h2&gt;&lt;?php _e('Your Header Image'); ?&gt;&lt;/h2&gt;
</span><span class="cx"> &lt;p&gt;&lt;?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?&gt;&lt;/p&gt;
</span><ins>+&lt;?php
</ins><span class="cx"> 
</span><ins>+if ( $this-&gt;admin_image_div_callback ) {
+  call_user_func($this-&gt;admin_image_div_callback);
+} else {
+?&gt;
</ins><span class="cx"> &lt;div id=&quot;headimg&quot; style=&quot;background-image: url(&lt;?php esc_url(header_image()) ?&gt;);&quot;&gt;
</span><span class="cx"> &lt;h1&gt;&lt;a onclick=&quot;return false;&quot; href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot; title=&quot;&lt;?php bloginfo('name'); ?&gt;&quot; id=&quot;name&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
</span><span class="cx"> &lt;div id=&quot;desc&quot;&gt;&lt;?php bloginfo('description');?&gt;&lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><ins>+&lt;?php } ?&gt;
+
</ins><span class="cx"> &lt;?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?&gt;
</span><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('themes.php?page=custom-header&amp;amp;updated=true') ?&gt;&quot;&gt;
</span><span class="cx"> &lt;input type=&quot;button&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e('Hide Text'); ?&gt;&quot; onclick=&quot;hide_text()&quot; id=&quot;hidetext&quot; /&gt;
</span><span class="lines">@@ -455,14 +473,8 @@
</span><span class="cx">          * @since unknown
</span><span class="cx">          */
</span><span class="cx">         function finished() {
</span><del>-                ?&gt;
-&lt;div class=&quot;wrap&quot;&gt;
-&lt;h2&gt;&lt;?php _e('Header complete!'); ?&gt;&lt;/h2&gt;
-
-&lt;p&gt;&lt;?php _e('Visit your site and you should see the new header now.'); ?&gt;&lt;/p&gt;
-
-&lt;/div&gt;
-                &lt;?php
</del><ins>+                $_GET['updated'] = 1;
+          $this-&gt;step_1();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span></span></pre></div>
<a id="trunkwpincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/theme.php (12889 => 12890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/theme.php        2010-01-28 17:30:50 UTC (rev 12889)
+++ trunk/wp-includes/theme.php        2010-01-28 19:00:16 UTC (rev 12890)
</span><span class="lines">@@ -1298,16 +1298,17 @@
</span><span class="cx">  * @uses Custom_Image_Header Sets up for $admin_header_callback for administration panel display.
</span><span class="cx">  *
</span><span class="cx">  * @param callback $header_callback Call on 'wp_head' action.
</span><del>- * @param callback $admin_header_callback Call on administration panels.
</del><ins>+ * @param callback $admin_header_callback Call on custom header administration screen.
+ * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional.
</ins><span class="cx">  */
</span><del>-function add_custom_image_header($header_callback, $admin_header_callback) {
</del><ins>+function add_custom_image_header($header_callback, $admin_header_callback, $admin_image_div_callback = '') {
</ins><span class="cx">         if ( ! empty($header_callback) )
</span><span class="cx">                 add_action('wp_head', $header_callback);
</span><span class="cx"> 
</span><span class="cx">         if ( ! is_admin() )
</span><span class="cx">                 return;
</span><span class="cx">         require_once(ABSPATH . 'wp-admin/custom-header.php');
</span><del>-        $GLOBALS['custom_image_header'] =&amp; new Custom_Image_Header($admin_header_callback);
</del><ins>+        $GLOBALS['custom_image_header'] =&amp; new Custom_Image_Header($admin_header_callback, $admin_image_div_callback);
</ins><span class="cx">         add_action('admin_menu', array(&amp;$GLOBALS['custom_image_header'], 'init'));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>