/** * Bootstrap constructor. */ public function __construct() { // Make sure we never bootstrap multiple times. if (true === self::$bootstrapped) { return; } /** * Initialize the plugin to check for registered addons * * Checking if a plugin is active with the "stencil-" prefix is not enough * The plugin could have not implemented the proper hook and could not be usable in the theme */ add_action('after_setup_theme', array(__CLASS__, 'boot')); /** * Allow implementation to be filtered */ add_filter(Stencil_Environment::format_filter('implementation'), array(__CLASS__, 'implementation')); /** * Boot Stencil when an engine is ready */ add_action(Stencil_Environment::format_hook('engine_ready'), array('Stencil', 'boot')); /** * Load plugin textdomain */ add_action('plugins_loaded', array(__CLASS__, 'load_textdomain')); /** * Boot up config if we are in the CMS. */ if (is_admin()) { new Stencil_Config(); new Stencil_Upgrader(); } self::$bootstrapped = true; }
/** * Exection hook * * @param Stencil_Interface $controller Controller that initiated this class. */ public function execute(Stencil_Interface $controller) { add_filter(Stencil_Environment::format_filter('views-custom'), array($this, 'set_template_as_first_option')); }