forked from leftypol/leftypol
Upgrade Twig library
This commit is contained in:
parent
22f3a95e0e
commit
0fe5528574
133 changed files with 5080 additions and 1386 deletions
|
@ -35,6 +35,19 @@ class Twig_TokenParser_Sandbox extends Twig_TokenParser
|
|||
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
||||
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
// in a sandbox tag, only include tags are allowed
|
||||
if (!$body instanceof Twig_Node_Include) {
|
||||
foreach ($body as $node) {
|
||||
if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$node instanceof Twig_Node_Include) {
|
||||
throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section', $node->getLine(), $this->parser->getFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag());
|
||||
}
|
||||
|
||||
|
@ -46,7 +59,7 @@ class Twig_TokenParser_Sandbox extends Twig_TokenParser
|
|||
/**
|
||||
* Gets the tag name associated with this token parser.
|
||||
*
|
||||
* @param string The tag name
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue