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:
ryan 2006-01-05 01:47:22 +00:00
parent c26e1c0cc3
commit dd8e5a3aae
2 changed files with 13 additions and 8 deletions

View File

@ -25,16 +25,18 @@ function kubrick_header_image() {
}
function kubrick_upper_color() {
if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
return substr( kubrick_header_image(), 21, 6 );
else
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['upper'];
} else
return '69aee7';
}
function kubrick_lower_color() {
if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
return substr( kubrick_header_image(), 34, 6 );
else
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['lower'];
} else
return '4180b6';
}

View File

@ -8,11 +8,14 @@ if ( ! function_exists('imagecreatefromjpeg') )
// Assign and validate the color values
$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 ) {
if ( isset($_GET[$var]) ) {
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 )
$default = true;
}