\n\n"; if ( '' != $output ) echo $head . $output . $foot; } add_action('wp_head', 'kubrick_head'); function kubrick_header_image() { return apply_filters('kubrick_header_image', get_settings('kubrick_header_image')); } function kubrick_upper_color() { if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) ) return substr( kubrick_header_image(), 21, 6 ); else return '69aee7'; } function kubrick_lower_color() { if ( strstr( kubrick_header_image_url(), 'header-img.php?' ) ) return substr( kubrick_header_image(), 34, 6 ); 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_settings('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_settings('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 ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { 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 update_option('kubrick_header_color', $_REQUEST['njfontcolor']); 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_settings('kubrick_header_display') ) update_option('kubrick_header_display', 'none'); else delete_option('kubrick_header_display'); } } } else { if ( isset($_REQUEST['headerimage']) ) { if ( '' == $_REQUEST['headerimage'] ) delete_option('kubrick_header_image'); else update_option('kubrick_header_image', $_REQUEST['headerimage']); } if ( isset($_REQUEST['fontcolor']) ) { if ( '' == $_REQUEST['fontcolor'] ) delete_option('kubrick_header_color'); else update_option('kubrick_header_color', $_REQUEST['fontcolor']); } if ( isset($_REQUEST['fontdisplay']) ) { if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] ) delete_option('kubrick_header_display'); else update_option('kubrick_header_display', 'none'); } } //print_r($_REQUEST); header("Location: themes.php?page=functions.php&saved=true"); die; } add_action('admin_head', 'kubrick_theme_page_head'); } add_theme_page("Kubrick Theme Options", "Current Theme Options", 'edit_themes', basename(__FILE__), 'kubrick_theme_page'); } function kubrick_theme_page_head() { ?>
Options saved.
'; ?>