Permalink
Browse files

recode options for the right header meta-area to be like the left met…

…a-area
  • Loading branch information...
1 parent 76d767e commit 8e70ef184a0e2d0da86002f0facb7ad91a7c457d @marpa committed Jun 3, 2012
Showing with 65 additions and 35 deletions.
  1. +9 −9 config-sample.php
  2. +23 −8 functions/theme-options.php
  3. +33 −18 template-options.php
View
@@ -55,6 +55,7 @@
$translucence_config['footer-meta-left'] = "custom";
$translucence_config['header-meta-left'] = "custom";
+$translucence_config['header-meta-right'] = "custom";
$translucence_config['headerleftcustom'] = "";
$translucence_config['footerleftcustom'] = "";
@@ -270,17 +271,14 @@
* (this is the html content options for the upper right corner of the blog)
******************************************************************************/
-$translucence_config['header_meta_right_options']['option_name'] = "";
-$translucence_config['header_meta_right_options']['option_label'] = "";
-$translucence_config['header_meta_right_options']['option_value'] = "";
+$translucence_config['header_meta_right_options']['blogs']['option_name'] = "blogs";
+$translucence_config['header_meta_right_options']['blogs']['option_label'] = "Blog Sign Up";
+$translucence_config['header_meta_right_options']['blogs']['option_value'] = "<a href='".get_bloginfo('url')."/wp-signup.php' title='View your Blogs'>WordPress</a>";
-$translucence_config['header_meta_right_options']['option_name'] = "show";
-$translucence_config['header_meta_right_options']['option_label'] = "Show";
-$translucence_config['header_meta_right_options']['option_value'] = "on";
+$translucence_config['header_meta_right_options']['custom']['option_name'] = "custom";
+$translucence_config['header_meta_right_options']['custom']['option_label'] = "Custom";
+$translucence_config['header_meta_right_options']['custom']['option_value'] = "";
-$translucence_config['header_meta_right_options']['option_name'] = "hide";
-$translucence_config['header_meta_right_options']['option_label'] = "Hide";
-$translucence_config['header_meta_right_options']['option_value'] = "off";
/******************************************************************************
@@ -330,6 +328,8 @@
$translucence_config['model'][] = 'header-width';
$translucence_config['model'][] = 'headerleftcustom';
$translucence_config['model'][] = 'header-meta-left';
+$translucence_config['model'][] = 'headerrightcustom';
+$translucence_config['model'][] = 'header-meta-right';
$translucence_config['model'][] = 'header-image-options';
$translucence_config['model'][] = 'header-text-display';
$translucence_config['model'][] = 'header-block-height';
@@ -127,6 +127,11 @@ function translucence_validate_options($input) {
} else if ($option == "footerleftcustom") {
$input['footerleftcustom'] = wp_kses($input['footerleftcustom'], $allowedposttags);
$validated[] = $option;
+
+ } else if ($option == "headerrightcustom") {
+ $input['headerrightcustom'] = wp_kses($input['headerrightcustom'], $allowedposttags);
+ $validated[] = $option;
+
// validate all options that specify a width
} else if (preg_match("/width/", $option)) {
@@ -259,6 +264,17 @@ function translucence_validate_options($input) {
$not_validated[] = $option;
}
+ // validate header-meta-right options
+ } else if (preg_match("/header-meta-right/", $option)) {
+ if (array_key_exists($value, $translucence_config['header_meta_right_options'])) {
+ $input[$option] = $value;
+ $validated[] = $option;
+ } else {
+ $input[$option] = null;
+ $not_validated[] = $option;
+ }
+
+
// validate footer-meta-left options
} else if (preg_match("/footer-meta-left/", $option)) {
if (array_key_exists($value, $translucence_config['footer_meta_left_options'])) {
@@ -435,6 +451,9 @@ function translucence_get_variation_default_config() {
if (!isset($translucence_options['header-meta-left'])) $translucence_options['header-meta-left'] = $translucence_config['header-meta-left'];
if (!isset($translucence_options['headerleftcustom'])) $translucence_options['headerleftcustom'] = $translucence_config['headerleftcustom'];
if (!isset($translucence_options['footerleftcustom'])) $translucence_options['footerleftcustom'] = $translucence_config['footerleftcustom'];
+
+ if (!isset($translucence_options['header-meta-right'])) $translucence_options['header-meta-right'] = $translucence_config['header-meta-right'];
+ if (!isset($translucence_options['headerrightcustom'])) $translucence_options['headerrightcustom'] = $translucence_config['headerrightcustom'];
if (!isset($translucence_options['header-image-options'])) $translucence_options['header-image-options'] = $translucence_config['header-image-options'];
@@ -663,15 +682,11 @@ function translucence_set_derivative_options() {
/******************************************************************************
* Header right links (derived from header_meta_right_options)
******************************************************************************/
-
- if (isset($translucence_config['header_meta_right_options'])) {
- if (isset($headermeta) && $headermeta == 'on') {
- $translucence_options['headerright'] = "Menus | Widgets | Design";
-
- } else {
- $translucence_options['headerright'] = "";
- }
+ if ($translucence_options['header-meta-right'] == 'custom') {
+ $translucence_options['headerright'] = stripslashes($translucence_options['headerrightcustom']);
+ } else {
+ $translucence_options['headerright'] = $translucence_config['header_meta_right_options'][$translucence_options['header-meta-right']]['option_value'];
}
/******************************************************************************
View
@@ -611,20 +611,33 @@ function translucence_headermeta_left() {
*/
function translucence_headermeta_right() {
- global $translucence_config, $translucence_options;
+ global $translucence_config, $translucence_options, $translucence_options_id;
ob_start();
- print "<span class='metatext'>";
- print $translucence_options['headerright'];
+ print "<div class='metatext'>";
- // Log in link options
- if ($translucence_options['headermeta'] == "on") {
- print __( 'Menus | Widgets | Options', '2010-translucence' );
- print " | ".wp_get_current_user()->display_name;
- //print " - Log out";
+ if ($translucence_options['headerright'] == "") {
+ print "no links defined...";
+ } else {
+ print $translucence_options['headerright'];
}
-
- print "</span>";
+
+ // if header right links selection is custom
+ if ($translucence_options['header-meta-right'] == 'custom') {
+ print "
+ <input id='headerrightdo' type='hidden' name='headerrightdo' value='0'/> -
+ <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"block\"; document.getElementById(\"headerrightdo\").value = \"1\"; exit; '>edit</a>
+ <div id='headerrightedit' style='display: none;'>
+ <textarea name='".$translucence_options_id."[headerrightcustom].' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
+ print stripslashes(stripslashes(trim($translucence_options['headerrightcustom'])));
+ print "</textarea>
+ &nbsp;&nbsp;&nbsp;
+ <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"none\"; document.getElementById(\"headerrightdo\").value = \"0\"; exit;'>Cancel</a> -
+ <span class='submit'><input type='submit' value='Update' name='save'/></span>
+ </div>
+ ";
+ }
+ print "</div>";
$headermeta_right = ob_get_contents();
ob_end_clean();
return $headermeta_right;
@@ -897,7 +910,7 @@ function translucence_get_global_options() {
// headermeta left options
print "<td style='width: 50%'>";
if (in_array("header-meta-left", $translucence_config['model'])) {
- print "<span style='font-size: 9px;'>".__( 'Header Links', '2010-translucence' )."</span>\n";
+ print "<span style='font-size: 9px;'>".__( 'Left Header Links', '2010-translucence' )."</span>\n";
print "<select name='".$translucence_options_id."[header-meta-left]' style='font-size: 10px;' onchange='this.form.submit();'>";
foreach (array_keys($translucence_config['header_meta_left_options']) as $meta_left_option) {
print "<option value='".$translucence_config['header_meta_left_options'][$meta_left_option]['option_name']."' ";
@@ -910,14 +923,16 @@ function translucence_get_global_options() {
// headermeta right options
print "<td style='width: 50%; text-align: right;'>";
- if (in_array("headermeta", $translucence_config['model'])) {
+ if (in_array("header-meta-right", $translucence_config['model'])) {
print "
- <span style='font-size: 9px;'>".__( 'Editing Quick Links', '2010-translucence' ).":</span>
- <select name='".$translucence_options_id."[headermeta]' style='font-size: 10px;' onchange='this.form.submit();'>
- <option value='on' ".($translucence_options['headermeta'] == 'on' ? ' selected' : '') . ">".__( 'Show', '2010-translucence' )."</option>
- <option value='off' ".($translucence_options['headermeta'] == 'off' ? ' selected' : '') . ">".__( 'Hide', '2010-translucence' )."</option>
- </select>";
- }
+ <span style='font-size: 9px;'>".__( 'Right Header Links', '2010-translucence' ).":</span>\n";
+ print "<select name='".$translucence_options_id."[header-meta-right]' style='font-size: 10px;' onchange='this.form.submit();'>";
+ foreach (array_keys($translucence_config['header_meta_right_options']) as $meta_right_option) {
+ print "<option value='".$translucence_config['header_meta_right_options'][$meta_right_option]['option_name']."' ";
+ print ($translucence_options['header-meta-right'] == $translucence_config['header_meta_right_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
+ print $translucence_config['header_meta_right_options'][$meta_right_option]['option_label']."</option>";
+ }
+ print "</select>"; }
print "</td>";
print "</tr>";
print "</table>";

0 comments on commit 8e70ef1

Please sign in to comment.