add_data( 'kubrick-ie', 'conditional', 'lte IE 8' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'kubrick_scripts' ); function kubrick_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( 'kubrick_custom_header_args', array( 'default-image' => '%s/images/kubrickheader.gif', 'default-text-color' => 'fff', 'width' => 740, 'height' => 192, 'wp-head-callback' => 'kubrick_header_style', 'admin-head-callback' => 'kubrick_admin_header_style', ) ) ); } add_action( 'after_setup_theme', 'kubrick_custom_header_setup' ); $content_width = 450; $themecolors = array( 'bg' => 'ffffff', 'text' => '333333', 'link' => '0066cc', 'border' => 'f9f9f9', 'url' => '114477', ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'print-style' ); function kubrick_admin_header_style() { ?> body { background: url("/images/kubrickbgcolor.gif"); } #page { background: url("/images/kubrickbg.gif") repeat-y top; border: none; } #page { background: url("/images/kubrickbgwide.gif") repeat-y top !important; border: none; } #header { background: url("/images/kubrickheader.gif") no-repeat bottom center; } #footer { background: url("/images/kubrickfooter.gif") no-repeat bottom; border: none;} #header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; } #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } "; } 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'] ) && 'theme_options' == $_GET['page'] ) { 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 = sanitize_hex_color( $_REQUEST['njfontcolor'] ); if ( ! empty( $fontcolor ) ) { 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("/\n+/", '', $_REQUEST['headerimage']); $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $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 = sanitize_hex_color( $_REQUEST['fontcolor'] ); if ( ! empty( $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'); } } wp_redirect( 'themes.php?page=theme_options&saved=true' ); exit(); } add_action('admin_head', 'kubrick_theme_page_head'); } add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'edit_theme_options', 'theme_options', 'kubrick_theme_page'); } function kubrick_theme_page_head() { ?>
'.__('Options saved.').'
'; ?>