29 $stream = $this->parser->getStream();
31 $body = $this->parser->subparse(
array($this,
'decideBlockEnd'),
true);
36 foreach ($body as $node) {
37 if ($node instanceof
Twig_Node_Text && ctype_space($node->getAttribute(
'data'))) {
41 if (!$node instanceof Twig_Node_Include) {
42 throw new Twig_Error_Syntax(
'Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(),
$stream->getSourceContext());
52 return $token->
test(
'endsandbox');
61 class_alias(
'Twig_TokenParser_Sandbox',
'Twig\TokenParser\SandboxTokenParser',
false);
Represents an include node.
test($type, $values=null)
Tests the current token for a type and/or a value.
decideBlockEnd(Twig_Token $token)
Represents a sandbox node.
$stream
PHP stream implementation.
Exception thrown when a syntax error occurs during lexing or parsing of a template.
Base class for all token parsers.
Create styles array
The data for the language used.
getTag()
Gets the tag name associated with this token parser.
Marks a section of a template as untrusted code that must be evaluated in the sandbox mode...
parse(Twig_Token $token)
Parses a token and returns a node.