Commits

Doug Stewart  committed 0673707

Intermediate tabs checkin. Not working yet.

  • Participants
  • Parent commits ba2f84d

Comments (0)

Files changed (4)

File includes/functions/admin.php

 */
 
 /**
+ * Add theme options page to WordPress admin menu.
  *
- * @global type $lblg_themename 
+ * @global string $lblg_themename 
  */
 function lblg_add_admin() {
 	global $lblg_themename;
 add_action( 'admin_menu', 'lblg_add_admin' );
 
 /**
- *
- * @global type $lblg_shortname 
+ * Initialize/register the theme option that will be saved to the DB
+ * in order to use the Settings API properly
+ * 
+ * @global string $lblg_shortname 
  */
 function lblg_admin_init(){
 	global $lblg_shortname;
 add_action( 'admin_init', 'lblg_admin_init' );
 
 /**
- * 
+ * Display tabbed options page if theme options request such.
+ *
+ * @global array $lblg_output_admin_tabs
  */
 function lblg_output_admin_tabs(){
 	global $lblg_default_options;
+	
+	$page = 'lblg_options_page';
+	
 	if( isset($_GET['tab'] )) {
 		$current_tab = $_GET['tab'];
 	} else {
 		$current_tab = 'general';
 	}
 	
-	$tabs = lblg_get_admin_tabs();
+	$tabs = $lblg_default_options['tabs'];
+	
 	echo '<h2 class="nav-tab-wrapper">';
-	echo '<a href="http://localhost" class="nav-tab">Localhost</a><a href="http://localhost" class="nav-tab nav-tab-active">Localhost Active</a></h2>';
+	
+	foreach( $tabs as $tab => $name ){
+		if( $current_tab == $tab ){
+			echo '<a href="' . $PHP_SELF . '?page=' . $page . '&tab='. $tab . '" class="nav-tab nav-tab-active">' . $name . '</a>';			
+		} else {
+			echo '<a href="' . $PHP_SELF . '?page=' . $page . '&tab='. $tab . '" class="nav-tab">' . $name . '</a>';			
+		}
+	}
+	
+	echo "</h2>";
 }
 add_action( 'lblg_after_admin_header', 'lblg_output_admin_tabs' );
 
 /**
+ * Grab all the options tab names/links to display.
  *
- * @global type $lblg_default_options 
+ * @global array $lblg_default_options 
+ * @return array
  */
 function lblg_get_admin_tabs(){
 	global $lblg_default_options;
 	
-	print_r($lblg_default_options);
+	print_r($lblg_default_options['tabs']);
+	// foreach( $lblg_default_options as $option => $values ){
+	// 		if( 'tab' == $values['type'] ){
+	// 			$admin_tabs[$option] = $values['name'];
+	// 		}
+	// 	}
+	
+	return $admin_tabs;
 }
 
 /**
  * Display the theme options page
  *
- * @global type $lblg_shortname
- * @global type $lblg_themename
- * @global type $lblg_version
- * @global type $lblg_options
- * @global type $lblg_default_options 
+ * @global string $lblg_shortname
+ * @global string $lblg_themename
+ * @global string $lblg_version
+ * @global array $lblg_options
+ * @global array $lblg_default_options 
  * 
  */
 function lblg_admin() {
 }
 
 /**
- *
- * @global type $lblg_options
- * @global type $lblg_default_options
- * @global type $lblg_shortname 
  * lblg_options_walker() is responsible for printing all the 
  * theme options in the theme's options screen.
+ *
+ * @global array $lblg_options
+ * @global array $lblg_default_options
+ * @global string $lblg_shortname 
  */
 function lblg_options_walker(){
 	global $lblg_options, $lblg_default_options, $lblg_shortname;

File includes/functions/hooks.php

 		$copyright_text = "<a href=\"" . get_home_url() . "\">" . get_bloginfo('name') . "</a> " . lblg_copyright();
 	}
 	
-	print_r($tmp_copyright);
 	echo "<div id=\"copyright-text\">$copyright_text</div>";
 }
 

File includes/functions/options.php

 }
 
 /**
- *
+ * Sanitizes options before sending them to the databse.
+ * 
  * @global  type $lblg_shortname
  * @global  type $lblg_default_options
  * @global  type $lblg_options

File includes/parent-options.php

 $alt_stylesheets_tmp = array_unshift($alt_stylesheets, "Select a stylesheet:", "*none*");
 
 $parent_options_array = array (
+	"tabs" => array( 'general' ),
+	
+	"general" => array(
+			"name"		=> "General",
+			"type"		=> "tab",
+			"contents"	=> array(
+				"style_options" => array(	"name" => "Style Options",
+						"type" => "subhead"),
 
-	"style_options" => array(	"name" => "Style Options",
-			"type" => "subhead"),
+				"layout_stylesheet" => array(	"name" => "Layout Stylesheet",
+						"desc" => "Place additional layout stylesheets in <code>" . TEMPLATEPATH . "/layouts/</code> to add them as layout options",
+			    		"std" => "Select a layout:",
+			    		"type" => "select",
+			    		"options" => $layouts),
 
-	"layout_stylesheet" => array(	"name" => "Layout Stylesheet",
-			"desc" => "Place additional layout stylesheets in <code>" . TEMPLATEPATH . "/layouts/</code> to add them as layout options",
-    		"std" => "Select a layout:",
-    		"type" => "select",
-    		"options" => $layouts),
+				"alt_stylesheet" => array(	"name" => "Theme Stylesheet",
+						"desc" => "Place additional theme stylesheets and assets in <code>" . TEMPLATEPATH . "/styles/</code> to add them as styling options",
+					    "std" => "Select a stylesheet:",
+					    "type" => "select",
+					    "options" => $alt_stylesheets),
 
-	"alt_stylesheet" => array(	"name" => "Theme Stylesheet",
-			"desc" => "Place additional theme stylesheets and assets in <code>" . TEMPLATEPATH . "/styles/</code> to add them as styling options",
-		    "std" => "Select a stylesheet:",
-		    "type" => "select",
-		    "options" => $alt_stylesheets),
+				"use_custom_header" => array(	"name" => "Use Custom Headers",
+						"desc" => 'Check this box if you wish to use WordPress\'s built-in <a href="http://codex.wordpress.org/Custom_Headers">Custom Header Image API</a> to define a custom image for your theme',
+						"std" => "1",
+						"type" => "checkbox"),
 
-	"use_custom_header" => array(	"name" => "Use Custom Headers",
-			"desc" => 'Check this box if you wish to use WordPress\'s built-in <a href="http://codex.wordpress.org/Custom_Headers">Custom Header Image API</a> to define a custom image for your theme',
-			"std" => "1",
-			"type" => "checkbox"),
+				"blog_meta_info" => array(	"name" => "Blog Meta Info",
+						"type" => "subhead"),
 
-	"blog_meta_info" => array(	"name" => "Blog Meta Info",
-			"type" => "subhead"),
+				"display_footer_copyright" => array(	"name" => "Display Copyright",
+						"desc" => "Check this box to display your copyright information in the footer.", 
+						"std" => "1",
+						"type" => "checkbox"),
 
-	"display_footer_copyright" => array(	"name" => "Display Copyright",
-			"desc" => "Check this box to display your copyright information in the footer.", 
-			"std" => "1",
-			"type" => "checkbox"),
+				"footer_copyright" => array(	"name" => "Copyright Statement",
+						"desc" => "The following text will be displayed by default: <b><p>" . get_bloginfo('name') . " " . lblg_copyright() . "</p></b>",
+						"std" => "",
+						"type" => "textarea",
+						"options" => array("rows" => "5",
+										   "cols" => "40") ),
 
-	"footer_copyright" => array(	"name" => "Copyright Statement",
-			"desc" => "The following text will be displayed by default: <b><p>" . get_bloginfo('name') . " " . lblg_copyright() . "</p></b>",
-			"std" => "",
-			"type" => "textarea",
-			"options" => array("rows" => "5",
-							   "cols" => "40") ),
+				"display_footer_credits" => array(	"name" => "Display Credits",
+						"desc" => "Check this box to display your site credits in the footer.", 
+						"std" => "1",
+						"type" => "checkbox"),
 
-	"display_footer_credits" => array(	"name" => "Display Credits",
-			"desc" => "Check this box to display your site credits in the footer.", 
-			"std" => "1",
-			"type" => "checkbox"),
+				"footer_credit_text" => array(	"name" => "Footer Credits",
+						"desc" => "Footer credit text defaults to: <b><p>Powered by <a href=\"http://wordpress.org\">WordPress</a> " . get_bloginfo('version') . " and <a href=\"http://literalbarrage.org/blog/code/elbee-elgee\">Elbee Elgee</a></p></b> Change it to fit your site. (I'd appreciate the link love, though, if you'd leave it in...)  HTML should work just fine, raw PHP not so much. ",
+						"std" => "",
+						"type" => "textarea",
+						"options" => array("rows" => "5",
+										   "cols" => "40") ),
+			)
+	),
 
-	"footer_credit_text" => array(	"name" => "Footer Credits",
-			"desc" => "Footer credit text defaults to: <b><p>Powered by <a href=\"http://wordpress.org\">WordPress</a> " . get_bloginfo('version') . " and <a href=\"http://literalbarrage.org/blog/code/elbee-elgee\">Elbee Elgee</a></p></b> Change it to fit your site. (I'd appreciate the link love, though, if you'd leave it in...)  HTML should work just fine, raw PHP not so much. ",
-			"std" => "",
-			"type" => "textarea",
-			"options" => array("rows" => "5",
-							   "cols" => "40") ),
+
 );
 
 if( function_exists('bp_get_loggedin_user_nav') ) {
-	$parent_options_array['bp_subhead'] = array( "name" => "BuddyPress-specific Options",
-										"type" => "subhead" );
-	
-	$parent_options_array['disable_bp_js'] = array( "name" => "Disable BuddyPress JavaScript/AJAX",
-											"desc" => "Elbee Elgee automatically integrates the BuddyPress default theme javascript and AJAX functionality. You may switch this off, though the experience will degrade somewhat.",
-											"std" => "0",
-											"type" => "checkbox" );
-	
-	$parent_options_array['disable_bp_css'] = array( "name" => "Disable BuddyPress CSS",
-											"desc" => "Elbee Elgee comes with basic CSS styles that give BuddyPress pages a standard look and feel. You can extend upon these styles in your child theme's CSS or simply disable them and construct your own.",
-											"std" => "0",
-											"type" => "checkbox" );
+	$parent_options_array['tabs'][] = 'buddypress';
+	$parent_options_array['buddypress'] = array(
+		"name"		=> "BuddyPress",
+		"type"		=> "tab",
+		"contents"	=> array(
+			"bp_subhead" => array( "name" => "BuddyPress-specific Options",
+								   "type" => "subhead" ),
+			
+			"disable_bp_js" => array( "name" => "Disable BuddyPress JavaScript/AJAX",
+									  "desc" => "Elbee Elgee automatically integrates the BuddyPress default theme javascript and AJAX functionality. You may switch this off, though the experience will degrade somewhat.",
+									  "std" => "0",
+									  "type" => "checkbox" ),
+									
+			"disable_bp_css" => array( "name" => "Disable BuddyPress CSS",
+									   "desc" => "Elbee Elgee comes with basic CSS styles that give BuddyPress pages a standard look and feel. You can extend upon these styles in your child theme's CSS or simply disable them and construct your own.",
+									   "std" => "0",
+									   "type" => "checkbox" ),
+		),
+	);
 }
 
 $parent_theme_array[ 'options' ] = $parent_options_array;