<?php

/**
 * StartBox functions and definitions
 *
 * Sets up the theme and provides includes some default scripts
 *
 * For help with StartBox, visit http://docs.wpstartbox.com
 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
 * For more information about Child Themes see http://codex.wordpress.org/Theme_Development and http://codex.wordpress.org/Child_Themes
 *
 * @package StartBox
 * @link http://www.wpstartbox.com
 */
// Initialize StartBox, but only if a child theme hasn't already
if (!did_action('sb_init')) {
    require_once TEMPLATEPATH . '/includes/functions/startbox.php';
    StartBox::init();
}
 public function sb_includes()
 {
     // Include all Widgets, Plugins and Theme Options
     require_if_theme_supports('sb-galleriffic', PLUGINS_PATH . '/galleriffic.php');
     // Galleriffic Slideshows (not supported yet)
     require_if_theme_supports('sb-slideshows', PLUGINS_PATH . '/slideshows.php');
     // Slideshows Post Type
     require_if_theme_supports('sb-sidebars', PLUGINS_PATH . '/sidebars.php');
     // Sidebar manager
     require_if_theme_supports('sb-layouts', FUNCTIONS_PATH . '/layouts.php');
     // Theme Layouts
     foreach (glob(WIDGETS_PATH . '/*.php') as $widget) {
         require_once $widget;
     }
     // Widgets
     foreach (glob(ADMIN_PATH . '/*.php') as $admin) {
         require_if_theme_supports('sb-options', $admin);
     }
     // Theme Options
     require_if_theme_supports('sb-updates', FUNCTIONS_PATH . '/upgrade.php');
     // Update Manager
     // Check installed version, upgrade if needed (Credit: K2, http://getk2.com)
     $sb_version = get_option('startbox_version');
     if ($sb_version === false) {
         StartBox::install();
     } elseif (version_compare($sb_version, SB_VERSION, '<')) {
         StartBox::upgrade($sb_version);
     }
 }