Version Description
- Fixed a few things on image handling
- Updated to Twig 1.15 (thanks @fabpot)
- Added wp_link_pages as TimberPost::pagination
- New filter to help with template selection (thanks @zlove)
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 0.16.4 |
Comparing to | |
See all releases |
Code changes from version 0.16.3 to 0.16.4
- Twig/CHANGELOG +6 -1
- Twig/LICENSE +0 -0
- Twig/README.rst +15 -0
- Twig/lib/Twig/Autoloader.php +0 -0
- Twig/lib/Twig/Compiler.php +0 -0
- Twig/lib/Twig/CompilerInterface.php +0 -0
- Twig/lib/Twig/Environment.php +2 -10
- Twig/lib/Twig/Error.php +0 -0
- Twig/lib/Twig/Error/Loader.php +0 -0
- Twig/lib/Twig/Error/Runtime.php +0 -0
- Twig/lib/Twig/Error/Syntax.php +0 -0
- Twig/lib/Twig/ExistsLoaderInterface.php +1 -1
- Twig/lib/Twig/ExpressionParser.php +10 -20
- Twig/lib/Twig/Extension.php +1 -1
- Twig/lib/Twig/Extension/Core.php +42 -4
- Twig/lib/Twig/Extension/Debug.php +0 -0
- Twig/lib/Twig/Extension/Escaper.php +1 -1
- Twig/lib/Twig/Extension/Optimizer.php +0 -0
- Twig/lib/Twig/Extension/Sandbox.php +1 -1
- Twig/lib/Twig/Extension/Staging.php +0 -0
- Twig/lib/Twig/Extension/StringLoader.php +0 -0
- Twig/lib/Twig/ExtensionInterface.php +1 -1
- Twig/lib/Twig/Filter.php +0 -0
- Twig/lib/Twig/Filter/Function.php +0 -0
- Twig/lib/Twig/Filter/Method.php +0 -0
- Twig/lib/Twig/Filter/Node.php +0 -0
- Twig/lib/Twig/FilterCallableInterface.php +0 -0
- Twig/lib/Twig/FilterInterface.php +0 -0
- Twig/lib/Twig/Function.php +0 -0
- Twig/lib/Twig/Function/Function.php +0 -0
- Twig/lib/Twig/Function/Method.php +0 -0
- Twig/lib/Twig/Function/Node.php +0 -0
- Twig/lib/Twig/FunctionCallableInterface.php +0 -0
- Twig/lib/Twig/FunctionInterface.php +0 -0
- Twig/lib/Twig/Lexer.php +0 -1
- Twig/lib/Twig/LexerInterface.php +0 -0
- Twig/lib/Twig/Loader/Array.php +0 -0
- Twig/lib/Twig/Loader/Chain.php +0 -0
- Twig/lib/Twig/Loader/Filesystem.php +0 -0
- Twig/lib/Twig/Loader/String.php +0 -0
- Twig/lib/Twig/LoaderInterface.php +0 -0
- Twig/lib/Twig/Markup.php +0 -0
- Twig/lib/Twig/Node.php +0 -0
- Twig/lib/Twig/Node/AutoEscape.php +0 -0
- Twig/lib/Twig/Node/Block.php +0 -0
- Twig/lib/Twig/Node/BlockReference.php +0 -0
- Twig/lib/Twig/Node/Body.php +0 -0
- Twig/lib/Twig/Node/Do.php +0 -0
- Twig/lib/Twig/Node/Embed.php +0 -0
- Twig/lib/Twig/Node/Expression.php +0 -0
- Twig/lib/Twig/Node/Expression/Array.php +0 -0
- Twig/lib/Twig/Node/Expression/AssignName.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Add.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/And.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Concat.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Div.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/EndsWith.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Equal.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Greater.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/In.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Less.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/LessEqual.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Matches.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Mod.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Mul.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/NotEqual.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/NotIn.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Or.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Power.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Range.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/StartsWith.php +0 -0
- Twig/lib/Twig/Node/Expression/Binary/Sub.php +0 -0
- Twig/lib/Twig/Node/Expression/BlockReference.php +0 -0
- Twig/lib/Twig/Node/Expression/Call.php +0 -0
- Twig/lib/Twig/Node/Expression/Conditional.php +0 -0
- Twig/lib/Twig/Node/Expression/Constant.php +0 -0
- Twig/lib/Twig/Node/Expression/ExtensionReference.php +0 -0
- Twig/lib/Twig/Node/Expression/Filter.php +0 -0
- Twig/lib/Twig/Node/Expression/Filter/Default.php +0 -0
- Twig/lib/Twig/Node/Expression/Function.php +0 -0
- Twig/lib/Twig/Node/Expression/GetAttr.php +0 -0
- Twig/lib/Twig/Node/Expression/MethodCall.php +0 -0
- Twig/lib/Twig/Node/Expression/Name.php +0 -0
- Twig/lib/Twig/Node/Expression/Parent.php +0 -0
- Twig/lib/Twig/Node/Expression/TempName.php +0 -0
- Twig/lib/Twig/Node/Expression/Test.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Constant.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Defined.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Divisibleby.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Even.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Null.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Odd.php +0 -0
- Twig/lib/Twig/Node/Expression/Test/Sameas.php +0 -0
- Twig/lib/Twig/Node/Expression/Unary.php +0 -0
- Twig/lib/Twig/Node/Expression/Unary/Neg.php +0 -0
- Twig/lib/Twig/Node/Expression/Unary/Not.php +0 -0
- Twig/lib/Twig/Node/Expression/Unary/Pos.php +0 -0
- Twig/lib/Twig/Node/Flush.php +0 -0
- Twig/lib/Twig/Node/For.php +0 -0
- Twig/lib/Twig/Node/ForLoop.php +0 -0
- Twig/lib/Twig/Node/If.php +0 -0
- Twig/lib/Twig/Node/Import.php +0 -0
- Twig/lib/Twig/Node/Include.php +0 -0
- Twig/lib/Twig/Node/Macro.php +0 -0
- Twig/lib/Twig/Node/Module.php +0 -0
- Twig/lib/Twig/Node/Print.php +0 -0
- Twig/lib/Twig/Node/Sandbox.php +0 -0
- Twig/lib/Twig/Node/SandboxedModule.php +0 -0
- Twig/lib/Twig/Node/SandboxedPrint.php +0 -0
- Twig/lib/Twig/Node/Set.php +0 -0
- Twig/lib/Twig/Node/SetTemp.php +0 -0
- Twig/lib/Twig/Node/Spaceless.php +0 -0
- Twig/lib/Twig/Node/Text.php +0 -0
- Twig/lib/Twig/NodeInterface.php +0 -0
- Twig/lib/Twig/NodeOutputInterface.php +0 -0
- Twig/lib/Twig/NodeTraverser.php +3 -3
- Twig/lib/Twig/NodeVisitor/Escaper.php +0 -0
- Twig/lib/Twig/NodeVisitor/Optimizer.php +1 -1
- Twig/lib/Twig/NodeVisitor/SafeAnalysis.php +0 -0
- Twig/lib/Twig/NodeVisitor/Sandbox.php +0 -0
- Twig/lib/Twig/NodeVisitorInterface.php +0 -0
- Twig/lib/Twig/Parser.php +1 -1
- Twig/lib/Twig/ParserInterface.php +0 -0
- Twig/lib/Twig/Sandbox/SecurityError.php +0 -0
- Twig/lib/Twig/Sandbox/SecurityPolicy.php +0 -0
- Twig/lib/Twig/Sandbox/SecurityPolicyInterface.php +0 -0
- Twig/lib/Twig/SimpleFilter.php +0 -0
- Twig/lib/Twig/SimpleFunction.php +0 -0
- Twig/lib/Twig/SimpleTest.php +0 -0
- Twig/lib/Twig/Template.php +12 -1
- Twig/lib/Twig/TemplateInterface.php +0 -0
- Twig/lib/Twig/Test.php +0 -0
- Twig/lib/Twig/Test/Function.php +0 -0
- Twig/lib/Twig/Test/IntegrationTestCase.php +0 -0
- Twig/lib/Twig/Test/Method.php +0 -0
- Twig/lib/Twig/Test/Node.php +0 -0
- Twig/lib/Twig/Test/NodeTestCase.php +0 -0
- Twig/lib/Twig/TestCallableInterface.php +0 -0
- Twig/lib/Twig/TestInterface.php +0 -0
- Twig/lib/Twig/Token.php +0 -0
- Twig/lib/Twig/TokenParser.php +0 -0
- Twig/lib/Twig/TokenParser/AutoEscape.php +0 -0
- Twig/lib/Twig/TokenParser/Block.php +3 -5
- Twig/lib/Twig/TokenParser/Do.php +0 -0
- Twig/lib/Twig/TokenParser/Embed.php +0 -0
- Twig/lib/Twig/TokenParser/Extends.php +0 -0
- Twig/lib/Twig/TokenParser/Filter.php +0 -0
- Twig/lib/Twig/TokenParser/Flush.php +0 -0
- Twig/lib/Twig/TokenParser/For.php +1 -2
- Twig/lib/Twig/TokenParser/From.php +2 -6
- Twig/lib/Twig/TokenParser/If.php +0 -0
- Twig/lib/Twig/TokenParser/Import.php +0 -0
- Twig/lib/Twig/TokenParser/Include.php +3 -8
- Twig/lib/Twig/TokenParser/Macro.php +2 -2
- Twig/lib/Twig/TokenParser/Sandbox.php +0 -0
- Twig/lib/Twig/TokenParser/Set.php +1 -2
- Twig/lib/Twig/TokenParser/Spaceless.php +0 -0
- Twig/lib/Twig/TokenParser/Use.php +3 -9
- Twig/lib/Twig/TokenParserBroker.php +0 -0
- Twig/lib/Twig/TokenParserBrokerInterface.php +0 -0
- Twig/lib/Twig/TokenParserInterface.php +0 -0
- Twig/lib/Twig/TokenStream.php +14 -2
- functions/timber-function-wrapper.php +1 -2
- functions/timber-helper.php +2 -2
- functions/timber-image-helper.php +13 -4
- functions/timber-loader.php +1 -0
- functions/timber-post.php +46 -3
- readme.txt +7 -1
- timber.php +2 -3
Twig/CHANGELOG
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
-
* 1.15.0 (2013-
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
* added a source function to include the content of a template without rendering it
|
4 |
* fixed the C extension sandbox behavior when get or set is prepend to method name
|
5 |
|
1 |
+
* 1.15.0 (2013-12-06)
|
2 |
|
3 |
+
* made ignoreStrictCheck in Template::getAttribute() works with __call() methods throwing BadMethodCallException
|
4 |
+
* added min and max functions
|
5 |
+
* added the round filter
|
6 |
+
* fixed a bug that prevented the optimizers to be enabled/disabled selectively
|
7 |
+
* fixed first and last filters for UTF-8 strings
|
8 |
* added a source function to include the content of a template without rendering it
|
9 |
* fixed the C extension sandbox behavior when get or set is prepend to method name
|
10 |
|
Twig/LICENSE
CHANGED
File without changes
|
Twig/README.rst
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Twig, the flexible, fast, and secure template language for PHP
|
2 |
+
==============================================================
|
3 |
+
|
4 |
+
Twig is a template language for PHP, released under the new BSD license (code
|
5 |
+
and documentation).
|
6 |
+
|
7 |
+
Twig uses a syntax similar to the Django and Jinja template languages which
|
8 |
+
inspired the Twig runtime environment.
|
9 |
+
|
10 |
+
More Information
|
11 |
+
----------------
|
12 |
+
|
13 |
+
Read the `documentation`_ for more information.
|
14 |
+
|
15 |
+
.. _documentation: http://twig.sensiolabs.org/documentation
|
Twig/lib/Twig/Autoloader.php
CHANGED
File without changes
|
Twig/lib/Twig/Compiler.php
CHANGED
File without changes
|
Twig/lib/Twig/CompilerInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Environment.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
class Twig_Environment
|
18 |
{
|
19 |
-
const VERSION = '1.
|
20 |
|
21 |
protected $charset;
|
22 |
protected $loader;
|
@@ -44,7 +44,6 @@ class Twig_Environment
|
|
44 |
protected $functionCallbacks;
|
45 |
protected $filterCallbacks;
|
46 |
protected $staging;
|
47 |
-
protected $templateClasses;
|
48 |
|
49 |
/**
|
50 |
* Constructor.
|
@@ -108,7 +107,6 @@ class Twig_Environment
|
|
108 |
$this->setCache($options['cache']);
|
109 |
$this->functionCallbacks = array();
|
110 |
$this->filterCallbacks = array();
|
111 |
-
$this->templateClasses = array();
|
112 |
|
113 |
$this->addExtension(new Twig_Extension_Core());
|
114 |
$this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
|
@@ -264,13 +262,7 @@ class Twig_Environment
|
|
264 |
*/
|
265 |
public function getTemplateClass($name, $index = null)
|
266 |
{
|
267 |
-
$
|
268 |
-
$cls = $name.$suffix;
|
269 |
-
if (isset($this->templateClasses[$cls])) {
|
270 |
-
return $this->templateClasses[$cls];
|
271 |
-
}
|
272 |
-
|
273 |
-
return $this->templateClasses[$cls] = $this->templateClassPrefix.hash('sha256', $this->getLoader()->getCacheKey($name)).$suffix;
|
274 |
}
|
275 |
|
276 |
/**
|
16 |
*/
|
17 |
class Twig_Environment
|
18 |
{
|
19 |
+
const VERSION = '1.15.0';
|
20 |
|
21 |
protected $charset;
|
22 |
protected $loader;
|
44 |
protected $functionCallbacks;
|
45 |
protected $filterCallbacks;
|
46 |
protected $staging;
|
|
|
47 |
|
48 |
/**
|
49 |
* Constructor.
|
107 |
$this->setCache($options['cache']);
|
108 |
$this->functionCallbacks = array();
|
109 |
$this->filterCallbacks = array();
|
|
|
110 |
|
111 |
$this->addExtension(new Twig_Extension_Core());
|
112 |
$this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
|
262 |
*/
|
263 |
public function getTemplateClass($name, $index = null)
|
264 |
{
|
265 |
+
return $this->templateClassPrefix.hash('sha256', $this->getLoader()->getCacheKey($name)).(null === $index ? '' : '_'.$index);
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
/**
|
Twig/lib/Twig/Error.php
CHANGED
File without changes
|
Twig/lib/Twig/Error/Loader.php
CHANGED
File without changes
|
Twig/lib/Twig/Error/Runtime.php
CHANGED
File without changes
|
Twig/lib/Twig/Error/Syntax.php
CHANGED
File without changes
|
Twig/lib/Twig/ExistsLoaderInterface.php
CHANGED
@@ -22,7 +22,7 @@ interface Twig_ExistsLoaderInterface
|
|
22 |
*
|
23 |
* @param string $name The name of the template to check if we can load
|
24 |
*
|
25 |
-
* @return
|
26 |
*/
|
27 |
public function exists($name);
|
28 |
}
|
22 |
*
|
23 |
* @param string $name The name of the template to check if we can load
|
24 |
*
|
25 |
+
* @return Boolean If the template source code is handled by this loader or not
|
26 |
*/
|
27 |
public function exists($name);
|
28 |
}
|
Twig/lib/Twig/ExpressionParser.php
CHANGED
@@ -86,18 +86,15 @@ class Twig_ExpressionParser
|
|
86 |
|
87 |
protected function parseConditionalExpression($expr)
|
88 |
{
|
89 |
-
while ($this->parser->getStream()->
|
90 |
-
|
91 |
-
if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ':')) {
|
92 |
$expr2 = $this->parseExpression();
|
93 |
-
if ($this->parser->getStream()->
|
94 |
-
$this->parser->getStream()->next();
|
95 |
$expr3 = $this->parseExpression();
|
96 |
} else {
|
97 |
$expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine());
|
98 |
}
|
99 |
} else {
|
100 |
-
$this->parser->getStream()->next();
|
101 |
$expr2 = $expr;
|
102 |
$expr3 = $this->parseExpression();
|
103 |
}
|
@@ -190,12 +187,10 @@ class Twig_ExpressionParser
|
|
190 |
// a string cannot be followed by another string in a single expression
|
191 |
$nextCanBeString = true;
|
192 |
while (true) {
|
193 |
-
if ($stream->
|
194 |
-
$token = $stream->next();
|
195 |
$nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
|
196 |
$nextCanBeString = false;
|
197 |
-
} elseif ($stream->
|
198 |
-
$stream->next();
|
199 |
$nodes[] = $this->parseExpression();
|
200 |
$stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
|
201 |
$nextCanBeString = true;
|
@@ -261,8 +256,7 @@ class Twig_ExpressionParser
|
|
261 |
// * a string -- 'a'
|
262 |
// * a name, which is equivalent to a string -- a
|
263 |
// * an expression, which must be enclosed in parentheses -- (1 + 2)
|
264 |
-
if ($stream->
|
265 |
-
$token = $stream->next();
|
266 |
$key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
|
267 |
} elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
|
268 |
$key = $this->parseExpression();
|
@@ -395,9 +389,8 @@ class Twig_ExpressionParser
|
|
395 |
$arg = $this->parseExpression();
|
396 |
}
|
397 |
|
398 |
-
if ($stream->
|
399 |
$slice = true;
|
400 |
-
$stream->next();
|
401 |
}
|
402 |
|
403 |
if ($slice) {
|
@@ -480,8 +473,7 @@ class Twig_ExpressionParser
|
|
480 |
}
|
481 |
|
482 |
$name = null;
|
483 |
-
if ($namedArguments && $stream->
|
484 |
-
$token = $stream->next();
|
485 |
if (!$value instanceof Twig_Node_Expression_Name) {
|
486 |
throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given', get_class($value)), $token->getLine(), $this->parser->getFilename());
|
487 |
}
|
@@ -527,10 +519,9 @@ class Twig_ExpressionParser
|
|
527 |
}
|
528 |
$targets[] = new Twig_Node_Expression_AssignName($token->getValue(), $token->getLine());
|
529 |
|
530 |
-
if (!$this->parser->getStream()->
|
531 |
break;
|
532 |
}
|
533 |
-
$this->parser->getStream()->next();
|
534 |
}
|
535 |
|
536 |
return new Twig_Node($targets);
|
@@ -541,10 +532,9 @@ class Twig_ExpressionParser
|
|
541 |
$targets = array();
|
542 |
while (true) {
|
543 |
$targets[] = $this->parseExpression();
|
544 |
-
if (!$this->parser->getStream()->
|
545 |
break;
|
546 |
}
|
547 |
-
$this->parser->getStream()->next();
|
548 |
}
|
549 |
|
550 |
return new Twig_Node($targets);
|
86 |
|
87 |
protected function parseConditionalExpression($expr)
|
88 |
{
|
89 |
+
while ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, '?')) {
|
90 |
+
if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
|
|
|
91 |
$expr2 = $this->parseExpression();
|
92 |
+
if ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
|
|
|
93 |
$expr3 = $this->parseExpression();
|
94 |
} else {
|
95 |
$expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine());
|
96 |
}
|
97 |
} else {
|
|
|
98 |
$expr2 = $expr;
|
99 |
$expr3 = $this->parseExpression();
|
100 |
}
|
187 |
// a string cannot be followed by another string in a single expression
|
188 |
$nextCanBeString = true;
|
189 |
while (true) {
|
190 |
+
if ($nextCanBeString && $token = $stream->nextIf(Twig_Token::STRING_TYPE)) {
|
|
|
191 |
$nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
|
192 |
$nextCanBeString = false;
|
193 |
+
} elseif ($stream->nextIf(Twig_Token::INTERPOLATION_START_TYPE)) {
|
|
|
194 |
$nodes[] = $this->parseExpression();
|
195 |
$stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
|
196 |
$nextCanBeString = true;
|
256 |
// * a string -- 'a'
|
257 |
// * a name, which is equivalent to a string -- a
|
258 |
// * an expression, which must be enclosed in parentheses -- (1 + 2)
|
259 |
+
if (($token = $stream->nextIf(Twig_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_Token::NUMBER_TYPE)) {
|
|
|
260 |
$key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
|
261 |
} elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
|
262 |
$key = $this->parseExpression();
|
389 |
$arg = $this->parseExpression();
|
390 |
}
|
391 |
|
392 |
+
if ($stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
|
393 |
$slice = true;
|
|
|
394 |
}
|
395 |
|
396 |
if ($slice) {
|
473 |
}
|
474 |
|
475 |
$name = null;
|
476 |
+
if ($namedArguments && $token = $stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) {
|
|
|
477 |
if (!$value instanceof Twig_Node_Expression_Name) {
|
478 |
throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given', get_class($value)), $token->getLine(), $this->parser->getFilename());
|
479 |
}
|
519 |
}
|
520 |
$targets[] = new Twig_Node_Expression_AssignName($token->getValue(), $token->getLine());
|
521 |
|
522 |
+
if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
|
523 |
break;
|
524 |
}
|
|
|
525 |
}
|
526 |
|
527 |
return new Twig_Node($targets);
|
532 |
$targets = array();
|
533 |
while (true) {
|
534 |
$targets[] = $this->parseExpression();
|
535 |
+
if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
|
536 |
break;
|
537 |
}
|
|
|
538 |
}
|
539 |
|
540 |
return new Twig_Node($targets);
|
Twig/lib/Twig/Extension.php
CHANGED
@@ -34,7 +34,7 @@ abstract class Twig_Extension implements Twig_ExtensionInterface
|
|
34 |
/**
|
35 |
* Returns the node visitor instances to add to the existing list.
|
36 |
*
|
37 |
-
* @return
|
38 |
*/
|
39 |
public function getNodeVisitors()
|
40 |
{
|
34 |
/**
|
35 |
* Returns the node visitor instances to add to the existing list.
|
36 |
*
|
37 |
+
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
|
38 |
*/
|
39 |
public function getNodeVisitors()
|
40 |
{
|
Twig/lib/Twig/Extension/Core.php
CHANGED
@@ -117,7 +117,7 @@ class Twig_Extension_Core extends Twig_Extension
|
|
117 |
/**
|
118 |
* Returns the token parser instance to add to the existing list.
|
119 |
*
|
120 |
-
* @return
|
121 |
*/
|
122 |
public function getTokenParsers()
|
123 |
{
|
@@ -155,6 +155,7 @@ class Twig_Extension_Core extends Twig_Extension
|
|
155 |
new Twig_SimpleFilter('replace', 'strtr'),
|
156 |
new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)),
|
157 |
new Twig_SimpleFilter('abs', 'abs'),
|
|
|
158 |
|
159 |
// encoding
|
160 |
new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'),
|
@@ -209,12 +210,15 @@ class Twig_Extension_Core extends Twig_Extension
|
|
209 |
public function getFunctions()
|
210 |
{
|
211 |
return array(
|
|
|
|
|
212 |
new Twig_SimpleFunction('range', 'range'),
|
213 |
new Twig_SimpleFunction('constant', 'twig_constant'),
|
214 |
new Twig_SimpleFunction('cycle', 'twig_cycle'),
|
215 |
new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
|
216 |
new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
|
217 |
new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
|
|
|
218 |
);
|
219 |
}
|
220 |
|
@@ -524,6 +528,28 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu
|
|
524 |
return $date;
|
525 |
}
|
526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
/**
|
528 |
* Number format filter.
|
529 |
*
|
@@ -561,7 +587,7 @@ function twig_number_format_filter(Twig_Environment $env, $number, $decimal = nu
|
|
561 |
* URL encodes a string as a path segment or an array as a query string.
|
562 |
*
|
563 |
* @param string|array $url A URL or an array of query parameters
|
564 |
-
* @param
|
565 |
*
|
566 |
* @return string The URL encoded value
|
567 |
*/
|
@@ -692,7 +718,7 @@ function twig_first(Twig_Environment $env, $item)
|
|
692 |
{
|
693 |
$elements = twig_slice($env, $item, 0, 1, false);
|
694 |
|
695 |
-
return is_string($elements) ? $elements
|
696 |
}
|
697 |
|
698 |
/**
|
@@ -707,7 +733,7 @@ function twig_last(Twig_Environment $env, $item)
|
|
707 |
{
|
708 |
$elements = twig_slice($env, $item, -1, 1, false);
|
709 |
|
710 |
-
return is_string($elements) ? $elements
|
711 |
}
|
712 |
|
713 |
/**
|
@@ -1370,6 +1396,18 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
|
|
1370 |
}
|
1371 |
}
|
1372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1373 |
/**
|
1374 |
* Provides the ability to get constants from instances as well as class/global constants.
|
1375 |
*
|
117 |
/**
|
118 |
* Returns the token parser instance to add to the existing list.
|
119 |
*
|
120 |
+
* @return Twig_TokenParser[] An array of Twig_TokenParser instances
|
121 |
*/
|
122 |
public function getTokenParsers()
|
123 |
{
|
155 |
new Twig_SimpleFilter('replace', 'strtr'),
|
156 |
new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)),
|
157 |
new Twig_SimpleFilter('abs', 'abs'),
|
158 |
+
new Twig_SimpleFilter('round', 'twig_round'),
|
159 |
|
160 |
// encoding
|
161 |
new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'),
|
210 |
public function getFunctions()
|
211 |
{
|
212 |
return array(
|
213 |
+
new Twig_SimpleFunction('max', 'max'),
|
214 |
+
new Twig_SimpleFunction('min', 'min'),
|
215 |
new Twig_SimpleFunction('range', 'range'),
|
216 |
new Twig_SimpleFunction('constant', 'twig_constant'),
|
217 |
new Twig_SimpleFunction('cycle', 'twig_cycle'),
|
218 |
new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
|
219 |
new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
|
220 |
new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
|
221 |
+
new Twig_SimpleFunction('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))),
|
222 |
);
|
223 |
}
|
224 |
|
528 |
return $date;
|
529 |
}
|
530 |
|
531 |
+
/**
|
532 |
+
* Rounds a number.
|
533 |
+
*
|
534 |
+
* @param integer|float $value The value to round
|
535 |
+
* @param integer|float $precision The rounding precision
|
536 |
+
* @param string $method The method to use for rounding
|
537 |
+
*
|
538 |
+
* @return integer|float The rounded number
|
539 |
+
*/
|
540 |
+
function twig_round($value, $precision = 0, $method = 'common')
|
541 |
+
{
|
542 |
+
if ('common' == $method) {
|
543 |
+
return round($value, $precision);
|
544 |
+
}
|
545 |
+
|
546 |
+
if ('ceil' != $method && 'floor' != $method) {
|
547 |
+
throw new Twig_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.');
|
548 |
+
}
|
549 |
+
|
550 |
+
return $method($value * pow(10, $precision)) / pow(10, $precision);
|
551 |
+
}
|
552 |
+
|
553 |
/**
|
554 |
* Number format filter.
|
555 |
*
|
587 |
* URL encodes a string as a path segment or an array as a query string.
|
588 |
*
|
589 |
* @param string|array $url A URL or an array of query parameters
|
590 |
+
* @param Boolean $raw true to use rawurlencode() instead of urlencode
|
591 |
*
|
592 |
* @return string The URL encoded value
|
593 |
*/
|
718 |
{
|
719 |
$elements = twig_slice($env, $item, 0, 1, false);
|
720 |
|
721 |
+
return is_string($elements) ? $elements : current($elements);
|
722 |
}
|
723 |
|
724 |
/**
|
733 |
{
|
734 |
$elements = twig_slice($env, $item, -1, 1, false);
|
735 |
|
736 |
+
return is_string($elements) ? $elements : current($elements);
|
737 |
}
|
738 |
|
739 |
/**
|
1396 |
}
|
1397 |
}
|
1398 |
|
1399 |
+
/**
|
1400 |
+
* Returns a template content without rendering it.
|
1401 |
+
*
|
1402 |
+
* @param string $name The template name
|
1403 |
+
*
|
1404 |
+
* @return string The template source
|
1405 |
+
*/
|
1406 |
+
function twig_source(Twig_Environment $env, $name)
|
1407 |
+
{
|
1408 |
+
return $env->getLoader()->getSource($name);
|
1409 |
+
}
|
1410 |
+
|
1411 |
/**
|
1412 |
* Provides the ability to get constants from instances as well as class/global constants.
|
1413 |
*
|
Twig/lib/Twig/Extension/Debug.php
CHANGED
File without changes
|
Twig/lib/Twig/Extension/Escaper.php
CHANGED
@@ -30,7 +30,7 @@ class Twig_Extension_Escaper extends Twig_Extension
|
|
30 |
/**
|
31 |
* Returns the node visitor instances to add to the existing list.
|
32 |
*
|
33 |
-
* @return
|
34 |
*/
|
35 |
public function getNodeVisitors()
|
36 |
{
|
30 |
/**
|
31 |
* Returns the node visitor instances to add to the existing list.
|
32 |
*
|
33 |
+
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
|
34 |
*/
|
35 |
public function getNodeVisitors()
|
36 |
{
|
Twig/lib/Twig/Extension/Optimizer.php
CHANGED
File without changes
|
Twig/lib/Twig/Extension/Sandbox.php
CHANGED
@@ -33,7 +33,7 @@ class Twig_Extension_Sandbox extends Twig_Extension
|
|
33 |
/**
|
34 |
* Returns the node visitor instances to add to the existing list.
|
35 |
*
|
36 |
-
* @return
|
37 |
*/
|
38 |
public function getNodeVisitors()
|
39 |
{
|
33 |
/**
|
34 |
* Returns the node visitor instances to add to the existing list.
|
35 |
*
|
36 |
+
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
|
37 |
*/
|
38 |
public function getNodeVisitors()
|
39 |
{
|
Twig/lib/Twig/Extension/Staging.php
CHANGED
File without changes
|
Twig/lib/Twig/Extension/StringLoader.php
CHANGED
File without changes
|
Twig/lib/Twig/ExtensionInterface.php
CHANGED
@@ -35,7 +35,7 @@ interface Twig_ExtensionInterface
|
|
35 |
/**
|
36 |
* Returns the node visitor instances to add to the existing list.
|
37 |
*
|
38 |
-
* @return
|
39 |
*/
|
40 |
public function getNodeVisitors();
|
41 |
|
35 |
/**
|
36 |
* Returns the node visitor instances to add to the existing list.
|
37 |
*
|
38 |
+
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
|
39 |
*/
|
40 |
public function getNodeVisitors();
|
41 |
|
Twig/lib/Twig/Filter.php
CHANGED
File without changes
|
Twig/lib/Twig/Filter/Function.php
CHANGED
File without changes
|
Twig/lib/Twig/Filter/Method.php
CHANGED
File without changes
|
Twig/lib/Twig/Filter/Node.php
CHANGED
File without changes
|
Twig/lib/Twig/FilterCallableInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/FilterInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Function.php
CHANGED
File without changes
|
Twig/lib/Twig/Function/Function.php
CHANGED
File without changes
|
Twig/lib/Twig/Function/Method.php
CHANGED
File without changes
|
Twig/lib/Twig/Function/Node.php
CHANGED
File without changes
|
Twig/lib/Twig/FunctionCallableInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/FunctionInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Lexer.php
CHANGED
@@ -321,7 +321,6 @@ class Twig_Lexer implements Twig_LexerInterface
|
|
321 |
$this->moveCursor($match[0]);
|
322 |
|
323 |
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
|
324 |
-
|
325 |
list($expect, $lineno) = array_pop($this->brackets);
|
326 |
if ($this->code[$this->cursor] != '"') {
|
327 |
throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename);
|
321 |
$this->moveCursor($match[0]);
|
322 |
|
323 |
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
|
|
|
324 |
list($expect, $lineno) = array_pop($this->brackets);
|
325 |
if ($this->code[$this->cursor] != '"') {
|
326 |
throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename);
|
Twig/lib/Twig/LexerInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Loader/Array.php
CHANGED
File without changes
|
Twig/lib/Twig/Loader/Chain.php
CHANGED
File without changes
|
Twig/lib/Twig/Loader/Filesystem.php
CHANGED
File without changes
|
Twig/lib/Twig/Loader/String.php
CHANGED
File without changes
|
Twig/lib/Twig/LoaderInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Markup.php
CHANGED
File without changes
|
Twig/lib/Twig/Node.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/AutoEscape.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Block.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/BlockReference.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Body.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Do.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Embed.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Array.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/AssignName.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Add.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/And.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Concat.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Div.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/EndsWith.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Equal.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/FloorDiv.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Greater.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/In.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Less.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/LessEqual.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Matches.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Mod.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Mul.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/NotEqual.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/NotIn.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Or.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Power.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Range.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/StartsWith.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Binary/Sub.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/BlockReference.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Call.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Conditional.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Constant.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/ExtensionReference.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Filter.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Filter/Default.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Function.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/GetAttr.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/MethodCall.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Name.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Parent.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/TempName.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Constant.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Defined.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Divisibleby.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Even.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Null.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Odd.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Test/Sameas.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Unary.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Unary/Neg.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Unary/Not.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Expression/Unary/Pos.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Flush.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/For.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/ForLoop.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/If.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Import.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Include.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Macro.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Module.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Print.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Sandbox.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/SandboxedModule.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/SandboxedPrint.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Set.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/SetTemp.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Spaceless.php
CHANGED
File without changes
|
Twig/lib/Twig/Node/Text.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeOutputInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeTraverser.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
/**
|
13 |
* Twig_NodeTraverser is a node traverser.
|
14 |
*
|
15 |
-
* It visits all nodes and their children and
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
@@ -24,8 +24,8 @@ class Twig_NodeTraverser
|
|
24 |
/**
|
25 |
* Constructor.
|
26 |
*
|
27 |
-
* @param Twig_Environment
|
28 |
-
* @param
|
29 |
*/
|
30 |
public function __construct(Twig_Environment $env, array $visitors = array())
|
31 |
{
|
12 |
/**
|
13 |
* Twig_NodeTraverser is a node traverser.
|
14 |
*
|
15 |
+
* It visits all nodes and their children and calls the given visitor for each.
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
24 |
/**
|
25 |
* Constructor.
|
26 |
*
|
27 |
+
* @param Twig_Environment $env A Twig_Environment instance
|
28 |
+
* @param Twig_NodeVisitorInterface[] $visitors An array of Twig_NodeVisitorInterface instances
|
29 |
*/
|
30 |
public function __construct(Twig_Environment $env, array $visitors = array())
|
31 |
{
|
Twig/lib/Twig/NodeVisitor/Escaper.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeVisitor/Optimizer.php
CHANGED
@@ -39,7 +39,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface
|
|
39 |
*/
|
40 |
public function __construct($optimizers = -1)
|
41 |
{
|
42 |
-
if (!is_int($optimizers) || $optimizers >
|
43 |
throw new InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers));
|
44 |
}
|
45 |
|
39 |
*/
|
40 |
public function __construct($optimizers = -1)
|
41 |
{
|
42 |
+
if (!is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) {
|
43 |
throw new InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers));
|
44 |
}
|
45 |
|
Twig/lib/Twig/NodeVisitor/SafeAnalysis.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeVisitor/Sandbox.php
CHANGED
File without changes
|
Twig/lib/Twig/NodeVisitorInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Parser.php
CHANGED
@@ -380,7 +380,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
380 |
}
|
381 |
|
382 |
foreach ($node as $k => $n) {
|
383 |
-
if (null !== $n && null === $
|
384 |
$node->removeNode($k);
|
385 |
}
|
386 |
}
|
380 |
}
|
381 |
|
382 |
foreach ($node as $k => $n) {
|
383 |
+
if (null !== $n && null === $this->filterBodyNodes($n)) {
|
384 |
$node->removeNode($k);
|
385 |
}
|
386 |
}
|
Twig/lib/Twig/ParserInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Sandbox/SecurityError.php
CHANGED
File without changes
|
Twig/lib/Twig/Sandbox/SecurityPolicy.php
CHANGED
File without changes
|
Twig/lib/Twig/Sandbox/SecurityPolicyInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/SimpleFilter.php
CHANGED
File without changes
|
Twig/lib/Twig/SimpleFunction.php
CHANGED
File without changes
|
Twig/lib/Twig/SimpleTest.php
CHANGED
File without changes
|
Twig/lib/Twig/Template.php
CHANGED
@@ -417,6 +417,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
417 |
self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object)));
|
418 |
}
|
419 |
|
|
|
420 |
$lcItem = strtolower($item);
|
421 |
if (isset(self::$cache[$class]['methods'][$lcItem])) {
|
422 |
$method = (string) $item;
|
@@ -426,6 +427,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
426 |
$method = 'is'.$item;
|
427 |
} elseif (isset(self::$cache[$class]['methods']['__call'])) {
|
428 |
$method = (string) $item;
|
|
|
429 |
} else {
|
430 |
if ($isDefinedTest) {
|
431 |
return false;
|
@@ -446,7 +448,16 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
446 |
$this->env->getExtension('sandbox')->checkMethodAllowed($object, $method);
|
447 |
}
|
448 |
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
|
451 |
// useful when calling a template method from a template
|
452 |
// this is not supported but unfortunately heavily used in the Symfony profiler
|
417 |
self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object)));
|
418 |
}
|
419 |
|
420 |
+
$call = false;
|
421 |
$lcItem = strtolower($item);
|
422 |
if (isset(self::$cache[$class]['methods'][$lcItem])) {
|
423 |
$method = (string) $item;
|
427 |
$method = 'is'.$item;
|
428 |
} elseif (isset(self::$cache[$class]['methods']['__call'])) {
|
429 |
$method = (string) $item;
|
430 |
+
$call = true;
|
431 |
} else {
|
432 |
if ($isDefinedTest) {
|
433 |
return false;
|
448 |
$this->env->getExtension('sandbox')->checkMethodAllowed($object, $method);
|
449 |
}
|
450 |
|
451 |
+
// Some objects throw exceptions when they have __call, and the method we try
|
452 |
+
// to call is not supported. If ignoreStrictCheck is true, we should return null.
|
453 |
+
try {
|
454 |
+
$ret = call_user_func_array(array($object, $method), $arguments);
|
455 |
+
} catch (BadMethodCallException $e) {
|
456 |
+
if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
|
457 |
+
return null;
|
458 |
+
}
|
459 |
+
throw $e;
|
460 |
+
}
|
461 |
|
462 |
// useful when calling a template method from a template
|
463 |
// this is not supported but unfortunately heavily used in the Symfony profiler
|
Twig/lib/Twig/TemplateInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Test.php
CHANGED
File without changes
|
Twig/lib/Twig/Test/Function.php
CHANGED
File without changes
|
Twig/lib/Twig/Test/IntegrationTestCase.php
CHANGED
File without changes
|
Twig/lib/Twig/Test/Method.php
CHANGED
File without changes
|
Twig/lib/Twig/Test/Node.php
CHANGED
File without changes
|
Twig/lib/Twig/Test/NodeTestCase.php
CHANGED
File without changes
|
Twig/lib/Twig/TestCallableInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/TestInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/Token.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/AutoEscape.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Block.php
CHANGED
@@ -41,12 +41,10 @@ class Twig_TokenParser_Block extends Twig_TokenParser
|
|
41 |
$this->parser->pushLocalScope();
|
42 |
$this->parser->pushBlockStack($name);
|
43 |
|
44 |
-
if ($stream->
|
45 |
-
$stream->next();
|
46 |
-
|
47 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
48 |
-
if ($stream->
|
49 |
-
$value = $
|
50 |
|
51 |
if ($value != $name) {
|
52 |
throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
|
41 |
$this->parser->pushLocalScope();
|
42 |
$this->parser->pushBlockStack($name);
|
43 |
|
44 |
+
if ($stream->nextIf(Twig_Token::BLOCK_END_TYPE)) {
|
|
|
|
|
45 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
46 |
+
if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
|
47 |
+
$value = $token->getValue();
|
48 |
|
49 |
if ($value != $name) {
|
50 |
throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
|
Twig/lib/Twig/TokenParser/Do.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Embed.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Extends.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Filter.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Flush.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/For.php
CHANGED
@@ -39,8 +39,7 @@ class Twig_TokenParser_For extends Twig_TokenParser
|
|
39 |
$seq = $this->parser->getExpressionParser()->parseExpression();
|
40 |
|
41 |
$ifexpr = null;
|
42 |
-
if ($stream->
|
43 |
-
$stream->next();
|
44 |
$ifexpr = $this->parser->getExpressionParser()->parseExpression();
|
45 |
}
|
46 |
|
39 |
$seq = $this->parser->getExpressionParser()->parseExpression();
|
40 |
|
41 |
$ifexpr = null;
|
42 |
+
if ($stream->nextIf(Twig_Token::NAME_TYPE, 'if')) {
|
|
|
43 |
$ifexpr = $this->parser->getExpressionParser()->parseExpression();
|
44 |
}
|
45 |
|
Twig/lib/Twig/TokenParser/From.php
CHANGED
@@ -36,19 +36,15 @@ class Twig_TokenParser_From extends Twig_TokenParser
|
|
36 |
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
37 |
|
38 |
$alias = $name;
|
39 |
-
if ($stream->
|
40 |
-
$stream->next();
|
41 |
-
|
42 |
$alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
43 |
}
|
44 |
|
45 |
$targets[$name] = $alias;
|
46 |
|
47 |
-
if (!$stream->
|
48 |
break;
|
49 |
}
|
50 |
-
|
51 |
-
$stream->next();
|
52 |
} while (true);
|
53 |
|
54 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
36 |
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
37 |
|
38 |
$alias = $name;
|
39 |
+
if ($stream->nextIf('as')) {
|
|
|
|
|
40 |
$alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
41 |
}
|
42 |
|
43 |
$targets[$name] = $alias;
|
44 |
|
45 |
+
if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
|
46 |
break;
|
47 |
}
|
|
|
|
|
48 |
} while (true);
|
49 |
|
50 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
Twig/lib/Twig/TokenParser/If.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Import.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Include.php
CHANGED
@@ -42,24 +42,19 @@ class Twig_TokenParser_Include extends Twig_TokenParser
|
|
42 |
$stream = $this->parser->getStream();
|
43 |
|
44 |
$ignoreMissing = false;
|
45 |
-
if ($stream->
|
46 |
-
$stream->next();
|
47 |
$stream->expect(Twig_Token::NAME_TYPE, 'missing');
|
48 |
|
49 |
$ignoreMissing = true;
|
50 |
}
|
51 |
|
52 |
$variables = null;
|
53 |
-
if ($stream->
|
54 |
-
$stream->next();
|
55 |
-
|
56 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
57 |
}
|
58 |
|
59 |
$only = false;
|
60 |
-
if ($stream->
|
61 |
-
$stream->next();
|
62 |
-
|
63 |
$only = true;
|
64 |
}
|
65 |
|
42 |
$stream = $this->parser->getStream();
|
43 |
|
44 |
$ignoreMissing = false;
|
45 |
+
if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) {
|
|
|
46 |
$stream->expect(Twig_Token::NAME_TYPE, 'missing');
|
47 |
|
48 |
$ignoreMissing = true;
|
49 |
}
|
50 |
|
51 |
$variables = null;
|
52 |
+
if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) {
|
|
|
|
|
53 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
54 |
}
|
55 |
|
56 |
$only = false;
|
57 |
+
if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) {
|
|
|
|
|
58 |
$only = true;
|
59 |
}
|
60 |
|
Twig/lib/Twig/TokenParser/Macro.php
CHANGED
@@ -38,8 +38,8 @@ class Twig_TokenParser_Macro extends Twig_TokenParser
|
|
38 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
39 |
$this->parser->pushLocalScope();
|
40 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
41 |
-
if ($stream->
|
42 |
-
$value = $
|
43 |
|
44 |
if ($value != $name) {
|
45 |
throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
|
38 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
39 |
$this->parser->pushLocalScope();
|
40 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
41 |
+
if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
|
42 |
+
$value = $token->getValue();
|
43 |
|
44 |
if ($value != $name) {
|
45 |
throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
|
Twig/lib/Twig/TokenParser/Sandbox.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Set.php
CHANGED
@@ -42,8 +42,7 @@ class Twig_TokenParser_Set extends Twig_TokenParser
|
|
42 |
$names = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
43 |
|
44 |
$capture = false;
|
45 |
-
if ($stream->
|
46 |
-
$stream->next();
|
47 |
$values = $this->parser->getExpressionParser()->parseMultitargetExpression();
|
48 |
|
49 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
42 |
$names = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
43 |
|
44 |
$capture = false;
|
45 |
+
if ($stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) {
|
|
|
46 |
$values = $this->parser->getExpressionParser()->parseMultitargetExpression();
|
47 |
|
48 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
Twig/lib/Twig/TokenParser/Spaceless.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParser/Use.php
CHANGED
@@ -42,26 +42,20 @@ class Twig_TokenParser_Use extends Twig_TokenParser
|
|
42 |
}
|
43 |
|
44 |
$targets = array();
|
45 |
-
if ($stream->
|
46 |
-
$stream->next();
|
47 |
-
|
48 |
do {
|
49 |
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
50 |
|
51 |
$alias = $name;
|
52 |
-
if ($stream->
|
53 |
-
$stream->next();
|
54 |
-
|
55 |
$alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
56 |
}
|
57 |
|
58 |
$targets[$name] = new Twig_Node_Expression_Constant($alias, -1);
|
59 |
|
60 |
-
if (!$stream->
|
61 |
break;
|
62 |
}
|
63 |
-
|
64 |
-
$stream->next();
|
65 |
} while (true);
|
66 |
}
|
67 |
|
42 |
}
|
43 |
|
44 |
$targets = array();
|
45 |
+
if ($stream->nextIf('with')) {
|
|
|
|
|
46 |
do {
|
47 |
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
48 |
|
49 |
$alias = $name;
|
50 |
+
if ($stream->nextIf('as')) {
|
|
|
|
|
51 |
$alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
52 |
}
|
53 |
|
54 |
$targets[$name] = new Twig_Node_Expression_Constant($alias, -1);
|
55 |
|
56 |
+
if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
|
57 |
break;
|
58 |
}
|
|
|
|
|
59 |
} while (true);
|
60 |
}
|
61 |
|
Twig/lib/Twig/TokenParserBroker.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParserBrokerInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenParserInterface.php
CHANGED
File without changes
|
Twig/lib/Twig/TokenStream.php
CHANGED
@@ -63,6 +63,18 @@ class Twig_TokenStream
|
|
63 |
return $this->tokens[$this->current - 1];
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
/**
|
67 |
* Tests a token and returns it or throws a syntax error.
|
68 |
*
|
@@ -105,7 +117,7 @@ class Twig_TokenStream
|
|
105 |
/**
|
106 |
* Tests the current token
|
107 |
*
|
108 |
-
* @return
|
109 |
*/
|
110 |
public function test($primary, $secondary = null)
|
111 |
{
|
@@ -115,7 +127,7 @@ class Twig_TokenStream
|
|
115 |
/**
|
116 |
* Checks if end of stream was reached
|
117 |
*
|
118 |
-
* @return
|
119 |
*/
|
120 |
public function isEOF()
|
121 |
{
|
63 |
return $this->tokens[$this->current - 1];
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
+
* Tests a token, sets the pointer to the next one and returns it or throws a syntax error.
|
68 |
+
*
|
69 |
+
* @return Twig_Token|null The next token if the condition is true, null otherwise
|
70 |
+
*/
|
71 |
+
public function nextIf($primary, $secondary = null)
|
72 |
+
{
|
73 |
+
if ($this->tokens[$this->current]->test($primary, $secondary)) {
|
74 |
+
return $this->next();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
/**
|
79 |
* Tests a token and returns it or throws a syntax error.
|
80 |
*
|
117 |
/**
|
118 |
* Tests the current token
|
119 |
*
|
120 |
+
* @return Boolean
|
121 |
*/
|
122 |
public function test($primary, $secondary = null)
|
123 |
{
|
127 |
/**
|
128 |
* Checks if end of stream was reached
|
129 |
*
|
130 |
+
* @return Boolean
|
131 |
*/
|
132 |
public function isEOF()
|
133 |
{
|
functions/timber-function-wrapper.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class TimberFunctionWrapper
|
4 |
-
{
|
5 |
|
6 |
private $_function;
|
7 |
private $_args;
|
1 |
<?php
|
2 |
|
3 |
+
class TimberFunctionWrapper {
|
|
|
4 |
|
5 |
private $_function;
|
6 |
private $_args;
|
functions/timber-helper.php
CHANGED
@@ -7,8 +7,8 @@ class TimberHelper {
|
|
7 |
if (defined('WP_DISABLE_TRANSIENTS')){
|
8 |
$disable_transients = WP_DISABLE_TRANSIENTS;
|
9 |
}
|
10 |
-
|
11 |
-
if (false === ($data = get_transient($slug)) || $disable_transients){
|
12 |
$cache_lock_slug = $slug.'_lock';
|
13 |
|
14 |
if (get_transient($cache_lock_slug)){
|
7 |
if (defined('WP_DISABLE_TRANSIENTS')){
|
8 |
$disable_transients = WP_DISABLE_TRANSIENTS;
|
9 |
}
|
10 |
+
$data = null;
|
11 |
+
if (is_callable($callback) && (false === ($data = get_transient($slug)) || $disable_transients)){
|
12 |
$cache_lock_slug = $slug.'_lock';
|
13 |
|
14 |
if (get_transient($cache_lock_slug)){
|
functions/timber-image-helper.php
CHANGED
@@ -120,10 +120,9 @@
|
|
120 |
$current_size = $image->get_size();
|
121 |
$ow = $current_size['width'];
|
122 |
$oh = $current_size['height'];
|
|
|
123 |
if ($h) {
|
124 |
$new_aspect = $w / $h;
|
125 |
-
$old_aspect = $ow / $oh;
|
126 |
-
|
127 |
if ($new_aspect > $old_aspect) {
|
128 |
//cropping a vertical photo horitzonally
|
129 |
$oht = $ow / $new_aspect;
|
@@ -135,9 +134,19 @@
|
|
135 |
$image->crop($ox, 0, $owt, $oh, $w, $h);
|
136 |
}
|
137 |
} else {
|
138 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
-
$image->save($new_root_path);
|
141 |
if ($abs){
|
142 |
return untrailingslashit(site_url()).$new_path;
|
143 |
}
|
120 |
$current_size = $image->get_size();
|
121 |
$ow = $current_size['width'];
|
122 |
$oh = $current_size['height'];
|
123 |
+
$old_aspect = $ow / $oh;
|
124 |
if ($h) {
|
125 |
$new_aspect = $w / $h;
|
|
|
|
|
126 |
if ($new_aspect > $old_aspect) {
|
127 |
//cropping a vertical photo horitzonally
|
128 |
$oht = $ow / $new_aspect;
|
134 |
$image->crop($ox, 0, $owt, $oh, $w, $h);
|
135 |
}
|
136 |
} else {
|
137 |
+
$h = $w;
|
138 |
+
if ($old_aspect < 1){
|
139 |
+
$h = $w / $old_aspect;
|
140 |
+
$image->crop(0, 0, $ow, $oh, $w, $h);
|
141 |
+
} else {
|
142 |
+
$image->resize($w, $h);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
$result = $image->save($new_root_path);
|
146 |
+
if (is_wp_error($result)){
|
147 |
+
error_log('Error resizing image');
|
148 |
+
error_log(print_r($result, true));
|
149 |
}
|
|
|
150 |
if ($abs){
|
151 |
return untrailingslashit(site_url()).$new_path;
|
152 |
}
|
functions/timber-loader.php
CHANGED
@@ -148,6 +148,7 @@ class TimberLoader {
|
|
148 |
$locs = array_merge($locs, $this->get_locations_theme());
|
149 |
$locs = array_merge($locs, $this->get_locations_caller($caller));
|
150 |
$locs = array_unique($locs);
|
|
|
151 |
return $locs;
|
152 |
}
|
153 |
|
148 |
$locs = array_merge($locs, $this->get_locations_theme());
|
149 |
$locs = array_merge($locs, $this->get_locations_caller($caller));
|
150 |
$locs = array_unique($locs);
|
151 |
+
$locs = apply_filters('timber_locations', $locs);
|
152 |
return $locs;
|
153 |
}
|
154 |
|
functions/timber-post.php
CHANGED
@@ -163,7 +163,9 @@ class TimberPost extends TimberCore {
|
|
163 |
}
|
164 |
if (!$strip){
|
165 |
$last_p_tag = strrpos($text, '</p>');
|
166 |
-
|
|
|
|
|
167 |
if ($last != '.' && $trimmed) {
|
168 |
$text .= ' … ';
|
169 |
}
|
@@ -250,6 +252,43 @@ class TimberPost extends TimberCore {
|
|
250 |
return $this->_next;
|
251 |
}
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
public function get_path() {
|
254 |
return TimberHelper::get_rel_url($this->get_link());
|
255 |
}
|
@@ -525,8 +564,8 @@ class TimberPost extends TimberCore {
|
|
525 |
return $this->get_comments();
|
526 |
}
|
527 |
|
528 |
-
public function content() {
|
529 |
-
return $this->get_content();
|
530 |
}
|
531 |
|
532 |
public function display_date(){
|
@@ -553,6 +592,10 @@ class TimberPost extends TimberCore {
|
|
553 |
return $this->get_next();
|
554 |
}
|
555 |
|
|
|
|
|
|
|
|
|
556 |
public function parent(){
|
557 |
return $this->get_parent();
|
558 |
}
|
163 |
}
|
164 |
if (!$strip){
|
165 |
$last_p_tag = strrpos($text, '</p>');
|
166 |
+
if ($last_p_tag !== false){
|
167 |
+
$text = substr($text, 0, $last_p_tag);
|
168 |
+
}
|
169 |
if ($last != '.' && $trimmed) {
|
170 |
$text .= ' … ';
|
171 |
}
|
252 |
return $this->_next;
|
253 |
}
|
254 |
|
255 |
+
public function get_pagination(){
|
256 |
+
global $post, $page, $numpages, $multipage, $more, $pagenow;
|
257 |
+
$old_global_post = $post;
|
258 |
+
$post = $this;
|
259 |
+
$ret = array();
|
260 |
+
if ($multipage){
|
261 |
+
for ( $i = 1; $i <= $numpages; $i++ ) {
|
262 |
+
$link = self::get_wp_link_page($i);
|
263 |
+
$data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link);
|
264 |
+
if ($i == $page){
|
265 |
+
$data['current'] = true;
|
266 |
+
}
|
267 |
+
$ret['pages'][] = $data;
|
268 |
+
}
|
269 |
+
$i = $page - 1;
|
270 |
+
if ( $i ) {
|
271 |
+
$link = self::get_wp_link_page( $i );
|
272 |
+
$ret['prev'] = array('link' => $link);
|
273 |
+
}
|
274 |
+
$i = $page + 1;
|
275 |
+
if ( $i <= $numpages ) {
|
276 |
+
$link = self::get_wp_link_page( $i );
|
277 |
+
$ret['next'] = array('link' => $link);
|
278 |
+
}
|
279 |
+
}
|
280 |
+
return $ret;
|
281 |
+
}
|
282 |
+
|
283 |
+
private static function get_wp_link_page($i){
|
284 |
+
$link = _wp_link_page($i);
|
285 |
+
$link = new SimpleXMLElement($link.'</a>');
|
286 |
+
if (isset($link['href'])){
|
287 |
+
return $link['href'];
|
288 |
+
}
|
289 |
+
return '';
|
290 |
+
}
|
291 |
+
|
292 |
public function get_path() {
|
293 |
return TimberHelper::get_rel_url($this->get_link());
|
294 |
}
|
564 |
return $this->get_comments();
|
565 |
}
|
566 |
|
567 |
+
public function content($page) {
|
568 |
+
return $this->get_content(0, $page);
|
569 |
}
|
570 |
|
571 |
public function display_date(){
|
592 |
return $this->get_next();
|
593 |
}
|
594 |
|
595 |
+
public function pagination(){
|
596 |
+
return $this->get_pagination();
|
597 |
+
}
|
598 |
+
|
599 |
public function parent(){
|
600 |
return $this->get_parent();
|
601 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.5
|
5 |
-
Stable tag: 0.16.
|
6 |
Tested up to: 3.8.0
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
@@ -41,6 +41,12 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 0.16.3 =
|
45 |
* Added width, height and aspect methods for TimberImages
|
46 |
* Timber::pagination can now accept a single integer as the overall "size" argument (for the total number of pages that get shown)
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.5
|
5 |
+
Stable tag: 0.16.4
|
6 |
Tested up to: 3.8.0
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 0.16.4 =
|
45 |
+
* Fixed a few things on image handling
|
46 |
+
* Updated to Twig 1.15 (thanks @fabpot)
|
47 |
+
* Added wp_link_pages as TimberPost::pagination
|
48 |
+
* New filter to help with template selection (thanks @zlove)
|
49 |
+
|
50 |
= 0.16.3 =
|
51 |
* Added width, height and aspect methods for TimberImages
|
52 |
* Timber::pagination can now accept a single integer as the overall "size" argument (for the total number of pages that get shown)
|
timber.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
|
|
4 |
Plugin URI: http://timber.upstatement.com
|
5 |
Description: The WordPress Timber Library allows you to write themes using the power Twig templates
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 0.16.
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
|
@@ -417,8 +417,7 @@ class Timber {
|
|
417 |
================================ */
|
418 |
|
419 |
public static function get_widgets($widget_id){
|
420 |
-
return TimberHelper::function_wrapper('dynamic_sidebar', array($widget_id));
|
421 |
-
//return TimberHelper::ob_function('dynamic_sidebar', array($widget_id));
|
422 |
}
|
423 |
|
424 |
|
4 |
Plugin URI: http://timber.upstatement.com
|
5 |
Description: The WordPress Timber Library allows you to write themes using the power Twig templates
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 0.16.4
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
|
417 |
================================ */
|
418 |
|
419 |
public static function get_widgets($widget_id){
|
420 |
+
return TimberHelper::function_wrapper('dynamic_sidebar', array($widget_id), true);
|
|
|
421 |
}
|
422 |
|
423 |
|