forked from leftypol/leftypol
upgrade twig library
This commit is contained in:
parent
01857d176a
commit
9c48084f3b
163 changed files with 275 additions and 94 deletions
0
inc/lib/Twig/Node/Expression/Array.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Array.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/AssignName.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/AssignName.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Add.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Add.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/And.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/And.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseAnd.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseAnd.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseOr.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseOr.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseXor.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/BitwiseXor.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Concat.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Concat.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Div.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Div.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Equal.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Equal.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/FloorDiv.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/FloorDiv.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Greater.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Greater.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/GreaterEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/GreaterEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/In.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/In.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Less.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Less.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/LessEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/LessEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Mod.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Mod.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Mul.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Mul.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/NotEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/NotEqual.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/NotIn.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/NotIn.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Or.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Or.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Power.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Power.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Range.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Range.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Sub.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Binary/Sub.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/BlockReference.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/BlockReference.php
Normal file → Executable file
6
inc/lib/Twig/Node/Expression/Call.php
Normal file → Executable file
6
inc/lib/Twig/Node/Expression/Call.php
Normal file → Executable file
|
@ -146,7 +146,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
|||
|
||||
if (array_key_exists($name, $parameters)) {
|
||||
if (array_key_exists($pos, $parameters)) {
|
||||
throw new Twig_Error_Syntax(sprintf('Arguments "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
|
||||
throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
|
||||
}
|
||||
|
||||
$arguments[] = $parameters[$name];
|
||||
|
@ -164,8 +164,8 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
|||
}
|
||||
}
|
||||
|
||||
foreach (array_keys($parameters) as $name) {
|
||||
throw new Twig_Error_Syntax(sprintf('Unknown argument "%s" for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
|
||||
if (!empty($parameters)) {
|
||||
throw new Twig_Error_Syntax(sprintf('Unknown argument%s "%s" for %s "%s".', count($parameters) > 1 ? 's' : '' , implode('", "', array_keys($parameters)), $this->getAttribute('type'), $this->getAttribute('name')));
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
|
|
0
inc/lib/Twig/Node/Expression/Conditional.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Conditional.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Constant.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Constant.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/ExtensionReference.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/ExtensionReference.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Filter.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Filter.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Filter/Default.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Filter/Default.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Function.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Function.php
Normal file → Executable file
4
inc/lib/Twig/Node/Expression/GetAttr.php
Normal file → Executable file
4
inc/lib/Twig/Node/Expression/GetAttr.php
Normal file → Executable file
|
@ -32,10 +32,10 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
|
|||
|
||||
$compiler->raw(', ')->subcompile($this->getNode('attribute'));
|
||||
|
||||
if (count($this->getNode('arguments')) || Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) {
|
||||
if (count($this->getNode('arguments')) || Twig_Template::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) {
|
||||
$compiler->raw(', ')->subcompile($this->getNode('arguments'));
|
||||
|
||||
if (Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) {
|
||||
if (Twig_Template::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) {
|
||||
$compiler->raw(', ')->repr($this->getAttribute('type'));
|
||||
}
|
||||
|
||||
|
|
60
inc/lib/Twig/Node/Expression/MacroCall.php
Executable file
60
inc/lib/Twig/Node/Expression/MacroCall.php
Executable file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) 2012 Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a macro call node.
|
||||
*
|
||||
* @author Martin Hasoň <martin.hason@gmail.com>
|
||||
*/
|
||||
class Twig_Node_Expression_MacroCall extends Twig_Node_Expression
|
||||
{
|
||||
public function __construct(Twig_Node_Expression $template, $name, Twig_Node_Expression_Array $arguments, $lineno)
|
||||
{
|
||||
parent::__construct(array('template' => $template, 'arguments' => $arguments), array('name' => $name), $lineno);
|
||||
}
|
||||
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
{
|
||||
$namedNames = array();
|
||||
$namedCount = 0;
|
||||
$positionalCount = 0;
|
||||
foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) {
|
||||
$name = $pair['key']->getAttribute('value');
|
||||
if (!is_int($name)) {
|
||||
$namedCount++;
|
||||
$namedNames[$name] = 1;
|
||||
} elseif ($namedCount > 0) {
|
||||
throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for macro "%s".', $this->getAttribute('name')), $this->lineno);
|
||||
} else {
|
||||
$positionalCount++;
|
||||
}
|
||||
}
|
||||
|
||||
$compiler
|
||||
->raw('$this->callMacro(')
|
||||
->subcompile($this->getNode('template'))
|
||||
->raw(', ')->repr($this->getAttribute('name'))
|
||||
->raw(', ')->subcompile($this->getNode('arguments'))
|
||||
;
|
||||
|
||||
if ($namedCount > 0) {
|
||||
$compiler
|
||||
->raw(', ')->repr($namedNames)
|
||||
->raw(', ')->repr($namedCount)
|
||||
->raw(', ')->repr($positionalCount)
|
||||
;
|
||||
}
|
||||
|
||||
$compiler
|
||||
->raw(')')
|
||||
;
|
||||
}
|
||||
}
|
0
inc/lib/Twig/Node/Expression/MethodCall.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/MethodCall.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Name.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Name.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Parent.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Parent.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/TempName.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/TempName.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Constant.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Constant.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Defined.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Defined.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Divisibleby.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Divisibleby.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Even.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Even.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Null.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Null.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Odd.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Odd.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Sameas.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Test/Sameas.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Neg.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Neg.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Not.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Not.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Pos.php
Normal file → Executable file
0
inc/lib/Twig/Node/Expression/Unary/Pos.php
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue