From 93fc30b2a0a76642b8c9a0f9d9168dee6d2db1b7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 28 Jan 2010 19:00:16 +0000 Subject: [PATCH] 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 #11855 git-svn-id: https://develop.svn.wordpress.org/trunk@12890 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-header.php | 34 +++++++++++++++++++++++----------- wp-includes/theme.php | 7 ++++--- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index c28934975b..223cabbaf2 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -24,15 +24,26 @@ class Custom_Image_Header { */ var $admin_header_callback; + /** + * Callback for header div. + * + * @var callback + * @since unknown + * @access private + */ + var $admin_image_div_callback; + /** * PHP4 Constructor - Register administration header callback. * * @since unknown * @param callback $admin_header_callback + * @param callback $admin_image_div_callback Optional custom image div output callback. * @return Custom_Image_Header */ - function Custom_Image_Header($admin_header_callback) { + function Custom_Image_Header($admin_header_callback, $admin_image_div_callback = '') { $this->admin_header_callback = $admin_header_callback; + $this->admin_image_div_callback = $admin_image_div_callback; } /** @@ -267,9 +278,9 @@ class Custom_Image_Header { * @since unknown */ function step_1() { - if ( $_GET['updated'] ) { ?> + if ( isset($_GET['updated']) && $_GET['updated'] ) { ?>
-

+

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

@@ -277,11 +288,18 @@ class Custom_Image_Header {

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

+ +
@@ -455,14 +473,8 @@ class Custom_Image_Header { * @since unknown */ function finished() { - ?> -
-

- -

- -
- step_1(); } /** diff --git a/wp-includes/theme.php b/wp-includes/theme.php index ad968bae6a..e44941a6c1 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1298,16 +1298,17 @@ function header_image() { * @uses Custom_Image_Header Sets up for $admin_header_callback for administration panel display. * * @param callback $header_callback Call on 'wp_head' action. - * @param callback $admin_header_callback Call on administration panels. + * @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. */ -function add_custom_image_header($header_callback, $admin_header_callback) { +function add_custom_image_header($header_callback, $admin_header_callback, $admin_image_div_callback = '') { if ( ! empty($header_callback) ) add_action('wp_head', $header_callback); if ( ! is_admin() ) return; require_once(ABSPATH . 'wp-admin/custom-header.php'); - $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback); + $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback, $admin_image_div_callback); add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init')); }