????
Current Path : /home2/morganrand/backup.morganrand.com/wp-content/themes/wanderfuls/skins/ |
Current File : /home2/morganrand/backup.morganrand.com/wp-content/themes/wanderfuls/skins/skins.php |
<?php /** * Skin loader function & helpers * * @package Wanderfuls WordPress Theme * @subpackage Skins * @deprecated Since 3.0.0 */ /** * Skins Loader Class * * @since Wanderfuls 1.6.3 */ if ( ! class_exists( 'TB_Skin_Loader' ) ) { class TB_Skin_Loader { public static $current_skin; private $enabled; /** * Start things up * * @since 1.6.3 */ public function __construct() { //set_theme_mod( 'theme_skin', 'agent' ); // for testing // Get current skin self::$current_skin = $this->get_current_skin(); $current_skin = self::$current_skin; // Enabled $this->enabled = ( $current_skin && 'base' != $current_skin ) ? true : false; $this->enabled = apply_filters( 'tb_enable_skins', $this->enabled ); // Return if disabled if ( ! $this->enabled ) { return; } // Skins Paths define( 'TB_SKIN_DIR', TB_THEME_DIR .'/skins/' ); define( 'TB_SKIN_DIR_URI', TB_THEME_URI .'/skins/' ); // Admin if ( is_admin() ) { require_once( TB_SKIN_DIR .'skins-admin.php' ); } // Load skin if needed if ( $current_skin && 'base' != $current_skin ) { $this->load_skin(); } } /** * Array of available skins * * @since 1.6.3 */ public static function skins_array() { $github_repo = 'https://raw.githubusercontent.com/tbplorer/wanderfuls-sample-data/master/'; return apply_filters( 'tb_skins', array( 'base' => array ( 'core' => true, 'name' => _x( 'Base', 'Theme Skin', 'tb' ), 'screenshot' => $github_repo .'Base/screenshot.jpg', ), 'agent' => array( 'core' => true, 'name' => _x( 'Agent', 'Theme Skin', 'tb' ), 'class' => TB_SKIN_DIR .'classes/agent/agent-skin.php', 'screenshot' => $github_repo .'Agent/screenshot.jpg', ), 'neat' => array( 'core' => true, 'name' => _x( 'Neat', 'Theme Skin', 'tb' ), 'class' => TB_SKIN_DIR .'classes/neat/neat-skin.php', 'screenshot' => $github_repo .'Health-Care/screenshot.jpg', ), 'flat' => array( 'core' => true, 'name' => _x( 'Flat', 'Theme Skin', 'tb' ), 'class' => TB_SKIN_DIR .'classes/flat/flat-skin.php', 'screenshot' => TB_SKIN_DIR_URI .'classes/flat/screenshot.jpg', ), 'gaps' => array( 'core' => true, 'name' => _x( 'Gaps', 'Theme Skin', 'tb' ), 'class' => TB_SKIN_DIR .'classes/gaps/gaps-skin.php', 'screenshot' => TB_SKIN_DIR_URI .'classes/gaps/screenshot.jpg', ), /* Removed but can be re-added via theme filter "tb_skins" 'minimal-graphical' => array( 'core' => true, 'name' => __( 'Minimal Graphical', 'tb' ), 'class' => TB_SKIN_DIR .'classes/minimal-graphical/minimal-graphical-skin.php', ),*/ ) ); } /** * Returns the current skin * * @since 1.6.3 */ public function get_current_skin() { // Check URL if ( ! empty( $_GET['theme_skin'] ) ) { return $_GET['theme_skin']; } // Apply filters $skin = apply_filters( 'tb_active_skin', tb_get_mod( 'theme_skin', 'base' ) ); // Sanitize $skin = $skin ? $skin : 'base'; // Return current skin return $skin; } /** * Returns the correct class file for the current skin * * @since 1.6.3 */ public function current_skin_file( $active_skin ) { // Nothing needed for the base skin or an empty skin if ( 'base' == $active_skin || ! $active_skin ) { return; } // Get currect skin class to load later $skins = $this->skins_array(); $active_skin_array = wp_array_slice_assoc( $skins, array( $active_skin ) ); if ( is_array( $active_skin_array ) ) { $class_file = ! empty( $active_skin_array[$active_skin]['class'] ) ? $active_skin_array[$active_skin]['class'] : false; } // Return class file if one exists if ( file_exists( $class_file ) ) { return $class_file; } } /** * Load the active skin * * @since 1.6.3 */ public function load_skin() { // Get skin file $file = $this->current_skin_file( self::$current_skin ); // Load the file if it exists if ( $file ) { require_once( $file ); } } /** * Returns the current skin * * @since 1.6.3 */ public static function return_current_skin() { return self::$current_skin; } } } new TB_Skin_Loader(); /** * Helper function that returns active skin name * * @since 1.6.3 */ function tb_active_skin() { if ( class_exists( 'TB_Skin_Loader' ) ) { return TB_Skin_Loader::return_current_skin(); } }