/** * Construct the class and initialize engine * * @param Stencil_Implementation $engine Initilize Stencil with the supplied engine. */ private function __construct(Stencil_Implementation $engine) { // Set the handler class. self::$default_implementation_class = get_class($engine); // Set the internal handler. self::$handler = $this->get_handler($engine); // Flow is irrelevant for AJAX calls; as are header and footers. if (!defined('DOING_AJAX') || false === DOING_AJAX) { // For the default engine, load the wp_head and wp_footer into variables. self::$handler->load_wp_header_and_footer(true); // Set default flow. self::$flow = new Stencil_Flow(); } /** * Append the 'assets' directory to the template URI for easy access */ add_filter('template_directory_uri', array($this, 'append_assets_directory')); add_filter('stylesheet_directory_uri', array($this, 'append_assets_directory')); /** * Make sure we only load index.php * * This removes the need for the use of the constant to skip the default loading * which would be a very inconvenient thing to do when somebody wants to switch * themes. */ add_filter('template_include', array($this, 'template_include_override')); }