__('Primary Navigation','xpress'),
) );
}
}
endif;
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '
',
'after_widget' => '',
'before_title' => '',
));
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');
if ( isset( $_REQUEST['action'] ) && 'update_footer' == $_REQUEST['action'] ) {
check_admin_referer('xpress-footer');
if ( isset($_REQUEST['xpress_footer_sidebars_count']) ) {
check_admin_referer('xpress-footer');
if ( '' == $_REQUEST['xpress_footer_sidebars_count'] || '0' == $_REQUEST['xpress_footer_sidebars_count'] ){
delete_option('xpress_footer_sidebars_count');
} else {
update_option('xpress_footer_sidebars_count', $_REQUEST['xpress_footer_sidebars_count']);
}
}
//print_r($_REQUEST);
wp_redirect("themes.php?page=functions.php&footer_saved=true");
die;
}
}
add_theme_page(__('Header & Footer', 'xpress'), __('Header & Footer', 'xpress'), 'edit_themes', basename(__FILE__), 'xpress_theme_header_page');
}
function xpress_theme_page_head() {
?>
'.__('Header Options saved.', 'xpress').'
';
if ( isset( $_REQUEST['footer_saved'] ) ) echo ''.__('Footer Options saved.', 'xpress').'
';
?>
$name,
'id' => 'footer-widget-area-'.$i,
'description' => $description,
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'footer_widgets_init' );
?>