Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function fetch($template)
 {
     $view = Laravel\View::make($template, $this->model);
     Laravel\Blade::sharpen();
     $responses = Laravel\Event::fire(Laravel\View::engine, array($view));
     return $responses[0];
 }
Ejemplo n.º 2
0
 /**
  * Handle the compilation of the templates
  * @param { str } template path
  * @return { str } compiled template path
  */
 public function template_include_blade($template)
 {
     if ($this->bladedTemplate) {
         return $this->bladedTemplate;
     }
     if (!$template) {
         return $template;
     }
     // Noting to do here. Come back later.
     require_once WP_BLADE_CONFIG_PATH . 'paths.php';
     Laravel\Blade::sharpen();
     $view = Laravel\View::make('path: ' . $template, array());
     $pathToCompiled = PATH_STORAGE . "/views/" . basename(Laravel\Blade::compiled($view->path)) . '.php';
     //k($pathToCompiled,$template);
     if (!file_exists($pathToCompiled) or Laravel\Blade::expired($view->view, $view->path) or filemtime($template) > filemtime($pathToCompiled)) {
         file_put_contents($pathToCompiled, "<?php // {$template} ?>\n" . Laravel\Blade::compile($view));
     }
     $this->engine or $this->engine = new TemplateEngine(get_template_directory());
     $pathToCompiled = $this->engine->display($pathToCompiled, true);
     $view->path = $pathToCompiled;
     if ($error = error_get_last()) {
         //var_dump($error);
         //exit;
     }
     return $this->bladedTemplate = $view->path;
 }
Ejemplo n.º 3
0
 /**
  * Handle the compilation of the templates
  * @param { str } template path
  * @return { str } compiled template path
  */
 public function template_include_blade($template)
 {
     if ($this->bladedTemplate) {
         return $this->bladedTemplate;
     }
     if (!$template) {
         return $template;
     }
     // Noting to do here. Come back later.
     require_once WP_BLADE_CONFIG_PATH . 'paths.php';
     Laravel\Blade::sharpen();
     $view = Laravel\View::make('path: ' . $template, array());
     $pathToCompiled = Laravel\Blade::compiled($view->path);
     if (!file_exists($pathToCompiled) or Laravel\Blade::expired($view->view, $view->path)) {
         file_put_contents($pathToCompiled, "<?php // {$template} ?>\n" . Laravel\Blade::compile($view));
     }
     $view->path = $pathToCompiled;
     if ($error = error_get_last()) {
         //var_dump($error);
         //exit;
     }
     return $this->bladedTemplate = $view->path;
 }