Example #1
0
 public function __construct(Context $context = null, UI $ui = null, $viewName = null)
 {
     if (strpos($viewName, 'stem-system.') === 0) {
         $viewPath = ILAB_STEM_VIEW_DIR;
         $viewName = str_replace('stem-system.', '', $viewName);
     } else {
         $viewPath = $context->rootPath . '/views/';
     }
     parent::__construct($context, $ui, $viewName);
     $cache = $ui->setting('options/views/cache');
     $this->blade = new BladeInstance($viewPath, $cache);
     $this->registerDirectives();
 }
Example #2
0
 public function __construct(Context $context = null, UI $ui = null, $viewName = null)
 {
     parent::__construct($context, $ui, $viewName);
     $loader = new \Twig_Loader_Filesystem($context->rootPath . '/views/');
     $args = ['autoescape' => false];
     $cache = $context->setting('options/views/cache');
     if ($cache && !$context->debug) {
         $args['cache'] = $context->rootPath . '/' . trim($cache, '/') . '/';
     }
     $this->twig = new \Twig_Environment($loader, $args);
     $this->twig->addExtension(new WordPressExtension());
     $this->twig->addTokenParser(new EnqueueTokenParser($context));
     $this->twig->addTokenParser(new HeaderFooterTokenParser($context, 'header'));
     $this->twig->addTokenParser(new HeaderFooterTokenParser($context, 'footer'));
     if (file_exists($context->ui->viewPath . $this->viewName . '.html.twig')) {
         $this->viewName .= '.html';
     }
 }