/** * Bootstrap. * * @return void */ public function boot() { $this->app['events']->listen('kernel.handled', function (Request $req, Response $res) { if ($this->app['config']->get('app.debug') && $res->headers->has('Content-Type') && strpos($res->headers->get('Content-Type'), 'html') !== false) { $res->setContent(Template::tidy($res->getContent())); } }); }
/** * Compile the view at the given path. * * @param string $path * @return void */ public function compile($path) { $file = $this->files->get($path); $contents = Template::compile($file); if (!is_null($this->cachePath)) { $compiledPath = $this->getCompiledPath($path); $this->files->put($compiledPath, $contents); } }
static function parse($tree) { extract($tree); if ($bool == '!') { $statement = "! ( {$statement} )"; } $node = Block::parse($node); $children = Template::parse($children); return "<?php if ({$statement}): ?>{$node}{$children}<?php endif; ?>"; }
static function parse($tree) { extract($tree); $attributes = static::setAttributes($attributes); $content = static::setContent($content); $children = Template::parse($children); if (static::isSelfClosingTag($tagName)) { return "<{$tagName}{$attributes} />"; } return "<{$tagName}{$attributes}>{$content}{$children}</{$tagName}>"; }
static function parse($tree) { extract($tree); $section = addcslashes($section, '"'); $content = static::setContent($content); $children = Template::parse($children); $output = "<?php \$__env->startSection(\"{$section}\"); ?>"; $output .= $content . $children; $output .= '<?php $__env->stopSection(); ?>'; return $output; }
static function parse($tree) { extract($tree); $section = addcslashes($section, '"'); $content = static::setContent($content); $children = Template::parse($children); $output = "<?php ob_start() ?>{$content}{$children}"; $output .= '<?php $__tmp = ob_get_clean(); ?>'; $output .= '<?= $__env->yieldContent("' . $section . '") ?: $__tmp ?>'; $output .= '<?php unset($__tmp); ?>'; return $output; }
static function parse($tree) { extract($tree); $view = addcslashes($view, '"'); $attributes = static::setAttributes($attributes); $children = Template::parse($children); $output = $children; $output .= "<?php extract({$attributes}); ?>"; $output .= '<?php $__d = array_except(get_defined_vars(), array("__data", "__path")) ?>'; $output .= "<?= \$__env->make(\"{$view}\", \$__d)->render(); ?>"; $output .= '<?php unset($__d) ?>'; return $output; }
static function parse($tree) { extract($tree); if (!$individual) { $individual = preg_match('/^\\$\\w+$/', $iterable) ? '$' . singular(trim($iterable, '$')) : '$item'; } if ($individual == $iterable) { $individual = '$item'; } $opening = "<?php foreach({$iterable} as \$i => {$individual}): ?>"; $node = Block::parse($node); $children = Template::parse($children); $closing = "<?php endforeach; ?>"; return $opening . $node . $children . $closing; }
static function parse($tree) { extract($tree); $view = addcslashes($view, '"'); $attributes = static::setAttributes($attributes); $content = static::setContent($content); $children = Template::parse($children); $output = "<?php ob_start() ?>{$content}{$children}"; $output .= '<?php $__tmp = ob_get_clean(); ?>'; $output .= "<?php extract({$attributes}); ?>"; $output .= '<?php $__d = array_except(get_defined_vars(), array("__data", "__path")) ?>'; $output .= '<?= $__env->make("' . $view . '", $__d)->render() ?: $__tmp ?>'; $output .= '<?php unset($__tmp, $__d); ?>'; return $output; }