Project

General

Profile

« Previous | Next » 

Revision 1938

Added by darkviper over 11 years ago

update Twig template engine to version 1.13.1

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
25 Jul-2013 Build 1938 M.v.d.Decken(DarkViper)
15
! update Twig template engine to version 1.13.1
14 16
25 Jul-2013 Build 1937 M.v.d.Decken(DarkViper)
15 17
- unneeded file /framework/Modlanguage.php removed
16 18
24 Jul-2013 Build 1936 M.v.d.Decken(DarkViper)
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Test/IntegrationTestCase.php
12 12
/**
13 13
 * Integration test helper
14 14
 *
15
 * @package twig
16
 * @author  Fabien Potencier <fabien@symfony.com>
17
 * @author  Karma Dordrak <drak@zikula.org>
15
 * @author Fabien Potencier <fabien@symfony.com>
16
 * @author Karma Dordrak <drak@zikula.org>
18 17
 */
19 18
abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Test/Method.php
12 12
/**
13 13
 * Represents a method template test.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
class Twig_Test_Method extends Twig_Test
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Test/Function.php
12 12
/**
13 13
 * Represents a function template test.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
class Twig_Test_Function extends Twig_Test
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Test/Node.php
12 12
/**
13 13
 * Represents a template test as a Node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
class Twig_Test_Node extends Twig_Test
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Parser.php
13 13
/**
14 14
 * Default parser implementation.
15 15
 *
16
 * @package twig
17
 * @author  Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Parser implements Twig_ParserInterface
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/ExtensionInterface.php
12 12
/**
13 13
 * Interface implemented by extension classes.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
interface Twig_ExtensionInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser.php
12 12
/**
13 13
 * Base class for all token parsers.
14 14
 *
15
 * @package twig
16
 * @author  Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
abstract class Twig_TokenParser implements Twig_TokenParserInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/AutoEscape.php
18 18
 *
19 19
 * If autoescaping is disabled, then the value is false.
20 20
 *
21
 * @package    twig
22
 * @author     Fabien Potencier <fabien@symfony.com>
21
 * @author Fabien Potencier <fabien@symfony.com>
23 22
 */
24 23
class Twig_Node_AutoEscape extends Twig_Node
25 24
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Block.php
13 13
/**
14 14
 * Represents a block node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Block extends Twig_Node
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Set.php
12 12
/**
13 13
 * Represents a set node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Set extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Print.php
13 13
/**
14 14
 * Represents a node that outputs an expression.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Body.php
12 12
/**
13 13
 * Represents a body node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Body extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Sandbox.php
12 12
/**
13 13
 * Represents a sandbox node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Sandbox extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/If.php
13 13
/**
14 14
 * Represents an if node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_If extends Twig_Node
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression.php
13 13
/**
14 14
 * Abstract class for all nodes that represents an expression.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
abstract class Twig_Node_Expression extends Twig_Node
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Macro.php
12 12
/**
13 13
 * Represents a macro node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Macro extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Do.php
12 12
/**
13 13
 * Represents a do node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Do extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/BlockReference.php
13 13
/**
14 14
 * Represents a block call node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Constant.php
18 18
 *  {% endif %}
19 19
 * </pre>
20 20
 *
21
 * @package twig
22
 * @author  Fabien Potencier <fabien@symfony.com>
21
 * @author Fabien Potencier <fabien@symfony.com>
23 22
 */
24 23
class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
25 24
{
......
29 28
            ->raw('(')
30 29
            ->subcompile($this->getNode('node'))
31 30
            ->raw(' === constant(')
31
        ;
32

  
33
        if ($this->getNode('arguments')->hasNode(1)) {
34
            $compiler
35
                ->raw('get_class(')
36
                ->subcompile($this->getNode('arguments')->getNode(1))
37
                ->raw(')."::".')
38
            ;
39
        }
40

  
41
        $compiler
32 42
            ->subcompile($this->getNode('arguments')->getNode(0))
33 43
            ->raw('))')
34 44
        ;
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Sameas.php
12 12
/**
13 13
 * Checks if a variable is the same as another one (=== in PHP).
14 14
 *
15
 * @package twig
16
 * @author  Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Null.php
16 16
 *  {{ var is none }}
17 17
 * </pre>
18 18
 *
19
 * @package twig
20
 * @author  Fabien Potencier <fabien@symfony.com>
19
 * @author Fabien Potencier <fabien@symfony.com>
21 20
 */
22 21
class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
23 22
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Even.php
16 16
 *  {{ var is even }}
17 17
 * </pre>
18 18
 *
19
 * @package twig
20
 * @author  Fabien Potencier <fabien@symfony.com>
19
 * @author Fabien Potencier <fabien@symfony.com>
21 20
 */
22 21
class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test
23 22
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Defined.php
19 19
 * {% endif %}
20 20
 * </pre>
21 21
 *
22
 * @package twig
23
 * @author  Fabien Potencier <fabien@symfony.com>
22
 * @author Fabien Potencier <fabien@symfony.com>
24 23
 */
25 24
class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test
26 25
{
......
35 34

  
36 35
            $this->changeIgnoreStrictCheck($node);
37 36
        } else {
38
            throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine(), $compiler->getFilename());
37
            throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine());
39 38
        }
40 39
    }
41 40

  
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Divisibleby.php
16 16
 *  {% if loop.index is divisibleby(3) %}
17 17
 * </pre>
18 18
 *
19
 * @package twig
20
 * @author  Fabien Potencier <fabien@symfony.com>
19
 * @author Fabien Potencier <fabien@symfony.com>
21 20
 */
22 21
class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test
23 22
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Test/Odd.php
16 16
 *  {{ var is odd }}
17 17
 * </pre>
18 18
 *
19
 * @package twig
20
 * @author  Fabien Potencier <fabien@symfony.com>
19
 * @author Fabien Potencier <fabien@symfony.com>
21 20
 */
22 21
class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test
23 22
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Parent.php
13 13
/**
14 14
 * Represents a parent node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Expression_Parent extends Twig_Node_Expression
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/ExtensionReference.php
12 12
/**
13 13
 * Represents an extension call node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Filter/Default.php
16 16
 *  {{ var.foo|default('foo item on var is not defined') }}
17 17
 * </pre>
18 18
 *
19
 * @package twig
20
 * @author  Fabien Potencier <fabien@symfony.com>
19
 * @author Fabien Potencier <fabien@symfony.com>
21 20
 */
22 21
class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter
23 22
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/BlockReference.php
13 13
/**
14 14
 * Represents a block call node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Expression/Call.php
98 98
            if (!is_int($name)) {
99 99
                $named = true;
100 100
                $name = $this->normalizeName($name);
101
            } elseif ($named) {
102
                throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name')));
101 103
            }
104

  
102 105
            $parameters[$name] = $node;
103 106
        }
104 107

  
......
142 145
            $name = $this->normalizeName($param->name);
143 146

  
144 147
            if (array_key_exists($name, $parameters)) {
148
                if (array_key_exists($pos, $parameters)) {
149
                    throw new Twig_Error_Syntax(sprintf('Arguments "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name')));
150
                }
151

  
145 152
                $arguments[] = $parameters[$name];
146 153
                unset($parameters[$name]);
147 154
            } elseif (array_key_exists($pos, $parameters)) {
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Import.php
12 12
/**
13 13
 * Represents an import node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Import extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Embed.php
12 12
/**
13 13
 * Represents an embed node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Embed extends Twig_Node_Include
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/SandboxedModule.php
13 13
/**
14 14
 * Represents a module node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_SandboxedModule extends Twig_Node_Module
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/ForLoop.php
12 12
/**
13 13
 * Internal node used by the for node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_ForLoop extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Flush.php
12 12
/**
13 13
 * Represents a flush node.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Node_Flush extends Twig_Node
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Spaceless.php
14 14
 *
15 15
 * It removes spaces between HTML tags.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 */
20 19
class Twig_Node_Spaceless extends Twig_Node
21 20
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Include.php
13 13
/**
14 14
 * Represents an include node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/SandboxedPrint.php
17 17
 * and if the sandbox is enabled, we need to check that the __toString()
18 18
 * method is allowed if 'article' is an object.
19 19
 *
20
 * @package    twig
21
 * @author     Fabien Potencier <fabien@symfony.com>
20
 * @author Fabien Potencier <fabien@symfony.com>
22 21
 */
23 22
class Twig_Node_SandboxedPrint extends Twig_Node_Print
24 23
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Text.php
13 13
/**
14 14
 * Represents a text node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/Module.php
13 13
/**
14 14
 * Represents a module node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_Module extends Twig_Node
20 19
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Node/For.php
13 13
/**
14 14
 * Represents a for node.
15 15
 *
16
 * @package    twig
17
 * @author     Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
class Twig_Node_For extends Twig_Node
20 19
{
......
108 107
        $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n");
109 108

  
110 109
        // keep the values set in the inner context for variables defined in the outer context
111
        $compiler->write("\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent));\n");
110
        $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n");
112 111
    }
113 112
}
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Filter/Method.php
14 14
 *
15 15
 * Use Twig_SimpleFilter instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
class Twig_Filter_Method extends Twig_Filter
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Filter/Function.php
14 14
 *
15 15
 * Use Twig_SimpleFilter instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
class Twig_Filter_Function extends Twig_Filter
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Filter/Node.php
14 14
 *
15 15
 * Use Twig_SimpleFilter instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
class Twig_Filter_Node extends Twig_Filter
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/SimpleFunction.php
12 12
/**
13 13
 * Represents a template function.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_SimpleFunction
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/LexerInterface.php
12 12
/**
13 13
 * Interface implemented by lexer classes.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
interface Twig_LexerInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TestInterface.php
12 12
/**
13 13
 * Represents a template test.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
interface Twig_TestInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeInterface.php
12 12
/**
13 13
 * Represents a node in the AST.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
interface Twig_NodeInterface extends Countable, IteratorAggregate
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/FilterInterface.php
14 14
 *
15 15
 * Use Twig_SimpleFilter instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
interface Twig_FilterInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser/Set.php
49 49
            $stream->expect(Twig_Token::BLOCK_END_TYPE);
50 50

  
51 51
            if (count($names) !== count($values)) {
52
                throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignements.", $stream->getCurrent()->getLine(), $stream->getFilename());
52
                throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignments.", $stream->getCurrent()->getLine(), $stream->getFilename());
53 53
            }
54 54
        } else {
55 55
            $capture = true;
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser/Use.php
68 68
        $stream->expect(Twig_Token::BLOCK_END_TYPE);
69 69

  
70 70
        $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
71

  
72
        return null;
73 71
    }
74 72

  
75 73
    /**
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser/Macro.php
49 49
        $stream->expect(Twig_Token::BLOCK_END_TYPE);
50 50

  
51 51
        $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag()));
52

  
53
        return null;
54 52
    }
55 53

  
56 54
    public function decideBlockEnd(Twig_Token $token)
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser/Do.php
10 10
 */
11 11

  
12 12
/**
13
 * Evaluates an expression, disgarding the returned value.
13
 * Evaluates an expression, discarding the returned value.
14 14
 */
15 15
class Twig_TokenParser_Do extends Twig_TokenParser
16 16
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParser/Extends.php
38 38
        $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
39 39

  
40 40
        $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
41

  
42
        return null;
43 41
    }
44 42

  
45 43
    /**
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Sandbox/SecurityError.php
12 12
/**
13 13
 * Exception thrown when a security error occurs at runtime.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Sandbox_SecurityError extends Twig_Error
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Sandbox/SecurityPolicy.php
12 12
/**
13 13
 * Represents a security policy which need to be enforced when sandbox mode is enabled.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Sandbox/SecurityPolicyInterface.php
12 12
/**
13 13
 * Interfaces that all security policy classes must implements.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
interface Twig_Sandbox_SecurityPolicyInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Template.php
13 13
/**
14 14
 * Default base class for compiled templates.
15 15
 *
16
 * @package twig
17
 * @author  Fabien Potencier <fabien@symfony.com>
16
 * @author Fabien Potencier <fabien@symfony.com>
18 17
 */
19 18
abstract class Twig_Template implements Twig_TemplateInterface
20 19
{
......
337 336
     */
338 337
    protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
339 338
    {
340
        $item = ctype_digit((string) $item) ? (int) $item : (string) $item;
341

  
342 339
        // array
343 340
        if (Twig_TemplateInterface::METHOD_CALL !== $type) {
344
            if ((is_array($object) && array_key_exists($item, $object))
345
                || ($object instanceof ArrayAccess && isset($object[$item]))
341
            $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
342

  
343
            if ((is_array($object) && array_key_exists($arrayItem, $object))
344
                || ($object instanceof ArrayAccess && isset($object[$arrayItem]))
346 345
            ) {
347 346
                if ($isDefinedTest) {
348 347
                    return true;
349 348
                }
350 349

  
351
                return $object[$item];
350
                return $object[$arrayItem];
352 351
            }
353 352

  
354
            if (Twig_TemplateInterface::ARRAY_CALL === $type) {
353
            if (Twig_TemplateInterface::ARRAY_CALL === $type || !is_object($object)) {
355 354
                if ($isDefinedTest) {
356 355
                    return false;
357 356
                }
......
361 360
                }
362 361

  
363 362
                if (is_object($object)) {
364
                    throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName());
363
                    throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $arrayItem, get_class($object)), -1, $this->getTemplateName());
365 364
                } elseif (is_array($object)) {
366
                    throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $item, implode(', ', array_keys($object))), -1, $this->getTemplateName());
365
                    throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))), -1, $this->getTemplateName());
366
                } elseif (Twig_TemplateInterface::ARRAY_CALL === $type) {
367
                    throw new Twig_Error_Runtime(sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName());
367 368
                } else {
368
                    throw new Twig_Error_Runtime(sprintf('Impossible to access a key ("%s") on a "%s" variable', $item, gettype($object)), -1, $this->getTemplateName());
369
                    throw new Twig_Error_Runtime(sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName());
369 370
                }
370 371
            }
371 372
        }
......
379 380
                return null;
380 381
            }
381 382

  
382
            throw new Twig_Error_Runtime(sprintf('Item "%s" for "%s" does not exist', $item, is_array($object) ? 'Array' : $object), -1, $this->getTemplateName());
383
            throw new Twig_Error_Runtime(sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName());
383 384
        }
384 385

  
385 386
        $class = get_class($object);
386 387

  
387 388
        // object property
388 389
        if (Twig_TemplateInterface::METHOD_CALL !== $type) {
389
            if (isset($object->$item) || array_key_exists($item, $object)) {
390
            if (isset($object->$item) || array_key_exists((string) $item, $object)) {
390 391
                if ($isDefinedTest) {
391 392
                    return true;
392 393
                }
......
406 407

  
407 408
        $lcItem = strtolower($item);
408 409
        if (isset(self::$cache[$class]['methods'][$lcItem])) {
409
            $method = $item;
410
            $method = (string) $item;
410 411
        } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) {
411 412
            $method = 'get'.$item;
412 413
        } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) {
413 414
            $method = 'is'.$item;
414 415
        } elseif (isset(self::$cache[$class]['methods']['__call'])) {
415
            $method = $item;
416
            $method = (string) $item;
416 417
        } else {
417 418
            if ($isDefinedTest) {
418 419
                return false;
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParserInterface.php
12 12
/**
13 13
 * Interface implemented by token parsers.
14 14
 *
15
 * @package twig
16
 * @author  Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
interface Twig_TokenParserInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeVisitor/Sandbox.php
12 12
/**
13 13
 * Twig_NodeVisitor_Sandbox implements sandboxing.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeVisitor/Escaper.php
12 12
/**
13 13
 * Twig_NodeVisitor_Escaper implements output escaping.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeVisitor/Optimizer.php
17 17
 * You can configure which optimizations you want to activate via the
18 18
 * optimizer mode.
19 19
 *
20
 * @package twig
21
 * @author  Fabien Potencier <fabien@symfony.com>
20
 * @author Fabien Potencier <fabien@symfony.com>
22 21
 */
23 22
class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface
24 23
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeVisitor/SafeAnalysis.php
20 20
                }
21 21
            }
22 22
        }
23

  
24
        return null;
25 23
    }
26 24

  
27 25
    protected function setSafe(Twig_NodeInterface $node, array $safe)
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TestCallableInterface.php
12 12
/**
13 13
 * Represents a callable template test.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 * @deprecated since 1.12 (to be removed in 2.0)
18 17
 */
19 18
interface Twig_TestCallableInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Loader/Array.php
17 17
 * source code of the template). If you don't want to see your cache grows out of
18 18
 * control, you need to take care of clearing the old cache file by yourself.
19 19
 *
20
 * @package    twig
21
 * @author     Fabien Potencier <fabien@symfony.com>
20
 * @author Fabien Potencier <fabien@symfony.com>
22 21
 */
23 22
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
24 23
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Loader/Chain.php
12 12
/**
13 13
 * Loads templates from other loaders.
14 14
 *
15
 * @package twig
16
 * @author  Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
19 18
{
......
77 76
        }
78 77

  
79 78
        foreach ($this->loaders as $loader) {
80
            if ($loader instanceof Twig_ExistsLoaderInterface && $loader->exists($name)) {
81
                return $this->hasSourceCache[$name] = true;
79
            if ($loader instanceof Twig_ExistsLoaderInterface) {
80
                if ($loader->exists($name)) {
81
                    return $this->hasSourceCache[$name] = true;
82
                }
83

  
84
                continue;
82 85
            }
83 86

  
84 87
            try {
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Loader/Filesystem.php
12 12
/**
13 13
 * Loads template from the filesystem.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
19 18
{
......
25 24
     *
26 25
     * @param string|array $paths A path or an array of paths where to look for templates
27 26
     */
28
    public function __construct($paths)
27
    public function __construct($paths = array())
29 28
    {
30
        $this->setPaths($paths);
29
        if ($paths) {
30
            $this->setPaths($paths);
31
        }
31 32
    }
32 33

  
33 34
    /**
......
204 205
            throw new Twig_Error_Loader('A template name cannot contain NUL bytes.');
205 206
        }
206 207

  
208
        $name = ltrim($name, '/');
207 209
        $parts = explode('/', $name);
208 210
        $level = 0;
209 211
        foreach ($parts as $part) {
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Loader/String.php
21 21
 * source code of the template). If you don't want to see your cache grows out of
22 22
 * control, you need to take care of clearing the old cache file by yourself.
23 23
 *
24
 * @package    twig
25
 * @author     Fabien Potencier <fabien@symfony.com>
24
 * @author Fabien Potencier <fabien@symfony.com>
26 25
 */
27 26
class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
28 27
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/TokenParserBrokerInterface.php
15 15
 *
16 16
 * Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name.
17 17
 *
18
 * @package    twig
19
 * @author     Arnaud Le Blanc <arnaud.lb@gmail.com>
18
 * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
20 19
 * @deprecated since 1.12 (to be removed in 2.0)
21 20
 */
22 21
interface Twig_TokenParserBrokerInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeTraverser.php
14 14
 *
15 15
 * It visits all nodes and their children and call the given visitor for each.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 */
20 19
class Twig_NodeTraverser
21 20
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Function.php
14 14
 *
15 15
 * Use Twig_SimpleFunction instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/FilterCallableInterface.php
14 14
 *
15 15
 * Use Twig_SimpleFilter instead.
16 16
 *
17
 * @package    twig
18
 * @author     Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 * @deprecated since 1.12 (to be removed in 2.0)
20 19
 */
21 20
interface Twig_FilterCallableInterface
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Extension/Staging.php
14 14
 *
15 15
 * This class is used by Twig_Environment as a staging area and must not be used directly.
16 16
 *
17
 * @package twig
18
 * @author  Fabien Potencier <fabien@symfony.com>
17
 * @author Fabien Potencier <fabien@symfony.com>
19 18
 */
20 19
class Twig_Extension_Staging extends Twig_Extension
21 20
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Extension/StringLoader.php
33 33
 * Loads a template from a string.
34 34
 *
35 35
 * <pre>
36
 * {% include template_from_string("Hello {{ name }}") }}
36
 * {{ include(template_from_string("Hello {{ name }}")) }}
37 37
 * </pre>
38 38
 *
39 39
 * @param Twig_Environment $env      A Twig_Environment instance
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Extension/Debug.php
24 24
            // false means that it was not set (and the default is on) or it explicitly enabled
25 25
            // xdebug.overload_var_dump produces HTML only when html_errors is also enabled
26 26
            && (false === ini_get('html_errors') || ini_get('html_errors'))
27
            || 'cli' === php_sapi_name()
27 28
        ;
28 29

  
29 30
        return array(
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Extension/Core.php
152 152
            new Twig_SimpleFilter('split', 'twig_split_filter'),
153 153
            new Twig_SimpleFilter('sort', 'twig_sort_filter'),
154 154
            new Twig_SimpleFilter('merge', 'twig_array_merge'),
155
            new Twig_SimpleFilter('batch', 'twig_array_batch'),
155 156

  
156 157
            // string/array filters
157 158
            new Twig_SimpleFilter('reverse', 'twig_reverse_filter', array('needs_environment' => true)),
......
170 171
        );
171 172

  
172 173
        if (function_exists('mb_get_info')) {
173
            $filters['upper'] = new Twig_Filter_Function('twig_upper_filter', array('needs_environment' => true));
174
            $filters['lower'] = new Twig_Filter_Function('twig_lower_filter', array('needs_environment' => true));
174
            $filters[] = new Twig_SimpleFilter('upper', 'twig_upper_filter', array('needs_environment' => true));
175
            $filters[] = new Twig_SimpleFilter('lower', 'twig_lower_filter', array('needs_environment' => true));
175 176
        }
176 177

  
177 178
        return $filters;
......
190 191
            new Twig_SimpleFunction('cycle', 'twig_cycle'),
191 192
            new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
192 193
            new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
193
            new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true)),
194
            new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
194 195
        );
195 196
    }
196 197

  
......
514 515
}
515 516

  
516 517
/**
517
 * URL encodes a string.
518
 * URL encodes a string as a path segment or an array as a query string.
518 519
 *
519
 * @param string $url A URL
520
 * @param bool   $raw true to use rawurlencode() instead of urlencode
520
 * @param string|array $url A URL or an array of query parameters
521
 * @param bool         $raw true to use rawurlencode() instead of urlencode
521 522
 *
522 523
 * @return string The URL encoded value
523 524
 */
524 525
function twig_urlencode_filter($url, $raw = false)
525 526
{
527
    if (is_array($url)) {
528
        return http_build_query($url, '', '&');
529
    }
530

  
526 531
    if ($raw) {
527 532
        return rawurlencode($url);
528 533
    }
......
842 847
 */
843 848
function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
844 849
{
845
    if ($autoescape && is_object($string) && $string instanceof Twig_Markup) {
850
    if ($autoescape && $string instanceof Twig_Markup) {
846 851
        return $string;
847 852
    }
848 853

  
849
    if (!is_string($string) && !(is_object($string) && method_exists($string, '__toString'))) {
850
        return $string;
854
    if (!is_string($string)) {
855
        if (is_object($string) && method_exists($string, '__toString')) {
856
            $string = (string) $string;
857
        } else {
858
            return $string;
859
        }
851 860
    }
852 861

  
853 862
    if (null === $charset) {
854 863
        $charset = $env->getCharset();
855 864
    }
856 865

  
857
    $string = (string) $string;
866
    switch ($strategy) {
867
        case 'html':
868
            // see http://php.net/htmlspecialchars
858 869

  
859
    switch ($strategy) {
870
            // Using a static variable to avoid initializing the array
871
            // each time the function is called. Moving the declaration on the
872
            // top of the function slow downs other escaping strategies.
873
            static $htmlspecialcharsCharsets = array(
874
                'ISO-8859-1' => true, 'ISO8859-1' => true,
875
                'ISO-8859-15' => true, 'ISO8859-15' => true,
876
                'utf-8' => true, 'UTF-8' => true,
877
                'CP866' => true, 'IBM866' => true, '866' => true,
878
                'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true,
879
                '1251' => true,
880
                'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true,
881
                'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true,
882
                'BIG5' => true, '950' => true,
883
                'GB2312' => true, '936' => true,
884
                'BIG5-HKSCS' => true,
885
                'SHIFT_JIS' => true, 'SJIS' => true, '932' => true,
886
                'EUC-JP' => true, 'EUCJP' => true,
887
                'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true,
888
            );
889

  
890
            if (isset($htmlspecialcharsCharsets[$charset])) {
891
                return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
892
            }
893

  
894
            if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) {
895
                // cache the lowercase variant for future iterations
896
                $htmlspecialcharsCharsets[$charset] = true;
897

  
898
                return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
899
            }
900

  
901
            $string = twig_convert_encoding($string, 'UTF-8', $charset);
902
            $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
903

  
904
            return twig_convert_encoding($string, $charset, 'UTF-8');
905

  
860 906
        case 'js':
861 907
            // escape all non-alphanumeric characters
862 908
            // into their \xHH or \uHHHH representations
......
910 956

  
911 957
            return $string;
912 958

  
913
        case 'html':
914
            // see http://php.net/htmlspecialchars
915

  
916
            // Using a static variable to avoid initializing the array
917
            // each time the function is called. Moving the declaration on the
918
            // top of the function slow downs other escaping strategies.
919
            static $htmlspecialcharsCharsets = array(
920
                'iso-8859-1' => true, 'iso8859-1' => true,
921
                'iso-8859-15' => true, 'iso8859-15' => true,
922
                'utf-8' => true,
923
                'cp866' => true, 'ibm866' => true, '866' => true,
924
                'cp1251' => true, 'windows-1251' => true, 'win-1251' => true,
925
                '1251' => true,
926
                'cp1252' => true, 'windows-1252' => true, '1252' => true,
927
                'koi8-r' => true, 'koi8-ru' => true, 'koi8r' => true,
928
                'big5' => true, '950' => true,
929
                'gb2312' => true, '936' => true,
930
                'big5-hkscs' => true,
931
                'shift_jis' => true, 'sjis' => true, '932' => true,
932
                'euc-jp' => true, 'eucjp' => true,
933
                'iso8859-5' => true, 'iso-8859-5' => true, 'macroman' => true,
934
            );
935

  
936
            if (isset($htmlspecialcharsCharsets[strtolower($charset)])) {
937
                return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
938
            }
939

  
940
            $string = twig_convert_encoding($string, 'UTF-8', $charset);
941
            $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
942

  
943
            return twig_convert_encoding($string, $charset, 'UTF-8');
944

  
945 959
        case 'url':
946
            if (version_compare(PHP_VERSION, '5.3.0', '<')) {
960
            // hackish test to avoid version_compare that is much slower, this works unless PHP releases a 5.10.*
961
            // at that point however PHP 5.2.* support can be removed
962
            if (PHP_VERSION < '5.3.0') {
947 963
                return str_replace('%7E', '~', rawurlencode($string));
948 964
            }
949 965

  
......
1257 1273
/**
1258 1274
 * Renders a template.
1259 1275
 *
1260
 * @param string  template       The template to render
1261
 * @param array   variables      The variables to pass to the template
1262
 * @param Boolean with_context   Whether to pass the current context variables or not
1263
 * @param Boolean ignore_missing Whether to ignore missing templates or not
1264
 * @param Boolean sandboxed      Whether to sandbox the template or not
1276
 * @param string  $template       The template to render
1277
 * @param array   $variables      The variables to pass to the template
1278
 * @param Boolean $with_context   Whether to pass the current context variables or not
1279
 * @param Boolean $ignore_missing Whether to ignore missing templates or not
1280
 * @param Boolean $sandboxed      Whether to sandbox the template or not
1265 1281
 *
1266 1282
 * @return string The rendered template
1267 1283
 */
......
1279 1295
    }
1280 1296

  
1281 1297
    try {
1282
        return $env->resolveTemplate($template)->display($variables);
1298
        return $env->resolveTemplate($template)->render($variables);
1283 1299
    } catch (Twig_Error_Loader $e) {
1284 1300
        if (!$ignoreMissing) {
1285 1301
            throw $e;
......
1307 1323

  
1308 1324
    return constant($constant);
1309 1325
}
1326

  
1327
/**
1328
 * Batches item.
1329
 *
1330
 * @param array   $items An array of items
1331
 * @param integer $size  The size of the batch
1332
 * @param string  $fill  A string to fill missing items
1333
 *
1334
 * @return array
1335
 */
1336
function twig_array_batch($items, $size, $fill = null)
1337
{
1338
    if ($items instanceof Traversable) {
1339
        $items = iterator_to_array($items, false);
1340
    }
1341

  
1342
    $size = ceil($size);
1343

  
1344
    $result = array_chunk($items, $size, true);
1345

  
1346
    if (null !== $fill) {
1347
        $last = count($result) - 1;
1348
        $result[$last] = array_merge(
1349
            $result[$last],
1350
            array_fill(0, $size - count($result[$last]), $fill)
1351
        );
1352
    }
1353

  
1354
    return $result;
1355
}
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/NodeVisitorInterface.php
12 12
/**
13 13
 * Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
interface Twig_NodeVisitorInterface
19 18
{
......
33 32
     * @param Twig_NodeInterface $node The node to visit
34 33
     * @param Twig_Environment   $env  The Twig environment instance
35 34
     *
36
     * @return Twig_NodeInterface The modified node
35
     * @return Twig_NodeInterface|false The modified node or false if the node must be removed
37 36
     */
38 37
    public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
39 38

  
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/SimpleTest.php
12 12
/**
13 13
 * Represents a template test.
14 14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
15
 * @author Fabien Potencier <fabien@symfony.com>
17 16
 */
18 17
class Twig_SimpleTest
19 18
{
branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Error.php
29 29
 * can be disabled by passing false for both the filename and the line number
30 30
 * when creating a new instance of this class.
31 31
 *
32
 * @package    twig
33
 * @author     Fabien Potencier <fabien@symfony.com>
32
 * @author Fabien Potencier <fabien@symfony.com>
34 33
 */
35 34
class Twig_Error extends Exception
36 35
{
......
187 186
    protected function guessTemplateInfo()
188 187
    {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff