Version Description
Fixes and improvements
* Fixed an issue where null results from PostGetter::get_posts
could trigger a fatal error #2199 (thanks @jhhazelaar)
* Removed a useless and confusing error_log message when a post_type
isn't found in a class map #2202 (thanks @gchtr)
* Fixed a documentation issue that gave phpStorm a bad time with query_post
#2205 (thanks @mweimerskirch)
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.15.1 |
Comparing to | |
See all releases |
Code changes from version 1.15.0 to 1.15.1
- lib/PostGetter.php +2 -4
- lib/Timber.php +2 -2
- readme.txt +7 -1
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +6 -6
- vendor/composer/installed.json +14 -16
- vendor/symfony/polyfill-ctype/composer.json +1 -1
- vendor/twig/twig/CHANGELOG +4 -0
- vendor/twig/twig/LICENSE +1 -3
- vendor/twig/twig/composer.json +1 -3
- vendor/twig/twig/doc/advanced.rst +1 -6
- vendor/twig/twig/doc/advanced_legacy.rst +0 -5
- vendor/twig/twig/doc/api.rst +6 -9
- vendor/twig/twig/doc/filters/filter.rst +1 -1
- vendor/twig/twig/doc/filters/reduce.rst +1 -1
- vendor/twig/twig/doc/functions/block.rst +2 -2
- vendor/twig/twig/doc/functions/constant.rst +2 -2
- vendor/twig/twig/doc/templates.rst +2 -6
- vendor/twig/twig/doc/tests/constant.rst +1 -1
- vendor/twig/twig/doc/tests/sameas.rst +1 -1
- vendor/twig/twig/drupal_test.sh +1 -2
- vendor/twig/twig/ext/twig/php_twig.h +1 -1
- vendor/twig/twig/src/Environment.php +3 -3
- vendor/twig/twig/src/ExpressionParser.php +1 -1
- vendor/twig/twig/src/Extension/CoreExtension.php +1 -1
- vendor/twig/twig/src/Parser.php +2 -2
- vendor/twig/twig/src/Sandbox/SecurityPolicy.php +2 -2
- vendor/twig/twig/src/Template.php +3 -3
lib/PostGetter.php
CHANGED
@@ -27,7 +27,7 @@ class PostGetter {
|
|
27 |
|
28 |
$posts = self::get_posts($query, $PostClass);
|
29 |
|
30 |
-
if ( $post = reset($posts) ) {
|
31 |
return $post;
|
32 |
}
|
33 |
|
@@ -174,13 +174,11 @@ class PostGetter {
|
|
174 |
if ( is_array($post_class) ) {
|
175 |
if ( isset($post_class[$post_type]) ) {
|
176 |
$post_class_use = $post_class[$post_type];
|
177 |
-
} else {
|
178 |
-
Helper::error_log($post_type.' not found in '.print_r($post_class, true));
|
179 |
}
|
180 |
} elseif ( is_string($post_class) ) {
|
181 |
$post_class_use = $post_class;
|
182 |
} else {
|
183 |
-
Helper::error_log('
|
184 |
}
|
185 |
|
186 |
if ( $post_class_use === '\Timber\Post' || $post_class_use === 'Timber\Post' ) {
|
27 |
|
28 |
$posts = self::get_posts($query, $PostClass);
|
29 |
|
30 |
+
if ( is_iterable($posts) && $post = reset($posts) ) {
|
31 |
return $post;
|
32 |
}
|
33 |
|
174 |
if ( is_array($post_class) ) {
|
175 |
if ( isset($post_class[$post_type]) ) {
|
176 |
$post_class_use = $post_class[$post_type];
|
|
|
|
|
177 |
}
|
178 |
} elseif ( is_string($post_class) ) {
|
179 |
$post_class_use = $post_class;
|
180 |
} else {
|
181 |
+
Helper::error_log('Unexpected value for PostClass: '.print_r($post_class, true));
|
182 |
}
|
183 |
|
184 |
if ( $post_class_use === '\Timber\Post' || $post_class_use === 'Timber\Post' ) {
|
lib/Timber.php
CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
|
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
-
public static $version = '1.15.
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
@@ -157,7 +157,7 @@ class Timber {
|
|
157 |
* @api
|
158 |
* @param mixed $query
|
159 |
* @param string $PostClass
|
160 |
-
* @return array|bool|null
|
161 |
*/
|
162 |
public static function query_post( $query = false, $PostClass = 'Timber\Post' ) {
|
163 |
return PostGetter::query_post($query, $PostClass);
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
+
public static $version = '1.15.1';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
157 |
* @api
|
158 |
* @param mixed $query
|
159 |
* @param string $PostClass
|
160 |
+
* @return Post|array|bool|null
|
161 |
*/
|
162 |
public static function query_post( $query = false, $PostClass = 'Timber\Post' ) {
|
163 |
return PostGetter::query_post($query, $PostClass);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: jarednova
|
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.9.8
|
5 |
Tested up to: 5.3.2
|
6 |
-
Stable tag: 1.15.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -36,6 +36,12 @@ _Twig is the template language powering Timber; if you need a little background
|
|
36 |
**Changes for Theme Developers**
|
37 |
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
= 1.15.0 =
|
40 |
**Fixes and improvements**
|
41 |
- Fixed an issue where a custom field named "content" could conflict with `{{ post.content }}`
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.9.8
|
5 |
Tested up to: 5.3.2
|
6 |
+
Stable tag: 1.15.1
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
36 |
**Changes for Theme Developers**
|
37 |
|
38 |
|
39 |
+
= 1.15.1 =
|
40 |
+
**Fixes and improvements**
|
41 |
+
* Fixed an issue where null results from `PostGetter::get_posts` could trigger a fatal error #2199 (thanks @jhhazelaar)
|
42 |
+
* Removed a useless and confusing error_log message when a `post_type` isn't found in a class map #2202 (thanks @gchtr)
|
43 |
+
* Fixed a documentation issue that gave phpStorm a bad time with `query_post` #2205 (thanks @mweimerskirch)
|
44 |
+
|
45 |
= 1.15.0 =
|
46 |
**Fixes and improvements**
|
47 |
- Fixed an issue where a custom field named "content" could conflict with `{{ post.content }}`
|
timber.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
|
|
4 |
Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
|
5 |
Plugin URI: https://upstatement.com/timber
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 1.15.
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
4 |
Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
|
5 |
Plugin URI: https://upstatement.com/timber
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.15.1
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitad727149e88eb2fc8fad43689551e91f::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit4d6dc3f12a5161b3f3e9bb1c93fcb33a
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit4d6dc3f12a5161b3f3e9bb1c93fcb33a
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitad727149e88eb2fc8fad43689551e91f
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitad727149e88eb2fc8fad43689551e91f', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitad727149e88eb2fc8fad43689551e91f', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitad727149e88eb2fc8fad43689551e91f::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequiread727149e88eb2fc8fad43689551e91f($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequiread727149e88eb2fc8fad43689551e91f($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
@@ -618,11 +618,11 @@ class ComposerStaticInit4d6dc3f12a5161b3f3e9bb1c93fcb33a
|
|
618 |
public static function getInitializer(ClassLoader $loader)
|
619 |
{
|
620 |
return \Closure::bind(function () use ($loader) {
|
621 |
-
$loader->prefixLengthsPsr4 =
|
622 |
-
$loader->prefixDirsPsr4 =
|
623 |
-
$loader->fallbackDirsPsr4 =
|
624 |
-
$loader->prefixesPsr0 =
|
625 |
-
$loader->classMap =
|
626 |
|
627 |
}, null, ClassLoader::class);
|
628 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitad727149e88eb2fc8fad43689551e91f
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
618 |
public static function getInitializer(ClassLoader $loader)
|
619 |
{
|
620 |
return \Closure::bind(function () use ($loader) {
|
621 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$prefixLengthsPsr4;
|
622 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$prefixDirsPsr4;
|
623 |
+
$loader->fallbackDirsPsr4 = ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$fallbackDirsPsr4;
|
624 |
+
$loader->prefixesPsr0 = ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$prefixesPsr0;
|
625 |
+
$loader->classMap = ComposerStaticInitad727149e88eb2fc8fad43689551e91f::$classMap;
|
626 |
|
627 |
}, null, ClassLoader::class);
|
628 |
}
|
vendor/composer/installed.json
CHANGED
@@ -241,17 +241,17 @@
|
|
241 |
},
|
242 |
{
|
243 |
"name": "symfony/polyfill-ctype",
|
244 |
-
"version": "v1.
|
245 |
-
"version_normalized": "1.
|
246 |
"source": {
|
247 |
"type": "git",
|
248 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
249 |
-
"reference": "
|
250 |
},
|
251 |
"dist": {
|
252 |
"type": "zip",
|
253 |
-
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/
|
254 |
-
"reference": "
|
255 |
"shasum": ""
|
256 |
},
|
257 |
"require": {
|
@@ -260,11 +260,11 @@
|
|
260 |
"suggest": {
|
261 |
"ext-ctype": "For best performance"
|
262 |
},
|
263 |
-
"time": "
|
264 |
"type": "library",
|
265 |
"extra": {
|
266 |
"branch-alias": {
|
267 |
-
"dev-master": "1.
|
268 |
}
|
269 |
},
|
270 |
"installation-source": "dist",
|
@@ -301,17 +301,17 @@
|
|
301 |
},
|
302 |
{
|
303 |
"name": "twig/twig",
|
304 |
-
"version": "v1.42.
|
305 |
-
"version_normalized": "1.42.
|
306 |
"source": {
|
307 |
"type": "git",
|
308 |
"url": "https://github.com/twigphp/Twig.git",
|
309 |
-
"reference": "
|
310 |
},
|
311 |
"dist": {
|
312 |
"type": "zip",
|
313 |
-
"url": "https://api.github.com/repos/twigphp/Twig/zipball/
|
314 |
-
"reference": "
|
315 |
"shasum": ""
|
316 |
},
|
317 |
"require": {
|
@@ -320,10 +320,9 @@
|
|
320 |
},
|
321 |
"require-dev": {
|
322 |
"psr/container": "^1.0",
|
323 |
-
"symfony/
|
324 |
-
"symfony/phpunit-bridge": "^4.4@dev|^5.0"
|
325 |
},
|
326 |
-
"time": "
|
327 |
"type": "library",
|
328 |
"extra": {
|
329 |
"branch-alias": {
|
@@ -352,7 +351,6 @@
|
|
352 |
},
|
353 |
{
|
354 |
"name": "Twig Team",
|
355 |
-
"homepage": "https://twig.symfony.com/contributors",
|
356 |
"role": "Contributors"
|
357 |
},
|
358 |
{
|
241 |
},
|
242 |
{
|
243 |
"name": "symfony/polyfill-ctype",
|
244 |
+
"version": "v1.14.0",
|
245 |
+
"version_normalized": "1.14.0.0",
|
246 |
"source": {
|
247 |
"type": "git",
|
248 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
249 |
+
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38"
|
250 |
},
|
251 |
"dist": {
|
252 |
"type": "zip",
|
253 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
|
254 |
+
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
|
255 |
"shasum": ""
|
256 |
},
|
257 |
"require": {
|
260 |
"suggest": {
|
261 |
"ext-ctype": "For best performance"
|
262 |
},
|
263 |
+
"time": "2020-01-13T11:15:53+00:00",
|
264 |
"type": "library",
|
265 |
"extra": {
|
266 |
"branch-alias": {
|
267 |
+
"dev-master": "1.14-dev"
|
268 |
}
|
269 |
},
|
270 |
"installation-source": "dist",
|
301 |
},
|
302 |
{
|
303 |
"name": "twig/twig",
|
304 |
+
"version": "v1.42.5",
|
305 |
+
"version_normalized": "1.42.5.0",
|
306 |
"source": {
|
307 |
"type": "git",
|
308 |
"url": "https://github.com/twigphp/Twig.git",
|
309 |
+
"reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e"
|
310 |
},
|
311 |
"dist": {
|
312 |
"type": "zip",
|
313 |
+
"url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e",
|
314 |
+
"reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e",
|
315 |
"shasum": ""
|
316 |
},
|
317 |
"require": {
|
320 |
},
|
321 |
"require-dev": {
|
322 |
"psr/container": "^1.0",
|
323 |
+
"symfony/phpunit-bridge": "^4.4|^5.0"
|
|
|
324 |
},
|
325 |
+
"time": "2020-02-11T05:59:23+00:00",
|
326 |
"type": "library",
|
327 |
"extra": {
|
328 |
"branch-alias": {
|
351 |
},
|
352 |
{
|
353 |
"name": "Twig Team",
|
|
|
354 |
"role": "Contributors"
|
355 |
},
|
356 |
{
|
vendor/symfony/polyfill-ctype/composer.json
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
"minimum-stability": "dev",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
31 |
-
"dev-master": "1.
|
32 |
}
|
33 |
}
|
34 |
}
|
28 |
"minimum-stability": "dev",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
31 |
+
"dev-master": "1.14-dev"
|
32 |
}
|
33 |
}
|
34 |
}
|
vendor/twig/twig/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
* 1.42.4 (2019-11-11)
|
2 |
|
3 |
* optimized "block('foo') ?? 'bar"
|
1 |
+
* 1.42.5 (2020-02-11)
|
2 |
+
|
3 |
+
* Fix implementation of case-insensitivity for method names
|
4 |
+
|
5 |
* 1.42.4 (2019-11-11)
|
6 |
|
7 |
* optimized "block('foo') ?? 'bar"
|
vendor/twig/twig/LICENSE
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
Copyright (c) 2009-
|
2 |
-
|
3 |
-
Some rights reserved.
|
4 |
|
5 |
Redistribution and use in source and binary forms, with or without
|
6 |
modification, are permitted provided that the following conditions are
|
1 |
+
Copyright (c) 2009-2020 by the Twig Team.
|
|
|
|
|
2 |
|
3 |
Redistribution and use in source and binary forms, with or without
|
4 |
modification, are permitted provided that the following conditions are
|
vendor/twig/twig/composer.json
CHANGED
@@ -14,7 +14,6 @@
|
|
14 |
},
|
15 |
{
|
16 |
"name": "Twig Team",
|
17 |
-
"homepage": "https://twig.symfony.com/contributors",
|
18 |
"role": "Contributors"
|
19 |
},
|
20 |
{
|
@@ -28,8 +27,7 @@
|
|
28 |
"symfony/polyfill-ctype": "^1.8"
|
29 |
},
|
30 |
"require-dev": {
|
31 |
-
"symfony/phpunit-bridge": "^4.4
|
32 |
-
"symfony/debug": "^3.4|^4.2",
|
33 |
"psr/container": "^1.0"
|
34 |
},
|
35 |
"autoload": {
|
14 |
},
|
15 |
{
|
16 |
"name": "Twig Team",
|
|
|
17 |
"role": "Contributors"
|
18 |
},
|
19 |
{
|
27 |
"symfony/polyfill-ctype": "^1.8"
|
28 |
},
|
29 |
"require-dev": {
|
30 |
+
"symfony/phpunit-bridge": "^4.4|^5.0",
|
|
|
31 |
"psr/container": "^1.0"
|
32 |
},
|
33 |
"autoload": {
|
vendor/twig/twig/doc/advanced.rst
CHANGED
@@ -584,11 +584,6 @@ to host all the specific tags and filters you want to add to Twig.
|
|
584 |
recompile your templates whenever you make a change to it (when
|
585 |
``auto_reload`` is enabled).
|
586 |
|
587 |
-
.. note::
|
588 |
-
|
589 |
-
Before writing your own extensions, have a look at the Twig official
|
590 |
-
extension repository: https://github.com/twigphp/Twig-extensions.
|
591 |
-
|
592 |
An extension is a class that implements the following interface::
|
593 |
|
594 |
interface Twig_ExtensionInterface
|
@@ -665,7 +660,7 @@ An extension is a class that implements the following interface::
|
|
665 |
|
666 |
To keep your extension class clean and lean, inherit from the built-in
|
667 |
``\Twig\Extension\AbstractExtension`` class instead of implementing the interface as it provides
|
668 |
-
empty implementations for all methods
|
669 |
|
670 |
class Project_Twig_Extension extends \Twig\Extension\AbstractExtension
|
671 |
{
|
584 |
recompile your templates whenever you make a change to it (when
|
585 |
``auto_reload`` is enabled).
|
586 |
|
|
|
|
|
|
|
|
|
|
|
587 |
An extension is a class that implements the following interface::
|
588 |
|
589 |
interface Twig_ExtensionInterface
|
660 |
|
661 |
To keep your extension class clean and lean, inherit from the built-in
|
662 |
``\Twig\Extension\AbstractExtension`` class instead of implementing the interface as it provides
|
663 |
+
empty implementations for all methods::
|
664 |
|
665 |
class Project_Twig_Extension extends \Twig\Extension\AbstractExtension
|
666 |
{
|
vendor/twig/twig/doc/advanced_legacy.rst
CHANGED
@@ -524,11 +524,6 @@ to host all the specific tags and filters you want to add to Twig.
|
|
524 |
recompile your templates whenever you make a change to it (when the
|
525 |
``auto_reload`` is enabled).
|
526 |
|
527 |
-
.. note::
|
528 |
-
|
529 |
-
Before writing your own extensions, have a look at the Twig official
|
530 |
-
extension repository: https://github.com/twigphp/Twig-extensions.
|
531 |
-
|
532 |
An extension is a class that implements the following interface::
|
533 |
|
534 |
interface Twig_ExtensionInterface
|
524 |
recompile your templates whenever you make a change to it (when the
|
525 |
``auto_reload`` is enabled).
|
526 |
|
|
|
|
|
|
|
|
|
|
|
527 |
An extension is a class that implements the following interface::
|
528 |
|
529 |
interface Twig_ExtensionInterface
|
vendor/twig/twig/doc/api.rst
CHANGED
@@ -19,8 +19,7 @@ to have multiple environments side by side, with different configurations.
|
|
19 |
The typical way to configure Twig to load templates for an application looks
|
20 |
roughly like this::
|
21 |
|
22 |
-
require_once '/path/to/
|
23 |
-
Twig_Autoloader::register();
|
24 |
|
25 |
$loader = new \Twig\Loader\FilesystemLoader('/path/to/templates');
|
26 |
$twig = new \Twig\Environment($loader, [
|
@@ -357,8 +356,8 @@ This section describes the features added by the built-in extensions.
|
|
357 |
|
358 |
.. tip::
|
359 |
|
360 |
-
Read the chapter about extending Twig to learn how to
|
361 |
-
extensions.
|
362 |
|
363 |
Core Extension
|
364 |
~~~~~~~~~~~~~~
|
@@ -417,7 +416,7 @@ The escaping rules are implemented as follows:
|
|
417 |
{% set text = "Twig<br />" %}
|
418 |
{{ text }} {# will be escaped #}
|
419 |
|
420 |
-
* Expressions which the result is
|
421 |
are never automatically escaped:
|
422 |
|
423 |
.. code-block:: twig
|
@@ -425,14 +424,12 @@ The escaping rules are implemented as follows:
|
|
425 |
{{ foo ? "Twig<br />" : "<br />Twig" }} {# won't be escaped #}
|
426 |
|
427 |
{% set text = "Twig<br />" %}
|
428 |
-
{{
|
|
|
429 |
|
430 |
{% set text = "Twig<br />" %}
|
431 |
{{ foo ? text|raw : "<br />Twig" }} {# won't be escaped #}
|
432 |
|
433 |
-
{% set text = "Twig<br />" %}
|
434 |
-
{{ foo ? text|escape : "<br />Twig" }} {# the result of the expression won't be escaped #}
|
435 |
-
|
436 |
* Escaping is applied before printing, after any other filter is applied:
|
437 |
|
438 |
.. code-block:: twig
|
19 |
The typical way to configure Twig to load templates for an application looks
|
20 |
roughly like this::
|
21 |
|
22 |
+
require_once '/path/to/vendor/autoload.php';
|
|
|
23 |
|
24 |
$loader = new \Twig\Loader\FilesystemLoader('/path/to/templates');
|
25 |
$twig = new \Twig\Environment($loader, [
|
356 |
|
357 |
.. tip::
|
358 |
|
359 |
+
Read the chapter about :doc:`extending Twig <advanced>` to learn how to
|
360 |
+
create your own extensions.
|
361 |
|
362 |
Core Extension
|
363 |
~~~~~~~~~~~~~~
|
416 |
{% set text = "Twig<br />" %}
|
417 |
{{ text }} {# will be escaped #}
|
418 |
|
419 |
+
* Expressions which the result is a literal or a variable marked safe
|
420 |
are never automatically escaped:
|
421 |
|
422 |
.. code-block:: twig
|
424 |
{{ foo ? "Twig<br />" : "<br />Twig" }} {# won't be escaped #}
|
425 |
|
426 |
{% set text = "Twig<br />" %}
|
427 |
+
{{ true ? text : "<br />Twig" }} {# will be escaped #}
|
428 |
+
{{ false ? text : "<br />Twig" }} {# won't be escaped #}
|
429 |
|
430 |
{% set text = "Twig<br />" %}
|
431 |
{{ foo ? text|raw : "<br />Twig" }} {# won't be escaped #}
|
432 |
|
|
|
|
|
|
|
433 |
* Escaping is applied before printing, after any other filter is applied:
|
434 |
|
435 |
.. code-block:: twig
|
vendor/twig/twig/doc/filters/filter.rst
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
``filter``
|
2 |
-
|
3 |
|
4 |
.. versionadded:: 1.41
|
5 |
The ``filter`` filter was added in Twig 1.41 and 2.10.
|
1 |
``filter``
|
2 |
+
==========
|
3 |
|
4 |
.. versionadded:: 1.41
|
5 |
The ``filter`` filter was added in Twig 1.41 and 2.10.
|
vendor/twig/twig/doc/filters/reduce.rst
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
``reduce``
|
2 |
-
|
3 |
|
4 |
.. versionadded:: 1.41
|
5 |
The ``reduce`` filter was added in Twig 1.41 and 2.10.
|
1 |
``reduce``
|
2 |
+
==========
|
3 |
|
4 |
.. versionadded:: 1.41
|
5 |
The ``reduce`` filter was added in Twig 1.41 and 2.10.
|
vendor/twig/twig/doc/functions/block.rst
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
``block``
|
2 |
=========
|
3 |
|
4 |
-
.. versionadded
|
5 |
Using ``block`` with the ``defined`` test was added in Twig 1.28.
|
6 |
|
7 |
-
.. versionadded
|
8 |
Support for the template argument was added in Twig 1.28.
|
9 |
|
10 |
When a template uses inheritance and if you want to print a block multiple
|
1 |
``block``
|
2 |
=========
|
3 |
|
4 |
+
.. versionadded:: 1.28
|
5 |
Using ``block`` with the ``defined`` test was added in Twig 1.28.
|
6 |
|
7 |
+
.. versionadded:: 1.28
|
8 |
Support for the template argument was added in Twig 1.28.
|
9 |
|
10 |
When a template uses inheritance and if you want to print a block multiple
|
vendor/twig/twig/doc/functions/constant.rst
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
``constant``
|
2 |
============
|
3 |
|
4 |
-
.. versionadded
|
5 |
constant now accepts object instances as the second argument.
|
6 |
|
7 |
-
.. versionadded
|
8 |
Using ``constant`` with the ``defined`` test was added in Twig 1.28.
|
9 |
|
10 |
``constant`` returns the constant value for a given string:
|
1 |
``constant``
|
2 |
============
|
3 |
|
4 |
+
.. versionadded:: 1.12.1
|
5 |
constant now accepts object instances as the second argument.
|
6 |
|
7 |
+
.. versionadded:: 1.28
|
8 |
Using ``constant`` with the ``defined`` test was added in Twig 1.28.
|
9 |
|
10 |
``constant`` returns the constant value for a given string:
|
vendor/twig/twig/doc/templates.rst
CHANGED
@@ -865,11 +865,8 @@ the modifiers on one side of a tag or on both sides:
|
|
865 |
Extensions
|
866 |
----------
|
867 |
|
868 |
-
Twig can be extended. If you
|
869 |
-
|
870 |
-
|
871 |
-
If you want to create your own, read the :ref:`Creating an
|
872 |
-
Extension<creating_extensions>` chapter.
|
873 |
|
874 |
.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle
|
875 |
.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim
|
@@ -877,7 +874,6 @@ Extension<creating_extensions>` chapter.
|
|
877 |
.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig
|
878 |
.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin
|
879 |
.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language
|
880 |
-
.. _`extension repository`: https://github.com/twigphp/Twig-extensions
|
881 |
.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode
|
882 |
.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode
|
883 |
.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig
|
865 |
Extensions
|
866 |
----------
|
867 |
|
868 |
+
Twig can be extended. If you want to create your own extensions, read the
|
869 |
+
:ref:`Creating an Extension <creating_extensions>` chapter.
|
|
|
|
|
|
|
870 |
|
871 |
.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle
|
872 |
.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim
|
874 |
.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig
|
875 |
.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin
|
876 |
.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language
|
|
|
877 |
.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode
|
878 |
.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode
|
879 |
.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig
|
vendor/twig/twig/doc/tests/constant.rst
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
``constant``
|
2 |
============
|
3 |
|
4 |
-
.. versionadded
|
5 |
constant now accepts object instances as the second argument.
|
6 |
|
7 |
``constant`` checks if a variable has the exact same value as a constant. You
|
1 |
``constant``
|
2 |
============
|
3 |
|
4 |
+
.. versionadded:: 1.13.1
|
5 |
constant now accepts object instances as the second argument.
|
6 |
|
7 |
``constant`` checks if a variable has the exact same value as a constant. You
|
vendor/twig/twig/doc/tests/sameas.rst
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
The ``same as`` test was added in Twig 1.14.2 as an alias for ``sameas``.
|
6 |
|
7 |
``same as`` checks if a variable is the same as another variable.
|
8 |
-
This is
|
9 |
|
10 |
.. code-block:: twig
|
11 |
|
5 |
The ``same as`` test was added in Twig 1.14.2 as an alias for ``sameas``.
|
6 |
|
7 |
``same as`` checks if a variable is the same as another variable.
|
8 |
+
This is equivalent to ``===`` in PHP:
|
9 |
|
10 |
.. code-block:: twig
|
11 |
|
vendor/twig/twig/drupal_test.sh
CHANGED
@@ -17,7 +17,6 @@ source output
|
|
17 |
wget https://get.symfony.com/cli/installer -O - | bash
|
18 |
export PATH="$HOME/.symfony/bin:$PATH"
|
19 |
symfony server:start -d --no-tls
|
20 |
-
ENDPOINT=`symfony server:status -no-ansi | sed -E 's/^.+ http/http/'`
|
21 |
|
22 |
curl -OLsS https://get.blackfire.io/blackfire-player.phar
|
23 |
chmod +x blackfire-player.phar
|
@@ -47,5 +46,5 @@ scenario
|
|
47 |
click link('Structure')
|
48 |
expect status_code() == 200
|
49 |
EOF
|
50 |
-
./blackfire-player.phar run drupal-tests.bkf --endpoint
|
51 |
symfony server:stop
|
17 |
wget https://get.symfony.com/cli/installer -O - | bash
|
18 |
export PATH="$HOME/.symfony/bin:$PATH"
|
19 |
symfony server:start -d --no-tls
|
|
|
20 |
|
21 |
curl -OLsS https://get.blackfire.io/blackfire-player.phar
|
22 |
chmod +x blackfire-player.phar
|
46 |
click link('Structure')
|
47 |
expect status_code() == 200
|
48 |
EOF
|
49 |
+
./blackfire-player.phar run drupal-tests.bkf --endpoint=`symfony var:export SYMFONY_DEFAULT_ROUTE_URL` --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
|
50 |
symfony server:stop
|
vendor/twig/twig/ext/twig/php_twig.h
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
#ifndef PHP_TWIG_H
|
16 |
#define PHP_TWIG_H
|
17 |
|
18 |
-
#define PHP_TWIG_VERSION "1.42.
|
19 |
|
20 |
#include "php.h"
|
21 |
|
15 |
#ifndef PHP_TWIG_H
|
16 |
#define PHP_TWIG_H
|
17 |
|
18 |
+
#define PHP_TWIG_VERSION "1.42.5-DEV"
|
19 |
|
20 |
#include "php.h"
|
21 |
|
vendor/twig/twig/src/Environment.php
CHANGED
@@ -41,11 +41,11 @@ use Twig\TokenParser\TokenParserInterface;
|
|
41 |
*/
|
42 |
class Environment
|
43 |
{
|
44 |
-
const VERSION = '1.42.
|
45 |
-
const VERSION_ID =
|
46 |
const MAJOR_VERSION = 1;
|
47 |
const MINOR_VERSION = 42;
|
48 |
-
const RELEASE_VERSION =
|
49 |
const EXTRA_VERSION = '';
|
50 |
|
51 |
protected $charset;
|
41 |
*/
|
42 |
class Environment
|
43 |
{
|
44 |
+
const VERSION = '1.42.5';
|
45 |
+
const VERSION_ID = 14205;
|
46 |
const MAJOR_VERSION = 1;
|
47 |
const MINOR_VERSION = 42;
|
48 |
+
const RELEASE_VERSION = 5;
|
49 |
const EXTRA_VERSION = '';
|
50 |
|
51 |
protected $charset;
|
vendor/twig/twig/src/ExpressionParser.php
CHANGED
@@ -657,7 +657,7 @@ class ExpressionParser
|
|
657 |
$stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to');
|
658 |
}
|
659 |
$value = $token->getValue();
|
660 |
-
if (\in_array(
|
661 |
throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
|
662 |
}
|
663 |
$targets[] = new AssignNameExpression($value, $token->getLine());
|
657 |
$stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to');
|
658 |
}
|
659 |
$value = $token->getValue();
|
660 |
+
if (\in_array(strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) {
|
661 |
throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
|
662 |
}
|
663 |
$targets[] = new AssignNameExpression($value, $token->getLine());
|
vendor/twig/twig/src/Extension/CoreExtension.php
CHANGED
@@ -459,7 +459,7 @@ function twig_date_modify_filter(Environment $env, $date, $modifier)
|
|
459 |
* @param \DateTime|\DateTimeInterface|string|null $date A date
|
460 |
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
|
461 |
*
|
462 |
-
* @return \
|
463 |
*/
|
464 |
function twig_date_converter(Environment $env, $date = null, $timezone = null)
|
465 |
{
|
459 |
* @param \DateTime|\DateTimeInterface|string|null $date A date
|
460 |
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
|
461 |
*
|
462 |
+
* @return \DateTimeInterface
|
463 |
*/
|
464 |
function twig_date_converter(Environment $env, $date = null, $timezone = null)
|
465 |
{
|
vendor/twig/twig/src/Parser.php
CHANGED
@@ -299,7 +299,7 @@ class Parser implements \Twig_ParserInterface
|
|
299 |
$this->reservedMacroNames = [];
|
300 |
$r = new \ReflectionClass($this->env->getBaseTemplateClass());
|
301 |
foreach ($r->getMethods() as $method) {
|
302 |
-
$methodName =
|
303 |
|
304 |
if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) {
|
305 |
$this->reservedMacroNames[] = substr($methodName, 3);
|
@@ -307,7 +307,7 @@ class Parser implements \Twig_ParserInterface
|
|
307 |
}
|
308 |
}
|
309 |
|
310 |
-
return \in_array(
|
311 |
}
|
312 |
|
313 |
public function addTrait($trait)
|
299 |
$this->reservedMacroNames = [];
|
300 |
$r = new \ReflectionClass($this->env->getBaseTemplateClass());
|
301 |
foreach ($r->getMethods() as $method) {
|
302 |
+
$methodName = strtr($method->getName(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
|
303 |
|
304 |
if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) {
|
305 |
$this->reservedMacroNames[] = substr($methodName, 3);
|
307 |
}
|
308 |
}
|
309 |
|
310 |
+
return \in_array(strtr($name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $this->reservedMacroNames);
|
311 |
}
|
312 |
|
313 |
public function addTrait($trait)
|
vendor/twig/twig/src/Sandbox/SecurityPolicy.php
CHANGED
@@ -51,7 +51,7 @@ class SecurityPolicy implements SecurityPolicyInterface
|
|
51 |
{
|
52 |
$this->allowedMethods = [];
|
53 |
foreach ($methods as $class => $m) {
|
54 |
-
$this->allowedMethods[$class] = array_map('
|
55 |
}
|
56 |
}
|
57 |
|
@@ -93,7 +93,7 @@ class SecurityPolicy implements SecurityPolicyInterface
|
|
93 |
}
|
94 |
|
95 |
$allowed = false;
|
96 |
-
$method =
|
97 |
foreach ($this->allowedMethods as $class => $methods) {
|
98 |
if ($obj instanceof $class) {
|
99 |
$allowed = \in_array($method, $methods);
|
51 |
{
|
52 |
$this->allowedMethods = [];
|
53 |
foreach ($methods as $class => $m) {
|
54 |
+
$this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]);
|
55 |
}
|
56 |
}
|
57 |
|
93 |
}
|
94 |
|
95 |
$allowed = false;
|
96 |
+
$method = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
|
97 |
foreach ($this->allowedMethods as $class => $methods) {
|
98 |
if ($obj instanceof $class) {
|
99 |
$allowed = \in_array($method, $methods);
|
vendor/twig/twig/src/Template.php
CHANGED
@@ -628,7 +628,7 @@ abstract class Template implements \Twig_TemplateInterface
|
|
628 |
|
629 |
foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) {
|
630 |
// Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
|
631 |
-
if ('getenvironment' !==
|
632 |
$methods[] = $refMethod->name;
|
633 |
}
|
634 |
}
|
@@ -642,7 +642,7 @@ abstract class Template implements \Twig_TemplateInterface
|
|
642 |
|
643 |
foreach ($methods as $method) {
|
644 |
$cache[$method] = $method;
|
645 |
-
$cache[$lcName =
|
646 |
|
647 |
if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) {
|
648 |
$name = substr($method, 3);
|
@@ -670,7 +670,7 @@ abstract class Template implements \Twig_TemplateInterface
|
|
670 |
$call = false;
|
671 |
if (isset(self::$cache[$class][$item])) {
|
672 |
$method = self::$cache[$class][$item];
|
673 |
-
} elseif (isset(self::$cache[$class][$lcItem =
|
674 |
$method = self::$cache[$class][$lcItem];
|
675 |
} elseif (isset(self::$cache[$class]['__call'])) {
|
676 |
$method = $item;
|
628 |
|
629 |
foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) {
|
630 |
// Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
|
631 |
+
if ('getenvironment' !== strtr($refMethod->name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
|
632 |
$methods[] = $refMethod->name;
|
633 |
}
|
634 |
}
|
642 |
|
643 |
foreach ($methods as $method) {
|
644 |
$cache[$method] = $method;
|
645 |
+
$cache[$lcName = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')] = $method;
|
646 |
|
647 |
if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) {
|
648 |
$name = substr($method, 3);
|
670 |
$call = false;
|
671 |
if (isset(self::$cache[$class][$item])) {
|
672 |
$method = self::$cache[$class][$item];
|
673 |
+
} elseif (isset(self::$cache[$class][$lcItem = strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) {
|
674 |
$method = self::$cache[$class][$lcItem];
|
675 |
} elseif (isset(self::$cache[$class]['__call'])) {
|
676 |
$method = $item;
|