Timber - Version 1.3.0

Version Description

  • Default $context object now returns a PostQuery for $context['posts'] this is cool because you can use {{ posts.pagination }} in your Twig templates without any further PHP work (thanks @lggorman)
  • Timber\Images with PDFs and other content types now return the file instead of null # (thanks @hoandang)
  • Timber\Comments now support different comment types #1364 (thanks @yantei)
  • Timber\Comments {{ comment.content }} now returns processed comment with <p> tags
  • Fix for HTTP error when uploading media files in Windows #1346 (thanks Matias Griese)
  • Fix for image resizing on alternative WP setups (thanks @gillesgoetsch)
  • Exposing a function to global Twig scope through Timber\FunctionWrapper is deprecated, the prefered method to do this is through a Twig template like {{ function('my_cool_function', 'my_argument') }} (thanks @gchtr)
  • Fixed issues with use of Twig 2.0 (#1370)
  • Fixed up some things with Timber/Archives and getting post_count #1376
  • Don't let Timber fail when converting TIFFs or other weird file types, instead return the passed value w/o modifying #1383
  • Updated FunctionWrapper with appropriate warnings and Twig 2.0 compat (thank you thank you @gchtr)
  • Misc fixes to documentation
Download this release

Release Info

Developer jarednova
Plugin Icon 128x128 Timber
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.4 to 1.3.0

Files changed (94) hide show
  1. README.md +9 -8
  2. lib/Archives.php +10 -7
  3. lib/Comment.php +1 -1
  4. lib/CommentThread.php +12 -5
  5. lib/FunctionWrapper.php +24 -13
  6. lib/Helper.php +15 -11
  7. lib/Image.php +16 -1
  8. lib/Image/Operation/ToJpg.php +14 -0
  9. lib/ImageHelper.php +12 -8
  10. lib/Integrations/ACF.php +3 -3
  11. lib/Loader.php +4 -1
  12. lib/MenuItem.php +1 -1
  13. lib/Post.php +9 -7
  14. lib/PostPreview.php +4 -1
  15. lib/Site.php +2 -2
  16. lib/Term.php +28 -2
  17. lib/TextHelper.php +16 -0
  18. lib/Theme.php +1 -1
  19. lib/Timber.php +17 -11
  20. lib/Twig.php +60 -48
  21. lib/URLHelper.php +6 -3
  22. readme.txt +16 -2
  23. timber-starter-theme/functions.php +1 -0
  24. timber.php +1 -1
  25. vendor/autoload.php +1 -1
  26. vendor/composer/autoload_real.php +3 -3
  27. vendor/composer/installed.json +127 -119
  28. vendor/composer/installers/.travis.yml +2 -0
  29. vendor/composer/installers/CHANGELOG.md +60 -0
  30. vendor/composer/installers/CONTRIBUTING.md +24 -0
  31. vendor/composer/installers/README.md +15 -21
  32. vendor/composer/installers/composer.json +7 -0
  33. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +0 -1
  34. vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +3 -2
  35. vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +9 -0
  36. vendor/composer/installers/src/Composer/Installers/Installer.php +8 -0
  37. vendor/composer/installers/src/Composer/Installers/ItopInstaller.php +9 -0
  38. vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php +18 -0
  39. vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php +10 -0
  40. vendor/composer/installers/src/Composer/Installers/MayaInstaller.php +33 -0
  41. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +1 -0
  42. vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php +24 -0
  43. vendor/composer/installers/src/Composer/Installers/PortoInstaller.php +9 -0
  44. vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +49 -0
  45. vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php +49 -0
  46. vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +18 -2
  47. vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php +61 -0
  48. vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php +85 -0
  49. vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php +81 -0
  50. vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php +79 -0
  51. vendor/twig/twig/.travis.yml +0 -1
  52. vendor/twig/twig/CHANGELOG +23 -0
  53. vendor/twig/twig/composer.json +4 -3
  54. vendor/twig/twig/doc/advanced.rst +5 -0
  55. vendor/twig/twig/doc/deprecated.rst +3 -0
  56. vendor/twig/twig/doc/filters/length.rst +11 -1
  57. vendor/twig/twig/doc/filters/striptags.rst +14 -0
  58. vendor/twig/twig/doc/filters/trim.rst +17 -1
  59. vendor/twig/twig/doc/recipes.rst +3 -3
  60. vendor/twig/twig/doc/templates.rst +1 -1
  61. vendor/twig/twig/doc/tests/empty.rst +12 -1
  62. vendor/twig/twig/ext/twig/php_twig.h +1 -1
  63. vendor/twig/twig/lib/Twig/Cache/Filesystem.php +7 -2
  64. vendor/twig/twig/lib/Twig/Compiler.php +1 -1
  65. vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php +37 -0
  66. vendor/twig/twig/lib/Twig/Environment.php +4 -4
  67. vendor/twig/twig/lib/Twig/Extension/Core.php +54 -4
  68. vendor/twig/twig/lib/Twig/Loader/Array.php +1 -1
  69. vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php +1 -1
  70. vendor/twig/twig/lib/Twig/Template.php +8 -5
  71. vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php +4 -0
  72. vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php +3 -3
  73. vendor/twig/twig/phpunit.xml.dist +1 -1
  74. vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php +40 -0
  75. vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php +6 -1
  76. vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +4 -1
  77. vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +4 -0
  78. vendor/twig/twig/test/Twig/Tests/{RuntimeFactoryLoaderTest.php → FactoryRuntimeLoaderTest.php} +0 -0
  79. vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test +4 -0
  80. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test +8 -0
  81. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +14 -3
  82. vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test +12 -0
  83. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test +25 -28
  84. vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +55 -0
  85. vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php +1 -1
  86. vendor/twig/twig/test/Twig/Tests/LexerTest.php +40 -4
  87. vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +28 -2
  88. vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +2 -2
  89. vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +1 -1
  90. vendor/twig/twig/test/Twig/Tests/ParserTest.php +5 -3
  91. vendor/twig/twig/test/Twig/Tests/TemplateTest.php +41 -7
  92. vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +4 -4
  93. vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php +42 -0
  94. vendor/twig/twig/test/bootstrap.php +10 -2
README.md CHANGED
@@ -5,12 +5,13 @@ By Jared Novack (<a href="https://twitter.com/jarednova">@JaredNova</a>) and <a
5
  </div>
6
 
7
  [![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
8
- [![Coverage Status](https://img.shields.io/codecov/c/github/timber/timber.svg?style=flat-square)](https://codecov.io/gh/timber/timber)
9
  [![Dependency Status](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f)
10
  [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
11
  [![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
12
  [![WordPress Download Count](https://img.shields.io/wordpress/plugin/dt/timber-library.svg?style=flat-square)](https://wordpress.org/plugins/timber-library/)
13
  [![Join the chat at https://gitter.im/timber/timber](https://img.shields.io/gitter/room/timber/timber.svg?style=flat-square)](https://gitter.im/timber/timber?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 
14
 
15
 
16
  ### Because WordPress is awesome, but the_loop isn't
@@ -23,12 +24,12 @@ This is what Timber's `.twig` files look like:
23
  ```twig
24
  {% extends "base.twig" %}
25
  {% block content %}
26
- <h1 class="big-title">{{foo}}</h1>
27
- <h2 class="post-title">{{post.title}}</h2>
28
- <img src="{{post.thumbnail.src}}" />
29
- <div class="body">
30
- {{post.content}}
31
- </div>
32
  {% endblock %}
33
  ```
34
  Once Timber is installed and activated in your plugin directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
@@ -108,7 +109,7 @@ Read the [contributor guidelines](https://github.com/timber/timber/wiki#contribu
108
 
109
  Documentation for Timber classes and functions is [auto generated](https://github.com/jarednova/PHP-Markdown-Documentation-Generator), so any changes to the object reference docs should be made by editing the function's DocBlock. To make a change to one of the guides, edit the relevant file in the `docs` directory.
110
 
111
- ####To publish docs:
112
 
113
  1. `composer install` if not already run
114
  2. Clone the [timber/slate](https://github.com/timber/slate) repo at the same directory level as Timber
5
  </div>
6
 
7
  [![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
8
+ [![Coverage Status](https://img.shields.io/coveralls/timber/timber.svg?style=flat-square)](https://codecov.io/gh/timber/timber)
9
  [![Dependency Status](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f)
10
  [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
11
  [![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
12
  [![WordPress Download Count](https://img.shields.io/wordpress/plugin/dt/timber-library.svg?style=flat-square)](https://wordpress.org/plugins/timber-library/)
13
  [![Join the chat at https://gitter.im/timber/timber](https://img.shields.io/gitter/room/timber/timber.svg?style=flat-square)](https://gitter.im/timber/timber?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
14
+ [![WordPress Rating](https://img.shields.io/wordpress/plugin/r/timber-library.svg?style=flat-square)](https://wordpress.org/support/plugin/timber-library/reviews/)
15
 
16
 
17
  ### Because WordPress is awesome, but the_loop isn't
24
  ```twig
25
  {% extends "base.twig" %}
26
  {% block content %}
27
+ <h1 class="big-title">{{ foo }}</h1>
28
+ <h2 class="post-title">{{ post.title }}</h2>
29
+ <img src="{{ post.thumbnail.src }}" />
30
+ <div class="body">
31
+ {{ post.content }}
32
+ </div>
33
  {% endblock %}
34
  ```
35
  Once Timber is installed and activated in your plugin directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
109
 
110
  Documentation for Timber classes and functions is [auto generated](https://github.com/jarednova/PHP-Markdown-Documentation-Generator), so any changes to the object reference docs should be made by editing the function's DocBlock. To make a change to one of the guides, edit the relevant file in the `docs` directory.
111
 
112
+ #### To publish docs:
113
 
114
  1. `composer install` if not already run
115
  2. Clone the [timber/slate](https://github.com/timber/slate) repo at the same directory level as Timber
lib/Archives.php CHANGED
@@ -83,10 +83,13 @@ class Archives extends Core {
83
  * @param string $text
84
  * @return mixed
85
  */
86
- protected function get_archives_link( $url, $text ) {
87
  $ret = array();
88
  $ret['text'] = $ret['title'] = $ret['name'] = wptexturize($text);
89
  $ret['url'] = $ret['link'] = esc_url(URLHelper::prepend_to_url($url, $this->base));
 
 
 
90
  return $ret;
91
  }
92
 
@@ -114,7 +117,7 @@ class Archives extends Core {
114
  foreach ( (array) $results as $result ) {
115
  $url = get_year_link($result->year);
116
  $text = sprintf('%d', $result->year);
117
- $output[] = $this->get_archives_link($url, $text);
118
  }
119
  }
120
  return $output;
@@ -159,16 +162,16 @@ class Archives extends Core {
159
  $text = sprintf(__('%1$s'), $wp_locale->get_month($result->month));
160
  }
161
  if ( $nested ) {
162
- $output[$result->year][] = $this->get_archives_link($url, $text);
163
  } else {
164
- $output[] = $this->get_archives_link($url, $text);
165
  }
166
  }
167
  }
168
  if ( $nested ) {
169
  $out2 = array();
170
  foreach ( $output as $year => $months ) {
171
- $out2[] = array('name' => $year, 'children' => $months);
172
  }
173
  return $out2;
174
  }
@@ -265,7 +268,7 @@ class Archives extends Core {
265
  $url = get_day_link($result->year, $result->month, $result->dayofmonth);
266
  $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth);
267
  $text = mysql2date($archive_day_date_format, $date);
268
- $output[] = $this->get_archives_link($url, $text);
269
  }
270
  }
271
  } elseif ( 'weekly' == $type ) {
@@ -289,7 +292,7 @@ class Archives extends Core {
289
  $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
290
  $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $result->week);
291
  $text = $arc_week_start.$archive_week_separator.$arc_week_end;
292
- $output[] = $this->get_archives_link($url, $text);
293
  }
294
  }
295
  }
83
  * @param string $text
84
  * @return mixed
85
  */
86
+ protected function get_archives_link( $url, $text, $post_count = 0 ) {
87
  $ret = array();
88
  $ret['text'] = $ret['title'] = $ret['name'] = wptexturize($text);
89
  $ret['url'] = $ret['link'] = esc_url(URLHelper::prepend_to_url($url, $this->base));
90
+ if ($post_count) {
91
+ $ret['post_count'] = (int) $post_count;
92
+ }
93
  return $ret;
94
  }
95
 
117
  foreach ( (array) $results as $result ) {
118
  $url = get_year_link($result->year);
119
  $text = sprintf('%d', $result->year);
120
+ $output[] = $this->get_archives_link($url, $text, $result->posts);
121
  }
122
  }
123
  return $output;
162
  $text = sprintf(__('%1$s'), $wp_locale->get_month($result->month));
163
  }
164
  if ( $nested ) {
165
+ $output[$result->year][] = $this->get_archives_link($url, $text, $result->posts);
166
  } else {
167
+ $output[] = $this->get_archives_link($url, $text, $result->posts);
168
  }
169
  }
170
  }
171
  if ( $nested ) {
172
  $out2 = array();
173
  foreach ( $output as $year => $months ) {
174
+ $out2[] = array('name' => $year, 'children' => $months, 'post_count' => array_sum(array_column($months, 'post_count')));
175
  }
176
  return $out2;
177
  }
268
  $url = get_day_link($result->year, $result->month, $result->dayofmonth);
269
  $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth);
270
  $text = mysql2date($archive_day_date_format, $date);
271
+ $output[] = $this->get_archives_link($url, $text, $result->posts);
272
  }
273
  }
274
  } elseif ( 'weekly' == $type ) {
292
  $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
293
  $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $result->week);
294
  $text = $arc_week_start.$archive_week_separator.$arc_week_end;
295
+ $output[] = $this->get_archives_link($url, $text, $result->posts);
296
  }
297
  }
298
  }
lib/Comment.php CHANGED
@@ -155,7 +155,7 @@ class Comment extends Core implements CoreInterface {
155
  * @return string
156
  */
157
  public function content() {
158
- return apply_filters('get_comment_text ', $this->comment_content);
159
  }
160
 
161
  /**
155
  * @return string
156
  */
157
  public function content() {
158
+ return trim(apply_filters('comment_text', $this->comment_content));
159
  }
160
 
161
  /**
lib/CommentThread.php CHANGED
@@ -11,10 +11,17 @@ class CommentThread extends \ArrayObject {
11
  var $_orderby = '';
12
  var $_order = 'ASC';
13
 
 
 
 
 
 
14
  public function __construct( $post_id, $args = array() ) {
15
  parent::__construct();
16
  $this->post_id = $post_id;
17
- $this->init($args);
 
 
18
  }
19
 
20
  protected function fetch_comments( $args = array() ) {
@@ -47,10 +54,10 @@ class CommentThread extends \ArrayObject {
47
  return $this;
48
  }
49
 
50
- protected function init( $args = array() ) {
51
  global $overridden_cpage;
52
  $args = self::merge_args($args);
53
- $comments = $this->fetch_comments( $args );
54
  $tcs = array();
55
  if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
56
  set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1);
@@ -77,10 +84,10 @@ class CommentThread extends \ArrayObject {
77
  foreach ( $children as &$comment ) {
78
  $parent_id = $comment->comment_parent;
79
  if ( isset($parents[$parent_id]) ) {
80
- $parents[$parent_id]->add_child( $comment );
81
  }
82
  if ( isset($children[$parent_id]) ) {
83
- $children[$parent_id]->add_child( $comment );
84
  }
85
  }
86
  //there's something in update_depth that breaks order?
11
  var $_orderby = '';
12
  var $_order = 'ASC';
13
 
14
+ /**
15
+ * @param int $post_id
16
+ * @param array|boolean $args an array of arguments
17
+ * or false if to skip initialization
18
+ */
19
  public function __construct( $post_id, $args = array() ) {
20
  parent::__construct();
21
  $this->post_id = $post_id;
22
+ if ( $args || is_array($args) ) {
23
+ $this->init($args);
24
+ }
25
  }
26
 
27
  protected function fetch_comments( $args = array() ) {
54
  return $this;
55
  }
56
 
57
+ public function init( $args = array() ) {
58
  global $overridden_cpage;
59
  $args = self::merge_args($args);
60
+ $comments = $this->fetch_comments($args);
61
  $tcs = array();
62
  if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
63
  set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1);
84
  foreach ( $children as &$comment ) {
85
  $parent_id = $comment->comment_parent;
86
  if ( isset($parents[$parent_id]) ) {
87
+ $parents[$parent_id]->add_child($comment);
88
  }
89
  if ( isset($children[$parent_id]) ) {
90
+ $children[$parent_id]->add_child($comment);
91
  }
92
  }
93
  //there's something in update_depth that breaks order?
lib/FunctionWrapper.php CHANGED
@@ -4,6 +4,13 @@ namespace Timber;
4
 
5
  use Timber\Helper;
6
 
 
 
 
 
 
 
 
7
  class FunctionWrapper {
8
 
9
  private $_class;
@@ -42,23 +49,27 @@ class FunctionWrapper {
42
  $this->_args = $args;
43
  $this->_use_ob = $return_output_buffer;
44
 
 
 
 
 
45
  add_filter('timber/twig', array(&$this, 'add_to_twig'));
46
  }
47
 
48
- /**
49
- *
50
- *
51
- * @param Twig_Environment $twig
52
- * @return Twig_Environment
53
- */
 
54
  public function add_to_twig( $twig ) {
55
- $wrapper = $this;
56
-
57
- $twig->addFunction(new \Twig_SimpleFunction($this->_function, function() use ($wrapper) {
58
- return call_user_func_array(array($wrapper, 'call'), func_get_args());
59
- } ));
60
-
61
- return $twig;
62
  }
63
 
64
  /**
4
 
5
  use Timber\Helper;
6
 
7
+ /**
8
+ * FunctionWrapper Class.
9
+ *
10
+ * With Timber, we want to prepare all the data before we echo content through a render function. Some functionality in WordPress directly echoes output instead of returning it. This class makes it easier to store the results of an echoing function by using ob_start() and ob_end_clean() behind the scenes.
11
+ *
12
+ * @package Timber
13
+ */
14
  class FunctionWrapper {
15
 
16
  private $_class;
49
  $this->_args = $args;
50
  $this->_use_ob = $return_output_buffer;
51
 
52
+ /**
53
+ * @deprecated since 1.3.0
54
+ * @todo remove in 1.4.0
55
+ */
56
  add_filter('timber/twig', array(&$this, 'add_to_twig'));
57
  }
58
 
59
+ /**
60
+ *
61
+ * @deprecated since 1.3.0
62
+ * @todo remove in 1.4.0
63
+ * @param Twig_Environment $twig
64
+ * @return Twig_Environment
65
+ */
66
  public function add_to_twig( $twig ) {
67
+ $wrapper = $this;
68
+ $twig->addFunction(new \Twig_SimpleFunction($this->_function, function() use ($wrapper) {
69
+ return call_user_func_array(array($wrapper, 'call'), func_get_args());
70
+ } ));
71
+
72
+ return $twig;
 
73
  }
74
 
75
  /**
lib/Helper.php CHANGED
@@ -172,13 +172,17 @@ class Helper {
172
  }
173
 
174
  /**
175
- * @param mixed $function_name or array( $class( string|object ), $function_name )
176
- * @param array (optional) $defaults
177
- * @param bool (optional) $return_output_buffer Return function output instead of return value (default: false)
178
- * @return Timber\FunctionWrapper|mixed
 
 
179
  */
180
  public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) {
181
- return new FunctionWrapper($function_name, $defaults, $return_output_buffer);
 
 
182
  }
183
 
184
  /**
@@ -205,7 +209,7 @@ class Helper {
205
  public static function warn( $message ) {
206
  return trigger_error($message, E_USER_WARNING);
207
  }
208
-
209
  /**
210
  *
211
  *
@@ -337,10 +341,10 @@ class Helper {
337
  return $arr;
338
  }
339
  }
340
- } else {
341
- throw new \InvalidArgumentException('$array is not an array, got:');
342
- Helper::error_log($array);
343
  }
 
 
344
  }
345
 
346
  /**
@@ -410,7 +414,7 @@ class Helper {
410
  $return[] = $obj->$key();
411
  } elseif ( is_object($obj) && property_exists($obj, $key) ) {
412
  $return[] = $obj->$key;
413
- } elseif ( isset($obj[$key]) ) {
414
  $return[] = $obj[$key];
415
  }
416
  }
@@ -451,4 +455,4 @@ class Helper {
451
  Helper::warn('TimberHelper::get_current_url() is deprecated and will be removed in future versions, use Timber\URLHelper::get_current_url()');
452
  return URLHelper::get_current_url();
453
  }
454
- }
172
  }
173
 
174
  /**
175
+ * @deprecated since 1.3.0
176
+ *
177
+ * @param mixed $function_name String or array( $class( string|object ), $function_name ).
178
+ * @param array $defaults Optional.
179
+ * @param bool $return_output_buffer Optional. Return function output instead of return value. Default false.
180
+ * @return FunctionWrapper|mixed
181
  */
182
  public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) {
183
+ Helper::warn( 'function_wrapper is deprecated and will be removed in 1.4. Use {{ function( \'function_to_call\' ) }} instead or use FunctionWrapper directly. For more information refer to http://timber.github.io/timber/#functions' );
184
+
185
+ return new FunctionWrapper( $function_name, $defaults, $return_output_buffer );
186
  }
187
 
188
  /**
209
  public static function warn( $message ) {
210
  return trigger_error($message, E_USER_WARNING);
211
  }
212
+
213
  /**
214
  *
215
  *
341
  return $arr;
342
  }
343
  }
344
+ return false;
 
 
345
  }
346
+ throw new \InvalidArgumentException('$array is not an array, got:');
347
+ Helper::error_log($array);
348
  }
349
 
350
  /**
414
  $return[] = $obj->$key();
415
  } elseif ( is_object($obj) && property_exists($obj, $key) ) {
416
  $return[] = $obj->$key;
417
+ } elseif ( is_array($obj) && isset($obj[$key]) ) {
418
  $return[] = $obj[$key];
419
  }
420
  }
455
  Helper::warn('TimberHelper::get_current_url() is deprecated and will be removed in future versions, use Timber\URLHelper::get_current_url()');
456
  return URLHelper::get_current_url();
457
  }
458
+ }
lib/Image.php CHANGED
@@ -441,6 +441,10 @@ class Image extends Post implements CoreInterface {
441
  return $this->_maybe_secure_url($this->abs_url);
442
  }
443
 
 
 
 
 
444
  $src = wp_get_attachment_image_src($this->ID, $size);
445
  $src = $src[0];
446
  $src = apply_filters('timber/image/src', $src, $this->ID);
@@ -448,6 +452,17 @@ class Image extends Post implements CoreInterface {
448
  return $src;
449
  }
450
 
 
 
 
 
 
 
 
 
 
 
 
451
  /**
452
  * @api
453
  * @example
@@ -493,4 +508,4 @@ class Image extends Post implements CoreInterface {
493
  Helper::warn('{{image.get_url}} is deprecated and will be removed in 1.1; use {{image.src}}');
494
  return $this->src($size);
495
  }
496
- }
441
  return $this->_maybe_secure_url($this->abs_url);
442
  }
443
 
444
+ if (!$this->is_image()) {
445
+ return wp_get_attachment_url($this->ID);
446
+ }
447
+
448
  $src = wp_get_attachment_image_src($this->ID, $size);
449
  $src = $src[0];
450
  $src = apply_filters('timber/image/src', $src, $this->ID);
452
  return $src;
453
  }
454
 
455
+ /**
456
+ * @internal
457
+ * @return bool true if media is an image
458
+ */
459
+ protected function is_image() {
460
+ $src = wp_get_attachment_url($this->ID);
461
+ $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
462
+ $check = wp_check_filetype(basename($src), null);
463
+ return in_array($check['ext'], $image_exts);
464
+ }
465
+
466
  /**
467
  * @api
468
  * @example
508
  Helper::warn('{{image.get_url}} is deprecated and will be removed in 1.1; use {{image.src}}');
509
  return $this->src($size);
510
  }
511
+ }
lib/Image/Operation/ToJpg.php CHANGED
@@ -40,6 +40,20 @@ class ToJpg extends ImageOperation {
40
  * @return bool true if everything went fine, false otherwise
41
  */
42
  public function run( $load_filename, $save_filename ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  $input = self::image_create($load_filename);
44
  list($width, $height) = getimagesize($load_filename);
45
  $output = imagecreatetruecolor($width, $height);
40
  * @return bool true if everything went fine, false otherwise
41
  */
42
  public function run( $load_filename, $save_filename ) {
43
+
44
+ // First, check if the filetype is a valid one. Processing an invalid filetype
45
+ // results in an exception, which is not really useful.
46
+ // See issue: "Timber throw exception when trying to convert TIFF to JPEG #1192"
47
+
48
+ $ext = wp_check_filetype($load_filename);
49
+ if ( isset($ext['ext']) ) {
50
+ $ext = $ext['ext'];
51
+ }
52
+ $ext = strtolower($ext);
53
+ if (!in_array($ext, ['gif', 'png', 'jpg', 'jpeg'])) {
54
+ return false;
55
+ }
56
+
57
  $input = self::image_create($load_filename);
58
  list($width, $height) = getimagesize($load_filename);
59
  $output = imagecreatetruecolor($width, $height);
lib/ImageHelper.php CHANGED
@@ -257,8 +257,7 @@ class ImageHelper {
257
  protected static function process_delete_generated_files( $filename, $ext, $dir, $search_pattern, $match_pattern = null ) {
258
  $searcher = '/'.$filename.$search_pattern;
259
  foreach ( glob($dir.$searcher) as $found_file ) {
260
- $regexdir = str_replace('/', '\/', $dir);
261
- $pattern = '/'.($regexdir).'\/'.$filename.$match_pattern.$ext.'/';
262
  $match = preg_match($pattern, $found_file);
263
  if ( !$match_pattern || $match ) {
264
  unlink($found_file);
@@ -354,25 +353,30 @@ class ImageHelper {
354
  );
355
  $upload_dir = wp_upload_dir();
356
  $tmp = $url;
357
- if ( 0 === strpos($tmp, ABSPATH) || 0 === strpos($tmp, '/srv/www/') ) {
358
  // we've been given a dir, not an url
359
  $result['absolute'] = true;
360
- if ( 0 === strpos($tmp, $upload_dir['basedir']) ) {
361
  $result['base'] = self::BASE_UPLOADS; // upload based
362
  $tmp = str_replace($upload_dir['basedir'], '', $tmp);
363
  }
364
- if ( 0 === strpos($tmp, WP_CONTENT_DIR) ) {
365
  $result['base'] = self::BASE_CONTENT; // content based
366
  $tmp = str_replace(WP_CONTENT_DIR, '', $tmp);
367
  }
368
  } else {
369
- if ( !$result['absolute'] ) {
 
 
 
 
 
370
  $tmp = site_url().$tmp;
371
  }
372
- if ( 0 === strpos($tmp, $upload_dir['baseurl']) ) {
373
  $result['base'] = self::BASE_UPLOADS; // upload based
374
  $tmp = str_replace($upload_dir['baseurl'], '', $tmp);
375
- } else if ( 0 === strpos($tmp, content_url()) ) {
376
  $result['base'] = self::BASE_CONTENT; // content-based
377
  $tmp = self::theme_url_to_dir($tmp);
378
  $tmp = str_replace(WP_CONTENT_DIR, '', $tmp);
257
  protected static function process_delete_generated_files( $filename, $ext, $dir, $search_pattern, $match_pattern = null ) {
258
  $searcher = '/'.$filename.$search_pattern;
259
  foreach ( glob($dir.$searcher) as $found_file ) {
260
+ $pattern = '/'.preg_quote($dir, '/').'\/'.preg_quote($filename, '/').$match_pattern.preg_quote($ext, '/').'/';
 
261
  $match = preg_match($pattern, $found_file);
262
  if ( !$match_pattern || $match ) {
263
  unlink($found_file);
353
  );
354
  $upload_dir = wp_upload_dir();
355
  $tmp = $url;
356
+ if ( TextHelper::starts_with($tmp, ABSPATH) || TextHelper::starts_with($tmp, '/srv/www/') ) {
357
  // we've been given a dir, not an url
358
  $result['absolute'] = true;
359
+ if ( TextHelper::starts_with($tmp, $upload_dir['basedir']) ) {
360
  $result['base'] = self::BASE_UPLOADS; // upload based
361
  $tmp = str_replace($upload_dir['basedir'], '', $tmp);
362
  }
363
+ if ( TextHelper::starts_with($tmp, WP_CONTENT_DIR) ) {
364
  $result['base'] = self::BASE_CONTENT; // content based
365
  $tmp = str_replace(WP_CONTENT_DIR, '', $tmp);
366
  }
367
  } else {
368
+ // if upload dir does not contain site_url, the content-directory seems to be outside of the site_url
369
+ // therefore using site_url() would lead to a wrong content/ path
370
+ if ( false === strpos($upload_dir['baseurl'], site_url()) ) {
371
+ // use HOME_URL and relative image path
372
+ $tmp = get_home_url().$tmp;
373
+ } else if ( !$result['absolute'] ) {
374
  $tmp = site_url().$tmp;
375
  }
376
+ if ( TextHelper::starts_with($tmp, $upload_dir['baseurl']) ) {
377
  $result['base'] = self::BASE_UPLOADS; // upload based
378
  $tmp = str_replace($upload_dir['baseurl'], '', $tmp);
379
+ } else if ( TextHelper::starts_with($tmp, content_url()) ) {
380
  $result['base'] = self::BASE_CONTENT; // content-based
381
  $tmp = self::theme_url_to_dir($tmp);
382
  $tmp = str_replace(WP_CONTENT_DIR, '', $tmp);
lib/Integrations/ACF.php CHANGED
@@ -7,10 +7,10 @@ class ACF {
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_term_get_meta', array($this, 'term_get_meta'), 10, 3);
11
- add_filter('timber_term_get_meta_field', array($this, 'term_get_meta_field'), 10, 4);
12
  add_filter('timber_user_get_meta_field_pre', array($this, 'user_get_meta_field'), 10, 3);
13
- add_filter('timber_term_set_meta', array($this, 'term_set_meta'), 10, 4);
14
  }
15
 
16
  public function post_get_meta( $customs, $post_id ) {
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/term/meta', array($this, 'term_get_meta'), 10, 3);
11
+ add_filter('timber/term/meta/field', array($this, 'term_get_meta_field'), 10, 4);
12
  add_filter('timber_user_get_meta_field_pre', array($this, 'user_get_meta_field'), 10, 3);
13
+ add_filter('timber/term/meta/set', array($this, 'term_set_meta'), 10, 4);
14
  }
15
 
16
  public function post_get_meta( $customs, $post_id ) {
lib/Loader.php CHANGED
@@ -163,6 +163,7 @@ class Loader {
163
 
164
  $twig = apply_filters('twig_apply_filters', $twig);
165
  $twig = apply_filters('timber/twig/filters', $twig);
 
166
  $twig = apply_filters('timber/twig/escapers', $twig);
167
  $twig = apply_filters('timber/loader/twig', $twig);
168
  return $twig;
@@ -205,7 +206,9 @@ class Loader {
205
 
206
  public function clear_cache_twig() {
207
  $twig = $this->get_twig();
208
- $twig->clearCacheFiles();
 
 
209
  $cache = $twig->getCache();
210
  if ( $cache ) {
211
  self::rrmdir($twig->getCache());
163
 
164
  $twig = apply_filters('twig_apply_filters', $twig);
165
  $twig = apply_filters('timber/twig/filters', $twig);
166
+ $twig = apply_filters('timber/twig/functions', $twig);
167
  $twig = apply_filters('timber/twig/escapers', $twig);
168
  $twig = apply_filters('timber/loader/twig', $twig);
169
  return $twig;
206
 
207
  public function clear_cache_twig() {
208
  $twig = $this->get_twig();
209
+ if ( method_exists($twig, 'clearCacheFiles') ) {
210
+ $twig->clearCacheFiles();
211
+ }
212
  $cache = $twig->getCache();
213
  if ( $cache ) {
214
  self::rrmdir($twig->getCache());
lib/MenuItem.php CHANGED
@@ -173,7 +173,7 @@ class MenuItem extends Core implements CoreInterface {
173
  }
174
  $this->classes = array_merge($this->classes, $data->classes);
175
  $this->classes = array_unique($this->classes);
176
- $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this);
177
  $this->class = trim(implode(' ', $this->classes));
178
  }
179
 
173
  }
174
  $this->classes = array_merge($this->classes, $data->classes);
175
  $this->classes = array_unique($this->classes);
176
+ $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this, array(), 0);
177
  $this->class = trim(implode(' ', $this->classes));
178
  }
179
 
lib/Post.php CHANGED
@@ -809,7 +809,7 @@ class Post extends Core implements CoreInterface {
809
  * @return array of TimberTerms
810
  */
811
  public function categories() {
812
- return $this->get_terms('category');
813
  }
814
 
815
  /**
@@ -830,7 +830,7 @@ class Post extends Core implements CoreInterface {
830
  * ```twig
831
  * {% if post.children %}
832
  * Here are the child pages:
833
- * {% for child in page.children %}
834
  * <a href="{{ child.link }}">{{ child.title }}</a>
835
  * {% endfor %}
836
  * {% endif %}
@@ -889,7 +889,7 @@ class Post extends Core implements CoreInterface {
889
  $commenter = wp_get_current_commenter();
890
  $comment_author_email = $commenter['comment_author_email'];
891
 
892
- $args = array('status' => $status, 'order' => $order);
893
  if ( $count > 0 ) {
894
  $args['number'] = $count;
895
  }
@@ -902,8 +902,10 @@ class Post extends Core implements CoreInterface {
902
  } elseif ( !empty($comment_author_email) ) {
903
  $args['include_unapproved'] = array($comment_author_email);
904
  }
905
-
906
- return new CommentThread($this->ID, $args);
 
 
907
  }
908
 
909
  /**
@@ -1323,7 +1325,7 @@ class Post extends Core implements CoreInterface {
1323
  * @return array of TimberTerms
1324
  */
1325
  public function get_categories() {
1326
- return $this->get_terms('category');
1327
  }
1328
 
1329
  /**
@@ -1364,7 +1366,7 @@ class Post extends Core implements CoreInterface {
1364
  * @return array
1365
  */
1366
  public function get_tags() {
1367
- return $this->get_terms('post_tag');
1368
  }
1369
 
1370
  /**
809
  * @return array of TimberTerms
810
  */
811
  public function categories() {
812
+ return $this->terms('category');
813
  }
814
 
815
  /**
830
  * ```twig
831
  * {% if post.children %}
832
  * Here are the child pages:
833
+ * {% for child in post.children %}
834
  * <a href="{{ child.link }}">{{ child.title }}</a>
835
  * {% endfor %}
836
  * {% endif %}
889
  $commenter = wp_get_current_commenter();
890
  $comment_author_email = $commenter['comment_author_email'];
891
 
892
+ $args = array('status' => $status, 'order' => $order, 'type' => $type);
893
  if ( $count > 0 ) {
894
  $args['number'] = $count;
895
  }
902
  } elseif ( !empty($comment_author_email) ) {
903
  $args['include_unapproved'] = array($comment_author_email);
904
  }
905
+ $ct = new CommentThread($this->ID, false);
906
+ $ct->CommentClass = $CommentClass;
907
+ $ct->init($args);
908
+ return $ct;
909
  }
910
 
911
  /**
1325
  * @return array of TimberTerms
1326
  */
1327
  public function get_categories() {
1328
+ return $this->terms('category');
1329
  }
1330
 
1331
  /**
1366
  * @return array
1367
  */
1368
  public function get_tags() {
1369
+ return $this->terms('post_tag');
1370
  }
1371
 
1372
  /**
lib/PostPreview.php CHANGED
@@ -16,6 +16,7 @@ class PostPreview {
16
  protected $char_length = false;
17
  protected $readmore = 'Read More';
18
  protected $strip = true;
 
19
 
20
  /**
21
  * @param Post $post
@@ -141,7 +142,9 @@ class PostPreview {
141
  $text = do_shortcode($text);
142
  }
143
  if ( !strlen($text) ) {
144
- $text = TextHelper::trim_words($this->post->content(), $len, false);
 
 
145
  if ( $chars !== false ) {
146
  $text = TextHelper::trim_characters($text, $chars, false);
147
  }
16
  protected $char_length = false;
17
  protected $readmore = 'Read More';
18
  protected $strip = true;
19
+ protected $destroy_tags = array('script', 'style');
20
 
21
  /**
22
  * @param Post $post
142
  $text = do_shortcode($text);
143
  }
144
  if ( !strlen($text) ) {
145
+ $text = $this->post->content();
146
+ $text = TextHelper::remove_tags($text, $this->destroy_tags);
147
+ $text = TextHelper::trim_words($text, $len, false);
148
  if ( $chars !== false ) {
149
  $text = TextHelper::trim_characters($text, $chars, false);
150
  }
lib/Site.php CHANGED
@@ -163,7 +163,7 @@ class Site extends Core implements CoreInterface {
163
  $this->title = $this->name;
164
  $this->description = get_bloginfo('description');
165
  $this->theme = new Theme();
166
- $this->language_attributes = Helper::function_wrapper('language_attributes');
167
  $this->multisite = false;
168
  }
169
 
@@ -180,7 +180,7 @@ class Site extends Core implements CoreInterface {
180
  $this->language = get_bloginfo('language');
181
  $this->charset = get_bloginfo('charset');
182
  $this->pingback = $this->pingback_url = get_bloginfo('pingback_url');
183
- $this->language_attributes = Helper::function_wrapper('language_attributes');
184
  }
185
 
186
  /**
163
  $this->title = $this->name;
164
  $this->description = get_bloginfo('description');
165
  $this->theme = new Theme();
166
+ $this->language_attributes = get_language_attributes();
167
  $this->multisite = false;
168
  }
169
 
180
  $this->language = get_bloginfo('language');
181
  $this->charset = get_bloginfo('charset');
182
  $this->pingback = $this->pingback_url = get_bloginfo('pingback_url');
183
+ $this->language_attributes = get_language_attributes();
184
  }
185
 
186
  /**
lib/Term.php CHANGED
@@ -10,7 +10,8 @@ use Timber\Helper;
10
  use Timber\URLHelper;
11
 
12
  /**
13
- * Terms: WordPress has got 'em, you want 'em. Categories. Tags. Custom Taxonomies. You don't care, you're a fiend. Well let's get this under control
 
14
  * @example
15
  * ```php
16
  * //Get a term by its ID
@@ -320,6 +321,7 @@ class Term extends Core implements CoreInterface {
320
  */
321
  public function update( $key, $value ) {
322
  $value = apply_filters('timber_term_set_meta', $value, $key, $this->ID, $this);
 
323
  $this->$key = $value;
324
  }
325
 
@@ -358,7 +360,13 @@ class Term extends Core implements CoreInterface {
358
 
359
 
360
  /**
 
 
361
  * @api
 
 
 
 
362
  * @return string
363
  */
364
  public function link() {
@@ -368,8 +376,20 @@ class Term extends Core implements CoreInterface {
368
  }
369
 
370
  /**
 
 
 
 
 
371
  * @api
372
  * @param string $field_name
 
 
 
 
 
 
 
373
  * @return string
374
  */
375
  public function meta( $field_name ) {
@@ -377,7 +397,13 @@ class Term extends Core implements CoreInterface {
377
  }
378
 
379
  /**
 
 
380
  * @api
 
 
 
 
381
  * @return string
382
  */
383
  public function path() {
@@ -394,7 +420,7 @@ class Term extends Core implements CoreInterface {
394
  * @param string $post_class
395
  * @example
396
  * ```twig
397
- * <h4>Recent posts in {{term.name}}</h4>
398
  * <ul>
399
  * {% for post in term.posts(3, 'post') %}
400
  * <li><a href="{{post.link}}">{{post.title}}</a></li>
10
  use Timber\URLHelper;
11
 
12
  /**
13
+ * Terms: WordPress has got 'em, you want 'em. Categories. Tags. Custom
14
+ * Taxonomies. You don't care, you're a fiend. Well let's get this under control:
15
  * @example
16
  * ```php
17
  * //Get a term by its ID
321
  */
322
  public function update( $key, $value ) {
323
  $value = apply_filters('timber_term_set_meta', $value, $key, $this->ID, $this);
324
+ $value = apply_filters('timber/term/meta/set', $value, $key, $this->ID, $this);
325
  $this->$key = $value;
326
  }
327
 
360
 
361
 
362
  /**
363
+ * Returns a full link to the term archive page like
364
+ * `http://example.com/category/news`
365
  * @api
366
+ * @example
367
+ * ```twig
368
+ * See all posts in: <a href="{{ term.link }}">{{ term.name }}</a>
369
+ * ```
370
  * @return string
371
  */
372
  public function link() {
376
  }
377
 
378
  /**
379
+ * Retrieves and outputs meta information stored with a term. This will use
380
+ * both data stored under (old) ACF hacks and new (WP 4.6+) where term meta
381
+ * has its own table. If retrieving a special ACF field (repeater, etc.) you
382
+ * can use the output immediately in Twig — no further processing is
383
+ * required.
384
  * @api
385
  * @param string $field_name
386
+ * @example
387
+ * ```twig
388
+ * <div class="location-info">
389
+ * <h2>{{ term.name }}</h2>
390
+ * <p>{{ term.meta('address') }}</p>
391
+ * </div>
392
+ * ```
393
  * @return string
394
  */
395
  public function meta( $field_name ) {
397
  }
398
 
399
  /**
400
+ * Returns a relative link (path) to the term archive page like
401
+ * `/category/news`
402
  * @api
403
+ * @example
404
+ * ```twig
405
+ * See all posts in: <a href="{{ term.path }}">{{ term.name }}</a>
406
+ * ```
407
  * @return string
408
  */
409
  public function path() {
420
  * @param string $post_class
421
  * @example
422
  * ```twig
423
+ * <h4>Recent posts in {{ term.name }}</h4>
424
  * <ul>
425
  * {% for post in term.posts(3, 'post') %}
426
  * <li><a href="{{post.link}}">{{post.title}}</a></li>
lib/TextHelper.php CHANGED
@@ -70,6 +70,22 @@ class TextHelper {
70
  return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  *
75
  *
70
  return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
71
  }
72
 
73
+ public static function remove_tags( $string, $tags = array() ) {
74
+ return preg_replace('#<(' . implode( '|', $tags) . ')(?:[^>]+)?>.*?</\1>#s', '', $string);
75
+ }
76
+
77
+ /**
78
+ * @param string $haystack
79
+ * @param string $needle
80
+ * @return boolean
81
+ */
82
+ public static function starts_with( $haystack, $needle ) {
83
+ if ( 0 === strpos($haystack, $needle) ) {
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+
89
  /**
90
  *
91
  *
lib/Theme.php CHANGED
@@ -63,7 +63,7 @@ class Theme extends Core {
63
  * <?php
64
  * $theme = new TimberTheme("my-theme");
65
  * $context['theme_stuff'] = $theme;
66
- * Timber::render('single.')
67
  * ?>
68
  * ```
69
  * ```twig
63
  * <?php
64
  * $theme = new TimberTheme("my-theme");
65
  * $context['theme_stuff'] = $theme;
66
+ * Timber::render('single.twig', $context);
67
  * ?>
68
  * ```
69
  * ```twig
lib/Timber.php CHANGED
@@ -72,7 +72,7 @@ class Timber {
72
  if ( version_compare(phpversion(), '5.3.0', '<') && !is_admin() ) {
73
  trigger_error('Timber requires PHP 5.3.0 or greater. You have '.phpversion(), E_USER_ERROR);
74
  }
75
- if ( !class_exists('Twig_Autoloader') ) {
76
  trigger_error('You have not run "composer install" to download required dependencies for Timber, you can read more on https://github.com/timber/timber#installation', E_USER_ERROR);
77
  }
78
  }
@@ -230,8 +230,6 @@ class Timber {
230
  if ( empty(self::$context_cache) ) {
231
  self::$context_cache['http_host'] = URLHelper::get_scheme().'://'.URLHelper::get_host();
232
  self::$context_cache['wp_title'] = Helper::get_wp_title();
233
- self::$context_cache['wp_head'] = Helper::function_wrapper('wp_head');
234
- self::$context_cache['wp_footer'] = Helper::function_wrapper('wp_footer');
235
  self::$context_cache['body_class'] = implode(' ', get_body_class());
236
 
237
  self::$context_cache['site'] = new Site();
@@ -240,10 +238,15 @@ class Timber {
240
  self::$context_cache['user'] = ($user->ID) ? $user : false;
241
  self::$context_cache['theme'] = self::$context_cache['site']->theme;
242
 
243
- /* @todo enable PostQuery in 1.3 */
244
- //self::$context_cache['posts'] = new PostQuery();
245
- self::$context_cache['posts'] = Timber::query_posts();
246
-
 
 
 
 
 
247
  self::$context_cache = apply_filters('timber_context', self::$context_cache);
248
  self::$context_cache = apply_filters('timber/context', self::$context_cache);
249
  }
@@ -321,7 +324,7 @@ class Timber {
321
  /**
322
  * Render function.
323
  * @api
324
- * @param array $filenames
325
  * @param array $data
326
  * @param boolean|integer $expires
327
  * @param string $cache_mode
@@ -396,12 +399,15 @@ class Timber {
396
 
397
  /**
398
  * Get widgets.
 
399
  * @api
400
- * @param int $widget_id
401
- * @return TimberFunctionWrapper
402
  */
403
  public static function get_widgets( $widget_id ) {
404
- return trim(Helper::function_wrapper('dynamic_sidebar', array($widget_id), true));
 
 
405
  }
406
 
407
  /* Pagination
72
  if ( version_compare(phpversion(), '5.3.0', '<') && !is_admin() ) {
73
  trigger_error('Timber requires PHP 5.3.0 or greater. You have '.phpversion(), E_USER_ERROR);
74
  }
75
+ if ( !class_exists('Twig_Token') ) {
76
  trigger_error('You have not run "composer install" to download required dependencies for Timber, you can read more on https://github.com/timber/timber#installation', E_USER_ERROR);
77
  }
78
  }
230
  if ( empty(self::$context_cache) ) {
231
  self::$context_cache['http_host'] = URLHelper::get_scheme().'://'.URLHelper::get_host();
232
  self::$context_cache['wp_title'] = Helper::get_wp_title();
 
 
233
  self::$context_cache['body_class'] = implode(' ', get_body_class());
234
 
235
  self::$context_cache['site'] = new Site();
238
  self::$context_cache['user'] = ($user->ID) ? $user : false;
239
  self::$context_cache['theme'] = self::$context_cache['site']->theme;
240
 
241
+ self::$context_cache['posts'] = new PostQuery();
242
+
243
+ /**
244
+ * @deprecated as of Timber 1.3.0
245
+ * @todo remove in Timber 1.4.*
246
+ */
247
+ self::$context_cache['wp_head'] = new FunctionWrapper( 'wp_head' );
248
+ self::$context_cache['wp_footer'] = new FunctionWrapper( 'wp_footer' );
249
+
250
  self::$context_cache = apply_filters('timber_context', self::$context_cache);
251
  self::$context_cache = apply_filters('timber/context', self::$context_cache);
252
  }
324
  /**
325
  * Render function.
326
  * @api
327
+ * @param array|string $filenames
328
  * @param array $data
329
  * @param boolean|integer $expires
330
  * @param string $cache_mode
399
 
400
  /**
401
  * Get widgets.
402
+ *
403
  * @api
404
+ * @param int|string $widget_id Optional. Index, name or ID of dynamic sidebar. Default 1.
405
+ * @return FunctionWrapper
406
  */
407
  public static function get_widgets( $widget_id ) {
408
+ $output = new FunctionWrapper( 'dynamic_sidebar', array( $widget_id ), true );
409
+
410
+ return trim( $output );
411
  }
412
 
413
  /* Pagination
lib/Twig.php CHANGED
@@ -26,54 +26,14 @@ class Twig {
26
  */
27
  public function __construct() {
28
  add_action('timber/twig/filters', array($this, 'add_timber_filters'));
 
29
  add_action('timber/twig/escapers', array($this, 'add_timber_escapers'));
30
  }
31
 
32
  /**
33
  *
34
- *
35
- * @param Twig_Environment $twig
36
- * @return Twig_Environment
37
  */
38
- public function add_timber_filters( $twig ) {
39
- /* image filters */
40
- $twig->addFilter(new \Twig_SimpleFilter('resize', array('Timber\ImageHelper', 'resize')));
41
- $twig->addFilter(new \Twig_SimpleFilter('retina', array('Timber\ImageHelper', 'retina_resize')));
42
- $twig->addFilter(new \Twig_SimpleFilter('letterbox', array('Timber\ImageHelper', 'letterbox')));
43
- $twig->addFilter(new \Twig_SimpleFilter('tojpg', array('Timber\ImageHelper', 'img_to_jpg')));
44
-
45
- /* debugging filters */
46
- $twig->addFilter(new \Twig_SimpleFilter('get_class', 'get_class'));
47
- $twig->addFilter(new \Twig_SimpleFilter('get_type', 'get_type'));
48
- $twig->addFilter(new \Twig_SimpleFilter('print_r', function( $arr ) {
49
- return print_r($arr, true);
50
- } ));
51
-
52
- /* other filters */
53
- $twig->addFilter(new \Twig_SimpleFilter('stripshortcodes', 'strip_shortcodes'));
54
- $twig->addFilter(new \Twig_SimpleFilter('array', array($this, 'to_array')));
55
- $twig->addFilter(new \Twig_SimpleFilter('excerpt', 'wp_trim_words'));
56
- $twig->addFilter(new \Twig_SimpleFilter('excerpt_chars', array('Timber\TextHelper','trim_characters')));
57
- $twig->addFilter(new \Twig_SimpleFilter('function', array($this, 'exec_function')));
58
- $twig->addFilter(new \Twig_SimpleFilter('pretags', array($this, 'twig_pretags')));
59
- $twig->addFilter(new \Twig_SimpleFilter('sanitize', 'sanitize_title'));
60
- $twig->addFilter(new \Twig_SimpleFilter('shortcodes', 'do_shortcode'));
61
- $twig->addFilter(new \Twig_SimpleFilter('time_ago', array($this, 'time_ago')));
62
- $twig->addFilter(new \Twig_SimpleFilter('wpautop', 'wpautop'));
63
- $twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
64
-
65
- $twig->addFilter(new \Twig_SimpleFilter('pluck', array('Timber\Helper', 'pluck')));
66
-
67
- $twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
68
- return URLHelper::get_rel_url($link, true);
69
- } ));
70
-
71
- $twig->addFilter(new \Twig_SimpleFilter('date', array($this, 'intl_date')));
72
-
73
- $twig->addFilter(new \Twig_SimpleFilter('truncate', function( $text, $len ) {
74
- return TextHelper::trim_words($text, $len);
75
- } ));
76
-
77
  /* actions and filters */
78
  $twig->addFunction(new \Twig_SimpleFunction('action', function( $context ) {
79
  $args = func_get_args();
@@ -82,12 +42,6 @@ class Twig {
82
  call_user_func_array('do_action', $args);
83
  }, array('needs_context' => true)));
84
 
85
- $twig->addFilter(new \Twig_SimpleFilter('apply_filters', function() {
86
- $args = func_get_args();
87
- $tag = current(array_splice($args, 1, 1));
88
-
89
- return apply_filters_ref_array($tag, $args);
90
- } ));
91
  $twig->addFunction(new \Twig_SimpleFunction('function', array(&$this, 'exec_function')));
92
  $twig->addFunction(new \Twig_SimpleFunction('fn', array(&$this, 'exec_function')));
93
 
@@ -204,6 +158,64 @@ class Twig {
204
  $twig->addFunction(new \Twig_SimpleFunction('translate_nooped_plural', function( $nooped_plural, $count, $domain = 'default' ) {
205
  return translate_nooped_plural($nooped_plural, $count, $domain);
206
  } ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  $twig = apply_filters('timber/twig', $twig);
208
  /**
209
  * get_twig is deprecated, use timber/twig
26
  */
27
  public function __construct() {
28
  add_action('timber/twig/filters', array($this, 'add_timber_filters'));
29
+ add_action('timber/twig/functions', array($this, 'add_timber_functions'));
30
  add_action('timber/twig/escapers', array($this, 'add_timber_escapers'));
31
  }
32
 
33
  /**
34
  *
 
 
 
35
  */
36
+ public function add_timber_functions( $twig ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /* actions and filters */
38
  $twig->addFunction(new \Twig_SimpleFunction('action', function( $context ) {
39
  $args = func_get_args();
42
  call_user_func_array('do_action', $args);
43
  }, array('needs_context' => true)));
44
 
 
 
 
 
 
 
45
  $twig->addFunction(new \Twig_SimpleFunction('function', array(&$this, 'exec_function')));
46
  $twig->addFunction(new \Twig_SimpleFunction('fn', array(&$this, 'exec_function')));
47
 
158
  $twig->addFunction(new \Twig_SimpleFunction('translate_nooped_plural', function( $nooped_plural, $count, $domain = 'default' ) {
159
  return translate_nooped_plural($nooped_plural, $count, $domain);
160
  } ));
161
+
162
+ return $twig;
163
+ }
164
+
165
+ /**
166
+ *
167
+ *
168
+ * @param Twig_Environment $twig
169
+ * @return Twig_Environment
170
+ */
171
+ public function add_timber_filters( $twig ) {
172
+ /* image filters */
173
+ $twig->addFilter(new \Twig_SimpleFilter('resize', array('Timber\ImageHelper', 'resize')));
174
+ $twig->addFilter(new \Twig_SimpleFilter('retina', array('Timber\ImageHelper', 'retina_resize')));
175
+ $twig->addFilter(new \Twig_SimpleFilter('letterbox', array('Timber\ImageHelper', 'letterbox')));
176
+ $twig->addFilter(new \Twig_SimpleFilter('tojpg', array('Timber\ImageHelper', 'img_to_jpg')));
177
+
178
+ /* debugging filters */
179
+ $twig->addFilter(new \Twig_SimpleFilter('get_class', 'get_class'));
180
+ $twig->addFilter(new \Twig_SimpleFilter('get_type', 'get_type'));
181
+ $twig->addFilter(new \Twig_SimpleFilter('print_r', function( $arr ) {
182
+ return print_r($arr, true);
183
+ } ));
184
+
185
+ /* other filters */
186
+ $twig->addFilter(new \Twig_SimpleFilter('stripshortcodes', 'strip_shortcodes'));
187
+ $twig->addFilter(new \Twig_SimpleFilter('array', array($this, 'to_array')));
188
+ $twig->addFilter(new \Twig_SimpleFilter('excerpt', 'wp_trim_words'));
189
+ $twig->addFilter(new \Twig_SimpleFilter('excerpt_chars', array('Timber\TextHelper','trim_characters')));
190
+ $twig->addFilter(new \Twig_SimpleFilter('function', array($this, 'exec_function')));
191
+ $twig->addFilter(new \Twig_SimpleFilter('pretags', array($this, 'twig_pretags')));
192
+ $twig->addFilter(new \Twig_SimpleFilter('sanitize', 'sanitize_title'));
193
+ $twig->addFilter(new \Twig_SimpleFilter('shortcodes', 'do_shortcode'));
194
+ $twig->addFilter(new \Twig_SimpleFilter('time_ago', array($this, 'time_ago')));
195
+ $twig->addFilter(new \Twig_SimpleFilter('wpautop', 'wpautop'));
196
+ $twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
197
+
198
+ $twig->addFilter(new \Twig_SimpleFilter('pluck', array('Timber\Helper', 'pluck')));
199
+
200
+ $twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
201
+ return URLHelper::get_rel_url($link, true);
202
+ } ));
203
+
204
+ $twig->addFilter(new \Twig_SimpleFilter('date', array($this, 'intl_date')));
205
+
206
+ $twig->addFilter(new \Twig_SimpleFilter('truncate', function( $text, $len ) {
207
+ return TextHelper::trim_words($text, $len);
208
+ } ));
209
+
210
+ /* actions and filters */
211
+ $twig->addFilter(new \Twig_SimpleFilter('apply_filters', function() {
212
+ $args = func_get_args();
213
+ $tag = current(array_splice($args, 1, 1));
214
+
215
+ return apply_filters_ref_array($tag, $args);
216
+ } ));
217
+
218
+
219
  $twig = apply_filters('timber/twig', $twig);
220
  /**
221
  * get_twig is deprecated, use timber/twig
lib/URLHelper.php CHANGED
@@ -193,12 +193,15 @@ class URLHelper {
193
  public static function prepend_to_url( $url, $path ) {
194
  if ( strstr(strtolower($url), 'http') ) {
195
  $url_parts = parse_url($url);
196
- $url = $url_parts['scheme'].'://'.$url_parts['host'].$path.$url_parts['path'];
 
 
 
197
  if ( isset($url_parts['query']) ) {
198
- $url .= $url_parts['query'];
199
  }
200
  if ( isset($url_parts['fragment']) ) {
201
- $url .= $url_parts['fragment'];
202
  }
203
  } else {
204
  $url = $url.$path;
193
  public static function prepend_to_url( $url, $path ) {
194
  if ( strstr(strtolower($url), 'http') ) {
195
  $url_parts = parse_url($url);
196
+ $url = $url_parts['scheme'].'://'.$url_parts['host'].$path;
197
+ if ( isset($url_parts['path']) ) {
198
+ $url .= $url_parts['path'];
199
+ }
200
  if ( isset($url_parts['query']) ) {
201
+ $url .= '?'.$url_parts['query'];
202
  }
203
  if ( isset($url_parts['fragment']) ) {
204
+ $url .= '#'.$url_parts['fragment'];
205
  }
206
  } else {
207
  $url = $url.$path;
readme.txt CHANGED
@@ -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.2.4
6
- Tested up to: 4.7.2
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
@@ -41,6 +41,20 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  = 1.2.4 =
45
  * Fixed regression from S3 handling #1330 (@gchtr)
46
 
2
  Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
+ Stable tag: 1.3.0
6
+ Tested up to: 4.7.3
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
41
 
42
  == Changelog ==
43
 
44
+ = 1.3.0 =
45
+ * Default $context object now returns a PostQuery for $context['posts'] this is cool because you can use `{{ posts.pagination }}` in your Twig templates without any further PHP work (thanks @lggorman)
46
+ * Timber\Images with PDFs and other content types now return the file instead of null # (thanks @hoandang)
47
+ * Timber\Comments now support different comment types #1364 (thanks @yantei)
48
+ * Timber\Comments {{ comment.content }} now returns processed comment with `<p>` tags
49
+ * Fix for HTTP error when uploading media files in Windows #1346 (thanks Matias Griese)
50
+ * Fix for image resizing on alternative WP setups (thanks @gillesgoetsch)
51
+ * Exposing a function to global Twig scope through Timber\FunctionWrapper is deprecated, the prefered method to do this is through a Twig template like `{{ function('my_cool_function', 'my_argument') }}` (thanks @gchtr)
52
+ * Fixed issues with use of Twig 2.0 (#1370)
53
+ * Fixed up some things with Timber/Archives and getting post_count #1376
54
+ * Don't let Timber fail when converting TIFFs or other weird file types, instead return the passed value w/o modifying #1383
55
+ * Updated `FunctionWrapper` with appropriate warnings and Twig 2.0 compat (thank you thank you @gchtr)
56
+ * Misc fixes to documentation
57
+
58
  = 1.2.4 =
59
  * Fixed regression from S3 handling #1330 (@gchtr)
60
 
timber-starter-theme/functions.php CHANGED
@@ -20,6 +20,7 @@ class StarterSite extends TimberSite {
20
  add_theme_support( 'post-formats' );
21
  add_theme_support( 'post-thumbnails' );
22
  add_theme_support( 'menus' );
 
23
  add_filter( 'timber_context', array( $this, 'add_to_context' ) );
24
  add_filter( 'get_twig', array( $this, 'add_to_twig' ) );
25
  add_action( 'init', array( $this, 'register_post_types' ) );
20
  add_theme_support( 'post-formats' );
21
  add_theme_support( 'post-thumbnails' );
22
  add_theme_support( 'menus' );
23
+ add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
24
  add_filter( 'timber_context', array( $this, 'add_to_context' ) );
25
  add_filter( 'get_twig', array( $this, 'add_to_twig' ) );
26
  add_action( 'init', array( $this, 'register_post_types' ) );
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
- Version: 1.2.4
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 Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
+ Version: 1.3.0
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitf666168e7a491cc40ebebd55a28299b2::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8b5bad47eaad3b412325467b36c7faaa::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf666168e7a491cc40ebebd55a28299b2
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitf666168e7a491cc40ebebd55a28299b2
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitf666168e7a491cc40ebebd55a28299b2', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitf666168e7a491cc40ebebd55a28299b2', 'loadClassLoader'));
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 ComposerAutoloaderInit8b5bad47eaad3b412325467b36c7faaa
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit8b5bad47eaad3b412325467b36c7faaa', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit8b5bad47eaad3b412325467b36c7faaa', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "composer/installers",
4
- "version": "v1.2.0",
5
- "version_normalized": "1.2.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
- "reference": "d78064c68299743e0161004f2de3a0204e33b804"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804",
14
- "reference": "d78064c68299743e0161004f2de3a0204e33b804",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -25,7 +25,7 @@
25
  "composer/composer": "1.0.*@dev",
26
  "phpunit/phpunit": "4.1.*"
27
  },
28
- "time": "2016-08-13 20:53:52",
29
  "type": "composer-plugin",
30
  "extra": {
31
  "class": "Composer\\Installers\\Plugin",
@@ -55,12 +55,16 @@
55
  "keywords": [
56
  "Craft",
57
  "Dolibarr",
 
58
  "Hurad",
59
  "ImageCMS",
 
60
  "MODX Evo",
61
  "Mautic",
 
62
  "OXID",
63
  "Plentymarkets",
 
64
  "RadPHP",
65
  "SMF",
66
  "Thelia",
@@ -83,9 +87,11 @@
83
  "fuelphp",
84
  "grav",
85
  "installer",
 
86
  "joomla",
87
  "kohana",
88
  "laravel",
 
89
  "lithium",
90
  "magento",
91
  "mako",
@@ -100,6 +106,7 @@
100
  "roundcube",
101
  "shopware",
102
  "silverstripe",
 
103
  "symfony",
104
  "typo3",
105
  "wordpress",
@@ -109,104 +116,89 @@
109
  ]
110
  },
111
  {
112
- "name": "twig/twig",
113
- "version": "v1.31.0",
114
- "version_normalized": "1.31.0.0",
115
  "source": {
116
  "type": "git",
117
- "url": "https://github.com/twigphp/Twig.git",
118
- "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7"
119
  },
120
  "dist": {
121
  "type": "zip",
122
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/ddc9e3e20ee9c0b6908f401ac8353635b750eca7",
123
- "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7",
124
  "shasum": ""
125
  },
126
  "require": {
127
- "php": ">=5.2.7"
128
- },
129
- "require-dev": {
130
- "symfony/debug": "~2.7",
131
- "symfony/phpunit-bridge": "~3.2"
132
  },
133
- "time": "2017-01-11 19:36:15",
134
  "type": "library",
135
- "extra": {
136
- "branch-alias": {
137
- "dev-master": "1.31-dev"
138
- }
139
- },
140
  "installation-source": "dist",
141
  "autoload": {
142
- "psr-0": {
143
- "Twig_": "lib/"
144
- }
145
  },
146
  "notification-url": "https://packagist.org/downloads/",
147
  "license": [
148
- "BSD-3-Clause"
149
  ],
150
  "authors": [
151
  {
152
- "name": "Fabien Potencier",
153
- "email": "fabien@symfony.com",
154
- "homepage": "http://fabien.potencier.org",
155
- "role": "Lead Developer"
156
  },
157
  {
158
- "name": "Armin Ronacher",
159
- "email": "armin.ronacher@active-4.com",
160
- "role": "Project Founder"
161
  },
162
  {
163
- "name": "Twig Team",
164
- "homepage": "http://twig.sensiolabs.org/contributors",
165
- "role": "Contributors"
166
  }
167
  ],
168
- "description": "Twig, the flexible, fast, and secure template language for PHP",
169
- "homepage": "http://twig.sensiolabs.org",
170
  "keywords": [
171
- "templating"
 
 
172
  ]
173
  },
174
  {
175
- "name": "asm89/twig-cache-extension",
176
- "version": "1.3.2",
177
- "version_normalized": "1.3.2.0",
178
  "source": {
179
  "type": "git",
180
- "url": "https://github.com/asm89/twig-cache-extension.git",
181
- "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
182
  },
183
  "dist": {
184
  "type": "zip",
185
- "url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
186
- "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
187
  "shasum": ""
188
  },
189
  "require": {
190
- "php": ">=5.3.2",
191
- "twig/twig": "^1.0|^2.0"
 
192
  },
193
  "require-dev": {
194
- "doctrine/cache": "~1.0"
195
- },
196
- "suggest": {
197
- "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
198
  },
199
- "time": "2017-01-10 22:04:15",
200
  "type": "library",
201
- "extra": {
202
- "branch-alias": {
203
- "dev-master": "1.3-dev"
204
- }
205
- },
206
  "installation-source": "dist",
207
  "autoload": {
208
- "psr-4": {
209
- "": "lib/"
210
  }
211
  },
212
  "notification-url": "https://packagist.org/downloads/",
@@ -215,102 +207,120 @@
215
  ],
216
  "authors": [
217
  {
218
- "name": "Alexander",
219
- "email": "iam.asm89@gmail.com"
 
220
  }
221
  ],
222
- "description": "Cache fragments of templates directly within Twig.",
223
- "homepage": "https://github.com/asm89/twig-cache-extension",
224
  "keywords": [
225
- "cache",
226
- "extension",
227
- "twig"
 
228
  ]
229
  },
230
  {
231
- "name": "altorouter/altorouter",
232
- "version": "v1.1.0",
233
- "version_normalized": "1.1.0.0",
234
  "source": {
235
  "type": "git",
236
- "url": "https://github.com/dannyvankooten/AltoRouter.git",
237
- "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4"
238
  },
239
  "dist": {
240
  "type": "zip",
241
- "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/09d9d946c546bae6d22a7654cdb3b825ffda54b4",
242
- "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4",
243
  "shasum": ""
244
  },
245
  "require": {
246
- "php": ">=5.3.0"
247
  },
248
- "time": "2014-04-16 09:44:40",
 
 
 
 
 
249
  "type": "library",
 
 
 
 
 
250
  "installation-source": "dist",
251
  "autoload": {
252
- "classmap": [
253
- "AltoRouter.php"
254
- ]
255
  },
256
  "notification-url": "https://packagist.org/downloads/",
257
  "license": [
258
- "MIT"
259
  ],
260
  "authors": [
261
  {
262
- "name": "Danny van Kooten",
263
- "email": "dannyvankooten@gmail.com",
264
- "homepage": "http://dannyvankooten.com/"
 
265
  },
266
  {
267
- "name": "Koen Punt",
268
- "homepage": "https://github.com/koenpunt"
 
269
  },
270
  {
271
- "name": "niahoo",
272
- "homepage": "https://github.com/niahoo"
 
273
  }
274
  ],
275
- "description": "A lightning fast router for PHP",
276
- "homepage": "https://github.com/dannyvankooten/AltoRouter",
277
  "keywords": [
278
- "lightweight",
279
- "router",
280
- "routing"
281
  ]
282
  },
283
  {
284
- "name": "upstatement/routes",
285
- "version": "0.4",
286
- "version_normalized": "0.4.0.0",
287
  "source": {
288
  "type": "git",
289
- "url": "https://github.com/Upstatement/routes.git",
290
- "reference": "fae7d46f56e8b5775f072774941a5f0a25cb86f3"
291
  },
292
  "dist": {
293
  "type": "zip",
294
- "url": "https://api.github.com/repos/Upstatement/routes/zipball/fae7d46f56e8b5775f072774941a5f0a25cb86f3",
295
- "reference": "fae7d46f56e8b5775f072774941a5f0a25cb86f3",
296
  "shasum": ""
297
  },
298
  "require": {
299
- "altorouter/altorouter": "1.1.0",
300
- "composer/installers": "~1.0",
301
- "php": ">=5.3.0"
302
  },
303
  "require-dev": {
304
- "phpunit/phpunit": "3.7.*",
305
- "satooshi/php-coveralls": "dev-master",
306
- "wp-cli/wp-cli": "*"
307
  },
308
- "time": "2016-07-06 12:53:24",
 
 
 
309
  "type": "library",
 
 
 
 
 
310
  "installation-source": "dist",
311
  "autoload": {
312
- "psr-0": {
313
- "Routes": ""
314
  }
315
  },
316
  "notification-url": "https://packagist.org/downloads/",
@@ -319,18 +329,16 @@
319
  ],
320
  "authors": [
321
  {
322
- "name": "Jared Novack",
323
- "email": "jared@upstatement.com",
324
- "homepage": "http://upstatement.com"
325
  }
326
  ],
327
- "description": "Manage rewrites and routes in WordPress with this dead-simple plugin",
328
- "homepage": "http://routes.upstatement.com",
329
  "keywords": [
330
- "redirects",
331
- "rewrite",
332
- "routes",
333
- "routing"
334
  ]
335
  }
336
  ]
1
  [
2
  {
3
  "name": "composer/installers",
4
+ "version": "v1.3.0",
5
+ "version_normalized": "1.3.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/installers.git",
9
+ "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/79ad876c7498c0bbfe7eed065b8651c93bfd6045",
14
+ "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045",
15
  "shasum": ""
16
  },
17
  "require": {
25
  "composer/composer": "1.0.*@dev",
26
  "phpunit/phpunit": "4.1.*"
27
  },
28
+ "time": "2017-04-24 06:37:16",
29
  "type": "composer-plugin",
30
  "extra": {
31
  "class": "Composer\\Installers\\Plugin",
55
  "keywords": [
56
  "Craft",
57
  "Dolibarr",
58
+ "Eliasis",
59
  "Hurad",
60
  "ImageCMS",
61
+ "Kanboard",
62
  "MODX Evo",
63
  "Mautic",
64
+ "Maya",
65
  "OXID",
66
  "Plentymarkets",
67
+ "Porto",
68
  "RadPHP",
69
  "SMF",
70
  "Thelia",
87
  "fuelphp",
88
  "grav",
89
  "installer",
90
+ "itop",
91
  "joomla",
92
  "kohana",
93
  "laravel",
94
+ "lavalite",
95
  "lithium",
96
  "magento",
97
  "mako",
106
  "roundcube",
107
  "shopware",
108
  "silverstripe",
109
+ "sydes",
110
  "symfony",
111
  "typo3",
112
  "wordpress",
116
  ]
117
  },
118
  {
119
+ "name": "altorouter/altorouter",
120
+ "version": "v1.1.0",
121
+ "version_normalized": "1.1.0.0",
122
  "source": {
123
  "type": "git",
124
+ "url": "https://github.com/dannyvankooten/AltoRouter.git",
125
+ "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4"
126
  },
127
  "dist": {
128
  "type": "zip",
129
+ "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/09d9d946c546bae6d22a7654cdb3b825ffda54b4",
130
+ "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4",
131
  "shasum": ""
132
  },
133
  "require": {
134
+ "php": ">=5.3.0"
 
 
 
 
135
  },
136
+ "time": "2014-04-16 09:44:40",
137
  "type": "library",
 
 
 
 
 
138
  "installation-source": "dist",
139
  "autoload": {
140
+ "classmap": [
141
+ "AltoRouter.php"
142
+ ]
143
  },
144
  "notification-url": "https://packagist.org/downloads/",
145
  "license": [
146
+ "MIT"
147
  ],
148
  "authors": [
149
  {
150
+ "name": "Danny van Kooten",
151
+ "email": "dannyvankooten@gmail.com",
152
+ "homepage": "http://dannyvankooten.com/"
 
153
  },
154
  {
155
+ "name": "Koen Punt",
156
+ "homepage": "https://github.com/koenpunt"
 
157
  },
158
  {
159
+ "name": "niahoo",
160
+ "homepage": "https://github.com/niahoo"
 
161
  }
162
  ],
163
+ "description": "A lightning fast router for PHP",
164
+ "homepage": "https://github.com/dannyvankooten/AltoRouter",
165
  "keywords": [
166
+ "lightweight",
167
+ "router",
168
+ "routing"
169
  ]
170
  },
171
  {
172
+ "name": "upstatement/routes",
173
+ "version": "0.4",
174
+ "version_normalized": "0.4.0.0",
175
  "source": {
176
  "type": "git",
177
+ "url": "https://github.com/Upstatement/routes.git",
178
+ "reference": "fae7d46f56e8b5775f072774941a5f0a25cb86f3"
179
  },
180
  "dist": {
181
  "type": "zip",
182
+ "url": "https://api.github.com/repos/Upstatement/routes/zipball/fae7d46f56e8b5775f072774941a5f0a25cb86f3",
183
+ "reference": "fae7d46f56e8b5775f072774941a5f0a25cb86f3",
184
  "shasum": ""
185
  },
186
  "require": {
187
+ "altorouter/altorouter": "1.1.0",
188
+ "composer/installers": "~1.0",
189
+ "php": ">=5.3.0"
190
  },
191
  "require-dev": {
192
+ "phpunit/phpunit": "3.7.*",
193
+ "satooshi/php-coveralls": "dev-master",
194
+ "wp-cli/wp-cli": "*"
 
195
  },
196
+ "time": "2016-07-06 12:53:24",
197
  "type": "library",
 
 
 
 
 
198
  "installation-source": "dist",
199
  "autoload": {
200
+ "psr-0": {
201
+ "Routes": ""
202
  }
203
  },
204
  "notification-url": "https://packagist.org/downloads/",
207
  ],
208
  "authors": [
209
  {
210
+ "name": "Jared Novack",
211
+ "email": "jared@upstatement.com",
212
+ "homepage": "http://upstatement.com"
213
  }
214
  ],
215
+ "description": "Manage rewrites and routes in WordPress with this dead-simple plugin",
216
+ "homepage": "http://routes.upstatement.com",
217
  "keywords": [
218
+ "redirects",
219
+ "rewrite",
220
+ "routes",
221
+ "routing"
222
  ]
223
  },
224
  {
225
+ "name": "twig/twig",
226
+ "version": "v1.33.2",
227
+ "version_normalized": "1.33.2.0",
228
  "source": {
229
  "type": "git",
230
+ "url": "https://github.com/twigphp/Twig.git",
231
+ "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927"
232
  },
233
  "dist": {
234
  "type": "zip",
235
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/dd6ca96227917e1e85b41c7c3cc6507b411e0927",
236
+ "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927",
237
  "shasum": ""
238
  },
239
  "require": {
240
+ "php": ">=5.2.7"
241
  },
242
+ "require-dev": {
243
+ "psr/container": "^1.0",
244
+ "symfony/debug": "~2.7",
245
+ "symfony/phpunit-bridge": "~3.3@dev"
246
+ },
247
+ "time": "2017-04-20 17:39:48",
248
  "type": "library",
249
+ "extra": {
250
+ "branch-alias": {
251
+ "dev-master": "1.33-dev"
252
+ }
253
+ },
254
  "installation-source": "dist",
255
  "autoload": {
256
+ "psr-0": {
257
+ "Twig_": "lib/"
258
+ }
259
  },
260
  "notification-url": "https://packagist.org/downloads/",
261
  "license": [
262
+ "BSD-3-Clause"
263
  ],
264
  "authors": [
265
  {
266
+ "name": "Fabien Potencier",
267
+ "email": "fabien@symfony.com",
268
+ "homepage": "http://fabien.potencier.org",
269
+ "role": "Lead Developer"
270
  },
271
  {
272
+ "name": "Armin Ronacher",
273
+ "email": "armin.ronacher@active-4.com",
274
+ "role": "Project Founder"
275
  },
276
  {
277
+ "name": "Twig Team",
278
+ "homepage": "http://twig.sensiolabs.org/contributors",
279
+ "role": "Contributors"
280
  }
281
  ],
282
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
283
+ "homepage": "http://twig.sensiolabs.org",
284
  "keywords": [
285
+ "templating"
 
 
286
  ]
287
  },
288
  {
289
+ "name": "asm89/twig-cache-extension",
290
+ "version": "1.3.2",
291
+ "version_normalized": "1.3.2.0",
292
  "source": {
293
  "type": "git",
294
+ "url": "https://github.com/asm89/twig-cache-extension.git",
295
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
296
  },
297
  "dist": {
298
  "type": "zip",
299
+ "url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
300
+ "reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
301
  "shasum": ""
302
  },
303
  "require": {
304
+ "php": ">=5.3.2",
305
+ "twig/twig": "^1.0|^2.0"
 
306
  },
307
  "require-dev": {
308
+ "doctrine/cache": "~1.0"
 
 
309
  },
310
+ "suggest": {
311
+ "psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
312
+ },
313
+ "time": "2017-01-10 22:04:15",
314
  "type": "library",
315
+ "extra": {
316
+ "branch-alias": {
317
+ "dev-master": "1.3-dev"
318
+ }
319
+ },
320
  "installation-source": "dist",
321
  "autoload": {
322
+ "psr-4": {
323
+ "": "lib/"
324
  }
325
  },
326
  "notification-url": "https://packagist.org/downloads/",
329
  ],
330
  "authors": [
331
  {
332
+ "name": "Alexander",
333
+ "email": "iam.asm89@gmail.com"
 
334
  }
335
  ],
336
+ "description": "Cache fragments of templates directly within Twig.",
337
+ "homepage": "https://github.com/asm89/twig-cache-extension",
338
  "keywords": [
339
+ "cache",
340
+ "extension",
341
+ "twig"
 
342
  ]
343
  }
344
  ]
vendor/composer/installers/.travis.yml CHANGED
@@ -6,12 +6,14 @@ php:
6
  - 5.5
7
  - 5.6
8
  - 7.0
 
9
  - hhvm
10
 
11
  matrix:
12
  fast_finish: true
13
  allow_failures:
14
  - php: 7.0
 
15
 
16
  before_script:
17
  - composer self-update
6
  - 5.5
7
  - 5.6
8
  - 7.0
9
+ - 7.1
10
  - hhvm
11
 
12
  matrix:
13
  fast_finish: true
14
  allow_failures:
15
  - php: 7.0
16
+ - php: 7.1
17
 
18
  before_script:
19
  - composer self-update
vendor/composer/installers/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## v1.3.0 - 2017-04-24
4
+ ### Added
5
+ * Kanboard plugins installer.
6
+ * Porto-SAP installer.
7
+ * Add `core` to concrete5 installer.
8
+ * Support Moodle "search" plugin type.
9
+ * SyDES installer.
10
+ * iTop installer.
11
+ * Lavalite installer.
12
+ * Module type for Eliasis.
13
+ * Vgmcp installer.
14
+ * OntoWiki installer.
15
+ * The requirements for contributing (CONTRIBUTING.md).
16
+
17
+ ### Changed
18
+ * Concrete5: block & theme install location updates.
19
+
20
+ ## v1.2.0 - 2016-08-13
21
+ ### Added
22
+ * Installer for Attogram.
23
+ * Installer for Cockpit.
24
+ * Installer for Plentymarkets.
25
+ * Installer for ReIndex.
26
+ * Installer for Vanilla.
27
+ * Installer for YAWIK.
28
+ * Added missing environments for new Shopware (5.2) Plugin System.
29
+
30
+ ## v1.1.0 - 2016-07-05
31
+ ### Added
32
+ * Installer for ReIndex.
33
+ * Installer for RadPHP.
34
+ * Installer for Decibel.
35
+ * Installer for Phifty.
36
+ * Installer for ExpressionEngine.
37
+
38
+ ### Changed
39
+ * New paths for new Bitrix CMS. Old paths is deprecated.
40
+
41
+ ### Deprecated
42
+ * Old paths in Bitrix CMS Installer is deprecated.
43
+
44
+ ## v1.0.25 - 2016-04-13
45
+ ### Removed
46
+ * Revert TYPO3 installer deletion.
47
+
48
+ ## v1.0.24 - 2016-04-05
49
+ ### Added
50
+ * Installer for ImageCMS.
51
+ * Installer for Mautic.
52
+ * New types in the Kirby installer: `kirby-plugin` and `kirby-field`.
53
+ * New types in the Drupal installer: `custom-theme` and `custom-module`.
54
+
55
+ ### Changed
56
+ * Switch to PSR-4.
57
+ * Update Bitrix Installer: configuration for setting custom path to directory with kernel.
58
+
59
+ ### Removed
60
+ * Remove TYPO3 Extension installers.
vendor/composer/installers/CONTRIBUTING.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing
2
+
3
+ If you would like to help, please take a look at the list of
4
+ [issues](https://github.com/composer/installers/issues).
5
+
6
+ ## Pull requests
7
+
8
+ * [Fork and clone](https://help.github.com/articles/fork-a-repo).
9
+ * Run the command `php composer.phar install` to install the dependencies.
10
+ This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install).
11
+ * Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
12
+ * Create a branch, commit, push and send us a
13
+ [pull request](https://help.github.com/articles/using-pull-requests).
14
+
15
+ To ensure a consistent code base, you should make sure the code follows the
16
+ coding standards [PSR-1](http://www.php-fig.org/psr/psr-1/) and
17
+ [PSR-2](http://www.php-fig.org/psr/psr-2/).
18
+
19
+ ### Create a new Installer
20
+
21
+ * Create class extends `Composer\Installers\BaseInstaller` with your Installer.
22
+ * Create unit tests as a separate class or as part of a `Composer\Installers\Test\InstallerTest`.
23
+ * Add information about your Installer in `README.md` in section "Current Supported Package Types".
24
+ * Run the tests.
vendor/composer/installers/README.md CHANGED
@@ -6,11 +6,11 @@ This is for PHP package authors to require in their `composer.json`. It will
6
  install their package to the correct location based on the specified package
7
  type.
8
 
9
- The goal of `installers` is to be a simple package type to install path map.
10
  Users can also customize the install path per package and package authors can
11
  modify the package name upon installing.
12
 
13
- `installers` isn't intended on replacing all custom installers. If your
14
  package requires special installation handling then by all means, create a
15
  custom installer to handle it.
16
 
@@ -25,7 +25,7 @@ is not needed to install packages with these frameworks:
25
  * Yii
26
  * Yii2
27
 
28
- **Current Supported Package Types**:
29
 
30
  > Stable types are marked as **bold**, this means that installation paths
31
  > for those type will not be changed. Any adjustment for those types would
@@ -45,7 +45,7 @@ is not needed to install packages with these frameworks:
45
  | CCFramework | `ccframework-ship`<br>`ccframework-theme`
46
  | Cockpit | `cockpit-module`
47
  | CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
48
- | concrete5 | `concrete5-block`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-update`
49
  | Craft | `craft-plugin`
50
  | Croogo | `croogo-plugin`<br>`croogo-theme`
51
  | Decibel | `decibel-app`
@@ -53,24 +53,30 @@ 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
  | ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
57
  | FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
58
  | FuelPHP v2.x | `fuelphp-component`
59
  | Grav | `grav-plugin`<br>`grav-theme`
60
  | Hurad | `hurad-plugin`<br>`hurad-theme`
61
  | ImageCMS | `imagecms-template`<br>`imagecms-module`<br>`imagecms-library`
 
62
  | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
 
63
  | Kirby | **`kirby-plugin`**<br>`kirby-field`<br>`kirby-tag`
64
  | KodiCMS | `kodicms-plugin`<br>`kodicms-media`
65
  | Kohana | **`kohana-module`**
66
  | Laravel | `laravel-library`
 
67
  | Lithium | **`lithium-library`<br>`lithium-source`**
68
  | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
69
  | Mako | `mako-package`
70
  | Mautic | `mautic-plugin`<br>`mautic-theme`
 
71
  | MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
72
  | MediaWiki | `mediawiki-extension`
73
  | October | **`october-module`<br>`october-plugin`<br>`october-theme`**
 
74
  | OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
75
  | MODULEWork | `modulework-module`
76
  | Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
@@ -80,6 +86,7 @@ is not needed to install packages with these frameworks:
80
  | Plentymarkets | `plentymarkets-plugin`
81
  | PPI | **`ppi-module`**
82
  | Puppet | `puppet-module`
 
83
  | RadPHP | `radphp-bundle`
84
  | REDAXO | `redaxo-addon`
85
  | ReIndex | **`reindex-plugin`** <br> **`reindex-theme`**
@@ -87,11 +94,13 @@ is not needed to install packages with these frameworks:
87
  | shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
88
  | SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
89
  | SMF | `smf-module`<br>`smf-theme`
 
90
  | symfony1 | **`symfony1-plugin`**
91
  | Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
92
  | TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
93
  | TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead)
94
  | Vanilla | `vanilla-plugin`<br>`vanilla-theme`
 
95
  | Wolf CMS | `wolfcms-plugin`
96
  | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
97
  | YAWIK | `yawik-module`
@@ -190,30 +199,15 @@ will allow this:
190
  Please note the name entered into `installer-name` will be the final and will
191
  not be inflected.
192
 
193
- ## Contribute!
194
 
195
- * [Fork and clone](https://help.github.com/articles/fork-a-repo).
196
- * Run the command `php composer.phar install` to install the dependencies.
197
- This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install).
198
- * Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
199
- * Create a branch, commit, push and send us a
200
- [pull request](https://help.github.com/articles/using-pull-requests).
201
-
202
- To ensure a consistent code base, you should make sure the code follows the
203
- [Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html)
204
- which we borrowed from Symfony.
205
-
206
- If you would like to help, please take a look at the list of
207
- [issues](https://github.com/composer/installers/issues).
208
-
209
- ### Should we allow dynamic package types or paths? No.
210
  What are they? The ability for a package author to determine where a package
211
  will be installed either through setting the path directly in their
212
  `composer.json` or through a dynamic package type: `"type":
213
  "framework-install-here"`.
214
 
215
  It has been proposed many times. Even implemented once early on and then
216
- removed. `installers` won't do this because it would allow a single package
217
  author to wipe out entire folders without the user's consent. That user would
218
  then come here to yell at us.
219
 
6
  install their package to the correct location based on the specified package
7
  type.
8
 
9
+ The goal of Installers is to be a simple package type to install path map.
10
  Users can also customize the install path per package and package authors can
11
  modify the package name upon installing.
12
 
13
+ Installers isn't intended on replacing all custom installers. If your
14
  package requires special installation handling then by all means, create a
15
  custom installer to handle it.
16
 
25
  * Yii
26
  * Yii2
27
 
28
+ ## Current Supported Package Types
29
 
30
  > Stable types are marked as **bold**, this means that installation paths
31
  > for those type will not be changed. Any adjustment for those types would
45
  | CCFramework | `ccframework-ship`<br>`ccframework-theme`
46
  | Cockpit | `cockpit-module`
47
  | CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
48
+ | concrete5 | `concrete5-core`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-block`<br>`concrete5-update`
49
  | Craft | `craft-plugin`
50
  | Croogo | `croogo-plugin`<br>`croogo-theme`
51
  | Decibel | `decibel-app`
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
  | FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
59
  | FuelPHP v2.x | `fuelphp-component`
60
  | Grav | `grav-plugin`<br>`grav-theme`
61
  | Hurad | `hurad-plugin`<br>`hurad-theme`
62
  | ImageCMS | `imagecms-template`<br>`imagecms-module`<br>`imagecms-library`
63
+ | iTop | `itop-extension`
64
  | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
65
+ | Kanboard | `kanboard-plugin`
66
  | Kirby | **`kirby-plugin`**<br>`kirby-field`<br>`kirby-tag`
67
  | KodiCMS | `kodicms-plugin`<br>`kodicms-media`
68
  | Kohana | **`kohana-module`**
69
  | Laravel | `laravel-library`
70
+ | Lavalite | `lavalite-theme`<br>`lavalite-package`
71
  | Lithium | **`lithium-library`<br>`lithium-source`**
72
  | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
73
  | Mako | `mako-package`
74
  | Mautic | `mautic-plugin`<br>`mautic-theme`
75
+ | Maya | `maya-module`
76
  | MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
77
  | MediaWiki | `mediawiki-extension`
78
  | October | **`october-module`<br>`october-plugin`<br>`october-theme`**
79
+ | OntoWiki | `ontowiki-extension`<br>`ontowiki-theme`<br>`ontowiki-translation`
80
  | OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
81
  | MODULEWork | `modulework-module`
82
  | Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
86
  | Plentymarkets | `plentymarkets-plugin`
87
  | PPI | **`ppi-module`**
88
  | Puppet | `puppet-module`
89
+ | Porto | `porto-container`
90
  | RadPHP | `radphp-bundle`
91
  | REDAXO | `redaxo-addon`
92
  | ReIndex | **`reindex-plugin`** <br> **`reindex-theme`**
94
  | shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
95
  | SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
96
  | SMF | `smf-module`<br>`smf-theme`
97
+ | SyDES | `sydes-module`<br>`sydes-theme`
98
  | symfony1 | **`symfony1-plugin`**
99
  | Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
100
  | TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
101
  | TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead)
102
  | Vanilla | `vanilla-plugin`<br>`vanilla-theme`
103
+ | Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
104
  | Wolf CMS | `wolfcms-plugin`
105
  | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
106
  | YAWIK | `yawik-module`
199
  Please note the name entered into `installer-name` will be the final and will
200
  not be inflected.
201
 
202
+ ## Should we allow dynamic package types or paths? No.
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  What are they? The ability for a package author to determine where a package
205
  will be installed either through setting the path directly in their
206
  `composer.json` or through a dynamic package type: `"type":
207
  "framework-install-here"`.
208
 
209
  It has been proposed many times. Even implemented once early on and then
210
+ removed. Installers won't do this because it would allow a single package
211
  author to wipe out entire folders without the user's consent. That user would
212
  then come here to yell at us.
213
 
vendor/composer/installers/composer.json CHANGED
@@ -21,18 +21,23 @@
21
  "Dolibarr",
22
  "Drupal",
23
  "Elgg",
 
24
  "ExpressionEngine",
25
  "FuelPHP",
26
  "Grav",
27
  "Hurad",
28
  "ImageCMS",
 
29
  "Joomla",
 
30
  "Kohana",
31
  "Laravel",
 
32
  "Lithium",
33
  "Magento",
34
  "Mako",
35
  "Mautic",
 
36
  "MODX Evo",
37
  "MediaWiki",
38
  "OXID",
@@ -43,12 +48,14 @@
43
  "Plentymarkets",
44
  "PPI",
45
  "Puppet",
 
46
  "RadPHP",
47
  "ReIndex",
48
  "Roundcube",
49
  "shopware",
50
  "SilverStripe",
51
  "SMF",
 
52
  "symfony",
53
  "Thelia",
54
  "TYPO3",
21
  "Dolibarr",
22
  "Drupal",
23
  "Elgg",
24
+ "Eliasis",
25
  "ExpressionEngine",
26
  "FuelPHP",
27
  "Grav",
28
  "Hurad",
29
  "ImageCMS",
30
+ "iTop",
31
  "Joomla",
32
+ "Kanboard",
33
  "Kohana",
34
  "Laravel",
35
+ "Lavalite",
36
  "Lithium",
37
  "Magento",
38
  "Mako",
39
  "Mautic",
40
+ "Maya",
41
  "MODX Evo",
42
  "MediaWiki",
43
  "OXID",
48
  "Plentymarkets",
49
  "PPI",
50
  "Puppet",
51
+ "Porto",
52
  "RadPHP",
53
  "ReIndex",
54
  "Roundcube",
55
  "shopware",
56
  "SilverStripe",
57
  "SMF",
58
+ "SyDES",
59
  "symfony",
60
  "Thelia",
61
  "TYPO3",
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php CHANGED
@@ -75,7 +75,6 @@ class CakePHPInstaller extends BaseInstaller
75
  $installed = new $constraintClass('=', $package->getVersion());
76
  if ($cake3->matches($installed)) {
77
  return true;
78
- break;
79
  }
80
  }
81
  }
75
  $installed = new $constraintClass('=', $package->getVersion());
76
  if ($cake3->matches($installed)) {
77
  return true;
 
78
  }
79
  }
80
  }
vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php CHANGED
@@ -4,9 +4,10 @@ namespace Composer\Installers;
4
  class Concrete5Installer extends BaseInstaller
5
  {
6
  protected $locations = array(
7
- 'block' => 'blocks/{$name}/',
 
8
  'package' => 'packages/{$name}/',
9
- 'theme' => 'themes/{$name}/',
10
  'update' => 'updates/{$name}/',
11
  );
12
  }
4
  class Concrete5Installer extends BaseInstaller
5
  {
6
  protected $locations = array(
7
+ 'core' => 'concrete/',
8
+ 'block' => 'application/blocks/{$name}/',
9
  'package' => 'packages/{$name}/',
10
+ 'theme' => 'application/themes/{$name}/',
11
  'update' => 'updates/{$name}/',
12
  );
13
  }
vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class EliasisInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -34,6 +34,7 @@ class Installer extends LibraryInstaller
34
  'decibel' => 'DecibelInstaller',
35
  'drupal' => 'DrupalInstaller',
36
  'elgg' => 'ElggInstaller',
 
37
  'ee3' => 'ExpressionEngineInstaller',
38
  'ee2' => 'ExpressionEngineInstaller',
39
  'fuel' => 'FuelInstaller',
@@ -41,14 +42,18 @@ class Installer extends LibraryInstaller
41
  'grav' => 'GravInstaller',
42
  'hurad' => 'HuradInstaller',
43
  'imagecms' => 'ImageCMSInstaller',
 
44
  'joomla' => 'JoomlaInstaller',
 
45
  'kirby' => 'KirbyInstaller',
46
  'kodicms' => 'KodiCMSInstaller',
47
  'kohana' => 'KohanaInstaller',
48
  'laravel' => 'LaravelInstaller',
 
49
  'lithium' => 'LithiumInstaller',
50
  'magento' => 'MagentoInstaller',
51
  'mako' => 'MakoInstaller',
 
52
  'mautic' => 'MauticInstaller',
53
  'mediawiki' => 'MediaWikiInstaller',
54
  'microweber' => 'MicroweberInstaller',
@@ -56,6 +61,7 @@ class Installer extends LibraryInstaller
56
  'modxevo' => 'MODXEvoInstaller',
57
  'moodle' => 'MoodleInstaller',
58
  'october' => 'OctoberInstaller',
 
59
  'oxid' => 'OxidInstaller',
60
  'phpbb' => 'PhpBBInstaller',
61
  'pimcore' => 'PimcoreInstaller',
@@ -65,12 +71,14 @@ class Installer extends LibraryInstaller
65
  'puppet' => 'PuppetInstaller',
66
  'radphp' => 'RadPHPInstaller',
67
  'phifty' => 'PhiftyInstaller',
 
68
  'redaxo' => 'RedaxoInstaller',
69
  'reindex' => 'ReIndexInstaller',
70
  'roundcube' => 'RoundcubeInstaller',
71
  'shopware' => 'ShopwareInstaller',
72
  'silverstripe' => 'SilverStripeInstaller',
73
  'smf' => 'SMFInstaller',
 
74
  'symfony1' => 'Symfony1Installer',
75
  'thelia' => 'TheliaInstaller',
76
  'tusk' => 'TuskInstaller',
34
  'decibel' => 'DecibelInstaller',
35
  'drupal' => 'DrupalInstaller',
36
  'elgg' => 'ElggInstaller',
37
+ 'eliasis' => 'EliasisInstaller',
38
  'ee3' => 'ExpressionEngineInstaller',
39
  'ee2' => 'ExpressionEngineInstaller',
40
  'fuel' => 'FuelInstaller',
42
  'grav' => 'GravInstaller',
43
  'hurad' => 'HuradInstaller',
44
  'imagecms' => 'ImageCMSInstaller',
45
+ 'itop' => 'ItopInstaller',
46
  'joomla' => 'JoomlaInstaller',
47
+ 'kanboard' => 'KanboardInstaller',
48
  'kirby' => 'KirbyInstaller',
49
  'kodicms' => 'KodiCMSInstaller',
50
  'kohana' => 'KohanaInstaller',
51
  'laravel' => 'LaravelInstaller',
52
+ 'lavalite' => 'LavaLiteInstaller',
53
  'lithium' => 'LithiumInstaller',
54
  'magento' => 'MagentoInstaller',
55
  'mako' => 'MakoInstaller',
56
+ 'maya' => 'MayaInstaller',
57
  'mautic' => 'MauticInstaller',
58
  'mediawiki' => 'MediaWikiInstaller',
59
  'microweber' => 'MicroweberInstaller',
61
  'modxevo' => 'MODXEvoInstaller',
62
  'moodle' => 'MoodleInstaller',
63
  'october' => 'OctoberInstaller',
64
+ 'ontowiki' => 'OntoWikiInstaller',
65
  'oxid' => 'OxidInstaller',
66
  'phpbb' => 'PhpBBInstaller',
67
  'pimcore' => 'PimcoreInstaller',
71
  'puppet' => 'PuppetInstaller',
72
  'radphp' => 'RadPHPInstaller',
73
  'phifty' => 'PhiftyInstaller',
74
+ 'porto' => 'PortoInstaller',
75
  'redaxo' => 'RedaxoInstaller',
76
  'reindex' => 'ReIndexInstaller',
77
  'roundcube' => 'RoundcubeInstaller',
78
  'shopware' => 'ShopwareInstaller',
79
  'silverstripe' => 'SilverStripeInstaller',
80
  'smf' => 'SMFInstaller',
81
+ 'sydes' => 'SyDESInstaller',
82
  'symfony1' => 'Symfony1Installer',
83
  'thelia' => 'TheliaInstaller',
84
  'tusk' => 'TuskInstaller',
vendor/composer/installers/src/Composer/Installers/ItopInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ItopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ *
6
+ * Installer for kanboard plugins
7
+ *
8
+ * kanboard.net
9
+ *
10
+ * Class KanboardInstaller
11
+ * @package Composer\Installers
12
+ */
13
+ class KanboardInstaller extends BaseInstaller
14
+ {
15
+ protected $locations = array(
16
+ 'plugin' => 'plugins/{$name}/',
17
+ );
18
+ }
vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LavaLiteInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'packages/{$name}/',
8
+ 'theme' => 'public/themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/MayaInstaller.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MayaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name.
12
+ *
13
+ * For package type maya-module, cut off a trailing '-module' if present.
14
+ *
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ if ($vars['type'] === 'maya-module') {
19
+ return $this->inflectModuleVars($vars);
20
+ }
21
+
22
+ return $vars;
23
+ }
24
+
25
+ protected function inflectModuleVars($vars)
26
+ {
27
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
28
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
29
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
30
+
31
+ return $vars;
32
+ }
33
+ }
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php CHANGED
@@ -45,6 +45,7 @@ class MoodleInstaller extends BaseInstaller
45
  'report' => 'report/{$name}/',
46
  'repository' => 'repository/{$name}/',
47
  'scormreport' => 'mod/scorm/report/{$name}/',
 
48
  'theme' => 'theme/{$name}/',
49
  'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
50
  'profilefield' => 'user/profile/field/{$name}/',
45
  'report' => 'report/{$name}/',
46
  'repository' => 'repository/{$name}/',
47
  'scormreport' => 'mod/scorm/report/{$name}/',
48
+ 'search' => 'search/engine/{$name}/',
49
  'theme' => 'theme/{$name}/',
50
  'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
51
  'profilefield' => 'user/profile/field/{$name}/',
vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OntoWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ 'theme' => 'extensions/themes/{$name}/',
9
+ 'translation' => 'extensions/translations/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name to lower case and remove ".ontowiki" suffix
14
+ */
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ $vars['name'] = strtolower($vars['name']);
18
+ $vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
19
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
20
+ $vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
21
+
22
+ return $vars;
23
+ }
24
+ }
vendor/composer/installers/src/Composer/Installers/PortoInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PortoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'container' => 'app/Containers/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class SyDESInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format module name.
13
+ *
14
+ * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15
+ *
16
+ * @param array @vars
17
+ *
18
+ * @return array
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+ if ($vars['type'] == 'sydes-module') {
23
+ return $this->inflectModuleVars($vars);
24
+ }
25
+
26
+ if ($vars['type'] === 'sydes-theme') {
27
+ return $this->inflectThemeVars($vars);
28
+ }
29
+
30
+ return $vars;
31
+ }
32
+
33
+ public function inflectModuleVars($vars)
34
+ {
35
+ $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
36
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
37
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
38
+
39
+ return $vars;
40
+ }
41
+
42
+ protected function inflectThemeVars($vars)
43
+ {
44
+ $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
45
+ $vars['name'] = strtolower($vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class VgmcpInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'src/{$vendor}/{$name}/',
8
+ 'theme' => 'themes/{$name}/'
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
15
+ *
16
+ * For package type vgmcp-theme, cut off a trailing '-theme' if present.
17
+ *
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] === 'vgmcp-bundle') {
22
+ return $this->inflectPluginVars($vars);
23
+ }
24
+
25
+ if ($vars['type'] === 'vgmcp-theme') {
26
+ return $this->inflectThemeVars($vars);
27
+ }
28
+
29
+ return $vars;
30
+ }
31
+
32
+ protected function inflectPluginVars($vars)
33
+ {
34
+ $vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
35
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php CHANGED
@@ -108,6 +108,7 @@ class InstallerTest extends TestCase
108
  array('concrete5-block', true),
109
  array('concrete5-package', true),
110
  array('concrete5-theme', true),
 
111
  array('concrete5-update', true),
112
  array('craft-plugin', true),
113
  array('croogo-plugin', true),
@@ -122,6 +123,7 @@ class InstallerTest extends TestCase
122
  array('ee2-theme', true),
123
  array('ee2-addon', true),
124
  array('elgg-plugin', true),
 
125
  array('fuel-module', true),
126
  array('fuel-package', true),
127
  array('fuel-theme', true),
@@ -131,10 +133,14 @@ class InstallerTest extends TestCase
131
  array('imagecms-template', true),
132
  array('imagecms-module', true),
133
  array('imagecms-library', true),
 
134
  array('joomla-library', true),
 
135
  array('kirby-plugin', true),
136
  array('kohana-module', true),
137
  array('laravel-library', true),
 
 
138
  array('lithium-library', true),
139
  array('magento-library', true),
140
  array('mako-package', true),
@@ -158,6 +164,7 @@ class InstallerTest extends TestCase
158
  array('prestashop-module', true),
159
  array('prestashop-theme', true),
160
  array('puppet-module', true),
 
161
  array('radphp-bundle', true),
162
  array('redaxo-addon', true),
163
  array('redaxo-bestyle-plugin', true),
@@ -174,6 +181,8 @@ class InstallerTest extends TestCase
174
  array('silverstripe-theme', true),
175
  array('smf-module', true),
176
  array('smf-theme', true),
 
 
177
  array('symfony1-plugin', true),
178
  array('thelia-module', true),
179
  array('thelia-frontoffice-template', true),
@@ -241,9 +250,10 @@ class InstallerTest extends TestCase
241
  array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
242
  array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
243
  array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
244
- array('concrete5-block', 'blocks/concrete5_block/', 'remo/concrete5_block'),
245
  array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
246
- array('concrete5-theme', 'themes/concrete5_theme/', 'remo/concrete5_theme'),
 
247
  array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
248
  array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
249
  array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
@@ -257,6 +267,7 @@ class InstallerTest extends TestCase
257
  array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
258
  array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
259
  array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
 
260
  array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
261
  array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
262
  array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
@@ -270,10 +281,14 @@ class InstallerTest extends TestCase
270
  array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
271
  array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
272
  array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
 
273
  array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
 
274
  array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
275
  array('kohana-module', 'modules/my_package/', 'shama/my_package'),
276
  array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
 
 
277
  array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
278
  array('magento-library', 'lib/foo/', 'test/foo'),
279
  array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
@@ -304,6 +319,7 @@ class InstallerTest extends TestCase
304
  array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
305
  array('ppi-module', 'modules/foo/', 'test/foo'),
306
  array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
 
307
  array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
308
  array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
309
  array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
108
  array('concrete5-block', true),
109
  array('concrete5-package', true),
110
  array('concrete5-theme', true),
111
+ array('concrete5-core', true),
112
  array('concrete5-update', true),
113
  array('craft-plugin', true),
114
  array('croogo-plugin', true),
123
  array('ee2-theme', true),
124
  array('ee2-addon', true),
125
  array('elgg-plugin', true),
126
+ array('eliasis-module', true),
127
  array('fuel-module', true),
128
  array('fuel-package', true),
129
  array('fuel-theme', true),
133
  array('imagecms-template', true),
134
  array('imagecms-module', true),
135
  array('imagecms-library', true),
136
+ array('itop-extension', true),
137
  array('joomla-library', true),
138
+ array('kanboard-plugin', true),
139
  array('kirby-plugin', true),
140
  array('kohana-module', true),
141
  array('laravel-library', true),
142
+ array('lavalite-theme', true),
143
+ array('lavalite-package', true),
144
  array('lithium-library', true),
145
  array('magento-library', true),
146
  array('mako-package', true),
164
  array('prestashop-module', true),
165
  array('prestashop-theme', true),
166
  array('puppet-module', true),
167
+ array('porto-container', true),
168
  array('radphp-bundle', true),
169
  array('redaxo-addon', true),
170
  array('redaxo-bestyle-plugin', true),
181
  array('silverstripe-theme', true),
182
  array('smf-module', true),
183
  array('smf-theme', true),
184
+ array('sydes-module', true),
185
+ array('sydes-theme', true),
186
  array('symfony1-plugin', true),
187
  array('thelia-module', true),
188
  array('thelia-frontoffice-template', true),
250
  array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
251
  array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
252
  array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
253
+ array('concrete5-block', 'application/blocks/concrete5_block/', 'remo/concrete5_block'),
254
  array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
255
+ array('concrete5-theme', 'application/themes/concrete5_theme/', 'remo/concrete5_theme'),
256
+ array('concrete5-core', 'concrete/', 'concrete5/core'),
257
  array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
258
  array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
259
  array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
267
  array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
268
  array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
269
  array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
270
+ array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
271
  array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
272
  array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
273
  array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
281
  array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
282
  array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
283
  array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
284
+ array('itop-extension', 'extensions/my_extension/', 'shama/my_extension'),
285
  array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
286
+ array('kanboard-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
287
  array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
288
  array('kohana-module', 'modules/my_package/', 'shama/my_package'),
289
  array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
290
+ array('lavalite-theme', 'public/themes/my_theme/', 'shama/my_theme'),
291
+ array('lavalite-package', 'packages/my_package/', 'shama/my_package'),
292
  array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
293
  array('magento-library', 'lib/foo/', 'test/foo'),
294
  array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
319
  array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
320
  array('ppi-module', 'modules/foo/', 'test/foo'),
321
  array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
322
+ array('porto-container', 'app/Containers/container-name/', 'test/container-name'),
323
  array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
324
  array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
325
  array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\MayaInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class MayaInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var MayaInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new MayaInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ array('name' => $expected, 'type' => $type),
30
+ $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ // Should keep module name StudlyCase
38
+ array(
39
+ 'maya-module',
40
+ 'user-profile',
41
+ 'UserProfile'
42
+ ),
43
+ array(
44
+ 'maya-module',
45
+ 'maya-module',
46
+ 'Maya'
47
+ ),
48
+ array(
49
+ 'maya-module',
50
+ 'blog',
51
+ 'Blog'
52
+ ),
53
+ // tests that exactly one '-module' is cut off
54
+ array(
55
+ 'maya-module',
56
+ 'some-module-module',
57
+ 'SomeModule',
58
+ ),
59
+ );
60
+ }
61
+ }
vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\OntoWikiInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ /**
9
+ * Test for the OntoWikiInstaller
10
+ * code was taken from DokuWikiInstaller
11
+ */
12
+ class OntoWikiInstallerTest extends \PHPUnit_Framework_TestCase
13
+ {
14
+ /**
15
+ * @var OntoWikiInstaller
16
+ */
17
+ private $installer;
18
+
19
+ public function setUp()
20
+ {
21
+ $this->installer = new OntoWikiInstaller();
22
+ }
23
+
24
+ /**
25
+ * @dataProvider packageNameInflectionProvider
26
+ */
27
+ public function testInflectPackageVars($type, $name, $expected)
28
+ {
29
+ $this->assertEquals(
30
+ $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
31
+ array('name' => $expected, 'type'=>$type)
32
+ );
33
+ }
34
+
35
+ public function packageNameInflectionProvider()
36
+ {
37
+ return array(
38
+ array(
39
+ 'ontowiki-extension',
40
+ 'CSVImport.ontowiki',
41
+ 'csvimport',
42
+ ),
43
+ array(
44
+ 'ontowiki-extension',
45
+ 'csvimport',
46
+ 'csvimport',
47
+ ),
48
+ array(
49
+ 'ontowiki-extension',
50
+ 'some_ontowiki_extension',
51
+ 'some_ontowiki_extension',
52
+ ),
53
+ array(
54
+ 'ontowiki-extension',
55
+ 'some_ontowiki_extension.ontowiki',
56
+ 'some_ontowiki_extension',
57
+ ),
58
+ array(
59
+ 'ontowiki-translation',
60
+ 'de-translation.ontowiki',
61
+ 'de',
62
+ ),
63
+ array(
64
+ 'ontowiki-translation',
65
+ 'en-US-translation.ontowiki',
66
+ 'en-us',
67
+ ),
68
+ array(
69
+ 'ontowiki-translation',
70
+ 'en-US-translation',
71
+ 'en-us',
72
+ ),
73
+ array(
74
+ 'ontowiki-theme',
75
+ 'blue-theme.ontowiki',
76
+ 'blue',
77
+ ),
78
+ array(
79
+ 'ontowiki-theme',
80
+ 'blue-theme',
81
+ 'blue',
82
+ ),
83
+ );
84
+ }
85
+ }
vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\SyDESInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class SyDESInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var SyDESInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new SyDESInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ array('name' => $expected, 'type' => $type),
30
+ $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ // modules
38
+ array(
39
+ 'sydes-module',
40
+ 'name',
41
+ 'Name'
42
+ ),
43
+ array(
44
+ 'sydes-module',
45
+ 'sample-name',
46
+ 'SampleName'
47
+ ),
48
+ array(
49
+ 'sydes-module',
50
+ 'sydes-name',
51
+ 'Name'
52
+ ),
53
+ array(
54
+ 'sydes-module',
55
+ 'sample-name-module',
56
+ 'SampleName',
57
+ ),
58
+ array(
59
+ 'sydes-module',
60
+ 'sydes-sample-name-module',
61
+ 'SampleName'
62
+ ),
63
+ // themes
64
+ array(
65
+ 'sydes-theme',
66
+ 'some-theme-theme',
67
+ 'some-theme',
68
+ ),
69
+ array(
70
+ 'sydes-theme',
71
+ 'sydes-sometheme',
72
+ 'sometheme',
73
+ ),
74
+ array(
75
+ 'sydes-theme',
76
+ 'Sample-Name',
77
+ 'sample-name'
78
+ ),
79
+ );
80
+ }
81
+ }
vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers\Test;
3
+
4
+ use Composer\Installers\VgmcpInstaller;
5
+ use Composer\Package\Package;
6
+ use Composer\Composer;
7
+
8
+ class VgmcpInstallerTest extends \PHPUnit_Framework_TestCase
9
+ {
10
+ /**
11
+ * @var VgmcpInstaller
12
+ */
13
+ private $installer;
14
+
15
+ public function setUp()
16
+ {
17
+ $this->installer = new VgmcpInstaller(
18
+ new Package('NyanCat', '4.2', '4.2'),
19
+ new Composer()
20
+ );
21
+ }
22
+
23
+ /**
24
+ * @dataProvider packageNameInflectionProvider
25
+ */
26
+ public function testInflectPackageVars($type, $name, $expected)
27
+ {
28
+ $this->assertEquals(
29
+ array('name' => $expected, 'type' => $type),
30
+ $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
31
+ );
32
+ }
33
+
34
+ public function packageNameInflectionProvider()
35
+ {
36
+ return array(
37
+ // Should keep bundle name StudlyCase
38
+ array(
39
+ 'vgmcp-bundle',
40
+ 'user-profile',
41
+ 'UserProfile'
42
+ ),
43
+ array(
44
+ 'vgmcp-bundle',
45
+ 'vgmcp-bundle',
46
+ 'Vgmcp'
47
+ ),
48
+ array(
49
+ 'vgmcp-bundle',
50
+ 'blog',
51
+ 'Blog'
52
+ ),
53
+ // tests that exactly one '-bundle' is cut off
54
+ array(
55
+ 'vgmcp-bundle',
56
+ 'some-bundle-bundle',
57
+ 'SomeBundle',
58
+ ),
59
+ // tests that exactly one '-theme' is cut off
60
+ array(
61
+ 'vgmcp-theme',
62
+ 'some-theme-theme',
63
+ 'SomeTheme',
64
+ ),
65
+ // tests that names without '-theme' suffix stay valid
66
+ array(
67
+ 'vgmcp-theme',
68
+ 'someothertheme',
69
+ 'Someothertheme',
70
+ ),
71
+ // Should keep theme name StudlyCase
72
+ array(
73
+ 'vgmcp-theme',
74
+ 'adminlte-advanced',
75
+ 'AdminlteAdvanced'
76
+ ),
77
+ );
78
+ }
79
+ }
vendor/twig/twig/.travis.yml CHANGED
@@ -31,7 +31,6 @@ install:
31
  before_script:
32
  - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi
33
  - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi
34
- - if [ ${TRAVIS_PHP_VERSION:0:3} == "5.2" ]; then sed -i.bak "s|vendor/autoload.php|test/bootstrap.php|" phpunit.xml.dist; fi
35
 
36
  matrix:
37
  fast_finish: true
31
  before_script:
32
  - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi
33
  - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi
 
34
 
35
  matrix:
36
  fast_finish: true
vendor/twig/twig/CHANGELOG CHANGED
@@ -1,3 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  * 1.31.0 (2017-01-11)
2
 
3
  * added Twig_NodeCaptureInterface for nodes that capture all output
1
+ * 1.33.2 (2017-04-20)
2
+
3
+ * fixed edge case in the method cache for Twig attributes
4
+
5
+ * 1.33.1 (2017-04-18)
6
+
7
+ * fixed the empty() test
8
+
9
+ * 1.33.0 (2017-03-22)
10
+
11
+ * fixed a race condition handling when writing cache files
12
+ * "length" filter now returns string length when applied to an object that does
13
+ not implement \Countable but provides __toString()
14
+ * "empty" test will now consider the return value of the __toString() method for
15
+ objects implement __toString() but not \Countable
16
+ * fixed JS escaping for unicode characters with higher code points
17
+
18
+ * 1.32.0 (2017-02-26)
19
+
20
+ * fixed deprecation notice in Twig_Util_DeprecationCollector
21
+ * added a PSR-11 compatible runtime loader
22
+ * added `side` argument to `trim` to allow left or right trimming only.
23
+
24
  * 1.31.0 (2017-01-11)
25
 
26
  * added Twig_NodeCaptureInterface for nodes that capture all output
vendor/twig/twig/composer.json CHANGED
@@ -30,8 +30,9 @@
30
  "php": ">=5.2.7"
31
  },
32
  "require-dev": {
33
- "symfony/phpunit-bridge": "~3.2",
34
- "symfony/debug": "~2.7"
 
35
  },
36
  "autoload": {
37
  "psr-0" : {
@@ -40,7 +41,7 @@
40
  },
41
  "extra": {
42
  "branch-alias": {
43
- "dev-master": "1.31-dev"
44
  }
45
  }
46
  }
30
  "php": ">=5.2.7"
31
  },
32
  "require-dev": {
33
+ "symfony/phpunit-bridge": "~3.3@dev",
34
+ "symfony/debug": "~2.7",
35
+ "psr/container": "^1.0"
36
  },
37
  "autoload": {
38
  "psr-0" : {
41
  },
42
  "extra": {
43
  "branch-alias": {
44
+ "dev-master": "1.33-dev"
45
  }
46
  }
47
  }
vendor/twig/twig/doc/advanced.rst CHANGED
@@ -830,6 +830,11 @@ instance on the environment that knows how to instantiate such runtime classes
830
 
831
  $twig->addRuntimeLoader(new RuntimeLoader());
832
 
 
 
 
 
 
833
  It is now possible to move the runtime logic to a new
834
  ``Project_Twig_RuntimeExtension`` class and use it directly in the extension::
835
 
830
 
831
  $twig->addRuntimeLoader(new RuntimeLoader());
832
 
833
+ .. note::
834
+
835
+ As of Twig 1.32, Twig comes with a PSR-11 compatible runtime loader
836
+ (``Twig_ContainerRuntimeLoader``) that works on PHP 5.3+.
837
+
838
  It is now possible to move the runtime logic to a new
839
  ``Project_Twig_RuntimeExtension`` class and use it directly in the extension::
840
 
vendor/twig/twig/doc/deprecated.rst CHANGED
@@ -206,6 +206,9 @@ Miscellaneous
206
  ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be
207
  removed in 2.0.
208
 
 
 
 
209
  * As of Twig 1.27, ``Twig_Error::getTemplateFile()`` and
210
  ``Twig_Error::setTemplateFile()`` are deprecated. Use
211
  ``Twig_Error::getTemplateName()`` and ``Twig_Error::setTemplateName()``
206
  ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be
207
  removed in 2.0.
208
 
209
+ * As of Twig 1.21, setting the environment option ``autoescape`` to ``true`` is
210
+ deprecated and will be removed in 2.0. Use ``"html"`` instead.
211
+
212
  * As of Twig 1.27, ``Twig_Error::getTemplateFile()`` and
213
  ``Twig_Error::setTemplateFile()`` are deprecated. Use
214
  ``Twig_Error::getTemplateName()`` and ``Twig_Error::setTemplateName()``
vendor/twig/twig/doc/filters/length.rst CHANGED
@@ -1,8 +1,18 @@
1
  ``length``
2
  ==========
3
 
 
 
 
 
4
  The ``length`` filter returns the number of items of a sequence or mapping, or
5
- the length of a string:
 
 
 
 
 
 
6
 
7
  .. code-block:: jinja
8
 
1
  ``length``
2
  ==========
3
 
4
+ .. versionadded:: 1.33
5
+
6
+ Support for the ``__toString()`` magic method has been added in Twig 1.33.
7
+
8
  The ``length`` filter returns the number of items of a sequence or mapping, or
9
+ the length of a string.
10
+
11
+ For objects that implement the ``Countable`` interface, ``length`` will use the
12
+ return value of the ``count()`` method.
13
+
14
+ For objects that implement the ``__toString()`` magic method (and not ``Countable``),
15
+ it will return the length of the string provided by that method.
16
 
17
  .. code-block:: jinja
18
 
vendor/twig/twig/doc/filters/striptags.rst CHANGED
@@ -8,8 +8,22 @@ by one space:
8
 
9
  {{ some_html|striptags }}
10
 
 
 
 
 
 
 
 
 
 
11
  .. note::
12
 
13
  Internally, Twig uses the PHP `strip_tags`_ function.
14
 
 
 
 
 
 
15
  .. _`strip_tags`: http://php.net/strip_tags
8
 
9
  {{ some_html|striptags }}
10
 
11
+ You can also provide tags which should not be stripped:
12
+
13
+ .. code-block:: jinja
14
+
15
+ {{ some_html|striptags('<br><p>') }}
16
+
17
+ In this example, the ``<br/>``, ``<br>``, ``<p>``, and ``</p>`` tags won't be
18
+ removed from the string.
19
+
20
  .. note::
21
 
22
  Internally, Twig uses the PHP `strip_tags`_ function.
23
 
24
+ Arguments
25
+ ---------
26
+
27
+ * ``allowable_tags``: Tags which should not be stripped
28
+
29
  .. _`strip_tags`: http://php.net/strip_tags
vendor/twig/twig/doc/filters/trim.rst CHANGED
@@ -1,6 +1,9 @@
1
  ``trim``
2
  ========
3
 
 
 
 
4
  .. versionadded:: 1.6.2
5
  The ``trim`` filter was added in Twig 1.6.2.
6
 
@@ -17,13 +20,26 @@ and end of a string:
17
 
18
  {# outputs ' I like Twig' #}
19
 
 
 
 
 
 
 
 
 
20
  .. note::
21
 
22
- Internally, Twig uses the PHP `trim`_ function.
23
 
24
  Arguments
25
  ---------
26
 
27
  * ``character_mask``: The characters to strip
28
 
 
 
 
29
  .. _`trim`: http://php.net/trim
 
 
1
  ``trim``
2
  ========
3
 
4
+ .. versionadded:: 1.32
5
+ The ``side`` argument was added in Twig 1.32.
6
+
7
  .. versionadded:: 1.6.2
8
  The ``trim`` filter was added in Twig 1.6.2.
9
 
20
 
21
  {# outputs ' I like Twig' #}
22
 
23
+ {{ ' I like Twig. '|trim(side='left') }}
24
+
25
+ {# outputs 'I like Twig. ' #}
26
+
27
+ {{ ' I like Twig. '|trim(' ', 'right') }}
28
+
29
+ {# outputs ' I like Twig.' #}
30
+
31
  .. note::
32
 
33
+ Internally, Twig uses the PHP `trim`_, `ltrim`_, and `rtrim`_ functions.
34
 
35
  Arguments
36
  ---------
37
 
38
  * ``character_mask``: The characters to strip
39
 
40
+ * ``side``: The default is to strip from the left and the right (`both`) sides, but `left`
41
+ and `right` will strip from either the left side or right side only
42
+
43
  .. _`trim`: http://php.net/trim
44
+ .. _`ltrim`: http://php.net/ltrim
45
+ .. _`rtrim`: http://php.net/rtrim
vendor/twig/twig/doc/recipes.rst CHANGED
@@ -30,7 +30,7 @@ catches deprecation notices, and return them.
30
  .. tip::
31
 
32
  If your templates are not stored on the filesystem, use the ``collect()``
33
- method instead which takes an ``Iterator``; the iterator must return
34
  template names as keys and template contents as values (as done by
35
  ``Twig_Util_TemplateDirIterator``).
36
 
@@ -551,7 +551,7 @@ include in your templates:
551
  ``interpolateProvider`` service, for instance at the module initialization
552
  time:
553
 
554
- ..code-block:: javascript
555
 
556
  angular.module('myApp', []).config(function($interpolateProvider) {
557
  $interpolateProvider.startSymbol('{[').endSymbol(']}');
@@ -559,7 +559,7 @@ include in your templates:
559
 
560
  * For Twig, change the delimiters via the ``tag_variable`` Lexer option:
561
 
562
- ..code-block:: php
563
 
564
  $env->setLexer(new Twig_Lexer($env, array(
565
  'tag_variable' => array('{[', ']}'),
30
  .. tip::
31
 
32
  If your templates are not stored on the filesystem, use the ``collect()``
33
+ method instead. ``collect()`` takes a ``Traversable`` which must return
34
  template names as keys and template contents as values (as done by
35
  ``Twig_Util_TemplateDirIterator``).
36
 
551
  ``interpolateProvider`` service, for instance at the module initialization
552
  time:
553
 
554
+ .. code-block:: javascript
555
 
556
  angular.module('myApp', []).config(function($interpolateProvider) {
557
  $interpolateProvider.startSymbol('{[').endSymbol(']}');
559
 
560
  * For Twig, change the delimiters via the ``tag_variable`` Lexer option:
561
 
562
+ .. code-block:: php
563
 
564
  $env->setLexer(new Twig_Lexer($env, array(
565
  'tag_variable' => array('{[', ']}'),
vendor/twig/twig/doc/templates.rst CHANGED
@@ -893,7 +893,7 @@ Extension<creating_extensions>` chapter.
893
 
894
  .. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle
895
  .. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim
896
- .. _`vim-twig plugin`: https://github.com/evidens/vim-twig
897
  .. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig
898
  .. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin
899
  .. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language
893
 
894
  .. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle
895
  .. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim
896
+ .. _`vim-twig plugin`: https://github.com/lumiliet/vim-twig
897
  .. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig
898
  .. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin
899
  .. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language
vendor/twig/twig/doc/tests/empty.rst CHANGED
@@ -1,11 +1,22 @@
1
  ``empty``
2
  =========
3
 
 
 
 
 
4
  ``empty`` checks if a variable is an empty string, an empty array, an empty
5
- hash, exactly ``false``, or exactly ``null``:
 
 
 
 
 
 
6
 
7
  .. code-block:: jinja
8
 
9
  {% if foo is empty %}
10
  ...
11
  {% endif %}
 
1
  ``empty``
2
  =========
3
 
4
+ .. versionadded:: 1.33
5
+
6
+ Support for the ``__toString()`` magic method has been added in Twig 1.33.
7
+
8
  ``empty`` checks if a variable is an empty string, an empty array, an empty
9
+ hash, exactly ``false``, or exactly ``null``.
10
+
11
+ For objects that implement the ``Countable`` interface, ``empty`` will check the
12
+ return value of the ``count()`` method.
13
+
14
+ For objects that implement the ``__toString()`` magic method (and not ``Countable``),
15
+ it will check if an empty string is returned.
16
 
17
  .. code-block:: jinja
18
 
19
  {% if foo is empty %}
20
  ...
21
  {% endif %}
22
+
vendor/twig/twig/ext/twig/php_twig.h CHANGED
@@ -15,7 +15,7 @@
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
- #define PHP_TWIG_VERSION "1.31.0"
19
 
20
  #include "php.h"
21
 
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
+ #define PHP_TWIG_VERSION "1.33.2"
19
 
20
  #include "php.h"
21
 
vendor/twig/twig/lib/Twig/Cache/Filesystem.php CHANGED
@@ -49,8 +49,13 @@ class Twig_Cache_Filesystem implements Twig_CacheInterface
49
  {
50
  $dir = dirname($key);
51
  if (!is_dir($dir)) {
52
- if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
53
- throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir));
 
 
 
 
 
54
  }
55
  } elseif (!is_writable($dir)) {
56
  throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir));
49
  {
50
  $dir = dirname($key);
51
  if (!is_dir($dir)) {
52
+ if (false === @mkdir($dir, 0777, true)) {
53
+ if (PHP_VERSION_ID >= 50300) {
54
+ clearstatcache(true, $dir);
55
+ }
56
+ if (!is_dir($dir)) {
57
+ throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir));
58
+ }
59
  }
60
  } elseif (!is_writable($dir)) {
61
  throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir));
vendor/twig/twig/lib/Twig/Compiler.php CHANGED
@@ -169,7 +169,7 @@ class Twig_Compiler implements Twig_CompilerInterface
169
  public function repr($value)
170
  {
171
  if (is_int($value) || is_float($value)) {
172
- if (false !== $locale = setlocale(LC_NUMERIC, 0)) {
173
  setlocale(LC_NUMERIC, 'C');
174
  }
175
 
169
  public function repr($value)
170
  {
171
  if (is_int($value) || is_float($value)) {
172
+ if (false !== $locale = setlocale(LC_NUMERIC, '0')) {
173
  setlocale(LC_NUMERIC, 'C');
174
  }
175
 
vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ use Psr\Container\ContainerInterface;
13
+
14
+ /**
15
+ * Lazily loads Twig runtime implementations from a PSR-11 container.
16
+ *
17
+ * Note that the runtime services MUST use their class names as identifiers.
18
+ *
19
+ * @author Fabien Potencier <fabien@symfony.com>
20
+ * @author Robin Chalas <robin.chalas@gmail.com>
21
+ */
22
+ class Twig_ContainerRuntimeLoader implements Twig_RuntimeLoaderInterface
23
+ {
24
+ private $container;
25
+
26
+ public function __construct(ContainerInterface $container)
27
+ {
28
+ $this->container = $container;
29
+ }
30
+
31
+ public function load($class)
32
+ {
33
+ if ($this->container->has($class)) {
34
+ return $this->container->get($class);
35
+ }
36
+ }
37
+ }
vendor/twig/twig/lib/Twig/Environment.php CHANGED
@@ -16,11 +16,11 @@
16
  */
17
  class Twig_Environment
18
  {
19
- const VERSION = '1.31.0';
20
- const VERSION_ID = 13100;
21
  const MAJOR_VERSION = 1;
22
- const MINOR_VERSION = 31;
23
- const RELEASE_VERSION = 0;
24
  const EXTRA_VERSION = '';
25
 
26
  protected $charset;
16
  */
17
  class Twig_Environment
18
  {
19
+ const VERSION = '1.33.2';
20
+ const VERSION_ID = 13302;
21
  const MAJOR_VERSION = 1;
22
+ const MINOR_VERSION = 33;
23
+ const RELEASE_VERSION = 1;
24
  const EXTRA_VERSION = '';
25
 
26
  protected $charset;
vendor/twig/twig/lib/Twig/Extension/Core.php CHANGED
@@ -163,7 +163,7 @@ class Twig_Extension_Core extends Twig_Extension
163
  new Twig_SimpleFilter('upper', 'strtoupper'),
164
  new Twig_SimpleFilter('lower', 'strtolower'),
165
  new Twig_SimpleFilter('striptags', 'strip_tags'),
166
- new Twig_SimpleFilter('trim', 'trim'),
167
  new Twig_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))),
168
 
169
  // array helpers
@@ -945,6 +945,31 @@ function twig_in_filter($value, $compare)
945
  return false;
946
  }
947
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948
  /**
949
  * Escapes a string.
950
  *
@@ -1143,8 +1168,13 @@ function _twig_escape_js_callback($matches)
1143
 
1144
  // \uHHHH
1145
  $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
 
1146
 
1147
- return '\\u'.strtoupper(substr('0000'.bin2hex($char), -4));
 
 
 
 
1148
  }
1149
 
1150
  function _twig_escape_css_callback($matches)
@@ -1234,7 +1264,15 @@ if (function_exists('mb_get_info')) {
1234
  */
1235
  function twig_length_filter(Twig_Environment $env, $thing)
1236
  {
1237
- return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
 
 
 
 
 
 
 
 
1238
  }
1239
 
1240
  /**
@@ -1317,7 +1355,15 @@ else {
1317
  */
1318
  function twig_length_filter(Twig_Environment $env, $thing)
1319
  {
1320
- return is_scalar($thing) ? strlen($thing) : count($thing);
 
 
 
 
 
 
 
 
1321
  }
1322
 
1323
  /**
@@ -1379,6 +1425,10 @@ function twig_test_empty($value)
1379
  return 0 == count($value);
1380
  }
1381
 
 
 
 
 
1382
  return '' === $value || false === $value || null === $value || array() === $value;
1383
  }
1384
 
163
  new Twig_SimpleFilter('upper', 'strtoupper'),
164
  new Twig_SimpleFilter('lower', 'strtolower'),
165
  new Twig_SimpleFilter('striptags', 'strip_tags'),
166
+ new Twig_SimpleFilter('trim', 'twig_trim_filter'),
167
  new Twig_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))),
168
 
169
  // array helpers
945
  return false;
946
  }
947
 
948
+ /**
949
+ * Returns a trimmed string.
950
+ *
951
+ * @return string
952
+ *
953
+ * @throws Twig_Error_Runtime When an invalid trimming side is used (not a string or not 'left', 'right', or 'both')
954
+ */
955
+ function twig_trim_filter($string, $characterMask = null, $side = 'both')
956
+ {
957
+ if (null === $characterMask) {
958
+ $characterMask = " \t\n\r\0\x0B";
959
+ }
960
+
961
+ switch ($side) {
962
+ case 'both':
963
+ return trim($string, $characterMask);
964
+ case 'left':
965
+ return ltrim($string, $characterMask);
966
+ case 'right':
967
+ return rtrim($string, $characterMask);
968
+ default:
969
+ throw new Twig_Error_Runtime('Trimming side must be "left", "right" or "both".');
970
+ }
971
+ }
972
+
973
  /**
974
  * Escapes a string.
975
  *
1168
 
1169
  // \uHHHH
1170
  $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
1171
+ $char = strtoupper(bin2hex($char));
1172
 
1173
+ if (4 >= strlen($char)) {
1174
+ return sprintf('\u%04s', $char);
1175
+ }
1176
+
1177
+ return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4));
1178
  }
1179
 
1180
  function _twig_escape_css_callback($matches)
1264
  */
1265
  function twig_length_filter(Twig_Environment $env, $thing)
1266
  {
1267
+ if (is_scalar($thing)) {
1268
+ return mb_strlen($thing, $env->getCharset());
1269
+ }
1270
+
1271
+ if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) {
1272
+ return mb_strlen((string) $thing, $env->getCharset());
1273
+ }
1274
+
1275
+ return count($thing);
1276
  }
1277
 
1278
  /**
1355
  */
1356
  function twig_length_filter(Twig_Environment $env, $thing)
1357
  {
1358
+ if (is_scalar($thing)) {
1359
+ return strlen($thing);
1360
+ }
1361
+
1362
+ if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) {
1363
+ return strlen((string) $thing);
1364
+ }
1365
+
1366
+ return count($thing);
1367
  }
1368
 
1369
  /**
1425
  return 0 == count($value);
1426
  }
1427
 
1428
+ if (is_object($value) && method_exists($value, '__toString')) {
1429
+ return '' === (string) $value;
1430
+ }
1431
+
1432
  return '' === $value || false === $value || null === $value || array() === $value;
1433
  }
1434
 
vendor/twig/twig/lib/Twig/Loader/Array.php CHANGED
@@ -80,7 +80,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
80
  throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
81
  }
82
 
83
- return $this->templates[$name];
84
  }
85
 
86
  public function isFresh($name, $time)
80
  throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
81
  }
82
 
83
+ return $name.':'.$this->templates[$name];
84
  }
85
 
86
  public function isFresh($name, $time)
vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php CHANGED
@@ -22,7 +22,7 @@ class Twig_Profiler_Dumper_Blackfire
22
  $this->dumpProfile('main()', $profile, $data);
23
  $this->dumpChildren('main()', $profile, $data);
24
 
25
- $start = microtime(true);
26
  $str = <<<EOF
27
  file-format: BlackfireProbe
28
  cost-dimensions: wt mu pmu
22
  $this->dumpProfile('main()', $profile, $data);
23
  $this->dumpChildren('main()', $profile, $data);
24
 
25
+ $start = sprintf('%f', microtime(true));
26
  $str = <<<EOF
27
  file-format: BlackfireProbe
28
  cost-dimensions: wt mu pmu
vendor/twig/twig/lib/Twig/Template.php CHANGED
@@ -627,11 +627,14 @@ abstract class Twig_Template implements Twig_TemplateInterface
627
  continue;
628
  }
629
 
630
- if (!isset($cache[$name])) {
631
- $cache[$name] = $method;
632
- }
633
- if (!isset($cache[$lcName])) {
634
- $cache[$lcName] = $method;
 
 
 
635
  }
636
  }
637
  self::$cache[$class] = $cache;
627
  continue;
628
  }
629
 
630
+ // skip get() and is() methods (in which case, $name is empty)
631
+ if ($name) {
632
+ if (!isset($cache[$name])) {
633
+ $cache[$name] = $method;
634
+ }
635
+ if (!isset($cache[$lcName])) {
636
+ $cache[$lcName] = $method;
637
+ }
638
  }
639
  }
640
  self::$cache[$class] = $cache;
vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php CHANGED
@@ -121,6 +121,10 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
121
 
122
  protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs)
123
  {
 
 
 
 
124
  if ($condition) {
125
  eval('$ret = '.$condition.';');
126
  if (!$ret) {
121
 
122
  protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs)
123
  {
124
+ if (!$outputs) {
125
+ $this->markTestSkipped('no legacy tests to run');
126
+ }
127
+
128
  if ($condition) {
129
  eval('$ret = '.$condition.';');
130
  if (!$ret) {
vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php CHANGED
@@ -46,11 +46,11 @@ class Twig_Util_DeprecationCollector
46
  /**
47
  * Returns deprecations for passed templates.
48
  *
49
- * @param Iterator $iterator An iterator of templates (where keys are template names and values the contents of the template)
50
  *
51
  * @return array An array of deprecations
52
  */
53
- public function collect(Iterator $iterator)
54
  {
55
  $this->deprecations = array();
56
 
@@ -58,7 +58,7 @@ class Twig_Util_DeprecationCollector
58
 
59
  foreach ($iterator as $name => $contents) {
60
  try {
61
- $this->twig->parse($this->twig->tokenize($contents, $name));
62
  } catch (Twig_Error_Syntax $e) {
63
  // ignore templates containing syntax errors
64
  }
46
  /**
47
  * Returns deprecations for passed templates.
48
  *
49
+ * @param Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template)
50
  *
51
  * @return array An array of deprecations
52
  */
53
+ public function collect(Traversable $iterator)
54
  {
55
  $this->deprecations = array();
56
 
58
 
59
  foreach ($iterator as $name => $contents) {
60
  try {
61
+ $this->twig->parse($this->twig->tokenize(new Twig_Source($contents, $name)));
62
  } catch (Twig_Error_Syntax $e) {
63
  // ignore templates containing syntax errors
64
  }
vendor/twig/twig/phpunit.xml.dist CHANGED
@@ -9,7 +9,7 @@
9
  processIsolation="false"
10
  stopOnFailure="false"
11
  syntaxCheck="false"
12
- bootstrap="vendor/autoload.php"
13
  >
14
  <testsuites>
15
  <testsuite name="Twig Test Suite">
9
  processIsolation="false"
10
  stopOnFailure="false"
11
  syntaxCheck="false"
12
+ bootstrap="test/bootstrap.php"
13
  >
14
  <testsuites>
15
  <testsuite name="Twig Test Suite">
vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Twig_Tests_ContainerRuntimeLoaderTest extends PHPUnit_Framework_TestCase
13
+ {
14
+ /**
15
+ * @requires PHP 5.3
16
+ */
17
+ public function testLoad()
18
+ {
19
+ $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
20
+ $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true);
21
+ $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new stdClass());
22
+
23
+ $loader = new Twig_ContainerRuntimeLoader($container);
24
+
25
+ $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
26
+ }
27
+
28
+ /**
29
+ * @requires PHP 5.3
30
+ */
31
+ public function testLoadUnknownRuntimeReturnsNull()
32
+ {
33
+ $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
34
+ $container->expects($this->once())->method('has')->with('Foo');
35
+ $container->expects($this->never())->method('get');
36
+
37
+ $loader = new Twig_ContainerRuntimeLoader($container);
38
+ $this->assertNull($loader->load('Foo'));
39
+ }
40
+ }
vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php CHANGED
@@ -17,7 +17,12 @@ class CustomExtensionTest extends PHPUnit_Framework_TestCase
17
  */
18
  public function testGetInvalidOperators(Twig_ExtensionInterface $extension, $expectedExceptionMessage)
19
  {
20
- $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
 
 
 
 
 
21
 
22
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
23
  $env->addExtension($extension);
17
  */
18
  public function testGetInvalidOperators(Twig_ExtensionInterface $extension, $expectedExceptionMessage)
19
  {
20
+ if (method_exists($this, 'expectException')) {
21
+ $this->expectException('InvalidArgumentException');
22
+ $this->expectExceptionMessage($expectedExceptionMessage);
23
+ } else {
24
+ $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
25
+ }
26
 
27
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
28
  $env->addExtension($extension);
vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php CHANGED
@@ -398,8 +398,11 @@ EOF
398
  {
399
  $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
400
  $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
401
-
402
  $twig->initRuntime();
 
 
 
 
403
  }
404
 
405
  /**
398
  {
399
  $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
400
  $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
 
401
  $twig->initRuntime();
402
+
403
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
404
+ // can be executed without throwing any deprecations
405
+ $this->addToAssertionCount(1);
406
  }
407
 
408
  /**
vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php CHANGED
@@ -284,6 +284,10 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
284
  $parser = new Twig_Parser($env);
285
 
286
  $parser->parse($env->tokenize(new Twig_Source($template, 'index')));
 
 
 
 
287
  }
288
 
289
  public function getMacroDefinitionSupportsConstantDefaultValues()
284
  $parser = new Twig_Parser($env);
285
 
286
  $parser->parse($env->tokenize(new Twig_Source($template, 'index')));
287
+
288
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
289
+ // can be executed without throwing any exceptions
290
+ $this->addToAssertionCount(1);
291
  }
292
 
293
  public function getMacroDefinitionSupportsConstantDefaultValues()
vendor/twig/twig/test/Twig/Tests/{RuntimeFactoryLoaderTest.php → FactoryRuntimeLoaderTest.php} RENAMED
File without changes
vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test CHANGED
@@ -2,8 +2,11 @@
2
  "name" autoescape strategy
3
  --TEMPLATE--
4
  {{ br -}}
 
5
  {{ include('index.html.twig') -}}
6
  {{ include('index.txt.twig') -}}
 
 
7
  --TEMPLATE(index.html.twig)--
8
  {{ br -}}
9
  --TEMPLATE(index.txt.twig)--
@@ -14,5 +17,6 @@ return array('br' => '<br />')
14
  return array('autoescape' => 'name')
15
  --EXPECT--
16
  &lt;br /&gt;
 
17
  &lt;br /&gt;
18
  <br />
2
  "name" autoescape strategy
3
  --TEMPLATE--
4
  {{ br -}}
5
+ {{ include('index.js.twig') -}}
6
  {{ include('index.html.twig') -}}
7
  {{ include('index.txt.twig') -}}
8
+ --TEMPLATE(index.js.twig)--
9
+ {{ br -}}
10
  --TEMPLATE(index.html.twig)--
11
  {{ br -}}
12
  --TEMPLATE(index.txt.twig)--
17
  return array('autoescape' => 'name')
18
  --EXPECT--
19
  &lt;br /&gt;
20
+ \x3Cbr\x20\x2F\x3E
21
  &lt;br /&gt;
22
  <br />
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "escape" filter
3
+ --TEMPLATE--
4
+ {{ "é ♜ 𝌆"|e('js') }}
5
+ --DATA--
6
+ return array()
7
+ --EXPECT--
8
+ \u00E9\x20\u265C\x20\uD834\uDF06
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test CHANGED
@@ -4,11 +4,22 @@
4
  {{ array|length }}
5
  {{ string|length }}
6
  {{ number|length }}
7
- {{ markup|length }}
 
 
8
  --DATA--
9
- return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000, 'markup' => new Twig_Markup('foo', 'UTF-8'))
 
 
 
 
 
 
 
10
  --EXPECT--
11
  2
12
  3
13
  4
14
- 3
 
 
4
  {{ array|length }}
5
  {{ string|length }}
6
  {{ number|length }}
7
+ {{ to_string_able|length }}
8
+ {{ countable|length }}
9
+ {{ magic|length }}
10
  --DATA--
11
+ return array(
12
+ 'array' => array(1, 4),
13
+ 'string' => 'foo',
14
+ 'number' => 1000,
15
+ 'to_string_able' => new ToStringStub('foobar'),
16
+ 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */
17
+ 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */
18
+ );
19
  --EXPECT--
20
  2
21
  3
22
  4
23
+ 6
24
+ 42
25
+ 1
vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test CHANGED
@@ -4,9 +4,21 @@
4
  {{ " I like Twig. "|trim }}
5
  {{ text|trim }}
6
  {{ " foo/"|trim("/") }}
 
 
 
 
 
 
7
  --DATA--
8
  return array('text' => " If you have some <strong>HTML</strong> it will be escaped. ")
9
  --EXPECT--
10
  I like Twig.
11
  If you have some &lt;strong&gt;HTML&lt;/strong&gt; it will be escaped.
12
  foo
 
 
 
 
 
 
4
  {{ " I like Twig. "|trim }}
5
  {{ text|trim }}
6
  {{ " foo/"|trim("/") }}
7
+ {{ "xxxI like Twig.xxx"|trim(character_mask="x", side="left") }}
8
+ {{ "xxxI like Twig.xxx"|trim(side="right", character_mask="x") }}
9
+ {{ "xxxI like Twig.xxx"|trim("x", "right") }}
10
+ {{ "/ foo/"|trim("/", "left") }}
11
+ {{ "/ foo/"|trim(character_mask="/", side="left") }}
12
+ {{ " do nothing. "|trim("", "right") }}
13
  --DATA--
14
  return array('text' => " If you have some <strong>HTML</strong> it will be escaped. ")
15
  --EXPECT--
16
  I like Twig.
17
  If you have some &lt;strong&gt;HTML&lt;/strong&gt; it will be escaped.
18
  foo
19
+ I like Twig.xxx
20
+ xxxI like Twig.
21
+ xxxI like Twig.
22
+ foo/
23
+ foo/
24
+ do nothing.
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test CHANGED
@@ -1,35 +1,28 @@
1
  --TEST--
2
  "empty" test
3
  --TEMPLATE--
4
- {{ foo is empty ? 'ok' : 'ko' }}
5
- {{ bar is empty ? 'ok' : 'ko' }}
6
- {{ foobar is empty ? 'ok' : 'ko' }}
7
- {{ array is empty ? 'ok' : 'ko' }}
8
- {{ zero is empty ? 'ok' : 'ko' }}
9
- {{ string is empty ? 'ok' : 'ko' }}
 
 
10
  {{ countable_empty is empty ? 'ok' : 'ko' }}
11
- {{ countable_not_empty is empty ? 'ok' : 'ko' }}
 
 
12
  {{ markup_empty is empty ? 'ok' : 'ko' }}
13
- {{ markup_not_empty is empty ? 'ok' : 'ko' }}
14
  --DATA--
15
-
16
- class CountableStub implements Countable
17
- {
18
- private $items;
19
-
20
- public function __construct(array $items)
21
- {
22
- $this->items = $items;
23
- }
24
-
25
- public function count()
26
- {
27
- return count($this->items);
28
- }
29
- }
30
  return array(
31
- 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0',
 
 
 
32
  'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)),
 
33
  'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'),
34
  );
35
  --EXPECT--
@@ -37,9 +30,13 @@ ok
37
  ok
38
  ok
39
  ok
40
- ko
41
- ko
42
  ok
43
- ko
44
  ok
45
- ko
 
 
 
 
 
 
 
1
  --TEST--
2
  "empty" test
3
  --TEMPLATE--
4
+ {{ string_empty is empty ? 'ok' : 'ko' }}
5
+ {{ string_zero is empty ? 'ko' : 'ok' }}
6
+ {{ value_null is empty ? 'ok' : 'ko' }}
7
+ {{ value_false is empty ? 'ok' : 'ko' }}
8
+ {{ value_int_zero is empty ? 'ko' : 'ok' }}
9
+ {{ array_empty is empty ? 'ok' : 'ko' }}
10
+ {{ array_not_empty is empty ? 'ko' : 'ok' }}
11
+ {{ magically_callable is empty ? 'ko' : 'ok' }}
12
  {{ countable_empty is empty ? 'ok' : 'ko' }}
13
+ {{ countable_not_empty is empty ? 'ko' : 'ok' }}
14
+ {{ tostring_empty is empty ? 'ok' : 'ko' }}
15
+ {{ tostring_not_empty is empty ? 'ko' : 'ok' }}
16
  {{ markup_empty is empty ? 'ok' : 'ko' }}
17
+ {{ markup_not_empty is empty ? 'ko' : 'ok' }}
18
  --DATA--
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  return array(
20
+ 'string_empty' => '', 'string_zero' => '0',
21
+ 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0,
22
+ 'array_empty' => array(), 'array_not_empty' => array(1, 2),
23
+ 'magically_callable' => new MagicCallStub(),
24
  'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)),
25
+ 'tostring_empty' => new ToStringStub(''), 'tostring_not_empty' => new ToStringStub('0' /* edge case of using "0" as the string */),
26
  'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'),
27
  );
28
  --EXPECT--
30
  ok
31
  ok
32
  ok
 
 
33
  ok
 
34
  ok
35
+ ok
36
+ ok
37
+ ok
38
+ ok
39
+ ok
40
+ ok
41
+ ok
42
+ ok
vendor/twig/twig/test/Twig/Tests/IntegrationTest.php CHANGED
@@ -252,3 +252,58 @@ class TwigTestExtension extends Twig_Extension
252
  return 'static_magic_'.$arguments[0];
253
  }
254
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  return 'static_magic_'.$arguments[0];
253
  }
254
  }
255
+
256
+ /**
257
+ * This class is used in tests for the "length" filter and "empty" test. It asserts that __call is not
258
+ * used to convert such objects to strings.
259
+ */
260
+ class MagicCallStub
261
+ {
262
+ public function __call($name, $args)
263
+ {
264
+ throw new Exception('__call shall not be called');
265
+ }
266
+ }
267
+
268
+ class ToStringStub
269
+ {
270
+ /**
271
+ * @var string
272
+ */
273
+ private $string;
274
+
275
+ public function __construct($string)
276
+ {
277
+ $this->string = $string;
278
+ }
279
+
280
+ public function __toString()
281
+ {
282
+ return $this->string;
283
+ }
284
+ }
285
+
286
+ /**
287
+ * This class is used in tests for the length filter and empty test to show
288
+ * that when \Countable is implemented, it is preferred over the __toString()
289
+ * method.
290
+ */
291
+ class CountableStub implements \Countable
292
+ {
293
+ private $count;
294
+
295
+ public function __construct($count)
296
+ {
297
+ $this->count = $count;
298
+ }
299
+
300
+ public function count()
301
+ {
302
+ return $this->count;
303
+ }
304
+
305
+ public function __toString()
306
+ {
307
+ throw new Exception('__toString shall not be called on \Countables');
308
+ }
309
+ }
vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php CHANGED
@@ -26,7 +26,7 @@ class Twig_Tests_LegacyIntegrationTest extends Twig_Test_IntegrationTestCase
26
  public function getTests($name, $legacyTests = false)
27
  {
28
  if (!$legacyTests) {
29
- return array(array('not', '-', '', array(), '', array()));
30
  }
31
 
32
  return parent::getTests($name, true);
26
  public function getTests($name, $legacyTests = false)
27
  {
28
  if (!$legacyTests) {
29
+ return array(array('', '', '', array(), '', array()));
30
  }
31
 
32
  return parent::getTests($name, true);
vendor/twig/twig/test/Twig/Tests/LexerTest.php CHANGED
@@ -116,7 +116,9 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
116
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
117
  $lexer->tokenize(new Twig_Source($template, 'index'));
118
 
119
- // should not throw an exception
 
 
120
  }
121
 
122
  public function testLongVerbatim()
@@ -126,7 +128,9 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
126
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
127
  $lexer->tokenize(new Twig_Source($template, 'index'));
128
 
129
- // should not throw an exception
 
 
130
  }
131
 
132
  public function testLongVar()
@@ -136,7 +140,9 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
136
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
137
  $lexer->tokenize(new Twig_Source($template, 'index'));
138
 
139
- // should not throw an exception
 
 
140
  }
141
 
142
  public function testLongBlock()
@@ -146,7 +152,9 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
146
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
147
  $lexer->tokenize(new Twig_Source($template, 'index'));
148
 
149
- // should not throw an exception
 
 
150
  }
151
 
152
  public function testBigNumbers()
@@ -171,6 +179,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
171
  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
172
  $stream->expect(Twig_Token::VAR_START_TYPE);
173
  $stream->expect(Twig_Token::STRING_TYPE, $expected);
 
 
 
 
174
  }
175
  }
176
 
@@ -189,6 +201,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
189
  $stream->expect(Twig_Token::NUMBER_TYPE, '1');
190
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
191
  $stream->expect(Twig_Token::VAR_END_TYPE);
 
 
 
 
192
  }
193
 
194
  public function testStringWithEscapedInterpolation()
@@ -200,6 +216,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
200
  $stream->expect(Twig_Token::VAR_START_TYPE);
201
  $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}');
202
  $stream->expect(Twig_Token::VAR_END_TYPE);
 
 
 
 
203
  }
204
 
205
  public function testStringWithHash()
@@ -211,6 +231,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
211
  $stream->expect(Twig_Token::VAR_START_TYPE);
212
  $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz');
213
  $stream->expect(Twig_Token::VAR_END_TYPE);
 
 
 
 
214
  }
215
 
216
  /**
@@ -240,6 +264,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
240
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
241
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
242
  $stream->expect(Twig_Token::VAR_END_TYPE);
 
 
 
 
243
  }
244
 
245
  public function testStringWithNestedInterpolationsInBlock()
@@ -258,6 +286,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
258
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
259
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
260
  $stream->expect(Twig_Token::BLOCK_END_TYPE);
 
 
 
 
261
  }
262
 
263
  public function testOperatorEndingWithALetterAtTheEndOfALine()
@@ -269,6 +301,10 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
269
  $stream->expect(Twig_Token::VAR_START_TYPE);
270
  $stream->expect(Twig_Token::NUMBER_TYPE, 1);
271
  $stream->expect(Twig_Token::OPERATOR_TYPE, 'and');
 
 
 
 
272
  }
273
 
274
  /**
116
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
117
  $lexer->tokenize(new Twig_Source($template, 'index'));
118
 
119
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
120
+ // can be executed without throwing any exceptions
121
+ $this->addToAssertionCount(1);
122
  }
123
 
124
  public function testLongVerbatim()
128
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
129
  $lexer->tokenize(new Twig_Source($template, 'index'));
130
 
131
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
132
+ // can be executed without throwing any exceptions
133
+ $this->addToAssertionCount(1);
134
  }
135
 
136
  public function testLongVar()
140
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
141
  $lexer->tokenize(new Twig_Source($template, 'index'));
142
 
143
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
144
+ // can be executed without throwing any exceptions
145
+ $this->addToAssertionCount(1);
146
  }
147
 
148
  public function testLongBlock()
152
  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
153
  $lexer->tokenize(new Twig_Source($template, 'index'));
154
 
155
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
156
+ // can be executed without throwing any exceptions
157
+ $this->addToAssertionCount(1);
158
  }
159
 
160
  public function testBigNumbers()
179
  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
180
  $stream->expect(Twig_Token::VAR_START_TYPE);
181
  $stream->expect(Twig_Token::STRING_TYPE, $expected);
182
+
183
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
184
+ // can be executed without throwing any exceptions
185
+ $this->addToAssertionCount(1);
186
  }
187
  }
188
 
201
  $stream->expect(Twig_Token::NUMBER_TYPE, '1');
202
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
203
  $stream->expect(Twig_Token::VAR_END_TYPE);
204
+
205
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
206
+ // can be executed without throwing any exceptions
207
+ $this->addToAssertionCount(1);
208
  }
209
 
210
  public function testStringWithEscapedInterpolation()
216
  $stream->expect(Twig_Token::VAR_START_TYPE);
217
  $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}');
218
  $stream->expect(Twig_Token::VAR_END_TYPE);
219
+
220
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
221
+ // can be executed without throwing any exceptions
222
+ $this->addToAssertionCount(1);
223
  }
224
 
225
  public function testStringWithHash()
231
  $stream->expect(Twig_Token::VAR_START_TYPE);
232
  $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz');
233
  $stream->expect(Twig_Token::VAR_END_TYPE);
234
+
235
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
236
+ // can be executed without throwing any exceptions
237
+ $this->addToAssertionCount(1);
238
  }
239
 
240
  /**
264
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
265
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
266
  $stream->expect(Twig_Token::VAR_END_TYPE);
267
+
268
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
269
+ // can be executed without throwing any exceptions
270
+ $this->addToAssertionCount(1);
271
  }
272
 
273
  public function testStringWithNestedInterpolationsInBlock()
286
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
287
  $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
288
  $stream->expect(Twig_Token::BLOCK_END_TYPE);
289
+
290
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
291
+ // can be executed without throwing any exceptions
292
+ $this->addToAssertionCount(1);
293
  }
294
 
295
  public function testOperatorEndingWithALetterAtTheEndOfALine()
301
  $stream->expect(Twig_Token::VAR_START_TYPE);
302
  $stream->expect(Twig_Token::NUMBER_TYPE, 1);
303
  $stream->expect(Twig_Token::OPERATOR_TYPE, 'and');
304
+
305
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
306
+ // can be executed without throwing any exceptions
307
+ $this->addToAssertionCount(1);
308
  }
309
 
310
  /**
vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php CHANGED
@@ -46,7 +46,29 @@ class Twig_Tests_Loader_ArrayTest extends PHPUnit_Framework_TestCase
46
  {
47
  $loader = new Twig_Loader_Array(array('foo' => 'bar'));
48
 
49
- $this->assertEquals('bar', $loader->getCacheKey('foo'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  /**
@@ -91,7 +113,11 @@ class Twig_Tests_Loader_ArrayTest extends PHPUnit_Framework_TestCase
91
  $loader->getCacheKey($name);
92
  $loader->getSourceContext($name);
93
  $loader->isFresh($name, time());
94
- $loader->setTemplate($name, 'foobar');
 
 
 
 
95
  }
96
  }
97
 
46
  {
47
  $loader = new Twig_Loader_Array(array('foo' => 'bar'));
48
 
49
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
50
+ }
51
+
52
+ public function testGetCacheKeyWhenTemplateHasDuplicateContent()
53
+ {
54
+ $loader = new Twig_Loader_Array(array(
55
+ 'foo' => 'bar',
56
+ 'baz' => 'bar',
57
+ ));
58
+
59
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
60
+ $this->assertEquals('baz:bar', $loader->getCacheKey('baz'));
61
+ }
62
+
63
+ public function testGetCacheKeyIsProtectedFromEdgeCollisions()
64
+ {
65
+ $loader = new Twig_Loader_Array(array(
66
+ 'foo__' => 'bar',
67
+ 'foo' => '__bar',
68
+ ));
69
+
70
+ $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__'));
71
+ $this->assertEquals('foo:__bar', $loader->getCacheKey('foo'));
72
  }
73
 
74
  /**
113
  $loader->getCacheKey($name);
114
  $loader->getSourceContext($name);
115
  $loader->isFresh($name, time());
116
+ $loader->setTemplate($name, 'foo:bar');
117
+
118
+ // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
119
+ // can be executed without crashing PHP
120
+ $this->addToAssertionCount(1);
121
  }
122
  }
123
 
vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php CHANGED
@@ -74,8 +74,8 @@ class Twig_Tests_Loader_ChainTest extends PHPUnit_Framework_TestCase
74
  new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')),
75
  ));
76
 
77
- $this->assertEquals('bar', $loader->getCacheKey('foo'));
78
- $this->assertEquals('foo', $loader->getCacheKey('bar'));
79
  }
80
 
81
  /**
74
  new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')),
75
  ));
76
 
77
+ $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
78
+ $this->assertEquals('bar:foo', $loader->getCacheKey('bar'));
79
  }
80
 
81
  /**
vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php CHANGED
@@ -37,7 +37,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase
37
  public function testRenderVariableBlockOptimizer()
38
  {
39
  if (PHP_VERSION_ID >= 50400) {
40
- return;
41
  }
42
 
43
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
37
  public function testRenderVariableBlockOptimizer()
38
  {
39
  if (PHP_VERSION_ID >= 50400) {
40
+ $this->markTestSkipped('not needed on PHP >= 5.4');
41
  }
42
 
43
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
vendor/twig/twig/test/Twig/Tests/ParserTest.php CHANGED
@@ -131,9 +131,6 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
131
  $this->assertNull($parser->getParent());
132
  }
133
 
134
- // The getVarName() must not depend on the template loaders,
135
- // If this test does not throw any exception, that's good.
136
- // see https://github.com/symfony/symfony/issues/4218
137
  public function testGetVarName()
138
  {
139
  $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
@@ -149,6 +146,11 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
149
  {% endmacro %}
150
  EOF
151
  , 'index')));
 
 
 
 
 
152
  }
153
 
154
  protected function getParser()
131
  $this->assertNull($parser->getParent());
132
  }
133
 
 
 
 
134
  public function testGetVarName()
135
  {
136
  $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
146
  {% endmacro %}
147
  EOF
148
  , 'index')));
149
+
150
+ // The getVarName() must not depend on the template loaders,
151
+ // If this test does not throw any exception, that's good.
152
+ // see https://github.com/symfony/symfony/issues/4218
153
+ $this->addToAssertionCount(1);
154
  }
155
 
156
  protected function getParser()
vendor/twig/twig/test/Twig/Tests/TemplateTest.php CHANGED
@@ -83,10 +83,14 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
83
 
84
  if (!$allowed) {
85
  $this->fail();
 
 
86
  }
87
  } catch (Twig_Sandbox_SecurityError $e) {
88
  if ($allowed) {
89
  $this->fail();
 
 
90
  }
91
 
92
  $this->assertContains('is not allowed', $e->getMessage());
@@ -255,15 +259,15 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
255
  if ($defined) {
256
  $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
257
  } else {
258
- try {
259
- $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
260
-
261
- throw new Exception('Expected Twig_Error_Runtime exception.');
262
- } catch (Twig_Error_Runtime $e) {
263
  if (null !== $exceptionMessage) {
264
- $this->assertSame($exceptionMessage, $e->getMessage());
265
  }
 
 
266
  }
 
267
  }
268
  }
269
 
@@ -420,6 +424,19 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
420
 
421
  return $tests;
422
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
424
 
425
  class Twig_TemplateTest extends Twig_Template
@@ -576,7 +593,13 @@ class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject
576
 
577
  class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess
578
  {
579
- private $data = array();
 
 
 
 
 
 
580
 
581
  public function offsetExists($offset)
582
  {
@@ -659,6 +682,17 @@ class Twig_TemplateMethodObject
659
  }
660
  }
661
 
 
 
 
 
 
 
 
 
 
 
 
662
  class Twig_TemplateMethodAndPropObject
663
  {
664
  private $a = 'a_prop';
83
 
84
  if (!$allowed) {
85
  $this->fail();
86
+ } else {
87
+ $this->addToAssertionCount(1);
88
  }
89
  } catch (Twig_Sandbox_SecurityError $e) {
90
  if ($allowed) {
91
  $this->fail();
92
+ } else {
93
+ $this->addToAssertionCount(1);
94
  }
95
 
96
  $this->assertContains('is not allowed', $e->getMessage());
259
  if ($defined) {
260
  $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
261
  } else {
262
+ if (method_exists($this, 'expectException')) {
263
+ $this->expectException('Twig_Error_Runtime');
 
 
 
264
  if (null !== $exceptionMessage) {
265
+ $this->expectExceptionMessage($exceptionMessage);
266
  }
267
+ } else {
268
+ $this->setExpectedException('Twig_Error_Runtime', $exceptionMessage);
269
  }
270
+ $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
271
  }
272
  }
273
 
424
 
425
  return $tests;
426
  }
427
+
428
+ /**
429
+ * @expectedException Twig_Error_Runtime
430
+ */
431
+ public function testGetIsMethods()
432
+ {
433
+ $getIsObject = new Twig_TemplateGetIsMethods();
434
+ $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)));
435
+ // first time should not create a cache for "get"
436
+ $this->assertNull($template->getAttribute($getIsObject, 'get'));
437
+ // 0 should be in the method cache now, so this should fail
438
+ $this->assertNull($template->getAttribute($getIsObject, 0));
439
+ }
440
  }
441
 
442
  class Twig_TemplateTest extends Twig_Template
593
 
594
  class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess
595
  {
596
+ private $data = array(
597
+ 'defined' => 'defined',
598
+ 'zero' => 0,
599
+ 'null' => null,
600
+ 'bar' => true,
601
+ 'baz' => 'baz',
602
+ );
603
 
604
  public function offsetExists($offset)
605
  {
682
  }
683
  }
684
 
685
+ class Twig_TemplateGetIsMethods
686
+ {
687
+ public function get()
688
+ {
689
+ }
690
+
691
+ public function is()
692
+ {
693
+ }
694
+ }
695
+
696
  class Twig_TemplateMethodAndPropObject
697
  {
698
  private $a = 'a_prop';
vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php CHANGED
@@ -52,8 +52,8 @@ class Twig_Tests_TokenStreamTest extends PHPUnit_Framework_TestCase
52
  }
53
 
54
  /**
55
- * @expectedException Twig_Error_Syntax
56
- * @expectedMessage Unexpected end of template
57
  */
58
  public function testEndOfTemplateNext()
59
  {
@@ -66,8 +66,8 @@ class Twig_Tests_TokenStreamTest extends PHPUnit_Framework_TestCase
66
  }
67
 
68
  /**
69
- * @expectedException Twig_Error_Syntax
70
- * @expectedMessage Unexpected end of template
71
  */
72
  public function testEndOfTemplateLook()
73
  {
52
  }
53
 
54
  /**
55
+ * @expectedException Twig_Error_Syntax
56
+ * @expectedExceptionMessage Unexpected end of template
57
  */
58
  public function testEndOfTemplateNext()
59
  {
66
  }
67
 
68
  /**
69
+ * @expectedException Twig_Error_Syntax
70
+ * @expectedExceptionMessage Unexpected end of template
71
  */
72
  public function testEndOfTemplateLook()
73
  {
vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Twig_Tests_Util_DeprecationCollectorTest extends PHPUnit_Framework_TestCase
13
+ {
14
+ /**
15
+ * @requires PHP 5.3
16
+ */
17
+ public function testCollect()
18
+ {
19
+ $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
20
+ $twig->addFunction(new Twig_SimpleFunction('deprec', array($this, 'deprec'), array('deprecated' => true)));
21
+
22
+ $collector = new Twig_Util_DeprecationCollector($twig);
23
+ $deprecations = $collector->collect(new Twig_Tests_Util_Iterator());
24
+
25
+ $this->assertEquals(array('Twig Function "deprec" is deprecated in deprec.twig at line 1.'), $deprecations);
26
+ }
27
+
28
+ public function deprec()
29
+ {
30
+ }
31
+ }
32
+
33
+ class Twig_Tests_Util_Iterator implements IteratorAggregate
34
+ {
35
+ public function getIterator()
36
+ {
37
+ return new ArrayIterator(array(
38
+ 'ok.twig' => '{{ foo }}',
39
+ 'deprec.twig' => '{{ deprec("foo") }}',
40
+ ));
41
+ }
42
+ }
vendor/twig/twig/test/bootstrap.php CHANGED
@@ -9,5 +9,13 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- require_once dirname(__FILE__).'/../lib/Twig/Autoloader.php';
13
- Twig_Autoloader::register(true);
 
 
 
 
 
 
 
 
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
+ }