'
',
'after_widget' => '',
'before_title' => '',
));
}
/** @ignore */
function kubrick_head() {
$head = "\n";
if ( '' != $output )
echo $head . $output . $foot;
}
add_action('wp_head', 'kubrick_head');
function kubrick_header_image() {
return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
}
function kubrick_upper_color() {
if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['upper'];
} else
return '69aee7';
}
function kubrick_lower_color() {
if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['lower'];
} else
return '4180b6';
}
function kubrick_header_image_url() {
if ( $image = kubrick_header_image() )
$url = get_template_directory_uri() . '/images/' . $image;
else
$url = get_template_directory_uri() . '/images/kubrickheader.jpg';
return $url;
}
function kubrick_header_color() {
return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
}
function kubrick_header_color_string() {
$color = kubrick_header_color();
if ( false === $color )
return 'white';
return $color;
}
function kubrick_header_display() {
return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
}
function kubrick_header_display_string() {
$display = kubrick_header_display();
return $display ? $display : 'inline';
}
add_action('admin_menu', 'kubrick_add_theme_page');
function kubrick_add_theme_page() {
if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
check_admin_referer('kubrick-header');
if ( isset($_REQUEST['njform']) ) {
if ( isset($_REQUEST['defaults']) ) {
delete_option('kubrick_header_image');
delete_option('kubrick_header_color');
delete_option('kubrick_header_display');
} else {
if ( '' == $_REQUEST['njfontcolor'] )
delete_option('kubrick_header_color');
else {
$fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
update_option('kubrick_header_color', $fontcolor);
}
if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
}
if ( isset($_REQUEST['toggledisplay']) ) {
if ( false === get_option('kubrick_header_display') )
update_option('kubrick_header_display', 'none');
else
delete_option('kubrick_header_display');
}
}
} else {
if ( isset($_REQUEST['headerimage']) ) {
check_admin_referer('kubrick-header');
if ( '' == $_REQUEST['headerimage'] )
delete_option('kubrick_header_image');
else {
$headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']);
update_option('kubrick_header_image', $headerimage);
}
}
if ( isset($_REQUEST['fontcolor']) ) {
check_admin_referer('kubrick-header');
if ( '' == $_REQUEST['fontcolor'] )
delete_option('kubrick_header_color');
else {
$fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
update_option('kubrick_header_color', $fontcolor);
}
}
if ( isset($_REQUEST['fontdisplay']) ) {
check_admin_referer('kubrick-header');
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('kubrick_header_display');
else
update_option('kubrick_header_display', 'none');
}
}
//print_r($_REQUEST);
wp_redirect("themes.php?page=functions.php&saved=true");
die;
}
add_action('admin_head', 'kubrick_theme_page_head');
}
add_theme_page(__('Customize Header'), __('Header Image and Color'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
}
function kubrick_theme_page_head() {
?>
'.__('Options saved.').'
';
?>