WordPress.org

Make WordPress Core

Changeset 3399


Ignore:
Timestamp:
01/05/2006 01:47:22 AM (15 years ago)
Author:
ryan
Message:

Default theme header color provisioning tweaks. fixes #2219

Location:
trunk/wp-content/themes/default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/default/functions.php

    r3276 r3399  
    2626
    2727function kubrick_upper_color() {
    28     if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
    29         return substr( kubrick_header_image(), 21, 6 );
    30     else
     28    if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
     29        parse_str(substr($url, strpos($url, '?') + 1), $q);
     30        return $q['upper'];
     31    } else
    3132        return '69aee7';
    3233}
    3334
    3435function kubrick_lower_color() {
    35     if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) )
    36         return substr( kubrick_header_image(), 34, 6 );
    37     else
     36    if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
     37        parse_str(substr($url, strpos($url, '?') + 1), $q);
     38        return $q['lower'];
     39    } else
    3840        return '4180b6';
    3941}
  • trunk/wp-content/themes/default/images/header-img.php

    r3276 r3399  
    99// Assign and validate the color values
    1010$default = false;
    11 $vars = array('upper'=>array(0=>'r1', 2=>'g1', 4=>'b1'), 'lower'=>array(0=>'r2', 2=>'g2', 4=>'b2'));
     11$vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2'));
    1212foreach ( $vars as $var => $subvars ) {
    1313    if ( isset($_GET[$var]) ) {
    1414        foreach ( $subvars as $index => $subvar ) {
    15             $$subvar = hexdec( substr($_GET[$var], $index, 2) );
     15            $length = strlen($_GET[$var]) / 3;
     16            $v = substr($_GET[$var], $index * $length, $length);
     17            if ( $length == 1 ) $v = '' . $v . $v;
     18            $$subvar = hexdec( $v );
    1619            if ( $$subvar < 0 || $$subvar > 255 )
    1720                $default = true;
Note: See TracChangeset for help on using the changeset viewer.