public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); try { $template = $compiler->getFilename(); if (Helper::hasBufferKey($template, $this->tag)) { $string = Helper::getBufferKey($template, $this->tag); } else { $string = "[{$this->tag}]"; // display a placeholder } } catch (\Exception $e) { $string = "[{$this->tag}]"; // display a placeholder } $compiler->raw("echo secure_string('{$string}');"); }
public function bufferHas($key, $withLayout = false) { $name = $withLayout ? $this->getLayout() : $this->getName(); return Helper::hasBufferKey($name, $key); }