Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * Boot up the main Stencil flow
  *
  * Triggered by the {FILTER_PREFIX}engine_ready hook
  * @see Environment::format_hook
  *
  * @param Stencil_Implementation $engine Boot Stencil with the supplied engine.
  */
 public static function boot(Stencil_Implementation $engine)
 {
     remove_action(Stencil_Environment::format_hook('engine_ready'), array(__CLASS__, __FUNCTION__));
     if (!isset(self::$instance)) {
         self::$instance = new Stencil($engine);
         /**
          * This cannot be inside the constructor:
          */
         Stencil_Environment::trigger('initialize', self::$instance);
     }
 }
Example #3
0
 /**
  * Detach hooks to load the wp_head and wp_footer variables
  */
 private function unhook_wp_header_and_footer()
 {
     /**
      * Add wp_head and wp_footer variable recording
      */
     remove_action(Stencil_Environment::format_hook('pre_display'), array($this, 'set_wp_head_footer'));
     remove_action(Stencil_Environment::format_hook('pre_fetch'), array($this, 'set_wp_head_footer'));
 }