Version Description
Fixes and improvements - Fixes issues previewing custom fields with ACF #1712 - Fixes some edge cases with Menu Item classes #1709 - Improved efficiency of Post class instantiation #1660
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.0 to 1.7.1
- README.md +18 -12
- lib/Helper.php +2 -2
- lib/Image/Operation/Resize.php +2 -0
- lib/Menu.php +65 -5
- lib/Post.php +25 -2
- lib/PostGetter.php +2 -2
- lib/Timber.php +1 -1
- readme.txt +10 -3
- timber-starter-theme/README.md +1 -1
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real.php +3 -3
- vendor/composer/installed.json +7 -7
- vendor/twig/twig/.travis.yml +13 -7
- vendor/twig/twig/CHANGELOG +21 -2
- vendor/twig/twig/LICENSE +1 -1
- vendor/twig/twig/composer.json +1 -1
- vendor/twig/twig/doc/advanced.rst +2 -2
- vendor/twig/twig/doc/filters/length.rst +2 -0
- vendor/twig/twig/doc/filters/replace.rst +6 -0
- vendor/twig/twig/doc/functions/block.rst +1 -1
- vendor/twig/twig/doc/templates.rst +2 -1
- vendor/twig/twig/ext/twig/php_twig.h +1 -1
- vendor/twig/twig/ext/twig/twig.c +5 -3
- vendor/twig/twig/lib/Twig/Compiler.php +3 -1
- vendor/twig/twig/lib/Twig/Environment.php +35 -11
- vendor/twig/twig/lib/Twig/ExpressionParser.php +8 -5
- vendor/twig/twig/lib/Twig/Extension/Core.php +12 -4
- vendor/twig/twig/lib/Twig/Lexer.php +2 -2
- vendor/twig/twig/lib/Twig/Loader/Filesystem.php +1 -1
- vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php +2 -2
- vendor/twig/twig/lib/Twig/Parser.php +5 -3
- vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +1 -1
- vendor/twig/twig/lib/Twig/Profiler/Profile.php +6 -0
- vendor/twig/twig/lib/Twig/Template.php +3 -1
- vendor/twig/twig/lib/Twig/TokenParser/For.php +1 -1
- vendor/twig/twig/lib/Twig/TokenParser/Use.php +2 -0
- vendor/twig/twig/lib/Twig/TokenParserBroker.php +2 -2
- vendor/twig/twig/lib/Twig/TokenStream.php +1 -1
- vendor/twig/twig/phpunit.xml.dist +1 -1
- vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php +19 -0
- vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/CompilerTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +28 -1
- vendor/twig/twig/test/Twig/Tests/ErrorTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php +3 -3
- vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php +2 -2
- vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/FileCachingTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test +2 -2
- vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test +6 -0
- vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +3 -0
- vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test +24 -0
- vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +18 -0
- vendor/twig/twig/test/Twig/Tests/LexerTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/ParserTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php +11 -1
- vendor/twig/twig/test/Twig/Tests/TemplateTest.php +2 -1
- vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php +1 -1
- vendor/twig/twig/test/Twig/Tests/escapingTest.php +1 -1
- vendor/twig/twig/test/bootstrap.php +0 -21
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<a href="https://upstatement.com/timber/"><img src="http://i.imgur.com/PbEwvZ9.png" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
</div>
|
4 |
|
5 |
-
By [Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.com/jarednova)), [Lukas Gächter](https://github.com/gchtr) ([@lgaechter](https://twitter.com/lgaechter)), [Linda Gorman](https://github.com/lggorman) ([@lggorman](https://twitter.com/lggorman))
|
6 |
|
7 |
|
8 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
@@ -20,7 +20,7 @@ Timber helps you create fully-customized WordPress themes faster with more susta
|
|
20 |
|
21 |
This cleans up your theme code so, for example, your PHP file can focus on being the data/logic, while your Twig file can focus 100% on the HTML and display.
|
22 |
|
23 |
-
This is what Timber's `.twig` files look like
|
24 |
|
25 |
```twig
|
26 |
{% extends "base.twig" %}
|
@@ -33,7 +33,7 @@ This is what Timber's `.twig` files look like:
|
|
33 |
</div>
|
34 |
{% endblock %}
|
35 |
```
|
36 |
-
Once Timber is installed and activated in your
|
37 |
|
38 |
### Looking for docs?
|
39 |
* [Timber Documentation](https://timber.github.io/docs/)
|
@@ -45,34 +45,40 @@ Once Timber is installed and activated in your plugin directory, it gives any Wo
|
|
45 |
|
46 |
### Installation
|
47 |
|
48 |
-
The GitHub version of Timber requires [Composer](https://getcomposer.org/download/). If you'd prefer one-click installation, you should use the [WordPress.org](https://wordpress.org/plugins/timber-library/) version.
|
49 |
|
50 |
```shell
|
|
|
51 |
composer require timber/timber
|
52 |
```
|
53 |
|
54 |
-
If your theme is not setup to pull in Composer's autoload file, you will need to
|
55 |
|
56 |
```php
|
|
|
57 |
require_once(__DIR__ . '/vendor/autoload.php');
|
58 |
```
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
Initialize Timber with
|
63 |
```php
|
64 |
$timber = new \Timber\Timber();
|
65 |
```
|
|
|
|
|
|
|
|
|
|
|
66 |
* * *
|
67 |
|
68 |
### Mission Statement
|
|
|
69 |
Timber is a tool for developers who want to translate their HTML into high-quality WordPress themes through an intuitive, consistent and fully-accessible interface.
|
70 |
* **Intuitive**: The API is written to be user-centric around a programmer's expectations.
|
71 |
* **Consistent**: WordPress objects can be accessed through common polymorphic properties like slug, ID and name.
|
72 |
* **Accessible**: No black boxes. Every effort is made so the developer has access to 100% of their HTML.
|
73 |
|
74 |
#### What does it look like?
|
75 |
-
Nothing. Timber is meant for you to build a theme on. Like
|
76 |
|
77 |
#### Who is it good for?
|
78 |
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress engineer can focus on building the `.php` files with requests from WordPress and pass the data into `.twig` files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
@@ -98,13 +104,13 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
98 |
* [**TutsPlus**](http://code.tutsplus.com/articles/kick-start-wordpress-development-with-twig-introduction--cms-24781) A guide to getting started by [@ahmadawais](https://github.com/ahmadawais)
|
99 |
|
100 |
#### Support
|
101 |
-
Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/questions/tagged/timber). Please use GitHub issues
|
102 |
|
103 |
#### Should I use it?
|
104 |
-
It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [thousands of sites](https://www.upstatement.com/timber/#showcase) (and tons more we don't know about)
|
105 |
|
106 |
#### Contributing
|
107 |
-
Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md).
|
108 |
|
109 |
## Documentation
|
110 |
|
2 |
<a href="https://upstatement.com/timber/"><img src="http://i.imgur.com/PbEwvZ9.png" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
</div>
|
4 |
|
5 |
+
By [Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.com/jarednova)), [Lukas Gächter](https://github.com/gchtr) ([@lgaechter](https://twitter.com/lgaechter)), [Linda Gorman](https://github.com/lggorman) ([@lggorman](https://twitter.com/lggorman)), [Upstatement](https://twitter.com/upstatement) and [hundreds of other GitHub contributors](https://github.com/timber/timber/graphs/contributors)
|
6 |
|
7 |
|
8 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
20 |
|
21 |
This cleans up your theme code so, for example, your PHP file can focus on being the data/logic, while your Twig file can focus 100% on the HTML and display.
|
22 |
|
23 |
+
This is what Timber's `.twig` files look like (from this [Hello World example](https://gist.github.com/jarednova/dc75030fd2c7dd6fe52a6fef459c450e))
|
24 |
|
25 |
```twig
|
26 |
{% extends "base.twig" %}
|
33 |
</div>
|
34 |
{% endblock %}
|
35 |
```
|
36 |
+
Once Timber is installed and activated in your `plugins` directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
|
37 |
|
38 |
### Looking for docs?
|
39 |
* [Timber Documentation](https://timber.github.io/docs/)
|
45 |
|
46 |
### Installation
|
47 |
|
48 |
+
The GitHub version of Timber requires [Composer](https://getcomposer.org/download/) and is setup for inclusion _within_ a theme or plugin. If you'd prefer one-click installation for your site, you should use the [WordPress.org](https://wordpress.org/plugins/timber-library/) version.
|
49 |
|
50 |
```shell
|
51 |
+
cd ~/wp-content/themes/my-theme
|
52 |
composer require timber/timber
|
53 |
```
|
54 |
|
55 |
+
If your theme/plugin is not setup to pull in Composer's autoload file, you will need to
|
56 |
|
57 |
```php
|
58 |
+
/* functions.php */
|
59 |
require_once(__DIR__ . '/vendor/autoload.php');
|
60 |
```
|
61 |
|
62 |
+
After this line, initialize Timber with
|
|
|
|
|
63 |
```php
|
64 |
$timber = new \Timber\Timber();
|
65 |
```
|
66 |
+
|
67 |
+
### What Now?
|
68 |
+
|
69 |
+
Setup the [Timber Starter Theme](https://timber.github.io/docs/getting-started/setup/#use-the-starter-theme). Once you have that installed in your WordPress setup, continue reading the [Getting Started guide to Themeing](https://timber.github.io/docs/getting-started/theming/).
|
70 |
+
|
71 |
* * *
|
72 |
|
73 |
### Mission Statement
|
74 |
+
|
75 |
Timber is a tool for developers who want to translate their HTML into high-quality WordPress themes through an intuitive, consistent and fully-accessible interface.
|
76 |
* **Intuitive**: The API is written to be user-centric around a programmer's expectations.
|
77 |
* **Consistent**: WordPress objects can be accessed through common polymorphic properties like slug, ID and name.
|
78 |
* **Accessible**: No black boxes. Every effort is made so the developer has access to 100% of their HTML.
|
79 |
|
80 |
#### What does it look like?
|
81 |
+
Nothing. Timber is meant for you to build a theme on. Like [_s](https://github.com/Automattic/_s) it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.
|
82 |
|
83 |
#### Who is it good for?
|
84 |
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress engineer can focus on building the `.php` files with requests from WordPress and pass the data into `.twig` files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
104 |
* [**TutsPlus**](http://code.tutsplus.com/articles/kick-start-wordpress-development-with-twig-introduction--cms-24781) A guide to getting started by [@ahmadawais](https://github.com/ahmadawais)
|
105 |
|
106 |
#### Support
|
107 |
+
Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/questions/tagged/timber). Please use GitHub issues _only_ for specific bugs, feature requests and other types of issues.
|
108 |
|
109 |
#### Should I use it?
|
110 |
+
It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [tens of thousands of sites](https://www.upstatement.com/timber/#showcase) (and tons more we don't know about)
|
111 |
|
112 |
#### Contributing
|
113 |
+
We love PRs! Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md).
|
114 |
|
115 |
## Documentation
|
116 |
|
lib/Helper.php
CHANGED
@@ -451,8 +451,8 @@ class Helper {
|
|
451 |
*
|
452 |
* Gets the comment form for use on a single article page
|
453 |
* @deprecated 0.21.8 use `{{ function('comment_form') }}` instead
|
454 |
-
* @param int
|
455 |
-
* @param array
|
456 |
* @return string
|
457 |
*/
|
458 |
public static function get_comment_form( $post_id = null, $args = array() ) {
|
451 |
*
|
452 |
* Gets the comment form for use on a single article page
|
453 |
* @deprecated 0.21.8 use `{{ function('comment_form') }}` instead
|
454 |
+
* @param int $post_id which post_id should the form be tied to?
|
455 |
+
* @param array The $args thing is a mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)
|
456 |
* @return string
|
457 |
*/
|
458 |
public static function get_comment_form( $post_id = null, $args = array() ) {
|
lib/Image/Operation/Resize.php
CHANGED
@@ -191,6 +191,8 @@ class Resize extends ImageOperation {
|
|
191 |
$crop['target_w'],
|
192 |
$crop['target_h']
|
193 |
);
|
|
|
|
|
194 |
$result = $image->save($save_filename);
|
195 |
if ( is_wp_error($result) ) {
|
196 |
// @codeCoverageIgnoreStart
|
191 |
$crop['target_w'],
|
192 |
$crop['target_h']
|
193 |
);
|
194 |
+
$quality = apply_filters( 'wp_editor_set_quality', 82, 'image/jpeg');
|
195 |
+
$image->set_quality($quality);
|
196 |
$result = $image->save($save_filename);
|
197 |
if ( is_wp_error($result) ) {
|
198 |
// @codeCoverageIgnoreStart
|
lib/Menu.php
CHANGED
@@ -10,6 +10,12 @@ class Menu extends Core {
|
|
10 |
public $MenuItemClass = 'Timber\MenuItem';
|
11 |
public $PostClass = 'Timber\Post';
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* @api
|
15 |
* @var array|null Array of `Timber\Menu` objects you can to iterate through.
|
@@ -40,22 +46,34 @@ class Menu extends Core {
|
|
40 |
*/
|
41 |
public $name;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @api
|
45 |
* @var string The name of the menu (ex: `Main Navigation`).
|
46 |
*/
|
47 |
public $title;
|
48 |
|
|
|
|
|
49 |
/**
|
50 |
* Initialize a menu.
|
51 |
*
|
52 |
-
* @param int|string $slug
|
53 |
-
*
|
54 |
-
*
|
|
|
55 |
*/
|
56 |
-
public function __construct( $slug = 0 ) {
|
57 |
$menu_id = false;
|
58 |
$locations = get_nav_menu_locations();
|
|
|
|
|
|
|
59 |
if ( $slug != 0 && is_numeric($slug) ) {
|
60 |
$menu_id = $slug;
|
61 |
} else if ( is_array($locations) && count($locations) ) {
|
@@ -83,6 +101,7 @@ class Menu extends Core {
|
|
83 |
_wp_menu_item_classes_by_context($menu);
|
84 |
if ( is_array($menu) ) {
|
85 |
$menu = self::order_children($menu);
|
|
|
86 |
}
|
87 |
$this->items = $menu;
|
88 |
$menu_info = wp_get_nav_menu_object($menu_id);
|
@@ -93,6 +112,16 @@ class Menu extends Core {
|
|
93 |
}
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* @internal
|
98 |
*/
|
@@ -194,7 +223,7 @@ class Menu extends Core {
|
|
194 |
$old_menu_item = $item;
|
195 |
$item = new $this->PostClass($item);
|
196 |
}
|
197 |
-
$menu_item =
|
198 |
if ( isset($old_menu_item) ) {
|
199 |
$menu_item->import_classes($old_menu_item);
|
200 |
}
|
@@ -211,6 +240,37 @@ class Menu extends Core {
|
|
211 |
return $menu;
|
212 |
}
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/**
|
215 |
* Get menu items.
|
216 |
*
|
10 |
public $MenuItemClass = 'Timber\MenuItem';
|
11 |
public $PostClass = 'Timber\Post';
|
12 |
|
13 |
+
/**
|
14 |
+
* @api
|
15 |
+
* @var integer The depth of the menu we are rendering
|
16 |
+
*/
|
17 |
+
public $depth;
|
18 |
+
|
19 |
/**
|
20 |
* @api
|
21 |
* @var array|null Array of `Timber\Menu` objects you can to iterate through.
|
46 |
*/
|
47 |
public $name;
|
48 |
|
49 |
+
/**
|
50 |
+
* @api
|
51 |
+
* @var array The unfiltered options sent forward via the user in the __construct
|
52 |
+
*/
|
53 |
+
public $raw_options;
|
54 |
+
|
55 |
/**
|
56 |
* @api
|
57 |
* @var string The name of the menu (ex: `Main Navigation`).
|
58 |
*/
|
59 |
public $title;
|
60 |
|
61 |
+
|
62 |
+
|
63 |
/**
|
64 |
* Initialize a menu.
|
65 |
*
|
66 |
+
* @param int|string $slug A menu slug, the term ID of the menu, the full name from the admin
|
67 |
+
* menu, the slug of theregistered location or nothing. Passing nothing
|
68 |
+
* is good if you only have one menu. Timber will grab what it finds.
|
69 |
+
* @param array $options An array of options, right now only `depth` is supported
|
70 |
*/
|
71 |
+
public function __construct( $slug = 0, $options = array() ) {
|
72 |
$menu_id = false;
|
73 |
$locations = get_nav_menu_locations();
|
74 |
+
|
75 |
+
$this->set_options((array)$options);
|
76 |
+
|
77 |
if ( $slug != 0 && is_numeric($slug) ) {
|
78 |
$menu_id = $slug;
|
79 |
} else if ( is_array($locations) && count($locations) ) {
|
101 |
_wp_menu_item_classes_by_context($menu);
|
102 |
if ( is_array($menu) ) {
|
103 |
$menu = self::order_children($menu);
|
104 |
+
$menu = self::strip_to_depth_limit($menu);
|
105 |
}
|
106 |
$this->items = $menu;
|
107 |
$menu_info = wp_get_nav_menu_object($menu_id);
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
/**
|
116 |
+
* @internal
|
117 |
+
* @param mixed $options
|
118 |
+
*/
|
119 |
+
protected function set_options ($options) {
|
120 |
+
// Set any important options
|
121 |
+
$this->depth = (isset($options['depth']) ? (int)$options['depth'] : -1);
|
122 |
+
$this->raw_options = $options; // for future enhancements?
|
123 |
+
}
|
124 |
+
|
125 |
/**
|
126 |
* @internal
|
127 |
*/
|
223 |
$old_menu_item = $item;
|
224 |
$item = new $this->PostClass($item);
|
225 |
}
|
226 |
+
$menu_item = $this->create_menu_item($item);
|
227 |
if ( isset($old_menu_item) ) {
|
228 |
$menu_item->import_classes($old_menu_item);
|
229 |
}
|
240 |
return $menu;
|
241 |
}
|
242 |
|
243 |
+
/**
|
244 |
+
* @internal
|
245 |
+
* @param object $item the WP menu item object to wrap
|
246 |
+
* @return mixed an instance of the user-configured $MenuItemClass
|
247 |
+
*/
|
248 |
+
protected function create_menu_item($item) {
|
249 |
+
return new $this->MenuItemClass($item);
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* @internal
|
254 |
+
* @param array $menu
|
255 |
+
*/
|
256 |
+
protected function strip_to_depth_limit ($menu, $current = 1) {
|
257 |
+
$depth = (int)$this->depth; // Confirms still int.
|
258 |
+
if ($depth <= 0) {
|
259 |
+
return $menu;
|
260 |
+
}
|
261 |
+
|
262 |
+
foreach ($menu as &$currentItem) {
|
263 |
+
if ($current == $depth) {
|
264 |
+
$currentItem->children = false;
|
265 |
+
continue;
|
266 |
+
}
|
267 |
+
|
268 |
+
$currentItem->children = self::strip_to_depth_limit($currentItem->children, $current + 1);
|
269 |
+
}
|
270 |
+
|
271 |
+
return $menu;
|
272 |
+
}
|
273 |
+
|
274 |
/**
|
275 |
* Get menu items.
|
276 |
*
|
lib/Post.php
CHANGED
@@ -209,6 +209,19 @@ class Post extends Core implements CoreInterface {
|
|
209 |
return parent::__call($field, $args);
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
/**
|
213 |
* tries to figure out what post you want to get if not explictly defined (or if it is, allows it to be passed through)
|
214 |
* @internal
|
@@ -224,7 +237,8 @@ class Post extends Core implements CoreInterface {
|
|
224 |
&& is_object($wp_query->queried_object)
|
225 |
&& get_class($wp_query->queried_object) == 'WP_Post'
|
226 |
) {
|
227 |
-
|
|
|
228 |
$pid = $this->get_post_preview_id($wp_query);
|
229 |
} else if ( !$pid ) {
|
230 |
$pid = $wp_query->queried_object_id;
|
@@ -251,6 +265,15 @@ class Post extends Core implements CoreInterface {
|
|
251 |
if ( $pid === null && ($pid_from_loop = PostGetter::loop_to_id()) ) {
|
252 |
$pid = $pid_from_loop;
|
253 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
return $pid;
|
255 |
}
|
256 |
|
@@ -546,7 +569,7 @@ class Post extends Core implements CoreInterface {
|
|
546 |
/**
|
547 |
*
|
548 |
* Gets the comment form for use on a single article page
|
549 |
-
* @param array
|
550 |
* @return string of HTML for the form
|
551 |
*/
|
552 |
public function comment_form( $args = array() ) {
|
209 |
return parent::__call($field, $args);
|
210 |
}
|
211 |
|
212 |
+
/**
|
213 |
+
* Determined whether or not an admin/editor is looking at the post in "preview mode" via the
|
214 |
+
* WordPress admin
|
215 |
+
* @internal
|
216 |
+
* @return bool
|
217 |
+
*/
|
218 |
+
protected static function is_previewing() {
|
219 |
+
global $wp_query;
|
220 |
+
if ( isset($_GET['preview']) && isset($_GET['preview_nonce']) && wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$wp_query->queried_object_id) ) {
|
221 |
+
return true;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
/**
|
226 |
* tries to figure out what post you want to get if not explictly defined (or if it is, allows it to be passed through)
|
227 |
* @internal
|
237 |
&& is_object($wp_query->queried_object)
|
238 |
&& get_class($wp_query->queried_object) == 'WP_Post'
|
239 |
) {
|
240 |
+
|
241 |
+
if ( self::is_previewing() ) {
|
242 |
$pid = $this->get_post_preview_id($wp_query);
|
243 |
} else if ( !$pid ) {
|
244 |
$pid = $wp_query->queried_object_id;
|
265 |
if ( $pid === null && ($pid_from_loop = PostGetter::loop_to_id()) ) {
|
266 |
$pid = $pid_from_loop;
|
267 |
}
|
268 |
+
if (
|
269 |
+
isset($_GET['preview'])
|
270 |
+
&& isset($_GET['preview_nonce'])
|
271 |
+
&& wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$wp_query->queried_object_id)
|
272 |
+
&& isset($wp_query->queried_object_id)
|
273 |
+
&& ($wp_query->queried_object_id === $pid || (is_object($pid) && $wp_query->queried_object_id === $pid->ID))
|
274 |
+
) {
|
275 |
+
$pid = $this->get_post_preview_id($wp_query);
|
276 |
+
}
|
277 |
return $pid;
|
278 |
}
|
279 |
|
569 |
/**
|
570 |
*
|
571 |
* Gets the comment form for use on a single article page
|
572 |
+
* @param array This $args array thing is a mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)
|
573 |
* @return string of HTML for the form
|
574 |
*/
|
575 |
public function comment_form( $args = array() ) {
|
lib/PostGetter.php
CHANGED
@@ -138,11 +138,11 @@ class PostGetter {
|
|
138 |
Helper::error_log('Unexpeted value for PostClass: '.print_r($post_class, true));
|
139 |
}
|
140 |
|
141 |
-
if ( $post_class_use === '\Timber\Post' ) {
|
142 |
return $post_class_use;
|
143 |
}
|
144 |
|
145 |
-
if ( !class_exists($post_class_use) || !
|
146 |
Helper::error_log('Class '.$post_class_use.' either does not exist or implement \Timber\Post');
|
147 |
return '\Timber\Post';
|
148 |
}
|
138 |
Helper::error_log('Unexpeted value for PostClass: '.print_r($post_class, true));
|
139 |
}
|
140 |
|
141 |
+
if ( $post_class_use === '\Timber\Post' || $post_class_use === 'Timber\Post') {
|
142 |
return $post_class_use;
|
143 |
}
|
144 |
|
145 |
+
if ( !class_exists($post_class_use) || !is_subclass_of($post_class_use, '\Timber\Post') ) {
|
146 |
Helper::error_log('Class '.$post_class_use.' either does not exist or implement \Timber\Post');
|
147 |
return '\Timber\Post';
|
148 |
}
|
lib/Timber.php
CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
|
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
-
public static $version = '1.
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
+
public static $version = '1.7.1';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.7.9
|
5 |
-
Tested up to: 4.9.
|
6 |
-
Stable tag: 1.7.
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -36,13 +36,20 @@ _Twig is the template language powering Timber; if you need a little background
|
|
36 |
**Changes for Theme Developers**
|
37 |
- Please add any usage changes here so theme developers are informed of changes.
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
= 1.7.0 =
|
40 |
**Fixes and improvements**
|
41 |
- Fixed some issues with animated gif resizing when Imagick isn't available #1653
|
42 |
- Fixed incorrect reporting of depth level in some comments #1648
|
43 |
- Fixed issues with preview permissions #1607
|
44 |
- Fixed issue with image resize in some WPML setups #1625
|
45 |
-
- Fixes
|
46 |
|
47 |
|
48 |
= 1.6.0 =
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.7.9
|
5 |
+
Tested up to: 4.9.6
|
6 |
+
Stable tag: 1.7.1
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
36 |
**Changes for Theme Developers**
|
37 |
- Please add any usage changes here so theme developers are informed of changes.
|
38 |
|
39 |
+
= 1.7.1 =
|
40 |
+
**Fixes and improvements**
|
41 |
+
- Fixes issues previewing custom fields with ACF #1712
|
42 |
+
- Fixes some edge cases with Menu Item classes #1709
|
43 |
+
- Improved efficiency of Post class instantiation #1660
|
44 |
+
|
45 |
+
|
46 |
= 1.7.0 =
|
47 |
**Fixes and improvements**
|
48 |
- Fixed some issues with animated gif resizing when Imagick isn't available #1653
|
49 |
- Fixed incorrect reporting of depth level in some comments #1648
|
50 |
- Fixed issues with preview permissions #1607
|
51 |
- Fixed issue with image resize in some WPML setups #1625
|
52 |
+
- Fixes compatibility issues with Twig 2.4 (and later) #1641
|
53 |
|
54 |
|
55 |
= 1.6.0 =
|
timber-starter-theme/README.md
CHANGED
@@ -9,7 +9,7 @@ The "_s" for Timber: a dead-simple theme that you can build from. The primary pu
|
|
9 |
|
10 |
Install this theme as you would any other, and be sure the Timber plugin is activated. But hey, let's break it down into some bullets:
|
11 |
|
12 |
-
1. Make sure you have installed the plugin for the [Timber Library](https://wordpress.org/plugins/timber-library/) (and Advanced Custom Fields - they [play quite nicely](
|
13 |
2. Download the zip for this theme (or clone it) and move it to `wp-content/themes` in your WordPress installation.
|
14 |
3. Rename the folder to something that makes sense for your website (generally no spaces and all lowercase). You could keep the name `timber-starter-theme` but the point of a starter theme is to make it your own!
|
15 |
4. Activate the theme in Appearance > Themes.
|
9 |
|
10 |
Install this theme as you would any other, and be sure the Timber plugin is activated. But hey, let's break it down into some bullets:
|
11 |
|
12 |
+
1. Make sure you have installed the plugin for the [Timber Library](https://wordpress.org/plugins/timber-library/) (and Advanced Custom Fields - they [play quite nicely](https://timber.github.io/docs/guides/acf-cookbook/#nav) together).
|
13 |
2. Download the zip for this theme (or clone it) and move it to `wp-content/themes` in your WordPress installation.
|
14 |
3. Rename the folder to something that makes sense for your website (generally no spaces and all lowercase). You could keep the name `timber-starter-theme` but the point of a starter theme is to make it your own!
|
15 |
4. Activate the theme in Appearance > Themes.
|
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: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 1.7.
|
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: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.7.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 ComposerAutoloaderInitc42aa27f1d57b332ff0f441aa8cd7aa5::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -183,6 +183,7 @@ return array(
|
|
183 |
'Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/twig/twig/src/Extension/InitRuntimeInterface.php',
|
184 |
'Twig\\Extension\\OptimizerExtension' => $vendorDir . '/twig/twig/src/Extension/OptimizerExtension.php',
|
185 |
'Twig\\Extension\\ProfilerExtension' => $vendorDir . '/twig/twig/src/Extension/ProfilerExtension.php',
|
|
|
186 |
'Twig\\Extension\\SandboxExtension' => $vendorDir . '/twig/twig/src/Extension/SandboxExtension.php',
|
187 |
'Twig\\Extension\\StagingExtension' => $vendorDir . '/twig/twig/src/Extension/StagingExtension.php',
|
188 |
'Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/twig/twig/src/Extension/StringLoaderExtension.php',
|
183 |
'Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/twig/twig/src/Extension/InitRuntimeInterface.php',
|
184 |
'Twig\\Extension\\OptimizerExtension' => $vendorDir . '/twig/twig/src/Extension/OptimizerExtension.php',
|
185 |
'Twig\\Extension\\ProfilerExtension' => $vendorDir . '/twig/twig/src/Extension/ProfilerExtension.php',
|
186 |
+
'Twig\\Extension\\RuntimeExtensionInterface' => $vendorDir . '/twig/twig/src/Extension/RuntimeExtensionInterface.php',
|
187 |
'Twig\\Extension\\SandboxExtension' => $vendorDir . '/twig/twig/src/Extension/SandboxExtension.php',
|
188 |
'Twig\\Extension\\StagingExtension' => $vendorDir . '/twig/twig/src/Extension/StagingExtension.php',
|
189 |
'Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/twig/twig/src/Extension/StringLoaderExtension.php',
|
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,9 +19,9 @@ class ComposerAutoloaderInite2f66f93b9f4fefc2ad5216aefbb2791
|
|
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 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitc42aa27f1d57b332ff0f441aa8cd7aa5
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitc42aa27f1d57b332ff0f441aa8cd7aa5', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitc42aa27f1d57b332ff0f441aa8cd7aa5', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
vendor/composer/installed.json
CHANGED
@@ -123,17 +123,17 @@
|
|
123 |
},
|
124 |
{
|
125 |
"name": "twig/twig",
|
126 |
-
"version": "v1.
|
127 |
-
"version_normalized": "1.
|
128 |
"source": {
|
129 |
"type": "git",
|
130 |
"url": "https://github.com/twigphp/Twig.git",
|
131 |
-
"reference": "
|
132 |
},
|
133 |
"dist": {
|
134 |
"type": "zip",
|
135 |
-
"url": "https://api.github.com/repos/twigphp/Twig/zipball/
|
136 |
-
"reference": "
|
137 |
"shasum": ""
|
138 |
},
|
139 |
"require": {
|
@@ -144,11 +144,11 @@
|
|
144 |
"symfony/debug": "~2.7",
|
145 |
"symfony/phpunit-bridge": "~3.3@dev"
|
146 |
},
|
147 |
-
"time": "
|
148 |
"type": "library",
|
149 |
"extra": {
|
150 |
"branch-alias": {
|
151 |
-
"dev-master": "1.
|
152 |
}
|
153 |
},
|
154 |
"installation-source": "dist",
|
123 |
},
|
124 |
{
|
125 |
"name": "twig/twig",
|
126 |
+
"version": "v1.35.2",
|
127 |
+
"version_normalized": "1.35.2.0",
|
128 |
"source": {
|
129 |
"type": "git",
|
130 |
"url": "https://github.com/twigphp/Twig.git",
|
131 |
+
"reference": "9c24f2cd39dc1906b76879e099970b7e53724601"
|
132 |
},
|
133 |
"dist": {
|
134 |
"type": "zip",
|
135 |
+
"url": "https://api.github.com/repos/twigphp/Twig/zipball/9c24f2cd39dc1906b76879e099970b7e53724601",
|
136 |
+
"reference": "9c24f2cd39dc1906b76879e099970b7e53724601",
|
137 |
"shasum": ""
|
138 |
},
|
139 |
"require": {
|
144 |
"symfony/debug": "~2.7",
|
145 |
"symfony/phpunit-bridge": "~3.3@dev"
|
146 |
},
|
147 |
+
"time": "2018-03-03 16:21:29",
|
148 |
"type": "library",
|
149 |
"extra": {
|
150 |
"branch-alias": {
|
151 |
+
"dev-master": "1.35-dev"
|
152 |
}
|
153 |
},
|
154 |
"installation-source": "dist",
|
vendor/twig/twig/.travis.yml
CHANGED
@@ -8,20 +8,20 @@ cache:
|
|
8 |
- $HOME/.composer/cache/files
|
9 |
|
10 |
php:
|
11 |
-
- 5.3
|
12 |
- 5.4
|
13 |
- 5.5
|
14 |
- 5.6
|
15 |
- 7.0
|
16 |
- 7.1
|
|
|
17 |
- nightly
|
18 |
|
19 |
env:
|
20 |
- TWIG_EXT=no
|
21 |
-
- TWIG_EXT=yes
|
22 |
|
23 |
before_install:
|
24 |
-
|
|
|
25 |
|
26 |
install:
|
27 |
- travis_retry composer install
|
@@ -39,10 +39,16 @@ script: |
|
|
39 |
|
40 |
matrix:
|
41 |
fast_finish: true
|
42 |
-
|
43 |
-
- php:
|
|
|
44 |
env: TWIG_EXT=yes
|
45 |
-
- php:
|
|
|
|
|
|
|
46 |
env: TWIG_EXT=yes
|
47 |
-
- php:
|
|
|
|
|
48 |
env: TWIG_EXT=yes
|
8 |
- $HOME/.composer/cache/files
|
9 |
|
10 |
php:
|
|
|
11 |
- 5.4
|
12 |
- 5.5
|
13 |
- 5.6
|
14 |
- 7.0
|
15 |
- 7.1
|
16 |
+
- 7.2
|
17 |
- nightly
|
18 |
|
19 |
env:
|
20 |
- TWIG_EXT=no
|
|
|
21 |
|
22 |
before_install:
|
23 |
+
# turn off XDebug
|
24 |
+
- phpenv config-rm xdebug.ini || return 0
|
25 |
|
26 |
install:
|
27 |
- travis_retry composer install
|
39 |
|
40 |
matrix:
|
41 |
fast_finish: true
|
42 |
+
include:
|
43 |
+
- php: 5.3
|
44 |
+
dist: precise
|
45 |
env: TWIG_EXT=yes
|
46 |
+
- php: 5.3
|
47 |
+
dist: precise
|
48 |
+
env: TWIG_EXT=no
|
49 |
+
- php: 5.4
|
50 |
env: TWIG_EXT=yes
|
51 |
+
- php: 5.5
|
52 |
+
env: TWIG_EXT=yes
|
53 |
+
- php: 5.6
|
54 |
env: TWIG_EXT=yes
|
vendor/twig/twig/CHANGELOG
CHANGED
@@ -1,3 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
* 1.34.4 (2017-07-04)
|
2 |
|
3 |
* added support for runtime loaders in IntegrationTestCase
|
@@ -142,7 +161,7 @@
|
|
142 |
|
143 |
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
144 |
* fixed support for PHP7 (Throwable support)
|
145 |
-
* marked the following methods as being internals on Twig_Environment:
|
146 |
getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(),
|
147 |
getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(),
|
148 |
getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension()
|
@@ -226,7 +245,7 @@
|
|
226 |
* fixed limited RCEs when in sandbox mode
|
227 |
* deprecated Twig_Template::getEnvironment()
|
228 |
* deprecated the _self variable for usage outside of the from and import tags
|
229 |
-
* added Twig_BaseNodeVisitor to ease the compatibility of node visitors
|
230 |
between 1.x and 2.x
|
231 |
|
232 |
* 1.19.0 (2015-07-31)
|
1 |
+
* 1.35.2 (2018-03-03)
|
2 |
+
|
3 |
+
* fixed a regression in the way the profiler is registered in templates
|
4 |
+
|
5 |
+
* 1.35.1 (2018-03-02)
|
6 |
+
|
7 |
+
* added an exception when using "===" instead of "same as"
|
8 |
+
* fixed possible array to string conversion concealing actual error
|
9 |
+
* made variable names deterministic in compiled templates
|
10 |
+
* fixed length filter when passing an instance of IteratorAggregate
|
11 |
+
* fixed Environment::resolveTemplate to accept instances of TemplateWrapper
|
12 |
+
|
13 |
+
* 1.35.0 (2017-09-27)
|
14 |
+
|
15 |
+
* added Twig_Profiler_Profile::reset()
|
16 |
+
* fixed use TokenParser to return an empty Node
|
17 |
+
* added RuntimeExtensionInterface
|
18 |
+
* added circular reference detection when loading templates
|
19 |
+
|
20 |
* 1.34.4 (2017-07-04)
|
21 |
|
22 |
* added support for runtime loaders in IntegrationTestCase
|
161 |
|
162 |
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
163 |
* fixed support for PHP7 (Throwable support)
|
164 |
+
* marked the following methods as being internals on Twig_Environment:
|
165 |
getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(),
|
166 |
getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(),
|
167 |
getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension()
|
245 |
* fixed limited RCEs when in sandbox mode
|
246 |
* deprecated Twig_Template::getEnvironment()
|
247 |
* deprecated the _self variable for usage outside of the from and import tags
|
248 |
+
* added Twig_BaseNodeVisitor to ease the compatibility of node visitors
|
249 |
between 1.x and 2.x
|
250 |
|
251 |
* 1.19.0 (2015-07-31)
|
vendor/twig/twig/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright (c) 2009-
|
2 |
|
3 |
Some rights reserved.
|
4 |
|
1 |
+
Copyright (c) 2009-2018 by the Twig Team.
|
2 |
|
3 |
Some rights reserved.
|
4 |
|
vendor/twig/twig/composer.json
CHANGED
@@ -44,7 +44,7 @@
|
|
44 |
},
|
45 |
"extra": {
|
46 |
"branch-alias": {
|
47 |
-
"dev-master": "1.
|
48 |
}
|
49 |
}
|
50 |
}
|
44 |
},
|
45 |
"extra": {
|
46 |
"branch-alias": {
|
47 |
+
"dev-master": "1.35-dev"
|
48 |
}
|
49 |
}
|
50 |
}
|
vendor/twig/twig/doc/advanced.rst
CHANGED
@@ -800,7 +800,7 @@ The simplest way to use methods is to define them on the extension itself::
|
|
800 |
|
801 |
public function rot13($value)
|
802 |
{
|
803 |
-
return $rot13Provider->rot13($value);
|
804 |
}
|
805 |
}
|
806 |
|
@@ -849,7 +849,7 @@ It is now possible to move the runtime logic to a new
|
|
849 |
|
850 |
public function rot13($value)
|
851 |
{
|
852 |
-
return $rot13Provider->rot13($value);
|
853 |
}
|
854 |
}
|
855 |
|
800 |
|
801 |
public function rot13($value)
|
802 |
{
|
803 |
+
return $this->rot13Provider->rot13($value);
|
804 |
}
|
805 |
}
|
806 |
|
849 |
|
850 |
public function rot13($value)
|
851 |
{
|
852 |
+
return $this->rot13Provider->rot13($value);
|
853 |
}
|
854 |
}
|
855 |
|
vendor/twig/twig/doc/filters/length.rst
CHANGED
@@ -14,6 +14,8 @@ return value of the ``count()`` method.
|
|
14 |
For objects that implement the ``__toString()`` magic method (and not ``Countable``),
|
15 |
it will return the length of the string provided by that method.
|
16 |
|
|
|
|
|
17 |
.. code-block:: jinja
|
18 |
|
19 |
{% if users|length > 10 %}
|
14 |
For objects that implement the ``__toString()`` magic method (and not ``Countable``),
|
15 |
it will return the length of the string provided by that method.
|
16 |
|
17 |
+
For objects that implement the ``IteratorAggregate`` interface, ``length`` will use the return value of the ``iterator_count()`` method.
|
18 |
+
|
19 |
.. code-block:: jinja
|
20 |
|
21 |
{% if users|length > 10 %}
|
vendor/twig/twig/doc/filters/replace.rst
CHANGED
@@ -11,6 +11,12 @@ The ``replace`` filter formats a given string by replacing the placeholders
|
|
11 |
{# outputs I like foo and bar
|
12 |
if the foo parameter equals to the foo string. #}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
Arguments
|
15 |
---------
|
16 |
|
11 |
{# outputs I like foo and bar
|
12 |
if the foo parameter equals to the foo string. #}
|
13 |
|
14 |
+
{# using % as a delimiter is purely conventional and optional #}
|
15 |
+
|
16 |
+
{{ "I like this and --that--."|replace({'this': foo, '--that--': "bar"}) }}
|
17 |
+
|
18 |
+
{# outputs I like foo and bar #}
|
19 |
+
|
20 |
Arguments
|
21 |
---------
|
22 |
|
vendor/twig/twig/doc/functions/block.rst
CHANGED
@@ -18,7 +18,7 @@ times, use the ``block`` function:
|
|
18 |
|
19 |
{% block body %}{% endblock %}
|
20 |
|
21 |
-
The ``block`` function can also be used to display one block
|
22 |
template:
|
23 |
|
24 |
.. code-block:: jinja
|
18 |
|
19 |
{% block body %}{% endblock %}
|
20 |
|
21 |
+
The ``block`` function can also be used to display one block from another
|
22 |
template:
|
23 |
|
24 |
.. code-block:: jinja
|
vendor/twig/twig/doc/templates.rst
CHANGED
@@ -611,7 +611,8 @@ exist:
|
|
611 |
{ 2: 'foo', 4: 'bar' }
|
612 |
|
613 |
{# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #}
|
614 |
-
{
|
|
|
615 |
|
616 |
* ``true`` / ``false``: ``true`` represents the true value, ``false``
|
617 |
represents the false value.
|
611 |
{ 2: 'foo', 4: 'bar' }
|
612 |
|
613 |
{# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #}
|
614 |
+
{% set foo = 'foo' %}
|
615 |
+
{ (foo): 'foo', (1 + 1): 'bar', (foo ~ 'b'): 'baz' }
|
616 |
|
617 |
* ``true`` / ``false``: ``true`` represents the true value, ``false``
|
618 |
represents the false value.
|
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.
|
19 |
|
20 |
#include "php.h"
|
21 |
|
15 |
#ifndef PHP_TWIG_H
|
16 |
#define PHP_TWIG_H
|
17 |
|
18 |
+
#define PHP_TWIG_VERSION "1.35.2"
|
19 |
|
20 |
#include "php.h"
|
21 |
|
vendor/twig/twig/ext/twig/twig.c
CHANGED
@@ -870,6 +870,8 @@ PHP_FUNCTION(twig_template_get_attributes)
|
|
870 |
|
871 |
if (null === $object) {
|
872 |
$message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item);
|
|
|
|
|
873 |
} else {
|
874 |
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
|
875 |
}
|
@@ -885,9 +887,9 @@ PHP_FUNCTION(twig_template_get_attributes)
|
|
885 |
type_name = zend_zval_type_name(object);
|
886 |
Z_ADDREF_P(object);
|
887 |
if (Z_TYPE_P(object) == IS_NULL) {
|
888 |
-
|
889 |
-
|
890 |
-
TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on
|
891 |
} else {
|
892 |
convert_to_string_ex(&object);
|
893 |
|
870 |
|
871 |
if (null === $object) {
|
872 |
$message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item);
|
873 |
+
} elseif (is_array($object)) {
|
874 |
+
$message = sprintf('Impossible to invoke a method ("%s") on an array.', $item);
|
875 |
} else {
|
876 |
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
|
877 |
}
|
887 |
type_name = zend_zval_type_name(object);
|
888 |
Z_ADDREF_P(object);
|
889 |
if (Z_TYPE_P(object) == IS_NULL) {
|
890 |
+
TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a null variable.", item);
|
891 |
+
} else if (Z_TYPE_P(object) == IS_ARRAY) {
|
892 |
+
TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on an array.", item);
|
893 |
} else {
|
894 |
convert_to_string_ex(&object);
|
895 |
|
vendor/twig/twig/lib/Twig/Compiler.php
CHANGED
@@ -25,6 +25,7 @@ class Twig_Compiler implements Twig_CompilerInterface
|
|
25 |
protected $sourceOffset;
|
26 |
protected $sourceLine;
|
27 |
protected $filename;
|
|
|
28 |
|
29 |
public function __construct(Twig_Environment $env)
|
30 |
{
|
@@ -78,6 +79,7 @@ class Twig_Compiler implements Twig_CompilerInterface
|
|
78 |
// source code starts at 1 (as we then increment it when we encounter new lines)
|
79 |
$this->sourceLine = 1;
|
80 |
$this->indentation = $indentation;
|
|
|
81 |
|
82 |
if ($node instanceof Twig_Node_Module) {
|
83 |
// to be removed in 2.0
|
@@ -276,7 +278,7 @@ class Twig_Compiler implements Twig_CompilerInterface
|
|
276 |
|
277 |
public function getVarName()
|
278 |
{
|
279 |
-
return sprintf('__internal_%s', hash('sha256',
|
280 |
}
|
281 |
}
|
282 |
|
25 |
protected $sourceOffset;
|
26 |
protected $sourceLine;
|
27 |
protected $filename;
|
28 |
+
private $varNameSalt = 0;
|
29 |
|
30 |
public function __construct(Twig_Environment $env)
|
31 |
{
|
79 |
// source code starts at 1 (as we then increment it when we encounter new lines)
|
80 |
$this->sourceLine = 1;
|
81 |
$this->indentation = $indentation;
|
82 |
+
$this->varNameSalt = 0;
|
83 |
|
84 |
if ($node instanceof Twig_Node_Module) {
|
85 |
// to be removed in 2.0
|
278 |
|
279 |
public function getVarName()
|
280 |
{
|
281 |
+
return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++));
|
282 |
}
|
283 |
}
|
284 |
|
vendor/twig/twig/lib/Twig/Environment.php
CHANGED
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
class Twig_Environment
|
18 |
{
|
19 |
-
const VERSION = '1.
|
20 |
-
const VERSION_ID =
|
21 |
const MAJOR_VERSION = 1;
|
22 |
-
const MINOR_VERSION =
|
23 |
-
const RELEASE_VERSION =
|
24 |
const EXTRA_VERSION = '';
|
25 |
|
26 |
protected $charset;
|
@@ -58,6 +58,7 @@ class Twig_Environment
|
|
58 |
private $runtimeLoaders = array();
|
59 |
private $runtimes = array();
|
60 |
private $optionsHash;
|
|
|
61 |
|
62 |
/**
|
63 |
* Constructor.
|
@@ -131,14 +132,14 @@ class Twig_Environment
|
|
131 |
// For BC
|
132 |
if (is_string($this->originalCache)) {
|
133 |
$r = new ReflectionMethod($this, 'writeCacheFile');
|
134 |
-
if ($r->getDeclaringClass()->getName()
|
135 |
@trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
|
136 |
|
137 |
$this->bcWriteCacheFile = true;
|
138 |
}
|
139 |
|
140 |
$r = new ReflectionMethod($this, 'getCacheFilename');
|
141 |
-
if ($r->getDeclaringClass()->getName()
|
142 |
@trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
|
143 |
|
144 |
$this->bcGetCacheFilename = true;
|
@@ -382,6 +383,10 @@ class Twig_Environment
|
|
382 |
*
|
383 |
* @param string|Twig_TemplateWrapper|Twig_Template $name The template name
|
384 |
*
|
|
|
|
|
|
|
|
|
385 |
* @return Twig_TemplateWrapper
|
386 |
*/
|
387 |
public function load($name)
|
@@ -472,7 +477,22 @@ class Twig_Environment
|
|
472 |
$this->initRuntime();
|
473 |
}
|
474 |
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
}
|
477 |
|
478 |
/**
|
@@ -542,12 +562,12 @@ class Twig_Environment
|
|
542 |
/**
|
543 |
* Tries to load a template consecutively from an array.
|
544 |
*
|
545 |
-
* Similar to loadTemplate() but it also accepts
|
546 |
-
* of templates where each is tried to be loaded.
|
547 |
*
|
548 |
-
* @param string|Twig_Template|array $names A template or an array of templates to try consecutively
|
549 |
*
|
550 |
-
* @return Twig_Template
|
551 |
*
|
552 |
* @throws Twig_Error_Loader When none of the templates can be found
|
553 |
* @throws Twig_Error_Syntax When an error occurred during compilation
|
@@ -563,6 +583,10 @@ class Twig_Environment
|
|
563 |
return $name;
|
564 |
}
|
565 |
|
|
|
|
|
|
|
|
|
566 |
try {
|
567 |
return $this->loadTemplate($name);
|
568 |
} catch (Twig_Error_Loader $e) {
|
16 |
*/
|
17 |
class Twig_Environment
|
18 |
{
|
19 |
+
const VERSION = '1.35.2';
|
20 |
+
const VERSION_ID = 13501;
|
21 |
const MAJOR_VERSION = 1;
|
22 |
+
const MINOR_VERSION = 35;
|
23 |
+
const RELEASE_VERSION = 1;
|
24 |
const EXTRA_VERSION = '';
|
25 |
|
26 |
protected $charset;
|
58 |
private $runtimeLoaders = array();
|
59 |
private $runtimes = array();
|
60 |
private $optionsHash;
|
61 |
+
private $loading = array();
|
62 |
|
63 |
/**
|
64 |
* Constructor.
|
132 |
// For BC
|
133 |
if (is_string($this->originalCache)) {
|
134 |
$r = new ReflectionMethod($this, 'writeCacheFile');
|
135 |
+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
136 |
@trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
|
137 |
|
138 |
$this->bcWriteCacheFile = true;
|
139 |
}
|
140 |
|
141 |
$r = new ReflectionMethod($this, 'getCacheFilename');
|
142 |
+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
143 |
@trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
|
144 |
|
145 |
$this->bcGetCacheFilename = true;
|
383 |
*
|
384 |
* @param string|Twig_TemplateWrapper|Twig_Template $name The template name
|
385 |
*
|
386 |
+
* @throws Twig_Error_Loader When the template cannot be found
|
387 |
+
* @throws Twig_Error_Runtime When a previously generated cache is corrupted
|
388 |
+
* @throws Twig_Error_Syntax When an error occurred during compilation
|
389 |
+
*
|
390 |
* @return Twig_TemplateWrapper
|
391 |
*/
|
392 |
public function load($name)
|
477 |
$this->initRuntime();
|
478 |
}
|
479 |
|
480 |
+
if (isset($this->loading[$cls])) {
|
481 |
+
throw new Twig_Error_Runtime(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, array($name)))));
|
482 |
+
}
|
483 |
+
|
484 |
+
$this->loading[$cls] = $name;
|
485 |
+
|
486 |
+
try {
|
487 |
+
$this->loadedTemplates[$cls] = new $cls($this);
|
488 |
+
unset($this->loading[$cls]);
|
489 |
+
} catch (\Exception $e) {
|
490 |
+
unset($this->loading[$cls]);
|
491 |
+
|
492 |
+
throw $e;
|
493 |
+
}
|
494 |
+
|
495 |
+
return $this->loadedTemplates[$cls];
|
496 |
}
|
497 |
|
498 |
/**
|
562 |
/**
|
563 |
* Tries to load a template consecutively from an array.
|
564 |
*
|
565 |
+
* Similar to loadTemplate() but it also accepts instances of Twig_Template and
|
566 |
+
* Twig_TemplateWrapper, and an array of templates where each is tried to be loaded.
|
567 |
*
|
568 |
+
* @param string|Twig_Template|Twig_TemplateWrapper|array $names A template or an array of templates to try consecutively
|
569 |
*
|
570 |
+
* @return Twig_Template|Twig_TemplateWrapper
|
571 |
*
|
572 |
* @throws Twig_Error_Loader When none of the templates can be found
|
573 |
* @throws Twig_Error_Syntax When an error occurred during compilation
|
583 |
return $name;
|
584 |
}
|
585 |
|
586 |
+
if ($name instanceof Twig_TemplateWrapper) {
|
587 |
+
return $name;
|
588 |
+
}
|
589 |
+
|
590 |
try {
|
591 |
return $this->loadTemplate($name);
|
592 |
} catch (Twig_Error_Loader $e) {
|
vendor/twig/twig/lib/Twig/ExpressionParser.php
CHANGED
@@ -199,11 +199,14 @@ class Twig_ExpressionParser
|
|
199 |
break;
|
200 |
}
|
201 |
|
|
|
202 |
default:
|
203 |
if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) {
|
204 |
$node = $this->parseArrayExpression();
|
205 |
} elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) {
|
206 |
$node = $this->parseHashExpression();
|
|
|
|
|
207 |
} else {
|
208 |
throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
|
209 |
}
|
@@ -313,7 +316,7 @@ class Twig_ExpressionParser
|
|
313 |
{
|
314 |
while (true) {
|
315 |
$token = $this->parser->getCurrentToken();
|
316 |
-
if ($token->getType()
|
317 |
if ('.' == $token->getValue() || '[' == $token->getValue()) {
|
318 |
$node = $this->parseSubscriptExpression($node);
|
319 |
} elseif ('|' == $token->getValue()) {
|
@@ -384,14 +387,14 @@ class Twig_ExpressionParser
|
|
384 |
$lineno = $token->getLine();
|
385 |
$arguments = new Twig_Node_Expression_Array(array(), $lineno);
|
386 |
$type = Twig_Template::ANY_CALL;
|
387 |
-
if ($token->getValue()
|
388 |
$token = $stream->next();
|
389 |
if (
|
390 |
-
$token->getType()
|
391 |
||
|
392 |
-
$token->getType()
|
393 |
||
|
394 |
-
($token->getType()
|
395 |
) {
|
396 |
$arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno);
|
397 |
|
199 |
break;
|
200 |
}
|
201 |
|
202 |
+
// no break
|
203 |
default:
|
204 |
if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) {
|
205 |
$node = $this->parseArrayExpression();
|
206 |
} elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) {
|
207 |
$node = $this->parseHashExpression();
|
208 |
+
} elseif ($token->test(Twig_Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) {
|
209 |
+
throw new Twig_Error_Syntax(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
|
210 |
} else {
|
211 |
throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
|
212 |
}
|
316 |
{
|
317 |
while (true) {
|
318 |
$token = $this->parser->getCurrentToken();
|
319 |
+
if (Twig_Token::PUNCTUATION_TYPE == $token->getType()) {
|
320 |
if ('.' == $token->getValue() || '[' == $token->getValue()) {
|
321 |
$node = $this->parseSubscriptExpression($node);
|
322 |
} elseif ('|' == $token->getValue()) {
|
387 |
$lineno = $token->getLine();
|
388 |
$arguments = new Twig_Node_Expression_Array(array(), $lineno);
|
389 |
$type = Twig_Template::ANY_CALL;
|
390 |
+
if ('.' == $token->getValue()) {
|
391 |
$token = $stream->next();
|
392 |
if (
|
393 |
+
Twig_Token::NAME_TYPE == $token->getType()
|
394 |
||
|
395 |
+
Twig_Token::NUMBER_TYPE == $token->getType()
|
396 |
||
|
397 |
+
(Twig_Token::OPERATOR_TYPE == $token->getType() && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue()))
|
398 |
) {
|
399 |
$arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno);
|
400 |
|
vendor/twig/twig/lib/Twig/Extension/Core.php
CHANGED
@@ -661,7 +661,7 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
|
|
661 |
|
662 |
if ($start >= 0 && $length >= 0 && $item instanceof Iterator) {
|
663 |
try {
|
664 |
-
return iterator_to_array(new LimitIterator($item, $start,
|
665 |
} catch (OutOfBoundsException $exception) {
|
666 |
return array();
|
667 |
}
|
@@ -1216,7 +1216,7 @@ function _twig_escape_html_attr_callback($matches)
|
|
1216 |
* The following replaces characters undefined in HTML with the
|
1217 |
* hex entity for the Unicode replacement character.
|
1218 |
*/
|
1219 |
-
if (($ord <= 0x1f &&
|
1220 |
return '�';
|
1221 |
}
|
1222 |
|
@@ -1224,7 +1224,7 @@ function _twig_escape_html_attr_callback($matches)
|
|
1224 |
* Check if the current character to escape has a name entity we should
|
1225 |
* replace it with while grabbing the hex value of the character.
|
1226 |
*/
|
1227 |
-
if (strlen($chr)
|
1228 |
$hex = strtoupper(substr('00'.bin2hex($chr), -2));
|
1229 |
} else {
|
1230 |
$chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8');
|
@@ -1271,6 +1271,10 @@ if (function_exists('mb_get_info')) {
|
|
1271 |
return count($thing);
|
1272 |
}
|
1273 |
|
|
|
|
|
|
|
|
|
1274 |
return 1;
|
1275 |
}
|
1276 |
|
@@ -1370,6 +1374,10 @@ else {
|
|
1370 |
return count($thing);
|
1371 |
}
|
1372 |
|
|
|
|
|
|
|
|
|
1373 |
return 1;
|
1374 |
}
|
1375 |
|
@@ -1444,7 +1452,7 @@ function twig_test_empty($value)
|
|
1444 |
*
|
1445 |
* <pre>
|
1446 |
* {# evaluates to true if the foo variable is an array or a traversable object #}
|
1447 |
-
* {% if foo is
|
1448 |
* {# ... #}
|
1449 |
* {% endif %}
|
1450 |
* </pre>
|
661 |
|
662 |
if ($start >= 0 && $length >= 0 && $item instanceof Iterator) {
|
663 |
try {
|
664 |
+
return iterator_to_array(new LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys);
|
665 |
} catch (OutOfBoundsException $exception) {
|
666 |
return array();
|
667 |
}
|
1216 |
* The following replaces characters undefined in HTML with the
|
1217 |
* hex entity for the Unicode replacement character.
|
1218 |
*/
|
1219 |
+
if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) {
|
1220 |
return '�';
|
1221 |
}
|
1222 |
|
1224 |
* Check if the current character to escape has a name entity we should
|
1225 |
* replace it with while grabbing the hex value of the character.
|
1226 |
*/
|
1227 |
+
if (1 == strlen($chr)) {
|
1228 |
$hex = strtoupper(substr('00'.bin2hex($chr), -2));
|
1229 |
} else {
|
1230 |
$chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8');
|
1271 |
return count($thing);
|
1272 |
}
|
1273 |
|
1274 |
+
if ($thing instanceof \IteratorAggregate) {
|
1275 |
+
return iterator_count($thing);
|
1276 |
+
}
|
1277 |
+
|
1278 |
return 1;
|
1279 |
}
|
1280 |
|
1374 |
return count($thing);
|
1375 |
}
|
1376 |
|
1377 |
+
if ($thing instanceof \IteratorAggregate) {
|
1378 |
+
return iterator_count($thing);
|
1379 |
+
}
|
1380 |
+
|
1381 |
return 1;
|
1382 |
}
|
1383 |
|
1452 |
*
|
1453 |
* <pre>
|
1454 |
* {# evaluates to true if the foo variable is an array or a traversable object #}
|
1455 |
+
* {% if foo is iterable %}
|
1456 |
* {# ... #}
|
1457 |
* {% endif %}
|
1458 |
* </pre>
|
vendor/twig/twig/lib/Twig/Lexer.php
CHANGED
@@ -235,7 +235,7 @@ class Twig_Lexer implements Twig_LexerInterface
|
|
235 |
$this->moveCursor($match[0]);
|
236 |
|
237 |
if ($this->cursor >= $this->end) {
|
238 |
-
throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state
|
239 |
}
|
240 |
}
|
241 |
|
@@ -337,7 +337,7 @@ class Twig_Lexer implements Twig_LexerInterface
|
|
337 |
$this->moveCursor($match[0]);
|
338 |
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
|
339 |
list($expect, $lineno) = array_pop($this->brackets);
|
340 |
-
if ($this->code[$this->cursor]
|
341 |
throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
342 |
}
|
343 |
|
235 |
$this->moveCursor($match[0]);
|
236 |
|
237 |
if ($this->cursor >= $this->end) {
|
238 |
+
throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
|
239 |
}
|
240 |
}
|
241 |
|
337 |
$this->moveCursor($match[0]);
|
338 |
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
|
339 |
list($expect, $lineno) = array_pop($this->brackets);
|
340 |
+
if ('"' != $this->code[$this->cursor]) {
|
341 |
throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
342 |
}
|
343 |
|
vendor/twig/twig/lib/Twig/Loader/Filesystem.php
CHANGED
@@ -279,7 +279,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|
279 |
{
|
280 |
return strspn($file, '/\\', 0, 1)
|
281 |
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
282 |
-
&& substr($file, 1, 1)
|
283 |
&& strspn($file, '/\\', 2, 1)
|
284 |
)
|
285 |
|| null !== parse_url($file, PHP_URL_SCHEME)
|
279 |
{
|
280 |
return strspn($file, '/\\', 0, 1)
|
281 |
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
282 |
+
&& ':' === substr($file, 1, 1)
|
283 |
&& strspn($file, '/\\', 2, 1)
|
284 |
)
|
285 |
|| null !== parse_url($file, PHP_URL_SCHEME)
|
vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
CHANGED
@@ -56,7 +56,7 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
|
|
56 |
if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) {
|
57 |
if ($this->inABody) {
|
58 |
if (!$node instanceof Twig_Node_Expression) {
|
59 |
-
if (get_class($node)
|
60 |
array_unshift($this->prependedNodes, array());
|
61 |
}
|
62 |
} else {
|
@@ -88,7 +88,7 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
|
|
88 |
if ($node instanceof Twig_Node_Body) {
|
89 |
$this->inABody = false;
|
90 |
} elseif ($this->inABody) {
|
91 |
-
if (!$expression && get_class($node)
|
92 |
$nodes = array();
|
93 |
foreach (array_unique($prependedNodes) as $name) {
|
94 |
$nodes[] = new Twig_Node_SetTemp($name, $node->getTemplateLine());
|
56 |
if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) {
|
57 |
if ($this->inABody) {
|
58 |
if (!$node instanceof Twig_Node_Expression) {
|
59 |
+
if ('Twig_Node' !== get_class($node)) {
|
60 |
array_unshift($this->prependedNodes, array());
|
61 |
}
|
62 |
} else {
|
88 |
if ($node instanceof Twig_Node_Body) {
|
89 |
$this->inABody = false;
|
90 |
} elseif ($this->inABody) {
|
91 |
+
if (!$expression && 'Twig_Node' !== get_class($node) && $prependedNodes = array_shift($this->prependedNodes)) {
|
92 |
$nodes = array();
|
93 |
foreach (array_unique($prependedNodes) as $name) {
|
94 |
$nodes[] = new Twig_Node_SetTemp($name, $node->getTemplateLine());
|
vendor/twig/twig/lib/Twig/Parser.php
CHANGED
@@ -31,6 +31,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
31 |
protected $importedSymbols;
|
32 |
protected $traits;
|
33 |
protected $embeddedTemplates = array();
|
|
|
34 |
|
35 |
public function __construct(Twig_Environment $env)
|
36 |
{
|
@@ -49,7 +50,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
49 |
|
50 |
public function getVarName()
|
51 |
{
|
52 |
-
return sprintf('__internal_%s', hash('sha256',
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -98,6 +99,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
98 |
$this->blockStack = array();
|
99 |
$this->importedSymbols = array(array());
|
100 |
$this->embeddedTemplates = array();
|
|
|
101 |
|
102 |
try {
|
103 |
$body = $this->subparse($test, $dropNeedle);
|
@@ -153,7 +155,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
153 |
$this->stream->next();
|
154 |
$token = $this->getCurrentToken();
|
155 |
|
156 |
-
if ($token->getType()
|
157 |
throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
|
158 |
}
|
159 |
|
@@ -383,7 +385,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
383 |
throw new Twig_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext());
|
384 |
}
|
385 |
|
386 |
-
throw new Twig_Error_Syntax('A template that extends another one cannot include
|
387 |
}
|
388 |
|
389 |
// bypass nodes that will "capture" the output
|
31 |
protected $importedSymbols;
|
32 |
protected $traits;
|
33 |
protected $embeddedTemplates = array();
|
34 |
+
private $varNameSalt = 0;
|
35 |
|
36 |
public function __construct(Twig_Environment $env)
|
37 |
{
|
50 |
|
51 |
public function getVarName()
|
52 |
{
|
53 |
+
return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++));
|
54 |
}
|
55 |
|
56 |
/**
|
99 |
$this->blockStack = array();
|
100 |
$this->importedSymbols = array(array());
|
101 |
$this->embeddedTemplates = array();
|
102 |
+
$this->varNameSalt = 0;
|
103 |
|
104 |
try {
|
105 |
$body = $this->subparse($test, $dropNeedle);
|
155 |
$this->stream->next();
|
156 |
$token = $this->getCurrentToken();
|
157 |
|
158 |
+
if (Twig_Token::NAME_TYPE !== $token->getType()) {
|
159 |
throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
|
160 |
}
|
161 |
|
385 |
throw new Twig_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext());
|
386 |
}
|
387 |
|
388 |
+
throw new Twig_Error_Syntax('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext());
|
389 |
}
|
390 |
|
391 |
// bypass nodes that will "capture" the output
|
vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
CHANGED
@@ -55,7 +55,7 @@ class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
|
|
55 |
|
56 |
private function getVarName()
|
57 |
{
|
58 |
-
return sprintf('__internal_%s', hash('sha256',
|
59 |
}
|
60 |
|
61 |
public function getPriority()
|
55 |
|
56 |
private function getVarName()
|
57 |
{
|
58 |
+
return sprintf('__internal_%s', hash('sha256', $this->extensionName));
|
59 |
}
|
60 |
|
61 |
public function getPriority()
|
vendor/twig/twig/lib/Twig/Profiler/Profile.php
CHANGED
@@ -145,6 +145,12 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
|
145 |
);
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
public function getIterator()
|
149 |
{
|
150 |
return new ArrayIterator($this->profiles);
|
145 |
);
|
146 |
}
|
147 |
|
148 |
+
public function reset()
|
149 |
+
{
|
150 |
+
$this->starts = $this->ends = $this->profiles = array();
|
151 |
+
$this->enter();
|
152 |
+
}
|
153 |
+
|
154 |
public function getIterator()
|
155 |
{
|
156 |
return new ArrayIterator($this->profiles);
|
vendor/twig/twig/lib/Twig/Template.php
CHANGED
@@ -568,6 +568,8 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
568 |
|
569 |
if (null === $object) {
|
570 |
$message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item);
|
|
|
|
|
571 |
} else {
|
572 |
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
|
573 |
}
|
@@ -696,7 +698,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
696 |
}
|
697 |
@trigger_error($message, E_USER_DEPRECATED);
|
698 |
|
699 |
-
return
|
700 |
}
|
701 |
|
702 |
return $ret;
|
568 |
|
569 |
if (null === $object) {
|
570 |
$message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item);
|
571 |
+
} elseif (is_array($object)) {
|
572 |
+
$message = sprintf('Impossible to invoke a method ("%s") on an array.', $item);
|
573 |
} else {
|
574 |
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
|
575 |
}
|
698 |
}
|
699 |
@trigger_error($message, E_USER_DEPRECATED);
|
700 |
|
701 |
+
return '' === $ret ? '' : new Twig_Markup($ret, $this->env->getCharset());
|
702 |
}
|
703 |
|
704 |
return $ret;
|
vendor/twig/twig/lib/Twig/TokenParser/For.php
CHANGED
@@ -40,7 +40,7 @@ class Twig_TokenParser_For extends Twig_TokenParser
|
|
40 |
|
41 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
42 |
$body = $this->parser->subparse(array($this, 'decideForFork'));
|
43 |
-
if ($stream->next()->getValue()
|
44 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
45 |
$else = $this->parser->subparse(array($this, 'decideForEnd'), true);
|
46 |
} else {
|
40 |
|
41 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
42 |
$body = $this->parser->subparse(array($this, 'decideForFork'));
|
43 |
+
if ('else' == $stream->next()->getValue()) {
|
44 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
45 |
$else = $this->parser->subparse(array($this, 'decideForEnd'), true);
|
46 |
} else {
|
vendor/twig/twig/lib/Twig/TokenParser/Use.php
CHANGED
@@ -57,6 +57,8 @@ class Twig_TokenParser_Use extends Twig_TokenParser
|
|
57 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
58 |
|
59 |
$this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
|
|
|
|
|
60 |
}
|
61 |
|
62 |
public function getTag()
|
57 |
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
58 |
|
59 |
$this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
|
60 |
+
|
61 |
+
return new Twig_Node();
|
62 |
}
|
63 |
|
64 |
public function getTag()
|
vendor/twig/twig/lib/Twig/TokenParserBroker.php
CHANGED
@@ -61,12 +61,12 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
|
|
61 |
}
|
62 |
}
|
63 |
|
64 |
-
public function addTokenParserBroker(
|
65 |
{
|
66 |
$this->brokers[] = $broker;
|
67 |
}
|
68 |
|
69 |
-
public function removeTokenParserBroker(
|
70 |
{
|
71 |
if (false !== $pos = array_search($broker, $this->brokers)) {
|
72 |
unset($this->brokers[$pos]);
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
public function addTokenParserBroker(self $broker)
|
65 |
{
|
66 |
$this->brokers[] = $broker;
|
67 |
}
|
68 |
|
69 |
+
public function removeTokenParserBroker(self $broker)
|
70 |
{
|
71 |
if (false !== $pos = array_search($broker, $this->brokers)) {
|
72 |
unset($this->brokers[$pos]);
|
vendor/twig/twig/lib/Twig/TokenStream.php
CHANGED
@@ -139,7 +139,7 @@ class Twig_TokenStream
|
|
139 |
*/
|
140 |
public function isEOF()
|
141 |
{
|
142 |
-
return $this->tokens[$this->current]->getType()
|
143 |
}
|
144 |
|
145 |
/**
|
139 |
*/
|
140 |
public function isEOF()
|
141 |
{
|
142 |
+
return Twig_Token::EOF_TYPE === $this->tokens[$this->current]->getType();
|
143 |
}
|
144 |
|
145 |
/**
|
vendor/twig/twig/phpunit.xml.dist
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
processIsolation="false"
|
10 |
stopOnFailure="false"
|
11 |
syntaxCheck="false"
|
12 |
-
bootstrap="
|
13 |
>
|
14 |
<testsuites>
|
15 |
<testsuite name="Twig Test Suite">
|
9 |
processIsolation="false"
|
10 |
stopOnFailure="false"
|
11 |
syntaxCheck="false"
|
12 |
+
bootstrap="vendor/autoload.php"
|
13 |
>
|
14 |
<testsuites>
|
15 |
<testsuite name="Twig Test Suite">
|
vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Twig\Extension;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
16 |
+
*/
|
17 |
+
interface RuntimeExtensionInterface
|
18 |
+
{
|
19 |
+
}
|
vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_AutoloaderTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_AutoloaderTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
|
12 |
require_once dirname(dirname(__FILE__)).'/FilesystemHelper.php';
|
13 |
|
14 |
-
class Twig_Tests_Cache_FilesystemTest extends
|
15 |
{
|
16 |
private $classname;
|
17 |
private $directory;
|
11 |
|
12 |
require_once dirname(dirname(__FILE__)).'/FilesystemHelper.php';
|
13 |
|
14 |
+
class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
|
15 |
{
|
16 |
private $classname;
|
17 |
private $directory;
|
vendor/twig/twig/test/Twig/Tests/CompilerTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_CompilerTest extends
|
13 |
{
|
14 |
public function testReprNumericValueWithLocale()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_CompilerTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testReprNumericValueWithLocale()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_ContainerRuntimeLoaderTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class CustomExtensionTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class CustomExtensionTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
|
12 |
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
13 |
|
14 |
-
class Twig_Tests_EnvironmentTest extends
|
15 |
{
|
16 |
private $deprecations = array();
|
17 |
|
@@ -480,6 +480,33 @@ EOF
|
|
480 |
$this->assertEquals('foo', $twig->render('func_string_named_args'));
|
481 |
}
|
482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
protected function getMockLoader($templateName, $templateContent)
|
484 |
{
|
485 |
// to be removed in 2.0
|
11 |
|
12 |
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
13 |
|
14 |
+
class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
15 |
{
|
16 |
private $deprecations = array();
|
17 |
|
480 |
$this->assertEquals('foo', $twig->render('func_string_named_args'));
|
481 |
}
|
482 |
|
483 |
+
/**
|
484 |
+
* @expectedException Twig_Error_Runtime
|
485 |
+
* @expectedExceptionMessage Circular reference detected for Twig template "base.html.twig", path: base.html.twig -> base.html.twig in "base.html.twig" at line 1
|
486 |
+
*/
|
487 |
+
public function testFailLoadTemplateOnCircularReference()
|
488 |
+
{
|
489 |
+
$twig = new Twig_Environment(new Twig_Loader_Array(array(
|
490 |
+
'base.html.twig' => '{% extends "base.html.twig" %}',
|
491 |
+
)));
|
492 |
+
|
493 |
+
$twig->loadTemplate('base.html.twig');
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* @expectedException Twig_Error_Runtime
|
498 |
+
* @expectedExceptionMessage Circular reference detected for Twig template "base1.html.twig", path: base1.html.twig -> base2.html.twig -> base1.html.twig in "base1.html.twig" at line 1
|
499 |
+
*/
|
500 |
+
public function testFailLoadTemplateOnComplexCircularReference()
|
501 |
+
{
|
502 |
+
$twig = new Twig_Environment(new Twig_Loader_Array(array(
|
503 |
+
'base1.html.twig' => '{% extends "base2.html.twig" %}',
|
504 |
+
'base2.html.twig' => '{% extends "base1.html.twig" %}',
|
505 |
+
)));
|
506 |
+
|
507 |
+
$twig->loadTemplate('base1.html.twig');
|
508 |
+
}
|
509 |
+
|
510 |
protected function getMockLoader($templateName, $templateContent)
|
511 |
{
|
512 |
// to be removed in 2.0
|
vendor/twig/twig/test/Twig/Tests/ErrorTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_ErrorTest extends
|
13 |
{
|
14 |
public function testErrorWithObjectFilename()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_ErrorTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testErrorWithObjectFilename()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_ExpressionParserTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @expectedException Twig_Error_Syntax
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @expectedException Twig_Error_Syntax
|
vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Extension_CoreTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @dataProvider getRandomFunctionTestData
|
@@ -264,7 +264,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
264 |
array(array(), new CoreTestIterator($i, $keys, true), count($keys) + 10),
|
265 |
array('de', 'abcdef', 3, 2),
|
266 |
array(array(), new SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3),
|
267 |
-
array(array(), new ArrayIterator(array(1, 2)), 3)
|
268 |
);
|
269 |
}
|
270 |
}
|
@@ -344,7 +344,7 @@ final class CoreTestIterator implements Iterator
|
|
344 |
{
|
345 |
++$this->position;
|
346 |
if ($this->position === $this->maxPosition) {
|
347 |
-
|
348 |
}
|
349 |
}
|
350 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @dataProvider getRandomFunctionTestData
|
264 |
array(array(), new CoreTestIterator($i, $keys, true), count($keys) + 10),
|
265 |
array('de', 'abcdef', 3, 2),
|
266 |
array(array(), new SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3),
|
267 |
+
array(array(), new ArrayIterator(array(1, 2)), 3),
|
268 |
);
|
269 |
}
|
270 |
}
|
344 |
{
|
345 |
++$this->position;
|
346 |
if ($this->position === $this->maxPosition) {
|
347 |
+
throw new LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition));
|
348 |
}
|
349 |
}
|
350 |
|
vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Extension_SandboxTest extends
|
13 |
{
|
14 |
protected static $params;
|
15 |
protected static $templates;
|
@@ -252,7 +252,7 @@ EOF
|
|
252 |
} catch (Throwable $e) {
|
253 |
} catch (Exception $e) {
|
254 |
}
|
255 |
-
if (
|
256 |
$this->fail('An exception should be thrown for this test to be valid.');
|
257 |
}
|
258 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
protected static $params;
|
15 |
protected static $templates;
|
252 |
} catch (Throwable $e) {
|
253 |
} catch (Exception $e) {
|
254 |
}
|
255 |
+
if (null === $e) {
|
256 |
$this->fail('An exception should be thrown for this test to be valid.');
|
257 |
}
|
258 |
|
vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_FactoryRuntimeLoaderTest extends
|
13 |
{
|
14 |
public function testLoad()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testLoad()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/FileCachingTest.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
|
12 |
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
13 |
|
14 |
-
class Twig_Tests_FileCachingTest extends
|
15 |
{
|
16 |
private $env;
|
17 |
private $tmpDir;
|
11 |
|
12 |
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
13 |
|
14 |
+
class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase
|
15 |
{
|
16 |
private $env;
|
17 |
private $tmpDir;
|
vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_FileExtensionEscapingStrategyTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @dataProvider getGuessData
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @dataProvider getGuessData
|
vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
--TEST--
|
2 |
-
Exception for child templates defining
|
3 |
--TEMPLATE--
|
4 |
{% extends 'base.twig' %}
|
5 |
|
@@ -12,4 +12,4 @@ Content outside a block.
|
|
12 |
{% block sidebar %}
|
13 |
{% endblock %}
|
14 |
--EXCEPTION--
|
15 |
-
Twig_Error_Syntax: A template that extends another one cannot include
|
1 |
--TEST--
|
2 |
+
Exception for child templates defining content outside blocks defined by parent
|
3 |
--TEMPLATE--
|
4 |
{% extends 'base.twig' %}
|
5 |
|
12 |
{% block sidebar %}
|
13 |
{% endblock %}
|
14 |
--EXCEPTION--
|
15 |
+
Twig_Error_Syntax: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 3?
|
vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
--TEST--
|
2 |
+
The PHP === strict comparison operator is not supported
|
3 |
+
--TEMPLATE--
|
4 |
+
{{ 1 === 2 }}
|
5 |
+
--EXCEPTION--
|
6 |
+
Twig_Error_Syntax: Unexpected operator of value "=". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead in "index.twig" at line 2.
|
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
{{ number|length }}
|
7 |
{{ to_string_able|length }}
|
8 |
{{ countable|length }}
|
|
|
9 |
{{ null|length }}
|
10 |
{{ magic|length }}
|
11 |
{{ non_countable|length }}
|
@@ -16,6 +17,7 @@ return array(
|
|
16 |
'number' => 1000,
|
17 |
'to_string_able' => new ToStringStub('foobar'),
|
18 |
'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */
|
|
|
19 |
'null' => null,
|
20 |
'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */
|
21 |
'non_countable' => new \StdClass(),
|
@@ -26,6 +28,7 @@ return array(
|
|
26 |
4
|
27 |
6
|
28 |
42
|
|
|
29 |
0
|
30 |
1
|
31 |
1
|
6 |
{{ number|length }}
|
7 |
{{ to_string_able|length }}
|
8 |
{{ countable|length }}
|
9 |
+
{{ iterator_aggregate|length }}
|
10 |
{{ null|length }}
|
11 |
{{ magic|length }}
|
12 |
{{ non_countable|length }}
|
17 |
'number' => 1000,
|
18 |
'to_string_able' => new ToStringStub('foobar'),
|
19 |
'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */
|
20 |
+
'iterator_aggregate' => new IteratorAggregateStub(array('a', 'b', 'c')), /* also asserts we do *not* call __toString() */
|
21 |
'null' => null,
|
22 |
'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */
|
23 |
'non_countable' => new \StdClass(),
|
28 |
4
|
29 |
6
|
30 |
42
|
31 |
+
3
|
32 |
0
|
33 |
1
|
34 |
1
|
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
--TEST--
|
2 |
+
"use" tag with a parent block
|
3 |
+
--TEMPLATE--
|
4 |
+
{% extends "parent.twig" %}
|
5 |
+
|
6 |
+
{% use 'blocks.twig' %}
|
7 |
+
|
8 |
+
{% block body %}
|
9 |
+
{{ parent() -}}
|
10 |
+
CHILD
|
11 |
+
{{ block('content') }}
|
12 |
+
{% endblock %}
|
13 |
+
--TEMPLATE(parent.twig)--
|
14 |
+
{% block body %}
|
15 |
+
PARENT
|
16 |
+
{% endblock %}
|
17 |
+
--TEMPLATE(blocks.twig)--
|
18 |
+
{% block content 'BLOCK' %}
|
19 |
+
--DATA--
|
20 |
+
return array()
|
21 |
+
--EXPECT--
|
22 |
+
PARENT
|
23 |
+
CHILD
|
24 |
+
BLOCK
|
vendor/twig/twig/test/Twig/Tests/IntegrationTest.php
CHANGED
@@ -307,3 +307,21 @@ class CountableStub implements \Countable
|
|
307 |
throw new Exception('__toString shall not be called on \Countables');
|
308 |
}
|
309 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
throw new Exception('__toString shall not be called on \Countables');
|
308 |
}
|
309 |
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* This class is used in tests for the length filter.
|
313 |
+
*/
|
314 |
+
class IteratorAggregateStub implements \IteratorAggregate
|
315 |
+
{
|
316 |
+
private $data;
|
317 |
+
|
318 |
+
public function __construct(array $data)
|
319 |
+
{
|
320 |
+
$this->data = $data;
|
321 |
+
}
|
322 |
+
|
323 |
+
public function getIterator()
|
324 |
+
{
|
325 |
+
return new ArrayIterator($this->data);
|
326 |
+
}
|
327 |
+
}
|
vendor/twig/twig/test/Twig/Tests/LexerTest.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
-
class Twig_Tests_LexerTest extends
|
12 |
{
|
13 |
/**
|
14 |
* @group legacy
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
+
class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase
|
12 |
{
|
13 |
/**
|
14 |
* @group legacy
|
vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Loader_ArrayTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Loader_ChainTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @group legacy
|
vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Loader_FilesystemTest extends
|
13 |
{
|
14 |
public function testGetSourceContext()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testGetSourceContext()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_NativeExtensionTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_NativeExtensionTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Node_Expression_CallTest extends
|
13 |
{
|
14 |
public function testGetArguments()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testGetArguments()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
-
class Twig_Tests_NodeVisitor_OptimizerTest extends
|
12 |
{
|
13 |
public function testRenderBlockOptimizer()
|
14 |
{
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
+
class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase
|
12 |
{
|
13 |
public function testRenderBlockOptimizer()
|
14 |
{
|
vendor/twig/twig/test/Twig/Tests/ParserTest.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
-
class Twig_Tests_ParserTest extends
|
12 |
{
|
13 |
/**
|
14 |
* @expectedException Twig_Error_Syntax
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
+
class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
|
12 |
{
|
13 |
/**
|
14 |
* @expectedException Twig_Error_Syntax
|
vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
abstract class Twig_Tests_Profiler_Dumper_AbstractTest extends
|
13 |
{
|
14 |
protected function getProfile()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
abstract class Twig_Tests_Profiler_Dumper_AbstractTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
protected function getProfile()
|
15 |
{
|
vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Profiler_ProfileTest extends
|
13 |
{
|
14 |
public function testConstructor()
|
15 |
{
|
@@ -97,4 +97,14 @@ class Twig_Tests_Profiler_ProfileTest extends PHPUnit_Framework_TestCase
|
|
97 |
$this->assertEquals($profile1->getType(), $profile3->getType());
|
98 |
$this->assertEquals($profile1->getName(), $profile3->getName());
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Profiler_ProfileTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
public function testConstructor()
|
15 |
{
|
97 |
$this->assertEquals($profile1->getType(), $profile3->getType());
|
98 |
$this->assertEquals($profile1->getName(), $profile3->getName());
|
99 |
}
|
100 |
+
|
101 |
+
public function testReset()
|
102 |
+
{
|
103 |
+
$profile = new Twig_Profiler_Profile();
|
104 |
+
usleep(1);
|
105 |
+
$profile->leave();
|
106 |
+
$profile->reset();
|
107 |
+
|
108 |
+
$this->assertEquals(0, $profile->getDuration());
|
109 |
+
}
|
110 |
}
|
vendor/twig/twig/test/Twig/Tests/TemplateTest.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
-
class Twig_Tests_TemplateTest extends
|
12 |
{
|
13 |
/**
|
14 |
* @expectedException LogicException
|
@@ -58,6 +58,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
58 |
array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'),
|
59 |
array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'),
|
60 |
array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'),
|
|
|
61 |
array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'),
|
62 |
array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'),
|
63 |
array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'),
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
+
class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
|
12 |
{
|
13 |
/**
|
14 |
* @expectedException LogicException
|
58 |
array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'),
|
59 |
array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'),
|
60 |
array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'),
|
61 |
+
array('{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'),
|
62 |
array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'),
|
63 |
array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'),
|
64 |
array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'),
|
vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
-
class Twig_Tests_TemplateWrapperTest extends
|
12 |
{
|
13 |
public function testHasGetBlocks()
|
14 |
{
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
+
class Twig_Tests_TemplateWrapperTest extends \PHPUnit\Framework\TestCase
|
12 |
{
|
13 |
public function testHasGetBlocks()
|
14 |
{
|
vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_TokenStreamTest extends
|
13 |
{
|
14 |
protected static $tokens;
|
15 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
protected static $tokens;
|
15 |
|
vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class Twig_Tests_Util_DeprecationCollectorTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_Tests_Util_DeprecationCollectorTest extends \PHPUnit\Framework\TestCase
|
13 |
{
|
14 |
/**
|
15 |
* @requires PHP 5.3
|
vendor/twig/twig/test/Twig/Tests/escapingTest.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
7 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
8 |
*/
|
9 |
-
class Twig_Test_EscapingTest extends
|
10 |
{
|
11 |
/**
|
12 |
* All character encodings supported by htmlspecialchars().
|
6 |
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
7 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
8 |
*/
|
9 |
+
class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase
|
10 |
{
|
11 |
/**
|
12 |
* All character encodings supported by htmlspecialchars().
|
vendor/twig/twig/test/bootstrap.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of Twig.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
if (PHP_VERSION_ID < 50300) {
|
13 |
-
require_once dirname(__FILE__).'/../lib/Twig/Autoloader.php';
|
14 |
-
Twig_Autoloader::register(true);
|
15 |
-
} else {
|
16 |
-
require __DIR__.'/../vendor/autoload.php';
|
17 |
-
|
18 |
-
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
|
19 |
-
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|