/** * Theme functions and definitions. * * @package TSD_Master_Theme * @since 1.0.0 */ /** * Main TSDMASTER class. * * @since 1.0.0 */ final class TSDMASTER { /** * Theme options * * @since 1.0.0 * @var object */ public $options; /** * Theme fonts * * @since 1.0.0 * @var object */ public $fonts; /** * Theme icons * * @since 1.0.0 * @var object */ public $icons; /** * Theme customizer * * @since 1.0.0 * @var object */ public $customizer; /** * Theme admin * * @since 1.0.0 * @var object */ public $admin; /** * Singleton instance of the class. * * @since 1.0.0 * @var object */ private static $instance; /** * Theme version. * * @since 1.0.0 * @var string */ public $version = '1.0.27'; /** * Main TSDMASTER Instance. * * Insures that only one instance of TSDMASTER exists in memory at any one * time. Also prevents needing to define globals all over the place. * * @since 1.0.0 * @return TSDMASTER */ public static function instance() { if ( ! isset( self::$instance ) && ! ( self::$instance instanceof TSDMASTER ) ) { self::$instance = new TSDMASTER(); self::$instance->constants(); self::$instance->includes(); self::$instance->objects(); // Hook now that all of the TSDMASTER stuff is loaded. do_action( 'TSDMASTER_loaded' ); } return self::$instance; } /** * Setup constants. * * @since 1.0.0 * @return void */ private function constants() { if ( ! defined( 'TSDMASTER_THEME_VERSION' ) ) { define( 'TSDMASTER_THEME_VERSION', $this->version ); } if ( ! defined( 'TSDMASTER_THEME_URI' ) ) { define( 'TSDMASTER_THEME_URI', get_parent_theme_file_uri() ); } if ( ! defined( 'TSDMASTER_THEME_PATH' ) ) { define( 'TSDMASTER_THEME_PATH', get_parent_theme_file_path() ); } } /** * Include files. * * @since 1.0.0 * @return void */ public function includes() { require_once TSDMASTER_THEME_PATH . '/inc/common.php'; require_once TSDMASTER_THEME_PATH . '/inc/helpers.php'; require_once TSDMASTER_THEME_PATH . '/inc/widgets.php'; require_once TSDMASTER_THEME_PATH . '/inc/template-tags.php'; require_once TSDMASTER_THEME_PATH . '/inc/template-parts.php'; require_once TSDMASTER_THEME_PATH . '/inc/icon-functions.php'; require_once TSDMASTER_THEME_PATH . '/inc/breadcrumbs.php'; require_once TSDMASTER_THEME_PATH . '/inc/class-tsdmaster-dynamic-styles.php'; // Core. require_once TSDMASTER_THEME_PATH . '/inc/core/class-tsdmaster-options.php'; require_once TSDMASTER_THEME_PATH . '/inc/core/class-tsdmaster-enqueue-scripts.php'; require_once TSDMASTER_THEME_PATH . '/inc/core/class-tsdmaster-fonts.php'; require_once TSDMASTER_THEME_PATH . '/inc/core/class-tsdmaster-theme-setup.php'; // Compatibility. require_once TSDMASTER_THEME_PATH . '/inc/compatibility/woocommerce/class-tsdmaster-woocommerce.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/socialsnap/class-tsdmaster-socialsnap.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-wpforms.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-jetpack.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-beaver-themer.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-elementor.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-elementor-pro.php'; require_once TSDMASTER_THEME_PATH . '/inc/compatibility/class-tsdmaster-hfe.php'; if ( is_admin() ) { require_once TSDMASTER_THEME_PATH . '/inc/utilities/class-tsdmaster-plugin-utilities.php'; require_once TSDMASTER_THEME_PATH . '/inc/admin/class-tsdmaster-admin.php'; } new TSDMASTER_Enqueue_Scripts(); // Customizer. require_once TSDMASTER_THEME_PATH . '/inc/customizer/class-tsdmaster-customizer.php'; require_once TSDMASTER_THEME_PATH . '/inc/customizer/customizer-callbacks.php'; require_once TSDMASTER_THEME_PATH . '/inc/customizer/class-tsdmaster-section-ordering.php'; } /** * Setup objects to be used throughout the theme. * * @since 1.0.0 * @return void */ public function objects() { TSDMASTER()->options = new TSDMASTER_Options(); TSDMASTER()->fonts = new TSDMASTER_Fonts(); TSDMASTER()->icons = new TSDMASTER_Icons(); TSDMASTER()->customizer = new TSDMASTER_Customizer(); if ( is_admin() ) { TSDMASTER()->admin = new TSDMASTER_Admin(); } } } /** * The function which returns the one TSDMASTER instance. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: