* @copyright Copyright (c) 2008 - 2015, Justin Tadlock * @link http://themehybrid.com/hybrid-core * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ if ( ! class_exists( 'Hybrid' ) ) { /** * The Hybrid class launches the framework. It's the organizational structure behind the * entire framework. This class should be loaded and initialized before anything else within * the theme is called to properly use the framework. * * After parent themes call the Hybrid class, they should perform a theme setup function on * the `after_setup_theme` hook with a priority no later than 11. This allows the class to * load theme-supported features at the appropriate time, which is on the `after_setup_theme` * hook with a priority of 12. * * Note that while it is possible to extend this class, it's not usually recommended unless * you absolutely know what you're doing and expect your sub-class to break on updates. This * class often gets modifications between versions. * * @since 0.7.0 * @access public */ class Hybrid { /** * Constructor method for the Hybrid class. This method adds other methods of the * class to specific hooks within WordPress. It controls the load order of the * required files for running the framework. * * @since 1.0.0 * @access public * @return void */ public function __construct() { // Set up an empty object to work with. $GLOBALS['hybrid'] = new stdClass; // Set up the load order. add_action( 'after_setup_theme', array( $this, 'constants' ), -95 ); add_action( 'after_setup_theme', array( $this, 'core' ), -95 ); add_action( 'after_setup_theme', array( $this, 'theme_support' ), 12 ); add_action( 'after_setup_theme', array( $this, 'includes' ), 13 ); add_action( 'after_setup_theme', array( $this, 'extensions' ), 14 ); add_action( 'after_setup_theme', array( $this, 'admin' ), 95 ); } /** * Defines the constant paths for use within the core framework, parent theme, and * child theme. * * @since 0.7.0 * @access public * @return void */ public function constants() { // Sets the framework version number. define( 'HYBRID_VERSION', '3.1.0' ); // Theme directory paths. define( 'HYBRID_PARENT', trailingslashit( get_template_directory() ) ); define( 'HYBRID_CHILD', trailingslashit( get_stylesheet_directory() ) ); // Theme directory URIs. define( 'HYBRID_PARENT_URI', trailingslashit( get_template_directory_uri() ) ); define( 'HYBRID_CHILD_URI', trailingslashit( get_stylesheet_directory_uri() ) ); // Sets the path to the core framework directory. if ( ! defined( 'HYBRID_DIR' ) ) define( 'HYBRID_DIR', trailingslashit( HYBRID_PARENT . basename( dirname( __FILE__ ) ) ) ); // Sets the path to the core framework directory URI. if ( ! defined( 'HYBRID_URI' ) ) define( 'HYBRID_URI', trailingslashit( HYBRID_PARENT_URI . basename( dirname( __FILE__ ) ) ) ); // Core framework directory paths. define( 'HYBRID_ADMIN', trailingslashit( HYBRID_DIR . 'admin' ) ); define( 'HYBRID_INC', trailingslashit( HYBRID_DIR . 'inc' ) ); define( 'HYBRID_EXT', trailingslashit( HYBRID_DIR . 'ext' ) ); define( 'HYBRID_CUSTOMIZE', trailingslashit( HYBRID_DIR . 'customize' ) ); // Core framework directory URIs. define( 'HYBRID_CSS', trailingslashit( HYBRID_URI . 'css' ) ); define( 'HYBRID_JS', trailingslashit( HYBRID_URI . 'js' ) ); } /** * Loads the core framework files. * * @since 1.0.0 * @access public * @return void */ public function core() { // Load the class files. require_once( HYBRID_INC . 'class-media-meta.php' ); require_once( HYBRID_INC . 'class-media-meta-factory.php' ); require_once( HYBRID_INC . 'class-media-grabber.php' ); // Load the functions files. require_once( HYBRID_INC . 'functions-attr.php' ); require_once( HYBRID_INC . 'functions-context.php' ); require_once( HYBRID_INC . 'functions-i18n.php' ); require_once( HYBRID_INC . 'functions-customize.php' ); require_once( HYBRID_INC . 'functions-filters.php' ); require_once( HYBRID_INC . 'functions-head.php' ); require_once( HYBRID_INC . 'functions-meta.php' ); require_once( HYBRID_INC . 'functions-sidebars.php' ); require_once( HYBRID_INC . 'functions-scripts.php' ); require_once( HYBRID_INC . 'functions-styles.php' ); require_once( HYBRID_INC . 'functions-utility.php' ); // Load the template files. require_once( HYBRID_INC . 'template.php' ); require_once( HYBRID_INC . 'template-comments.php' ); require_once( HYBRID_INC . 'template-general.php' ); require_once( HYBRID_INC . 'template-media.php' ); require_once( HYBRID_INC . 'template-post.php' ); } /** * Adds theme support for features that themes should be supporting. Also, removes * theme supported features from themes in the case that a user has a plugin installed * that handles the functionality. * * @since 1.3.0 * @access public * @return void */ public function theme_support() { // Automatically add