'
',
'after_widget' => '',
'before_title' => '',
));
// This theme uses wp_nav_menu()
if ( function_exists('add_theme_support') )add_theme_support( 'nav-menus' );
// This theme uses wp_nav_menu() in one location.
if ( function_exists('register_nav_menus') ){
register_nav_menus( array(
'primary' => __('Primary Navigation','xpress'),
) );
}
function xpress_head() {
$head = "\n";
if ( '' != $output )
echo $head . $output . $foot;
}
add_action('wp_head', 'xpress_head');
function xpress_header_image() {
return apply_filters('xpress_header_image', get_option('xpress_header_image'));
}
function xpress_upper_color() {
if (strpos($url = xpress_header_image_url(), 'header-img.php?') !== false) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['upper'];
} else
return 'ffffff';
}
function xpress_lower_color() {
if (strpos($url = xpress_header_image_url(), 'header-img.php?') !== false) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['lower'];
} else
return 'ffffff';
}
function xpress_header_image_url() {
if ( $image = xpress_header_image() )
$url = get_template_directory_uri() . '/images/' . $image;
else
$url = get_template_directory_uri() . '/images/xpressheader.jpg';
return $url;
}
function xpress_header_color() {
return apply_filters('xpress_header_color', get_option('xpress_header_color'));
}
function xpress_header_color_string() {
$color = xpress_header_color();
if ( false === $color )
return 'black';
return $color;
}
function xpress_header_display() {
return apply_filters('xpress_header_display', get_option('xpress_header_display'));
}
function xpress_header_display_string() {
$display = xpress_header_display();
return $display ? $display : 'inline';
}
add_action('admin_menu', 'xpress_add_theme_page');
function xpress_add_theme_page() {
if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
check_admin_referer('xpress-header');
if ( isset($_REQUEST['njform']) ) {
if ( isset($_REQUEST['defaults']) ) {
delete_option('xpress_header_image');
delete_option('xpress_header_color');
delete_option('xpress_header_display');
} else {
if ( '' == $_REQUEST['njfontcolor'] )
delete_option('xpress_header_color');
else {
$fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
update_option('xpress_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('xpress_header_image', "header-img.php?upper=$uc&lower=$lc");
}
if ( isset($_REQUEST['toggledisplay']) ) {
if ( false === get_option('xpress_header_display') )
update_option('xpress_header_display', 'none');
else
delete_option('xpress_header_display');
}
}
} else {
if ( isset($_REQUEST['headerimage']) ) {
check_admin_referer('xpress-header');
if ( '' == $_REQUEST['headerimage'] )
delete_option('xpress_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('xpress_header_image', $headerimage);
}
}
if ( isset($_REQUEST['fontcolor']) ) {
check_admin_referer('xpress-header');
if ( '' == $_REQUEST['fontcolor'] )
delete_option('xpress_header_color');
else {
$fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
update_option('xpress_header_color', $fontcolor);
}
}
if ( isset($_REQUEST['fontdisplay']) ) {
check_admin_referer('xpress-header');
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('xpress_header_display');
else
update_option('xpress_header_display', 'none');
}
}
//print_r($_REQUEST);
wp_redirect("themes.php?page=functions.php&saved=true");
die;
}
add_action('admin_head', 'xpress_theme_page_head');
}
add_theme_page(__('Customize Header', 'xpress'), __('Header Image and Color', 'xpress'), 'edit_themes', basename(__FILE__), 'xpress_theme_page');
}
function xpress_theme_page_head() {
?>
'.__('Options saved.', 'xpress').'
';
?>