Commits

Doug Stewart committed 2623767

More support of tabbed admin incoming.

Comments (0)

Files changed (2)

includes/functions/admin.php

 	
 	echo "<h2>Options</h2>";
 	print_r($options);
-	echo "<h2>Defaut Options</h2>";
-	print_r($default_options);
+	
 	$section = '';
 	$lblg_options_group = $shortname . '_theme_options';
 
 						<?php 
 							if( $value['options'] === array_values($value['options'])){
 								foreach ( $value['options'] as $option) { 
-									echo "<option" . selected( $option, $lblg_options[$key], false ) . ">$option</option>\n";
+									echo "<option" . selected( $option, $options[$key], false ) . ">$option</option>\n";
 								}
 							} else {
 								foreach ( $value['options'] as $key => $value ) { 
 			$ta_options = $value['options'];
 			lblg_option_wrapper_header( $value );
 			?>
-					<textarea name="<?php echo $lblg_options_group . '[' . $key . ']'; ?>" id="<?php echo $key; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php echo esc_html( $lblg_options[$key] ); ?></textarea>
+					<textarea name="<?php echo $lblg_options_group . '[' . $key . ']'; ?>" id="<?php echo $key; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php echo esc_html( $options[$key] ); ?></textarea>
 			<?php
 			lblg_option_wrapper_footer( $value );
 			break;
 		 		foreach ( $value['options'] as $option ) {
 						$radio_setting = $lblg_options[$key];
 						$tmp_name = $lblg_options_group . '['. $key . ']';
-			    		echo "<input type=\"radio\" name=\"$tmp_name\" value=\"$option\"" . checked( $option, $lblg_options[$key], false ) . " />$option<br />\n";
+			    		echo "<input type=\"radio\" name=\"$tmp_name\" value=\"$option\"" . checked( $option, $options[$key], false ) . " />$option<br />\n";
 				}
 			} else {
 		 		foreach ( $value['options'] as $opt_key => $opt_value ) {
 						$radio_setting = $lblg_options[$key];
 						$tmp_name = $lblg_options_group . '['. $key . ']';
-			    		echo "<input type=\"radio\" name=\"$tmp_name\" value=\"$opt_key\"" . checked( $opt_key, $lblg_options[$key], false ) . " />$opt_value<br />\n";
+			    		echo "<input type=\"radio\" name=\"$tmp_name\" value=\"$opt_key\"" . checked( $opt_key, $options[$key], false ) . " />$opt_value<br />\n";
 				}
 			}
 		 
 			lblg_option_wrapper_header( $value );
 
 			$tmp_name = $lblg_options_group . '['. $key . ']';
-			echo "<input type=\"checkbox\" name=\"$tmp_name\" id=\"$key\" value=\"1\"" . checked( $lblg_options[$key], 1, false ) . " />\n";
+			echo "<input type=\"checkbox\" name=\"$tmp_name\" id=\"$key\" value=\"1\"" . checked( $options[$key], 1, false ) . " />\n";
 
 			lblg_option_wrapper_footer( $value );
 			break;

includes/functions/options.php

  * @global string   $lblg_themename
  * @global string   $lblg_version
  * @global array    $lblg_options
- * @global array    $lblg_default_options 
+ * @global array    $lblg_default_options
+ * @global array    $lblg_defaults
  */
 function lblg_options_init(){
-	global $lblg_shortname, $lblg_themename, $lblg_version, $lblg_options, $lblg_default_options;
+	global $lblg_shortname, $lblg_themename, $lblg_version, $lblg_options, $lblg_default_options, $lblg_defaults;
 	/* 
 	*  If Elbee Elgee (or a child theme) has already been installed,
 	*  this should return an array() with keys 'shortname', 'themename',
 	// Pull the default options from the parent-options.php and, optionally, the
 	// child-options.php file, if we're running as a child theme.
 	$lblg_default_options = lblg_get_default_options();
+	$lblg_defaults = lblg_get_options_from_defaults( $lblg_default_options );
 
 	if( ( false === $lblg_stored_options ) || ( '' == $lblg_stored_options ) ){
 		// We haven't been installed yet.
 function lblg_get_options_from_defaults( $default_options ){
 	$stripped_opts = array();
 	
-	$c = 0;
 	foreach( $default_options as $key => $value ){
-		switch($value['type']){
-			case 'tab':
-				$stripped_opts = $stripped_opts + lblg_get_options_from_defaults($value['contents']);
-			break;
-			case 'subhead':
-			break;
-			default:
-			$stripped_opts[$key] = $value['std'];
-			break;
+		if( $key != "tabs" ){
+			switch($value['type']){
+				case 'tab':
+					$stripped_opts = $stripped_opts + lblg_get_options_from_defaults($value['contents']);
+				break;
+				case 'subhead':
+				break;
+				default:
+				$stripped_opts[$key] = $value['std'];
+				break;
+			}
 		}
-		echo "<h2>Iteration $c</h2>";
-		print_r($stripped_opts);
-		$c++;
 	}
 	
 	return $stripped_opts;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.