-
+ 69E82F4D9E763724FAF4F737E80A6FFA0E08042A65398CEFCF5CE37E4A84D376ECFEC94CDE64FDE02CA8F1A26CF24B3D3CCF3A07F4FF78EB6F9C4C1FF38497C2mp-wp/wp-content/themes/default/functions.php(0 . 0)(1 . 422)
66620 <?php
66621 /**
66622 * @package WordPress
66623 * @subpackage Default_Theme
66624 */
66625
66626 if ( function_exists('register_sidebar') )
66627 register_sidebar(array(
66628 'before_widget' => '<li id="%1$s" class="widget %2$s">',
66629 'after_widget' => '</li>',
66630 'before_title' => '<h2 class="widgettitle">',
66631 'after_title' => '</h2>',
66632 ));
66633
66634 /** @ignore */
66635 function kubrick_head() {
66636 $head = "<style type='text/css'>\n<!--";
66637 $output = '';
66638 if ( kubrick_header_image() ) {
66639 $url = kubrick_header_image_url() ;
66640 $output .= "#header { background: url('$url') no-repeat bottom center; }\n";
66641 }
66642 if ( false !== ( $color = kubrick_header_color() ) ) {
66643 $output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
66644 }
66645 if ( false !== ( $display = kubrick_header_display() ) ) {
66646 $output .= "#headerimg { display: $display }\n";
66647 }
66648 $foot = "--></style>\n";
66649 if ( '' != $output )
66650 echo $head . $output . $foot;
66651 }
66652
66653 add_action('wp_head', 'kubrick_head');
66654
66655 function kubrick_header_image() {
66656 return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
66657 }
66658
66659 function kubrick_upper_color() {
66660 if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
66661 parse_str(substr($url, strpos($url, '?') + 1), $q);
66662 return $q['upper'];
66663 } else
66664 return '69aee7';
66665 }
66666
66667 function kubrick_lower_color() {
66668 if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
66669 parse_str(substr($url, strpos($url, '?') + 1), $q);
66670 return $q['lower'];
66671 } else
66672 return '4180b6';
66673 }
66674
66675 function kubrick_header_image_url() {
66676 if ( $image = kubrick_header_image() )
66677 $url = get_template_directory_uri() . '/images/' . $image;
66678 else
66679 $url = get_template_directory_uri() . '/images/kubrickheader.jpg.svg';
66680
66681 return $url;
66682 }
66683
66684 function kubrick_header_color() {
66685 return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
66686 }
66687
66688 function kubrick_header_color_string() {
66689 $color = kubrick_header_color();
66690 if ( false === $color )
66691 return 'white';
66692
66693 return $color;
66694 }
66695
66696 function kubrick_header_display() {
66697 return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
66698 }
66699
66700 function kubrick_header_display_string() {
66701 $display = kubrick_header_display();
66702 return $display ? $display : 'inline';
66703 }
66704
66705 add_action('admin_menu', 'kubrick_add_theme_page');
66706
66707 function kubrick_add_theme_page() {
66708 if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
66709 if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
66710 check_admin_referer('kubrick-header');
66711 if ( isset($_REQUEST['njform']) ) {
66712 if ( isset($_REQUEST['defaults']) ) {
66713 delete_option('kubrick_header_image');
66714 delete_option('kubrick_header_color');
66715 delete_option('kubrick_header_display');
66716 } else {
66717 if ( '' == $_REQUEST['njfontcolor'] )
66718 delete_option('kubrick_header_color');
66719 else {
66720 $fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
66721 update_option('kubrick_header_color', $fontcolor);
66722 }
66723 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) ) {
66724 $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];
66725 $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];
66726 update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
66727 }
66728
66729 if ( isset($_REQUEST['toggledisplay']) ) {
66730 if ( false === get_option('kubrick_header_display') )
66731 update_option('kubrick_header_display', 'none');
66732 else
66733 delete_option('kubrick_header_display');
66734 }
66735 }
66736 } else {
66737
66738 if ( isset($_REQUEST['headerimage']) ) {
66739 check_admin_referer('kubrick-header');
66740 if ( '' == $_REQUEST['headerimage'] )
66741 delete_option('kubrick_header_image');
66742 else {
66743 $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']);
66744 update_option('kubrick_header_image', $headerimage);
66745 }
66746 }
66747
66748 if ( isset($_REQUEST['fontcolor']) ) {
66749 check_admin_referer('kubrick-header');
66750 if ( '' == $_REQUEST['fontcolor'] )
66751 delete_option('kubrick_header_color');
66752 else {
66753 $fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
66754 update_option('kubrick_header_color', $fontcolor);
66755 }
66756 }
66757
66758 if ( isset($_REQUEST['fontdisplay']) ) {
66759 check_admin_referer('kubrick-header');
66760 if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
66761 delete_option('kubrick_header_display');
66762 else
66763 update_option('kubrick_header_display', 'none');
66764 }
66765 }
66766 //print_r($_REQUEST);
66767 wp_redirect("themes.php?page=functions.php&saved=true");
66768 die;
66769 }
66770 add_action('admin_head', 'kubrick_theme_page_head');
66771 }
66772 add_theme_page(__('Customize Header'), __('Header Image and Color'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
66773 }
66774
66775 function kubrick_theme_page_head() {
66776 ?>
66777 <script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
66778 <script type='text/javascript'>
66779 // <![CDATA[
66780 function pickColor(color) {
66781 ColorPicker_targetInput.value = color;
66782 kUpdate(ColorPicker_targetInput.id);
66783 }
66784 function PopupWindow_populate(contents) {
66785 contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Close Color Picker')); ?>" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
66786 this.contents = contents;
66787 this.populated = false;
66788 }
66789 function PopupWindow_hidePopup(magicword) {
66790 if ( magicword != 'prettyplease' )
66791 return false;
66792 if (this.divName != null) {
66793 if (this.use_gebi) {
66794 document.getElementById(this.divName).style.visibility = "hidden";
66795 }
66796 else if (this.use_css) {
66797 document.all[this.divName].style.visibility = "hidden";
66798 }
66799 else if (this.use_layers) {
66800 document.layers[this.divName].visibility = "hidden";
66801 }
66802 }
66803 else {
66804 if (this.popupWindow && !this.popupWindow.closed) {
66805 this.popupWindow.close();
66806 this.popupWindow = null;
66807 }
66808 }
66809 return false;
66810 }
66811 function colorSelect(t,p) {
66812 if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
66813 cp.hidePopup('prettyplease');
66814 else {
66815 cp.p = p;
66816 cp.select(t,p);
66817 }
66818 }
66819 function PopupWindow_setSize(width,height) {
66820 this.width = 162;
66821 this.height = 210;
66822 }
66823
66824 var cp = new ColorPicker();
66825 function advUpdate(val, obj) {
66826 document.getElementById(obj).value = val;
66827 kUpdate(obj);
66828 }
66829 function kUpdate(oid) {
66830 if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
66831 uc = document.getElementById('uppercolor').value.replace('#', '');
66832 lc = document.getElementById('lowercolor').value.replace('#', '');
66833 hi = document.getElementById('headerimage');
66834 hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
66835 document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
66836 document.getElementById('advuppercolor').value = '#'+uc;
66837 document.getElementById('advlowercolor').value = '#'+lc;
66838 }
66839 if ( 'fontcolor' == oid ) {
66840 document.getElementById('header').style.color = document.getElementById('fontcolor').value;
66841 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
66842 }
66843 if ( 'fontdisplay' == oid ) {
66844 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
66845 }
66846 }
66847 function toggleDisplay() {
66848 td = document.getElementById('fontdisplay');
66849 td.value = ( td.value == 'none' ) ? 'inline' : 'none';
66850 kUpdate('fontdisplay');
66851 }
66852 function toggleAdvanced() {
66853 a = document.getElementById('jsAdvanced');
66854 if ( a.style.display == 'none' )
66855 a.style.display = 'block';
66856 else
66857 a.style.display = 'none';
66858 }
66859 function kDefaults() {
66860 document.getElementById('headerimage').value = '';
66861 document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
66862 document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
66863 document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg.svg") center no-repeat';
66864 document.getElementById('header').style.color = '#FFFFFF';
66865 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
66866 document.getElementById('fontdisplay').value = 'inline';
66867 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
66868 }
66869 function kRevert() {
66870 document.getElementById('headerimage').value = '<?php echo js_escape(kubrick_header_image()); ?>';
66871 document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo js_escape(kubrick_upper_color()); ?>';
66872 document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo js_escape(kubrick_lower_color()); ?>';
66873 document.getElementById('header').style.background = 'url("<?php echo js_escape(kubrick_header_image_url()); ?>") center no-repeat';
66874 document.getElementById('header').style.color = '';
66875 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo js_escape(kubrick_header_color_string()); ?>';
66876 document.getElementById('fontdisplay').value = '<?php echo js_escape(kubrick_header_display_string()); ?>';
66877 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
66878 }
66879 function kInit() {
66880 document.getElementById('jsForm').style.display = 'block';
66881 document.getElementById('nonJsForm').style.display = 'none';
66882 }
66883 addLoadEvent(kInit);
66884 // ]]>
66885 </script>
66886 <style type='text/css'>
66887 #headwrap {
66888 text-align: center;
66889 }
66890 #kubrick-header {
66891 font-size: 80%;
66892 }
66893 #kubrick-header .hibrowser {
66894 width: 780px;
66895 height: 260px;
66896 overflow: scroll;
66897 }
66898 #kubrick-header #hitarget {
66899 display: none;
66900 }
66901 #kubrick-header #header h1 {
66902 font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
66903 font-weight: bold;
66904 font-size: 4em;
66905 text-align: center;
66906 padding-top: 70px;
66907 margin: 0;
66908 }
66909
66910 #kubrick-header #header .description {
66911 font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
66912 font-size: 1.2em;
66913 text-align: center;
66914 }
66915 #kubrick-header #header {
66916 text-decoration: none;
66917 color: <?php echo kubrick_header_color_string(); ?>;
66918 padding: 0;
66919 margin: 0;
66920 height: 200px;
66921 text-align: center;
66922 background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
66923 }
66924 #kubrick-header #headerimg {
66925 margin: 0;
66926 height: 200px;
66927 width: 100%;
66928 display: <?php echo kubrick_header_display_string(); ?>;
66929 }
66930 #jsForm {
66931 display: none;
66932 text-align: center;
66933 }
66934 #jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
66935 padding: 0px;
66936 margin: 0px;
66937 }
66938 #advanced {
66939 text-align: center;
66940 width: 620px;
66941 }
66942 html>body #advanced {
66943 text-align: center;
66944 position: relative;
66945 left: 50%;
66946 margin-left: -380px;
66947 }
66948 #jsAdvanced {
66949 text-align: right;
66950 }
66951 #nonJsForm {
66952 position: relative;
66953 text-align: left;
66954 margin-left: -370px;
66955 left: 50%;
66956 }
66957 #nonJsForm label {
66958 padding-top: 6px;
66959 padding-right: 5px;
66960 float: left;
66961 width: 100px;
66962 text-align: right;
66963 }
66964 .defbutton {
66965 font-weight: bold;
66966 }
66967 .zerosize {
66968 width: 0px;
66969 height: 0px;
66970 overflow: hidden;
66971 }
66972 #colorPickerDiv a, #colorPickerDiv a:hover {
66973 padding: 1px;
66974 text-decoration: none;
66975 border-bottom: 0px;
66976 }
66977 </style>
66978 <?php
66979 }
66980
66981 function kubrick_theme_page() {
66982 if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
66983 ?>
66984 <div class='wrap'>
66985 <h2><?php _e('Customize Header'); ?></h2>
66986 <div id="kubrick-header">
66987 <div id="headwrap">
66988 <div id="header">
66989 <div id="headerimg">
66990 <h1><?php bloginfo('name'); ?></h1>
66991 <div class="description"><?php bloginfo('description'); ?></div>
66992 </div>
66993 </div>
66994 </div>
66995 <br />
66996 <div id="nonJsForm">
66997 <form method="post" action="">
66998 <?php wp_nonce_field('kubrick-header'); ?>
66999 <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php echo attribute_escape(__('Save')); ?>" /></div>
67000 <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br />
67001 <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
67002 <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
67003 <input type="hidden" name="hi" id="hi" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
67004 <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php echo attribute_escape(__('Toggle Text')); ?>" />
67005 <input type="submit" name="defaults" value="<?php echo attribute_escape(__('Use Defaults')); ?>" />
67006 <input type="submit" class="defbutton" name="submitform" value=" <?php _e('Save'); ?> " />
67007 <input type="hidden" name="action" value="save" />
67008 <input type="hidden" name="njform" value="true" />
67009 </form>
67010 </div>
67011 <div id="jsForm">
67012 <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>">
67013 <?php wp_nonce_field('kubrick-header'); ?>
67014 <input type="button" class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php echo attribute_escape(__('Font Color')); ?>"></input>
67015 <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php echo attribute_escape(__('Upper Color')); ?>"></input>
67016 <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php echo attribute_escape(__('Lower Color')); ?>"></input>
67017 <input type="button" class="button-secondary" name="revert" value="<?php echo attribute_escape(__('Revert')); ?>" onclick="kRevert()" />
67018 <input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Advanced')); ?>" onclick="toggleAdvanced()" />
67019 <input type="hidden" name="action" value="save" />
67020 <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo attribute_escape(kubrick_header_display()); ?>" />
67021 <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" />
67022 <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo attribute_escape(kubrick_upper_color()); ?>" />
67023 <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo attribute_escape(kubrick_lower_color()); ?>" />
67024 <input type="hidden" name="headerimage" id="headerimage" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
67025 <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php echo attribute_escape(__('Update Header')); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
67026 </form>
67027 <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
67028 <div id="advanced">
67029 <form id="jsAdvanced" style="display:none;" action="">
67030 <?php wp_nonce_field('kubrick-header'); ?>
67031 <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /><br />
67032 <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /><br />
67033 <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /><br />
67034 <input type="button" class="button-secondary" name="default" value="<?php echo attribute_escape(__('Select Default Colors')); ?>" onclick="kDefaults()" /><br />
67035 <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php echo attribute_escape(__('Toggle Text Display')); ?>"></input><br />
67036 </form>
67037 </div>
67038 </div>
67039 </div>
67040 </div>
67041 <?php } ?>