Version Description
Changes for Theme Developers
- You can now easily access all of a MenuItem's master object properties through {{ item.master_object }}
What's a master object? It's when a Menu Item has been created directly from a Post or Term in the WP Admin #1577 #1572
- Enabled methods for getting media from posts, you can now do {{ post.video }}
, {{ post.audio }}
and {{ post.gallery }}
to retrieve media include in the body of a post #1583 (thanks @marciojc)
- You can now get ACF's field object data: {{ post.field_object('my_field').key }}
#1597 #1599 (thanks @palmiak)
- You can use the |filter
filter on arrays to return items like so:
{% for post in posts|filter('my-slug') %}
{{ post.title }}
{% endfor %}
by default it looks for slugs, but you can also get into particular fields:
{% for post in posts|filter({post_title: "Cheese", post_content:"Method Man"}) %}
{{ post.title }}
{% endfor %}
... this will return posts that match both parameters. #1594 thanks @pablo-sg-pacheco
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.6.0
- lib/Helper.php +17 -0
- lib/Integrations/ACF.php +30 -17
- lib/MenuItem.php +23 -14
- lib/Post.php +87 -4
- lib/Site.php +4 -0
- lib/Timber.php +1 -1
- lib/Twig.php +1 -0
- readme.txt +21 -2
- timber-starter-theme/templates/comment-form.twig +2 -2
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +5 -0
- vendor/composer/autoload_real.php +3 -3
- vendor/composer/installed.json +17 -14
- vendor/composer/installers/.travis.yml +1 -0
- vendor/composer/installers/CHANGELOG.md +17 -0
- vendor/composer/installers/README.md +5 -2
- vendor/composer/installers/composer.json +4 -1
- vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +0 -1
- vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +4 -1
- vendor/composer/installers/src/Composer/Installers/Installer.php +7 -8
- vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +37 -0
- vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +12 -0
- vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +3 -3
- vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +63 -0
- vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +2 -2
- vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +1 -2
- vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +25 -0
- vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +1 -0
- vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php +1 -2
- vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +0 -1
- vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +17 -1
- vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php +3 -2
- vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php +2 -3
- vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php +120 -0
- vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php +2 -1
- vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php +2 -1
- vendor/twig/twig/.travis.yml +2 -1
- vendor/twig/twig/CHANGELOG +9 -2
- vendor/twig/twig/composer.json +1 -1
- vendor/twig/twig/doc/templates.rst +2 -1
- vendor/twig/twig/ext/twig/php_twig.h +1 -1
- vendor/twig/twig/lib/Twig/Environment.php +25 -5
- vendor/twig/twig/lib/Twig/Profiler/Profile.php +6 -0
- vendor/twig/twig/lib/Twig/TokenParser/Use.php +2 -0
- 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 +1 -1
- 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/tags/use/use_with_parent.test +24 -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 +1 -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
@@ -421,6 +421,23 @@ class Helper {
|
|
421 |
return $return;
|
422 |
}
|
423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
/* Links, Forms, Etc. Utilities
|
425 |
======================== */
|
426 |
|
421 |
return $return;
|
422 |
}
|
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 $array to filter.
|
430 |
+
* @param string|array $filter to search for.
|
431 |
+
* @param string $operator to use (AND, NOT, OR).
|
432 |
+
* @return array
|
433 |
+
*/
|
434 |
+
public static function filter_array( $array, $filter, $operator = 'AND' ) {
|
435 |
+
if ( ! is_array($filter) ) {
|
436 |
+
$filter = array( 'slug' => $filter );
|
437 |
+
}
|
438 |
+
return wp_list_filter($array, $filter, $operator);
|
439 |
+
}
|
440 |
+
|
441 |
/* Links, Forms, Etc. Utilities
|
442 |
======================== */
|
443 |
|
@@ -1,16 +1,25 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Timber\Integrations;
|
4 |
|
|
|
|
|
|
|
5 |
class ACF {
|
6 |
|
7 |
public function __construct() {
|
8 |
-
add_filter('timber_post_get_meta', array($this, 'post_get_meta'), 10, 2);
|
9 |
-
add_filter('timber_post_get_meta_field', array($this, 'post_get_meta_field'), 10, 3);
|
10 |
-
add_filter('timber/
|
11 |
-
add_filter('timber/term/meta
|
12 |
-
add_filter('
|
13 |
-
add_filter('
|
|
|
14 |
}
|
15 |
|
16 |
public function post_get_meta( $customs, $post_id ) {
|
@@ -21,27 +30,31 @@ class ACF {
|
|
21 |
return get_field($field_name, $post_id);
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
24 |
public function term_get_meta_field( $value, $term_id, $field_name, $term ) {
|
25 |
-
$searcher = $term->taxonomy.
|
26 |
return get_field($field_name, $searcher);
|
27 |
}
|
28 |
|
29 |
public function term_set_meta( $value, $field, $term_id, $term ) {
|
30 |
-
$searcher = $term->taxonomy.
|
31 |
update_field($field, $value, $searcher);
|
32 |
return $value;
|
33 |
}
|
34 |
|
35 |
public function term_get_meta( $fields, $term_id, $term ) {
|
36 |
-
$searcher = $term->taxonomy.
|
37 |
-
$fds
|
38 |
if ( is_array($fds) ) {
|
39 |
foreach ( $fds as $key => $value ) {
|
40 |
-
$key
|
41 |
-
$key
|
42 |
-
$key
|
43 |
-
$field
|
44 |
-
$fields[$key] = $field;
|
45 |
}
|
46 |
$fields = array_merge($fields, $fds);
|
47 |
}
|
@@ -53,6 +66,6 @@ class ACF {
|
|
53 |
}
|
54 |
|
55 |
public function user_get_meta_field( $value, $uid, $field ) {
|
56 |
-
return get_field($field, 'user_'
|
57 |
}
|
58 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Integration with Advanced Custom Fields (ACF)
|
4 |
+
*
|
5 |
+
* @package Timber
|
6 |
+
*/
|
7 |
|
8 |
namespace Timber\Integrations;
|
9 |
|
10 |
+
/**
|
11 |
+
* Class used to handle integration with Advanced Custom Fields
|
12 |
+
*/
|
13 |
class ACF {
|
14 |
|
15 |
public function __construct() {
|
16 |
+
add_filter('timber_post_get_meta', array( $this, 'post_get_meta' ), 10, 2);
|
17 |
+
add_filter('timber_post_get_meta_field', array( $this, 'post_get_meta_field' ), 10, 3);
|
18 |
+
add_filter('timber/post/meta_object_field', array( $this, 'post_meta_object' ), 10, 3);
|
19 |
+
add_filter('timber/term/meta', array( $this, 'term_get_meta' ), 10, 3);
|
20 |
+
add_filter('timber/term/meta/field', array( $this, 'term_get_meta_field' ), 10, 4);
|
21 |
+
add_filter('timber_user_get_meta_field_pre', array( $this, 'user_get_meta_field' ), 10, 3);
|
22 |
+
add_filter('timber/term/meta/set', array( $this, 'term_set_meta' ), 10, 4);
|
23 |
}
|
24 |
|
25 |
public function post_get_meta( $customs, $post_id ) {
|
30 |
return get_field($field_name, $post_id);
|
31 |
}
|
32 |
|
33 |
+
public function post_meta_object( $value, $post_id, $field_name ) {
|
34 |
+
return get_field_object($field_name, $post_id);
|
35 |
+
}
|
36 |
+
|
37 |
public function term_get_meta_field( $value, $term_id, $field_name, $term ) {
|
38 |
+
$searcher = $term->taxonomy . '_' . $term->ID;
|
39 |
return get_field($field_name, $searcher);
|
40 |
}
|
41 |
|
42 |
public function term_set_meta( $value, $field, $term_id, $term ) {
|
43 |
+
$searcher = $term->taxonomy . '_' . $term->ID;
|
44 |
update_field($field, $value, $searcher);
|
45 |
return $value;
|
46 |
}
|
47 |
|
48 |
public function term_get_meta( $fields, $term_id, $term ) {
|
49 |
+
$searcher = $term->taxonomy . '_' . $term->ID; // save to a specific category.
|
50 |
+
$fds = get_fields($searcher);
|
51 |
if ( is_array($fds) ) {
|
52 |
foreach ( $fds as $key => $value ) {
|
53 |
+
$key = preg_replace('/_/', '', $key, 1);
|
54 |
+
$key = str_replace($searcher, '', $key);
|
55 |
+
$key = preg_replace('/_/', '', $key, 1);
|
56 |
+
$field = get_field($key, $searcher);
|
57 |
+
$fields[ $key ] = $field;
|
58 |
}
|
59 |
$fields = array_merge($fields, $fds);
|
60 |
}
|
66 |
}
|
67 |
|
68 |
public function user_get_meta_field( $value, $uid, $field ) {
|
69 |
+
return get_field($field, 'user_' . $uid);
|
70 |
}
|
71 |
+
}
|
@@ -64,7 +64,6 @@ class MenuItem extends Core implements CoreInterface {
|
|
64 |
protected $_menu_item_object_id;
|
65 |
protected $_menu_item_url;
|
66 |
protected $menu_object;
|
67 |
-
protected $master_object;
|
68 |
|
69 |
/**
|
70 |
* @internal
|
@@ -140,23 +139,33 @@ class MenuItem extends Core implements CoreInterface {
|
|
140 |
* @return string The URL-safe slug of the menu item.
|
141 |
*/
|
142 |
public function slug() {
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
if ( isset($this->master_object->post_name) && $this->master_object->post_name ) {
|
147 |
-
return $this->master_object->post_name;
|
148 |
}
|
149 |
return $this->post_name;
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
-
*
|
154 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
*/
|
156 |
-
|
157 |
if ( isset($this->_menu_item_object_id) ) {
|
158 |
return new $this->PostClass($this->_menu_item_object_id);
|
159 |
}
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
/**
|
@@ -381,7 +390,7 @@ class MenuItem extends Core implements CoreInterface {
|
|
381 |
* @return string A full URL, like `http://mysite.com/thing/`.
|
382 |
*/
|
383 |
public function permalink() {
|
384 |
-
Helper::warn(
|
385 |
return $this->link();
|
386 |
}
|
387 |
|
@@ -423,6 +432,7 @@ class MenuItem extends Core implements CoreInterface {
|
|
423 |
* Get the featured image of the post associated with the menu item.
|
424 |
*
|
425 |
* @api
|
|
|
426 |
* @example
|
427 |
* ```twig
|
428 |
* {% for item in menu.items %}
|
@@ -432,10 +442,9 @@ class MenuItem extends Core implements CoreInterface {
|
|
432 |
* @return \Timber\Image|null The featured image object.
|
433 |
*/
|
434 |
public function thumbnail() {
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
error_log('no master object');
|
439 |
}
|
440 |
}
|
441 |
}
|
64 |
protected $_menu_item_object_id;
|
65 |
protected $_menu_item_url;
|
66 |
protected $menu_object;
|
|
|
67 |
|
68 |
/**
|
69 |
* @internal
|
139 |
* @return string The URL-safe slug of the menu item.
|
140 |
*/
|
141 |
public function slug() {
|
142 |
+
$mo = $this->master_object();
|
143 |
+
if ( $mo && $mo->post_name ) {
|
144 |
+
return $mo->post_name;
|
|
|
|
|
145 |
}
|
146 |
return $this->post_name;
|
147 |
}
|
148 |
|
149 |
/**
|
150 |
+
* Allows dev to access the "master object" (ex: post or page) the menu item represents
|
151 |
+
* @api
|
152 |
+
* @example
|
153 |
+
* ```twig
|
154 |
+
* <div>
|
155 |
+
* {% for item in menu.items %}
|
156 |
+
* <a href="{{ item.link }}"><img src="{{ item.master_object.thumbnail }}" /></a>
|
157 |
+
* {% endfor %}
|
158 |
+
* </div>
|
159 |
+
* ```
|
160 |
+
* @return mixed Whatever object (Timber\Post, Timber\Term, etc.) the menu item represents.
|
161 |
*/
|
162 |
+
public function master_object() {
|
163 |
if ( isset($this->_menu_item_object_id) ) {
|
164 |
return new $this->PostClass($this->_menu_item_object_id);
|
165 |
}
|
166 |
+
if ( isset($this->menu_object) ) {
|
167 |
+
return new $this->PostClass($this->menu_object);
|
168 |
+
}
|
169 |
}
|
170 |
|
171 |
/**
|
390 |
* @return string A full URL, like `http://mysite.com/thing/`.
|
391 |
*/
|
392 |
public function permalink() {
|
393 |
+
Helper::warn('{{ item.permalink }} is deprecated, use {{ item.link }} instead');
|
394 |
return $this->link();
|
395 |
}
|
396 |
|
432 |
* Get the featured image of the post associated with the menu item.
|
433 |
*
|
434 |
* @api
|
435 |
+
* @deprecated since 1.5.2 to be removed in v2.0
|
436 |
* @example
|
437 |
* ```twig
|
438 |
* {% for item in menu.items %}
|
442 |
* @return \Timber\Image|null The featured image object.
|
443 |
*/
|
444 |
public function thumbnail() {
|
445 |
+
$mo = $this->master_object();
|
446 |
+
if ( $mo && method_exists($mo, 'thumbnail') ) {
|
447 |
+
return $mo->thumbnail();
|
|
|
448 |
}
|
449 |
}
|
450 |
}
|
@@ -68,6 +68,11 @@ class Post extends Core implements CoreInterface {
|
|
68 |
*/
|
69 |
public $object_type = 'post';
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* @var string $representation what does this class represent in WordPress terms?
|
73 |
*/
|
@@ -697,6 +702,19 @@ class Post extends Core implements CoreInterface {
|
|
697 |
return (!$this->get_field($field_name)) ? false : true;
|
698 |
}
|
699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
|
701 |
/**
|
702 |
* @param string $field_name
|
@@ -1016,7 +1034,7 @@ class Post extends Core implements CoreInterface {
|
|
1016 |
* ```twig
|
1017 |
* Published on {{ post.date }} // Uses WP's formatting set in Admin
|
1018 |
* OR
|
1019 |
-
* Published on {{ post.date
|
1020 |
* ```
|
1021 |
*
|
1022 |
* ```html
|
@@ -1319,13 +1337,13 @@ class Post extends Core implements CoreInterface {
|
|
1319 |
}
|
1320 |
|
1321 |
/**
|
1322 |
-
* get the featured image as a
|
1323 |
* @api
|
1324 |
* @example
|
1325 |
* ```twig
|
1326 |
-
* <img src="{{post.thumbnail.src}}" />
|
1327 |
* ```
|
1328 |
-
* @return
|
1329 |
*/
|
1330 |
public function thumbnail() {
|
1331 |
$tid = get_post_thumbnail_id($this->ID);
|
@@ -1349,6 +1367,71 @@ class Post extends Core implements CoreInterface {
|
|
1349 |
return apply_filters('the_title', $this->post_title, $this->ID);
|
1350 |
}
|
1351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1352 |
|
1353 |
/**
|
1354 |
*
|
68 |
*/
|
69 |
public $object_type = 'post';
|
70 |
|
71 |
+
/**
|
72 |
+
* @var array $custom stores custom meta data
|
73 |
+
*/
|
74 |
+
public $custom = array();
|
75 |
+
|
76 |
/**
|
77 |
* @var string $representation what does this class represent in WordPress terms?
|
78 |
*/
|
702 |
return (!$this->get_field($field_name)) ? false : true;
|
703 |
}
|
704 |
|
705 |
+
/**
|
706 |
+
* Gets the field object data from Advanced Custom Fields.
|
707 |
+
* This includes metadata on the field like whether it's conditional or not.
|
708 |
+
*
|
709 |
+
* @since 1.6.0
|
710 |
+
* @param string $field_name of the field you want to lookup.
|
711 |
+
* @return mixed
|
712 |
+
*/
|
713 |
+
public function field_object( $field_name ) {
|
714 |
+
$value = apply_filters('timber/post/meta_object_field', null, $this->ID, $field_name, $this);
|
715 |
+
$value = $this->convert($value, __CLASS__);
|
716 |
+
return $value;
|
717 |
+
}
|
718 |
|
719 |
/**
|
720 |
* @param string $field_name
|
1034 |
* ```twig
|
1035 |
* Published on {{ post.date }} // Uses WP's formatting set in Admin
|
1036 |
* OR
|
1037 |
+
* Published on {{ post.date('F jS') }} // Jan 12th
|
1038 |
* ```
|
1039 |
*
|
1040 |
* ```html
|
1337 |
}
|
1338 |
|
1339 |
/**
|
1340 |
+
* get the featured image as a Timber/Image
|
1341 |
* @api
|
1342 |
* @example
|
1343 |
* ```twig
|
1344 |
+
* <img src="{{ post.thumbnail.src }}" />
|
1345 |
* ```
|
1346 |
+
* @return Timber/Image|null of your thumbnail
|
1347 |
*/
|
1348 |
public function thumbnail() {
|
1349 |
$tid = get_post_thumbnail_id($this->ID);
|
1367 |
return apply_filters('the_title', $this->post_title, $this->ID);
|
1368 |
}
|
1369 |
|
1370 |
+
/**
|
1371 |
+
* Returns the gallery
|
1372 |
+
* @api
|
1373 |
+
* @example
|
1374 |
+
* ```twig
|
1375 |
+
* {{ post.gallery }}
|
1376 |
+
* ```
|
1377 |
+
* @return html
|
1378 |
+
*/
|
1379 |
+
public function gallery( $html = true ) {
|
1380 |
+
if ( isset($this->custom['gallery']) ) {
|
1381 |
+
return $this->custom['gallery'];
|
1382 |
+
}
|
1383 |
+
$galleries = get_post_galleries($this->ID, $html);
|
1384 |
+
$gallery = reset($galleries);
|
1385 |
+
|
1386 |
+
return apply_filters('get_post_gallery', $gallery, $this->ID, $galleries);
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
/**
|
1390 |
+
* Returns the audio
|
1391 |
+
* @api
|
1392 |
+
* @example
|
1393 |
+
* ```twig
|
1394 |
+
* {{ post.audio }}
|
1395 |
+
* ```
|
1396 |
+
* @return html
|
1397 |
+
*/
|
1398 |
+
public function audio() {
|
1399 |
+
if ( isset($this->custom['audio']) ) {
|
1400 |
+
return $this->custom['audio'];
|
1401 |
+
}
|
1402 |
+
$audio = false;
|
1403 |
+
|
1404 |
+
// Only get audio from the content if a playlist isn't present.
|
1405 |
+
if ( false === strpos($this->get_content(), 'wp-playlist-script') ) {
|
1406 |
+
$audio = get_media_embedded_in_content($this->get_content(), array('audio'));
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
return $audio;
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
/**
|
1413 |
+
* Returns the video
|
1414 |
+
* @api
|
1415 |
+
* @example
|
1416 |
+
* ```twig
|
1417 |
+
* {{ post.video }}
|
1418 |
+
* ```
|
1419 |
+
* @return html
|
1420 |
+
*/
|
1421 |
+
public function video() {
|
1422 |
+
if ( isset($this->custom['video']) ) {
|
1423 |
+
return $this->custom['video'];
|
1424 |
+
}
|
1425 |
+
$video = false;
|
1426 |
+
|
1427 |
+
// Only get video from the content if a playlist isn't present.
|
1428 |
+
if ( false === strpos($this->get_content(), 'wp-playlist-script') ) {
|
1429 |
+
$video = get_media_embedded_in_content($this->get_content(), array('video', 'object', 'embed', 'iframe'));
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
return $video;
|
1433 |
+
}
|
1434 |
+
|
1435 |
|
1436 |
/**
|
1437 |
*
|
@@ -81,6 +81,8 @@ class Site extends Core implements CoreInterface {
|
|
81 |
*/
|
82 |
public $title;
|
83 |
public $url;
|
|
|
|
|
84 |
|
85 |
/**
|
86 |
* @api
|
@@ -167,6 +169,8 @@ class Site extends Core implements CoreInterface {
|
|
167 |
*/
|
168 |
protected function init() {
|
169 |
$this->url = home_url();
|
|
|
|
|
170 |
$this->rdf = get_bloginfo('rdf_url');
|
171 |
$this->rss = get_bloginfo('rss_url');
|
172 |
$this->rss2 = get_bloginfo('rss2_url');
|
81 |
*/
|
82 |
public $title;
|
83 |
public $url;
|
84 |
+
public $home_url;
|
85 |
+
public $site_url;
|
86 |
|
87 |
/**
|
88 |
* @api
|
169 |
*/
|
170 |
protected function init() {
|
171 |
$this->url = home_url();
|
172 |
+
$this->home_url = $this->url;
|
173 |
+
$this->site_url = site_url();
|
174 |
$this->rdf = get_bloginfo('rdf_url');
|
175 |
$this->rss = get_bloginfo('rss_url');
|
176 |
$this->rss2 = get_bloginfo('rss2_url');
|
@@ -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.6.0';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
@@ -226,6 +226,7 @@ class Twig {
|
|
226 |
$twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
|
227 |
|
228 |
$twig->addFilter(new \Twig_SimpleFilter('pluck', array('Timber\Helper', 'pluck')));
|
|
|
229 |
|
230 |
$twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
|
231 |
return URLHelper::get_rel_url($link, true);
|
226 |
$twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
|
227 |
|
228 |
$twig->addFilter(new \Twig_SimpleFilter('pluck', array('Timber\Helper', 'pluck')));
|
229 |
+
$twig->addFilter(new \Twig_SimpleFilter('filter', array('Timber\Helper', 'filter_array')));
|
230 |
|
231 |
$twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
|
232 |
return URLHelper::get_rel_url($link, true);
|
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
-
Stable tag: 1.
|
6 |
-
Tested up to: 4.9
|
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,6 +36,25 @@ _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.5.2 =
|
40 |
|
41 |
**Fixes and improvements**
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
+
Stable tag: 1.6.0
|
6 |
+
Tested up to: 4.9.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.6.0 =
|
40 |
+
**Changes for Theme Developers**
|
41 |
+
- You can now easily access all of a MenuItem's master object properties through `{{ item.master_object }}` What's a master object? It's when a Menu Item has been created directly from a Post or Term in the WP Admin #1577 #1572
|
42 |
+
- Enabled methods for getting media from posts, you can now do `{{ post.video }}`, `{{ post.audio }}` and `{{ post.gallery }}` to retrieve media include in the body of a post #1583 (thanks @marciojc)
|
43 |
+
- You can now get ACF's field object data: `{{ post.field_object('my_field').key }}` #1597 #1599 (thanks @palmiak)
|
44 |
+
- You can use the `|filter` filter on arrays to return items like so:
|
45 |
+
```
|
46 |
+
{% for post in posts|filter('my-slug') %}
|
47 |
+
{{ post.title }}
|
48 |
+
{% endfor %}
|
49 |
+
```
|
50 |
+
by default it looks for slugs, but you can also get into particular fields:
|
51 |
+
```
|
52 |
+
{% for post in posts|filter({post_title: "Cheese", post_content:"Method Man"}) %}
|
53 |
+
{{ post.title }}
|
54 |
+
{% endfor %}
|
55 |
+
```
|
56 |
+
... this will return posts that match both parameters. #1594 thanks @pablo-sg-pacheco
|
57 |
+
|
58 |
= 1.5.2 =
|
59 |
|
60 |
**Fixes and improvements**
|
@@ -1,7 +1,7 @@
|
|
1 |
<div class="comment-form">
|
2 |
<h3> add comment </h3>
|
3 |
|
4 |
-
<form id="form" class="comment-form" method="post" action="{{ site.
|
5 |
{% if user %}
|
6 |
<input type="hidden" name="email" value="{{ user.email }}">
|
7 |
<input type="hidden" name="author" value="{{ user.name }}">
|
@@ -33,4 +33,4 @@
|
|
33 |
<p> Your comment will be revised by the site if needed. </p>
|
34 |
</div>
|
35 |
</form>
|
36 |
-
</div>
|
1 |
<div class="comment-form">
|
2 |
<h3> add comment </h3>
|
3 |
|
4 |
+
<form id="form" class="comment-form" method="post" action="{{ site.site_url~'/wp-comments-post.php' }}">
|
5 |
{% if user %}
|
6 |
<input type="hidden" name="email" value="{{ user.email }}">
|
7 |
<input type="hidden" name="author" value="{{ user.name }}">
|
33 |
<p> Your comment will be revised by the site if needed. </p>
|
34 |
</div>
|
35 |
</form>
|
36 |
+
</div>
|
@@ -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.6.0
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
@@ -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 ComposerAutoloaderInitf91e73dd1d6a11b3b8b379524fdab64c::getLoader();
|
@@ -67,11 +67,13 @@ return array(
|
|
67 |
'Composer\\Installers\\MODULEWorkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
|
68 |
'Composer\\Installers\\MODXEvoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
|
69 |
'Composer\\Installers\\MagentoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
|
|
|
70 |
'Composer\\Installers\\MakoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
|
71 |
'Composer\\Installers\\MauticInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
|
72 |
'Composer\\Installers\\MayaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
|
73 |
'Composer\\Installers\\MediaWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
|
74 |
'Composer\\Installers\\MicroweberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
|
|
|
75 |
'Composer\\Installers\\MoodleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
|
76 |
'Composer\\Installers\\OctoberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
|
77 |
'Composer\\Installers\\OntoWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
|
@@ -87,6 +89,7 @@ return array(
|
|
87 |
'Composer\\Installers\\PortoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
|
88 |
'Composer\\Installers\\PrestashopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
|
89 |
'Composer\\Installers\\PuppetInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
|
|
|
90 |
'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
|
91 |
'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
|
92 |
'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
|
@@ -94,6 +97,7 @@ return array(
|
|
94 |
'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
|
95 |
'Composer\\Installers\\ShopwareInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
|
96 |
'Composer\\Installers\\SilverStripeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
|
|
|
97 |
'Composer\\Installers\\SyDESInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
|
98 |
'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
|
99 |
'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
|
@@ -179,6 +183,7 @@ return array(
|
|
179 |
'Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/twig/twig/src/Extension/InitRuntimeInterface.php',
|
180 |
'Twig\\Extension\\OptimizerExtension' => $vendorDir . '/twig/twig/src/Extension/OptimizerExtension.php',
|
181 |
'Twig\\Extension\\ProfilerExtension' => $vendorDir . '/twig/twig/src/Extension/ProfilerExtension.php',
|
|
|
182 |
'Twig\\Extension\\SandboxExtension' => $vendorDir . '/twig/twig/src/Extension/SandboxExtension.php',
|
183 |
'Twig\\Extension\\StagingExtension' => $vendorDir . '/twig/twig/src/Extension/StagingExtension.php',
|
184 |
'Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/twig/twig/src/Extension/StringLoaderExtension.php',
|
67 |
'Composer\\Installers\\MODULEWorkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
|
68 |
'Composer\\Installers\\MODXEvoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
|
69 |
'Composer\\Installers\\MagentoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
|
70 |
+
'Composer\\Installers\\MajimaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MajimaInstaller.php',
|
71 |
'Composer\\Installers\\MakoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
|
72 |
'Composer\\Installers\\MauticInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
|
73 |
'Composer\\Installers\\MayaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
|
74 |
'Composer\\Installers\\MediaWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
|
75 |
'Composer\\Installers\\MicroweberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
|
76 |
+
'Composer\\Installers\\ModxInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ModxInstaller.php',
|
77 |
'Composer\\Installers\\MoodleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
|
78 |
'Composer\\Installers\\OctoberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
|
79 |
'Composer\\Installers\\OntoWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
|
89 |
'Composer\\Installers\\PortoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
|
90 |
'Composer\\Installers\\PrestashopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
|
91 |
'Composer\\Installers\\PuppetInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
|
92 |
+
'Composer\\Installers\\PxcmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
|
93 |
'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
|
94 |
'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
|
95 |
'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
|
97 |
'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
|
98 |
'Composer\\Installers\\ShopwareInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
|
99 |
'Composer\\Installers\\SilverStripeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
|
100 |
+
'Composer\\Installers\\SiteDirectInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SiteDirectInstaller.php',
|
101 |
'Composer\\Installers\\SyDESInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
|
102 |
'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
|
103 |
'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.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',
|
@@ -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 ComposerAutoloaderInitceec62c1fa8d259bb5b01ab49f462533
|
|
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 ComposerAutoloaderInitf91e73dd1d6a11b3b8b379524fdab64c
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitf91e73dd1d6a11b3b8b379524fdab64c', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitf91e73dd1d6a11b3b8b379524fdab64c', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
@@ -1,17 +1,17 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/installers",
|
4 |
-
"version": "v1.
|
5 |
-
"version_normalized": "1.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/installers.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/composer/installers/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
@@ -23,9 +23,9 @@
|
|
23 |
},
|
24 |
"require-dev": {
|
25 |
"composer/composer": "1.0.*@dev",
|
26 |
-
"phpunit/phpunit": "4.
|
27 |
},
|
28 |
-
"time": "2017-
|
29 |
"type": "composer-plugin",
|
30 |
"extra": {
|
31 |
"class": "Composer\\Installers\\Plugin",
|
@@ -96,15 +96,18 @@
|
|
96 |
"lavalite",
|
97 |
"lithium",
|
98 |
"magento",
|
|
|
99 |
"mako",
|
100 |
"mediawiki",
|
101 |
"modulework",
|
|
|
102 |
"moodle",
|
103 |
"osclass",
|
104 |
"phpbb",
|
105 |
"piwik",
|
106 |
"ppi",
|
107 |
"puppet",
|
|
|
108 |
"reindex",
|
109 |
"roundcube",
|
110 |
"shopware",
|
@@ -120,17 +123,17 @@
|
|
120 |
},
|
121 |
{
|
122 |
"name": "twig/twig",
|
123 |
-
"version": "v1.
|
124 |
-
"version_normalized": "1.
|
125 |
"source": {
|
126 |
"type": "git",
|
127 |
"url": "https://github.com/twigphp/Twig.git",
|
128 |
-
"reference": "
|
129 |
},
|
130 |
"dist": {
|
131 |
"type": "zip",
|
132 |
-
"url": "https://api.github.com/repos/twigphp/Twig/zipball/
|
133 |
-
"reference": "
|
134 |
"shasum": ""
|
135 |
},
|
136 |
"require": {
|
@@ -141,11 +144,11 @@
|
|
141 |
"symfony/debug": "~2.7",
|
142 |
"symfony/phpunit-bridge": "~3.3@dev"
|
143 |
},
|
144 |
-
"time": "2017-
|
145 |
"type": "library",
|
146 |
"extra": {
|
147 |
"branch-alias": {
|
148 |
-
"dev-master": "1.
|
149 |
}
|
150 |
},
|
151 |
"installation-source": "dist",
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/installers",
|
4 |
+
"version": "v1.5.0",
|
5 |
+
"version_normalized": "1.5.0.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/installers.git",
|
9 |
+
"reference": "049797d727261bf27f2690430d935067710049c2"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2",
|
14 |
+
"reference": "049797d727261bf27f2690430d935067710049c2",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
23 |
},
|
24 |
"require-dev": {
|
25 |
"composer/composer": "1.0.*@dev",
|
26 |
+
"phpunit/phpunit": "^4.8.36"
|
27 |
},
|
28 |
+
"time": "2017-12-29 09:13:20",
|
29 |
"type": "composer-plugin",
|
30 |
"extra": {
|
31 |
"class": "Composer\\Installers\\Plugin",
|
96 |
"lavalite",
|
97 |
"lithium",
|
98 |
"magento",
|
99 |
+
"majima",
|
100 |
"mako",
|
101 |
"mediawiki",
|
102 |
"modulework",
|
103 |
+
"modx",
|
104 |
"moodle",
|
105 |
"osclass",
|
106 |
"phpbb",
|
107 |
"piwik",
|
108 |
"ppi",
|
109 |
"puppet",
|
110 |
+
"pxcms",
|
111 |
"reindex",
|
112 |
"roundcube",
|
113 |
"shopware",
|
123 |
},
|
124 |
{
|
125 |
"name": "twig/twig",
|
126 |
+
"version": "v1.35.0",
|
127 |
+
"version_normalized": "1.35.0.0",
|
128 |
"source": {
|
129 |
"type": "git",
|
130 |
"url": "https://github.com/twigphp/Twig.git",
|
131 |
+
"reference": "daa657073e55b0a78cce8fdd22682fddecc6385f"
|
132 |
},
|
133 |
"dist": {
|
134 |
"type": "zip",
|
135 |
+
"url": "https://api.github.com/repos/twigphp/Twig/zipball/daa657073e55b0a78cce8fdd22682fddecc6385f",
|
136 |
+
"reference": "daa657073e55b0a78cce8fdd22682fddecc6385f",
|
137 |
"shasum": ""
|
138 |
},
|
139 |
"require": {
|
144 |
"symfony/debug": "~2.7",
|
145 |
"symfony/phpunit-bridge": "~3.3@dev"
|
146 |
},
|
147 |
+
"time": "2017-09-27 18:06:46",
|
148 |
"type": "library",
|
149 |
"extra": {
|
150 |
"branch-alias": {
|
151 |
+
"dev-master": "1.35-dev"
|
152 |
}
|
153 |
},
|
154 |
"installation-source": "dist",
|
@@ -13,6 +13,7 @@ php:
|
|
13 |
- 5.6
|
14 |
- 7.0
|
15 |
- 7.1
|
|
|
16 |
- hhvm
|
17 |
- nightly
|
18 |
|
13 |
- 5.6
|
14 |
- 7.0
|
15 |
- 7.1
|
16 |
+
- 7.2
|
17 |
- hhvm
|
18 |
- nightly
|
19 |
|
@@ -2,6 +2,23 @@
|
|
2 |
|
3 |
## [Unreleased]
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
## v1.4.0 - 2017-08-09
|
6 |
### Added
|
7 |
* Installer for eZ Platform.
|
2 |
|
3 |
## [Unreleased]
|
4 |
|
5 |
+
## v1.5.0 - 2017-12-29
|
6 |
+
### Added
|
7 |
+
* Added WordPress dropin support.
|
8 |
+
* Added new types supported for Eliasis.
|
9 |
+
* Added support for Phoenix CMS.
|
10 |
+
* Added MODX installer.
|
11 |
+
* Added Majima instaler.
|
12 |
+
* Added SiteDirect installer.
|
13 |
+
* Added support optional prefix in OctoberCMS installers.
|
14 |
+
* Added PHP 7.2 support.
|
15 |
+
|
16 |
+
### Changed
|
17 |
+
* Changed remove packages, see [#348](https://github.com/composer/installers/pull/348).
|
18 |
+
|
19 |
+
### Fixed
|
20 |
+
* Fixed code style, removed unused imports.
|
21 |
+
|
22 |
## v1.4.0 - 2017-08-09
|
23 |
### Added
|
24 |
* Installer for eZ Platform.
|
@@ -53,7 +53,7 @@ is not needed to install packages with these frameworks:
|
|
53 |
| Dolibarr | `dolibarr-module`
|
54 |
| Drupal | <b>`drupal-core`<br>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
|
55 |
| Elgg | `elgg-plugin`
|
56 |
-
| Eliasis | `eliasis-module`
|
57 |
| ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
|
58 |
| eZ Platform | `ezplatform-assets`<br>`ezplatform-meta-assets`
|
59 |
| FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
|
@@ -72,9 +72,11 @@ is not needed to install packages with these frameworks:
|
|
72 |
| Lavalite | `lavalite-theme`<br>`lavalite-package`
|
73 |
| Lithium | **`lithium-library`<br>`lithium-source`**
|
74 |
| Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
|
|
|
75 |
| Mako | `mako-package`
|
76 |
| Mautic | `mautic-plugin`<br>`mautic-theme`
|
77 |
| Maya | `maya-module`
|
|
|
78 |
| MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
|
79 |
| MediaWiki | `mediawiki-extension`
|
80 |
| October | **`october-module`<br>`october-plugin`<br>`october-theme`**
|
@@ -96,6 +98,7 @@ is not needed to install packages with these frameworks:
|
|
96 |
| Roundcube | `roundcube-plugin`
|
97 |
| shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
|
98 |
| SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
|
|
|
99 |
| SMF | `smf-module`<br>`smf-theme`
|
100 |
| SyDES | `sydes-module`<br>`sydes-theme`
|
101 |
| symfony1 | **`symfony1-plugin`**
|
@@ -106,7 +109,7 @@ is not needed to install packages with these frameworks:
|
|
106 |
| Vanilla | `vanilla-plugin`<br>`vanilla-theme`
|
107 |
| Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
|
108 |
| Wolf CMS | `wolfcms-plugin`
|
109 |
-
| WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
|
110 |
| YAWIK | `yawik-module`
|
111 |
| Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
|
112 |
| Zikula | `zikula-module`<br>`zikula-theme`
|
53 |
| Dolibarr | `dolibarr-module`
|
54 |
| Drupal | <b>`drupal-core`<br>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
|
55 |
| Elgg | `elgg-plugin`
|
56 |
+
| Eliasis | `eliasis-component`<br>`eliasis-module`<br>`eliasis-plugin`<br>`eliasis-template`
|
57 |
| ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
|
58 |
| eZ Platform | `ezplatform-assets`<br>`ezplatform-meta-assets`
|
59 |
| FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
|
72 |
| Lavalite | `lavalite-theme`<br>`lavalite-package`
|
73 |
| Lithium | **`lithium-library`<br>`lithium-source`**
|
74 |
| Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
|
75 |
+
| majima | `majima-plugin`
|
76 |
| Mako | `mako-package`
|
77 |
| Mautic | `mautic-plugin`<br>`mautic-theme`
|
78 |
| Maya | `maya-module`
|
79 |
+
| MODX | `modx-extra`
|
80 |
| MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
|
81 |
| MediaWiki | `mediawiki-extension`
|
82 |
| October | **`october-module`<br>`october-plugin`<br>`october-theme`**
|
98 |
| Roundcube | `roundcube-plugin`
|
99 |
| shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
|
100 |
| SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
|
101 |
+
| SiteDirect | `sitedirect-module`<br>`sitedirect-plugin`
|
102 |
| SMF | `smf-module`<br>`smf-theme`
|
103 |
| SyDES | `sydes-module`<br>`sydes-theme`
|
104 |
| symfony1 | **`symfony1-plugin`**
|
109 |
| Vanilla | `vanilla-plugin`<br>`vanilla-theme`
|
110 |
| Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
|
111 |
| Wolf CMS | `wolfcms-plugin`
|
112 |
+
| WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`<br>`wordpress-dropin`
|
113 |
| YAWIK | `yawik-module`
|
114 |
| Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
|
115 |
| Zikula | `zikula-module`<br>`zikula-theme`
|
@@ -37,9 +37,11 @@
|
|
37 |
"Lavalite",
|
38 |
"Lithium",
|
39 |
"Magento",
|
|
|
40 |
"Mako",
|
41 |
"Mautic",
|
42 |
"Maya",
|
|
|
43 |
"MODX Evo",
|
44 |
"MediaWiki",
|
45 |
"OXID",
|
@@ -47,6 +49,7 @@
|
|
47 |
"MODULEWork",
|
48 |
"Moodle",
|
49 |
"Piwik",
|
|
|
50 |
"phpBB",
|
51 |
"Plentymarkets",
|
52 |
"PPI",
|
@@ -94,7 +97,7 @@
|
|
94 |
},
|
95 |
"require-dev": {
|
96 |
"composer/composer": "1.0.*@dev",
|
97 |
-
"phpunit/phpunit": "4.
|
98 |
},
|
99 |
"scripts": {
|
100 |
"test": "phpunit"
|
37 |
"Lavalite",
|
38 |
"Lithium",
|
39 |
"Magento",
|
40 |
+
"majima",
|
41 |
"Mako",
|
42 |
"Mautic",
|
43 |
"Maya",
|
44 |
+
"MODX",
|
45 |
"MODX Evo",
|
46 |
"MediaWiki",
|
47 |
"OXID",
|
49 |
"MODULEWork",
|
50 |
"Moodle",
|
51 |
"Piwik",
|
52 |
+
"pxcms",
|
53 |
"phpBB",
|
54 |
"Plentymarkets",
|
55 |
"PPI",
|
97 |
},
|
98 |
"require-dev": {
|
99 |
"composer/composer": "1.0.*@dev",
|
100 |
+
"phpunit/phpunit": "^4.8.36"
|
101 |
},
|
102 |
"scripts": {
|
103 |
"test": "phpunit"
|
@@ -2,7 +2,6 @@
|
|
2 |
namespace Composer\Installers;
|
3 |
|
4 |
use Composer\DependencyResolver\Pool;
|
5 |
-
use Composer\Package\PackageInterface;
|
6 |
|
7 |
class CakePHPInstaller extends BaseInstaller
|
8 |
{
|
2 |
namespace Composer\Installers;
|
3 |
|
4 |
use Composer\DependencyResolver\Pool;
|
|
|
5 |
|
6 |
class CakePHPInstaller extends BaseInstaller
|
7 |
{
|
@@ -4,6 +4,9 @@ namespace Composer\Installers;
|
|
4 |
class EliasisInstaller extends BaseInstaller
|
5 |
{
|
6 |
protected $locations = array(
|
7 |
-
'
|
|
|
|
|
|
|
8 |
);
|
9 |
}
|
4 |
class EliasisInstaller extends BaseInstaller
|
5 |
{
|
6 |
protected $locations = array(
|
7 |
+
'component' => 'components/{$name}/',
|
8 |
+
'module' => 'modules/{$name}/',
|
9 |
+
'plugin' => 'plugins/{$name}/',
|
10 |
+
'template' => 'templates/{$name}/',
|
11 |
);
|
12 |
}
|
@@ -54,18 +54,21 @@ class Installer extends LibraryInstaller
|
|
54 |
'lavalite' => 'LavaLiteInstaller',
|
55 |
'lithium' => 'LithiumInstaller',
|
56 |
'magento' => 'MagentoInstaller',
|
|
|
57 |
'mako' => 'MakoInstaller',
|
58 |
'maya' => 'MayaInstaller',
|
59 |
'mautic' => 'MauticInstaller',
|
60 |
'mediawiki' => 'MediaWikiInstaller',
|
61 |
'microweber' => 'MicroweberInstaller',
|
62 |
'modulework' => 'MODULEWorkInstaller',
|
|
|
63 |
'modxevo' => 'MODXEvoInstaller',
|
64 |
'moodle' => 'MoodleInstaller',
|
65 |
'october' => 'OctoberInstaller',
|
66 |
'ontowiki' => 'OntoWikiInstaller',
|
67 |
'oxid' => 'OxidInstaller',
|
68 |
'osclass' => 'OsclassInstaller',
|
|
|
69 |
'phpbb' => 'PhpBBInstaller',
|
70 |
'pimcore' => 'PimcoreInstaller',
|
71 |
'piwik' => 'PiwikInstaller',
|
@@ -79,6 +82,7 @@ class Installer extends LibraryInstaller
|
|
79 |
'reindex' => 'ReIndexInstaller',
|
80 |
'roundcube' => 'RoundcubeInstaller',
|
81 |
'shopware' => 'ShopwareInstaller',
|
|
|
82 |
'silverstripe' => 'SilverStripeInstaller',
|
83 |
'smf' => 'SMFInstaller',
|
84 |
'sydes' => 'SyDESInstaller',
|
@@ -120,14 +124,9 @@ class Installer extends LibraryInstaller
|
|
120 |
|
121 |
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
122 |
{
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
$repo->removePackage($package);
|
128 |
-
|
129 |
-
$installPath = $this->getInstallPath($package);
|
130 |
-
$this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
|
131 |
}
|
132 |
|
133 |
/**
|
54 |
'lavalite' => 'LavaLiteInstaller',
|
55 |
'lithium' => 'LithiumInstaller',
|
56 |
'magento' => 'MagentoInstaller',
|
57 |
+
'majima' => 'MajimaInstaller',
|
58 |
'mako' => 'MakoInstaller',
|
59 |
'maya' => 'MayaInstaller',
|
60 |
'mautic' => 'MauticInstaller',
|
61 |
'mediawiki' => 'MediaWikiInstaller',
|
62 |
'microweber' => 'MicroweberInstaller',
|
63 |
'modulework' => 'MODULEWorkInstaller',
|
64 |
+
'modx' => 'ModxInstaller',
|
65 |
'modxevo' => 'MODXEvoInstaller',
|
66 |
'moodle' => 'MoodleInstaller',
|
67 |
'october' => 'OctoberInstaller',
|
68 |
'ontowiki' => 'OntoWikiInstaller',
|
69 |
'oxid' => 'OxidInstaller',
|
70 |
'osclass' => 'OsclassInstaller',
|
71 |
+
'pxcms' => 'PxcmsInstaller',
|
72 |
'phpbb' => 'PhpBBInstaller',
|
73 |
'pimcore' => 'PimcoreInstaller',
|
74 |
'piwik' => 'PiwikInstaller',
|
82 |
'reindex' => 'ReIndexInstaller',
|
83 |
'roundcube' => 'RoundcubeInstaller',
|
84 |
'shopware' => 'ShopwareInstaller',
|
85 |
+
'sitedirect' => 'SiteDirectInstaller',
|
86 |
'silverstripe' => 'SilverStripeInstaller',
|
87 |
'smf' => 'SMFInstaller',
|
88 |
'sydes' => 'SyDESInstaller',
|
124 |
|
125 |
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
126 |
{
|
127 |
+
parent::uninstall($repo, $package);
|
128 |
+
$installPath = $this->getPackageBasePath($package);
|
129 |
+
$this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
|
132 |
/**
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Plugin/theme installer for majima
|
6 |
+
* @author David Neustadt
|
7 |
+
*/
|
8 |
+
class MajimaInstaller extends BaseInstaller
|
9 |
+
{
|
10 |
+
protected $locations = array(
|
11 |
+
'plugin' => 'plugins/{$name}/',
|
12 |
+
);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Transforms the names
|
16 |
+
* @param array $vars
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function inflectPackageVars($vars)
|
20 |
+
{
|
21 |
+
return $this->correctPluginName($vars);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Change hyphenated names to camelcase
|
26 |
+
* @param array $vars
|
27 |
+
* @return array
|
28 |
+
*/
|
29 |
+
private function correctPluginName($vars)
|
30 |
+
{
|
31 |
+
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
|
32 |
+
return strtoupper($matches[0][1]);
|
33 |
+
}, $vars['name']);
|
34 |
+
$vars['name'] = ucfirst($camelCasedName);
|
35 |
+
return $vars;
|
36 |
+
}
|
37 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An installer to handle MODX specifics when installing packages.
|
6 |
+
*/
|
7 |
+
class ModxInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'extra' => 'core/packages/{$name}/'
|
11 |
+
);
|
12 |
+
}
|
@@ -32,15 +32,15 @@ class OctoberInstaller extends BaseInstaller
|
|
32 |
|
33 |
protected function inflectPluginVars($vars)
|
34 |
{
|
35 |
-
$vars['name'] = preg_replace('
|
36 |
|
37 |
return $vars;
|
38 |
}
|
39 |
|
40 |
protected function inflectThemeVars($vars)
|
41 |
{
|
42 |
-
$vars['name'] = preg_replace('
|
43 |
|
44 |
return $vars;
|
45 |
}
|
46 |
-
}
|
32 |
|
33 |
protected function inflectPluginVars($vars)
|
34 |
{
|
35 |
+
$vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
|
36 |
|
37 |
return $vars;
|
38 |
}
|
39 |
|
40 |
protected function inflectThemeVars($vars)
|
41 |
{
|
42 |
+
$vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
|
43 |
|
44 |
return $vars;
|
45 |
}
|
46 |
+
}
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PxcmsInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'app/Modules/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name.
|
13 |
+
*
|
14 |
+
* @param array $vars
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
if ($vars['type'] === 'pxcms-module') {
|
21 |
+
return $this->inflectModuleVars($vars);
|
22 |
+
}
|
23 |
+
|
24 |
+
if ($vars['type'] === 'pxcms-theme') {
|
25 |
+
return $this->inflectThemeVars($vars);
|
26 |
+
}
|
27 |
+
|
28 |
+
return $vars;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
|
33 |
+
*
|
34 |
+
* return string
|
35 |
+
*/
|
36 |
+
protected function inflectModuleVars($vars)
|
37 |
+
{
|
38 |
+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
|
39 |
+
$vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
|
40 |
+
$vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
|
41 |
+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
|
42 |
+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
|
43 |
+
|
44 |
+
return $vars;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
|
50 |
+
*
|
51 |
+
* return string
|
52 |
+
*/
|
53 |
+
protected function inflectThemeVars($vars)
|
54 |
+
{
|
55 |
+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
|
56 |
+
$vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
|
57 |
+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
|
58 |
+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
|
59 |
+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
|
60 |
+
|
61 |
+
return $vars;
|
62 |
+
}
|
63 |
+
}
|
@@ -25,9 +25,9 @@ class ShopwareInstaller extends BaseInstaller
|
|
25 |
{
|
26 |
if ($vars['type'] === 'shopware-theme') {
|
27 |
return $this->correctThemeName($vars);
|
28 |
-
} else {
|
29 |
-
return $this->correctPluginName($vars);
|
30 |
}
|
|
|
|
|
31 |
}
|
32 |
|
33 |
/**
|
25 |
{
|
26 |
if ($vars['type'] === 'shopware-theme') {
|
27 |
return $this->correctThemeName($vars);
|
|
|
|
|
28 |
}
|
29 |
+
|
30 |
+
return $this->correctPluginName($vars);
|
31 |
}
|
32 |
|
33 |
/**
|
@@ -28,9 +28,8 @@ class SilverStripeInstaller extends BaseInstaller
|
|
28 |
&& version_compare($package->getVersion(), '2.999.999') < 0
|
29 |
) {
|
30 |
return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
|
31 |
-
} else {
|
32 |
-
return parent::getInstallPath($package, $frameworkType);
|
33 |
}
|
34 |
|
|
|
35 |
}
|
36 |
}
|
28 |
&& version_compare($package->getVersion(), '2.999.999') < 0
|
29 |
) {
|
30 |
return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
|
|
|
|
|
31 |
}
|
32 |
|
33 |
+
return parent::getInstallPath($package, $frameworkType);
|
34 |
}
|
35 |
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class SiteDirectInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'module' => 'modules/{$vendor}/{$name}/',
|
9 |
+
'plugin' => 'plugins/{$vendor}/{$name}/'
|
10 |
+
);
|
11 |
+
|
12 |
+
public function inflectPackageVars($vars)
|
13 |
+
{
|
14 |
+
return $this->parseVars($vars);
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function parseVars($vars)
|
18 |
+
{
|
19 |
+
$vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
|
20 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
21 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
22 |
+
|
23 |
+
return $vars;
|
24 |
+
}
|
25 |
+
}
|
@@ -7,5 +7,6 @@ class WordPressInstaller extends BaseInstaller
|
|
7 |
'plugin' => 'wp-content/plugins/{$name}/',
|
8 |
'theme' => 'wp-content/themes/{$name}/',
|
9 |
'muplugin' => 'wp-content/mu-plugins/{$name}/',
|
|
|
10 |
);
|
11 |
}
|
7 |
'plugin' => 'wp-content/plugins/{$name}/',
|
8 |
'theme' => 'wp-content/themes/{$name}/',
|
9 |
'muplugin' => 'wp-content/mu-plugins/{$name}/',
|
10 |
+
'dropin' => 'wp-content/{$name}/',
|
11 |
);
|
12 |
}
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\AsgardInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class AsgardInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var AsgardInstaller
|
4 |
use Composer\Installers\AsgardInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase;
|
8 |
|
9 |
+
class AsgardInstallerTest extends TestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var AsgardInstaller
|
@@ -3,7 +3,6 @@
|
|
3 |
namespace Composer\Installers\Test;
|
4 |
|
5 |
use Composer\Installers\BitrixInstaller;
|
6 |
-
use Composer\Package\PackageInterface;
|
7 |
use Composer\Package\Package;
|
8 |
use Composer\Composer;
|
9 |
|
@@ -73,4 +72,4 @@ class BitrixInstallerTest extends TestCase
|
|
73 |
),
|
74 |
);
|
75 |
}
|
76 |
-
}
|
3 |
namespace Composer\Installers\Test;
|
4 |
|
5 |
use Composer\Installers\BitrixInstaller;
|
|
|
6 |
use Composer\Package\Package;
|
7 |
use Composer\Composer;
|
8 |
|
72 |
),
|
73 |
);
|
74 |
}
|
75 |
+
}
|
@@ -6,7 +6,6 @@ use Composer\Repository\RepositoryManager;
|
|
6 |
use Composer\Repository\InstalledArrayRepository;
|
7 |
use Composer\Package\Package;
|
8 |
use Composer\Package\RootPackage;
|
9 |
-
use Composer\Package\Link;
|
10 |
use Composer\Package\Version\VersionParser;
|
11 |
use Composer\Composer;
|
12 |
use Composer\Config;
|
6 |
use Composer\Repository\InstalledArrayRepository;
|
7 |
use Composer\Package\Package;
|
8 |
use Composer\Package\RootPackage;
|
|
|
9 |
use Composer\Package\Version\VersionParser;
|
10 |
use Composer\Composer;
|
11 |
use Composer\Config;
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\DokuWikiInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class DokuWikiInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var DokuWikiInstaller
|
4 |
use Composer\Installers\DokuWikiInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class DokuWikiInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var DokuWikiInstaller
|
@@ -123,7 +123,10 @@ class InstallerTest extends TestCase
|
|
123 |
array('ee2-theme', true),
|
124 |
array('ee2-addon', true),
|
125 |
array('elgg-plugin', true),
|
|
|
126 |
array('eliasis-module', true),
|
|
|
|
|
127 |
array('ezplatform-assets', true),
|
128 |
array('ezplatform-meta-assets', true),
|
129 |
array('fuel-module', true),
|
@@ -149,7 +152,9 @@ class InstallerTest extends TestCase
|
|
149 |
array('lavalite-package', true),
|
150 |
array('lithium-library', true),
|
151 |
array('magento-library', true),
|
|
|
152 |
array('mako-package', true),
|
|
|
153 |
array('modxevo-snippet', true),
|
154 |
array('modxevo-plugin', true),
|
155 |
array('modxevo-module', true),
|
@@ -163,6 +168,8 @@ class InstallerTest extends TestCase
|
|
163 |
array('october-module', true),
|
164 |
array('october-plugin', true),
|
165 |
array('piwik-plugin', true),
|
|
|
|
|
166 |
array('phpbb-extension', true),
|
167 |
array('pimcore-plugin', true),
|
168 |
array('plentymarkets-plugin', true),
|
@@ -277,7 +284,10 @@ class InstallerTest extends TestCase
|
|
277 |
array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
|
278 |
array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
|
279 |
array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
|
|
|
280 |
array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
|
|
|
|
|
281 |
array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
|
282 |
array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
|
283 |
array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
|
@@ -311,6 +321,8 @@ class InstallerTest extends TestCase
|
|
311 |
array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
|
312 |
array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
|
313 |
array('magento-library', 'lib/foo/', 'test/foo'),
|
|
|
|
|
314 |
array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
|
315 |
array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
|
316 |
array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
|
@@ -332,6 +344,10 @@ class InstallerTest extends TestCase
|
|
332 |
array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
|
333 |
array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
|
334 |
array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
|
|
|
|
|
|
|
|
|
335 |
array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
|
336 |
array('phpbb-style', 'styles/foo/', 'test/foo'),
|
337 |
array('phpbb-language', 'language/foo/', 'test/foo'),
|
@@ -525,7 +541,7 @@ class InstallerTest extends TestCase
|
|
525 |
$package = new Package('foo', '1.0.0', '1.0.0');
|
526 |
|
527 |
$installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
|
528 |
-
$installer->expects($this->
|
529 |
|
530 |
$repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
531 |
$repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
|
123 |
array('ee2-theme', true),
|
124 |
array('ee2-addon', true),
|
125 |
array('elgg-plugin', true),
|
126 |
+
array('eliasis-component', true),
|
127 |
array('eliasis-module', true),
|
128 |
+
array('eliasis-plugin', true),
|
129 |
+
array('eliasis-template', true),
|
130 |
array('ezplatform-assets', true),
|
131 |
array('ezplatform-meta-assets', true),
|
132 |
array('fuel-module', true),
|
152 |
array('lavalite-package', true),
|
153 |
array('lithium-library', true),
|
154 |
array('magento-library', true),
|
155 |
+
array('majima-plugin', true),
|
156 |
array('mako-package', true),
|
157 |
+
array('modx-extra', true),
|
158 |
array('modxevo-snippet', true),
|
159 |
array('modxevo-plugin', true),
|
160 |
array('modxevo-module', true),
|
168 |
array('october-module', true),
|
169 |
array('october-plugin', true),
|
170 |
array('piwik-plugin', true),
|
171 |
+
array('pxcms-module', true),
|
172 |
+
array('pxcms-theme', true),
|
173 |
array('phpbb-extension', true),
|
174 |
array('pimcore-plugin', true),
|
175 |
array('plentymarkets-plugin', true),
|
284 |
array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
|
285 |
array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
|
286 |
array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
|
287 |
+
array('eliasis-component', 'components/my_component/', 'shama/my_component'),
|
288 |
array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
|
289 |
+
array('eliasis-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
290 |
+
array('eliasis-template', 'templates/my_template/', 'shama/my_template'),
|
291 |
array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
|
292 |
array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
|
293 |
array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
|
321 |
array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
|
322 |
array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
|
323 |
array('magento-library', 'lib/foo/', 'test/foo'),
|
324 |
+
array('majima-plugin', 'plugins/MyPlugin/', 'shama/my-plugin'),
|
325 |
+
array('modx-extra', 'core/packages/extra/', 'vendor/extra'),
|
326 |
array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
|
327 |
array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
|
328 |
array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
|
344 |
array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
|
345 |
array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
|
346 |
array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
|
347 |
+
array('pxcms-module', 'app/Modules/Foo/', 'vendor/module-foo'),
|
348 |
+
array('pxcms-module', 'app/Modules/Foo/', 'vendor/pxcms-foo'),
|
349 |
+
array('pxcms-theme', 'themes/Foo/', 'vendor/theme-foo'),
|
350 |
+
array('pxcms-theme', 'themes/Foo/', 'vendor/pxcms-foo'),
|
351 |
array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
|
352 |
array('phpbb-style', 'styles/foo/', 'test/foo'),
|
353 |
array('phpbb-language', 'language/foo/', 'test/foo'),
|
541 |
$package = new Package('foo', '1.0.0', '1.0.0');
|
542 |
|
543 |
$installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
|
544 |
+
$installer->expects($this->atLeastOnce())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
|
545 |
|
546 |
$repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
547 |
$repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\MayaInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class MayaInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var MayaInstaller
|
4 |
use Composer\Installers\MayaInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class MayaInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var MayaInstaller
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\MediaWikiInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class MediaWikiInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var MediaWikiInstaller
|
4 |
use Composer\Installers\MediaWikiInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class MediaWikiInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var MediaWikiInstaller
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\OctoberInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class OctoberInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var OctoberInstaller
|
@@ -63,4 +64,4 @@ class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
|
|
63 |
),
|
64 |
);
|
65 |
}
|
66 |
-
}
|
4 |
use Composer\Installers\OctoberInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class OctoberInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var OctoberInstaller
|
64 |
),
|
65 |
);
|
66 |
}
|
67 |
+
}
|
@@ -2,14 +2,13 @@
|
|
2 |
namespace Composer\Installers\Test;
|
3 |
|
4 |
use Composer\Installers\OntoWikiInstaller;
|
5 |
-
use
|
6 |
-
use Composer\Composer;
|
7 |
|
8 |
/**
|
9 |
* Test for the OntoWikiInstaller
|
10 |
* code was taken from DokuWikiInstaller
|
11 |
*/
|
12 |
-
class OntoWikiInstallerTest extends
|
13 |
{
|
14 |
/**
|
15 |
* @var OntoWikiInstaller
|
2 |
namespace Composer\Installers\Test;
|
3 |
|
4 |
use Composer\Installers\OntoWikiInstaller;
|
5 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
|
|
6 |
|
7 |
/**
|
8 |
* Test for the OntoWikiInstaller
|
9 |
* code was taken from DokuWikiInstaller
|
10 |
*/
|
11 |
+
class OntoWikiInstallerTest extends BaseTestCase
|
12 |
{
|
13 |
/**
|
14 |
* @var OntoWikiInstaller
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers\Test;
|
4 |
+
|
5 |
+
use Composer\Composer;
|
6 |
+
use Composer\Installers\SiteDirectInstaller;
|
7 |
+
use Composer\Package\Package;
|
8 |
+
|
9 |
+
class SiteDirectInstallerTest extends TestCase
|
10 |
+
{
|
11 |
+
/** @var SiteDirectInstaller $installer */
|
12 |
+
protected $installer;
|
13 |
+
|
14 |
+
/** @var Package */
|
15 |
+
private $package;
|
16 |
+
|
17 |
+
public function SetUp()
|
18 |
+
{
|
19 |
+
$this->package = new Package('sitedirect/some_name', '1.0.9', '1.0');
|
20 |
+
$this->installer = new SiteDirectInstaller(
|
21 |
+
$this->package,
|
22 |
+
new Composer()
|
23 |
+
);
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @dataProvider dataProvider
|
29 |
+
*/
|
30 |
+
public function testInflectPackageVars($data, $expected)
|
31 |
+
{
|
32 |
+
$result = $this->installer->inflectPackageVars($data);
|
33 |
+
$this->assertEquals($result, $expected);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @dataProvider dataProvider
|
38 |
+
*/
|
39 |
+
public function testInstallPath($data, $expected)
|
40 |
+
{
|
41 |
+
$result = $this->installer->inflectPackageVars($data);
|
42 |
+
$path = $this->createPackage($data);
|
43 |
+
|
44 |
+
// use $result to get the proper capitalization for the vendor path
|
45 |
+
$expectedPath = "modules/{$result['vendor']}/{$result['name']}/";
|
46 |
+
$notExpectedPath = "modules/{$data['vendor']}/{$data['name']}/";
|
47 |
+
$this->assertEquals($expectedPath, $path);
|
48 |
+
$this->assertNotEquals($notExpectedPath, $path);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param $data
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
private function createPackage($data)
|
56 |
+
{
|
57 |
+
$fullName = "{$data['vendor']}/{$data['name']}";
|
58 |
+
|
59 |
+
$package = new Package($fullName, '1.0', '1.0');
|
60 |
+
$package->setType('sitedirect-module');
|
61 |
+
$installer = new SiteDirectInstaller($package, new Composer());
|
62 |
+
|
63 |
+
$path = $installer->getInstallPath($package, 'sitedirect');
|
64 |
+
return $path;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function dataProvider()
|
68 |
+
{
|
69 |
+
return array(
|
70 |
+
array(
|
71 |
+
'data' => array(
|
72 |
+
'name' => 'kernel',
|
73 |
+
'vendor' => 'sitedirect',
|
74 |
+
'type' => 'sitedirect-module',
|
75 |
+
),
|
76 |
+
'expected' => array(
|
77 |
+
'name' => 'Kernel',
|
78 |
+
'vendor' => 'SiteDirect',
|
79 |
+
'type' => 'sitedirect-module',
|
80 |
+
)
|
81 |
+
),
|
82 |
+
array(
|
83 |
+
'data' => array(
|
84 |
+
'name' => 'that_guy',
|
85 |
+
'vendor' => 'whatGuy',
|
86 |
+
'type' => 'sitedirect-module',
|
87 |
+
),
|
88 |
+
'expected' => array(
|
89 |
+
'name' => 'ThatGuy',
|
90 |
+
'vendor' => 'whatGuy',
|
91 |
+
'type' => 'sitedirect-module',
|
92 |
+
)
|
93 |
+
),
|
94 |
+
array(
|
95 |
+
'data' => array(
|
96 |
+
'name' => 'checkout',
|
97 |
+
'vendor' => 'someVendor',
|
98 |
+
'type' => 'sitedirect-plugin',
|
99 |
+
),
|
100 |
+
'expected' => array(
|
101 |
+
'name' => 'Checkout',
|
102 |
+
'vendor' => 'someVendor',
|
103 |
+
'type' => 'sitedirect-plugin',
|
104 |
+
)
|
105 |
+
),
|
106 |
+
array(
|
107 |
+
'data' => array(
|
108 |
+
'name' => 'checkout',
|
109 |
+
'vendor' => 'siteDirect',
|
110 |
+
'type' => 'sitedirect-plugin',
|
111 |
+
),
|
112 |
+
'expected' => array(
|
113 |
+
'name' => 'Checkout',
|
114 |
+
'vendor' => 'SiteDirect',
|
115 |
+
'type' => 'sitedirect-plugin',
|
116 |
+
)
|
117 |
+
),
|
118 |
+
);
|
119 |
+
}
|
120 |
+
}
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\SyDESInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class SyDESInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var SyDESInstaller
|
4 |
use Composer\Installers\SyDESInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class SyDESInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var SyDESInstaller
|
@@ -17,8 +17,9 @@ use Composer\Package\Package;
|
|
17 |
use Composer\Package\AliasPackage;
|
18 |
use Composer\Package\LinkConstraint\VersionConstraint;
|
19 |
use Composer\Util\Filesystem;
|
|
|
20 |
|
21 |
-
abstract class TestCase extends
|
22 |
{
|
23 |
private static $parser;
|
24 |
|
17 |
use Composer\Package\AliasPackage;
|
18 |
use Composer\Package\LinkConstraint\VersionConstraint;
|
19 |
use Composer\Util\Filesystem;
|
20 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
21 |
|
22 |
+
abstract class TestCase extends BaseTestCase
|
23 |
{
|
24 |
private static $parser;
|
25 |
|
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
|
|
4 |
use Composer\Installers\VgmcpInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
|
|
7 |
|
8 |
-
class VgmcpInstallerTest extends
|
9 |
{
|
10 |
/**
|
11 |
* @var VgmcpInstaller
|
4 |
use Composer\Installers\VgmcpInstaller;
|
5 |
use Composer\Package\Package;
|
6 |
use Composer\Composer;
|
7 |
+
use PHPUnit\Framework\TestCase as BaseTestCase;
|
8 |
|
9 |
+
class VgmcpInstallerTest extends BaseTestCase
|
10 |
{
|
11 |
/**
|
12 |
* @var VgmcpInstaller
|
@@ -21,7 +21,8 @@ env:
|
|
21 |
- TWIG_EXT=yes
|
22 |
|
23 |
before_install:
|
24 |
-
|
|
|
25 |
|
26 |
install:
|
27 |
- travis_retry composer install
|
21 |
- TWIG_EXT=yes
|
22 |
|
23 |
before_install:
|
24 |
+
# turn off XDebug
|
25 |
+
- phpenv config-rm xdebug.ini || return 0
|
26 |
|
27 |
install:
|
28 |
- travis_retry composer install
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
* 1.34.4 (2017-07-04)
|
2 |
|
3 |
* added support for runtime loaders in IntegrationTestCase
|
@@ -142,7 +149,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 +233,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.0 (2017-09-27)
|
2 |
+
|
3 |
+
* added Twig_Profiler_Profile::reset()
|
4 |
+
* fixed use TokenParser to return an empty Node
|
5 |
+
* added RuntimeExtensionInterface
|
6 |
+
* added circular reference detection when loading templates
|
7 |
+
|
8 |
* 1.34.4 (2017-07-04)
|
9 |
|
10 |
* added support for runtime loaders in IntegrationTestCase
|
149 |
|
150 |
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
151 |
* fixed support for PHP7 (Throwable support)
|
152 |
+
* marked the following methods as being internals on Twig_Environment:
|
153 |
getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(),
|
154 |
getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(),
|
155 |
getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension()
|
233 |
* fixed limited RCEs when in sandbox mode
|
234 |
* deprecated Twig_Template::getEnvironment()
|
235 |
* deprecated the _self variable for usage outside of the from and import tags
|
236 |
+
* added Twig_BaseNodeVisitor to ease the compatibility of node visitors
|
237 |
between 1.x and 2.x
|
238 |
|
239 |
* 1.19.0 (2015-07-31)
|
@@ -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 |
}
|
@@ -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.
|
@@ -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.0"
|
19 |
|
20 |
#include "php.h"
|
21 |
|
@@ -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.
|
@@ -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 |
/**
|
16 |
*/
|
17 |
class Twig_Environment
|
18 |
{
|
19 |
+
const VERSION = '1.35.0';
|
20 |
+
const VERSION_ID = 13500;
|
21 |
const MAJOR_VERSION = 1;
|
22 |
+
const MINOR_VERSION = 35;
|
23 |
+
const RELEASE_VERSION = 0;
|
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.
|
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 |
/**
|
@@ -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);
|
@@ -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()
|
@@ -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">
|
@@ -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 |
+
}
|
@@ -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
|
@@ -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;
|
@@ -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 |
{
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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 |
{
|
@@ -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
|
@@ -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 |
|
@@ -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;
|
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;
|
@@ -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 |
{
|
@@ -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;
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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 |
{
|
@@ -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
|
@@ -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 |
{
|
@@ -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 |
{
|
@@ -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
|
@@ -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 |
{
|
@@ -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 |
}
|
@@ -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
|
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
|
@@ -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 |
{
|
@@ -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 |
|
@@ -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
|
@@ -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().
|
@@ -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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|