- 6399A2B7AFFEBC933CDBBE699A806131411ED87DD6509B6AD68A679130B78F32AA628BC8045D95C7EDCF7A3CA9217AA048F703FBED526C13F29070FC5DC5E0BB
+ D998FA47A199B7D39163B5A076DE094D21E4074BB82830150103882127AD4A347040E6855D4F501763FA2DB7086AFF7D4616CE6871E411EAF8444EF79AEDF145
mp-wp/wp-content/themes/default/functions.php
(11 . 412)(11 . 4)
34530 'before_title' => '<h2 class="widgettitle">',
34531 'after_title' => '</h2>',
34532 ));
34533
34534 /** @ignore */
34535 function kubrick_head() {
34536 $head = "<style type='text/css'>\n<!--";
34537 $output = '';
34538 if ( kubrick_header_image() ) {
34539 $url = kubrick_header_image_url() ;
34540 $output .= "#header { background: url('$url') no-repeat bottom center; }\n";
34541 }
34542 if ( false !== ( $color = kubrick_header_color() ) ) {
34543 $output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
34544 }
34545 if ( false !== ( $display = kubrick_header_display() ) ) {
34546 $output .= "#headerimg { display: $display }\n";
34547 }
34548 $foot = "--></style>\n";
34549 if ( '' != $output )
34550 echo $head . $output . $foot;
34551 }
34552
34553 add_action('wp_head', 'kubrick_head');
34554
34555 function kubrick_header_image() {
34556 return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
34557 }
34558
34559 function kubrick_upper_color() {
34560 if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
34561 parse_str(substr($url, strpos($url, '?') + 1), $q);
34562 return $q['upper'];
34563 } else
34564 return '69aee7';
34565 }
34566
34567 function kubrick_lower_color() {
34568 if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
34569 parse_str(substr($url, strpos($url, '?') + 1), $q);
34570 return $q['lower'];
34571 } else
34572 return '4180b6';
34573 }
34574
34575 function kubrick_header_image_url() {
34576 if ( $image = kubrick_header_image() )
34577 $url = get_template_directory_uri() . '/images/' . $image;
34578 else
34579 $url = get_template_directory_uri() . '/images/kubrickheader.svg';
34580
34581 return $url;
34582 }
34583
34584 function kubrick_header_color() {
34585 return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
34586 }
34587
34588 function kubrick_header_color_string() {
34589 $color = kubrick_header_color();
34590 if ( false === $color )
34591 return 'white';
34592
34593 return $color;
34594 }
34595
34596 function kubrick_header_display() {
34597 return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
34598 }
34599
34600 function kubrick_header_display_string() {
34601 $display = kubrick_header_display();
34602 return $display ? $display : 'inline';
34603 }
34604
34605 add_action('admin_menu', 'kubrick_add_theme_page');
34606
34607 function kubrick_add_theme_page() {
34608 if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
34609 if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
34610 check_admin_referer('kubrick-header');
34611 if ( isset($_REQUEST['njform']) ) {
34612 if ( isset($_REQUEST['defaults']) ) {
34613 delete_option('kubrick_header_image');
34614 delete_option('kubrick_header_color');
34615 delete_option('kubrick_header_display');
34616 } else {
34617 if ( '' == $_REQUEST['njfontcolor'] )
34618 delete_option('kubrick_header_color');
34619 else {
34620 $fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
34621 update_option('kubrick_header_color', $fontcolor);
34622 }
34623 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) ) {
34624 $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];
34625 $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];
34626 update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
34627 }
34628
34629 if ( isset($_REQUEST['toggledisplay']) ) {
34630 if ( false === get_option('kubrick_header_display') )
34631 update_option('kubrick_header_display', 'none');
34632 else
34633 delete_option('kubrick_header_display');
34634 }
34635 }
34636 } else {
34637
34638 if ( isset($_REQUEST['headerimage']) ) {
34639 check_admin_referer('kubrick-header');
34640 if ( '' == $_REQUEST['headerimage'] )
34641 delete_option('kubrick_header_image');
34642 else {
34643 $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']);
34644 update_option('kubrick_header_image', $headerimage);
34645 }
34646 }
34647
34648 if ( isset($_REQUEST['fontcolor']) ) {
34649 check_admin_referer('kubrick-header');
34650 if ( '' == $_REQUEST['fontcolor'] )
34651 delete_option('kubrick_header_color');
34652 else {
34653 $fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
34654 update_option('kubrick_header_color', $fontcolor);
34655 }
34656 }
34657
34658 if ( isset($_REQUEST['fontdisplay']) ) {
34659 check_admin_referer('kubrick-header');
34660 if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
34661 delete_option('kubrick_header_display');
34662 else
34663 update_option('kubrick_header_display', 'none');
34664 }
34665 }
34666 //print_r($_REQUEST);
34667 wp_redirect("themes.php?page=functions.php&saved=true");
34668 die;
34669 }
34670 add_action('admin_head', 'kubrick_theme_page_head');
34671 }
34672 add_theme_page(__('Customize Header'), __('Header Image and Color'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
34673 }
34674
34675 function kubrick_theme_page_head() {
34676 ?>
34677 <script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
34678 <script type='text/javascript'>
34679 // <![CDATA[
34680 function pickColor(color) {
34681 ColorPicker_targetInput.value = color;
34682 kUpdate(ColorPicker_targetInput.id);
34683 }
34684 function PopupWindow_populate(contents) {
34685 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>';
34686 this.contents = contents;
34687 this.populated = false;
34688 }
34689 function PopupWindow_hidePopup(magicword) {
34690 if ( magicword != 'prettyplease' )
34691 return false;
34692 if (this.divName != null) {
34693 if (this.use_gebi) {
34694 document.getElementById(this.divName).style.visibility = "hidden";
34695 }
34696 else if (this.use_css) {
34697 document.all[this.divName].style.visibility = "hidden";
34698 }
34699 else if (this.use_layers) {
34700 document.layers[this.divName].visibility = "hidden";
34701 }
34702 }
34703 else {
34704 if (this.popupWindow && !this.popupWindow.closed) {
34705 this.popupWindow.close();
34706 this.popupWindow = null;
34707 }
34708 }
34709 return false;
34710 }
34711 function colorSelect(t,p) {
34712 if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
34713 cp.hidePopup('prettyplease');
34714 else {
34715 cp.p = p;
34716 cp.select(t,p);
34717 }
34718 }
34719 function PopupWindow_setSize(width,height) {
34720 this.width = 162;
34721 this.height = 210;
34722 }
34723
34724 var cp = new ColorPicker();
34725 function advUpdate(val, obj) {
34726 document.getElementById(obj).value = val;
34727 kUpdate(obj);
34728 }
34729 function kUpdate(oid) {
34730 if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
34731 uc = document.getElementById('uppercolor').value.replace('#', '');
34732 lc = document.getElementById('lowercolor').value.replace('#', '');
34733 hi = document.getElementById('headerimage');
34734 hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
34735 document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
34736 document.getElementById('advuppercolor').value = '#'+uc;
34737 document.getElementById('advlowercolor').value = '#'+lc;
34738 }
34739 if ( 'fontcolor' == oid ) {
34740 document.getElementById('header').style.color = document.getElementById('fontcolor').value;
34741 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
34742 }
34743 if ( 'fontdisplay' == oid ) {
34744 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
34745 }
34746 }
34747 function toggleDisplay() {
34748 td = document.getElementById('fontdisplay');
34749 td.value = ( td.value == 'none' ) ? 'inline' : 'none';
34750 kUpdate('fontdisplay');
34751 }
34752 function toggleAdvanced() {
34753 a = document.getElementById('jsAdvanced');
34754 if ( a.style.display == 'none' )
34755 a.style.display = 'block';
34756 else
34757 a.style.display = 'none';
34758 }
34759 function kDefaults() {
34760 document.getElementById('headerimage').value = '';
34761 document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
34762 document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
34763 document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.svg") center no-repeat';
34764 document.getElementById('header').style.color = '#FFFFFF';
34765 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
34766 document.getElementById('fontdisplay').value = 'inline';
34767 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
34768 }
34769 function kRevert() {
34770 document.getElementById('headerimage').value = '<?php echo js_escape(kubrick_header_image()); ?>';
34771 document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo js_escape(kubrick_upper_color()); ?>';
34772 document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo js_escape(kubrick_lower_color()); ?>';
34773 document.getElementById('header').style.background = 'url("<?php echo js_escape(kubrick_header_image_url()); ?>") center no-repeat';
34774 document.getElementById('header').style.color = '';
34775 document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo js_escape(kubrick_header_color_string()); ?>';
34776 document.getElementById('fontdisplay').value = '<?php echo js_escape(kubrick_header_display_string()); ?>';
34777 document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
34778 }
34779 function kInit() {
34780 document.getElementById('jsForm').style.display = 'block';
34781 document.getElementById('nonJsForm').style.display = 'none';
34782 }
34783 addLoadEvent(kInit);
34784 // ]]>
34785 </script>
34786 <style type='text/css'>
34787 #headwrap {
34788 text-align: center;
34789 }
34790 #kubrick-header {
34791 font-size: 80%;
34792 }
34793 #kubrick-header .hibrowser {
34794 width: 780px;
34795 height: 260px;
34796 overflow: scroll;
34797 }
34798 #kubrick-header #hitarget {
34799 display: none;
34800 }
34801 #kubrick-header #header h1 {
34802 font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
34803 font-weight: bold;
34804 font-size: 4em;
34805 text-align: center;
34806 padding-top: 70px;
34807 margin: 0;
34808 }
34809
34810 #kubrick-header #header .description {
34811 font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
34812 font-size: 1.2em;
34813 text-align: center;
34814 }
34815 #kubrick-header #header {
34816 text-decoration: none;
34817 color: <?php echo kubrick_header_color_string(); ?>;
34818 padding: 0;
34819 margin: 0;
34820 height: 200px;
34821 text-align: center;
34822 background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
34823 }
34824 #kubrick-header #headerimg {
34825 margin: 0;
34826 height: 200px;
34827 width: 100%;
34828 display: <?php echo kubrick_header_display_string(); ?>;
34829 }
34830 #jsForm {
34831 display: none;
34832 text-align: center;
34833 }
34834 #jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
34835 padding: 0px;
34836 margin: 0px;
34837 }
34838 #advanced {
34839 text-align: center;
34840 width: 620px;
34841 }
34842 html>body #advanced {
34843 text-align: center;
34844 position: relative;
34845 left: 50%;
34846 margin-left: -380px;
34847 }
34848 #jsAdvanced {
34849 text-align: right;
34850 }
34851 #nonJsForm {
34852 position: relative;
34853 text-align: left;
34854 margin-left: -370px;
34855 left: 50%;
34856 }
34857 #nonJsForm label {
34858 padding-top: 6px;
34859 padding-right: 5px;
34860 float: left;
34861 width: 100px;
34862 text-align: right;
34863 }
34864 .defbutton {
34865 font-weight: bold;
34866 }
34867 .zerosize {
34868 width: 0px;
34869 height: 0px;
34870 overflow: hidden;
34871 }
34872 #colorPickerDiv a, #colorPickerDiv a:hover {
34873 padding: 1px;
34874 text-decoration: none;
34875 border-bottom: 0px;
34876 }
34877 </style>
34878 <?php
34879 }
34880
34881 function kubrick_theme_page() {
34882 if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
34883 ?>
34884 <div class='wrap'>
34885 <h2><?php _e('Customize Header'); ?></h2>
34886 <div id="kubrick-header">
34887 <div id="headwrap">
34888 <div id="header">
34889 <div id="headerimg">
34890 <h1><?php bloginfo('name'); ?></h1>
34891 <div class="description"><?php bloginfo('description'); ?></div>
34892 </div>
34893 </div>
34894 </div>
34895 <br />
34896 <div id="nonJsForm">
34897 <form method="post" action="">
34898 <?php wp_nonce_field('kubrick-header'); ?>
34899 <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php echo attribute_escape(__('Save')); ?>" /></div>
34900 <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 />
34901 <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 />
34902 <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 />
34903 <input type="hidden" name="hi" id="hi" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
34904 <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php echo attribute_escape(__('Toggle Text')); ?>" />
34905 <input type="submit" name="defaults" value="<?php echo attribute_escape(__('Use Defaults')); ?>" />
34906 <input type="submit" class="defbutton" name="submitform" value="  <?php _e('Save'); ?>  " />
34907 <input type="hidden" name="action" value="save" />
34908 <input type="hidden" name="njform" value="true" />
34909 </form>
34910 </div>
34911 <div id="jsForm">
34912 <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>">
34913 <?php wp_nonce_field('kubrick-header'); ?>
34914 <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>
34915 <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>
34916 <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>
34917 <input type="button" class="button-secondary" name="revert" value="<?php echo attribute_escape(__('Revert')); ?>" onclick="kRevert()" />
34918 <input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Advanced')); ?>" onclick="toggleAdvanced()" />
34919 <input type="hidden" name="action" value="save" />
34920 <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo attribute_escape(kubrick_header_display()); ?>" />
34921 <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" />
34922 <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo attribute_escape(kubrick_upper_color()); ?>" />
34923 <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo attribute_escape(kubrick_lower_color()); ?>" />
34924 <input type="hidden" name="headerimage" id="headerimage" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
34925 <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php echo attribute_escape(__('Update Header')); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
34926 </form>
34927 <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
34928 <div id="advanced">
34929 <form id="jsAdvanced" style="display:none;" action="">
34930 <?php wp_nonce_field('kubrick-header'); ?>
34931 <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 />
34932 <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 />
34933 <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 />
34934 <input type="button" class="button-secondary" name="default" value="<?php echo attribute_escape(__('Select Default Colors')); ?>" onclick="kDefaults()" /><br />
34935 <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php echo attribute_escape(__('Toggle Text Display')); ?>"></input><br />
34936 </form>
34937 </div>
34938 </div>
34939 </div>
34940 </div>
34941 <?php } ?>