Default theme header color provisioning tweaks. fixes #2219
git-svn-id: http://svn.automattic.com/wordpress/trunk@3399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c26e1c0cc3
commit
dd8e5a3aae
|
@ -25,16 +25,18 @@ function kubrick_header_image() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_upper_color() {
|
function kubrick_upper_color() {
|
||||||
if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
|
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||||
return substr( kubrick_header_image(), 21, 6 );
|
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||||
else
|
return $q['upper'];
|
||||||
|
} else
|
||||||
return '69aee7';
|
return '69aee7';
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_lower_color() {
|
function kubrick_lower_color() {
|
||||||
if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
|
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||||
return substr( kubrick_header_image(), 34, 6 );
|
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||||
else
|
return $q['lower'];
|
||||||
|
} else
|
||||||
return '4180b6';
|
return '4180b6';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,14 @@ if ( ! function_exists('imagecreatefromjpeg') )
|
||||||
|
|
||||||
// Assign and validate the color values
|
// Assign and validate the color values
|
||||||
$default = false;
|
$default = false;
|
||||||
$vars = array('upper'=>array(0=>'r1', 2=>'g1', 4=>'b1'), 'lower'=>array(0=>'r2', 2=>'g2', 4=>'b2'));
|
$vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2'));
|
||||||
foreach ( $vars as $var => $subvars ) {
|
foreach ( $vars as $var => $subvars ) {
|
||||||
if ( isset($_GET[$var]) ) {
|
if ( isset($_GET[$var]) ) {
|
||||||
foreach ( $subvars as $index => $subvar ) {
|
foreach ( $subvars as $index => $subvar ) {
|
||||||
$$subvar = hexdec( substr($_GET[$var], $index, 2) );
|
$length = strlen($_GET[$var]) / 3;
|
||||||
|
$v = substr($_GET[$var], $index * $length, $length);
|
||||||
|
if ( $length == 1 ) $v = '' . $v . $v;
|
||||||
|
$$subvar = hexdec( $v );
|
||||||
if ( $$subvar < 0 || $$subvar > 255 )
|
if ( $$subvar < 0 || $$subvar > 255 )
|
||||||
$default = true;
|
$default = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue