Version Description
Fixes and improvements
- {{ post.date }} and {{ post.time }} now use date_i18n
under the hood instead of mysql2date
#2104 #2126 (thanks @palmiak)
- WordPress 4.9.8 is the new min supported version.
Changes for Theme Developers
- We're now using minimum versions of Twig 1.41 and 2.10
- Twig introduced a filter filter (you read that right, a filter named filter like {{ sizes | filter(v => v > 38) }}
. This wrecked havoc on our own pre-existing Timber filter filter {{ posts | filter({post_title:"Cheese", post_content:"Yum!"}, "AND") }}
. In #2124 we gave Twig's filter the preferred treatment. However, if the arguments look like you intend to use the old filter (which is a wrapper for WordPress's WP_List_Util class) we use what's there. Want to keep using the class Timber filter filter? Switch it to wp_list_filter
as in {{ posts | wp_list_filter({post_title:"Cheese", post_content:"Yum!"}, "AND") }}
(thanks @palmiak @gchtr @nlemoine @aj-adl @rubas @xdevelx and others)
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.14.0 |
Comparing to | |
See all releases |
Code changes from version 1.13.0 to 1.14.0
- lib/Helper.php +26 -4
- lib/Image/Operation.php +4 -6
- lib/ImageHelper.php +1 -2
- lib/PathHelper.php +34 -13
- lib/Post.php +2 -2
- lib/Timber.php +1 -1
- lib/Twig.php +7 -0
- readme.txt +11 -2
- timber-starter-theme/templates/single.twig +1 -1
- timber.php +1 -1
- vendor/asm89/twig-cache-extension/.travis.yml +38 -30
- vendor/asm89/twig-cache-extension/composer.json +5 -1
- vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/Extension.php +1 -1
- vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheProvider/DoctrineCacheAdapterTest.php +1 -1
- vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/GenerationCacheStrategyTest.php +2 -2
- vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/IndexedChainingCacheStrategyTest.php +1 -1
- vendor/asm89/twig-cache-extension/test/Asm89/Twig/CacheExtension/Tests/CacheStrategy/LifetimeCacheStrategyTest.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +6 -6
- vendor/composer/installed.json +16 -15
- vendor/symfony/polyfill-ctype/composer.json +1 -1
@@ -172,8 +172,9 @@ class Helper {
|
|
172 |
}
|
173 |
|
174 |
/**
|
|
|
175 |
* @deprecated since 1.3.0
|
176 |
-
*
|
177 |
* @param mixed $function_name String or array( $class( string|object ), $function_name ).
|
178 |
* @param array $defaults Optional.
|
179 |
* @param bool $return_output_buffer Optional. Return function output instead of return value. Default false.
|
@@ -423,16 +424,37 @@ class Helper {
|
|
423 |
|
424 |
/**
|
425 |
* Filters a list of objects, based on a set of key => value arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
*
|
427 |
* @since 1.5.3
|
428 |
* @ticket #1594
|
429 |
* @param array $list to filter.
|
430 |
-
* @param string|array $
|
431 |
* @param string $operator to use (AND, NOT, OR).
|
432 |
* @return array
|
433 |
*/
|
434 |
-
public static function
|
435 |
-
if ( ! is_array($args) ) {
|
436 |
$args = array( 'slug' => $args );
|
437 |
}
|
438 |
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
+
* @codeCoverageIgnore
|
176 |
* @deprecated since 1.3.0
|
177 |
+
*
|
178 |
* @param mixed $function_name String or array( $class( string|object ), $function_name ).
|
179 |
* @param array $defaults Optional.
|
180 |
* @param bool $return_output_buffer Optional. Return function output instead of return value. Default false.
|
424 |
|
425 |
/**
|
426 |
* Filters a list of objects, based on a set of key => value arguments.
|
427 |
+
* Uses native Twig Filter.
|
428 |
+
*
|
429 |
+
* @since 1.14.0
|
430 |
+
* @param array $list to filter.
|
431 |
+
* @param callback|string|array $arrow function used for filtering,
|
432 |
+
* string or array for backward compatibility.
|
433 |
+
* @param string $operator to use (AND, NOT, OR). For backward compatibility.
|
434 |
+
* @return array
|
435 |
+
*/
|
436 |
+
public static function filter_array( $list, $arrow, $operator = 'AND' ) {
|
437 |
+
if ( ! is_callable( $arrow ) ) {
|
438 |
+
self::warn( 'This filter is using Twig\'s filter by default. If you want to use wp_list_filter use {{ my_array|wp_list_filter }}.' );
|
439 |
+
return self::wp_list_filter( $list, $arrow, $operator );
|
440 |
+
}
|
441 |
+
|
442 |
+
return twig_array_filter( $list, $arrow );
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Filters a list of objects, based on a set of key => value arguments.
|
447 |
+
* Uses WordPress WP_List_Util's filter.
|
448 |
*
|
449 |
* @since 1.5.3
|
450 |
* @ticket #1594
|
451 |
* @param array $list to filter.
|
452 |
+
* @param string|array $args to search for.
|
453 |
* @param string $operator to use (AND, NOT, OR).
|
454 |
* @return array
|
455 |
*/
|
456 |
+
public static function wp_list_filter( $list, $args, $operator = 'AND' ) {
|
457 |
+
if ( ! is_array( $args ) ) {
|
458 |
$args = array( 'slug' => $args );
|
459 |
}
|
460 |
|
@@ -36,16 +36,14 @@ abstract class Operation {
|
|
36 |
/**
|
37 |
* Helper method to convert hex string to rgb array
|
38 |
*
|
39 |
-
* @param string $hexstr hex color string (like '#FF1455')
|
40 |
* @return array array('red', 'green', 'blue') to int
|
41 |
* ex: array('red' => 255, 'green' => 20, 'blue' => 85);
|
42 |
*/
|
43 |
public static function hexrgb( $hexstr ) {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if ( strlen($hexstr) == 4 ) {
|
48 |
-
$hexstr = '#'.$hexstr[1].$hexstr[1].$hexstr[2].$hexstr[2].$hexstr[3].$hexstr[3];
|
49 |
}
|
50 |
$int = hexdec($hexstr);
|
51 |
return array("red" => 0xFF & ($int >> 0x10), "green" => 0xFF & ($int >> 0x8), "blue" => 0xFF & $int);
|
36 |
/**
|
37 |
* Helper method to convert hex string to rgb array
|
38 |
*
|
39 |
+
* @param string $hexstr hex color string (like '#FF1455', 'FF1455', '#CCC', 'CCC')
|
40 |
* @return array array('red', 'green', 'blue') to int
|
41 |
* ex: array('red' => 255, 'green' => 20, 'blue' => 85);
|
42 |
*/
|
43 |
public static function hexrgb( $hexstr ) {
|
44 |
+
$hexstr = str_replace('#', '', $hexstr);
|
45 |
+
if ( strlen($hexstr) == 3 ) {
|
46 |
+
$hexstr = $hexstr[0].$hexstr[0].$hexstr[1].$hexstr[1].$hexstr[2].$hexstr[2];
|
|
|
|
|
47 |
}
|
48 |
$int = hexdec($hexstr);
|
49 |
return array("red" => 0xFF & ($int >> 0x10), "green" => 0xFF & ($int >> 0x8), "blue" => 0xFF & $int);
|
@@ -499,11 +499,10 @@ class ImageHelper {
|
|
499 |
if ( !empty($subdir) ) {
|
500 |
$url .= $subdir;
|
501 |
}
|
502 |
-
$url
|
503 |
if ( !$absolute ) {
|
504 |
$url = str_replace(site_url(), '', $url);
|
505 |
}
|
506 |
-
// $url = TimberURLHelper::remove_double_slashes( $url);
|
507 |
return $url;
|
508 |
}
|
509 |
|
499 |
if ( !empty($subdir) ) {
|
500 |
$url .= $subdir;
|
501 |
}
|
502 |
+
$url = untrailingslashit($url).'/'.$filename;
|
503 |
if ( !$absolute ) {
|
504 |
$url = str_replace(site_url(), '', $url);
|
505 |
}
|
|
|
506 |
return $url;
|
507 |
}
|
508 |
|
@@ -3,20 +3,30 @@
|
|
3 |
namespace Timber;
|
4 |
|
5 |
/**
|
|
|
|
|
6 |
* Useful methods for working with file paths.
|
|
|
|
|
|
|
7 |
*/
|
8 |
class PathHelper {
|
9 |
-
|
10 |
/**
|
|
|
11 |
*
|
12 |
-
* Unicode-friendly version of
|
13 |
-
* https://www.php.net/manual/en/function.pathinfo.php
|
14 |
*
|
15 |
-
* @
|
16 |
-
*
|
17 |
-
* @
|
|
|
18 |
*
|
19 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
public static function pathinfo( $path, $options = PATHINFO_DIRNAME |
|
22 |
PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME
|
@@ -29,27 +39,38 @@ class PathHelper {
|
|
29 |
),
|
30 |
$options
|
31 |
);
|
|
|
32 |
if ( is_array( $info ) ) {
|
33 |
-
//
|
34 |
return array_map( 'rawurldecode', $info );
|
35 |
} else {
|
36 |
-
//
|
37 |
return rawurldecode( $info );
|
38 |
}
|
39 |
}
|
40 |
|
41 |
/**
|
|
|
42 |
*
|
43 |
* Unicode-friendly version of the PHP basename() function.
|
44 |
-
* https://www.php.net/manual/en/function.basename.php
|
45 |
*
|
46 |
-
* @
|
47 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
* @return string
|
49 |
*/
|
50 |
public static function basename( $path, $suffix = '' ) {
|
51 |
return rawurldecode(
|
52 |
-
basename(
|
|
|
|
|
|
|
53 |
);
|
54 |
}
|
55 |
}
|
3 |
namespace Timber;
|
4 |
|
5 |
/**
|
6 |
+
* Class PathHelper
|
7 |
+
*
|
8 |
* Useful methods for working with file paths.
|
9 |
+
*
|
10 |
+
* @api
|
11 |
+
* @since 1.11.1
|
12 |
*/
|
13 |
class PathHelper {
|
|
|
14 |
/**
|
15 |
+
* Returns information about a file path.
|
16 |
*
|
17 |
+
* Unicode-friendly version of PHP’s pathinfo() function.
|
|
|
18 |
*
|
19 |
+
* @link https://www.php.net/manual/en/function.pathinfo.php
|
20 |
+
*
|
21 |
+
* @api
|
22 |
+
* @since 1.11.1
|
23 |
*
|
24 |
+
* @param string $path The path to be parsed.
|
25 |
+
* @param int $options The path part to extract. One of `PATHINFO_DIRNAME`,
|
26 |
+
* `PATHINFO_BASENAME`, `PATHINFO_EXTENSION` or `PATHINFO_FILENAME`. If
|
27 |
+
* not specified, returns all available elements.
|
28 |
+
*
|
29 |
+
* @return mixed
|
30 |
*/
|
31 |
public static function pathinfo( $path, $options = PATHINFO_DIRNAME |
|
32 |
PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME
|
39 |
),
|
40 |
$options
|
41 |
);
|
42 |
+
|
43 |
if ( is_array( $info ) ) {
|
44 |
+
// Decode all keys in the array.
|
45 |
return array_map( 'rawurldecode', $info );
|
46 |
} else {
|
47 |
+
// Decode the string when requesting a single path component.
|
48 |
return rawurldecode( $info );
|
49 |
}
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* Returns trailing name component of path.
|
54 |
*
|
55 |
* Unicode-friendly version of the PHP basename() function.
|
|
|
56 |
*
|
57 |
+
* @link https://www.php.net/manual/en/function.basename.php
|
58 |
+
*
|
59 |
+
* @api
|
60 |
+
* @since 1.11.1
|
61 |
+
*
|
62 |
+
* @param string $path The path.
|
63 |
+
* @param string $suffix Optional. If the name component ends in suffix, this part will also be
|
64 |
+
* cut off.
|
65 |
+
*
|
66 |
* @return string
|
67 |
*/
|
68 |
public static function basename( $path, $suffix = '' ) {
|
69 |
return rawurldecode(
|
70 |
+
basename(
|
71 |
+
str_replace( array( '%2F', '%5C' ), '/', rawurlencode( $path ) ),
|
72 |
+
$suffix
|
73 |
+
)
|
74 |
);
|
75 |
}
|
76 |
}
|
@@ -1259,7 +1259,7 @@ class Post extends Core implements CoreInterface {
|
|
1259 |
*/
|
1260 |
public function date( $date_format = '' ) {
|
1261 |
$df = $date_format ? $date_format : get_option('date_format');
|
1262 |
-
$the_date = (
|
1263 |
return apply_filters('get_the_date', $the_date, $df);
|
1264 |
}
|
1265 |
|
@@ -1283,7 +1283,7 @@ class Post extends Core implements CoreInterface {
|
|
1283 |
*/
|
1284 |
public function time( $time_format = '' ) {
|
1285 |
$tf = $time_format ? $time_format : get_option('time_format');
|
1286 |
-
$the_time = (
|
1287 |
return apply_filters('get_the_time', $the_time, $tf);
|
1288 |
}
|
1289 |
|
1259 |
*/
|
1260 |
public function date( $date_format = '' ) {
|
1261 |
$df = $date_format ? $date_format : get_option('date_format');
|
1262 |
+
$the_date = date_i18n($df, strtotime($this->post_date));
|
1263 |
return apply_filters('get_the_date', $the_date, $df);
|
1264 |
}
|
1265 |
|
1283 |
*/
|
1284 |
public function time( $time_format = '' ) {
|
1285 |
$tf = $time_format ? $time_format : get_option('time_format');
|
1286 |
+
$the_time = date_i18n($tf, strtotime($this->post_date));
|
1287 |
return apply_filters('get_the_time', $the_time, $tf);
|
1288 |
}
|
1289 |
|
@@ -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.14.0';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
@@ -207,7 +207,14 @@ class Twig {
|
|
207 |
$twig->addFilter(new Twig_Filter('list', array($this, 'add_list_separators')));
|
208 |
|
209 |
$twig->addFilter(new Twig_Filter('pluck', array('Timber\Helper', 'pluck')));
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
$twig->addFilter(new Twig_Filter('filter', array('Timber\Helper', 'filter_array')));
|
|
|
211 |
|
212 |
$twig->addFilter(new Twig_Filter('relative', function( $link ) {
|
213 |
return URLHelper::get_rel_url($link, true);
|
207 |
$twig->addFilter(new Twig_Filter('list', array($this, 'add_list_separators')));
|
208 |
|
209 |
$twig->addFilter(new Twig_Filter('pluck', array('Timber\Helper', 'pluck')));
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @deprecated since 1.13 (to be removed in 2.0). Use Twig's native filter filter instead
|
213 |
+
* @todo remove this in 2.x so that filter merely passes to Twig's filter without any modification
|
214 |
+
* @ticket #1594 #2120
|
215 |
+
*/
|
216 |
$twig->addFilter(new Twig_Filter('filter', array('Timber\Helper', 'filter_array')));
|
217 |
+
$twig->addFilter(new Twig_Filter('wp_list_filter', array('Timber\Helper', 'wp_list_filter')));
|
218 |
|
219 |
$twig->addFilter(new Twig_Filter('relative', function( $link ) {
|
220 |
return URLHelper::get_rel_url($link, true);
|
@@ -1,9 +1,9 @@
|
|
1 |
=== Timber ===
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
-
Requires at least: 4.
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 1.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -34,6 +34,15 @@ _Twig is the template language powering Timber; if you need a little background
|
|
34 |
|
35 |
**Changes for Theme Developers**
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
= 1.13.0 =
|
38 |
**Fixes and improvements**
|
39 |
- Fix issue with debug on/off in certain installs #2084 (thanks @kmonahan)
|
1 |
=== Timber ===
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
+
Requires at least: 4.9.8
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 1.14.0
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
34 |
|
35 |
**Changes for Theme Developers**
|
36 |
|
37 |
+
= 1.14.0 =
|
38 |
+
**Fixes and improvements**
|
39 |
+
- {{ post.date }} and {{ post.time }} now use `date_i18n` under the hood instead of `mysql2date` #2104 #2126 (thanks @palmiak)
|
40 |
+
- WordPress 4.9.8 is the new min supported version.
|
41 |
+
|
42 |
+
**Changes for Theme Developers**
|
43 |
+
- We're now using minimum versions of Twig 1.41 and 2.10
|
44 |
+
- Twig introduced a [filter filter](https://twig.symfony.com/doc/1.x/filters/filter.html) (you read that right, a filter named filter — like `{{ sizes | filter(v => v > 38) }}`. This wrecked havoc on our own pre-existing Timber filter filter `{{ posts | filter({post_title:"Cheese", post_content:"Yum!"}, "AND") }}`. In #2124 we gave Twig's filter the preferred treatment. However, if the arguments look like you intend to use the old filter (which is a wrapper for WordPress's WP_List_Util class) we use what's there. Want to keep using the class Timber filter filter? Switch it to `wp_list_filter` as in `{{ posts | wp_list_filter({post_title:"Cheese", post_content:"Yum!"}, "AND") }}` (thanks @palmiak @gchtr @nlemoine @aj-adl @rubas @xdevelx and others)
|
45 |
+
|
46 |
= 1.13.0 =
|
47 |
**Fixes and improvements**
|
48 |
- Fix issue with debug on/off in certain installs #2084 (thanks @kmonahan)
|
@@ -8,7 +8,7 @@
|
|
8 |
<h1 class="article-h1">{{ post.title }}</h1>
|
9 |
<a href="{{ post.link }}">{{ _e('edit') }}</a>
|
10 |
<p class="blog-author">
|
11 |
-
<span>By</span><a href="{{post.author.path}}"> {{ post.author.name }} </a><span>•</span> {{ post.date }}
|
12 |
</p>
|
13 |
<div class="article-body">
|
14 |
{{post.content}}
|
8 |
<h1 class="article-h1">{{ post.title }}</h1>
|
9 |
<a href="{{ post.link }}">{{ _e('edit') }}</a>
|
10 |
<p class="blog-author">
|
11 |
+
<span>By</span><a href="{{post.author.path}}"> {{ post.author.name }} </a><span>•</span> <time datetime="{{ post.date|date('Y-m-d H:i:s') }}">{{ post.date }}</time>
|
12 |
</p>
|
13 |
<div class="article-body">
|
14 |
{{post.content}}
|
@@ -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.
|
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.14.0
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
@@ -1,36 +1,44 @@
|
|
1 |
language: php
|
2 |
|
3 |
-
cache:
|
4 |
-
directories:
|
5 |
-
- vendor
|
6 |
-
- $HOME/.composer/cache
|
7 |
-
|
8 |
-
env:
|
9 |
-
- TWIG_VERSION="^1.0"
|
10 |
-
- TWIG_VERSION="^2.0"
|
11 |
-
|
12 |
-
php:
|
13 |
-
- 5.3
|
14 |
-
- 5.4
|
15 |
-
- 5.5
|
16 |
-
- 5.6
|
17 |
-
- 7.0
|
18 |
-
- 7.1
|
19 |
-
- hhvm
|
20 |
-
|
21 |
matrix:
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
install: composer require twig/twig:${TWIG_VERSION}
|
35 |
|
36 |
-
script:
|
1 |
language: php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
matrix:
|
4 |
+
include:
|
5 |
+
- php: 5.6
|
6 |
+
dist: xenial
|
7 |
+
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest" TWIG_VERSION="^1.0"'
|
8 |
+
- php: 5.6
|
9 |
+
dist: xenial
|
10 |
+
env: TWIG_VERSION="^1.0"
|
11 |
+
- php: 7.0
|
12 |
+
dist: xenial
|
13 |
+
env: TWIG_VERSION="^1.0"
|
14 |
+
- php: 7.1
|
15 |
+
dist: bionic
|
16 |
+
env: TWIG_VERSION="^1.0"
|
17 |
+
- php: 7.2
|
18 |
+
dist: bionic
|
19 |
+
env: TWIG_VERSION="^1.0"
|
20 |
+
- php: 7.3
|
21 |
+
dist: bionic
|
22 |
+
env: TWIG_VERSION="^1.0"
|
23 |
+
- php: 7.4
|
24 |
+
dist: bionic
|
25 |
+
env: TWIG_VERSION="^1.0"
|
26 |
+
- php: 7.0
|
27 |
+
dist: xenial
|
28 |
+
env: TWIG_VERSION="^2.0"
|
29 |
+
- php: 7.1
|
30 |
+
dist: bionic
|
31 |
+
env: TWIG_VERSION="^2.0"
|
32 |
+
- php: 7.2
|
33 |
+
dist: bionic
|
34 |
+
env: TWIG_VERSION="^2.0"
|
35 |
+
- php: 7.3
|
36 |
+
dist: bionic
|
37 |
+
env: TWIG_VERSION="^2.0"
|
38 |
+
- php: 7.4
|
39 |
+
dist: bionic
|
40 |
+
env: TWIG_VERSION="^2.0"
|
41 |
|
42 |
install: composer require twig/twig:${TWIG_VERSION}
|
43 |
|
44 |
+
script: composer test
|
@@ -16,8 +16,12 @@
|
|
16 |
"twig/twig": "^1.0|^2.0"
|
17 |
},
|
18 |
"require-dev": {
|
|
|
19 |
"doctrine/cache": "~1.0"
|
20 |
},
|
|
|
|
|
|
|
21 |
"suggest": {
|
22 |
"psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
|
23 |
},
|
@@ -33,7 +37,7 @@
|
|
33 |
},
|
34 |
"extra": {
|
35 |
"branch-alias": {
|
36 |
-
"dev-master": "1.
|
37 |
}
|
38 |
}
|
39 |
}
|
16 |
"twig/twig": "^1.0|^2.0"
|
17 |
},
|
18 |
"require-dev": {
|
19 |
+
"phpunit/phpunit": "^5.0 || ^4.8.10",
|
20 |
"doctrine/cache": "~1.0"
|
21 |
},
|
22 |
+
"scripts": {
|
23 |
+
"test": "phpunit"
|
24 |
+
},
|
25 |
"suggest": {
|
26 |
"psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
|
27 |
},
|
37 |
},
|
38 |
"extra": {
|
39 |
"branch-alias": {
|
40 |
+
"dev-master": "1.4-dev"
|
41 |
}
|
42 |
}
|
43 |
}
|
@@ -42,7 +42,7 @@ class Extension extends \Twig_Extension
|
|
42 |
public function getName()
|
43 |
{
|
44 |
if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
|
45 |
-
return
|
46 |
}
|
47 |
return 'asm89_cache';
|
48 |
}
|
42 |
public function getName()
|
43 |
{
|
44 |
if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
|
45 |
+
return __CLASS__;
|
46 |
}
|
47 |
return 'asm89_cache';
|
48 |
}
|
@@ -41,6 +41,6 @@ class DoctrineCacheAdapterTest extends \PHPUnit_Framework_TestCase
|
|
41 |
|
42 |
public function createCacheMock()
|
43 |
{
|
44 |
-
return $this->
|
45 |
}
|
46 |
}
|
41 |
|
42 |
public function createCacheMock()
|
43 |
{
|
44 |
+
return $this->createMock('Doctrine\Common\Cache\Cache');
|
45 |
}
|
46 |
}
|
@@ -70,11 +70,11 @@ class GenerationalCacheStrategyTest extends \PHPUnit_Framework_TestCase
|
|
70 |
|
71 |
public function createKeyGeneratorMock()
|
72 |
{
|
73 |
-
return $this->
|
74 |
}
|
75 |
|
76 |
public function createCacheProviderMock()
|
77 |
{
|
78 |
-
return $this->
|
79 |
}
|
80 |
}
|
70 |
|
71 |
public function createKeyGeneratorMock()
|
72 |
{
|
73 |
+
return $this->createMock('Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface');
|
74 |
}
|
75 |
|
76 |
public function createCacheProviderMock()
|
77 |
{
|
78 |
+
return $this->createMock('Asm89\Twig\CacheExtension\CacheProviderInterface');
|
79 |
}
|
80 |
}
|
@@ -75,6 +75,6 @@ class IndexedChainingCacheStrategyTest extends \PHPUnit_Framework_TestCase
|
|
75 |
|
76 |
public function createCacheStrategyMock()
|
77 |
{
|
78 |
-
return $this->
|
79 |
}
|
80 |
}
|
75 |
|
76 |
public function createCacheStrategyMock()
|
77 |
{
|
78 |
+
return $this->createMock('Asm89\Twig\CacheExtension\CacheStrategyInterface');
|
79 |
}
|
80 |
}
|
@@ -63,6 +63,6 @@ class LifetimeCacheStrategyTest extends \PHPUnit_Framework_TestCase
|
|
63 |
|
64 |
public function createCacheProviderMock()
|
65 |
{
|
66 |
-
return $this->
|
67 |
}
|
68 |
}
|
63 |
|
64 |
public function createCacheProviderMock()
|
65 |
{
|
66 |
+
return $this->createMock('Asm89\Twig\CacheExtension\CacheProviderInterface');
|
67 |
}
|
68 |
}
|
@@ -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 ComposerAutoloaderInit674010418e53f6f9593de4aedd440a23::getLoader();
|
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit54d7be5edfb3045bf104020f539d2c76
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit54d7be5edfb3045bf104020f539d2c76
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit674010418e53f6f9593de4aedd440a23
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit674010418e53f6f9593de4aedd440a23', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit674010418e53f6f9593de4aedd440a23', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit674010418e53f6f9593de4aedd440a23::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit674010418e53f6f9593de4aedd440a23::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire674010418e53f6f9593de4aedd440a23($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire674010418e53f6f9593de4aedd440a23($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
@@ -616,11 +616,11 @@ class ComposerStaticInit54d7be5edfb3045bf104020f539d2c76
|
|
616 |
public static function getInitializer(ClassLoader $loader)
|
617 |
{
|
618 |
return \Closure::bind(function () use ($loader) {
|
619 |
-
$loader->prefixLengthsPsr4 =
|
620 |
-
$loader->prefixDirsPsr4 =
|
621 |
-
$loader->fallbackDirsPsr4 =
|
622 |
-
$loader->prefixesPsr0 =
|
623 |
-
$loader->classMap =
|
624 |
|
625 |
}, null, ClassLoader::class);
|
626 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit674010418e53f6f9593de4aedd440a23
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
616 |
public static function getInitializer(ClassLoader $loader)
|
617 |
{
|
618 |
return \Closure::bind(function () use ($loader) {
|
619 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit674010418e53f6f9593de4aedd440a23::$prefixLengthsPsr4;
|
620 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit674010418e53f6f9593de4aedd440a23::$prefixDirsPsr4;
|
621 |
+
$loader->fallbackDirsPsr4 = ComposerStaticInit674010418e53f6f9593de4aedd440a23::$fallbackDirsPsr4;
|
622 |
+
$loader->prefixesPsr0 = ComposerStaticInit674010418e53f6f9593de4aedd440a23::$prefixesPsr0;
|
623 |
+
$loader->classMap = ComposerStaticInit674010418e53f6f9593de4aedd440a23::$classMap;
|
624 |
|
625 |
}, null, ClassLoader::class);
|
626 |
}
|
@@ -58,17 +58,17 @@
|
|
58 |
},
|
59 |
{
|
60 |
"name": "asm89/twig-cache-extension",
|
61 |
-
"version": "1.
|
62 |
-
"version_normalized": "1.
|
63 |
"source": {
|
64 |
"type": "git",
|
65 |
"url": "https://github.com/asm89/twig-cache-extension.git",
|
66 |
-
"reference": "
|
67 |
},
|
68 |
"dist": {
|
69 |
"type": "zip",
|
70 |
-
"url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/
|
71 |
-
"reference": "
|
72 |
"shasum": ""
|
73 |
},
|
74 |
"require": {
|
@@ -76,16 +76,17 @@
|
|
76 |
"twig/twig": "^1.0|^2.0"
|
77 |
},
|
78 |
"require-dev": {
|
79 |
-
"doctrine/cache": "~1.0"
|
|
|
80 |
},
|
81 |
"suggest": {
|
82 |
"psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
|
83 |
},
|
84 |
-
"time": "
|
85 |
"type": "library",
|
86 |
"extra": {
|
87 |
"branch-alias": {
|
88 |
-
"dev-master": "1.
|
89 |
}
|
90 |
},
|
91 |
"installation-source": "dist",
|
@@ -238,17 +239,17 @@
|
|
238 |
},
|
239 |
{
|
240 |
"name": "symfony/polyfill-ctype",
|
241 |
-
"version": "v1.
|
242 |
-
"version_normalized": "1.
|
243 |
"source": {
|
244 |
"type": "git",
|
245 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
246 |
-
"reference": "
|
247 |
},
|
248 |
"dist": {
|
249 |
"type": "zip",
|
250 |
-
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/
|
251 |
-
"reference": "
|
252 |
"shasum": ""
|
253 |
},
|
254 |
"require": {
|
@@ -257,11 +258,11 @@
|
|
257 |
"suggest": {
|
258 |
"ext-ctype": "For best performance"
|
259 |
},
|
260 |
-
"time": "2019-
|
261 |
"type": "library",
|
262 |
"extra": {
|
263 |
"branch-alias": {
|
264 |
-
"dev-master": "1.
|
265 |
}
|
266 |
},
|
267 |
"installation-source": "dist",
|
58 |
},
|
59 |
{
|
60 |
"name": "asm89/twig-cache-extension",
|
61 |
+
"version": "1.4.0",
|
62 |
+
"version_normalized": "1.4.0.0",
|
63 |
"source": {
|
64 |
"type": "git",
|
65 |
"url": "https://github.com/asm89/twig-cache-extension.git",
|
66 |
+
"reference": "13787226956ec766f4770722082288097aebaaf3"
|
67 |
},
|
68 |
"dist": {
|
69 |
"type": "zip",
|
70 |
+
"url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/13787226956ec766f4770722082288097aebaaf3",
|
71 |
+
"reference": "13787226956ec766f4770722082288097aebaaf3",
|
72 |
"shasum": ""
|
73 |
},
|
74 |
"require": {
|
76 |
"twig/twig": "^1.0|^2.0"
|
77 |
},
|
78 |
"require-dev": {
|
79 |
+
"doctrine/cache": "~1.0",
|
80 |
+
"phpunit/phpunit": "^5.0 || ^4.8.10"
|
81 |
},
|
82 |
"suggest": {
|
83 |
"psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
|
84 |
},
|
85 |
+
"time": "2020-01-01T20:47:37+00:00",
|
86 |
"type": "library",
|
87 |
"extra": {
|
88 |
"branch-alias": {
|
89 |
+
"dev-master": "1.4-dev"
|
90 |
}
|
91 |
},
|
92 |
"installation-source": "dist",
|
239 |
},
|
240 |
{
|
241 |
"name": "symfony/polyfill-ctype",
|
242 |
+
"version": "v1.13.1",
|
243 |
+
"version_normalized": "1.13.1.0",
|
244 |
"source": {
|
245 |
"type": "git",
|
246 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
247 |
+
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
|
248 |
},
|
249 |
"dist": {
|
250 |
"type": "zip",
|
251 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
252 |
+
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
253 |
"shasum": ""
|
254 |
},
|
255 |
"require": {
|
258 |
"suggest": {
|
259 |
"ext-ctype": "For best performance"
|
260 |
},
|
261 |
+
"time": "2019-11-27T13:56:44+00:00",
|
262 |
"type": "library",
|
263 |
"extra": {
|
264 |
"branch-alias": {
|
265 |
+
"dev-master": "1.13-dev"
|
266 |
}
|
267 |
},
|
268 |
"installation-source": "dist",
|
@@ -28,7 +28,7 @@
|
|
28 |
"minimum-stability": "dev",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
31 |
-
"dev-master": "1.
|
32 |
}
|
33 |
}
|
34 |
}
|
28 |
"minimum-stability": "dev",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
31 |
+
"dev-master": "1.13-dev"
|
32 |
}
|
33 |
}
|
34 |
}
|