Commits

Doug Stewart committed 2d8db0d Merge

Okay, this merge has been one filled with blood, sweat and tears. /me crosses fingers

Comments (0)

Files changed (8)

 
 define( 'LBLG_FUNCTIONS_DIR',  get_template_directory() . '/includes/functions/' );
 
+// Functions and settings related to handling theme options
 require_once( LBLG_FUNCTIONS_DIR . 'options.php' );
 
+// Functions and settings related to handling the Custom Header functionality
 require_once( LBLG_FUNCTIONS_DIR . 'headers.php' );
 
+// Functions and settings related to the back-end theme admin page[s]
 require_once( LBLG_FUNCTIONS_DIR . 'admin.php' );
 
+// Functions and settings handling custom widgets functionality
 require_once( LBLG_FUNCTIONS_DIR . 'widgets.php' );
 
+// Registration of custom theme hooks
 require_once( LBLG_FUNCTIONS_DIR . 'hooks.php' );
 
+// Register theme support for various core WordPress functionality
 require_once( LBLG_FUNCTIONS_DIR . 'supports.php' );
 
-// Only load the BuddyPress-related code if BP is active
+// Custom functionality that doesn't fit in any other area
+require_once( LBLG_FUNCTIONS_DIR . 'custom.php' );
+
+// BuddyPress-related code, only loaded if BP is active
 if( function_exists( 'bp_init' ) )
 	require_once( LBLG_FUNCTIONS_DIR . 'buddypress.php' );
 
+// bbPress-related code, only loaded if bbP is active
 if( function_exists( 'bbp_get_current_user_id' ) )	
 	require_once( LBLG_FUNCTIONS_DIR . 'bbpress.php' );
 ?>

includes/functions/admin.php

 
 function lblg_admin_init(){
 	global $lblg_shortname;
-	register_setting( $lblg_shortname . '_lblg_options', $lblg_shortname . '_lblg_options', 'lblg_sanitize_options' );
+	register_setting( $lblg_shortname . '_theme_options', $lblg_shortname . '_theme_options', 'lblg_sanitize_options' );
 }
 
 // Display the theme options page
 <form method="post" action="options.php">
 <?php screen_icon( 'themes' ); ?>
 <h2 class="updatehook"><?php echo $themename; ?> settings 
-	<input name="<?php echo $lblg_shortname; ?>_lblg_options[save]" type="submit" class="button-primary" value="Save changes" />
-	<input name="<?php echo $lblg_shortname; ?>_lblg_options[reset]" type="submit" class="button-secondary" value="Reset to defaults" />
+	<input name="<?php echo $lblg_shortname; ?>_theme_options[save]" type="submit" class="button-primary" value="Save changes" />
+	<input name="<?php echo $lblg_shortname; ?>_theme_options[reset]" type="submit" class="button-secondary" value="Reset to defaults" />
 </h2>
 
 <?php 
 	if ( isset( $_REQUEST['settings-updated'] ) ) echo '<div id="message" class="updated under-h2"><p><strong>'.$themename.' settings updated.</strong></p></div>';
 
-	settings_fields( $lblg_shortname . '_lblg_options' ); 
+	settings_fields( $lblg_shortname . '_theme_options' ); 
 ?>
 <table class="form-table">
 <tbody>
 </table>
 
 <p class="submit">
-<input name="<?php echo $lblg_shortname; ?>_lblg_options[save]" type="submit" class="button-primary" value="Save changes" />
-<input name="<?php echo $lblg_shortname; ?>_lblg_options[reset]" type="submit" class="button-secondary" value="Reset to defaults" />
+<input name="<?php echo $lblg_shortname; ?>_theme_options[save]" type="submit" class="button-primary" value="Save changes" />
+<input name="<?php echo $lblg_shortname; ?>_theme_options[reset]" type="submit" class="button-secondary" value="Reset to defaults" />
 </p>
 </form>
 
 	//$lblg_num_values = array_count_values($lblg_default_options);
 	
 	$section = '';
-	$lblg_options_group = $lblg_shortname . '_lblg_options';
+	$lblg_options_group = $lblg_shortname . '_theme_options';
 	$options = $lblg_options;
 	$default_options = $lblg_default_options;
 

includes/functions/hooks.php

 */
 
 $lblg_meta_info = get_option('lblg_meta_info');
-$lblg_options = get_option($lblg_meta_info['shortname'] . "_lblg_options" );
+$lblg_options = get_option($lblg_meta_info['shortname'] . "_theme_options" );
 
 /*
 *  Action hooks

includes/functions/options.php

 	*  this should return an array() with keys 'shortname', 'themename',
 	*  and 'version'.
 	*/
-	$bootstrap_tmp = get_option( 'lblg_meta_info' );
+	
+	$parent_bootstrap = get_theme_data( trailingslashit( TEMPLATEPATH ) . 'style.css' );
+	$child_bootstrap = get_theme_data( trailingslashit( STYLESHEETPATH ) . 'style.css' );
+	
+	// If parent & child are the same theme, these should be equal
+	if( $parent_bootstrap['Short Name'] == $child_bootstrap['Short Name'] ){
+		$lblg_shortname = $parent_bootstrap['Short Name'];
+		$lblg_themename = $parent_bootstrap['Theme Name'];
+		$lblg_version = $parent_bootstrap['Version'];
+	} else {
+		$lblg_shortname = $child_bootstrap['Short Name'];
+		$lblg_themename = $child_bootstrap['Theme Name'];
+		$lblg_version = $child_bootstrap['Version'];
+	}
 
+	// Check to see whether we've been installed previously
+	$lblg_stored_options = get_option( $lblg_shortname . '_theme_options' );
+	
 	$temp_opts = lblg_get_default_options();
 	$lblg_default_options = $temp_opts['options'];
 
-	if( false === $bootstrap_tmp ){
+	if( false === $lblg_stored_options ){
 		// We haven't been installed yet.
-		//Assign the globals
-		$lblg_shortname = $temp_opts['shortname'];
-		$lblg_themename = $temp_opts['themename'];
-		$lblg_version = $temp_opts['version'];
 		$lblg_options = lblg_get_options_from_defaults();
-	} elseif( version_compare( $temp_opts['version'], $bootstrap_tmp['version'], '>' )) {
+	} elseif( version_compare( $lblg_version, $install_check['version'], '>' )) {
 		// New version of the options have been detected. Let's reload.
-		$lblg_shortname = $temp_opts['shortname'];
-		$lblg_themename = $temp_opts['themename'];
-		$lblg_version = $temp_opts['version'];
-		$tmp_options = get_option( $lblg_shortname . '_lblg_options' );
-		$lblg_options = $tmp_options + $lblg_default_options;
+		$lblg_options = $lblg_stored_options + $lblg_default_options;
 	} else {
 		// Nothing to see here. Move along. Move along.
-		$lblg_shortname = $bootstrap_tmp['shortname'];
-		$lblg_themename = $bootstrap_tmp['themename'];
-		$lblg_version = $bootstrap_tmp['version'];
-		$lblg_options = get_option( $lblg_shortname . '_lblg_options' );
+		$lblg_options = get_option( $lblg_shortname . '_theme_options' );
 		/*
 		*  This shouldn't happen, but it just might, so let's check
 		*  and then set up the options correctly.
 			$lblg_options = lblg_get_options_from_defaults();
 		}	
 	}
-	
-	$meta_options = array( 'shortname' => $lblg_shortname,
-						   'themename' => $lblg_themename,
-						   'version'   => $lblg_version);
-					
-	update_option( 'lblg_meta_info', $meta_options);
-	update_option( $lblg_shortname . '_lblg_options', $lblg_options );
+
+	update_option( $lblg_shortname . '_theme_options', $lblg_options );
 }
 
 function lblg_get_options_from_defaults(){

includes/functions/supports.php

 						   'after_widget' => '</li>', 
 						   'before_title' => '<h4>', 
 						   'after_title' => '</h4>' ) );
-	register_sidebar( array( 'name'=>'Bottom-Left' ) );
-	register_sidebar( array( 'name'=>'Bottom-Right' ) );
+	register_sidebar( array( 'name'=>'Bottom-Left',
+						   'before_widget' => '<li>', 
+						   'after_widget' => '</li>', 
+						   'before_title' => '<h4>', 
+						   'after_title' => '</h4>' ) );
+	register_sidebar( array( 'name'=>'Bottom-Right',
+						   'before_widget' => '<li>', 
+						   'after_widget' => '</li>', 
+						   'before_title' => '<h4>', 
+						   'after_title' => '</h4>' ) );
 }
 
 /*

includes/parent-options.php

 <?php
-$parent_theme_array[ 'parent_themename' ] = "Elbee Elgee";
-$parent_theme_array[ 'parent_shortname' ] = "lblg";
-$parent_theme_array[ 'parent_version' ] = '1.1';
-
 // Look for layout CSS files to auto-load
 $layout_path = TEMPLATEPATH . '/layouts/'; 
 $layouts = array();
-/*
-Theme Name: Elbee Elgee
-Theme URI: http://literalbarrage.org/blog/code/lblg
-Description: An extremely flexible 1, 2, or 3 column theme with over 30 possible layouts and support for widgetized sidebars, custom headers, custom backgrounds, custom navigation menus, BuddyPress and bbPress.
-Author: Doug Stewart
-Author URI: http://literalbarrage.org/blog/
-License: GPL v2
-License URI: http://www.gnu.org/licenses/gpl-2.0.html
-Version: 1.1.1
-Tags: buddypress, two-columns, three-columns, one-column, left-sidebar, right-sidebar, white, blue, fixed-width, flexible-width, custom-header, custom-menu, featured-images, sticky-post, theme-options
-*/
+/**
+ * Theme Name: Elbee Elgee
+ * Theme URI: http://literalbarrage.org/blog/code/lblg
+ * Short Name: lblg
+ * Support URI: http://literalbarrage.org/blog/forums/themes/lblg/
+ * Description: An extremely flexible 1, 2, or 3 column theme with over 30 possible layouts and support for widgetized sidebars, custom headers, custom backgrounds, custom navigation menus, BuddyPress and bbPress.
+ * Author: Doug Stewart
+ * Author URI: http://literalbarrage.org/blog/
+ * License: GPL v2
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
+ * Version: 1.1.1
+ * Tags: buddypress, two-columns, three-columns, one-column, left-sidebar, right-sidebar, white, blue, fixed-width, flexible-width, custom-header, custom-menu, featured-images, sticky-post, theme-options
+ *
+ * Elbee Elgee WordPress Theme, Copyright (C) 2011 Doug Stewart
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ **/
 
 /* @group Reset CSS 
    Based on YUI Reset CSS */

styles/layoutgala.css

-
-div#header h1{margin:0;padding-left:10px;background: #EEE;color: #79B30B}
+div#header{background:#bbb;}
+div#header h1 a{margin:0;padding-left:10px;background: #ddd;color: #79B30B;}
 div#header a{color: #79B30B}
 div#primarysb{background:#B9CAFF}
 div#secondarysb{background:#FF8539}