From 369fca15092cad1c26633e021a6bc84651b3297c Mon Sep 17 00:00:00 2001 From: nacin Date: Tue, 20 Mar 2012 20:34:49 +0000 Subject: [PATCH] In new add_theme_support() logic, fix logic inversion, define HEADER_IMAGE in a simpler way, and force args to be an array. see #20249. git-svn-id: http://svn.automattic.com/wordpress/trunk@20221 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index ec722faa04..1026151dff 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1283,6 +1283,9 @@ function add_theme_support( $feature ) { break; case 'custom-header' : + if ( ! is_array( $args ) ) + $args = array( 0 => array() ); + $defaults = array( 'default-image' => '', 'random-default' => false, @@ -1329,7 +1332,7 @@ function add_theme_support( $feature ) { if ( defined( 'HEADER_IMAGE_HEIGHT' ) ) $args[0]['height'] = (int) HEADER_IMAGE_HEIGHT; - elseif ( ! isset( $args[0]['height'] ) ) + elseif ( isset( $args[0]['height'] ) ) define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] ); if ( defined( 'HEADER_TEXTCOLOR' ) ) @@ -1339,13 +1342,12 @@ function add_theme_support( $feature ) { if ( defined( 'HEADER_IMAGE' ) ) $args[0]['default-image'] = HEADER_IMAGE; + elseif ( isset( $args[0]['default-image'] ) ) + define( 'HEADER_IMAGE', $args[0]['default-image'] ); if ( $jit && ! empty( $args[0]['default-image'] ) ) $args[0]['random-default'] = false; - if ( ! defined( 'HEADER_IMAGE' ) && ( isset( $args[0]['default-image'] ) || isset( $args[0]['random-default'] ) ) ) - define( 'HEADER_IMAGE', $args[0]['default-image'] ); - // If headers are supported, and we still don't have a defined width or height, // we have implicit flex sizes. if ( $jit ) { @@ -1358,6 +1360,9 @@ function add_theme_support( $feature ) { break; case 'custom-background' : + if ( ! is_array( $args ) ) + $args = array( 0 => array() ); + $defaults = array( 'default-image' => '', 'default-color' => '',