<!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->admin_header_callback = $admin_header_callback;
</span><ins>+                $this->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'] ) { ?>
</del><ins>+                if ( isset($_GET['updated']) && $_GET['updated'] ) { ?>
</ins><span class="cx"> <div id="message" class="updated">
</span><del>-<p><?php _e('Header updated.') ?></p>
</del><ins>+<p><?php printf(__('Header updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url()); ?></p>
</ins><span class="cx"> </div>
</span><span class="cx">                 <?php } ?>
</span><span class="cx">
</span><span class="lines">@@ -277,11 +288,18 @@
</span><span class="cx"> <?php screen_icon(); ?>
</span><span class="cx"> <h2><?php _e('Your Header Image'); ?></h2>
</span><span class="cx"> <p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
</span><ins>+<?php
</ins><span class="cx">
</span><ins>+if ( $this->admin_image_div_callback ) {
+ call_user_func($this->admin_image_div_callback);
+} else {
+?>
</ins><span class="cx"> <div id="headimg" style="background-image: url(<?php esc_url(header_image()) ?>);">
</span><span class="cx"> <h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
</span><span class="cx"> <div id="desc"><?php bloginfo('description');?></div>
</span><span class="cx"> </div>
</span><ins>+<?php } ?>
+
</ins><span class="cx"> <?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
</span><span class="cx"> <form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
</span><span class="cx"> <input type="button" class="button" value="<?php esc_attr_e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
</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>-                ?>
-<div class="wrap">
-<h2><?php _e('Header complete!'); ?></h2>
-
-<p><?php _e('Visit your site and you should see the new header now.'); ?></p>
-
-</div>
-                <?php
</del><ins>+                $_GET['updated'] = 1;
+         $this->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'] =& new Custom_Image_Header($admin_header_callback);
</del><ins>+        $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback, $admin_image_div_callback);
</ins><span class="cx">         add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init'));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>