Photo Gallery by Supsystic - Version 1.14.8

Version Description

Download this release

Release Info

Developer supsystic.com
Plugin Icon 128x128 Photo Gallery by Supsystic
Version 1.14.8
Comparing to
See all releases

Code changes from version 1.13.9 to 1.14.8

Files changed (221) hide show
  1. app/assets/css/supsystic-ui.css +13 -9
  2. app/templates/grid-gallery.twig +11 -11
  3. index.php +2 -2
  4. readme.txt +48 -2
  5. src/GridGallery/Core/Module.php +5 -5
  6. src/GridGallery/Galleries/Controller.php +2 -2
  7. src/GridGallery/Galleries/Module.php +15 -15
  8. src/GridGallery/Galleries/assets/css/grid-gallery.galleries.effects.css +9 -4
  9. src/GridGallery/Galleries/assets/css/grid-gallery.galleries.frontend.css +56 -1
  10. src/GridGallery/Galleries/assets/css/photobox.css +4 -1
  11. src/GridGallery/Galleries/assets/css/prettyPhoto.css +7 -7
  12. src/GridGallery/Galleries/assets/js/frontend.js +74 -15
  13. src/GridGallery/Galleries/assets/js/lib/jquery.easing.js +4 -2
  14. src/GridGallery/Galleries/assets/js/lib/jquery.prettyphoto.js +12 -12
  15. src/GridGallery/Galleries/configs/tooltips.php +1 -1
  16. src/GridGallery/Galleries/views/r314/shortcode/helpers.twig +3 -3
  17. src/GridGallery/Galleries/views/settings.twig +2 -2
  18. src/GridGallery/Galleries/views/shortcode/gallery.twig +8 -8
  19. src/GridGallery/Galleries/views/shortcode/helpers.twig +8 -4
  20. src/GridGallery/Overview/Controller.php +4 -11
  21. src/GridGallery/SocialSharing/Module.php +3 -3
  22. vendor/Rsc/ClassLoader.php +21 -3
  23. vendor/Rsc/Environment.php +9 -9
  24. vendor/Rsc/Resolver.php +3 -3
  25. vendor/Twig/Autoloader.php +5 -5
  26. vendor/Twig/BaseNodeVisitor.php +12 -12
  27. vendor/Twig/Cache/Filesystem.php +1 -1
  28. vendor/Twig/Cache/Null.php +1 -1
  29. vendor/Twig/CacheInterface.php +1 -1
  30. vendor/Twig/Compiler.php +8 -8
  31. vendor/Twig/CompilerInterface.php +2 -2
  32. vendor/Twig/ContainerRuntimeLoader.php +1 -1
  33. vendor/Twig/Environment.php +143 -143
  34. vendor/Twig/Error.php +8 -8
  35. vendor/Twig/Error/Loader.php +3 -3
  36. vendor/Twig/Error/Runtime.php +1 -1
  37. vendor/Twig/Error/Syntax.php +1 -1
  38. vendor/Twig/ExistsLoaderInterface.php +1 -1
  39. vendor/Twig/ExpressionParser.php +136 -136
  40. vendor/Twig/Extension.php +4 -4
  41. vendor/Twig/Extension/Core.php +226 -226
  42. vendor/Twig/Extension/Debug.php +4 -4
  43. vendor/Twig/Extension/Escaper.php +6 -6
  44. vendor/Twig/Extension/GlobalsInterface.php +2 -2
  45. vendor/Twig/Extension/InitRuntimeInterface.php +2 -2
  46. vendor/Twig/Extension/Optimizer.php +2 -2
  47. vendor/Twig/Extension/Profiler.php +5 -5
  48. vendor/Twig/Extension/Sandbox.php +5 -5
  49. vendor/Twig/Extension/Staging.php +4 -4
  50. vendor/Twig/Extension/StringLoader.php +5 -5
  51. vendor/Twig/ExtensionInterface.php +9 -9
  52. vendor/Twig/FactoryRuntimeLoader.php +1 -1
  53. vendor/Twig/FileExtensionEscapingStrategy.php +1 -1
  54. vendor/Twig/Filter.php +4 -4
  55. vendor/Twig/Filter/Function.php +3 -3
  56. vendor/Twig/Filter/Method.php +4 -4
  57. vendor/Twig/Filter/Node.php +3 -3
  58. vendor/Twig/FilterCallableInterface.php +2 -2
  59. vendor/Twig/FilterInterface.php +3 -3
  60. vendor/Twig/Function.php +4 -4
  61. vendor/Twig/Function/Function.php +3 -3
  62. vendor/Twig/Function/Method.php +4 -4
  63. vendor/Twig/Function/Node.php +3 -3
  64. vendor/Twig/FunctionCallableInterface.php +2 -2
  65. vendor/Twig/FunctionInterface.php +3 -3
  66. vendor/Twig/Lexer.php +32 -32
  67. vendor/Twig/LexerInterface.php +4 -4
  68. vendor/Twig/Loader/Array.php +6 -6
  69. vendor/Twig/Loader/Chain.php +20 -20
  70. vendor/Twig/Loader/Filesystem.php +13 -13
  71. vendor/Twig/Loader/String.php +3 -3
  72. vendor/Twig/LoaderInterface.php +5 -5
  73. vendor/Twig/Markup.php +1 -1
  74. vendor/Twig/Node.php +9 -9
  75. vendor/Twig/Node/AutoEscape.php +3 -3
  76. vendor/Twig/Node/Block.php +3 -3
  77. vendor/Twig/Node/BlockReference.php +2 -2
  78. vendor/Twig/Node/Body.php +1 -1
  79. vendor/Twig/Node/CheckSecurity.php +8 -8
  80. vendor/Twig/Node/Do.php +3 -3
  81. vendor/Twig/Node/Embed.php +4 -4
  82. vendor/Twig/Node/Expression.php +1 -1
  83. vendor/Twig/Node/Expression/Array.php +6 -6
  84. vendor/Twig/Node/Expression/AssignName.php +2 -2
  85. vendor/Twig/Node/Expression/Binary.php +4 -4
  86. vendor/Twig/Node/Expression/Binary/Add.php +2 -2
  87. vendor/Twig/Node/Expression/Binary/And.php +2 -2
  88. vendor/Twig/Node/Expression/Binary/BitwiseAnd.php +2 -2
  89. vendor/Twig/Node/Expression/Binary/BitwiseOr.php +2 -2
  90. vendor/Twig/Node/Expression/Binary/BitwiseXor.php +2 -2
  91. vendor/Twig/Node/Expression/Binary/Concat.php +2 -2
  92. vendor/Twig/Node/Expression/Binary/Div.php +2 -2
  93. vendor/Twig/Node/Expression/Binary/EndsWith.php +3 -3
  94. vendor/Twig/Node/Expression/Binary/Equal.php +2 -2
  95. vendor/Twig/Node/Expression/Binary/FloorDiv.php +3 -3
  96. vendor/Twig/Node/Expression/Binary/Greater.php +2 -2
  97. vendor/Twig/Node/Expression/Binary/GreaterEqual.php +2 -2
  98. vendor/Twig/Node/Expression/Binary/In.php +4 -4
  99. vendor/Twig/Node/Expression/Binary/Less.php +2 -2
  100. vendor/Twig/Node/Expression/Binary/LessEqual.php +2 -2
  101. vendor/Twig/Node/Expression/Binary/Matches.php +3 -3
  102. vendor/Twig/Node/Expression/Binary/Mod.php +2 -2
  103. vendor/Twig/Node/Expression/Binary/Mul.php +2 -2
  104. vendor/Twig/Node/Expression/Binary/NotEqual.php +2 -2
  105. vendor/Twig/Node/Expression/Binary/NotIn.php +4 -4
  106. vendor/Twig/Node/Expression/Binary/Or.php +2 -2
  107. vendor/Twig/Node/Expression/Binary/Power.php +3 -3
  108. vendor/Twig/Node/Expression/Binary/Range.php +3 -3
  109. vendor/Twig/Node/Expression/Binary/StartsWith.php +3 -3
  110. vendor/Twig/Node/Expression/Binary/Sub.php +2 -2
  111. vendor/Twig/Node/Expression/BlockReference.php +6 -6
  112. vendor/Twig/Node/Expression/Call.php +13 -13
  113. vendor/Twig/Node/Expression/Conditional.php +3 -3
  114. vendor/Twig/Node/Expression/Constant.php +2 -2
  115. vendor/Twig/Node/Expression/ExtensionReference.php +3 -3
  116. vendor/Twig/Node/Expression/Filter.php +5 -5
  117. vendor/Twig/Node/Expression/Filter/Default.php +8 -8
  118. vendor/Twig/Node/Expression/Function.php +6 -6
  119. vendor/Twig/Node/Expression/GetAttr.php +6 -6
  120. vendor/Twig/Node/Expression/MethodCall.php +4 -4
  121. vendor/Twig/Node/Expression/Name.php +2 -2
  122. vendor/Twig/Node/Expression/NullCoalesce.php +7 -7
  123. vendor/Twig/Node/Expression/Parent.php +2 -2
  124. vendor/Twig/Node/Expression/TempName.php +2 -2
  125. vendor/Twig/Node/Expression/Test.php +5 -5
  126. vendor/Twig/Node/Expression/Test/Constant.php +2 -2
  127. vendor/Twig/Node/Expression/Test/Defined.php +12 -12
  128. vendor/Twig/Node/Expression/Test/Divisibleby.php +2 -2
  129. vendor/Twig/Node/Expression/Test/Even.php +2 -2
  130. vendor/Twig/Node/Expression/Test/Null.php +2 -2
  131. vendor/Twig/Node/Expression/Test/Odd.php +2 -2
  132. vendor/Twig/Node/Expression/Test/Sameas.php +2 -2
  133. vendor/Twig/Node/Expression/Unary.php +4 -4
  134. vendor/Twig/Node/Expression/Unary/Neg.php +2 -2
  135. vendor/Twig/Node/Expression/Unary/Not.php +2 -2
  136. vendor/Twig/Node/Expression/Unary/Pos.php +2 -2
  137. vendor/Twig/Node/Flush.php +2 -2
  138. vendor/Twig/Node/For.php +6 -6
  139. vendor/Twig/Node/ForLoop.php +2 -2
  140. vendor/Twig/Node/If.php +3 -3
  141. vendor/Twig/Node/Import.php +4 -4
  142. vendor/Twig/Node/Include.php +6 -6
  143. vendor/Twig/Node/Macro.php +5 -5
  144. vendor/Twig/Node/Module.php +37 -37
  145. vendor/Twig/Node/Print.php +3 -3
  146. vendor/Twig/Node/Sandbox.php +4 -4
  147. vendor/Twig/Node/SandboxedPrint.php +7 -7
  148. vendor/Twig/Node/Set.php +8 -8
  149. vendor/Twig/Node/SetTemp.php +2 -2
  150. vendor/Twig/Node/Spaceless.php +3 -3
  151. vendor/Twig/Node/Text.php +2 -2
  152. vendor/Twig/Node/With.php +4 -4
  153. vendor/Twig/NodeCaptureInterface.php +1 -1
  154. vendor/Twig/NodeInterface.php +2 -2
  155. vendor/Twig/NodeOutputInterface.php +1 -1
  156. vendor/Twig/NodeTraverser.php +9 -9
  157. vendor/Twig/NodeVisitor/Escaper.php +24 -24
  158. vendor/Twig/NodeVisitor/Optimizer.php +37 -37
  159. vendor/Twig/NodeVisitor/SafeAnalysis.php +13 -13
  160. vendor/Twig/NodeVisitor/Sandbox.php +11 -11
  161. vendor/Twig/NodeVisitorInterface.php +6 -6
  162. vendor/Twig/Parser.php +39 -39
  163. vendor/Twig/ParserInterface.php +4 -4
  164. vendor/Twig/Profiler/Dumper/Blackfire.php +4 -4
  165. vendor/Twig/Profiler/Dumper/Html.php +5 -5
  166. vendor/Twig/Profiler/Dumper/Text.php +6 -6
  167. vendor/Twig/Profiler/Node/EnterProfile.php +3 -3
  168. vendor/Twig/Profiler/Node/LeaveProfile.php +2 -2
  169. vendor/Twig/Profiler/NodeVisitor/Profiler.php +14 -14
  170. vendor/Twig/Profiler/Profile.php +2 -2
  171. vendor/Twig/RuntimeLoaderInterface.php +1 -1
  172. vendor/Twig/Sandbox/SecurityError.php +1 -1
  173. vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php +1 -1
  174. vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php +1 -1
  175. vendor/Twig/Sandbox/SecurityNotAllowedMethodError.php +1 -1
  176. vendor/Twig/Sandbox/SecurityNotAllowedPropertyError.php +1 -1
  177. vendor/Twig/Sandbox/SecurityNotAllowedTagError.php +1 -1
  178. vendor/Twig/Sandbox/SecurityPolicy.php +7 -7
  179. vendor/Twig/Sandbox/SecurityPolicyInterface.php +1 -1
  180. vendor/Twig/SimpleFilter.php +3 -3
  181. vendor/Twig/SimpleFunction.php +3 -3
  182. vendor/Twig/SimpleTest.php +2 -2
  183. vendor/Twig/Source.php +1 -1
  184. vendor/Twig/SourceContextLoaderInterface.php +3 -3
  185. vendor/Twig/Template.php +35 -35
  186. vendor/Twig/TemplateInterface.php +2 -2
  187. vendor/Twig/TemplateWrapper.php +4 -4
  188. vendor/Twig/Test.php +2 -2
  189. vendor/Twig/Test/Function.php +2 -2
  190. vendor/Twig/Test/IntegrationTestCase.php +11 -11
  191. vendor/Twig/Test/Method.php +3 -3
  192. vendor/Twig/Test/Node.php +2 -2
  193. vendor/Twig/Test/NodeTestCase.php +7 -7
  194. vendor/Twig/TestCallableInterface.php +1 -1
  195. vendor/Twig/TestInterface.php +1 -1
  196. vendor/Twig/Token.php +2 -2
  197. vendor/Twig/TokenParser.php +3 -3
  198. vendor/Twig/TokenParser/AutoEscape.php +11 -11
  199. vendor/Twig/TokenParser/Block.php +13 -13
  200. vendor/Twig/TokenParser/Do.php +4 -4
  201. vendor/Twig/TokenParser/Embed.php +13 -13
  202. vendor/Twig/TokenParser/Extends.php +5 -5
  203. vendor/Twig/TokenParser/Filter.php +8 -8
  204. vendor/Twig/TokenParser/Flush.php +4 -4
  205. vendor/Twig/TokenParser/For.php +22 -22
  206. vendor/Twig/TokenParser/From.php +8 -8
  207. vendor/Twig/TokenParser/If.php +10 -10
  208. vendor/Twig/TokenParser/Import.php +5 -5
  209. vendor/Twig/TokenParser/Include.php +8 -8
  210. vendor/Twig/TokenParser/Macro.php +9 -9
  211. vendor/Twig/TokenParser/Sandbox.php +10 -10
  212. vendor/Twig/TokenParser/Set.php +10 -10
  213. vendor/Twig/TokenParser/Spaceless.php +6 -6
  214. vendor/Twig/TokenParser/Use.php +10 -10
  215. vendor/Twig/TokenParser/With.php +8 -8
  216. vendor/Twig/TokenParserBroker.php +13 -13
  217. vendor/Twig/TokenParserBrokerInterface.php +6 -6
  218. vendor/Twig/TokenParserInterface.php +5 -5
  219. vendor/Twig/TokenStream.php +16 -16
  220. vendor/Twig/Util/DeprecationCollector.php +5 -5
  221. vendor/Twig/Util/TemplateDirIterator.php +1 -1
app/assets/css/supsystic-ui.css CHANGED
@@ -436,10 +436,10 @@ input[type=checkbox] + label:before {
436
  display: inline-block;
437
  }
438
 
439
- input[type=checkbox] + label:before { content: "\f096"; }
440
- input[type=checkbox] + label:before { letter-spacing: 10px; }
441
 
442
- input[type=checkbox]:checked + label:before { content: "\f046"; }
443
  input[type=checkbox]:checked + label:before { letter-spacing: 5px; } */
444
 
445
  .supsystic-plugin input[type=radio] {
@@ -559,7 +559,7 @@ h2 .nav-tab.active{
559
  .supsystic-plugin .button.focus,
560
  .supsystic-plugin .button:focus,
561
  .ui-button.ui-state-hover,
562
- .ui-button:hover,
563
  .ui-button:focus,
564
  .ui-dialog .button:hover,
565
  .ui-dialog .button:focus {
@@ -849,7 +849,7 @@ table[name="cats"] {
849
  .sgg-tutorial-step-2 .wp-pointer-arrow {
850
  left:150px;
851
  }
852
- .sgg-tutorial-step-4 .wp-pointer-arrow,
853
  .sgg-tutorial-step-7 .wp-pointer-arrow,
854
  .sgg-tutorial-step-8 .wp-pointer-arrow,
855
  .sgg-tutorial-step-9 .wp-pointer-arrow,
@@ -861,7 +861,7 @@ table[name="cats"] {
861
  border-right-color: #00a0d2;
862
  }
863
 
864
- .sgg-tutorial-step-7 .wp-pointer-arrow-inner,
865
  .sgg-tutorial-step-8 .wp-pointer-arrow-inner,
866
  .sgg-tutorial-step-9 .wp-pointer-arrow-inner,
867
  .sgg-tutorial-step-10 .wp-pointer-arrow-inner {
@@ -881,11 +881,15 @@ table[name="cats"] {
881
  outline: none!important;
882
  }
883
  /*****/
884
-
 
 
885
  #galleries a{
886
  color: black;
887
  }
888
-
889
  .gg-link-option label{
890
  display: block;
891
- }
 
 
 
436
  display: inline-block;
437
  }
438
 
439
+ input[type=checkbox] + label:before { content: "\f096"; }
440
+ input[type=checkbox] + label:before { letter-spacing: 10px; }
441
 
442
+ input[type=checkbox]:checked + label:before { content: "\f046"; }
443
  input[type=checkbox]:checked + label:before { letter-spacing: 5px; } */
444
 
445
  .supsystic-plugin input[type=radio] {
559
  .supsystic-plugin .button.focus,
560
  .supsystic-plugin .button:focus,
561
  .ui-button.ui-state-hover,
562
+ .ui-button:hover,
563
  .ui-button:focus,
564
  .ui-dialog .button:hover,
565
  .ui-dialog .button:focus {
849
  .sgg-tutorial-step-2 .wp-pointer-arrow {
850
  left:150px;
851
  }
852
+ .sgg-tutorial-step-4 .wp-pointer-arrow,
853
  .sgg-tutorial-step-7 .wp-pointer-arrow,
854
  .sgg-tutorial-step-8 .wp-pointer-arrow,
855
  .sgg-tutorial-step-9 .wp-pointer-arrow,
861
  border-right-color: #00a0d2;
862
  }
863
 
864
+ .sgg-tutorial-step-7 .wp-pointer-arrow-inner,
865
  .sgg-tutorial-step-8 .wp-pointer-arrow-inner,
866
  .sgg-tutorial-step-9 .wp-pointer-arrow-inner,
867
  .sgg-tutorial-step-10 .wp-pointer-arrow-inner {
881
  outline: none!important;
882
  }
883
  /*****/
884
+ .ui-dialog .button-primary.button-hero {
885
+ line-height: 46px;
886
+ }
887
  #galleries a{
888
  color: black;
889
  }
 
890
  .gg-link-option label{
891
  display: block;
892
+ }
893
+ .button.button-hero {
894
+ line-height: 46px !important;
895
+ }
app/templates/grid-gallery.twig CHANGED
@@ -17,19 +17,19 @@
17
  <section class="supsystic-content">
18
  <nav class="supsystic-navigation supsystic-sticky" style="top: 0px;">
19
  <ul>
20
- <li class="supsystic-sticky {% if request.query.module == 'overview' %}active{% endif %}">
21
  <a href="{{ environment.generateUrl('overview') }}">
22
  <i class="fa fa-info"></i>
23
  <span class="gg-sps-sticky-link">{{ translate('Overview') }}</span>
24
  </a>
25
  </li>
26
- <li {% if request.query.module == 'galleries' and request.query.action == 'showPresets' %}class="active" {% endif %}>
27
  <a id="btn-add-new" href="{{ environment.generateUrl('galleries', 'showPresets') }}">
28
  <i class="fa fa-plus-circle"></i>
29
  <span class="gg-sps-sticky-link">{{ translate('New Gallery') }}</span>
30
  </a>
31
  </li>
32
- <li class="supsystic-sticky {% if (request.query.module == 'galleries' or request.query.module is null) and request.query.action != 'showPresets' %}active{% endif %}">
33
  <a href="{{ environment.generateUrl('galleries') }}">
34
  <i class="fa fa-archive"></i>
35
  <span class="gg-sps-sticky-link">{{ translate('Galleries') }}</span>
@@ -42,23 +42,23 @@
42
  </a>
43
  </li>
44
 
45
- <li class="supsystic-sticky {% if request.query.module == 'settings' %}active{% endif %}">
46
  <a href="{{ environment.generateUrl('settings') }}">
47
  <i class="fa fa-gear"></i>
48
  <span class="gg-sps-sticky-link">{{ translate('Advanced Settings') }}</span>
49
  </a>
50
  </li>
51
-
52
  {% if environment.getModule('license') %}
53
- <li class="supsystic-sticky {% if (request.query.module == 'license') %}active{% endif %}">
54
  <a href="{{ environment.generateUrl('license') }}">
55
  <i class="fa fa-hand-o-right"></i>
56
  <span class="gg-sps-sticky-link">{{ translate('License') }}</span>
57
  </a>
58
  </li>
59
  {% endif %}
60
-
61
- <li class="supsystic-sticky {% if request.query.module == 'featuredplugins' %}active{% endif %}">
62
  <a href="{{ environment.generateUrl('featuredplugins') }}">
63
  <i class="fa fa-heart"></i>
64
  <span class="gg-sps-sticky-link">{{ translate('Featured Plugins') }}</span>
@@ -66,7 +66,7 @@
66
  </li>
67
 
68
  {# Uncomment to enable images tab #}
69
- {#<li class="supsystic-sticky {% if request.query.module == 'photos' or request.query.module is null %}active{% endif %}">
70
  <a href="{{ environment.generateUrl('photos') }}">
71
  <i class="fa fa-picture-o"></i>
72
  {{ environment.translate('Images') }}
@@ -74,13 +74,13 @@
74
  </li>#}
75
 
76
  {# Ucomment to enable social tabs #}
77
- {#<li class="supsystic-sticky {% if request.query.module == 'insta' or request.query.module is null %}active{% endif %}">
78
  <a href="{{ environment.generateUrl('insta') }}">
79
  <i class="fa fa-instagram"></i>
80
  {{ environment.translate('Instagram') }}
81
  </a>
82
  </li>
83
- <li {% if environment.isPro() == false %} class="supsystic-pro" {% endif %} class="supsystic-sticky {% if request.query.module == 'flickr' or request.query.module is null %}active{% endif %}">
84
  {% if environment.isPro() == false %}
85
  <a href="http://supsystic.com/plugins/photo-gallery/">
86
  <i class="fa fa-unlock"></i>
17
  <section class="supsystic-content">
18
  <nav class="supsystic-navigation supsystic-sticky" style="top: 0px;">
19
  <ul>
20
+ <li class="supsystic-sticky {% if request.query.module == 'overview' %} active{% endif %}">
21
  <a href="{{ environment.generateUrl('overview') }}">
22
  <i class="fa fa-info"></i>
23
  <span class="gg-sps-sticky-link">{{ translate('Overview') }}</span>
24
  </a>
25
  </li>
26
+ <li {% if request.query.module == 'galleries' and request.query.action == 'showPresets' %} class="active" {% endif %}>
27
  <a id="btn-add-new" href="{{ environment.generateUrl('galleries', 'showPresets') }}">
28
  <i class="fa fa-plus-circle"></i>
29
  <span class="gg-sps-sticky-link">{{ translate('New Gallery') }}</span>
30
  </a>
31
  </li>
32
+ <li class="supsystic-sticky {% if (request.query.module == 'galleries' or request.query.module is null) and request.query.action != 'showPresets' %} active{% endif %}">
33
  <a href="{{ environment.generateUrl('galleries') }}">
34
  <i class="fa fa-archive"></i>
35
  <span class="gg-sps-sticky-link">{{ translate('Galleries') }}</span>
42
  </a>
43
  </li>
44
 
45
+ <li class="supsystic-sticky {% if request.query.module == 'settings' %} active{% endif %}">
46
  <a href="{{ environment.generateUrl('settings') }}">
47
  <i class="fa fa-gear"></i>
48
  <span class="gg-sps-sticky-link">{{ translate('Advanced Settings') }}</span>
49
  </a>
50
  </li>
51
+
52
  {% if environment.getModule('license') %}
53
+ <li class="supsystic-sticky {% if (request.query.module == 'license') %} active{% endif %}">
54
  <a href="{{ environment.generateUrl('license') }}">
55
  <i class="fa fa-hand-o-right"></i>
56
  <span class="gg-sps-sticky-link">{{ translate('License') }}</span>
57
  </a>
58
  </li>
59
  {% endif %}
60
+
61
+ <li class="supsystic-sticky {% if request.query.module == 'featuredplugins' %} active{% endif %}">
62
  <a href="{{ environment.generateUrl('featuredplugins') }}">
63
  <i class="fa fa-heart"></i>
64
  <span class="gg-sps-sticky-link">{{ translate('Featured Plugins') }}</span>
66
  </li>
67
 
68
  {# Uncomment to enable images tab #}
69
+ {#<li class="supsystic-sticky {% if request.query.module == 'photos' or request.query.module is null %} active{% endif %}">
70
  <a href="{{ environment.generateUrl('photos') }}">
71
  <i class="fa fa-picture-o"></i>
72
  {{ environment.translate('Images') }}
74
  </li>#}
75
 
76
  {# Ucomment to enable social tabs #}
77
+ {#<li class="supsystic-sticky {% if request.query.module == 'insta' or request.query.module is null %} active{% endif %}">
78
  <a href="{{ environment.generateUrl('insta') }}">
79
  <i class="fa fa-instagram"></i>
80
  {{ environment.translate('Instagram') }}
81
  </a>
82
  </li>
83
+ <li {% if environment.isPro() == false %} class="supsystic-pro" {% endif %} class="supsystic-sticky {% if request.query.module == 'flickr' or request.query.module is null %} active{% endif %}">
84
  {% if environment.isPro() == false %}
85
  <a href="http://supsystic.com/plugins/photo-gallery/">
86
  <i class="fa fa-unlock"></i>
index.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: Photo Gallery by Supsystic
5
  * Description: Easy to use Gallery by Supsystic with professional gallery templates. Show off your best design, photography and creative work
6
- * Version: 1.13.9
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: grid-gallery
@@ -11,5 +11,5 @@
11
 
12
  require_once dirname(__FILE__) . '/app/SupsysticGallery.php';
13
 
14
- $supsysticGallery = new SupsysticGallery('1.13.9');
15
  $supsysticGallery->run();
3
  /**
4
  * Plugin Name: Photo Gallery by Supsystic
5
  * Description: Easy to use Gallery by Supsystic with professional gallery templates. Show off your best design, photography and creative work
6
+ * Version: 1.14.8
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: grid-gallery
11
 
12
  require_once dirname(__FILE__) . '/app/SupsysticGallery.php';
13
 
14
+ $supsysticGallery = new SupsysticGallery('1.14.8');
15
  $supsysticGallery->run();
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: supsystic.com
3
  Donate link: https://supsystic.com/plugins/gallery
4
  Tags: gallery, wordpress gallery plugin, photo gallery, grid gallery, image gallery, video gallery, responsive gallery, polaroid gallery
5
- Tested up to: 5.2
6
- Stable tag: 1.13.9
7
 
8
  Photo Gallery with template editor to build amazing media gallery. Responsive mobile gallery with grid, masonry, carousel, polaroid and more gallery
9
 
@@ -177,6 +177,52 @@ Add watermark on each image in your gallery and you protect your photos from the
177
 
178
  == Changelog ==
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  = Gallery 1.13.9 / 11.09.2019 =
181
  * fix for vertical gallery and category
182
  * Fixed gif height/width
2
  Contributors: supsystic.com
3
  Donate link: https://supsystic.com/plugins/gallery
4
  Tags: gallery, wordpress gallery plugin, photo gallery, grid gallery, image gallery, video gallery, responsive gallery, polaroid gallery
5
+ Tested up to: 5.4
6
+ Stable tag: 1.14.8
7
 
8
  Photo Gallery with template editor to build amazing media gallery. Responsive mobile gallery with grid, masonry, carousel, polaroid and more gallery
9
 
177
 
178
  == Changelog ==
179
 
180
+ = Gallery 1.14.8 / 23.06.2020 =
181
+ * Add fix for social share buttons
182
+ * Add fix for social icons
183
+ * Create universal TWIG library for supsystic plugins
184
+ * Add fix for TWIG
185
+
186
+ = Gallery 1.14.7 / 23.04.2020 =
187
+ * Add support WP 5.4
188
+ * Change gateway Server
189
+ * Add support for PHP 7.4
190
+ * Add fix for older php version 5.3.2 with empty method
191
+ * Add fix for oceanwp-theme
192
+
193
+ = Gallery 1.14.6 / 23.01.2020 =
194
+ * Minor issues fixes
195
+ * Remove PHPmailer code
196
+ * Problem with caption on mobile
197
+ * improvements for Mosaic
198
+
199
+
200
+ = Gallery 1.14.5 / 27.11.2019 =
201
+ * Minor issues fixes
202
+
203
+ = Gallery 1.14.4 / 19.11.2019 =
204
+ * Fix for Polaroid on mobile
205
+ * Minor issues fixes
206
+
207
+ = Gallery 1.14.3 / 06.11.2019 =
208
+ * Add fix for mosaic
209
+
210
+ = Gallery 1.14.2 / 23.10.2019 =
211
+ * Lightbox fix for mobile
212
+ * Fullscreen button fix
213
+ * Lightbox themes list fix
214
+
215
+ = Gallery 1.14.1 / 09.10.2019 =
216
+ * Added fixes for responsive mod gallery type: Fixed, Vertical, Horizontal, Fixed Columns, Mosaic
217
+ * Add fix for mosaic counter align
218
+ * Fix for lightbox on mobile
219
+
220
+ = Gallery 1.14.0 / 25.09.2019 =
221
+ * Add fix for init easing.js
222
+ * Fixed mosaic watermarked thumbnail
223
+ * Add fix for CSS responsive mode
224
+ * Fix for Horizontal Scroll
225
+
226
  = Gallery 1.13.9 / 11.09.2019 =
227
  * fix for vertical gallery and category
228
  * Fixed gif height/width
src/GridGallery/Core/Module.php CHANGED
@@ -93,25 +93,25 @@ class GridGallery_Core_Module extends Rsc_Mvc_Module
93
  $twig = $this->getTwig();
94
 
95
  $twig->addFunction(
96
- new Twig_SimpleFunction(
97
  'plugin_directory_url', array($this, 'getPluginDirectoryUrl')
98
  )
99
  );
100
 
101
  $twig->addFunction(
102
- new Twig_SimpleFunction(
103
  'build_pro_url', array($this, 'buildProUrl')
104
  )
105
  );
106
 
107
  $twig->addFunction(
108
- new Twig_SimpleFunction(
109
  'translate', array($this, 'translate')
110
  )
111
  );
112
 
113
  $twig->addFunction(
114
- new Twig_SimpleFunction(
115
  'getProUrl', array($this, 'getProUrl')
116
  )
117
  );
@@ -119,7 +119,7 @@ class GridGallery_Core_Module extends Rsc_Mvc_Module
119
  $twig->addGlobal('_wpnonce', wp_create_nonce('supsystic-gallery'));
120
 
121
  $twig->addFunction(
122
- new Twig_SimpleFunction(
123
  'getProUrl', array($this, 'getProUrl')
124
  )
125
  );
93
  $twig = $this->getTwig();
94
 
95
  $twig->addFunction(
96
+ new Twig_SupTwg_SimpleFunction(
97
  'plugin_directory_url', array($this, 'getPluginDirectoryUrl')
98
  )
99
  );
100
 
101
  $twig->addFunction(
102
+ new Twig_SupTwg_SimpleFunction(
103
  'build_pro_url', array($this, 'buildProUrl')
104
  )
105
  );
106
 
107
  $twig->addFunction(
108
+ new Twig_SupTwg_SimpleFunction(
109
  'translate', array($this, 'translate')
110
  )
111
  );
112
 
113
  $twig->addFunction(
114
+ new Twig_SupTwg_SimpleFunction(
115
  'getProUrl', array($this, 'getProUrl')
116
  )
117
  );
119
  $twig->addGlobal('_wpnonce', wp_create_nonce('supsystic-gallery'));
120
 
121
  $twig->addFunction(
122
+ new Twig_SupTwg_SimpleFunction(
123
  'getProUrl', array($this, 'getProUrl')
124
  )
125
  );
src/GridGallery/Galleries/Controller.php CHANGED
@@ -87,7 +87,7 @@ class GridGallery_Galleries_Controller extends GridGallery_Core_BaseController
87
 
88
  $twig = $this->getEnvironment()->getTwig();
89
  $twig->addFunction(
90
- new Twig_SimpleFunction(
91
  'get_image_src',
92
  'wp_get_attachment_image_src'
93
  )
@@ -708,7 +708,7 @@ class GridGallery_Galleries_Controller extends GridGallery_Core_BaseController
708
 
709
  $twig = $this->getEnvironment()->getTwig();
710
  $twig->addFunction(
711
- new Twig_SimpleFunction(
712
  'get_image_src',
713
  'wp_get_attachment_image_src'
714
  )
87
 
88
  $twig = $this->getEnvironment()->getTwig();
89
  $twig->addFunction(
90
+ new Twig_SupTwg_SimpleFunction(
91
  'get_image_src',
92
  'wp_get_attachment_image_src'
93
  )
708
 
709
  $twig = $this->getEnvironment()->getTwig();
710
  $twig->addFunction(
711
+ new Twig_SupTwg_SimpleFunction(
712
  'get_image_src',
713
  'wp_get_attachment_image_src'
714
  )
src/GridGallery/Galleries/Module.php CHANGED
@@ -36,28 +36,28 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
36
  add_image_size('gg_gallery_thumbnail', 450, 250, true);
37
 
38
  // !!!!!! use {} for preg_* functions as start and end of the expresion.
39
- $pregReplaceFilter = new Twig_SimpleFilter(
40
  'preg_replace',
41
  array($this, 'pregReplace')
42
  );
43
 
44
- $httpFilter = new Twig_SimpleFilter(
45
  'force_http',
46
  array($this, 'forceHttpUrl')
47
  );
48
- $htmlspecialchars_decode = new Twig_SimpleFilter(
49
  'htmlspecialchars_decode',
50
  'htmlspecialchars_decode'
51
  );
52
 
53
- $function = new Twig_SimpleFunction('translate', array($this->getController(), 'translate'));
54
- $ceilFunction = new Twig_SimpleFunction('ceil','ceil');
55
  $all_categories_func =
56
- new Twig_SimpleFunction(
57
  'all_categories',
58
  'get_categories'
59
  );
60
- $hexToRgbaFunction = new Twig_SimpleFunction('hex_to_rgba', 'GridGallery_Galleries_Module::hexToRgbaStr');
61
 
62
  $twig = $this->getEnvironment()->getTwig();
63
  $twig->enableAutoReload();
@@ -70,7 +70,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
70
  $twig->addFunction($hexToRgbaFunction);
71
 
72
  // To avoid conflict with other plugins which have older twig version.
73
- $twig->addFilter(new Twig_SimpleFilter('round', 'round'));
74
 
75
 
76
  // Widget
@@ -198,10 +198,10 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
198
  if($environment->isAction('preview')) {
199
  $jsList[] = $this->getLocationUrl() . '/assets/js/grid-gallery.galleries.preview.js';
200
  }
201
-
202
  $jsList[] = $this->getLocationUrl() . '/assets/js/grid-gallery.galleries.thumb.js';
203
  $jsList[] = $this->getLocationUrl() . '/assets/js/lib/chosen.jquery.js';
204
-
205
  if ($environment->isAction('index')) {
206
  $jsList[] = $this->getLocationUrl() . '/assets/js/lib/jquery.dataTables.min.js';
207
  $jsList[] = $this->getLocationUrl() . '/assets/js/gallery.index.js';
@@ -255,7 +255,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
255
  }
256
  wp_localize_script('sgg-frontend-js', 'sggStandartFontsList', $this->getModule('ui')->getStandardFontsList());
257
  wp_localize_script('sgg-frontend-js', 'sggIsMobile', array($this->getModel('settings')->isMobile(true) ? 1 : 0));
258
-
259
  //on shutdown check is footer is printed , if not print scripts for our gallery
260
  //add_action('shutdown', array($this,'shutdown'));
261
  }
@@ -684,7 +684,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
684
  public function addFrontendJs()
685
  {
686
  $javascripts = array(
687
- // $this->getLocationUrl() . '/assets/js/grid-gallery.galleries.frontend.js'
688
  $this->getLocationUrl() . '/assets/js/frontend.js',
689
  $this->getLocationUrl() . '/assets/js/jquery.photobox.js',
690
  $this->getLocationUrl() . '/assets/js/jquery.sliphover.js',
@@ -731,7 +731,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
731
  $this->getEnvironment()
732
  ->getTwig()
733
  ->addFunction(
734
- new Twig_SimpleFunction('get_attachment', array(
735
  $attachment,
736
  'getAttachment'
737
  )
@@ -740,7 +740,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
740
  $this->getEnvironment()
741
  ->getTwig()
742
  ->addFunction(
743
- new Twig_SimpleFunction('set_attachment_settings', array(
744
  $attachment,
745
  'setAttachmentSettings',
746
  )
@@ -850,7 +850,7 @@ class GridGallery_Galleries_Module extends GridGallery_Core_Module
850
  fwrite($temp, file_get_contents($file));
851
  $meta = stream_get_meta_data($temp);
852
  $file_array['tmp_name'] = $meta['uri'];
853
-
854
  } catch (Exception $e) {
855
 
856
  return $file_array['tmp_name'];
36
  add_image_size('gg_gallery_thumbnail', 450, 250, true);
37
 
38
  // !!!!!! use {} for preg_* functions as start and end of the expresion.
39
+ $pregReplaceFilter = new Twig_SupTwg_SimpleFilter(
40
  'preg_replace',
41
  array($this, 'pregReplace')
42
  );
43
 
44
+ $httpFilter = new Twig_SupTwg_SimpleFilter(
45
  'force_http',
46
  array($this, 'forceHttpUrl')
47
  );
48
+ $htmlspecialchars_decode = new Twig_SupTwg_SimpleFilter(
49
  'htmlspecialchars_decode',
50
  'htmlspecialchars_decode'
51
  );
52
 
53
+ $function = new Twig_SupTwg_SimpleFunction('translate', array($this->getController(), 'translate'));
54
+ $ceilFunction = new Twig_SupTwg_SimpleFunction('ceil','ceil');
55
  $all_categories_func =
56
+ new Twig_SupTwg_SimpleFunction(
57
  'all_categories',
58
  'get_categories'
59
  );
60
+ $hexToRgbaFunction = new Twig_SupTwg_SimpleFunction('hex_to_rgba', 'GridGallery_Galleries_Module::hexToRgbaStr');
61
 
62
  $twig = $this->getEnvironment()->getTwig();
63
  $twig->enableAutoReload();
70
  $twig->addFunction($hexToRgbaFunction);
71
 
72
  // To avoid conflict with other plugins which have older twig version.
73
+ $twig->addFilter(new Twig_SupTwg_SimpleFilter('round', 'round'));
74
 
75
 
76
  // Widget
198
  if($environment->isAction('preview')) {
199
  $jsList[] = $this->getLocationUrl() . '/assets/js/grid-gallery.galleries.preview.js';
200
  }
201
+
202
  $jsList[] = $this->getLocationUrl() . '/assets/js/grid-gallery.galleries.thumb.js';
203
  $jsList[] = $this->getLocationUrl() . '/assets/js/lib/chosen.jquery.js';
204
+
205
  if ($environment->isAction('index')) {
206
  $jsList[] = $this->getLocationUrl() . '/assets/js/lib/jquery.dataTables.min.js';
207
  $jsList[] = $this->getLocationUrl() . '/assets/js/gallery.index.js';
255
  }
256
  wp_localize_script('sgg-frontend-js', 'sggStandartFontsList', $this->getModule('ui')->getStandardFontsList());
257
  wp_localize_script('sgg-frontend-js', 'sggIsMobile', array($this->getModel('settings')->isMobile(true) ? 1 : 0));
258
+
259
  //on shutdown check is footer is printed , if not print scripts for our gallery
260
  //add_action('shutdown', array($this,'shutdown'));
261
  }
684
  public function addFrontendJs()
685
  {
686
  $javascripts = array(
687
+ //$this->getLocationUrl() . '/assets/js/grid-gallery.galleries.frontend.js'
688
  $this->getLocationUrl() . '/assets/js/frontend.js',
689
  $this->getLocationUrl() . '/assets/js/jquery.photobox.js',
690
  $this->getLocationUrl() . '/assets/js/jquery.sliphover.js',
731
  $this->getEnvironment()
732
  ->getTwig()
733
  ->addFunction(
734
+ new Twig_SupTwg_SimpleFunction('get_attachment', array(
735
  $attachment,
736
  'getAttachment'
737
  )
740
  $this->getEnvironment()
741
  ->getTwig()
742
  ->addFunction(
743
+ new Twig_SupTwg_SimpleFunction('set_attachment_settings', array(
744
  $attachment,
745
  'setAttachmentSettings',
746
  )
850
  fwrite($temp, file_get_contents($file));
851
  $meta = stream_get_meta_data($temp);
852
  $file_array['tmp_name'] = $meta['uri'];
853
+
854
  } catch (Exception $e) {
855
 
856
  return $file_array['tmp_name'];
src/GridGallery/Galleries/assets/css/grid-gallery.galleries.effects.css CHANGED
@@ -37,7 +37,7 @@ a.post .grid-gallery-caption {
37
  transition: 500ms;*/
38
  /* width: 100%;
39
  height: 100%;*/
40
- width: 100%;
41
  max-width: 100%;
42
  display: block;
43
  border-radius: 0;
@@ -1979,7 +1979,7 @@ a.post .grid-gallery-caption {
1979
  z-index: 1;
1980
  }
1981
 
1982
- .grid-gallery-caption[data-grid-gallery-type="polaroid"] img {
1983
  z-index: 2;
1984
  position: relative;
1985
  }
@@ -1988,7 +1988,12 @@ a.post .grid-gallery-caption {
1988
  position: relative;
1989
  }
1990
 
1991
-
 
 
 
 
 
1992
 
1993
  .grid-gallery-caption[data-grid-gallery-type="polaroid"].polaroid-animation:hover,
1994
  .grid-gallery-caption[data-grid-gallery-type="polaroid"].polaroid-animation.hovered {
@@ -2985,4 +2990,4 @@ a.post .grid-gallery-caption {
2985
  -o-transform: perspective(1300px) rotateX(0deg);
2986
  transform: perspective(1300px) rotateX(0deg);
2987
  }
2988
- }
37
  transition: 500ms;*/
38
  /* width: 100%;
39
  height: 100%;*/
40
+ /* width: 100% !important; */
41
  max-width: 100%;
42
  display: block;
43
  border-radius: 0;
1979
  z-index: 1;
1980
  }
1981
 
1982
+ .grid-gallery-caption[data-grid-gallery-type="polaroid"] img {
1983
  z-index: 2;
1984
  position: relative;
1985
  }
1988
  position: relative;
1989
  }
1990
 
1991
+ /* @media (max-width:1024px) {
1992
+ .grid-gallery-caption[data-grid-gallery-type="none"] figcaption {
1993
+ background: transparent !important;
1994
+ background-color: transparent !important;
1995
+ }
1996
+ } */
1997
 
1998
  .grid-gallery-caption[data-grid-gallery-type="polaroid"].polaroid-animation:hover,
1999
  .grid-gallery-caption[data-grid-gallery-type="polaroid"].polaroid-animation.hovered {
2990
  -o-transform: perspective(1300px) rotateX(0deg);
2991
  transform: perspective(1300px) rotateX(0deg);
2992
  }
2993
+ }
src/GridGallery/Galleries/assets/css/grid-gallery.galleries.frontend.css CHANGED
@@ -519,4 +519,59 @@
519
 
520
  .supsystic-grid-gallery-image-sharing::-webkit-scrollbar-thumb {
521
  background-color: #000000;
522
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
 
520
  .supsystic-grid-gallery-image-sharing::-webkit-scrollbar-thumb {
521
  background-color: #000000;
522
+ }
523
+
524
+ @media (max-width: 768px) {
525
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .grid-gallery-photos {
526
+ display:block;
527
+ position:relative !important;
528
+ float:none !important;
529
+ width:100% !important;
530
+ height:auto !important;
531
+ }
532
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .gg-link {
533
+ display:inline-block;
534
+ position:relative !important;
535
+ float:left !important;
536
+ width:49.99% !important;
537
+ height:auto !important;
538
+ left: inherit !important;
539
+ top:inherit !important;
540
+ }
541
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .gg-link figure {
542
+ display:block;
543
+ position:relative !important;
544
+ float:none !important;
545
+ width:100% !important;
546
+ height:auto !important;
547
+ left: inherit !important;
548
+ top:inherit !important;
549
+ text-align: center !important;
550
+ }
551
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .grid-gallery-photos img {
552
+ display:block;
553
+ position:relative !important;
554
+ float:none !important;
555
+ width:100% !important;
556
+ height:auto !important;
557
+ left: inherit !important;
558
+ top:inherit !important;
559
+ }
560
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .gg-link figure .crop {
561
+ display:inline-block !important;
562
+ }
563
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .gg-link:nth-child(2n+1) {
564
+ clear:left;
565
+ }
566
+ }
567
+ @media (max-width: 500px) {
568
+ div:not(.grid-gallery-mosaic):not(.grid-gallery-fixed).grid-gallery .gg-link {
569
+ display:block;
570
+ position:relative !important;
571
+ float:none !important;
572
+ width:100% !important;
573
+ height:auto !important;
574
+ left: inherit !important;
575
+ top:inherit !important;
576
+ }
577
+ }
src/GridGallery/Galleries/assets/css/photobox.css CHANGED
@@ -174,6 +174,9 @@
174
  /* fix for Chrome */
175
  @media all and (max-width:710px){
176
  .pbThumbs li.active a img{ min-height:96%; }
 
 
 
177
  }
178
 
179
  #pbOverlay { visibility: hidden; }
@@ -192,4 +195,4 @@
192
  }
193
  #cboxRight{
194
  left: 0;
195
- }
174
  /* fix for Chrome */
175
  @media all and (max-width:710px){
176
  .pbThumbs li.active a img{ min-height:96%; }
177
+ .video .zoomable iframe {
178
+ max-width: 100vw;
179
+ }
180
  }
181
 
182
  #pbOverlay { visibility: hidden; }
195
  }
196
  #cboxRight{
197
  left: 0;
198
+ }
src/GridGallery/Galleries/assets/css/prettyPhoto.css CHANGED
@@ -270,7 +270,7 @@
270
  div.facebook .pp_bottom .pp_right { background: url(../images/prettyPhoto/facebook/sprite.png) -110px -80px no-repeat; } /* Bottom right corner */
271
 
272
 
273
- div.pp_pic_holder .ppt {
274
  overflow: hidden;
275
  text-overflow: ellipsis;
276
  }
@@ -285,10 +285,11 @@
285
  background: #000;
286
  display: none;
287
  left: 0;
288
- position: absolute;
289
  top: 0;
290
  width: 100%;
291
  z-index: 9500;
 
292
  }
293
 
294
  div.pp_pic_holder {
@@ -424,13 +425,13 @@
424
  font-family: Arial;
425
  font-style: italic;
426
  font-weight: bold;
427
- font-size: 12px;
428
  }
429
  #ppCustomAttributes .pp_attribute_value {
430
  padding-left: 10px;
431
  font-family: Arial;
432
  font-style: normal;
433
- font-size: 12px;
434
  }
435
  #ppAttributeButton {
436
  padding-left: 10px;
@@ -441,7 +442,7 @@
441
  float: left;
442
  }
443
  .grid-gallery-filter option {
444
- padding: 2px;
445
  }
446
  .gg-filter-attributes-names, .gg-filter-attributes-values {
447
  width: 150px;
@@ -605,7 +606,7 @@
605
  margin: 0 0 5px 15px;
606
  z-index: 9999;
607
  }
608
-
609
  img#fullResImage {
610
  margin-bottom: 0px!important;
611
  max-width: 100%;
@@ -810,4 +811,3 @@ a.pp_next {
810
  display: inline-block;
811
  float: left;
812
  }
813
-
270
  div.facebook .pp_bottom .pp_right { background: url(../images/prettyPhoto/facebook/sprite.png) -110px -80px no-repeat; } /* Bottom right corner */
271
 
272
 
273
+ div.pp_pic_holder .ppt {
274
  overflow: hidden;
275
  text-overflow: ellipsis;
276
  }
285
  background: #000;
286
  display: none;
287
  left: 0;
288
+ position: fixed !important;
289
  top: 0;
290
  width: 100%;
291
  z-index: 9500;
292
+ height:100% !important;
293
  }
294
 
295
  div.pp_pic_holder {
425
  font-family: Arial;
426
  font-style: italic;
427
  font-weight: bold;
428
+ font-size: 12px;
429
  }
430
  #ppCustomAttributes .pp_attribute_value {
431
  padding-left: 10px;
432
  font-family: Arial;
433
  font-style: normal;
434
+ font-size: 12px;
435
  }
436
  #ppAttributeButton {
437
  padding-left: 10px;
442
  float: left;
443
  }
444
  .grid-gallery-filter option {
445
+ padding: 2px;
446
  }
447
  .gg-filter-attributes-names, .gg-filter-attributes-values {
448
  width: 150px;
606
  margin: 0 0 5px 15px;
607
  z-index: 9999;
608
  }
609
+
610
  img#fullResImage {
611
  margin-bottom: 0px!important;
612
  max-width: 100%;
811
  display: inline-block;
812
  float: left;
813
  }
 
src/GridGallery/Galleries/assets/js/frontend.js CHANGED
@@ -302,6 +302,10 @@
302
  }
303
 
304
  this.$container.find('.grid-gallery-photos').css('text-align', this.$container.data('area-position'));
 
 
 
 
305
  this.$container.filter(':visible').find('.grid-gallery-photos > *').filter(':visible').css({
306
  'float': 'none',
307
  'display': 'inline-block',
@@ -587,7 +591,7 @@
587
  $(window).resize(function(){
588
  self.resizeColorbox();
589
  });
590
-
591
  $('#cboxOverlay').removeClass().addClass($this.data('popup-theme')+'-overlay');
592
  $('#colorbox').removeClass().addClass($this.data('popup-theme'));
593
 
@@ -675,7 +679,7 @@
675
  if(self.$container.attr('data-show-link-btn-in-popup') == 1 && window.prettyPhotoDetailLink) {
676
  window.prettyPhotoDetailLink(element);
677
  }
678
- if(self.$container.attr('data-show-attributes-in-popup') == 1 && window.prettyPhotoAttributes)
679
  {
680
  window.prettyPhotoAttributes(element, self.$container);
681
  }
@@ -1402,7 +1406,7 @@
1402
  } else {
1403
  var topRow = $el.find('.gg-caption-row.top'),
1404
  centerRow = $el.find('.gg-caption-row.center');
1405
- if(centerRow.length == 1 && topRow.length == 1) {
1406
  centerRow.css({'top': topRow.height(), 'transform': 'initial'});
1407
  }
1408
  }
@@ -1462,7 +1466,7 @@
1462
 
1463
  if($img.hasClass('ggLazyImg') || $img.hasClass('ggNotInitImg')) return;
1464
  if($el.closest('.gg-mw-row').hasClass('sggDisplNone')) return;
1465
-
1466
  $el.addClass('initialized');
1467
  $img.finish();
1468
  var width = $el.width(),
@@ -1483,14 +1487,14 @@
1483
  }
1484
  var figcaptionHeight = !isNaN(clearHeight) && clearHeight != 0 ? (captionHeight.toString().indexOf('%') > 0 ? (imageHeight * clearHeight / 100) : clearHeight) : 0,
1485
  figureFullHeight = imageHeight + frameWidth * 2 + figcaptionHeight;
1486
-
1487
  $img.css({
1488
  'width': imageWidth + 'px',
1489
  'height': imageHeight + 'px',
1490
  'margin': frameWidth + 'px auto 0',
1491
  });
1492
  $el.find('.gg-caption-table').css('height', '1px');
1493
-
1494
  $el.find('.crop').css({
1495
  'height': imageHeight + frameWidth + 'px'
1496
  });
@@ -1521,7 +1525,7 @@
1521
  });
1522
  if(figcaptionHeight) {
1523
  figcaptionHeight += 'px';
1524
- $figcaption.css('height', figcaptionHeight);
1525
  $el.find('.gg-caption-row').css({'max-height': figcaptionHeight ? figcaptionHeight : '100%', 'height': 'auto'});
1526
  $el.find('.gg-caption-cell').css('height', '100%');
1527
  if(gridType == 3) {
@@ -1725,8 +1729,8 @@
1725
  , width = this.$container.data('width')
1726
  , offset = this.$container.data('offset')
1727
  , isMobile = parseInt($anyGallery.attr('data-is-mobile'))
1728
- , mouseWheelStep = 20
1729
- , touchStep = 200
1730
  , responsiveMode = 0
1731
  , tmpValue = 0
1732
  , self = this;
@@ -1898,13 +1902,13 @@
1898
  if (e.currentTarget.href.slice(-1) !== '#') {
1899
  window.open(e.currentTarget.href, 'mw' + e.timeStamp, 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
1900
  }
1901
-
1902
  var button = $(this)
1903
  , figureWrapper = button.closest('.grid-gallery')
1904
  , socialHtmlWrapper = figureWrapper.find('#social-share-html')
1905
  // , socialHtmlWrapper = figureWrapper.find('.supsystic-social-sharing')
1906
  , popupWrapper = socialHtmlWrapper.find('.supsystic-social-sharing-popup');
1907
-
1908
  if(button.hasClass('trigger-popup')){
1909
  if(socialHtmlWrapper.css('display') === 'none'){
1910
  socialHtmlWrapper.find('a').css('display', 'none');
@@ -2223,8 +2227,13 @@
2223
  buttonsClass +=' ' + this.socialSharing.popupSharing.wrapperClass;
2224
  }
2225
 
 
 
 
2226
  $wrapper.find('.supsystic-grid-gallery-image-sharing').remove();
2227
  $wrapper.prepend(this.getSocialButtonsByImage(buttonsClass, $element, true));
 
 
2228
  // remove "Show all networks" button
2229
  $wrapper.find('.supsystic-social-sharing .trigger-popup').remove();
2230
 
@@ -2449,7 +2458,7 @@
2449
  Gallery.prototype.lazyLoadDistanceRefresh = (function(waitTime) {
2450
  var self = this,
2451
  galleryType = this.$container.data('gridType');
2452
-
2453
  if(typeof(waitTime) == 'undefined') {
2454
  waitTime = 400;
2455
  }
@@ -2467,7 +2476,7 @@
2467
  }
2468
  });
2469
  }, waitTime + 50);
2470
-
2471
  switch(galleryType) {
2472
  case 4:
2473
  $(document).trigger('ggMosaicResizedEvent');
@@ -2520,7 +2529,7 @@
2520
  var showMoreCategory = this.$container.find('.showMoreCategory'),
2521
  effect = this.$container.data('lazyload-effect'),
2522
  duration = this.$container.data('lazyload-effect-duration');
2523
-
2524
  if(typeof(effect) == 'undefined') {
2525
  effect = 'show';
2526
  duration = 400;
@@ -2792,6 +2801,20 @@
2792
  contentLoaded();
2793
  });
2794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2795
  // added Gallery initialization by trigger
2796
  $(document).on('ggFirInitialize', function() {
2797
  contentLoaded();
@@ -2809,4 +2832,40 @@
2809
  }
2810
  });
2811
 
2812
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  }
303
 
304
  this.$container.find('.grid-gallery-photos').css('text-align', this.$container.data('area-position'));
305
+ var minheight = this.$container.find('.grid-gallery-photos').data('min-height');
306
+ this.$container.find('.grid-gallery-photos').css({
307
+ 'min-height': minheight,
308
+ });
309
  this.$container.filter(':visible').find('.grid-gallery-photos > *').filter(':visible').css({
310
  'float': 'none',
311
  'display': 'inline-block',
591
  $(window).resize(function(){
592
  self.resizeColorbox();
593
  });
594
+
595
  $('#cboxOverlay').removeClass().addClass($this.data('popup-theme')+'-overlay');
596
  $('#colorbox').removeClass().addClass($this.data('popup-theme'));
597
 
679
  if(self.$container.attr('data-show-link-btn-in-popup') == 1 && window.prettyPhotoDetailLink) {
680
  window.prettyPhotoDetailLink(element);
681
  }
682
+ if(self.$container.attr('data-show-attributes-in-popup') == 1 && window.prettyPhotoAttributes)
683
  {
684
  window.prettyPhotoAttributes(element, self.$container);
685
  }
1406
  } else {
1407
  var topRow = $el.find('.gg-caption-row.top'),
1408
  centerRow = $el.find('.gg-caption-row.center');
1409
+ if(centerRow.length == 1 && topRow.length == 1) {
1410
  centerRow.css({'top': topRow.height(), 'transform': 'initial'});
1411
  }
1412
  }
1466
 
1467
  if($img.hasClass('ggLazyImg') || $img.hasClass('ggNotInitImg')) return;
1468
  if($el.closest('.gg-mw-row').hasClass('sggDisplNone')) return;
1469
+
1470
  $el.addClass('initialized');
1471
  $img.finish();
1472
  var width = $el.width(),
1487
  }
1488
  var figcaptionHeight = !isNaN(clearHeight) && clearHeight != 0 ? (captionHeight.toString().indexOf('%') > 0 ? (imageHeight * clearHeight / 100) : clearHeight) : 0,
1489
  figureFullHeight = imageHeight + frameWidth * 2 + figcaptionHeight;
1490
+
1491
  $img.css({
1492
  'width': imageWidth + 'px',
1493
  'height': imageHeight + 'px',
1494
  'margin': frameWidth + 'px auto 0',
1495
  });
1496
  $el.find('.gg-caption-table').css('height', '1px');
1497
+
1498
  $el.find('.crop').css({
1499
  'height': imageHeight + frameWidth + 'px'
1500
  });
1525
  });
1526
  if(figcaptionHeight) {
1527
  figcaptionHeight += 'px';
1528
+ $figcaption.css('height', figcaptionHeight);
1529
  $el.find('.gg-caption-row').css({'max-height': figcaptionHeight ? figcaptionHeight : '100%', 'height': 'auto'});
1530
  $el.find('.gg-caption-cell').css('height', '100%');
1531
  if(gridType == 3) {
1729
  , width = this.$container.data('width')
1730
  , offset = this.$container.data('offset')
1731
  , isMobile = parseInt($anyGallery.attr('data-is-mobile'))
1732
+ , mouseWheelStep = 100
1733
+ , touchStep = 100
1734
  , responsiveMode = 0
1735
  , tmpValue = 0
1736
  , self = this;
1902
  if (e.currentTarget.href.slice(-1) !== '#') {
1903
  window.open(e.currentTarget.href, 'mw' + e.timeStamp, 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
1904
  }
1905
+
1906
  var button = $(this)
1907
  , figureWrapper = button.closest('.grid-gallery')
1908
  , socialHtmlWrapper = figureWrapper.find('#social-share-html')
1909
  // , socialHtmlWrapper = figureWrapper.find('.supsystic-social-sharing')
1910
  , popupWrapper = socialHtmlWrapper.find('.supsystic-social-sharing-popup');
1911
+
1912
  if(button.hasClass('trigger-popup')){
1913
  if(socialHtmlWrapper.css('display') === 'none'){
1914
  socialHtmlWrapper.find('a').css('display', 'none');
2227
  buttonsClass +=' ' + this.socialSharing.popupSharing.wrapperClass;
2228
  }
2229
 
2230
+ var attachId = $element.attr('data-attachment-id');
2231
+ var attachObject = jQuery('body').find('.gg-link[data-attachment-id="'+attachId+'"]');
2232
+ var attachHtml = attachObject.find('.supsystic-social-sharing').html();
2233
  $wrapper.find('.supsystic-grid-gallery-image-sharing').remove();
2234
  $wrapper.prepend(this.getSocialButtonsByImage(buttonsClass, $element, true));
2235
+ $wrapper.find('.supsystic-social-sharing').html(attachHtml);
2236
+
2237
  // remove "Show all networks" button
2238
  $wrapper.find('.supsystic-social-sharing .trigger-popup').remove();
2239
 
2458
  Gallery.prototype.lazyLoadDistanceRefresh = (function(waitTime) {
2459
  var self = this,
2460
  galleryType = this.$container.data('gridType');
2461
+
2462
  if(typeof(waitTime) == 'undefined') {
2463
  waitTime = 400;
2464
  }
2476
  }
2477
  });
2478
  }, waitTime + 50);
2479
+
2480
  switch(galleryType) {
2481
  case 4:
2482
  $(document).trigger('ggMosaicResizedEvent');
2529
  var showMoreCategory = this.$container.find('.showMoreCategory'),
2530
  effect = this.$container.data('lazyload-effect'),
2531
  duration = this.$container.data('lazyload-effect-duration');
2532
+
2533
  if(typeof(effect) == 'undefined') {
2534
  effect = 'show';
2535
  duration = 400;
2801
  contentLoaded();
2802
  });
2803
 
2804
+ if ( jQuery('body').hasClass('oceanwp-theme') ) {
2805
+ function oceanwpFixedFooter () {
2806
+ $("#main").css("min-height", "0px");
2807
+ };
2808
+ jQuery(window).resize(function() {
2809
+ oceanwpFixedFooter();
2810
+ });
2811
+ jQuery(document).ready(function () {
2812
+ setTimeout(function(){
2813
+ oceanwpFixedFooter();
2814
+ },3000);
2815
+ });
2816
+ }
2817
+
2818
  // added Gallery initialization by trigger
2819
  $(document).on('ggFirInitialize', function() {
2820
  contentLoaded();
2832
  }
2833
  });
2834
 
2835
+ jQuery(document).ready(function(){
2836
+ setTimeout(function(){
2837
+ jQuery('body').find('.supsystic-social-sharing').each(function( key, value ){
2838
+ var summary = 0;
2839
+ jQuery(this).find('.social-sharing-button').each(function( key2, value2 ){
2840
+ if (jQuery(this).parent().hasClass('supsystic-social-sharing-popup')) return;
2841
+ var networks = jQuery(this).attr('data-networks');
2842
+ networks = jQuery.parseJSON(networks);
2843
+ var attachId = jQuery('.supsystic-social-sharing').eq(key).closest('[data-attachment-id]').attr('data-attachment-id');
2844
+ if (typeof attachId != 'undefined') {
2845
+ var nid = jQuery(this).attr('data-nid');
2846
+ var counter = networks[attachId][nid];
2847
+ if (parseInt(counter) && !isNaN(counter)) {
2848
+ summary = summary + parseInt(counter);
2849
+ }
2850
+ var counterWrapper = '';
2851
+ if (jQuery(this).hasClass('counter-standard')) {
2852
+ jQuery(this).find('.counter-wrap.standard').remove('');
2853
+ counterWrapper = '<div class="counter-wrap standard"><span class="counter">'+counter+'</span></div>';
2854
+ }
2855
+ if (jQuery(this).hasClass('counter-arrowed')) {
2856
+ jQuery(this).find('.counter-wrap.arrowed').remove('');
2857
+ counterWrapper = '<div class="counter-wrap arrowed"><span class="counter">'+counter+'</span></div>';
2858
+ }
2859
+ if (jQuery(this).hasClass('counter-white-arrowed')) {
2860
+ jQuery(this).find('.counter-wrap.white-arrowed').remove('');
2861
+ counterWrapper = '<div class="counter-wrap white-arrowed"><span class="counter">'+counter+'</span></div>';
2862
+ }
2863
+ var attachId = jQuery(this).append(counterWrapper);
2864
+ }
2865
+ });
2866
+ summary = '<span>Shares</span> <span>'+summary+'</span>';
2867
+ jQuery(this).closest('a').find('.supsystic-social-sharing-total-counter.counter-wrap').html(summary);
2868
+ });
2869
+ }, 1000);
2870
+ });
2871
+ }(jQuery));
src/GridGallery/Galleries/assets/js/lib/jquery.easing.js CHANGED
@@ -36,5 +36,7 @@
36
  */
37
 
38
  // t: current time, b: begInnIng value, c: change In value, d: duration
39
-
40
- jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,t,n,r,i){return jQuery.easing[jQuery.easing.def](e,t,n,r,i)},easeInQuad:function(e,t,n,r,i){return r*(t/=i)*t+n},easeOutQuad:function(e,t,n,r,i){return-r*(t/=i)*(t-2)+n},easeInOutQuad:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t+n;return-r/2*(--t*(t-2)-1)+n},easeInCubic:function(e,t,n,r,i){return r*(t/=i)*t*t+n},easeOutCubic:function(e,t,n,r,i){return r*((t=t/i-1)*t*t+1)+n},easeInOutCubic:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t+n;return r/2*((t-=2)*t*t+2)+n},easeInQuart:function(e,t,n,r,i){return r*(t/=i)*t*t*t+n},easeOutQuart:function(e,t,n,r,i){return-r*((t=t/i-1)*t*t*t-1)+n},easeInOutQuart:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t+n;return-r/2*((t-=2)*t*t*t-2)+n},easeInQuint:function(e,t,n,r,i){return r*(t/=i)*t*t*t*t+n},easeOutQuint:function(e,t,n,r,i){return r*((t=t/i-1)*t*t*t*t+1)+n},easeInOutQuint:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t*t+n;return r/2*((t-=2)*t*t*t*t+2)+n},easeInSine:function(e,t,n,r,i){return-r*Math.cos(t/i*(Math.PI/2))+r+n},easeOutSine:function(e,t,n,r,i){return r*Math.sin(t/i*(Math.PI/2))+n},easeInOutSine:function(e,t,n,r,i){return-r/2*(Math.cos(Math.PI*t/i)-1)+n},easeInExpo:function(e,t,n,r,i){return t==0?n:r*Math.pow(2,10*(t/i-1))+n},easeOutExpo:function(e,t,n,r,i){return t==i?n+r:r*(-Math.pow(2,-10*t/i)+1)+n},easeInOutExpo:function(e,t,n,r,i){if(t==0)return n;if(t==i)return n+r;if((t/=i/2)<1)return r/2*Math.pow(2,10*(t-1))+n;return r/2*(-Math.pow(2,-10*--t)+2)+n},easeInCirc:function(e,t,n,r,i){return-r*(Math.sqrt(1-(t/=i)*t)-1)+n},easeOutCirc:function(e,t,n,r,i){return r*Math.sqrt(1-(t=t/i-1)*t)+n},easeInOutCirc:function(e,t,n,r,i){if((t/=i/2)<1)return-r/2*(Math.sqrt(1-t*t)-1)+n;return r/2*(Math.sqrt(1-(t-=2)*t)+1)+n},easeInElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return-(u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o))+n},easeOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return u*Math.pow(2,-10*t)*Math.sin((t*i-s)*2*Math.PI/o)+r+n},easeInOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i/2)==2)return n+r;if(!o)o=i*.3*1.5;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);if(t<1)return-.5*u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)+n;return u*Math.pow(2,-10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)*.5+r+n},easeInBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*(t/=i)*t*((s+1)*t-s)+n},easeOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*((t=t/i-1)*t*((s+1)*t+s)+1)+n},easeInOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;if((t/=i/2)<1)return r/2*t*t*(((s*=1.525)+1)*t-s)+n;return r/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+n},easeInBounce:function(e,t,n,r,i){return r-jQuery.easing.easeOutBounce(e,i-t,0,r,i)+n},easeOutBounce:function(e,t,n,r,i){if((t/=i)<1/2.75){return r*7.5625*t*t+n}else if(t<2/2.75){return r*(7.5625*(t-=1.5/2.75)*t+.75)+n}else if(t<2.5/2.75){return r*(7.5625*(t-=2.25/2.75)*t+.9375)+n}else{return r*(7.5625*(t-=2.625/2.75)*t+.984375)+n}},easeInOutBounce:function(e,t,n,r,i){if(t<i/2)return jQuery.easing.easeInBounce(e,t*2,0,r,i)*.5+n;return jQuery.easing.easeOutBounce(e,t*2-i,0,r,i)*.5+r*.5+n}});
 
 
36
  */
37
 
38
  // t: current time, b: begInnIng value, c: change In value, d: duration
39
+ jQuery(document).ready(function() {
40
+ jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,t,n,r,i){return jQuery.easing[jQuery.easing.def](e,t,n,r,i)},easeInQuad:function(e,t,n,r,i){return r*(t/=i)*t+n},easeOutQuad:function(e,t,n,r,i){return-r*(t/=i)*(t-2)+n},easeInOutQuad:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t+n;return-r/2*(--t*(t-2)-1)+n},easeInCubic:function(e,t,n,r,i){return r*(t/=i)*t*t+n},easeOutCubic:function(e,t,n,r,i){return r*((t=t/i-1)*t*t+1)+n},easeInOutCubic:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t+n;return r/2*((t-=2)*t*t+2)+n},easeInQuart:function(e,t,n,r,i){return r*(t/=i)*t*t*t+n},easeOutQuart:function(e,t,n,r,i){return-r*((t=t/i-1)*t*t*t-1)+n},easeInOutQuart:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t+n;return-r/2*((t-=2)*t*t*t-2)+n},easeInQuint:function(e,t,n,r,i){return r*(t/=i)*t*t*t*t+n},easeOutQuint:function(e,t,n,r,i){return r*((t=t/i-1)*t*t*t*t+1)+n},easeInOutQuint:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t*t+n;return r/2*((t-=2)*t*t*t*t+2)+n},easeInSine:function(e,t,n,r,i){return-r*Math.cos(t/i*(Math.PI/2))+r+n},easeOutSine:function(e,t,n,r,i){return r*Math.sin(t/i*(Math.PI/2))+n},easeInOutSine:function(e,t,n,r,i){return-r/2*(Math.cos(Math.PI*t/i)-1)+n},easeInExpo:function(e,t,n,r,i){return t==0?n:r*Math.pow(2,10*(t/i-1))+n},easeOutExpo:function(e,t,n,r,i){return t==i?n+r:r*(-Math.pow(2,-10*t/i)+1)+n},easeInOutExpo:function(e,t,n,r,i){if(t==0)return n;if(t==i)return n+r;if((t/=i/2)<1)return r/2*Math.pow(2,10*(t-1))+n;return r/2*(-Math.pow(2,-10*--t)+2)+n},easeInCirc:function(e,t,n,r,i){return-r*(Math.sqrt(1-(t/=i)*t)-1)+n},easeOutCirc:function(e,t,n,r,i){return r*Math.sqrt(1-(t=t/i-1)*t)+n},easeInOutCirc:function(e,t,n,r,i){if((t/=i/2)<1)return-r/2*(Math.sqrt(1-t*t)-1)+n;return r/2*(Math.sqrt(1-(t-=2)*t)+1)+n},easeInElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return-(u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o))+n},easeOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return u*Math.pow(2,-10*t)*Math.sin((t*i-s)*2*Math.PI/o)+r+n},easeInOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i/2)==2)return n+r;if(!o)o=i*.3*1.5;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);if(t<1)return-.5*u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)+n;return u*Math.pow(2,-10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)*.5+r+n},easeInBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*(t/=i)*t*((s+1)*t-s)+n},easeOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*((t=t/i-1)*t*((s+1)*t+s)+1)+n},easeInOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;if((t/=i/2)<1)return r/2*t*t*(((s*=1.525)+1)*t-s)+n;return r/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+n},easeInBounce:function(e,t,n,r,i){return r-jQuery.easing.easeOutBounce(e,i-t,0,r,i)+n},easeOutBounce:function(e,t,n,r,i){if((t/=i)<1/2.75){return r*7.5625*t*t+n}else if(t<2/2.75){return r*(7.5625*(t-=1.5/2.75)*t+.75)+n}else if(t<2.5/2.75){return r*(7.5625*(t-=2.25/2.75)*t+.9375)+n}else{return r*(7.5625*(t-=2.625/2.75)*t+.984375)+n}},easeInOutBounce:function(e,t,n,r,i){if(t<i/2)return jQuery.easing.easeInBounce(e,t*2,0,r,i)*.5+n;return jQuery.easing.easeOutBounce(e,t*2-i,0,r,i)*.5+r*.5+n}});
41
+ });
42
+
src/GridGallery/Galleries/assets/js/lib/jquery.prettyphoto.js CHANGED
@@ -186,7 +186,7 @@ Version: 3.1.6
186
  horizontal_padding: 20, /* The padding on each side of the picture */
187
  hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
188
  wmode: 'opaque', /* Set the flash wmode attribute */
189
- autoplay: true, /* Automatically start videos: True/False */
190
  modal: false, /* If set to true, only the close button will close the window */
191
  deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
192
  overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
@@ -200,20 +200,20 @@ Version: 3.1.6
200
  ie6_fallback: true,
201
  'is_lazy_load': 0,
202
  markup: markupHtml,
203
- gallery_markup: '<div style="clear: both;"></div><div class="pp_gallery">' +
204
  '<a href="#" class="pp_arrow_previous">' + ppTranslationVar['cPrevious'] + '</a>' +
205
- '<div>' +
206
- '<ul>' +
207
- '{gallery}' +
208
- '</ul>' +
209
- '</div>' +
210
  '<a href="#" class="pp_arrow_next">' + ppTranslationVar['cNext'] + '</a>' +
211
  '</div>',
212
  image_markup: '<img id="fullResImage" src="{path}" data-rotate-angl="0"/>',
213
  flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
214
  quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
215
  html5_markup: '<video controls="" style="margin-bottom: 0px;"><source src="{path}" height="{height}" width="{width}"></video>',
216
- iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
217
  inline_markup: '<div class="pp_inline">{content}</div>',
218
  custom_markup: '',
219
  social_tools: '<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
@@ -716,7 +716,7 @@ Version: 3.1.6
716
  var $ppHoverContainer = $pp_pic_holder.find('.pp_hoverContainer')
717
  , $ppImageWrapper = $pp_pic_holder.find('#pp_full_res')
718
  , $ppPopupImage = $pp_pic_holder.find('#fullResImage');
719
-
720
  $ppHoverContainer.height(pp_dimensions['height']).width(pp_dimensions['width']);
721
  $ppPopupImage.height(pp_dimensions['height']).width(pp_dimensions['width']);
722
 
@@ -855,7 +855,7 @@ Version: 3.1.6
855
  return response;
856
  }
857
  }
858
-
859
 
860
  /**
861
  * Resize the item dimensions if it's bigger than the viewport
@@ -1068,7 +1068,7 @@ Version: 3.1.6
1068
  $selfPp.initOnHoverPreview($(caller), pp_settings.galleryId);
1069
 
1070
  $pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
1071
-
1072
  // disable contextmenu
1073
  if (settings.isDisableRightClick) {
1074
  $pp_pic_holder.off('contextmenu').on('contextmenu', function(e){return false;});
@@ -1242,4 +1242,4 @@ Version: 3.1.6
1242
 
1243
  })(jQuery);
1244
 
1245
- var ggpp_alreadyInitialized = false;
186
  horizontal_padding: 20, /* The padding on each side of the picture */
187
  hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
188
  wmode: 'opaque', /* Set the flash wmode attribute */
189
+ autoplay: false, /* Automatically start videos: True/False */
190
  modal: false, /* If set to true, only the close button will close the window */
191
  deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
192
  overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
200
  ie6_fallback: true,
201
  'is_lazy_load': 0,
202
  markup: markupHtml,
203
+ gallery_markup: '<div style="clear: both;"></div><div class="pp_gallery">' +
204
  '<a href="#" class="pp_arrow_previous">' + ppTranslationVar['cPrevious'] + '</a>' +
205
+ '<div>' +
206
+ '<ul>' +
207
+ '{gallery}' +
208
+ '</ul>' +
209
+ '</div>' +
210
  '<a href="#" class="pp_arrow_next">' + ppTranslationVar['cNext'] + '</a>' +
211
  '</div>',
212
  image_markup: '<img id="fullResImage" src="{path}" data-rotate-angl="0"/>',
213
  flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
214
  quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
215
  html5_markup: '<video controls="" style="margin-bottom: 0px;"><source src="{path}" height="{height}" width="{width}"></video>',
216
+ iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" allowfullscreen="true" frameborder="no" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
217
  inline_markup: '<div class="pp_inline">{content}</div>',
218
  custom_markup: '',
219
  social_tools: '<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
716
  var $ppHoverContainer = $pp_pic_holder.find('.pp_hoverContainer')
717
  , $ppImageWrapper = $pp_pic_holder.find('#pp_full_res')
718
  , $ppPopupImage = $pp_pic_holder.find('#fullResImage');
719
+
720
  $ppHoverContainer.height(pp_dimensions['height']).width(pp_dimensions['width']);
721
  $ppPopupImage.height(pp_dimensions['height']).width(pp_dimensions['width']);
722
 
855
  return response;
856
  }
857
  }
858
+
859
 
860
  /**
861
  * Resize the item dimensions if it's bigger than the viewport
1068
  $selfPp.initOnHoverPreview($(caller), pp_settings.galleryId);
1069
 
1070
  $pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
1071
+
1072
  // disable contextmenu
1073
  if (settings.isDisableRightClick) {
1074
  $pp_pic_holder.off('contextmenu').on('contextmenu', function(e){return false;});
1242
 
1243
  })(jQuery);
1244
 
1245
+ var ggpp_alreadyInitialized = false;
src/GridGallery/Galleries/configs/tooltips.php CHANGED
@@ -18,7 +18,7 @@ return array(
18
  'area-width' => __('This option helps you set gallery width in pixels or percents. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/gallery-width.jpg />',
19
  'full-screen-width' => __('Check this checkbox if you want your gallery to be displayed at full screen width. This option is of no use in Vertical gallery layout. Click the link below to see the example of Full Screen Width gallery. ', 'sgg') . '<a target=\'_blank\' href=\'https://supsystic.com/example/full-width-gallery-example/\'>https://supsystic.com/example/full-width-gallery-example/</a>',
20
  'area-padding' => __('Here you may set gallery padding value in pixels. Padding will be the same from both sides of the gallery. ', 'sgg') . '<a target=\'_blank\' href=\'https://supsystic.com/documentation/main-settings/\'>https://supsystic.com/documentation/main-settings/</a>',
21
- 'photo-width' => __('Set your image width in pixels or percents. This option is not available in Horizontal gallery. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/width_bet_photos.jpg>',
22
  'photo-height' => __('Set your image height in pixels or percents. This option is not available in Vertical gallery. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/height_bet_photos.jpg>',
23
  'browserUrlTooltipHideFree' => __('If this option is enabled, the links on the images will not be displayed in the browser. Also, it will be impossible to open gallery in popup. In the case you are not sure, please do not enable the option. ', 'sgg'),
24
  'default-settings' =>__('All new galleries you create after enabling the option will be created with these settings by default (even gallery type). Important! This feature may be enabled only in single gallery at once. ', 'sgg'),
18
  'area-width' => __('This option helps you set gallery width in pixels or percents. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/gallery-width.jpg />',
19
  'full-screen-width' => __('Check this checkbox if you want your gallery to be displayed at full screen width. This option is of no use in Vertical gallery layout. Click the link below to see the example of Full Screen Width gallery. ', 'sgg') . '<a target=\'_blank\' href=\'https://supsystic.com/example/full-width-gallery-example/\'>https://supsystic.com/example/full-width-gallery-example/</a>',
20
  'area-padding' => __('Here you may set gallery padding value in pixels. Padding will be the same from both sides of the gallery. ', 'sgg') . '<a target=\'_blank\' href=\'https://supsystic.com/documentation/main-settings/\'>https://supsystic.com/documentation/main-settings/</a>',
21
+ 'photo-width' => __('Set your image width in pixels or percents. This option is not available in Horizontal, Mosaic gallery. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/width_bet_photos.jpg>',
22
  'photo-height' => __('Set your image height in pixels or percents. This option is not available in Vertical gallery. Note: setting this parameter in percents allows your gallery to adjust to any screen size. ', 'sgg') . '</br><img src=@url/height_bet_photos.jpg>',
23
  'browserUrlTooltipHideFree' => __('If this option is enabled, the links on the images will not be displayed in the browser. Also, it will be impossible to open gallery in popup. In the case you are not sure, please do not enable the option. ', 'sgg'),
24
  'default-settings' =>__('All new galleries you create after enabling the option will be created with these settings by default (even gallery type). Important! This feature may be enabled only in single gallery at once. ', 'sgg'),
src/GridGallery/Galleries/views/r314/shortcode/helpers.twig CHANGED
@@ -75,7 +75,7 @@
75
 
76
  {% if environment.isPro() == false or settings.icons is not defined or settings.icons.enabled == 'false' %}
77
  <a
78
- class="gg-link {{ aClass|trim }}{% if settings.box.type == '2' and link is not defined %} pbox{% endif %}
79
  {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}"
80
  href="{{ aHref|trim }}"
81
  target="{{ photo.attachment.target|default('_self') }}"
@@ -86,14 +86,14 @@
86
  style="border-radius: {{ settings.thumbnail.border.radius ~ settings.thumbnail.border.radius_unit|replace(['px', '%']) }};"
87
  >
88
  {% endif %}
89
- <figure
90
  class="grid-gallery-caption
91
  {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}
92
  {% if settings.mouse_shadow == '1' and settings.use_shadow == '1' %} shadow-show{% endif %}{% if settings.mouse_shadow == '2' and settings.use_shadow == '1' %} shadow-hide{% endif %}"
93
  data-tags="{{ tags|trim|replace(' ', '_') }}"
94
  data-grid-gallery-type="{% if environment.isPro() and settings.icons.enabled == 'true' %}{% if 'icons' in settings.thumbnail.overlay.effect %}{{ settings.thumbnail.overlay.effect }}{% else %}icons{% endif %}{% elseif settings.thumbnail.overlay.enabled == 'false' %}none{% else %}{{ settings.thumbnail.overlay.effect }}{% endif %}"
95
  style="display:none;{{ figureStyle|trim }}">
96
-
97
  <div class="crop{% if settings.thumbnail.shadow.overlay == '1' and settings.use_shadow == '1' %} image-overlay{% endif %}" style="{% if settings.area.grid == '0' or settings.area.grid == '3' %}width:{{ settings.area.photo_width ~ settings.area.photo_width_unit|replace(['px', '%']) }};
98
  {% if settings.pagination.enabled == 'true' %}
99
  height: 100% !important;
75
 
76
  {% if environment.isPro() == false or settings.icons is not defined or settings.icons.enabled == 'false' %}
77
  <a
78
+ class="gg-link {{' '}} {{ aClass|trim }}{% if settings.box.type == '2' and link is not defined %} pbox{% endif %}
79
  {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}"
80
  href="{{ aHref|trim }}"
81
  target="{{ photo.attachment.target|default('_self') }}"
86
  style="border-radius: {{ settings.thumbnail.border.radius ~ settings.thumbnail.border.radius_unit|replace(['px', '%']) }};"
87
  >
88
  {% endif %}
89
+ <figure
90
  class="grid-gallery-caption
91
  {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}
92
  {% if settings.mouse_shadow == '1' and settings.use_shadow == '1' %} shadow-show{% endif %}{% if settings.mouse_shadow == '2' and settings.use_shadow == '1' %} shadow-hide{% endif %}"
93
  data-tags="{{ tags|trim|replace(' ', '_') }}"
94
  data-grid-gallery-type="{% if environment.isPro() and settings.icons.enabled == 'true' %}{% if 'icons' in settings.thumbnail.overlay.effect %}{{ settings.thumbnail.overlay.effect }}{% else %}icons{% endif %}{% elseif settings.thumbnail.overlay.enabled == 'false' %}none{% else %}{{ settings.thumbnail.overlay.effect }}{% endif %}"
95
  style="display:none;{{ figureStyle|trim }}">
96
+
97
  <div class="crop{% if settings.thumbnail.shadow.overlay == '1' and settings.use_shadow == '1' %} image-overlay{% endif %}" style="{% if settings.area.grid == '0' or settings.area.grid == '3' %}width:{{ settings.area.photo_width ~ settings.area.photo_width_unit|replace(['px', '%']) }};
98
  {% if settings.pagination.enabled == 'true' %}
99
  height: 100% !important;
src/GridGallery/Galleries/views/settings.twig CHANGED
@@ -168,7 +168,7 @@
168
  {% if settings.area.grid == 0 or settings.area.grid == '2' or settings.area.grid == '3' %}
169
  {% set crop = 1 %}
170
  {% else %}
171
- {% set height = null %}
172
  {% endif %}
173
 
174
  {% if settings.thumbnail.cropQuality is defined %}
@@ -181,7 +181,7 @@
181
  {% if gallery.photos[0].attachment.isRemoteImage is defined and gallery.photos[0].attachment.isRemoteImage == 1 %}
182
  src="{{ gallery.photos[0].attachment.thumbUrl }}"
183
  {% else %}
184
- src="{{ get_attachment(gallery.photos[0].attachment.id, width, height, crop, cropQuality) }}"
185
  {% endif %}
186
  data-src="{{ 'holder.js/350x250?theme=simple&text=' ~ gallery.title|raw }}" alt="{{ gallery.title|raw }}"
187
  style="
168
  {% if settings.area.grid == 0 or settings.area.grid == '2' or settings.area.grid == '3' %}
169
  {% set crop = 1 %}
170
  {% else %}
171
+ {% set height = 0 %}
172
  {% endif %}
173
 
174
  {% if settings.thumbnail.cropQuality is defined %}
181
  {% if gallery.photos[0].attachment.isRemoteImage is defined and gallery.photos[0].attachment.isRemoteImage == 1 %}
182
  src="{{ gallery.photos[0].attachment.thumbUrl }}"
183
  {% else %}
184
+ src="{{ get_attachment(gallery.photos[0].attachment.id, width, height, crop, cropQuality) }}"
185
  {% endif %}
186
  data-src="{{ 'holder.js/350x250?theme=simple&text=' ~ gallery.title|raw }}" alt="{{ gallery.title|raw }}"
187
  style="
src/GridGallery/Galleries/views/shortcode/gallery.twig CHANGED
@@ -58,15 +58,15 @@
58
 
59
  data-popup-image-text="{{ settings.box.imageText|default('title') }}"
60
 
61
- {% if settings.box.popupwidth == '' %}
62
  data-popup-widthsize="auto"
63
- {% else %}
64
  data-popup-widthsize="{{ settings.box.popupwidth }}"
65
  {% endif %}
66
 
67
- {% if settings.box.popupheight == '' %}
68
  data-popup-heightsize="auto"
69
- {% else %}
70
  data-popup-heightsize="{{ settings.box.popupheight }}"
71
  {% endif %}
72
  {% endif %}
@@ -94,8 +94,8 @@
94
  data-caption-mobile="{{ settings.thumbnail.isMobile|default('false') }}" {# Always show in mobile #}
95
  data-hide-long-tltp-title="{{ settings.hideLongTooltipTitles == 'on' ? '1' : '0' }}"
96
  data-caption-disabled-on-mobile="{{ settings.thumbnail.isDisableMobileCaption|default('false') }}"
97
- {% if settings.lazyload.enabled == '1' %}
98
- data-lazyload-enable='1'
99
  data-lazyload-effect="{{ settings.lazyload.animationEffect | default('show') }}"
100
  data-lazyload-effect-duration="{{ settings.lazyload.effectDuration | default('400') }}"
101
  {% endif %}
@@ -264,10 +264,10 @@
264
  {% block photos_after %}
265
  {% endblock %}
266
  </div>
267
-
268
  <!-- Gallery by Supsystic plugin {{ environment.getConfig().get('plugin_version') }} {% if environment.isPro() == true %} / {{ environment.getConfig().get('pro_plugin_version') }}{% endif %} -->
269
  {% endif %}
270
 
271
  {% block styleForEffectInclude %}
272
  {% include '@galleries/shortcode/style_for_effects.twig' with {'gallery': gallery, 'settings': settings} %}
273
- {% endblock %}
58
 
59
  data-popup-image-text="{{ settings.box.imageText|default('title') }}"
60
 
61
+ {% if settings.box.popupwidth == '' %}
62
  data-popup-widthsize="auto"
63
+ {% else %}
64
  data-popup-widthsize="{{ settings.box.popupwidth }}"
65
  {% endif %}
66
 
67
+ {% if settings.box.popupheight == '' %}
68
  data-popup-heightsize="auto"
69
+ {% else %}
70
  data-popup-heightsize="{{ settings.box.popupheight }}"
71
  {% endif %}
72
  {% endif %}
94
  data-caption-mobile="{{ settings.thumbnail.isMobile|default('false') }}" {# Always show in mobile #}
95
  data-hide-long-tltp-title="{{ settings.hideLongTooltipTitles == 'on' ? '1' : '0' }}"
96
  data-caption-disabled-on-mobile="{{ settings.thumbnail.isDisableMobileCaption|default('false') }}"
97
+ {% if settings.lazyload.enabled == '1' %}
98
+ data-lazyload-enable='1'
99
  data-lazyload-effect="{{ settings.lazyload.animationEffect | default('show') }}"
100
  data-lazyload-effect-duration="{{ settings.lazyload.effectDuration | default('400') }}"
101
  {% endif %}
264
  {% block photos_after %}
265
  {% endblock %}
266
  </div>
267
+
268
  <!-- Gallery by Supsystic plugin {{ environment.getConfig().get('plugin_version') }} {% if environment.isPro() == true %} / {{ environment.getConfig().get('pro_plugin_version') }}{% endif %} -->
269
  {% endif %}
270
 
271
  {% block styleForEffectInclude %}
272
  {% include '@galleries/shortcode/style_for_effects.twig' with {'gallery': gallery, 'settings': settings} %}
273
+ {% endblock %}
src/GridGallery/Galleries/views/shortcode/helpers.twig CHANGED
@@ -3,8 +3,8 @@
3
  border: {{ settings.thumbnail.border.width }}px {{ settings.thumbnail.border.type }} {{ settings.thumbnail.border.color }};
4
  {% endif %}
5
  border-radius: {{ settings.thumbnail.border.radius ~ settings.thumbnail.border.radius_unit|replace(['px', '%']) }};
6
- {% if settings.use_shadow == 1 %}
7
- box-shadow: {{ settings.thumbnail.shadow.x }}px {{ settings.thumbnail.shadow.y }}px {{ settings.thumbnail.shadow.blur }}px {{ settings.thumbnail.shadow.color }};
8
  {% endif %};
9
 
10
  {% if settings.area.grid == '2' %}
@@ -87,9 +87,11 @@
87
  id="gg-{{ gallery.id }}-{{ photo.id }}"
88
 
89
  {% block a_attributes_class_set %}
90
- class="gg-link {{ aClass|trim }} {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}"
91
  {% endblock %}
92
 
 
 
93
  {{ ggMosaicHiddenItemVar }}
94
  {% block a_attributes_href %}
95
  href="{{ aHref|trim|htmlspecialchars_decode }}"
@@ -117,6 +119,8 @@
117
  {% endblock %}
118
  {% endset %}
119
 
 
 
120
  {% set var_figure_before %}
121
  {% block figure_before %}
122
  {% if settings.icons is not defined or settings.icons.enabled == 'false' %}
@@ -527,4 +531,4 @@
527
  {{ var_figure_after }}
528
  {% endblock %}
529
  {# ##########Image######### #}
530
- {% endspaceless %}
3
  border: {{ settings.thumbnail.border.width }}px {{ settings.thumbnail.border.type }} {{ settings.thumbnail.border.color }};
4
  {% endif %}
5
  border-radius: {{ settings.thumbnail.border.radius ~ settings.thumbnail.border.radius_unit|replace(['px', '%']) }};
6
+ {% if settings.use_shadow == '1' %}
7
+ box-shadow: {{ settings.thumbnail.shadow.x }}px {{' '}} {{ settings.thumbnail.shadow.y }}px {{' '}} {{ settings.thumbnail.shadow.blur }}px {{' '}} {{ settings.thumbnail.shadow.color }};
8
  {% endif %};
9
 
10
  {% if settings.area.grid == '2' %}
87
  id="gg-{{ gallery.id }}-{{ photo.id }}"
88
 
89
  {% block a_attributes_class_set %}
90
+ class="gg-link {{' '}} {{ aClass|trim }} {% if settings.displayFirstPhoto == 'on' and index > 0 %} hidden-item {% endif %}"
91
  {% endblock %}
92
 
93
+ data-attachment-id="{{ photo.attachment.id }}"
94
+
95
  {{ ggMosaicHiddenItemVar }}
96
  {% block a_attributes_href %}
97
  href="{{ aHref|trim|htmlspecialchars_decode }}"
119
  {% endblock %}
120
  {% endset %}
121
 
122
+
123
+
124
  {% set var_figure_before %}
125
  {% block figure_before %}
126
  {% if settings.icons is not defined or settings.icons.enabled == 'false' %}
531
  {{ var_figure_after }}
532
  {% endblock %}
533
  {# ##########Image######### #}
534
+ {% endspaceless %}
src/GridGallery/Overview/Controller.php CHANGED
@@ -81,7 +81,7 @@ class GridGallery_Overview_Controller extends GridGallery_Core_BaseController
81
  /**
82
  * @return base server settings
83
  */
84
- protected function getServerSettings()
85
  {
86
  global $wpdb;
87
 
@@ -104,23 +104,16 @@ class GridGallery_Overview_Controller extends GridGallery_Core_BaseController
104
  }
105
 
106
  /**
107
- * @return mail send error
108
  */
109
  protected function getMailErrors()
110
  {
111
  global $ts_mail_errors;
112
- global $phpmailer;
113
-
114
  if (!isset($ts_mail_errors)) {
115
  $ts_mail_errors = array();
116
  }
117
 
118
- if (isset($phpmailer)) {
119
- if(!empty($phpmailer->ErrorInfo)) {
120
- $ts_mail_errors[] = $phpmailer->ErrorInfo;
121
- }
122
- }
123
-
124
  return $ts_mail_errors;
125
  }
126
 
@@ -134,4 +127,4 @@ class GridGallery_Overview_Controller extends GridGallery_Core_BaseController
134
 
135
  return $news;
136
  }
137
- }
81
  /**
82
  * @return base server settings
83
  */
84
+ protected function getServerSettings()
85
  {
86
  global $wpdb;
87
 
104
  }
105
 
106
  /**
107
+ * @return mail send error
108
  */
109
  protected function getMailErrors()
110
  {
111
  global $ts_mail_errors;
112
+
 
113
  if (!isset($ts_mail_errors)) {
114
  $ts_mail_errors = array();
115
  }
116
 
 
 
 
 
 
 
117
  return $ts_mail_errors;
118
  }
119
 
127
 
128
  return $news;
129
  }
130
+ }
src/GridGallery/SocialSharing/Module.php CHANGED
@@ -27,7 +27,7 @@ class GridGallery_SocialSharing_Module extends GridGallery_Core_Module{
27
  $galleriesList = $galleryModel->getList();
28
  foreach($galleriesList as $gallery){
29
  $settings = $settingsModel->get($gallery->id);
30
- if($settings->data['socialSharing']['projectId'] == $projectId){
31
  $galleryModule->cleanCache($gallery->id);
32
  }
33
  }
@@ -72,7 +72,7 @@ class GridGallery_SocialSharing_Module extends GridGallery_Core_Module{
72
  $photoModel = new GridGallery_Photos_Model_Photos();
73
  $attachment = new GridGallery_Galleries_Attachment();
74
  $photoData = $photoModel->getById($photoId);
75
-
76
  if (!$photoData) {
77
  return;
78
  }
@@ -94,4 +94,4 @@ class GridGallery_SocialSharing_Module extends GridGallery_Core_Module{
94
  ));
95
 
96
  }
97
- }
27
  $galleriesList = $galleryModel->getList();
28
  foreach($galleriesList as $gallery){
29
  $settings = $settingsModel->get($gallery->id);
30
+ if(!empty($settings->data['socialSharing']['projectId']) && $settings->data['socialSharing']['projectId'] == $projectId){
31
  $galleryModule->cleanCache($gallery->id);
32
  }
33
  }
72
  $photoModel = new GridGallery_Photos_Model_Photos();
73
  $attachment = new GridGallery_Galleries_Attachment();
74
  $photoData = $photoModel->getById($photoId);
75
+
76
  if (!$photoData) {
77
  return;
78
  }
94
  ));
95
 
96
  }
97
+ }
vendor/Rsc/ClassLoader.php CHANGED
@@ -115,7 +115,7 @@ class Rsc_ClassLoader
115
  public function load($class)
116
  {
117
  if ($file = $this->find($class)) {
118
- require $file;
119
  }
120
  }
121
 
@@ -134,7 +134,25 @@ class Rsc_ClassLoader
134
  $name = $class;
135
  }
136
 
137
- $path .= str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  foreach ($this->prefixes as $prefix => $dirs) {
140
  if ($class === strstr($class, $prefix)) {
@@ -146,4 +164,4 @@ class Rsc_ClassLoader
146
  }
147
  }
148
  }
149
- }
115
  public function load($class)
116
  {
117
  if ($file = $this->find($class)) {
118
+ require_once $file;
119
  }
120
  }
121
 
134
  $name = $class;
135
  }
136
 
137
+ if (stripos($class,'Twig_') !== false) {
138
+ $className = str_replace('Twig_SupTwg_', '', $name);
139
+ $classDelimeters = explode('_', $className);
140
+
141
+ $newName = '';
142
+ for ($i=0; $i < count($classDelimeters); $i++) {
143
+ $newName .= DIRECTORY_SEPARATOR . $classDelimeters[$i];
144
+ }
145
+ $path .= 'Twig' . $newName . '.php';
146
+ if ($class == 'SupsysticSlider_Slider_Twig_SupTwg_Attachment') {
147
+ $path = DIRECTORY_SEPARATOR.'SupsysticSlider'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Attachment.php';
148
+ }
149
+ if ($class == 'SupsysticSliderPro_Slider_Twig_SupTwg_Video') {
150
+ $path = DIRECTORY_SEPARATOR.'SupsysticSliderPro'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Video.php';
151
+ }
152
+
153
+ } else {
154
+ $path .= str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
155
+ }
156
 
157
  foreach ($this->prefixes as $prefix => $dirs) {
158
  if ($class === strstr($class, $prefix)) {
164
  }
165
  }
166
  }
167
+ }
vendor/Rsc/Environment.php CHANGED
@@ -57,7 +57,7 @@ class Rsc_Environment
57
  protected $resolver;
58
 
59
  /**
60
- * @var Twig_Environment
61
  */
62
  protected $twig;
63
 
@@ -77,7 +77,7 @@ class Rsc_Environment
77
  protected $dispatcher;
78
 
79
  protected $adminAreaMenus = array();
80
-
81
  protected $baseModInited = false;
82
 
83
  /**
@@ -117,7 +117,7 @@ class Rsc_Environment
117
  public function setBaseModInited( $newVal ) {
118
  $this->baseModInited = $newVal;
119
  }
120
-
121
  public function getBaseModInited() {
122
  return $this->baseModInited;
123
  }
@@ -167,19 +167,19 @@ class Rsc_Environment
167
  try {
168
  $templatesPath = $this->getPluginPath() . '/app/templates';
169
 
170
- $this->twig = new Twig_Environment(
171
- new Twig_Loader_Filesystem($templatesPath),
172
  array(
173
  'cache' => $this->config->get('plugin_cache_twig', false),
174
  'debug' => $this->isDev(),
 
175
  )
176
  );
177
 
178
-
179
  if ($this->isDev()) {
180
- $this->twig->addExtension(new Twig_Extension_Debug());
181
  }
182
- } catch (Twig_Error_Loader $e) {
183
  wp_die(
184
  sprintf('Invalid plugin path specified: "%s"', $e->getMessage())
185
  );
@@ -253,7 +253,7 @@ class Rsc_Environment
253
 
254
  /**
255
  * Returns an instance of the Twig
256
- * @return Twig_Environment
257
  */
258
  public function getTwig()
259
  {
57
  protected $resolver;
58
 
59
  /**
60
+ * @var Twig_SupTwg_Environment
61
  */
62
  protected $twig;
63
 
77
  protected $dispatcher;
78
 
79
  protected $adminAreaMenus = array();
80
+
81
  protected $baseModInited = false;
82
 
83
  /**
117
  public function setBaseModInited( $newVal ) {
118
  $this->baseModInited = $newVal;
119
  }
120
+
121
  public function getBaseModInited() {
122
  return $this->baseModInited;
123
  }
167
  try {
168
  $templatesPath = $this->getPluginPath() . '/app/templates';
169
 
170
+ $this->twig = new Twig_SupTwg_Environment(
171
+ new Twig_SupTwg_Loader_Filesystem($templatesPath),
172
  array(
173
  'cache' => $this->config->get('plugin_cache_twig', false),
174
  'debug' => $this->isDev(),
175
+ 'auto_reload' => true
176
  )
177
  );
178
 
 
179
  if ($this->isDev()) {
180
+ $this->twig->addExtension(new Twig_SupTwg_Extension_Debug());
181
  }
182
+ } catch (Twig_SupTwg_Error_Loader $e) {
183
  wp_die(
184
  sprintf('Invalid plugin path specified: "%s"', $e->getMessage())
185
  );
253
 
254
  /**
255
  * Returns an instance of the Twig
256
+ * @return Twig_SupTwg_Environment
257
  */
258
  public function getTwig()
259
  {
vendor/Rsc/Resolver.php CHANGED
@@ -114,7 +114,7 @@ class Rsc_Resolver
114
 
115
  /* We add module's location to the template & config loaders */
116
 
117
- /** @var Twig_Loader_Filesystem $loader */
118
  try {
119
  $loader = $this->environment->getTwig()->getLoader();
120
  $loader->addPath($instance->getLocation() . '/views', strtolower($name));
@@ -130,7 +130,7 @@ class Rsc_Resolver
130
 
131
  $loader->addPath($location . '/views', strtolower($name) . '_pro');
132
  }
133
- } catch (Twig_Error_Loader $e) { }
134
 
135
  $configLoader = $config->getLoader();
136
  $configLoader->add($instance->getLocation() . '/configs', strtolower($name));
@@ -195,7 +195,7 @@ class Rsc_Resolver
195
 
196
  try {
197
  $twig->addPath($location . '/views', $name . '_pro');
198
- } catch (Twig_Error_Loader $e) {
199
  // Do nothing. Path does not exists.
200
  }
201
 
114
 
115
  /* We add module's location to the template & config loaders */
116
 
117
+ /** @var Twig_SupTwg_Loader_Filesystem $loader */
118
  try {
119
  $loader = $this->environment->getTwig()->getLoader();
120
  $loader->addPath($instance->getLocation() . '/views', strtolower($name));
130
 
131
  $loader->addPath($location . '/views', strtolower($name) . '_pro');
132
  }
133
+ } catch (Twig_SupTwg_Error_Loader $e) { }
134
 
135
  $configLoader = $config->getLoader();
136
  $configLoader->add($instance->getLocation() . '/configs', strtolower($name));
195
 
196
  try {
197
  $twig->addPath($location . '/views', $name . '_pro');
198
+ } catch (Twig_SupTwg_Error_Loader $e) {
199
  // Do nothing. Path does not exists.
200
  }
201
 
vendor/Twig/Autoloader.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Autoloads Twig classes.
@@ -18,16 +18,16 @@
18
  *
19
  * @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
20
  */
21
- class Twig_Autoloader
22
  {
23
  /**
24
- * Registers Twig_Autoloader as an SPL autoloader.
25
  *
26
  * @param bool $prepend whether to prepend the autoloader or not
27
  */
28
  public static function register($prepend = false)
29
  {
30
- @trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);
31
 
32
  if (PHP_VERSION_ID < 50300) {
33
  spl_autoload_register(array(__CLASS__, 'autoload'));
@@ -43,7 +43,7 @@ class Twig_Autoloader
43
  */
44
  public static function autoload($class)
45
  {
46
- if (0 !== strpos($class, 'Twig')) {
47
  return;
48
  }
49
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Autoloads Twig classes.
18
  *
19
  * @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
20
  */
21
+ class Twig_SupTwg_Autoloader
22
  {
23
  /**
24
+ * Registers Twig_SupTwg_Autoloader as an SPL autoloader.
25
  *
26
  * @param bool $prepend whether to prepend the autoloader or not
27
  */
28
  public static function register($prepend = false)
29
  {
30
+ @trigger_error('Using Twig_SupTwg_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);
31
 
32
  if (PHP_VERSION_ID < 50300) {
33
  spl_autoload_register(array(__CLASS__, 'autoload'));
43
  */
44
  public static function autoload($class)
45
  {
46
+ if (0 !== strpos($class, 'Twig_SupTwg')) {
47
  return;
48
  }
49
 
vendor/Twig/BaseNodeVisitor.php CHANGED
@@ -10,25 +10,25 @@
10
  */
11
 
12
  /**
13
- * Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x.
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
18
  {
19
- final public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
20
  {
21
- if (!$node instanceof Twig_Node) {
22
- throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.');
23
  }
24
 
25
  return $this->doEnterNode($node, $env);
26
  }
27
 
28
- final public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
29
  {
30
- if (!$node instanceof Twig_Node) {
31
- throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.');
32
  }
33
 
34
  return $this->doLeaveNode($node, $env);
@@ -37,14 +37,14 @@ abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
37
  /**
38
  * Called before child nodes are visited.
39
  *
40
- * @return Twig_Node The modified node
41
  */
42
- abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env);
43
 
44
  /**
45
  * Called after child nodes are visited.
46
  *
47
- * @return Twig_Node|false The modified node or false if the node must be removed
48
  */
49
- abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
50
  }
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x.
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ abstract class Twig_SupTwg_BaseNodeVisitor implements Twig_SupTwg_NodeVisitorInterface
18
  {
19
+ final public function enterNode(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
20
  {
21
+ if (!$node instanceof Twig_SupTwg_Node) {
22
+ throw new LogicException('Twig_SupTwg_BaseNodeVisitor only supports Twig_SupTwg_Node instances.');
23
  }
24
 
25
  return $this->doEnterNode($node, $env);
26
  }
27
 
28
+ final public function leaveNode(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
29
  {
30
+ if (!$node instanceof Twig_SupTwg_Node) {
31
+ throw new LogicException('Twig_SupTwg_BaseNodeVisitor only supports Twig_SupTwg_Node instances.');
32
  }
33
 
34
  return $this->doLeaveNode($node, $env);
37
  /**
38
  * Called before child nodes are visited.
39
  *
40
+ * @return Twig_SupTwg_Node The modified node
41
  */
42
+ abstract protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env);
43
 
44
  /**
45
  * Called after child nodes are visited.
46
  *
47
+ * @return Twig_SupTwg_Node|false The modified node or false if the node must be removed
48
  */
49
+ abstract protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env);
50
  }
vendor/Twig/Cache/Filesystem.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Andrew Tch <andrew@noop.lv>
16
  */
17
- class Twig_Cache_Filesystem implements Twig_CacheInterface
18
  {
19
  const FORCE_BYTECODE_INVALIDATION = 1;
20
 
14
  *
15
  * @author Andrew Tch <andrew@noop.lv>
16
  */
17
+ class Twig_SupTwg_Cache_Filesystem implements Twig_SupTwg_CacheInterface
18
  {
19
  const FORCE_BYTECODE_INVALIDATION = 1;
20
 
vendor/Twig/Cache/Null.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_Cache_Null implements Twig_CacheInterface
20
  {
21
  public function generateKey($name, $className)
22
  {
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_Cache_Null implements Twig_SupTwg_CacheInterface
20
  {
21
  public function generateKey($name, $className)
22
  {
vendor/Twig/CacheInterface.php CHANGED
@@ -18,7 +18,7 @@
18
  *
19
  * @author Andrew Tch <andrew@noop.lv>
20
  */
21
- interface Twig_CacheInterface
22
  {
23
  /**
24
  * Generates a cache key for the given template class name.
18
  *
19
  * @author Andrew Tch <andrew@noop.lv>
20
  */
21
+ interface Twig_SupTwg_CacheInterface
22
  {
23
  /**
24
  * Generates a cache key for the given template class name.
vendor/Twig/Compiler.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Compiler implements Twig_CompilerInterface
19
  {
20
  protected $lastLine;
21
  protected $source;
@@ -26,7 +26,7 @@ class Twig_Compiler implements Twig_CompilerInterface
26
  protected $sourceLine;
27
  protected $filename;
28
 
29
- public function __construct(Twig_Environment $env)
30
  {
31
  $this->env = $env;
32
  }
@@ -44,7 +44,7 @@ class Twig_Compiler implements Twig_CompilerInterface
44
  /**
45
  * Returns the environment instance related to this compiler.
46
  *
47
- * @return Twig_Environment
48
  */
49
  public function getEnvironment()
50
  {
@@ -64,12 +64,12 @@ class Twig_Compiler implements Twig_CompilerInterface
64
  /**
65
  * Compiles a node.
66
  *
67
- * @param Twig_NodeInterface $node The node to compile
68
  * @param int $indentation The current indentation
69
  *
70
  * @return $this
71
  */
72
- public function compile(Twig_NodeInterface $node, $indentation = 0)
73
  {
74
  $this->lastLine = null;
75
  $this->source = '';
@@ -79,7 +79,7 @@ class Twig_Compiler implements Twig_CompilerInterface
79
  $this->sourceLine = 1;
80
  $this->indentation = $indentation;
81
 
82
- if ($node instanceof Twig_Node_Module) {
83
  // to be removed in 2.0
84
  $this->filename = $node->getTemplateName();
85
  }
@@ -89,7 +89,7 @@ class Twig_Compiler implements Twig_CompilerInterface
89
  return $this;
90
  }
91
 
92
- public function subcompile(Twig_NodeInterface $node, $raw = true)
93
  {
94
  if (false === $raw) {
95
  $this->source .= str_repeat(' ', $this->indentation * 4);
@@ -207,7 +207,7 @@ class Twig_Compiler implements Twig_CompilerInterface
207
  *
208
  * @return $this
209
  */
210
- public function addDebugInfo(Twig_NodeInterface $node)
211
  {
212
  if ($node->getTemplateLine() != $this->lastLine) {
213
  $this->write(sprintf("// line %d\n", $node->getTemplateLine()));
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
19
  {
20
  protected $lastLine;
21
  protected $source;
26
  protected $sourceLine;
27
  protected $filename;
28
 
29
+ public function __construct(Twig_SupTwg_Environment $env)
30
  {
31
  $this->env = $env;
32
  }
44
  /**
45
  * Returns the environment instance related to this compiler.
46
  *
47
+ * @return Twig_SupTwg_Environment
48
  */
49
  public function getEnvironment()
50
  {
64
  /**
65
  * Compiles a node.
66
  *
67
+ * @param Twig_SupTwg_NodeInterface $node The node to compile
68
  * @param int $indentation The current indentation
69
  *
70
  * @return $this
71
  */
72
+ public function compile(Twig_SupTwg_NodeInterface $node, $indentation = 0)
73
  {
74
  $this->lastLine = null;
75
  $this->source = '';
79
  $this->sourceLine = 1;
80
  $this->indentation = $indentation;
81
 
82
+ if ($node instanceof Twig_SupTwg_Node_Module) {
83
  // to be removed in 2.0
84
  $this->filename = $node->getTemplateName();
85
  }
89
  return $this;
90
  }
91
 
92
+ public function subcompile(Twig_SupTwg_NodeInterface $node, $raw = true)
93
  {
94
  if (false === $raw) {
95
  $this->source .= str_repeat(' ', $this->indentation * 4);
207
  *
208
  * @return $this
209
  */
210
+ public function addDebugInfo(Twig_SupTwg_NodeInterface $node)
211
  {
212
  if ($node->getTemplateLine() != $this->lastLine) {
213
  $this->write(sprintf("// line %d\n", $node->getTemplateLine()));
vendor/Twig/CompilerInterface.php CHANGED
@@ -16,14 +16,14 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_CompilerInterface
20
  {
21
  /**
22
  * Compiles a node.
23
  *
24
  * @return $this
25
  */
26
- public function compile(Twig_NodeInterface $node);
27
 
28
  /**
29
  * Gets the current PHP code after compilation.
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_CompilerInterface
20
  {
21
  /**
22
  * Compiles a node.
23
  *
24
  * @return $this
25
  */
26
+ public function compile(Twig_SupTwg_NodeInterface $node);
27
 
28
  /**
29
  * Gets the current PHP code after compilation.
vendor/Twig/ContainerRuntimeLoader.php CHANGED
@@ -19,7 +19,7 @@ use Psr\Container\ContainerInterface;
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
 
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  * @author Robin Chalas <robin.chalas@gmail.com>
21
  */
22
+ class Twig_SupTwg_ContainerRuntimeLoader implements Twig_SupTwg_RuntimeLoaderInterface
23
  {
24
  private $container;
25
 
vendor/Twig/Environment.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Environment
18
  {
19
  const VERSION = '1.33.2';
20
  const VERSION_ID = 13302;
@@ -70,10 +70,10 @@ class Twig_Environment
70
  * * charset: The charset used by the templates (default to UTF-8).
71
  *
72
  * * base_template_class: The base template class to use for generated
73
- * templates (default to Twig_Template).
74
  *
75
  * * cache: An absolute path where to store the compiled templates,
76
- * a Twig_Cache_Interface implementation,
77
  * or false to disable compilation cache (default).
78
  *
79
  * * auto_reload: Whether to reload the template if the original source changed.
@@ -94,21 +94,21 @@ class Twig_Environment
94
  * (default to -1 which means that all optimizations are enabled;
95
  * set it to 0 to disable).
96
  *
97
- * @param Twig_LoaderInterface $loader
98
  * @param array $options An array of options
99
  */
100
- public function __construct(Twig_LoaderInterface $loader = null, $options = array())
101
  {
102
  if (null !== $loader) {
103
  $this->setLoader($loader);
104
  } else {
105
- @trigger_error('Not passing a Twig_LoaderInterface as the first constructor argument of Twig_Environment is deprecated since version 1.21.', E_USER_DEPRECATED);
106
  }
107
 
108
  $options = array_merge(array(
109
  'debug' => false,
110
  'charset' => 'UTF-8',
111
- 'base_template_class' => 'Twig_Template',
112
  'strict_variables' => false,
113
  'autoescape' => 'html',
114
  'cache' => false,
@@ -123,23 +123,23 @@ class Twig_Environment
123
  $this->strictVariables = (bool) $options['strict_variables'];
124
  $this->setCache($options['cache']);
125
 
126
- $this->addExtension(new Twig_Extension_Core());
127
- $this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
128
- $this->addExtension(new Twig_Extension_Optimizer($options['optimizations']));
129
- $this->staging = new Twig_Extension_Staging();
130
 
131
  // For BC
132
  if (is_string($this->originalCache)) {
133
  $r = new ReflectionMethod($this, 'writeCacheFile');
134
  if ($r->getDeclaringClass()->getName() !== __CLASS__) {
135
- @trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
136
 
137
  $this->bcWriteCacheFile = true;
138
  }
139
 
140
  $r = new ReflectionMethod($this, 'getCacheFilename');
141
  if ($r->getDeclaringClass()->getName() !== __CLASS__) {
142
- @trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
143
 
144
  $this->bcGetCacheFilename = true;
145
  }
@@ -254,7 +254,7 @@ class Twig_Environment
254
  *
255
  * @param bool $original Whether to return the original cache option or the real cache instance
256
  *
257
- * @return Twig_CacheInterface|string|false A Twig_CacheInterface implementation,
258
  * an absolute path to the compiled templates,
259
  * or false to disable cache
260
  */
@@ -266,7 +266,7 @@ class Twig_Environment
266
  /**
267
  * Sets the current cache implementation.
268
  *
269
- * @param Twig_CacheInterface|string|false $cache A Twig_CacheInterface implementation,
270
  * an absolute path to the compiled templates,
271
  * or false to disable cache
272
  */
@@ -274,18 +274,18 @@ class Twig_Environment
274
  {
275
  if (is_string($cache)) {
276
  $this->originalCache = $cache;
277
- $this->cache = new Twig_Cache_Filesystem($cache);
278
  } elseif (false === $cache) {
279
  $this->originalCache = $cache;
280
- $this->cache = new Twig_Cache_Null();
281
  } elseif (null === $cache) {
282
  @trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
283
  $this->originalCache = false;
284
- $this->cache = new Twig_Cache_Null();
285
- } elseif ($cache instanceof Twig_CacheInterface) {
286
  $this->originalCache = $this->cache = $cache;
287
  } else {
288
- throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_CacheInterface implementation.'));
289
  }
290
  }
291
 
@@ -353,9 +353,9 @@ class Twig_Environment
353
  *
354
  * @return string The rendered template
355
  *
356
- * @throws Twig_Error_Loader When the template cannot be found
357
- * @throws Twig_Error_Syntax When an error occurred during compilation
358
- * @throws Twig_Error_Runtime When an error occurred during rendering
359
  */
360
  public function render($name, array $context = array())
361
  {
@@ -368,9 +368,9 @@ class Twig_Environment
368
  * @param string $name The template name
369
  * @param array $context An array of parameters to pass to the template
370
  *
371
- * @throws Twig_Error_Loader When the template cannot be found
372
- * @throws Twig_Error_Syntax When an error occurred during compilation
373
- * @throws Twig_Error_Runtime When an error occurred during rendering
374
  */
375
  public function display($name, array $context = array())
376
  {
@@ -380,21 +380,21 @@ class Twig_Environment
380
  /**
381
  * Loads a template.
382
  *
383
- * @param string|Twig_TemplateWrapper|Twig_Template $name The template name
384
  *
385
- * @return Twig_TemplateWrapper
386
  */
387
  public function load($name)
388
  {
389
- if ($name instanceof Twig_TemplateWrapper) {
390
  return $name;
391
  }
392
 
393
- if ($name instanceof Twig_Template) {
394
- return new Twig_TemplateWrapper($this, $name);
395
  }
396
 
397
- return new Twig_TemplateWrapper($this, $this->loadTemplate($name));
398
  }
399
 
400
  /**
@@ -406,11 +406,11 @@ class Twig_Environment
406
  * @param string $name The template name
407
  * @param int $index The index if it is an embedded template
408
  *
409
- * @return Twig_TemplateInterface A template instance representing the given template name
410
  *
411
- * @throws Twig_Error_Loader When the template cannot be found
412
- * @throws Twig_Error_Runtime When a previously generated cache is corrupted
413
- * @throws Twig_Error_Syntax When an error occurred during compilation
414
  *
415
  * @internal
416
  */
@@ -438,8 +438,8 @@ class Twig_Environment
438
 
439
  if (!class_exists($cls, false)) {
440
  $loader = $this->getLoader();
441
- if (!$loader instanceof Twig_SourceContextLoaderInterface) {
442
- $source = new Twig_Source($loader->getSource($name), $name);
443
  } else {
444
  $source = $loader->getSourceContext($name);
445
  }
@@ -464,7 +464,7 @@ class Twig_Environment
464
  }
465
 
466
  if (!class_exists($cls, false)) {
467
- throw new Twig_Error_Runtime(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source);
468
  }
469
  }
470
 
@@ -482,17 +482,17 @@ class Twig_Environment
482
  *
483
  * @param string $template The template name
484
  *
485
- * @return Twig_Template A template instance representing the given template name
486
  *
487
- * @throws Twig_Error_Loader When the template cannot be found
488
- * @throws Twig_Error_Syntax When an error occurred during compilation
489
  */
490
  public function createTemplate($template)
491
  {
492
  $name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false));
493
 
494
- $loader = new Twig_Loader_Chain(array(
495
- new Twig_Loader_Array(array($name => $template)),
496
  $current = $this->getLoader(),
497
  ));
498
 
@@ -542,15 +542,15 @@ class Twig_Environment
542
  /**
543
  * Tries to load a template consecutively from an array.
544
  *
545
- * Similar to loadTemplate() but it also accepts Twig_TemplateInterface instances and an array
546
  * of templates where each is tried to be loaded.
547
  *
548
- * @param string|Twig_Template|array $names A template or an array of templates to try consecutively
549
  *
550
- * @return Twig_Template
551
  *
552
- * @throws Twig_Error_Loader When none of the templates can be found
553
- * @throws Twig_Error_Syntax When an error occurred during compilation
554
  */
555
  public function resolveTemplate($names)
556
  {
@@ -559,13 +559,13 @@ class Twig_Environment
559
  }
560
 
561
  foreach ($names as $name) {
562
- if ($name instanceof Twig_Template) {
563
  return $name;
564
  }
565
 
566
  try {
567
  return $this->loadTemplate($name);
568
- } catch (Twig_Error_Loader $e) {
569
  }
570
  }
571
 
@@ -573,7 +573,7 @@ class Twig_Environment
573
  throw $e;
574
  }
575
 
576
- throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
577
  }
578
 
579
  /**
@@ -609,7 +609,7 @@ class Twig_Environment
609
  /**
610
  * Gets the Lexer instance.
611
  *
612
- * @return Twig_LexerInterface
613
  *
614
  * @deprecated since 1.25 (to be removed in 2.0)
615
  */
@@ -618,13 +618,13 @@ class Twig_Environment
618
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
619
 
620
  if (null === $this->lexer) {
621
- $this->lexer = new Twig_Lexer($this);
622
  }
623
 
624
  return $this->lexer;
625
  }
626
 
627
- public function setLexer(Twig_LexerInterface $lexer)
628
  {
629
  $this->lexer = $lexer;
630
  }
@@ -632,22 +632,22 @@ class Twig_Environment
632
  /**
633
  * Tokenizes a source code.
634
  *
635
- * @param string|Twig_Source $source The template source code
636
  * @param string $name The template name (deprecated)
637
  *
638
- * @return Twig_TokenStream
639
  *
640
- * @throws Twig_Error_Syntax When the code is syntactically wrong
641
  */
642
  public function tokenize($source, $name = null)
643
  {
644
- if (!$source instanceof Twig_Source) {
645
- @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
646
- $source = new Twig_Source($source, $name);
647
  }
648
 
649
  if (null === $this->lexer) {
650
- $this->lexer = new Twig_Lexer($this);
651
  }
652
 
653
  return $this->lexer->tokenize($source);
@@ -656,7 +656,7 @@ class Twig_Environment
656
  /**
657
  * Gets the Parser instance.
658
  *
659
- * @return Twig_ParserInterface
660
  *
661
  * @deprecated since 1.25 (to be removed in 2.0)
662
  */
@@ -665,13 +665,13 @@ class Twig_Environment
665
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
666
 
667
  if (null === $this->parser) {
668
- $this->parser = new Twig_Parser($this);
669
  }
670
 
671
  return $this->parser;
672
  }
673
 
674
- public function setParser(Twig_ParserInterface $parser)
675
  {
676
  $this->parser = $parser;
677
  }
@@ -679,14 +679,14 @@ class Twig_Environment
679
  /**
680
  * Converts a token stream to a node tree.
681
  *
682
- * @return Twig_Node_Module
683
  *
684
- * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
685
  */
686
- public function parse(Twig_TokenStream $stream)
687
  {
688
  if (null === $this->parser) {
689
- $this->parser = new Twig_Parser($this);
690
  }
691
 
692
  return $this->parser->parse($stream);
@@ -695,7 +695,7 @@ class Twig_Environment
695
  /**
696
  * Gets the Compiler instance.
697
  *
698
- * @return Twig_CompilerInterface
699
  *
700
  * @deprecated since 1.25 (to be removed in 2.0)
701
  */
@@ -704,13 +704,13 @@ class Twig_Environment
704
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
705
 
706
  if (null === $this->compiler) {
707
- $this->compiler = new Twig_Compiler($this);
708
  }
709
 
710
  return $this->compiler;
711
  }
712
 
713
- public function setCompiler(Twig_CompilerInterface $compiler)
714
  {
715
  $this->compiler = $compiler;
716
  }
@@ -720,10 +720,10 @@ class Twig_Environment
720
  *
721
  * @return string The compiled PHP source code
722
  */
723
- public function compile(Twig_NodeInterface $node)
724
  {
725
  if (null === $this->compiler) {
726
- $this->compiler = new Twig_Compiler($this);
727
  }
728
 
729
  return $this->compiler->compile($node)->getSource();
@@ -732,34 +732,34 @@ class Twig_Environment
732
  /**
733
  * Compiles a template source code.
734
  *
735
- * @param string|Twig_Source $source The template source code
736
  * @param string $name The template name (deprecated)
737
  *
738
  * @return string The compiled PHP source code
739
  *
740
- * @throws Twig_Error_Syntax When there was an error during tokenizing, parsing or compiling
741
  */
742
  public function compileSource($source, $name = null)
743
  {
744
- if (!$source instanceof Twig_Source) {
745
- @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
746
- $source = new Twig_Source($source, $name);
747
  }
748
 
749
  try {
750
  return $this->compile($this->parse($this->tokenize($source)));
751
- } catch (Twig_Error $e) {
752
  $e->setSourceContext($source);
753
  throw $e;
754
  } catch (Exception $e) {
755
- throw new Twig_Error_Syntax(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e);
756
  }
757
  }
758
 
759
- public function setLoader(Twig_LoaderInterface $loader)
760
  {
761
- if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_LoaderInterface')) {
762
- @trigger_error(sprintf('Twig loader "%s" should implement Twig_SourceContextLoaderInterface since version 1.27.', get_class($loader)), E_USER_DEPRECATED);
763
  }
764
 
765
  $this->loader = $loader;
@@ -768,7 +768,7 @@ class Twig_Environment
768
  /**
769
  * Gets the Loader instance.
770
  *
771
- * @return Twig_LoaderInterface
772
  */
773
  public function getLoader()
774
  {
@@ -809,11 +809,11 @@ class Twig_Environment
809
  $this->runtimeInitialized = true;
810
 
811
  foreach ($this->getExtensions() as $name => $extension) {
812
- if (!$extension instanceof Twig_Extension_InitRuntimeInterface) {
813
  $m = new ReflectionMethod($extension, 'initRuntime');
814
 
815
- if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
816
- @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
817
  }
818
  }
819
 
@@ -845,7 +845,7 @@ class Twig_Environment
845
  /**
846
  * Adds a runtime loader.
847
  */
848
- public function addRuntimeLoader(Twig_RuntimeLoaderInterface $loader)
849
  {
850
  $this->runtimeLoaders[] = $loader;
851
  }
@@ -855,7 +855,7 @@ class Twig_Environment
855
  *
856
  * @param string $class The extension class name
857
  *
858
- * @return Twig_ExtensionInterface
859
  */
860
  public function getExtension($class)
861
  {
@@ -870,7 +870,7 @@ class Twig_Environment
870
  }
871
 
872
  if (!isset($this->extensionsByClass[$class])) {
873
- throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $class));
874
  }
875
 
876
  return $this->extensionsByClass[$class];
@@ -883,7 +883,7 @@ class Twig_Environment
883
  *
884
  * @return object The runtime implementation
885
  *
886
- * @throws Twig_Error_Runtime When the template cannot be found
887
  */
888
  public function getRuntime($class)
889
  {
@@ -897,10 +897,10 @@ class Twig_Environment
897
  }
898
  }
899
 
900
- throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
901
  }
902
 
903
- public function addExtension(Twig_ExtensionInterface $extension)
904
  {
905
  if ($this->extensionInitialized) {
906
  throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
@@ -965,14 +965,14 @@ class Twig_Environment
965
  /**
966
  * Returns all registered extensions.
967
  *
968
- * @return Twig_ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on)
969
  */
970
  public function getExtensions()
971
  {
972
  return $this->extensions;
973
  }
974
 
975
- public function addTokenParser(Twig_TokenParserInterface $parser)
976
  {
977
  if ($this->extensionInitialized) {
978
  throw new LogicException('Unable to add a token parser as extensions have already been initialized.');
@@ -984,7 +984,7 @@ class Twig_Environment
984
  /**
985
  * Gets the registered Token Parsers.
986
  *
987
- * @return Twig_TokenParserBrokerInterface
988
  *
989
  * @internal
990
  */
@@ -1000,9 +1000,9 @@ class Twig_Environment
1000
  /**
1001
  * Gets registered tags.
1002
  *
1003
- * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.
1004
  *
1005
- * @return Twig_TokenParserInterface[]
1006
  *
1007
  * @internal
1008
  */
@@ -1010,7 +1010,7 @@ class Twig_Environment
1010
  {
1011
  $tags = array();
1012
  foreach ($this->getTokenParsers()->getParsers() as $parser) {
1013
- if ($parser instanceof Twig_TokenParserInterface) {
1014
  $tags[$parser->getTag()] = $parser;
1015
  }
1016
  }
@@ -1018,7 +1018,7 @@ class Twig_Environment
1018
  return $tags;
1019
  }
1020
 
1021
- public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
1022
  {
1023
  if ($this->extensionInitialized) {
1024
  throw new LogicException('Unable to add a node visitor as extensions have already been initialized.');
@@ -1030,7 +1030,7 @@ class Twig_Environment
1030
  /**
1031
  * Gets the registered Node Visitors.
1032
  *
1033
- * @return Twig_NodeVisitorInterface[]
1034
  *
1035
  * @internal
1036
  */
@@ -1046,20 +1046,20 @@ class Twig_Environment
1046
  /**
1047
  * Registers a Filter.
1048
  *
1049
- * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance
1050
- * @param Twig_FilterInterface|Twig_SimpleFilter $filter
1051
  */
1052
  public function addFilter($name, $filter = null)
1053
  {
1054
- if (!$name instanceof Twig_SimpleFilter && !($filter instanceof Twig_SimpleFilter || $filter instanceof Twig_FilterInterface)) {
1055
- throw new LogicException('A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter.');
1056
  }
1057
 
1058
- if ($name instanceof Twig_SimpleFilter) {
1059
  $filter = $name;
1060
  $name = $filter->getName();
1061
  } else {
1062
- @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1063
  }
1064
 
1065
  if ($this->extensionInitialized) {
@@ -1077,7 +1077,7 @@ class Twig_Environment
1077
  *
1078
  * @param string $name The filter name
1079
  *
1080
- * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist
1081
  *
1082
  * @internal
1083
  */
@@ -1123,7 +1123,7 @@ class Twig_Environment
1123
  *
1124
  * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
1125
  *
1126
- * @return Twig_FilterInterface[]
1127
  *
1128
  * @see registerUndefinedFilterCallback
1129
  *
@@ -1141,20 +1141,20 @@ class Twig_Environment
1141
  /**
1142
  * Registers a Test.
1143
  *
1144
- * @param string|Twig_SimpleTest $name The test name or a Twig_SimpleTest instance
1145
- * @param Twig_TestInterface|Twig_SimpleTest $test A Twig_TestInterface instance or a Twig_SimpleTest instance
1146
  */
1147
  public function addTest($name, $test = null)
1148
  {
1149
- if (!$name instanceof Twig_SimpleTest && !($test instanceof Twig_SimpleTest || $test instanceof Twig_TestInterface)) {
1150
- throw new LogicException('A test must be an instance of Twig_TestInterface or Twig_SimpleTest.');
1151
  }
1152
 
1153
- if ($name instanceof Twig_SimpleTest) {
1154
  $test = $name;
1155
  $name = $test->getName();
1156
  } else {
1157
- @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1158
  }
1159
 
1160
  if ($this->extensionInitialized) {
@@ -1167,7 +1167,7 @@ class Twig_Environment
1167
  /**
1168
  * Gets the registered Tests.
1169
  *
1170
- * @return Twig_TestInterface[]
1171
  *
1172
  * @internal
1173
  */
@@ -1185,7 +1185,7 @@ class Twig_Environment
1185
  *
1186
  * @param string $name The test name
1187
  *
1188
- * @return Twig_Test|false A Twig_Test instance or false if the test does not exist
1189
  *
1190
  * @internal
1191
  */
@@ -1205,20 +1205,20 @@ class Twig_Environment
1205
  /**
1206
  * Registers a Function.
1207
  *
1208
- * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance
1209
- * @param Twig_FunctionInterface|Twig_SimpleFunction $function
1210
  */
1211
  public function addFunction($name, $function = null)
1212
  {
1213
- if (!$name instanceof Twig_SimpleFunction && !($function instanceof Twig_SimpleFunction || $function instanceof Twig_FunctionInterface)) {
1214
- throw new LogicException('A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction.');
1215
  }
1216
 
1217
- if ($name instanceof Twig_SimpleFunction) {
1218
  $function = $name;
1219
  $name = $function->getName();
1220
  } else {
1221
- @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1222
  }
1223
 
1224
  if ($this->extensionInitialized) {
@@ -1236,7 +1236,7 @@ class Twig_Environment
1236
  *
1237
  * @param string $name function name
1238
  *
1239
- * @return Twig_Function|false A Twig_Function instance or false if the function does not exist
1240
  *
1241
  * @internal
1242
  */
@@ -1282,7 +1282,7 @@ class Twig_Environment
1282
  *
1283
  * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
1284
  *
1285
- * @return Twig_FunctionInterface[]
1286
  *
1287
  * @see registerUndefinedFunctionCallback
1288
  *
@@ -1407,7 +1407,7 @@ class Twig_Environment
1407
  {
1408
  @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
1409
 
1410
- return Twig_Error_Syntax::computeAlternatives($name, $items);
1411
  }
1412
 
1413
  /**
@@ -1417,11 +1417,11 @@ class Twig_Environment
1417
  {
1418
  $globals = array();
1419
  foreach ($this->extensions as $name => $extension) {
1420
- if (!$extension instanceof Twig_Extension_GlobalsInterface) {
1421
  $m = new ReflectionMethod($extension, 'getGlobals');
1422
 
1423
- if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
1424
- @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED);
1425
  }
1426
  }
1427
 
@@ -1447,7 +1447,7 @@ class Twig_Environment
1447
  return;
1448
  }
1449
 
1450
- $this->parsers = new Twig_TokenParserBroker(array(), array(), false);
1451
  $this->filters = array();
1452
  $this->functions = array();
1453
  $this->tests = array();
@@ -1466,14 +1466,14 @@ class Twig_Environment
1466
  /**
1467
  * @internal
1468
  */
1469
- protected function initExtension(Twig_ExtensionInterface $extension)
1470
  {
1471
  // filters
1472
  foreach ($extension->getFilters() as $name => $filter) {
1473
- if ($filter instanceof Twig_SimpleFilter) {
1474
  $name = $filter->getName();
1475
  } else {
1476
- @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use Twig_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED);
1477
  }
1478
 
1479
  $this->filters[$name] = $filter;
@@ -1481,10 +1481,10 @@ class Twig_Environment
1481
 
1482
  // functions
1483
  foreach ($extension->getFunctions() as $name => $function) {
1484
- if ($function instanceof Twig_SimpleFunction) {
1485
  $name = $function->getName();
1486
  } else {
1487
- @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use Twig_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED);
1488
  }
1489
 
1490
  $this->functions[$name] = $function;
@@ -1492,10 +1492,10 @@ class Twig_Environment
1492
 
1493
  // tests
1494
  foreach ($extension->getTests() as $name => $test) {
1495
- if ($test instanceof Twig_SimpleTest) {
1496
  $name = $test->getName();
1497
  } else {
1498
- @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use Twig_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED);
1499
  }
1500
 
1501
  $this->tests[$name] = $test;
@@ -1503,14 +1503,14 @@ class Twig_Environment
1503
 
1504
  // token parsers
1505
  foreach ($extension->getTokenParsers() as $parser) {
1506
- if ($parser instanceof Twig_TokenParserInterface) {
1507
  $this->parsers->addTokenParser($parser);
1508
- } elseif ($parser instanceof Twig_TokenParserBrokerInterface) {
1509
- @trigger_error('Registering a Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED);
1510
 
1511
  $this->parsers->addTokenParserBroker($parser);
1512
  } else {
1513
- throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances.');
1514
  }
1515
  }
1516
 
@@ -1547,7 +1547,7 @@ class Twig_Environment
1547
  $hashParts = array_merge(
1548
  array_keys($this->extensions),
1549
  array(
1550
- (int) function_exists('twig_template_get_attributes'),
1551
  PHP_MAJOR_VERSION,
1552
  PHP_MINOR_VERSION,
1553
  self::VERSION,
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Environment
18
  {
19
  const VERSION = '1.33.2';
20
  const VERSION_ID = 13302;
70
  * * charset: The charset used by the templates (default to UTF-8).
71
  *
72
  * * base_template_class: The base template class to use for generated
73
+ * templates (default to Twig_SupTwg_Template).
74
  *
75
  * * cache: An absolute path where to store the compiled templates,
76
+ * a Twig_SupTwg_Cache_Interface implementation,
77
  * or false to disable compilation cache (default).
78
  *
79
  * * auto_reload: Whether to reload the template if the original source changed.
94
  * (default to -1 which means that all optimizations are enabled;
95
  * set it to 0 to disable).
96
  *
97
+ * @param Twig_SupTwg_LoaderInterface $loader
98
  * @param array $options An array of options
99
  */
100
+ public function __construct(Twig_SupTwg_LoaderInterface $loader = null, $options = array())
101
  {
102
  if (null !== $loader) {
103
  $this->setLoader($loader);
104
  } else {
105
+ @trigger_error('Not passing a Twig_SupTwg_LoaderInterface as the first constructor argument of Twig_SupTwg_Environment is deprecated since version 1.21.', E_USER_DEPRECATED);
106
  }
107
 
108
  $options = array_merge(array(
109
  'debug' => false,
110
  'charset' => 'UTF-8',
111
+ 'base_template_class' => 'Twig_SupTwg_Template',
112
  'strict_variables' => false,
113
  'autoescape' => 'html',
114
  'cache' => false,
123
  $this->strictVariables = (bool) $options['strict_variables'];
124
  $this->setCache($options['cache']);
125
 
126
+ $this->addExtension(new Twig_SupTwg_Extension_Core());
127
+ $this->addExtension(new Twig_SupTwg_Extension_Escaper($options['autoescape']));
128
+ $this->addExtension(new Twig_SupTwg_Extension_Optimizer($options['optimizations']));
129
+ $this->staging = new Twig_SupTwg_Extension_Staging();
130
 
131
  // For BC
132
  if (is_string($this->originalCache)) {
133
  $r = new ReflectionMethod($this, 'writeCacheFile');
134
  if ($r->getDeclaringClass()->getName() !== __CLASS__) {
135
+ @trigger_error('The Twig_SupTwg_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
136
 
137
  $this->bcWriteCacheFile = true;
138
  }
139
 
140
  $r = new ReflectionMethod($this, 'getCacheFilename');
141
  if ($r->getDeclaringClass()->getName() !== __CLASS__) {
142
+ @trigger_error('The Twig_SupTwg_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
143
 
144
  $this->bcGetCacheFilename = true;
145
  }
254
  *
255
  * @param bool $original Whether to return the original cache option or the real cache instance
256
  *
257
+ * @return Twig_SupTwg_CacheInterface|string|false A Twig_SupTwg_CacheInterface implementation,
258
  * an absolute path to the compiled templates,
259
  * or false to disable cache
260
  */
266
  /**
267
  * Sets the current cache implementation.
268
  *
269
+ * @param Twig_SupTwg_CacheInterface|string|false $cache A Twig_SupTwg_CacheInterface implementation,
270
  * an absolute path to the compiled templates,
271
  * or false to disable cache
272
  */
274
  {
275
  if (is_string($cache)) {
276
  $this->originalCache = $cache;
277
+ $this->cache = new Twig_SupTwg_Cache_Filesystem($cache);
278
  } elseif (false === $cache) {
279
  $this->originalCache = $cache;
280
+ $this->cache = new Twig_SupTwg_Cache_Null();
281
  } elseif (null === $cache) {
282
  @trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
283
  $this->originalCache = false;
284
+ $this->cache = new Twig_SupTwg_Cache_Null();
285
+ } elseif ($cache instanceof Twig_SupTwg_CacheInterface) {
286
  $this->originalCache = $this->cache = $cache;
287
  } else {
288
+ throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_SupTwg_CacheInterface implementation.'));
289
  }
290
  }
291
 
353
  *
354
  * @return string The rendered template
355
  *
356
+ * @throws Twig_SupTwg_Error_Loader When the template cannot be found
357
+ * @throws Twig_SupTwg_Error_Syntax When an error occurred during compilation
358
+ * @throws Twig_SupTwg_Error_Runtime When an error occurred during rendering
359
  */
360
  public function render($name, array $context = array())
361
  {
368
  * @param string $name The template name
369
  * @param array $context An array of parameters to pass to the template
370
  *
371
+ * @throws Twig_SupTwg_Error_Loader When the template cannot be found
372
+ * @throws Twig_SupTwg_Error_Syntax When an error occurred during compilation
373
+ * @throws Twig_SupTwg_Error_Runtime When an error occurred during rendering
374
  */
375
  public function display($name, array $context = array())
376
  {
380
  /**
381
  * Loads a template.
382
  *
383
+ * @param string|Twig_SupTwg_TemplateWrapper|Twig_SupTwg_Template $name The template name
384
  *
385
+ * @return Twig_SupTwg_TemplateWrapper
386
  */
387
  public function load($name)
388
  {
389
+ if ($name instanceof Twig_SupTwg_TemplateWrapper) {
390
  return $name;
391
  }
392
 
393
+ if ($name instanceof Twig_SupTwg_Template) {
394
+ return new Twig_SupTwg_TemplateWrapper($this, $name);
395
  }
396
 
397
+ return new Twig_SupTwg_TemplateWrapper($this, $this->loadTemplate($name));
398
  }
399
 
400
  /**
406
  * @param string $name The template name
407
  * @param int $index The index if it is an embedded template
408
  *
409
+ * @return Twig_SupTwg_TemplateInterface A template instance representing the given template name
410
  *
411
+ * @throws Twig_SupTwg_Error_Loader When the template cannot be found
412
+ * @throws Twig_SupTwg_Error_Runtime When a previously generated cache is corrupted
413
+ * @throws Twig_SupTwg_Error_Syntax When an error occurred during compilation
414
  *
415
  * @internal
416
  */
438
 
439
  if (!class_exists($cls, false)) {
440
  $loader = $this->getLoader();
441
+ if (!$loader instanceof Twig_SupTwg_SourceContextLoaderInterface) {
442
+ $source = new Twig_SupTwg_Source($loader->getSource($name), $name);
443
  } else {
444
  $source = $loader->getSourceContext($name);
445
  }
464
  }
465
 
466
  if (!class_exists($cls, false)) {
467
+ throw new Twig_SupTwg_Error_Runtime(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source);
468
  }
469
  }
470
 
482
  *
483
  * @param string $template The template name
484
  *
485
+ * @return Twig_SupTwg_Template A template instance representing the given template name
486
  *
487
+ * @throws Twig_SupTwg_Error_Loader When the template cannot be found
488
+ * @throws Twig_SupTwg_Error_Syntax When an error occurred during compilation
489
  */
490
  public function createTemplate($template)
491
  {
492
  $name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false));
493
 
494
+ $loader = new Twig_SupTwg_Loader_Chain(array(
495
+ new Twig_SupTwg_Loader_Array(array($name => $template)),
496
  $current = $this->getLoader(),
497
  ));
498
 
542
  /**
543
  * Tries to load a template consecutively from an array.
544
  *
545
+ * Similar to loadTemplate() but it also accepts Twig_SupTwg_TemplateInterface instances and an array
546
  * of templates where each is tried to be loaded.
547
  *
548
+ * @param string|Twig_SupTwg_Template|array $names A template or an array of templates to try consecutively
549
  *
550
+ * @return Twig_SupTwg_Template
551
  *
552
+ * @throws Twig_SupTwg_Error_Loader When none of the templates can be found
553
+ * @throws Twig_SupTwg_Error_Syntax When an error occurred during compilation
554
  */
555
  public function resolveTemplate($names)
556
  {
559
  }
560
 
561
  foreach ($names as $name) {
562
+ if ($name instanceof Twig_SupTwg_Template) {
563
  return $name;
564
  }
565
 
566
  try {
567
  return $this->loadTemplate($name);
568
+ } catch (Twig_SupTwg_Error_Loader $e) {
569
  }
570
  }
571
 
573
  throw $e;
574
  }
575
 
576
+ throw new Twig_SupTwg_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
577
  }
578
 
579
  /**
609
  /**
610
  * Gets the Lexer instance.
611
  *
612
+ * @return Twig_SupTwg_LexerInterface
613
  *
614
  * @deprecated since 1.25 (to be removed in 2.0)
615
  */
618
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
619
 
620
  if (null === $this->lexer) {
621
+ $this->lexer = new Twig_SupTwg_Lexer($this);
622
  }
623
 
624
  return $this->lexer;
625
  }
626
 
627
+ public function setLexer(Twig_SupTwg_LexerInterface $lexer)
628
  {
629
  $this->lexer = $lexer;
630
  }
632
  /**
633
  * Tokenizes a source code.
634
  *
635
+ * @param string|Twig_SupTwg_Source $source The template source code
636
  * @param string $name The template name (deprecated)
637
  *
638
+ * @return Twig_SupTwg_TokenStream
639
  *
640
+ * @throws Twig_SupTwg_Error_Syntax When the code is syntactically wrong
641
  */
642
  public function tokenize($source, $name = null)
643
  {
644
+ if (!$source instanceof Twig_SupTwg_Source) {
645
+ @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwg_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
646
+ $source = new Twig_SupTwg_Source($source, $name);
647
  }
648
 
649
  if (null === $this->lexer) {
650
+ $this->lexer = new Twig_SupTwg_Lexer($this);
651
  }
652
 
653
  return $this->lexer->tokenize($source);
656
  /**
657
  * Gets the Parser instance.
658
  *
659
+ * @return Twig_SupTwg_ParserInterface
660
  *
661
  * @deprecated since 1.25 (to be removed in 2.0)
662
  */
665
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
666
 
667
  if (null === $this->parser) {
668
+ $this->parser = new Twig_SupTwg_Parser($this);
669
  }
670
 
671
  return $this->parser;
672
  }
673
 
674
+ public function setParser(Twig_SupTwg_ParserInterface $parser)
675
  {
676
  $this->parser = $parser;
677
  }
679
  /**
680
  * Converts a token stream to a node tree.
681
  *
682
+ * @return Twig_SupTwg_Node_Module
683
  *
684
+ * @throws Twig_SupTwg_Error_Syntax When the token stream is syntactically or semantically wrong
685
  */
686
+ public function parse(Twig_SupTwg_TokenStream $stream)
687
  {
688
  if (null === $this->parser) {
689
+ $this->parser = new Twig_SupTwg_Parser($this);
690
  }
691
 
692
  return $this->parser->parse($stream);
695
  /**
696
  * Gets the Compiler instance.
697
  *
698
+ * @return Twig_SupTwg_CompilerInterface
699
  *
700
  * @deprecated since 1.25 (to be removed in 2.0)
701
  */
704
  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
705
 
706
  if (null === $this->compiler) {
707
+ $this->compiler = new Twig_SupTwg_Compiler($this);
708
  }
709
 
710
  return $this->compiler;
711
  }
712
 
713
+ public function setCompiler(Twig_SupTwg_CompilerInterface $compiler)
714
  {
715
  $this->compiler = $compiler;
716
  }
720
  *
721
  * @return string The compiled PHP source code
722
  */
723
+ public function compile(Twig_SupTwg_NodeInterface $node)
724
  {
725
  if (null === $this->compiler) {
726
+ $this->compiler = new Twig_SupTwg_Compiler($this);
727
  }
728
 
729
  return $this->compiler->compile($node)->getSource();
732
  /**
733
  * Compiles a template source code.
734
  *
735
+ * @param string|Twig_SupTwg_Source $source The template source code
736
  * @param string $name The template name (deprecated)
737
  *
738
  * @return string The compiled PHP source code
739
  *
740
+ * @throws Twig_SupTwg_Error_Syntax When there was an error during tokenizing, parsing or compiling
741
  */
742
  public function compileSource($source, $name = null)
743
  {
744
+ if (!$source instanceof Twig_SupTwg_Source) {
745
+ @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwg_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
746
+ $source = new Twig_SupTwg_Source($source, $name);
747
  }
748
 
749
  try {
750
  return $this->compile($this->parse($this->tokenize($source)));
751
+ } catch (Twig_SupTwg_Error $e) {
752
  $e->setSourceContext($source);
753
  throw $e;
754
  } catch (Exception $e) {
755
+ throw new Twig_SupTwg_Error_Syntax(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e);
756
  }
757
  }
758
 
759
+ public function setLoader(Twig_SupTwg_LoaderInterface $loader)
760
  {
761
+ if (!$loader instanceof Twig_SupTwg_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_SupTwg_LoaderInterface')) {
762
+ @trigger_error(sprintf('Twig loader "%s" should implement Twig_SupTwg_SourceContextLoaderInterface since version 1.27.', get_class($loader)), E_USER_DEPRECATED);
763
  }
764
 
765
  $this->loader = $loader;
768
  /**
769
  * Gets the Loader instance.
770
  *
771
+ * @return Twig_SupTwg_LoaderInterface
772
  */
773
  public function getLoader()
774
  {
809
  $this->runtimeInitialized = true;
810
 
811
  foreach ($this->getExtensions() as $name => $extension) {
812
+ if (!$extension instanceof Twig_SupTwg_Extension_InitRuntimeInterface) {
813
  $m = new ReflectionMethod($extension, 'initRuntime');
814
 
815
+ if ('Twig_SupTwg_Extension' !== $m->getDeclaringClass()->getName()) {
816
+ @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_SupTwg_Environment instance in filters, functions, or tests; or explicitly implement Twig_SupTwg_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
817
  }
818
  }
819
 
845
  /**
846
  * Adds a runtime loader.
847
  */
848
+ public function addRuntimeLoader(Twig_SupTwg_RuntimeLoaderInterface $loader)
849
  {
850
  $this->runtimeLoaders[] = $loader;
851
  }
855
  *
856
  * @param string $class The extension class name
857
  *
858
+ * @return Twig_SupTwg_ExtensionInterface
859
  */
860
  public function getExtension($class)
861
  {
870
  }
871
 
872
  if (!isset($this->extensionsByClass[$class])) {
873
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The "%s" extension is not enabled.', $class));
874
  }
875
 
876
  return $this->extensionsByClass[$class];
883
  *
884
  * @return object The runtime implementation
885
  *
886
+ * @throws Twig_SupTwg_Error_Runtime When the template cannot be found
887
  */
888
  public function getRuntime($class)
889
  {
897
  }
898
  }
899
 
900
+ throw new Twig_SupTwg_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
901
  }
902
 
903
+ public function addExtension(Twig_SupTwg_ExtensionInterface $extension)
904
  {
905
  if ($this->extensionInitialized) {
906
  throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
965
  /**
966
  * Returns all registered extensions.
967
  *
968
+ * @return Twig_SupTwg_ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on)
969
  */
970
  public function getExtensions()
971
  {
972
  return $this->extensions;
973
  }
974
 
975
+ public function addTokenParser(Twig_SupTwg_TokenParserInterface $parser)
976
  {
977
  if ($this->extensionInitialized) {
978
  throw new LogicException('Unable to add a token parser as extensions have already been initialized.');
984
  /**
985
  * Gets the registered Token Parsers.
986
  *
987
+ * @return Twig_SupTwg_TokenParserBrokerInterface
988
  *
989
  * @internal
990
  */
1000
  /**
1001
  * Gets registered tags.
1002
  *
1003
+ * Be warned that this method cannot return tags defined by Twig_SupTwg_TokenParserBrokerInterface classes.
1004
  *
1005
+ * @return Twig_SupTwg_TokenParserInterface[]
1006
  *
1007
  * @internal
1008
  */
1010
  {
1011
  $tags = array();
1012
  foreach ($this->getTokenParsers()->getParsers() as $parser) {
1013
+ if ($parser instanceof Twig_SupTwg_TokenParserInterface) {
1014
  $tags[$parser->getTag()] = $parser;
1015
  }
1016
  }
1018
  return $tags;
1019
  }
1020
 
1021
+ public function addNodeVisitor(Twig_SupTwg_NodeVisitorInterface $visitor)
1022
  {
1023
  if ($this->extensionInitialized) {
1024
  throw new LogicException('Unable to add a node visitor as extensions have already been initialized.');
1030
  /**
1031
  * Gets the registered Node Visitors.
1032
  *
1033
+ * @return Twig_SupTwg_NodeVisitorInterface[]
1034
  *
1035
  * @internal
1036
  */
1046
  /**
1047
  * Registers a Filter.
1048
  *
1049
+ * @param string|Twig_SupTwg_SimpleFilter $name The filter name or a Twig_SupTwg_SimpleFilter instance
1050
+ * @param Twig_SupTwg_FilterInterface|Twig_SupTwg_SimpleFilter $filter
1051
  */
1052
  public function addFilter($name, $filter = null)
1053
  {
1054
+ if (!$name instanceof Twig_SupTwg_SimpleFilter && !($filter instanceof Twig_SupTwg_SimpleFilter || $filter instanceof Twig_SupTwg_FilterInterface)) {
1055
+ throw new LogicException('A filter must be an instance of Twig_SupTwg_FilterInterface or Twig_SupTwg_SimpleFilter.');
1056
  }
1057
 
1058
+ if ($name instanceof Twig_SupTwg_SimpleFilter) {
1059
  $filter = $name;
1060
  $name = $filter->getName();
1061
  } else {
1062
+ @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SupTwg_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1063
  }
1064
 
1065
  if ($this->extensionInitialized) {
1077
  *
1078
  * @param string $name The filter name
1079
  *
1080
+ * @return Twig_SupTwg_Filter|false A Twig_SupTwg_Filter instance or false if the filter does not exist
1081
  *
1082
  * @internal
1083
  */
1123
  *
1124
  * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
1125
  *
1126
+ * @return Twig_SupTwg_FilterInterface[]
1127
  *
1128
  * @see registerUndefinedFilterCallback
1129
  *
1141
  /**
1142
  * Registers a Test.
1143
  *
1144
+ * @param string|Twig_SupTwg_SimpleTest $name The test name or a Twig_SupTwg_SimpleTest instance
1145
+ * @param Twig_SupTwg_TestInterface|Twig_SupTwg_SimpleTest $test A Twig_SupTwg_TestInterface instance or a Twig_SupTwg_SimpleTest instance
1146
  */
1147
  public function addTest($name, $test = null)
1148
  {
1149
+ if (!$name instanceof Twig_SupTwg_SimpleTest && !($test instanceof Twig_SupTwg_SimpleTest || $test instanceof Twig_SupTwg_TestInterface)) {
1150
+ throw new LogicException('A test must be an instance of Twig_SupTwg_TestInterface or Twig_SupTwg_SimpleTest.');
1151
  }
1152
 
1153
+ if ($name instanceof Twig_SupTwg_SimpleTest) {
1154
  $test = $name;
1155
  $name = $test->getName();
1156
  } else {
1157
+ @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SupTwg_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1158
  }
1159
 
1160
  if ($this->extensionInitialized) {
1167
  /**
1168
  * Gets the registered Tests.
1169
  *
1170
+ * @return Twig_SupTwg_TestInterface[]
1171
  *
1172
  * @internal
1173
  */
1185
  *
1186
  * @param string $name The test name
1187
  *
1188
+ * @return Twig_SupTwg_Test|false A Twig_SupTwg_Test instance or false if the test does not exist
1189
  *
1190
  * @internal
1191
  */
1205
  /**
1206
  * Registers a Function.
1207
  *
1208
+ * @param string|Twig_SupTwg_SimpleFunction $name The function name or a Twig_SupTwg_SimpleFunction instance
1209
+ * @param Twig_SupTwg_FunctionInterface|Twig_SupTwg_SimpleFunction $function
1210
  */
1211
  public function addFunction($name, $function = null)
1212
  {
1213
+ if (!$name instanceof Twig_SupTwg_SimpleFunction && !($function instanceof Twig_SupTwg_SimpleFunction || $function instanceof Twig_SupTwg_FunctionInterface)) {
1214
+ throw new LogicException('A function must be an instance of Twig_SupTwg_FunctionInterface or Twig_SupTwg_SimpleFunction.');
1215
  }
1216
 
1217
+ if ($name instanceof Twig_SupTwg_SimpleFunction) {
1218
  $function = $name;
1219
  $name = $function->getName();
1220
  } else {
1221
+ @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SupTwg_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1222
  }
1223
 
1224
  if ($this->extensionInitialized) {
1236
  *
1237
  * @param string $name function name
1238
  *
1239
+ * @return Twig_SupTwg_Function|false A Twig_SupTwg_Function instance or false if the function does not exist
1240
  *
1241
  * @internal
1242
  */
1282
  *
1283
  * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
1284
  *
1285
+ * @return Twig_SupTwg_FunctionInterface[]
1286
  *
1287
  * @see registerUndefinedFunctionCallback
1288
  *
1407
  {
1408
  @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
1409
 
1410
+ return Twig_SupTwg_Error_Syntax::computeAlternatives($name, $items);
1411
  }
1412
 
1413
  /**
1417
  {
1418
  $globals = array();
1419
  foreach ($this->extensions as $name => $extension) {
1420
+ if (!$extension instanceof Twig_SupTwg_Extension_GlobalsInterface) {
1421
  $m = new ReflectionMethod($extension, 'getGlobals');
1422
 
1423
+ if ('Twig_SupTwg_Extension' !== $m->getDeclaringClass()->getName()) {
1424
+ @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_SupTwg_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED);
1425
  }
1426
  }
1427
 
1447
  return;
1448
  }
1449
 
1450
+ $this->parsers = new Twig_SupTwg_TokenParserBroker(array(), array(), false);
1451
  $this->filters = array();
1452
  $this->functions = array();
1453
  $this->tests = array();
1466
  /**
1467
  * @internal
1468
  */
1469
+ protected function initExtension(Twig_SupTwg_ExtensionInterface $extension)
1470
  {
1471
  // filters
1472
  foreach ($extension->getFilters() as $name => $filter) {
1473
+ if ($filter instanceof Twig_SupTwg_SimpleFilter) {
1474
  $name = $filter->getName();
1475
  } else {
1476
+ @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use Twig_SupTwg_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED);
1477
  }
1478
 
1479
  $this->filters[$name] = $filter;
1481
 
1482
  // functions
1483
  foreach ($extension->getFunctions() as $name => $function) {
1484
+ if ($function instanceof Twig_SupTwg_SimpleFunction) {
1485
  $name = $function->getName();
1486
  } else {
1487
+ @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use Twig_SupTwg_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED);
1488
  }
1489
 
1490
  $this->functions[$name] = $function;
1492
 
1493
  // tests
1494
  foreach ($extension->getTests() as $name => $test) {
1495
+ if ($test instanceof Twig_SupTwg_SimpleTest) {
1496
  $name = $test->getName();
1497
  } else {
1498
+ @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use Twig_SupTwg_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED);
1499
  }
1500
 
1501
  $this->tests[$name] = $test;
1503
 
1504
  // token parsers
1505
  foreach ($extension->getTokenParsers() as $parser) {
1506
+ if ($parser instanceof Twig_SupTwg_TokenParserInterface) {
1507
  $this->parsers->addTokenParser($parser);
1508
+ } elseif ($parser instanceof Twig_SupTwg_TokenParserBrokerInterface) {
1509
+ @trigger_error('Registering a Twig_SupTwg_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED);
1510
 
1511
  $this->parsers->addTokenParserBroker($parser);
1512
  } else {
1513
+ throw new LogicException('getTokenParsers() must return an array of Twig_SupTwg_TokenParserInterface or Twig_SupTwg_TokenParserBrokerInterface instances.');
1514
  }
1515
  }
1516
 
1547
  $hashParts = array_merge(
1548
  array_keys($this->extensions),
1549
  array(
1550
+ (int) function_exists('Twig_SupTwg_template_get_attributes'),
1551
  PHP_MAJOR_VERSION,
1552
  PHP_MINOR_VERSION,
1553
  self::VERSION,
vendor/Twig/Error.php CHANGED
@@ -31,7 +31,7 @@
31
  *
32
  * @author Fabien Potencier <fabien@symfony.com>
33
  */
34
- class Twig_Error extends Exception
35
  {
36
  protected $lineno;
37
  // to be renamed to name in 2.0
@@ -56,14 +56,14 @@ class Twig_Error extends Exception
56
  *
57
  * @param string $message The error message
58
  * @param int $lineno The template line where the error occurred
59
- * @param Twig_Source|string|null $source The source context where the error occurred
60
  * @param Exception $previous The previous exception
61
  */
62
  public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
63
  {
64
  if (null === $source) {
65
  $name = null;
66
- } elseif (!$source instanceof Twig_Source) {
67
  // for compat with the Twig C ext., passing the template name as string is accepted
68
  $name = $source;
69
  } else {
@@ -186,17 +186,17 @@ class Twig_Error extends Exception
186
  /**
187
  * Gets the source context of the Twig template where the error occurred.
188
  *
189
- * @return Twig_Source|null
190
  */
191
  public function getSourceContext()
192
  {
193
- return $this->filename ? new Twig_Source($this->sourceCode, $this->filename, $this->sourcePath) : null;
194
  }
195
 
196
  /**
197
  * Sets the source context of the Twig template where the error occurred.
198
  */
199
- public function setSourceContext(Twig_Source $source = null)
200
  {
201
  if (null === $source) {
202
  $this->sourceCode = $this->filename = $this->sourcePath = null;
@@ -231,7 +231,7 @@ class Twig_Error extends Exception
231
  return $this->previous;
232
  }
233
 
234
- throw new BadMethodCallException(sprintf('Method "Twig_Error::%s()" does not exist.', $method));
235
  }
236
 
237
  public function appendMessage($rawMessage)
@@ -303,7 +303,7 @@ class Twig_Error extends Exception
303
  }
304
 
305
  foreach ($backtrace as $trace) {
306
- if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) {
307
  $currentClass = get_class($trace['object']);
308
  $isEmbedContainer = 0 === strpos($templateClass, $currentClass);
309
  if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
31
  *
32
  * @author Fabien Potencier <fabien@symfony.com>
33
  */
34
+ class Twig_SupTwg_Error extends Exception
35
  {
36
  protected $lineno;
37
  // to be renamed to name in 2.0
56
  *
57
  * @param string $message The error message
58
  * @param int $lineno The template line where the error occurred
59
+ * @param Twig_SupTwg_Source|string|null $source The source context where the error occurred
60
  * @param Exception $previous The previous exception
61
  */
62
  public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
63
  {
64
  if (null === $source) {
65
  $name = null;
66
+ } elseif (!$source instanceof Twig_SupTwg_Source) {
67
  // for compat with the Twig C ext., passing the template name as string is accepted
68
  $name = $source;
69
  } else {
186
  /**
187
  * Gets the source context of the Twig template where the error occurred.
188
  *
189
+ * @return Twig_SupTwg_Source|null
190
  */
191
  public function getSourceContext()
192
  {
193
+ return $this->filename ? new Twig_SupTwg_Source($this->sourceCode, $this->filename, $this->sourcePath) : null;
194
  }
195
 
196
  /**
197
  * Sets the source context of the Twig template where the error occurred.
198
  */
199
+ public function setSourceContext(Twig_SupTwg_Source $source = null)
200
  {
201
  if (null === $source) {
202
  $this->sourceCode = $this->filename = $this->sourcePath = null;
231
  return $this->previous;
232
  }
233
 
234
+ throw new BadMethodCallException(sprintf('Method "Twig_SupTwg_Error::%s()" does not exist.', $method));
235
  }
236
 
237
  public function appendMessage($rawMessage)
303
  }
304
 
305
  foreach ($backtrace as $trace) {
306
+ if (isset($trace['object']) && $trace['object'] instanceof Twig_SupTwg_Template && 'Twig_SupTwg_Template' !== get_class($trace['object'])) {
307
  $currentClass = get_class($trace['object']);
308
  $isEmbedContainer = 0 === strpos($templateClass, $currentClass);
309
  if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
vendor/Twig/Error/Loader.php CHANGED
@@ -16,13 +16,13 @@
16
  * if a template cannot be loaded, there is nothing to guess.
17
  * However, when a template is loaded from another one, then, we need
18
  * to find the current context and this is automatically done by
19
- * Twig_Template::displayWithErrorHandling().
20
  *
21
- * This strategy makes Twig_Environment::resolveTemplate() much faster.
22
  *
23
  * @author Fabien Potencier <fabien@symfony.com>
24
  */
25
- class Twig_Error_Loader extends Twig_Error
26
  {
27
  public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
28
  {
16
  * if a template cannot be loaded, there is nothing to guess.
17
  * However, when a template is loaded from another one, then, we need
18
  * to find the current context and this is automatically done by
19
+ * Twig_SupTwg_Template::displayWithErrorHandling().
20
  *
21
+ * This strategy makes Twig_SupTwg_Environment::resolveTemplate() much faster.
22
  *
23
  * @author Fabien Potencier <fabien@symfony.com>
24
  */
25
+ class Twig_SupTwg_Error_Loader extends Twig_SupTwg_Error
26
  {
27
  public function __construct($message, $lineno = -1, $source = null, Exception $previous = null)
28
  {
vendor/Twig/Error/Runtime.php CHANGED
@@ -15,6 +15,6 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Error_Runtime extends Twig_Error
19
  {
20
  }
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Error_Runtime extends Twig_SupTwg_Error
19
  {
20
  }
vendor/Twig/Error/Syntax.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Error_Syntax extends Twig_Error
19
  {
20
  /**
21
  * Tweaks the error message to include suggestions.
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Error_Syntax extends Twig_SupTwg_Error
19
  {
20
  /**
21
  * Tweaks the error message to include suggestions.
vendor/Twig/ExistsLoaderInterface.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_ExistsLoaderInterface
20
  {
21
  /**
22
  * Check if we have the source code of a template, given its name.
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_ExistsLoaderInterface
20
  {
21
  /**
22
  * Check if we have the source code of a template, given its name.
vendor/Twig/ExpressionParser.php CHANGED
@@ -22,7 +22,7 @@
22
  *
23
  * @internal
24
  */
25
- class Twig_ExpressionParser
26
  {
27
  const OPERATOR_LEFT = 1;
28
  const OPERATOR_RIGHT = 2;
@@ -33,11 +33,11 @@ class Twig_ExpressionParser
33
 
34
  private $env;
35
 
36
- public function __construct(Twig_Parser $parser, $env = null)
37
  {
38
  $this->parser = $parser;
39
 
40
- if ($env instanceof Twig_Environment) {
41
  $this->env = $env;
42
  $this->unaryOperators = $env->getUnaryOperators();
43
  $this->binaryOperators = $env->getBinaryOperators();
@@ -91,10 +91,10 @@ class Twig_ExpressionParser
91
  $class = $operator['class'];
92
 
93
  return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
94
- } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
95
  $this->parser->getStream()->next();
96
  $expr = $this->parseExpression();
97
- $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed');
98
 
99
  return $this->parsePostfixExpression($expr);
100
  }
@@ -104,92 +104,92 @@ class Twig_ExpressionParser
104
 
105
  protected function parseConditionalExpression($expr)
106
  {
107
- while ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, '?')) {
108
- if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
109
  $expr2 = $this->parseExpression();
110
- if ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
111
  $expr3 = $this->parseExpression();
112
  } else {
113
- $expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine());
114
  }
115
  } else {
116
  $expr2 = $expr;
117
  $expr3 = $this->parseExpression();
118
  }
119
 
120
- $expr = new Twig_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine());
121
  }
122
 
123
  return $expr;
124
  }
125
 
126
- protected function isUnary(Twig_Token $token)
127
  {
128
- return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]);
129
  }
130
 
131
- protected function isBinary(Twig_Token $token)
132
  {
133
- return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]);
134
  }
135
 
136
  public function parsePrimaryExpression()
137
  {
138
  $token = $this->parser->getCurrentToken();
139
  switch ($token->getType()) {
140
- case Twig_Token::NAME_TYPE:
141
  $this->parser->getStream()->next();
142
  switch ($token->getValue()) {
143
  case 'true':
144
  case 'TRUE':
145
- $node = new Twig_Node_Expression_Constant(true, $token->getLine());
146
  break;
147
 
148
  case 'false':
149
  case 'FALSE':
150
- $node = new Twig_Node_Expression_Constant(false, $token->getLine());
151
  break;
152
 
153
  case 'none':
154
  case 'NONE':
155
  case 'null':
156
  case 'NULL':
157
- $node = new Twig_Node_Expression_Constant(null, $token->getLine());
158
  break;
159
 
160
  default:
161
  if ('(' === $this->parser->getCurrentToken()->getValue()) {
162
  $node = $this->getFunctionNode($token->getValue(), $token->getLine());
163
  } else {
164
- $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine());
165
  }
166
  }
167
  break;
168
 
169
- case Twig_Token::NUMBER_TYPE:
170
  $this->parser->getStream()->next();
171
- $node = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
172
  break;
173
 
174
- case Twig_Token::STRING_TYPE:
175
- case Twig_Token::INTERPOLATION_START_TYPE:
176
  $node = $this->parseStringExpression();
177
  break;
178
 
179
- case Twig_Token::OPERATOR_TYPE:
180
- if (preg_match(Twig_Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) {
181
  // in this context, string operators are variable names
182
  $this->parser->getStream()->next();
183
- $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine());
184
  break;
185
  } elseif (isset($this->unaryOperators[$token->getValue()])) {
186
  $class = $this->unaryOperators[$token->getValue()]['class'];
187
 
188
  $ref = new ReflectionClass($class);
189
- $negClass = 'Twig_Node_Expression_Unary_Neg';
190
- $posClass = 'Twig_Node_Expression_Unary_Pos';
191
  if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) {
192
- throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
193
  }
194
 
195
  $this->parser->getStream()->next();
@@ -200,12 +200,12 @@ class Twig_ExpressionParser
200
  }
201
 
202
  default:
203
- if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) {
204
  $node = $this->parseArrayExpression();
205
- } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) {
206
  $node = $this->parseHashExpression();
207
  } else {
208
- throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
209
  }
210
  }
211
 
@@ -220,12 +220,12 @@ class Twig_ExpressionParser
220
  // a string cannot be followed by another string in a single expression
221
  $nextCanBeString = true;
222
  while (true) {
223
- if ($nextCanBeString && $token = $stream->nextIf(Twig_Token::STRING_TYPE)) {
224
- $nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
225
  $nextCanBeString = false;
226
- } elseif ($stream->nextIf(Twig_Token::INTERPOLATION_START_TYPE)) {
227
  $nodes[] = $this->parseExpression();
228
- $stream->expect(Twig_Token::INTERPOLATION_END_TYPE);
229
  $nextCanBeString = true;
230
  } else {
231
  break;
@@ -234,7 +234,7 @@ class Twig_ExpressionParser
234
 
235
  $expr = array_shift($nodes);
236
  foreach ($nodes as $node) {
237
- $expr = new Twig_Node_Expression_Binary_Concat($expr, $node, $node->getTemplateLine());
238
  }
239
 
240
  return $expr;
@@ -243,16 +243,16 @@ class Twig_ExpressionParser
243
  public function parseArrayExpression()
244
  {
245
  $stream = $this->parser->getStream();
246
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
247
 
248
- $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
249
  $first = true;
250
- while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) {
251
  if (!$first) {
252
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma');
253
 
254
  // trailing ,?
255
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) {
256
  break;
257
  }
258
  }
@@ -260,7 +260,7 @@ class Twig_ExpressionParser
260
 
261
  $node->addElement($this->parseExpression());
262
  }
263
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed');
264
 
265
  return $node;
266
  }
@@ -268,16 +268,16 @@ class Twig_ExpressionParser
268
  public function parseHashExpression()
269
  {
270
  $stream = $this->parser->getStream();
271
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected');
272
 
273
- $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
274
  $first = true;
275
- while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) {
276
  if (!$first) {
277
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma');
278
 
279
  // trailing ,?
280
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) {
281
  break;
282
  }
283
  }
@@ -289,22 +289,22 @@ class Twig_ExpressionParser
289
  // * a string -- 'a'
290
  // * a name, which is equivalent to a string -- a
291
  // * an expression, which must be enclosed in parentheses -- (1 + 2)
292
- if (($token = $stream->nextIf(Twig_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_Token::NUMBER_TYPE)) {
293
- $key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
294
- } elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
295
  $key = $this->parseExpression();
296
  } else {
297
  $current = $stream->getCurrent();
298
 
299
- throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
300
  }
301
 
302
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)');
303
  $value = $this->parseExpression();
304
 
305
  $node->addElement($value, $key);
306
  }
307
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed');
308
 
309
  return $node;
310
  }
@@ -313,7 +313,7 @@ class Twig_ExpressionParser
313
  {
314
  while (true) {
315
  $token = $this->parser->getCurrentToken();
316
- if ($token->getType() == Twig_Token::PUNCTUATION_TYPE) {
317
  if ('.' == $token->getValue() || '[' == $token->getValue()) {
318
  $node = $this->parseSubscriptExpression($node);
319
  } elseif ('|' == $token->getValue()) {
@@ -335,36 +335,36 @@ class Twig_ExpressionParser
335
  case 'parent':
336
  $this->parseArguments();
337
  if (!count($this->parser->getBlockStack())) {
338
- throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext());
339
  }
340
 
341
  if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
342
- throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext());
343
  }
344
 
345
- return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line);
346
  case 'block':
347
  $args = $this->parseArguments();
348
  if (count($args) < 1) {
349
- throw new Twig_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext());
350
  }
351
 
352
- return new Twig_Node_Expression_BlockReference($args->getNode(0), count($args) > 1 ? $args->getNode(1) : null, $line);
353
  case 'attribute':
354
  $args = $this->parseArguments();
355
  if (count($args) < 2) {
356
- throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext());
357
  }
358
 
359
- return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_Template::ANY_CALL, $line);
360
  default:
361
  if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) {
362
- $arguments = new Twig_Node_Expression_Array(array(), $line);
363
  foreach ($this->parseArguments() as $n) {
364
  $arguments->addElement($n);
365
  }
366
 
367
- $node = new Twig_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line);
368
  $node->setAttribute('safe', true);
369
 
370
  return $node;
@@ -382,81 +382,81 @@ class Twig_ExpressionParser
382
  $stream = $this->parser->getStream();
383
  $token = $stream->next();
384
  $lineno = $token->getLine();
385
- $arguments = new Twig_Node_Expression_Array(array(), $lineno);
386
- $type = Twig_Template::ANY_CALL;
387
  if ($token->getValue() == '.') {
388
  $token = $stream->next();
389
  if (
390
- $token->getType() == Twig_Token::NAME_TYPE
391
  ||
392
- $token->getType() == Twig_Token::NUMBER_TYPE
393
  ||
394
- ($token->getType() == Twig_Token::OPERATOR_TYPE && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue()))
395
  ) {
396
- $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno);
397
 
398
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
399
- $type = Twig_Template::METHOD_CALL;
400
  foreach ($this->parseArguments() as $n) {
401
  $arguments->addElement($n);
402
  }
403
  }
404
  } else {
405
- throw new Twig_Error_Syntax('Expected name or number.', $lineno, $stream->getSourceContext());
406
  }
407
 
408
- if ($node instanceof Twig_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {
409
- if (!$arg instanceof Twig_Node_Expression_Constant) {
410
- throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext());
411
  }
412
 
413
  $name = $arg->getAttribute('value');
414
 
415
  if ($this->parser->isReservedMacroName($name)) {
416
- throw new Twig_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
417
  }
418
 
419
- $node = new Twig_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno);
420
  $node->setAttribute('safe', true);
421
 
422
  return $node;
423
  }
424
  } else {
425
- $type = Twig_Template::ARRAY_CALL;
426
 
427
  // slice?
428
  $slice = false;
429
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) {
430
  $slice = true;
431
- $arg = new Twig_Node_Expression_Constant(0, $token->getLine());
432
  } else {
433
  $arg = $this->parseExpression();
434
  }
435
 
436
- if ($stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) {
437
  $slice = true;
438
  }
439
 
440
  if ($slice) {
441
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) {
442
- $length = new Twig_Node_Expression_Constant(null, $token->getLine());
443
  } else {
444
  $length = $this->parseExpression();
445
  }
446
 
447
  $class = $this->getFilterNodeClass('slice', $token->getLine());
448
- $arguments = new Twig_Node(array($arg, $length));
449
- $filter = new $class($node, new Twig_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine());
450
 
451
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']');
452
 
453
  return $filter;
454
  }
455
 
456
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']');
457
  }
458
 
459
- return new Twig_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno);
460
  }
461
 
462
  public function parseFilterExpression($node)
@@ -469,11 +469,11 @@ class Twig_ExpressionParser
469
  public function parseFilterExpressionRaw($node, $tag = null)
470
  {
471
  while (true) {
472
- $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE);
473
 
474
- $name = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
475
- if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
476
- $arguments = new Twig_Node();
477
  } else {
478
  $arguments = $this->parseArguments(true);
479
  }
@@ -482,7 +482,7 @@ class Twig_ExpressionParser
482
 
483
  $node = new $class($node, $name, $arguments, $token->getLine(), $tag);
484
 
485
- if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '|')) {
486
  break;
487
  }
488
 
@@ -498,32 +498,32 @@ class Twig_ExpressionParser
498
  * @param bool $namedArguments Whether to allow named arguments or not
499
  * @param bool $definition Whether we are parsing arguments for a function definition
500
  *
501
- * @return Twig_Node
502
  *
503
- * @throws Twig_Error_Syntax
504
  */
505
  public function parseArguments($namedArguments = false, $definition = false)
506
  {
507
  $args = array();
508
  $stream = $this->parser->getStream();
509
 
510
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
511
- while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ')')) {
512
  if (!empty($args)) {
513
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
514
  }
515
 
516
  if ($definition) {
517
- $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'An argument must be a name');
518
- $value = new Twig_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine());
519
  } else {
520
  $value = $this->parseExpression();
521
  }
522
 
523
  $name = null;
524
- if ($namedArguments && $token = $stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) {
525
- if (!$value instanceof Twig_Node_Expression_Name) {
526
- throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given.', get_class($value)), $token->getLine(), $stream->getSourceContext());
527
  }
528
  $name = $value->getAttribute('name');
529
 
@@ -531,7 +531,7 @@ class Twig_ExpressionParser
531
  $value = $this->parsePrimaryExpression();
532
 
533
  if (!$this->checkConstantExpression($value)) {
534
- throw new Twig_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext());
535
  }
536
  } else {
537
  $value = $this->parseExpression();
@@ -541,7 +541,7 @@ class Twig_ExpressionParser
541
  if ($definition) {
542
  if (null === $name) {
543
  $name = $value->getAttribute('name');
544
- $value = new Twig_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine());
545
  }
546
  $args[$name] = $value;
547
  } else {
@@ -552,9 +552,9 @@ class Twig_ExpressionParser
552
  }
553
  }
554
  }
555
- $stream->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis');
556
 
557
- return new Twig_Node($args);
558
  }
559
 
560
  public function parseAssignmentExpression()
@@ -562,19 +562,19 @@ class Twig_ExpressionParser
562
  $stream = $this->parser->getStream();
563
  $targets = array();
564
  while (true) {
565
- $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to');
566
  $value = $token->getValue();
567
  if (in_array(strtolower($value), array('true', 'false', 'none', 'null'))) {
568
- throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
569
  }
570
- $targets[] = new Twig_Node_Expression_AssignName($value, $token->getLine());
571
 
572
- if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
573
  break;
574
  }
575
  }
576
 
577
- return new Twig_Node($targets);
578
  }
579
 
580
  public function parseMultitargetExpression()
@@ -582,27 +582,27 @@ class Twig_ExpressionParser
582
  $targets = array();
583
  while (true) {
584
  $targets[] = $this->parseExpression();
585
- if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
586
  break;
587
  }
588
  }
589
 
590
- return new Twig_Node($targets);
591
  }
592
 
593
- private function parseNotTestExpression(Twig_NodeInterface $node)
594
  {
595
- return new Twig_Node_Expression_Unary_Not($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine());
596
  }
597
 
598
- private function parseTestExpression(Twig_NodeInterface $node)
599
  {
600
  $stream = $this->parser->getStream();
601
  list($name, $test) = $this->getTest($node->getTemplateLine());
602
 
603
  $class = $this->getTestNodeClass($test);
604
  $arguments = null;
605
- if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
606
  $arguments = $this->parser->getExpressionParser()->parseArguments(true);
607
  }
608
 
@@ -612,13 +612,13 @@ class Twig_ExpressionParser
612
  private function getTest($line)
613
  {
614
  $stream = $this->parser->getStream();
615
- $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
616
 
617
  if ($test = $this->env->getTest($name)) {
618
  return array($name, $test);
619
  }
620
 
621
- if ($stream->test(Twig_Token::NAME_TYPE)) {
622
  // try 2-words tests
623
  $name = $name.' '.$this->parser->getCurrentToken()->getValue();
624
 
@@ -629,7 +629,7 @@ class Twig_ExpressionParser
629
  }
630
  }
631
 
632
- $e = new Twig_Error_Syntax(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext());
633
  $e->addSuggestions($name, array_keys($this->env->getTests()));
634
 
635
  throw $e;
@@ -637,7 +637,7 @@ class Twig_ExpressionParser
637
 
638
  private function getTestNodeClass($test)
639
  {
640
- if ($test instanceof Twig_SimpleTest && $test->isDeprecated()) {
641
  $stream = $this->parser->getStream();
642
  $message = sprintf('Twig Test "%s" is deprecated', $test->getName());
643
  if (!is_bool($test->getDeprecatedVersion())) {
@@ -652,23 +652,23 @@ class Twig_ExpressionParser
652
  @trigger_error($message, E_USER_DEPRECATED);
653
  }
654
 
655
- if ($test instanceof Twig_SimpleTest) {
656
  return $test->getNodeClass();
657
  }
658
 
659
- return $test instanceof Twig_Test_Node ? $test->getClass() : 'Twig_Node_Expression_Test';
660
  }
661
 
662
  protected function getFunctionNodeClass($name, $line)
663
  {
664
  if (false === $function = $this->env->getFunction($name)) {
665
- $e = new Twig_Error_Syntax(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext());
666
  $e->addSuggestions($name, array_keys($this->env->getFunctions()));
667
 
668
  throw $e;
669
  }
670
 
671
- if ($function instanceof Twig_SimpleFunction && $function->isDeprecated()) {
672
  $message = sprintf('Twig Function "%s" is deprecated', $function->getName());
673
  if (!is_bool($function->getDeprecatedVersion())) {
674
  $message .= sprintf(' since version %s', $function->getDeprecatedVersion());
@@ -682,23 +682,23 @@ class Twig_ExpressionParser
682
  @trigger_error($message, E_USER_DEPRECATED);
683
  }
684
 
685
- if ($function instanceof Twig_SimpleFunction) {
686
  return $function->getNodeClass();
687
  }
688
 
689
- return $function instanceof Twig_Function_Node ? $function->getClass() : 'Twig_Node_Expression_Function';
690
  }
691
 
692
  protected function getFilterNodeClass($name, $line)
693
  {
694
  if (false === $filter = $this->env->getFilter($name)) {
695
- $e = new Twig_Error_Syntax(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext());
696
  $e->addSuggestions($name, array_keys($this->env->getFilters()));
697
 
698
  throw $e;
699
  }
700
 
701
- if ($filter instanceof Twig_SimpleFilter && $filter->isDeprecated()) {
702
  $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName());
703
  if (!is_bool($filter->getDeprecatedVersion())) {
704
  $message .= sprintf(' since version %s', $filter->getDeprecatedVersion());
@@ -712,18 +712,18 @@ class Twig_ExpressionParser
712
  @trigger_error($message, E_USER_DEPRECATED);
713
  }
714
 
715
- if ($filter instanceof Twig_SimpleFilter) {
716
  return $filter->getNodeClass();
717
  }
718
 
719
- return $filter instanceof Twig_Filter_Node ? $filter->getClass() : 'Twig_Node_Expression_Filter';
720
  }
721
 
722
  // checks that the node only contains "constant" elements
723
- protected function checkConstantExpression(Twig_NodeInterface $node)
724
  {
725
- if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array
726
- || $node instanceof Twig_Node_Expression_Unary_Neg || $node instanceof Twig_Node_Expression_Unary_Pos
727
  )) {
728
  return false;
729
  }
22
  *
23
  * @internal
24
  */
25
+ class Twig_SupTwg_ExpressionParser
26
  {
27
  const OPERATOR_LEFT = 1;
28
  const OPERATOR_RIGHT = 2;
33
 
34
  private $env;
35
 
36
+ public function __construct(Twig_SupTwg_Parser $parser, $env = null)
37
  {
38
  $this->parser = $parser;
39
 
40
+ if ($env instanceof Twig_SupTwg_Environment) {
41
  $this->env = $env;
42
  $this->unaryOperators = $env->getUnaryOperators();
43
  $this->binaryOperators = $env->getBinaryOperators();
91
  $class = $operator['class'];
92
 
93
  return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
94
+ } elseif ($token->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(')) {
95
  $this->parser->getStream()->next();
96
  $expr = $this->parseExpression();
97
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed');
98
 
99
  return $this->parsePostfixExpression($expr);
100
  }
104
 
105
  protected function parseConditionalExpression($expr)
106
  {
107
+ while ($this->parser->getStream()->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, '?')) {
108
+ if (!$this->parser->getStream()->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ':')) {
109
  $expr2 = $this->parseExpression();
110
+ if ($this->parser->getStream()->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ':')) {
111
  $expr3 = $this->parseExpression();
112
  } else {
113
+ $expr3 = new Twig_SupTwg_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine());
114
  }
115
  } else {
116
  $expr2 = $expr;
117
  $expr3 = $this->parseExpression();
118
  }
119
 
120
+ $expr = new Twig_SupTwg_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine());
121
  }
122
 
123
  return $expr;
124
  }
125
 
126
+ protected function isUnary(Twig_SupTwg_Token $token)
127
  {
128
+ return $token->test(Twig_SupTwg_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]);
129
  }
130
 
131
+ protected function isBinary(Twig_SupTwg_Token $token)
132
  {
133
+ return $token->test(Twig_SupTwg_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]);
134
  }
135
 
136
  public function parsePrimaryExpression()
137
  {
138
  $token = $this->parser->getCurrentToken();
139
  switch ($token->getType()) {
140
+ case Twig_SupTwg_Token::NAME_TYPE:
141
  $this->parser->getStream()->next();
142
  switch ($token->getValue()) {
143
  case 'true':
144
  case 'TRUE':
145
+ $node = new Twig_SupTwg_Node_Expression_Constant(true, $token->getLine());
146
  break;
147
 
148
  case 'false':
149
  case 'FALSE':
150
+ $node = new Twig_SupTwg_Node_Expression_Constant(false, $token->getLine());
151
  break;
152
 
153
  case 'none':
154
  case 'NONE':
155
  case 'null':
156
  case 'NULL':
157
+ $node = new Twig_SupTwg_Node_Expression_Constant(null, $token->getLine());
158
  break;
159
 
160
  default:
161
  if ('(' === $this->parser->getCurrentToken()->getValue()) {
162
  $node = $this->getFunctionNode($token->getValue(), $token->getLine());
163
  } else {
164
+ $node = new Twig_SupTwg_Node_Expression_Name($token->getValue(), $token->getLine());
165
  }
166
  }
167
  break;
168
 
169
+ case Twig_SupTwg_Token::NUMBER_TYPE:
170
  $this->parser->getStream()->next();
171
+ $node = new Twig_SupTwg_Node_Expression_Constant($token->getValue(), $token->getLine());
172
  break;
173
 
174
+ case Twig_SupTwg_Token::STRING_TYPE:
175
+ case Twig_SupTwg_Token::INTERPOLATION_START_TYPE:
176
  $node = $this->parseStringExpression();
177
  break;
178
 
179
+ case Twig_SupTwg_Token::OPERATOR_TYPE:
180
+ if (preg_match(Twig_SupTwg_Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) {
181
  // in this context, string operators are variable names
182
  $this->parser->getStream()->next();
183
+ $node = new Twig_SupTwg_Node_Expression_Name($token->getValue(), $token->getLine());
184
  break;
185
  } elseif (isset($this->unaryOperators[$token->getValue()])) {
186
  $class = $this->unaryOperators[$token->getValue()]['class'];
187
 
188
  $ref = new ReflectionClass($class);
189
+ $negClass = 'Twig_SupTwg_Node_Expression_Unary_Neg';
190
+ $posClass = 'Twig_SupTwg_Node_Expression_Unary_Pos';
191
  if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) {
192
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
193
  }
194
 
195
  $this->parser->getStream()->next();
200
  }
201
 
202
  default:
203
+ if ($token->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '[')) {
204
  $node = $this->parseArrayExpression();
205
+ } elseif ($token->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '{')) {
206
  $node = $this->parseHashExpression();
207
  } else {
208
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_SupTwg_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
209
  }
210
  }
211
 
220
  // a string cannot be followed by another string in a single expression
221
  $nextCanBeString = true;
222
  while (true) {
223
+ if ($nextCanBeString && $token = $stream->nextIf(Twig_SupTwg_Token::STRING_TYPE)) {
224
+ $nodes[] = new Twig_SupTwg_Node_Expression_Constant($token->getValue(), $token->getLine());
225
  $nextCanBeString = false;
226
+ } elseif ($stream->nextIf(Twig_SupTwg_Token::INTERPOLATION_START_TYPE)) {
227
  $nodes[] = $this->parseExpression();
228
+ $stream->expect(Twig_SupTwg_Token::INTERPOLATION_END_TYPE);
229
  $nextCanBeString = true;
230
  } else {
231
  break;
234
 
235
  $expr = array_shift($nodes);
236
  foreach ($nodes as $node) {
237
+ $expr = new Twig_SupTwg_Node_Expression_Binary_Concat($expr, $node, $node->getTemplateLine());
238
  }
239
 
240
  return $expr;
243
  public function parseArrayExpression()
244
  {
245
  $stream = $this->parser->getStream();
246
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
247
 
248
+ $node = new Twig_SupTwg_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
249
  $first = true;
250
+ while (!$stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']')) {
251
  if (!$first) {
252
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma');
253
 
254
  // trailing ,?
255
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']')) {
256
  break;
257
  }
258
  }
260
 
261
  $node->addElement($this->parseExpression());
262
  }
263
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed');
264
 
265
  return $node;
266
  }
268
  public function parseHashExpression()
269
  {
270
  $stream = $this->parser->getStream();
271
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected');
272
 
273
+ $node = new Twig_SupTwg_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
274
  $first = true;
275
+ while (!$stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '}')) {
276
  if (!$first) {
277
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma');
278
 
279
  // trailing ,?
280
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '}')) {
281
  break;
282
  }
283
  }
289
  // * a string -- 'a'
290
  // * a name, which is equivalent to a string -- a
291
  // * an expression, which must be enclosed in parentheses -- (1 + 2)
292
+ if (($token = $stream->nextIf(Twig_SupTwg_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_SupTwg_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_SupTwg_Token::NUMBER_TYPE)) {
293
+ $key = new Twig_SupTwg_Node_Expression_Constant($token->getValue(), $token->getLine());
294
+ } elseif ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(')) {
295
  $key = $this->parseExpression();
296
  } else {
297
  $current = $stream->getCurrent();
298
 
299
+ throw new Twig_SupTwg_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Twig_SupTwg_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
300
  }
301
 
302
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)');
303
  $value = $this->parseExpression();
304
 
305
  $node->addElement($value, $key);
306
  }
307
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed');
308
 
309
  return $node;
310
  }
313
  {
314
  while (true) {
315
  $token = $this->parser->getCurrentToken();
316
+ if ($token->getType() == Twig_SupTwg_Token::PUNCTUATION_TYPE) {
317
  if ('.' == $token->getValue() || '[' == $token->getValue()) {
318
  $node = $this->parseSubscriptExpression($node);
319
  } elseif ('|' == $token->getValue()) {
335
  case 'parent':
336
  $this->parseArguments();
337
  if (!count($this->parser->getBlockStack())) {
338
+ throw new Twig_SupTwg_Error_Syntax('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext());
339
  }
340
 
341
  if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
342
+ throw new Twig_SupTwg_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext());
343
  }
344
 
345
+ return new Twig_SupTwg_Node_Expression_Parent($this->parser->peekBlockStack(), $line);
346
  case 'block':
347
  $args = $this->parseArguments();
348
  if (count($args) < 1) {
349
+ throw new Twig_SupTwg_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext());
350
  }
351
 
352
+ return new Twig_SupTwg_Node_Expression_BlockReference($args->getNode(0), count($args) > 1 ? $args->getNode(1) : null, $line);
353
  case 'attribute':
354
  $args = $this->parseArguments();
355
  if (count($args) < 2) {
356
+ throw new Twig_SupTwg_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext());
357
  }
358
 
359
+ return new Twig_SupTwg_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_SupTwg_Template::ANY_CALL, $line);
360
  default:
361
  if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) {
362
+ $arguments = new Twig_SupTwg_Node_Expression_Array(array(), $line);
363
  foreach ($this->parseArguments() as $n) {
364
  $arguments->addElement($n);
365
  }
366
 
367
+ $node = new Twig_SupTwg_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line);
368
  $node->setAttribute('safe', true);
369
 
370
  return $node;
382
  $stream = $this->parser->getStream();
383
  $token = $stream->next();
384
  $lineno = $token->getLine();
385
+ $arguments = new Twig_SupTwg_Node_Expression_Array(array(), $lineno);
386
+ $type = Twig_SupTwg_Template::ANY_CALL;
387
  if ($token->getValue() == '.') {
388
  $token = $stream->next();
389
  if (
390
+ $token->getType() == Twig_SupTwg_Token::NAME_TYPE
391
  ||
392
+ $token->getType() == Twig_SupTwg_Token::NUMBER_TYPE
393
  ||
394
+ ($token->getType() == Twig_SupTwg_Token::OPERATOR_TYPE && preg_match(Twig_SupTwg_Lexer::REGEX_NAME, $token->getValue()))
395
  ) {
396
+ $arg = new Twig_SupTwg_Node_Expression_Constant($token->getValue(), $lineno);
397
 
398
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(')) {
399
+ $type = Twig_SupTwg_Template::METHOD_CALL;
400
  foreach ($this->parseArguments() as $n) {
401
  $arguments->addElement($n);
402
  }
403
  }
404
  } else {
405
+ throw new Twig_SupTwg_Error_Syntax('Expected name or number.', $lineno, $stream->getSourceContext());
406
  }
407
 
408
+ if ($node instanceof Twig_SupTwg_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {
409
+ if (!$arg instanceof Twig_SupTwg_Node_Expression_Constant) {
410
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext());
411
  }
412
 
413
  $name = $arg->getAttribute('value');
414
 
415
  if ($this->parser->isReservedMacroName($name)) {
416
+ throw new Twig_SupTwg_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
417
  }
418
 
419
+ $node = new Twig_SupTwg_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno);
420
  $node->setAttribute('safe', true);
421
 
422
  return $node;
423
  }
424
  } else {
425
+ $type = Twig_SupTwg_Template::ARRAY_CALL;
426
 
427
  // slice?
428
  $slice = false;
429
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, ':')) {
430
  $slice = true;
431
+ $arg = new Twig_SupTwg_Node_Expression_Constant(0, $token->getLine());
432
  } else {
433
  $arg = $this->parseExpression();
434
  }
435
 
436
+ if ($stream->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ':')) {
437
  $slice = true;
438
  }
439
 
440
  if ($slice) {
441
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']')) {
442
+ $length = new Twig_SupTwg_Node_Expression_Constant(null, $token->getLine());
443
  } else {
444
  $length = $this->parseExpression();
445
  }
446
 
447
  $class = $this->getFilterNodeClass('slice', $token->getLine());
448
+ $arguments = new Twig_SupTwg_Node(array($arg, $length));
449
+ $filter = new $class($node, new Twig_SupTwg_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine());
450
 
451
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']');
452
 
453
  return $filter;
454
  }
455
 
456
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ']');
457
  }
458
 
459
+ return new Twig_SupTwg_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno);
460
  }
461
 
462
  public function parseFilterExpression($node)
469
  public function parseFilterExpressionRaw($node, $tag = null)
470
  {
471
  while (true) {
472
+ $token = $this->parser->getStream()->expect(Twig_SupTwg_Token::NAME_TYPE);
473
 
474
+ $name = new Twig_SupTwg_Node_Expression_Constant($token->getValue(), $token->getLine());
475
+ if (!$this->parser->getStream()->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(')) {
476
+ $arguments = new Twig_SupTwg_Node();
477
  } else {
478
  $arguments = $this->parseArguments(true);
479
  }
482
 
483
  $node = new $class($node, $name, $arguments, $token->getLine(), $tag);
484
 
485
+ if (!$this->parser->getStream()->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '|')) {
486
  break;
487
  }
488
 
498
  * @param bool $namedArguments Whether to allow named arguments or not
499
  * @param bool $definition Whether we are parsing arguments for a function definition
500
  *
501
+ * @return Twig_SupTwg_Node
502
  *
503
+ * @throws Twig_SupTwg_Error_Syntax
504
  */
505
  public function parseArguments($namedArguments = false, $definition = false)
506
  {
507
  $args = array();
508
  $stream = $this->parser->getStream();
509
 
510
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
511
+ while (!$stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, ')')) {
512
  if (!empty($args)) {
513
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
514
  }
515
 
516
  if ($definition) {
517
+ $token = $stream->expect(Twig_SupTwg_Token::NAME_TYPE, null, 'An argument must be a name');
518
+ $value = new Twig_SupTwg_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine());
519
  } else {
520
  $value = $this->parseExpression();
521
  }
522
 
523
  $name = null;
524
+ if ($namedArguments && $token = $stream->nextIf(Twig_SupTwg_Token::OPERATOR_TYPE, '=')) {
525
+ if (!$value instanceof Twig_SupTwg_Node_Expression_Name) {
526
+ throw new Twig_SupTwg_Error_Syntax(sprintf('A parameter name must be a string, "%s" given.', get_class($value)), $token->getLine(), $stream->getSourceContext());
527
  }
528
  $name = $value->getAttribute('name');
529
 
531
  $value = $this->parsePrimaryExpression();
532
 
533
  if (!$this->checkConstantExpression($value)) {
534
+ throw new Twig_SupTwg_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext());
535
  }
536
  } else {
537
  $value = $this->parseExpression();
541
  if ($definition) {
542
  if (null === $name) {
543
  $name = $value->getAttribute('name');
544
+ $value = new Twig_SupTwg_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine());
545
  }
546
  $args[$name] = $value;
547
  } else {
552
  }
553
  }
554
  }
555
+ $stream->expect(Twig_SupTwg_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis');
556
 
557
+ return new Twig_SupTwg_Node($args);
558
  }
559
 
560
  public function parseAssignmentExpression()
562
  $stream = $this->parser->getStream();
563
  $targets = array();
564
  while (true) {
565
+ $token = $stream->expect(Twig_SupTwg_Token::NAME_TYPE, null, 'Only variables can be assigned to');
566
  $value = $token->getValue();
567
  if (in_array(strtolower($value), array('true', 'false', 'none', 'null'))) {
568
+ throw new Twig_SupTwg_Error_Syntax(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
569
  }
570
+ $targets[] = new Twig_SupTwg_Node_Expression_AssignName($value, $token->getLine());
571
 
572
+ if (!$stream->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',')) {
573
  break;
574
  }
575
  }
576
 
577
+ return new Twig_SupTwg_Node($targets);
578
  }
579
 
580
  public function parseMultitargetExpression()
582
  $targets = array();
583
  while (true) {
584
  $targets[] = $this->parseExpression();
585
+ if (!$this->parser->getStream()->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',')) {
586
  break;
587
  }
588
  }
589
 
590
+ return new Twig_SupTwg_Node($targets);
591
  }
592
 
593
+ private function parseNotTestExpression(Twig_SupTwg_NodeInterface $node)
594
  {
595
+ return new Twig_SupTwg_Node_Expression_Unary_Not($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine());
596
  }
597
 
598
+ private function parseTestExpression(Twig_SupTwg_NodeInterface $node)
599
  {
600
  $stream = $this->parser->getStream();
601
  list($name, $test) = $this->getTest($node->getTemplateLine());
602
 
603
  $class = $this->getTestNodeClass($test);
604
  $arguments = null;
605
+ if ($stream->test(Twig_SupTwg_Token::PUNCTUATION_TYPE, '(')) {
606
  $arguments = $this->parser->getExpressionParser()->parseArguments(true);
607
  }
608
 
612
  private function getTest($line)
613
  {
614
  $stream = $this->parser->getStream();
615
+ $name = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
616
 
617
  if ($test = $this->env->getTest($name)) {
618
  return array($name, $test);
619
  }
620
 
621
+ if ($stream->test(Twig_SupTwg_Token::NAME_TYPE)) {
622
  // try 2-words tests
623
  $name = $name.' '.$this->parser->getCurrentToken()->getValue();
624
 
629
  }
630
  }
631
 
632
+ $e = new Twig_SupTwg_Error_Syntax(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext());
633
  $e->addSuggestions($name, array_keys($this->env->getTests()));
634
 
635
  throw $e;
637
 
638
  private function getTestNodeClass($test)
639
  {
640
+ if ($test instanceof Twig_SupTwg_SimpleTest && $test->isDeprecated()) {
641
  $stream = $this->parser->getStream();
642
  $message = sprintf('Twig Test "%s" is deprecated', $test->getName());
643
  if (!is_bool($test->getDeprecatedVersion())) {
652
  @trigger_error($message, E_USER_DEPRECATED);
653
  }
654
 
655
+ if ($test instanceof Twig_SupTwg_SimpleTest) {
656
  return $test->getNodeClass();
657
  }
658
 
659
+ return $test instanceof Twig_SupTwg_Test_Node ? $test->getClass() : 'Twig_SupTwg_Node_Expression_Test';
660
  }
661
 
662
  protected function getFunctionNodeClass($name, $line)
663
  {
664
  if (false === $function = $this->env->getFunction($name)) {
665
+ $e = new Twig_SupTwg_Error_Syntax(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext());
666
  $e->addSuggestions($name, array_keys($this->env->getFunctions()));
667
 
668
  throw $e;
669
  }
670
 
671
+ if ($function instanceof Twig_SupTwg_SimpleFunction && $function->isDeprecated()) {
672
  $message = sprintf('Twig Function "%s" is deprecated', $function->getName());
673
  if (!is_bool($function->getDeprecatedVersion())) {
674
  $message .= sprintf(' since version %s', $function->getDeprecatedVersion());
682
  @trigger_error($message, E_USER_DEPRECATED);
683
  }
684
 
685
+ if ($function instanceof Twig_SupTwg_SimpleFunction) {
686
  return $function->getNodeClass();
687
  }
688
 
689
+ return $function instanceof Twig_SupTwg_Function_Node ? $function->getClass() : 'Twig_SupTwg_Node_Expression_Function';
690
  }
691
 
692
  protected function getFilterNodeClass($name, $line)
693
  {
694
  if (false === $filter = $this->env->getFilter($name)) {
695
+ $e = new Twig_SupTwg_Error_Syntax(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext());
696
  $e->addSuggestions($name, array_keys($this->env->getFilters()));
697
 
698
  throw $e;
699
  }
700
 
701
+ if ($filter instanceof Twig_SupTwg_SimpleFilter && $filter->isDeprecated()) {
702
  $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName());
703
  if (!is_bool($filter->getDeprecatedVersion())) {
704
  $message .= sprintf(' since version %s', $filter->getDeprecatedVersion());
712
  @trigger_error($message, E_USER_DEPRECATED);
713
  }
714
 
715
+ if ($filter instanceof Twig_SupTwg_SimpleFilter) {
716
  return $filter->getNodeClass();
717
  }
718
 
719
+ return $filter instanceof Twig_SupTwg_Filter_Node ? $filter->getClass() : 'Twig_SupTwg_Node_Expression_Filter';
720
  }
721
 
722
  // checks that the node only contains "constant" elements
723
+ protected function checkConstantExpression(Twig_SupTwg_NodeInterface $node)
724
  {
725
+ if (!($node instanceof Twig_SupTwg_Node_Expression_Constant || $node instanceof Twig_SupTwg_Node_Expression_Array
726
+ || $node instanceof Twig_SupTwg_Node_Expression_Unary_Neg || $node instanceof Twig_SupTwg_Node_Expression_Unary_Pos
727
  )) {
728
  return false;
729
  }
vendor/Twig/Extension.php CHANGED
@@ -8,12 +8,12 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- abstract class Twig_Extension implements Twig_ExtensionInterface
12
  {
13
  /**
14
- * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
15
  */
16
- public function initRuntime(Twig_Environment $environment)
17
  {
18
  }
19
 
@@ -48,7 +48,7 @@ abstract class Twig_Extension implements Twig_ExtensionInterface
48
  }
49
 
50
  /**
51
- * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead
52
  */
53
  public function getGlobals()
54
  {
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ abstract class Twig_SupTwg_Extension implements Twig_SupTwg_ExtensionInterface
12
  {
13
  /**
14
+ * @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwg_Extension_InitRuntimeInterface instead
15
  */
16
+ public function initRuntime(Twig_SupTwg_Environment $environment)
17
  {
18
  }
19
 
48
  }
49
 
50
  /**
51
+ * @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwg_Extension_GlobalsInterface instead
52
  */
53
  public function getGlobals()
54
  {
vendor/Twig/Extension/Core.php CHANGED
@@ -17,7 +17,7 @@ if (!defined('ENT_SUBSTITUTE')) {
17
  /**
18
  * @final
19
  */
20
- class Twig_Extension_Core extends Twig_Extension
21
  {
22
  protected $dateFormats = array('F j, Y H:i', '%d days');
23
  protected $numberFormat = array(0, '.', ',');
@@ -121,22 +121,22 @@ class Twig_Extension_Core extends Twig_Extension
121
  public function getTokenParsers()
122
  {
123
  return array(
124
- new Twig_TokenParser_For(),
125
- new Twig_TokenParser_If(),
126
- new Twig_TokenParser_Extends(),
127
- new Twig_TokenParser_Include(),
128
- new Twig_TokenParser_Block(),
129
- new Twig_TokenParser_Use(),
130
- new Twig_TokenParser_Filter(),
131
- new Twig_TokenParser_Macro(),
132
- new Twig_TokenParser_Import(),
133
- new Twig_TokenParser_From(),
134
- new Twig_TokenParser_Set(),
135
- new Twig_TokenParser_Spaceless(),
136
- new Twig_TokenParser_Flush(),
137
- new Twig_TokenParser_Do(),
138
- new Twig_TokenParser_Embed(),
139
- new Twig_TokenParser_With(),
140
  );
141
  }
142
 
@@ -144,54 +144,54 @@ class Twig_Extension_Core extends Twig_Extension
144
  {
145
  $filters = array(
146
  // formatting filters
147
- new Twig_SimpleFilter('date', 'twig_date_format_filter', array('needs_environment' => true)),
148
- new Twig_SimpleFilter('date_modify', 'twig_date_modify_filter', array('needs_environment' => true)),
149
- new Twig_SimpleFilter('format', 'sprintf'),
150
- new Twig_SimpleFilter('replace', 'twig_replace_filter'),
151
- new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)),
152
- new Twig_SimpleFilter('abs', 'abs'),
153
- new Twig_SimpleFilter('round', 'twig_round'),
154
 
155
  // encoding
156
- new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'),
157
- new Twig_SimpleFilter('json_encode', 'twig_jsonencode_filter'),
158
- new Twig_SimpleFilter('convert_encoding', 'twig_convert_encoding'),
159
 
160
  // string filters
161
- new Twig_SimpleFilter('title', 'twig_title_string_filter', array('needs_environment' => true)),
162
- new Twig_SimpleFilter('capitalize', 'twig_capitalize_string_filter', array('needs_environment' => true)),
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
170
- new Twig_SimpleFilter('join', 'twig_join_filter'),
171
- new Twig_SimpleFilter('split', 'twig_split_filter', array('needs_environment' => true)),
172
- new Twig_SimpleFilter('sort', 'twig_sort_filter'),
173
- new Twig_SimpleFilter('merge', 'twig_array_merge'),
174
- new Twig_SimpleFilter('batch', 'twig_array_batch'),
175
 
176
  // string/array filters
177
- new Twig_SimpleFilter('reverse', 'twig_reverse_filter', array('needs_environment' => true)),
178
- new Twig_SimpleFilter('length', 'twig_length_filter', array('needs_environment' => true)),
179
- new Twig_SimpleFilter('slice', 'twig_slice', array('needs_environment' => true)),
180
- new Twig_SimpleFilter('first', 'twig_first', array('needs_environment' => true)),
181
- new Twig_SimpleFilter('last', 'twig_last', array('needs_environment' => true)),
182
 
183
  // iteration and runtime
184
- new Twig_SimpleFilter('default', '_twig_default_filter', array('node_class' => 'Twig_Node_Expression_Filter_Default')),
185
- new Twig_SimpleFilter('keys', 'twig_get_array_keys_filter'),
186
 
187
  // escaping
188
- new Twig_SimpleFilter('escape', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')),
189
- new Twig_SimpleFilter('e', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')),
190
  );
191
 
192
  if (function_exists('mb_get_info')) {
193
- $filters[] = new Twig_SimpleFilter('upper', 'twig_upper_filter', array('needs_environment' => true));
194
- $filters[] = new Twig_SimpleFilter('lower', 'twig_lower_filter', array('needs_environment' => true));
195
  }
196
 
197
  return $filters;
@@ -200,33 +200,33 @@ class Twig_Extension_Core extends Twig_Extension
200
  public function getFunctions()
201
  {
202
  return array(
203
- new Twig_SimpleFunction('max', 'max'),
204
- new Twig_SimpleFunction('min', 'min'),
205
- new Twig_SimpleFunction('range', 'range'),
206
- new Twig_SimpleFunction('constant', 'twig_constant'),
207
- new Twig_SimpleFunction('cycle', 'twig_cycle'),
208
- new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
209
- new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
210
- new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
211
- new Twig_SimpleFunction('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))),
212
  );
213
  }
214
 
215
  public function getTests()
216
  {
217
  return array(
218
- new Twig_SimpleTest('even', null, array('node_class' => 'Twig_Node_Expression_Test_Even')),
219
- new Twig_SimpleTest('odd', null, array('node_class' => 'Twig_Node_Expression_Test_Odd')),
220
- new Twig_SimpleTest('defined', null, array('node_class' => 'Twig_Node_Expression_Test_Defined')),
221
- new Twig_SimpleTest('sameas', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas', 'deprecated' => '1.21', 'alternative' => 'same as')),
222
- new Twig_SimpleTest('same as', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas')),
223
- new Twig_SimpleTest('none', null, array('node_class' => 'Twig_Node_Expression_Test_Null')),
224
- new Twig_SimpleTest('null', null, array('node_class' => 'Twig_Node_Expression_Test_Null')),
225
- new Twig_SimpleTest('divisibleby', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby', 'deprecated' => '1.21', 'alternative' => 'divisible by')),
226
- new Twig_SimpleTest('divisible by', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby')),
227
- new Twig_SimpleTest('constant', null, array('node_class' => 'Twig_Node_Expression_Test_Constant')),
228
- new Twig_SimpleTest('empty', 'twig_test_empty'),
229
- new Twig_SimpleTest('iterable', 'twig_test_iterable'),
230
  );
231
  }
232
 
@@ -234,39 +234,39 @@ class Twig_Extension_Core extends Twig_Extension
234
  {
235
  return array(
236
  array(
237
- 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'),
238
- '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'),
239
- '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'),
240
  ),
241
  array(
242
- 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
243
- 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
244
- 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
245
- 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
246
- 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
247
- '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
248
- '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
249
- '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
250
- '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
251
- '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
252
- '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
253
- 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
254
- 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
255
- 'matches' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Matches', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
256
- 'starts with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_StartsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
257
- 'ends with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_EndsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
258
- '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
259
- '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
260
- '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
261
- '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
262
- '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
263
- '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
264
- '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
265
- '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
266
- 'is' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
267
- 'is not' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
268
- '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT),
269
- '??' => array('precedence' => 300, 'class' => 'Twig_Node_Expression_NullCoalesce', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT),
270
  ),
271
  );
272
  }
@@ -285,7 +285,7 @@ class Twig_Extension_Core extends Twig_Extension
285
  *
286
  * @return string The next value in the cycle
287
  */
288
- function twig_cycle($values, $position)
289
  {
290
  if (!is_array($values) && !$values instanceof ArrayAccess) {
291
  return $values;
@@ -300,14 +300,14 @@ function twig_cycle($values, $position)
300
  * - a random character from a string
301
  * - a random integer between 0 and the integer parameter.
302
  *
303
- * @param Twig_Environment $env
304
  * @param Traversable|array|int|float|string $values The values to pick a random item from
305
  *
306
- * @throws Twig_Error_Runtime when $values is an empty array (does not apply to an empty string which is returned as is)
307
  *
308
  * @return mixed A random value from the given sequence
309
  */
310
- function twig_random(Twig_Environment $env, $values = null)
311
  {
312
  if (null === $values) {
313
  return mt_rand();
@@ -325,7 +325,7 @@ function twig_random(Twig_Environment $env, $values = null)
325
  }
326
  if (null !== $charset = $env->getCharset()) {
327
  if ('UTF-8' !== $charset) {
328
- $values = twig_convert_encoding($values, 'UTF-8', $charset);
329
  }
330
 
331
  // unicode version of str_split()
@@ -334,7 +334,7 @@ function twig_random(Twig_Environment $env, $values = null)
334
 
335
  if ('UTF-8' !== $charset) {
336
  foreach ($values as $i => $value) {
337
- $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8');
338
  }
339
  }
340
  } else {
@@ -347,7 +347,7 @@ function twig_random(Twig_Environment $env, $values = null)
347
  }
348
 
349
  if (0 === count($values)) {
350
- throw new Twig_Error_Runtime('The random function cannot pick from an empty array.');
351
  }
352
 
353
  return $values[array_rand($values, 1)];
@@ -360,17 +360,17 @@ function twig_random(Twig_Environment $env, $values = null)
360
  * {{ post.published_at|date("m/d/Y") }}
361
  * </pre>
362
  *
363
- * @param Twig_Environment $env
364
  * @param DateTime|DateTimeInterface|DateInterval|string $date A date
365
  * @param string|null $format The target format, null to use the default
366
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
367
  *
368
  * @return string The formatted date
369
  */
370
- function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null)
371
  {
372
  if (null === $format) {
373
- $formats = $env->getExtension('Twig_Extension_Core')->getDateFormat();
374
  $format = $date instanceof DateInterval ? $formats[1] : $formats[0];
375
  }
376
 
@@ -378,7 +378,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
378
  return $date->format($format);
379
  }
380
 
381
- return twig_date_converter($env, $date, $timezone)->format($format);
382
  }
383
 
384
  /**
@@ -388,15 +388,15 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
388
  * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
389
  * </pre>
390
  *
391
- * @param Twig_Environment $env
392
  * @param DateTime|string $date A date
393
  * @param string $modifier A modifier string
394
  *
395
  * @return DateTime A new date object
396
  */
397
- function twig_date_modify_filter(Twig_Environment $env, $date, $modifier)
398
  {
399
- $date = twig_date_converter($env, $date, false);
400
  $resultDate = $date->modify($modifier);
401
 
402
  // This is a hack to ensure PHP 5.2 support and support for DateTimeImmutable
@@ -414,18 +414,18 @@ function twig_date_modify_filter(Twig_Environment $env, $date, $modifier)
414
  * {% endif %}
415
  * </pre>
416
  *
417
- * @param Twig_Environment $env
418
  * @param DateTime|DateTimeInterface|string|null $date A date
419
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
420
  *
421
  * @return DateTime A DateTime instance
422
  */
423
- function twig_date_converter(Twig_Environment $env, $date = null, $timezone = null)
424
  {
425
  // determine the timezone
426
  if (false !== $timezone) {
427
  if (null === $timezone) {
428
- $timezone = $env->getExtension('Twig_Extension_Core')->getTimezone();
429
  } elseif (!$timezone instanceof DateTimeZone) {
430
  $timezone = new DateTimeZone($timezone);
431
  }
@@ -446,14 +446,14 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu
446
  }
447
 
448
  if (null === $date || 'now' === $date) {
449
- return new DateTime($date, false !== $timezone ? $timezone : $env->getExtension('Twig_Extension_Core')->getTimezone());
450
  }
451
 
452
  $asString = (string) $date;
453
  if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) {
454
  $date = new DateTime('@'.$date);
455
  } else {
456
- $date = new DateTime($date, $env->getExtension('Twig_Extension_Core')->getTimezone());
457
  }
458
 
459
  if (false !== $timezone) {
@@ -472,7 +472,7 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu
472
  *
473
  * @return string
474
  */
475
- function twig_replace_filter($str, $from, $to = null)
476
  {
477
  if ($from instanceof Traversable) {
478
  $from = iterator_to_array($from);
@@ -481,7 +481,7 @@ function twig_replace_filter($str, $from, $to = null)
481
 
482
  return strtr($str, $from, $to);
483
  } elseif (!is_array($from)) {
484
- throw new Twig_Error_Runtime(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', is_object($from) ? get_class($from) : gettype($from)));
485
  }
486
 
487
  return strtr($str, $from);
@@ -496,14 +496,14 @@ function twig_replace_filter($str, $from, $to = null)
496
  *
497
  * @return int|float The rounded number
498
  */
499
- function twig_round($value, $precision = 0, $method = 'common')
500
  {
501
  if ('common' == $method) {
502
  return round($value, $precision);
503
  }
504
 
505
  if ('ceil' != $method && 'floor' != $method) {
506
- throw new Twig_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.');
507
  }
508
 
509
  return $method($value * pow(10, $precision)) / pow(10, $precision);
@@ -516,7 +516,7 @@ function twig_round($value, $precision = 0, $method = 'common')
516
  * be used. Supplying any of the parameters will override the defaults set in the
517
  * environment object.
518
  *
519
- * @param Twig_Environment $env
520
  * @param mixed $number A float/int/string of the number to format
521
  * @param int $decimal the number of decimal points to display
522
  * @param string $decimalPoint the character(s) to use for the decimal point
@@ -524,9 +524,9 @@ function twig_round($value, $precision = 0, $method = 'common')
524
  *
525
  * @return string The formatted number
526
  */
527
- function twig_number_format_filter(Twig_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null)
528
  {
529
- $defaults = $env->getExtension('Twig_Extension_Core')->getNumberFormat();
530
  if (null === $decimal) {
531
  $decimal = $defaults[0];
532
  }
@@ -549,7 +549,7 @@ function twig_number_format_filter(Twig_Environment $env, $number, $decimal = nu
549
  *
550
  * @return string The URL encoded value
551
  */
552
- function twig_urlencode_filter($url)
553
  {
554
  if (is_array($url)) {
555
  if (defined('PHP_QUERY_RFC3986')) {
@@ -571,12 +571,12 @@ if (PHP_VERSION_ID < 50300) {
571
  *
572
  * @return mixed The JSON encoded value
573
  */
574
- function twig_jsonencode_filter($value, $options = 0)
575
  {
576
- if ($value instanceof Twig_Markup) {
577
  $value = (string) $value;
578
  } elseif (is_array($value)) {
579
- array_walk_recursive($value, '_twig_markup2string');
580
  }
581
 
582
  return json_encode($value);
@@ -590,21 +590,21 @@ if (PHP_VERSION_ID < 50300) {
590
  *
591
  * @return mixed The JSON encoded value
592
  */
593
- function twig_jsonencode_filter($value, $options = 0)
594
  {
595
- if ($value instanceof Twig_Markup) {
596
  $value = (string) $value;
597
  } elseif (is_array($value)) {
598
- array_walk_recursive($value, '_twig_markup2string');
599
  }
600
 
601
  return json_encode($value, $options);
602
  }
603
  }
604
 
605
- function _twig_markup2string(&$value)
606
  {
607
- if ($value instanceof Twig_Markup) {
608
  $value = (string) $value;
609
  }
610
  }
@@ -625,18 +625,18 @@ function _twig_markup2string(&$value)
625
  *
626
  * @return array The merged array
627
  */
628
- function twig_array_merge($arr1, $arr2)
629
  {
630
  if ($arr1 instanceof Traversable) {
631
  $arr1 = iterator_to_array($arr1);
632
  } elseif (!is_array($arr1)) {
633
- throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', gettype($arr1)));
634
  }
635
 
636
  if ($arr2 instanceof Traversable) {
637
  $arr2 = iterator_to_array($arr2);
638
  } elseif (!is_array($arr2)) {
639
- throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', gettype($arr2)));
640
  }
641
 
642
  return array_merge($arr1, $arr2);
@@ -645,7 +645,7 @@ function twig_array_merge($arr1, $arr2)
645
  /**
646
  * Slices a variable.
647
  *
648
- * @param Twig_Environment $env
649
  * @param mixed $item A variable
650
  * @param int $start Start of the slice
651
  * @param int $length Size of the slice
@@ -653,7 +653,7 @@ function twig_array_merge($arr1, $arr2)
653
  *
654
  * @return mixed The sliced variable
655
  */
656
- function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false)
657
  {
658
  if ($item instanceof Traversable) {
659
  while ($item instanceof IteratorAggregate) {
@@ -687,14 +687,14 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
687
  /**
688
  * Returns the first element of the item.
689
  *
690
- * @param Twig_Environment $env
691
  * @param mixed $item A variable
692
  *
693
  * @return mixed The first element of the item
694
  */
695
- function twig_first(Twig_Environment $env, $item)
696
  {
697
- $elements = twig_slice($env, $item, 0, 1, false);
698
 
699
  return is_string($elements) ? $elements : current($elements);
700
  }
@@ -702,14 +702,14 @@ function twig_first(Twig_Environment $env, $item)
702
  /**
703
  * Returns the last element of the item.
704
  *
705
- * @param Twig_Environment $env
706
  * @param mixed $item A variable
707
  *
708
  * @return mixed The last element of the item
709
  */
710
- function twig_last(Twig_Environment $env, $item)
711
  {
712
- $elements = twig_slice($env, $item, -1, 1, false);
713
 
714
  return is_string($elements) ? $elements : current($elements);
715
  }
@@ -732,7 +732,7 @@ function twig_last(Twig_Environment $env, $item)
732
  *
733
  * @return string The concatenated string
734
  */
735
- function twig_join_filter($value, $glue = '')
736
  {
737
  if ($value instanceof Traversable) {
738
  $value = iterator_to_array($value, false);
@@ -758,14 +758,14 @@ function twig_join_filter($value, $glue = '')
758
  * {# returns [aa, bb, cc] #}
759
  * </pre>
760
  *
761
- * @param Twig_Environment $env
762
  * @param string $value A string
763
  * @param string $delimiter The delimiter
764
  * @param int $limit The limit
765
  *
766
  * @return array The split string as an array
767
  */
768
- function twig_split_filter(Twig_Environment $env, $value, $delimiter, $limit = null)
769
  {
770
  if (!empty($delimiter)) {
771
  return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
@@ -798,9 +798,9 @@ function twig_split_filter(Twig_Environment $env, $value, $delimiter, $limit = n
798
  /**
799
  * @internal
800
  */
801
- function _twig_default_filter($value, $default = '')
802
  {
803
- if (twig_test_empty($value)) {
804
  return $default;
805
  }
806
 
@@ -822,7 +822,7 @@ function _twig_default_filter($value, $default = '')
822
  *
823
  * @return array The keys
824
  */
825
- function twig_get_array_keys_filter($array)
826
  {
827
  if ($array instanceof Traversable) {
828
  while ($array instanceof IteratorAggregate) {
@@ -858,13 +858,13 @@ function twig_get_array_keys_filter($array)
858
  /**
859
  * Reverses a variable.
860
  *
861
- * @param Twig_Environment $env
862
  * @param array|Traversable|string $item An array, a Traversable instance, or a string
863
  * @param bool $preserveKeys Whether to preserve key or not
864
  *
865
  * @return mixed The reversed input
866
  */
867
- function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false)
868
  {
869
  if ($item instanceof Traversable) {
870
  return array_reverse(iterator_to_array($item), $preserveKeys);
@@ -878,7 +878,7 @@ function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false
878
  $string = (string) $item;
879
 
880
  if ('UTF-8' !== $charset) {
881
- $item = twig_convert_encoding($string, 'UTF-8', $charset);
882
  }
883
 
884
  preg_match_all('/./us', $item, $matches);
@@ -886,7 +886,7 @@ function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false
886
  $string = implode('', array_reverse($matches[0]));
887
 
888
  if ('UTF-8' !== $charset) {
889
- $string = twig_convert_encoding($string, $charset, 'UTF-8');
890
  }
891
 
892
  return $string;
@@ -902,12 +902,12 @@ function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false
902
  *
903
  * @return array
904
  */
905
- function twig_sort_filter($array)
906
  {
907
  if ($array instanceof Traversable) {
908
  $array = iterator_to_array($array);
909
  } elseif (!is_array($array)) {
910
- throw new Twig_Error_Runtime(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', gettype($array)));
911
  }
912
 
913
  asort($array);
@@ -918,7 +918,7 @@ function twig_sort_filter($array)
918
  /**
919
  * @internal
920
  */
921
- function twig_in_filter($value, $compare)
922
  {
923
  if (is_array($compare)) {
924
  return in_array($value, $compare, is_object($value) || is_resource($value));
@@ -950,9 +950,9 @@ function twig_in_filter($value, $compare)
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";
@@ -966,14 +966,14 @@ function twig_trim_filter($string, $characterMask = null, $side = 'both')
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
  *
976
- * @param Twig_Environment $env
977
  * @param mixed $string The value to be escaped
978
  * @param string $strategy The escaping strategy
979
  * @param string $charset The charset
@@ -981,9 +981,9 @@ function twig_trim_filter($string, $characterMask = null, $side = 'both')
981
  *
982
  * @return string
983
  */
984
- function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
985
  {
986
- if ($autoescape && $string instanceof Twig_Markup) {
987
  return $string;
988
  }
989
 
@@ -1042,60 +1042,60 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1042
  return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
1043
  }
1044
 
1045
- $string = twig_convert_encoding($string, 'UTF-8', $charset);
1046
  $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
1047
 
1048
- return twig_convert_encoding($string, $charset, 'UTF-8');
1049
 
1050
  case 'js':
1051
  // escape all non-alphanumeric characters
1052
  // into their \xHH or \uHHHH representations
1053
  if ('UTF-8' !== $charset) {
1054
- $string = twig_convert_encoding($string, 'UTF-8', $charset);
1055
  }
1056
 
1057
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1058
- throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1059
  }
1060
 
1061
- $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string);
1062
 
1063
  if ('UTF-8' !== $charset) {
1064
- $string = twig_convert_encoding($string, $charset, 'UTF-8');
1065
  }
1066
 
1067
  return $string;
1068
 
1069
  case 'css':
1070
  if ('UTF-8' !== $charset) {
1071
- $string = twig_convert_encoding($string, 'UTF-8', $charset);
1072
  }
1073
 
1074
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1075
- throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1076
  }
1077
 
1078
- $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string);
1079
 
1080
  if ('UTF-8' !== $charset) {
1081
- $string = twig_convert_encoding($string, $charset, 'UTF-8');
1082
  }
1083
 
1084
  return $string;
1085
 
1086
  case 'html_attr':
1087
  if ('UTF-8' !== $charset) {
1088
- $string = twig_convert_encoding($string, 'UTF-8', $charset);
1089
  }
1090
 
1091
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1092
- throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1093
  }
1094
 
1095
- $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string);
1096
 
1097
  if ('UTF-8' !== $charset) {
1098
- $string = twig_convert_encoding($string, $charset, 'UTF-8');
1099
  }
1100
 
1101
  return $string;
@@ -1111,7 +1111,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1111
  static $escapers;
1112
 
1113
  if (null === $escapers) {
1114
- $escapers = $env->getExtension('Twig_Extension_Core')->getEscapers();
1115
  }
1116
 
1117
  if (isset($escapers[$strategy])) {
@@ -1120,17 +1120,17 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1120
 
1121
  $validStrategies = implode(', ', array_merge(array('html', 'js', 'url', 'css', 'html_attr'), array_keys($escapers)));
1122
 
1123
- throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies));
1124
  }
1125
  }
1126
 
1127
  /**
1128
  * @internal
1129
  */
1130
- function twig_escape_filter_is_safe(Twig_Node $filterArgs)
1131
  {
1132
  foreach ($filterArgs as $arg) {
1133
- if ($arg instanceof Twig_Node_Expression_Constant) {
1134
  return array($arg->getAttribute('value'));
1135
  }
1136
 
@@ -1141,23 +1141,23 @@ function twig_escape_filter_is_safe(Twig_Node $filterArgs)
1141
  }
1142
 
1143
  if (function_exists('mb_convert_encoding')) {
1144
- function twig_convert_encoding($string, $to, $from)
1145
  {
1146
  return mb_convert_encoding($string, $to, $from);
1147
  }
1148
  } elseif (function_exists('iconv')) {
1149
- function twig_convert_encoding($string, $to, $from)
1150
  {
1151
  return iconv($from, $to, $string);
1152
  }
1153
  } else {
1154
- function twig_convert_encoding($string, $to, $from)
1155
  {
1156
- throw new Twig_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
1157
  }
1158
  }
1159
 
1160
- function _twig_escape_js_callback($matches)
1161
  {
1162
  $char = $matches[0];
1163
 
@@ -1167,7 +1167,7 @@ function _twig_escape_js_callback($matches)
1167
  }
1168
 
1169
  // \uHHHH
1170
- $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
1171
  $char = strtoupper(bin2hex($char));
1172
 
1173
  if (4 >= strlen($char)) {
@@ -1177,7 +1177,7 @@ function _twig_escape_js_callback($matches)
1177
  return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4));
1178
  }
1179
 
1180
- function _twig_escape_css_callback($matches)
1181
  {
1182
  $char = $matches[0];
1183
 
@@ -1192,7 +1192,7 @@ function _twig_escape_css_callback($matches)
1192
  }
1193
 
1194
  // \uHHHH
1195
- $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
1196
 
1197
  return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' ';
1198
  }
@@ -1203,7 +1203,7 @@ function _twig_escape_css_callback($matches)
1203
  * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
1204
  * @license http://framework.zend.com/license/new-bsd New BSD License
1205
  */
1206
- function _twig_escape_html_attr_callback($matches)
1207
  {
1208
  /*
1209
  * While HTML supports far more named entities, the lowest common denominator
@@ -1236,7 +1236,7 @@ function _twig_escape_html_attr_callback($matches)
1236
  if (strlen($chr) == 1) {
1237
  $hex = strtoupper(substr('00'.bin2hex($chr), -2));
1238
  } else {
1239
- $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8');
1240
  $hex = strtoupper(substr('0000'.bin2hex($chr), -4));
1241
  }
1242
 
@@ -1257,12 +1257,12 @@ if (function_exists('mb_get_info')) {
1257
  /**
1258
  * Returns the length of a variable.
1259
  *
1260
- * @param Twig_Environment $env
1261
  * @param mixed $thing A variable
1262
  *
1263
  * @return int The length of the value
1264
  */
1265
- function twig_length_filter(Twig_Environment $env, $thing)
1266
  {
1267
  if (is_scalar($thing)) {
1268
  return mb_strlen($thing, $env->getCharset());
@@ -1284,12 +1284,12 @@ if (function_exists('mb_get_info')) {
1284
  /**
1285
  * Converts a string to uppercase.
1286
  *
1287
- * @param Twig_Environment $env
1288
  * @param string $string A string
1289
  *
1290
  * @return string The uppercased string
1291
  */
1292
- function twig_upper_filter(Twig_Environment $env, $string)
1293
  {
1294
  if (null !== $charset = $env->getCharset()) {
1295
  return mb_strtoupper($string, $charset);
@@ -1301,12 +1301,12 @@ if (function_exists('mb_get_info')) {
1301
  /**
1302
  * Converts a string to lowercase.
1303
  *
1304
- * @param Twig_Environment $env
1305
  * @param string $string A string
1306
  *
1307
  * @return string The lowercased string
1308
  */
1309
- function twig_lower_filter(Twig_Environment $env, $string)
1310
  {
1311
  if (null !== $charset = $env->getCharset()) {
1312
  return mb_strtolower($string, $charset);
@@ -1318,12 +1318,12 @@ if (function_exists('mb_get_info')) {
1318
  /**
1319
  * Returns a titlecased string.
1320
  *
1321
- * @param Twig_Environment $env
1322
  * @param string $string A string
1323
  *
1324
  * @return string The titlecased string
1325
  */
1326
- function twig_title_string_filter(Twig_Environment $env, $string)
1327
  {
1328
  if (null !== $charset = $env->getCharset()) {
1329
  return mb_convert_case($string, MB_CASE_TITLE, $charset);
@@ -1335,12 +1335,12 @@ if (function_exists('mb_get_info')) {
1335
  /**
1336
  * Returns a capitalized string.
1337
  *
1338
- * @param Twig_Environment $env
1339
  * @param string $string A string
1340
  *
1341
  * @return string The capitalized string
1342
  */
1343
- function twig_capitalize_string_filter(Twig_Environment $env, $string)
1344
  {
1345
  if (null !== $charset = $env->getCharset()) {
1346
  return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset);
@@ -1354,12 +1354,12 @@ else {
1354
  /**
1355
  * Returns the length of a variable.
1356
  *
1357
- * @param Twig_Environment $env
1358
  * @param mixed $thing A variable
1359
  *
1360
  * @return int The length of the value
1361
  */
1362
- function twig_length_filter(Twig_Environment $env, $thing)
1363
  {
1364
  if (is_scalar($thing)) {
1365
  return strlen($thing);
@@ -1375,12 +1375,12 @@ else {
1375
  /**
1376
  * Returns a titlecased string.
1377
  *
1378
- * @param Twig_Environment $env
1379
  * @param string $string A string
1380
  *
1381
  * @return string The titlecased string
1382
  */
1383
- function twig_title_string_filter(Twig_Environment $env, $string)
1384
  {
1385
  return ucwords(strtolower($string));
1386
  }
@@ -1388,12 +1388,12 @@ else {
1388
  /**
1389
  * Returns a capitalized string.
1390
  *
1391
- * @param Twig_Environment $env
1392
  * @param string $string A string
1393
  *
1394
  * @return string The capitalized string
1395
  */
1396
- function twig_capitalize_string_filter(Twig_Environment $env, $string)
1397
  {
1398
  return ucfirst(strtolower($string));
1399
  }
@@ -1402,7 +1402,7 @@ else {
1402
  /**
1403
  * @internal
1404
  */
1405
- function twig_ensure_traversable($seq)
1406
  {
1407
  if ($seq instanceof Traversable || is_array($seq)) {
1408
  return $seq;
@@ -1425,7 +1425,7 @@ function twig_ensure_traversable($seq)
1425
  *
1426
  * @return bool true if the value is empty, false otherwise
1427
  */
1428
- function twig_test_empty($value)
1429
  {
1430
  if ($value instanceof Countable) {
1431
  return 0 == count($value);
@@ -1452,7 +1452,7 @@ function twig_test_empty($value)
1452
  *
1453
  * @return bool true if the value is traversable
1454
  */
1455
- function twig_test_iterable($value)
1456
  {
1457
  return $value instanceof Traversable || is_array($value);
1458
  }
@@ -1460,7 +1460,7 @@ function twig_test_iterable($value)
1460
  /**
1461
  * Renders a template.
1462
  *
1463
- * @param Twig_Environment $env
1464
  * @param array $context
1465
  * @param string|array $template The template to render or an array of templates to try consecutively
1466
  * @param array $variables The variables to pass to the template
@@ -1470,7 +1470,7 @@ function twig_test_iterable($value)
1470
  *
1471
  * @return string The rendered template
1472
  */
1473
- function twig_include(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false)
1474
  {
1475
  $alreadySandboxed = false;
1476
  $sandbox = null;
@@ -1478,8 +1478,8 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
1478
  $variables = array_merge($context, $variables);
1479
  }
1480
 
1481
- if ($isSandboxed = $sandboxed && $env->hasExtension('Twig_Extension_Sandbox')) {
1482
- $sandbox = $env->getExtension('Twig_Extension_Sandbox');
1483
  if (!$alreadySandboxed = $sandbox->isSandboxed()) {
1484
  $sandbox->enableSandbox();
1485
  }
@@ -1488,7 +1488,7 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
1488
  $result = null;
1489
  try {
1490
  $result = $env->resolveTemplate($template)->render($variables);
1491
- } catch (Twig_Error_Loader $e) {
1492
  if (!$ignoreMissing) {
1493
  if ($isSandboxed && !$alreadySandboxed) {
1494
  $sandbox->disableSandbox();
@@ -1520,22 +1520,22 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
1520
  /**
1521
  * Returns a template content without rendering it.
1522
  *
1523
- * @param Twig_Environment $env
1524
  * @param string $name The template name
1525
  * @param bool $ignoreMissing Whether to ignore missing templates or not
1526
  *
1527
  * @return string The template source
1528
  */
1529
- function twig_source(Twig_Environment $env, $name, $ignoreMissing = false)
1530
  {
1531
  $loader = $env->getLoader();
1532
  try {
1533
- if (!$loader instanceof Twig_SourceContextLoaderInterface) {
1534
  return $loader->getSource($name);
1535
  } else {
1536
  return $loader->getSourceContext($name)->getCode();
1537
  }
1538
- } catch (Twig_Error_Loader $e) {
1539
  if (!$ignoreMissing) {
1540
  throw $e;
1541
  }
@@ -1550,7 +1550,7 @@ function twig_source(Twig_Environment $env, $name, $ignoreMissing = false)
1550
  *
1551
  * @return string
1552
  */
1553
- function twig_constant($constant, $object = null)
1554
  {
1555
  if (null !== $object) {
1556
  $constant = get_class($object).'::'.$constant;
@@ -1567,7 +1567,7 @@ function twig_constant($constant, $object = null)
1567
  *
1568
  * @return bool
1569
  */
1570
- function twig_constant_is_defined($constant, $object = null)
1571
  {
1572
  if (null !== $object) {
1573
  $constant = get_class($object).'::'.$constant;
@@ -1585,7 +1585,7 @@ function twig_constant_is_defined($constant, $object = null)
1585
  *
1586
  * @return array
1587
  */
1588
- function twig_array_batch($items, $size, $fill = null)
1589
  {
1590
  if ($items instanceof Traversable) {
1591
  $items = iterator_to_array($items, false);
17
  /**
18
  * @final
19
  */
20
+ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
21
  {
22
  protected $dateFormats = array('F j, Y H:i', '%d days');
23
  protected $numberFormat = array(0, '.', ',');
121
  public function getTokenParsers()
122
  {
123
  return array(
124
+ new Twig_SupTwg_TokenParser_For(),
125
+ new Twig_SupTwg_TokenParser_If(),
126
+ new Twig_SupTwg_TokenParser_Extends(),
127
+ new Twig_SupTwg_TokenParser_Include(),
128
+ new Twig_SupTwg_TokenParser_Block(),
129
+ new Twig_SupTwg_TokenParser_Use(),
130
+ new Twig_SupTwg_TokenParser_Filter(),
131
+ new Twig_SupTwg_TokenParser_Macro(),
132
+ new Twig_SupTwg_TokenParser_Import(),
133
+ new Twig_SupTwg_TokenParser_From(),
134
+ new Twig_SupTwg_TokenParser_Set(),
135
+ new Twig_SupTwg_TokenParser_Spaceless(),
136
+ new Twig_SupTwg_TokenParser_Flush(),
137
+ new Twig_SupTwg_TokenParser_Do(),
138
+ new Twig_SupTwg_TokenParser_Embed(),
139
+ new Twig_SupTwg_TokenParser_With(),
140
  );
141
  }
142
 
144
  {
145
  $filters = array(
146
  // formatting filters
147
+ new Twig_SupTwg_SimpleFilter('date', 'Twig_SupTwg_date_format_filter', array('needs_environment' => true)),
148
+ new Twig_SupTwg_SimpleFilter('date_modify', 'Twig_SupTwg_date_modify_filter', array('needs_environment' => true)),
149
+ new Twig_SupTwg_SimpleFilter('format', 'sprintf'),
150
+ new Twig_SupTwg_SimpleFilter('replace', 'Twig_SupTwg_replace_filter'),
151
+ new Twig_SupTwg_SimpleFilter('number_format', 'Twig_SupTwg_number_format_filter', array('needs_environment' => true)),
152
+ new Twig_SupTwg_SimpleFilter('abs', 'abs'),
153
+ new Twig_SupTwg_SimpleFilter('round', 'Twig_SupTwg_round'),
154
 
155
  // encoding
156
+ new Twig_SupTwg_SimpleFilter('url_encode', 'Twig_SupTwg_urlencode_filter'),
157
+ new Twig_SupTwg_SimpleFilter('json_encode', 'Twig_SupTwg_jsonencode_filter'),
158
+ new Twig_SupTwg_SimpleFilter('convert_encoding', 'Twig_SupTwg_convert_encoding'),
159
 
160
  // string filters
161
+ new Twig_SupTwg_SimpleFilter('title', 'Twig_SupTwg_title_string_filter', array('needs_environment' => true)),
162
+ new Twig_SupTwg_SimpleFilter('capitalize', 'Twig_SupTwg_capitalize_string_filter', array('needs_environment' => true)),
163
+ new Twig_SupTwg_SimpleFilter('upper', 'strtoupper'),
164
+ new Twig_SupTwg_SimpleFilter('lower', 'strtolower'),
165
+ new Twig_SupTwg_SimpleFilter('striptags', 'strip_tags'),
166
+ new Twig_SupTwg_SimpleFilter('trim', 'Twig_SupTwg_trim_filter'),
167
+ new Twig_SupTwg_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))),
168
 
169
  // array helpers
170
+ new Twig_SupTwg_SimpleFilter('join', 'Twig_SupTwg_join_filter'),
171
+ new Twig_SupTwg_SimpleFilter('split', 'Twig_SupTwg_split_filter', array('needs_environment' => true)),
172
+ new Twig_SupTwg_SimpleFilter('sort', 'Twig_SupTwg_sort_filter'),
173
+ new Twig_SupTwg_SimpleFilter('merge', 'Twig_SupTwg_array_merge'),
174
+ new Twig_SupTwg_SimpleFilter('batch', 'Twig_SupTwg_array_batch'),
175
 
176
  // string/array filters
177
+ new Twig_SupTwg_SimpleFilter('reverse', 'Twig_SupTwg_reverse_filter', array('needs_environment' => true)),
178
+ new Twig_SupTwg_SimpleFilter('length', 'Twig_SupTwg_length_filter', array('needs_environment' => true)),
179
+ new Twig_SupTwg_SimpleFilter('slice', 'Twig_SupTwg_slice', array('needs_environment' => true)),
180
+ new Twig_SupTwg_SimpleFilter('first', 'Twig_SupTwg_first', array('needs_environment' => true)),
181
+ new Twig_SupTwg_SimpleFilter('last', 'Twig_SupTwg_last', array('needs_environment' => true)),
182
 
183
  // iteration and runtime
184
+ new Twig_SupTwg_SimpleFilter('default', '_Twig_SupTwg_default_filter', array('node_class' => 'Twig_SupTwg_Node_Expression_Filter_Default')),
185
+ new Twig_SupTwg_SimpleFilter('keys', 'Twig_SupTwg_get_array_keys_filter'),
186
 
187
  // escaping
188
+ new Twig_SupTwg_SimpleFilter('escape', 'Twig_SupTwg_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'Twig_SupTwg_escape_filter_is_safe')),
189
+ new Twig_SupTwg_SimpleFilter('e', 'Twig_SupTwg_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'Twig_SupTwg_escape_filter_is_safe')),
190
  );
191
 
192
  if (function_exists('mb_get_info')) {
193
+ $filters[] = new Twig_SupTwg_SimpleFilter('upper', 'Twig_SupTwg_upper_filter', array('needs_environment' => true));
194
+ $filters[] = new Twig_SupTwg_SimpleFilter('lower', 'Twig_SupTwg_lower_filter', array('needs_environment' => true));
195
  }
196
 
197
  return $filters;
200
  public function getFunctions()
201
  {
202
  return array(
203
+ new Twig_SupTwg_SimpleFunction('max', 'max'),
204
+ new Twig_SupTwg_SimpleFunction('min', 'min'),
205
+ new Twig_SupTwg_SimpleFunction('range', 'range'),
206
+ new Twig_SupTwg_SimpleFunction('constant', 'Twig_SupTwg_constant'),
207
+ new Twig_SupTwg_SimpleFunction('cycle', 'Twig_SupTwg_cycle'),
208
+ new Twig_SupTwg_SimpleFunction('random', 'Twig_SupTwg_random', array('needs_environment' => true)),
209
+ new Twig_SupTwg_SimpleFunction('date', 'Twig_SupTwg_date_converter', array('needs_environment' => true)),
210
+ new Twig_SupTwg_SimpleFunction('include', 'Twig_SupTwg_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
211
+ new Twig_SupTwg_SimpleFunction('source', 'Twig_SupTwg_source', array('needs_environment' => true, 'is_safe' => array('all'))),
212
  );
213
  }
214
 
215
  public function getTests()
216
  {
217
  return array(
218
+ new Twig_SupTwg_SimpleTest('even', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Even')),
219
+ new Twig_SupTwg_SimpleTest('odd', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Odd')),
220
+ new Twig_SupTwg_SimpleTest('defined', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Defined')),
221
+ new Twig_SupTwg_SimpleTest('sameas', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Sameas', 'deprecated' => '1.21', 'alternative' => 'same as')),
222
+ new Twig_SupTwg_SimpleTest('same as', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Sameas')),
223
+ new Twig_SupTwg_SimpleTest('none', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Null')),
224
+ new Twig_SupTwg_SimpleTest('null', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Null')),
225
+ new Twig_SupTwg_SimpleTest('divisibleby', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Divisibleby', 'deprecated' => '1.21', 'alternative' => 'divisible by')),
226
+ new Twig_SupTwg_SimpleTest('divisible by', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Divisibleby')),
227
+ new Twig_SupTwg_SimpleTest('constant', null, array('node_class' => 'Twig_SupTwg_Node_Expression_Test_Constant')),
228
+ new Twig_SupTwg_SimpleTest('empty', 'Twig_SupTwg_test_empty'),
229
+ new Twig_SupTwg_SimpleTest('iterable', 'Twig_SupTwg_test_iterable'),
230
  );
231
  }
232
 
234
  {
235
  return array(
236
  array(
237
+ 'not' => array('precedence' => 50, 'class' => 'Twig_SupTwg_Node_Expression_Unary_Not'),
238
+ '-' => array('precedence' => 500, 'class' => 'Twig_SupTwg_Node_Expression_Unary_Neg'),
239
+ '+' => array('precedence' => 500, 'class' => 'Twig_SupTwg_Node_Expression_Unary_Pos'),
240
  ),
241
  array(
242
+ 'or' => array('precedence' => 10, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Or', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
243
+ 'and' => array('precedence' => 15, 'class' => 'Twig_SupTwg_Node_Expression_Binary_And', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
244
+ 'b-or' => array('precedence' => 16, 'class' => 'Twig_SupTwg_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
245
+ 'b-xor' => array('precedence' => 17, 'class' => 'Twig_SupTwg_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
246
+ 'b-and' => array('precedence' => 18, 'class' => 'Twig_SupTwg_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
247
+ '==' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Equal', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
248
+ '!=' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_NotEqual', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
249
+ '<' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Less', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
250
+ '>' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Greater', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
251
+ '>=' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
252
+ '<=' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_LessEqual', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
253
+ 'not in' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_NotIn', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
254
+ 'in' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_In', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
255
+ 'matches' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Matches', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
256
+ 'starts with' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_StartsWith', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
257
+ 'ends with' => array('precedence' => 20, 'class' => 'Twig_SupTwg_Node_Expression_Binary_EndsWith', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
258
+ '..' => array('precedence' => 25, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Range', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
259
+ '+' => array('precedence' => 30, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Add', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
260
+ '-' => array('precedence' => 30, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Sub', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
261
+ '~' => array('precedence' => 40, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Concat', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
262
+ '*' => array('precedence' => 60, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Mul', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
263
+ '/' => array('precedence' => 60, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Div', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
264
+ '//' => array('precedence' => 60, 'class' => 'Twig_SupTwg_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
265
+ '%' => array('precedence' => 60, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Mod', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
266
+ 'is' => array('precedence' => 100, 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
267
+ 'is not' => array('precedence' => 100, 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_LEFT),
268
+ '**' => array('precedence' => 200, 'class' => 'Twig_SupTwg_Node_Expression_Binary_Power', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_RIGHT),
269
+ '??' => array('precedence' => 300, 'class' => 'Twig_SupTwg_Node_Expression_NullCoalesce', 'associativity' => Twig_SupTwg_ExpressionParser::OPERATOR_RIGHT),
270
  ),
271
  );
272
  }
285
  *
286
  * @return string The next value in the cycle
287
  */
288
+ function Twig_SupTwg_cycle($values, $position)
289
  {
290
  if (!is_array($values) && !$values instanceof ArrayAccess) {
291
  return $values;
300
  * - a random character from a string
301
  * - a random integer between 0 and the integer parameter.
302
  *
303
+ * @param Twig_SupTwg_Environment $env
304
  * @param Traversable|array|int|float|string $values The values to pick a random item from
305
  *
306
+ * @throws Twig_SupTwg_Error_Runtime when $values is an empty array (does not apply to an empty string which is returned as is)
307
  *
308
  * @return mixed A random value from the given sequence
309
  */
310
+ function Twig_SupTwg_random(Twig_SupTwg_Environment $env, $values = null)
311
  {
312
  if (null === $values) {
313
  return mt_rand();
325
  }
326
  if (null !== $charset = $env->getCharset()) {
327
  if ('UTF-8' !== $charset) {
328
+ $values = Twig_SupTwg_convert_encoding($values, 'UTF-8', $charset);
329
  }
330
 
331
  // unicode version of str_split()
334
 
335
  if ('UTF-8' !== $charset) {
336
  foreach ($values as $i => $value) {
337
+ $values[$i] = Twig_SupTwg_convert_encoding($value, $charset, 'UTF-8');
338
  }
339
  }
340
  } else {
347
  }
348
 
349
  if (0 === count($values)) {
350
+ throw new Twig_SupTwg_Error_Runtime('The random function cannot pick from an empty array.');
351
  }
352
 
353
  return $values[array_rand($values, 1)];
360
  * {{ post.published_at|date("m/d/Y") }}
361
  * </pre>
362
  *
363
+ * @param Twig_SupTwg_Environment $env
364
  * @param DateTime|DateTimeInterface|DateInterval|string $date A date
365
  * @param string|null $format The target format, null to use the default
366
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
367
  *
368
  * @return string The formatted date
369
  */
370
+ function Twig_SupTwg_date_format_filter(Twig_SupTwg_Environment $env, $date, $format = null, $timezone = null)
371
  {
372
  if (null === $format) {
373
+ $formats = $env->getExtension('Twig_SupTwg_Extension_Core')->getDateFormat();
374
  $format = $date instanceof DateInterval ? $formats[1] : $formats[0];
375
  }
376
 
378
  return $date->format($format);
379
  }
380
 
381
+ return Twig_SupTwg_date_converter($env, $date, $timezone)->format($format);
382
  }
383
 
384
  /**
388
  * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
389
  * </pre>
390
  *
391
+ * @param Twig_SupTwg_Environment $env
392
  * @param DateTime|string $date A date
393
  * @param string $modifier A modifier string
394
  *
395
  * @return DateTime A new date object
396
  */
397
+ function Twig_SupTwg_date_modify_filter(Twig_SupTwg_Environment $env, $date, $modifier)
398
  {
399
+ $date = Twig_SupTwg_date_converter($env, $date, false);
400
  $resultDate = $date->modify($modifier);
401
 
402
  // This is a hack to ensure PHP 5.2 support and support for DateTimeImmutable
414
  * {% endif %}
415
  * </pre>
416
  *
417
+ * @param Twig_SupTwg_Environment $env
418
  * @param DateTime|DateTimeInterface|string|null $date A date
419
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
420
  *
421
  * @return DateTime A DateTime instance
422
  */
423
+ function Twig_SupTwg_date_converter(Twig_SupTwg_Environment $env, $date = null, $timezone = null)
424
  {
425
  // determine the timezone
426
  if (false !== $timezone) {
427
  if (null === $timezone) {
428
+ $timezone = $env->getExtension('Twig_SupTwg_Extension_Core')->getTimezone();
429
  } elseif (!$timezone instanceof DateTimeZone) {
430
  $timezone = new DateTimeZone($timezone);
431
  }
446
  }
447
 
448
  if (null === $date || 'now' === $date) {
449
+ return new DateTime($date, false !== $timezone ? $timezone : $env->getExtension('Twig_SupTwg_Extension_Core')->getTimezone());
450
  }
451
 
452
  $asString = (string) $date;
453
  if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) {
454
  $date = new DateTime('@'.$date);
455
  } else {
456
+ $date = new DateTime($date, $env->getExtension('Twig_SupTwg_Extension_Core')->getTimezone());
457
  }
458
 
459
  if (false !== $timezone) {
472
  *
473
  * @return string
474
  */
475
+ function Twig_SupTwg_replace_filter($str, $from, $to = null)
476
  {
477
  if ($from instanceof Traversable) {
478
  $from = iterator_to_array($from);
481
 
482
  return strtr($str, $from, $to);
483
  } elseif (!is_array($from)) {
484
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', is_object($from) ? get_class($from) : gettype($from)));
485
  }
486
 
487
  return strtr($str, $from);
496
  *
497
  * @return int|float The rounded number
498
  */
499
+ function Twig_SupTwg_round($value, $precision = 0, $method = 'common')
500
  {
501
  if ('common' == $method) {
502
  return round($value, $precision);
503
  }
504
 
505
  if ('ceil' != $method && 'floor' != $method) {
506
+ throw new Twig_SupTwg_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.');
507
  }
508
 
509
  return $method($value * pow(10, $precision)) / pow(10, $precision);
516
  * be used. Supplying any of the parameters will override the defaults set in the
517
  * environment object.
518
  *
519
+ * @param Twig_SupTwg_Environment $env
520
  * @param mixed $number A float/int/string of the number to format
521
  * @param int $decimal the number of decimal points to display
522
  * @param string $decimalPoint the character(s) to use for the decimal point
524
  *
525
  * @return string The formatted number
526
  */
527
+ function Twig_SupTwg_number_format_filter(Twig_SupTwg_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null)
528
  {
529
+ $defaults = $env->getExtension('Twig_SupTwg_Extension_Core')->getNumberFormat();
530
  if (null === $decimal) {
531
  $decimal = $defaults[0];
532
  }
549
  *
550
  * @return string The URL encoded value
551
  */
552
+ function Twig_SupTwg_urlencode_filter($url)
553
  {
554
  if (is_array($url)) {
555
  if (defined('PHP_QUERY_RFC3986')) {
571
  *
572
  * @return mixed The JSON encoded value
573
  */
574
+ function Twig_SupTwg_jsonencode_filter($value, $options = 0)
575
  {
576
+ if ($value instanceof Twig_SupTwg_Markup) {
577
  $value = (string) $value;
578
  } elseif (is_array($value)) {
579
+ array_walk_recursive($value, '_Twig_SupTwg_markup2string');
580
  }
581
 
582
  return json_encode($value);
590
  *
591
  * @return mixed The JSON encoded value
592
  */
593
+ function Twig_SupTwg_jsonencode_filter($value, $options = 0)
594
  {
595
+ if ($value instanceof Twig_SupTwg_Markup) {
596
  $value = (string) $value;
597
  } elseif (is_array($value)) {
598
+ array_walk_recursive($value, '_Twig_SupTwg_markup2string');
599
  }
600
 
601
  return json_encode($value, $options);
602
  }
603
  }
604
 
605
+ function _Twig_SupTwg_markup2string(&$value)
606
  {
607
+ if ($value instanceof Twig_SupTwg_Markup) {
608
  $value = (string) $value;
609
  }
610
  }
625
  *
626
  * @return array The merged array
627
  */
628
+ function Twig_SupTwg_array_merge($arr1, $arr2)
629
  {
630
  if ($arr1 instanceof Traversable) {
631
  $arr1 = iterator_to_array($arr1);
632
  } elseif (!is_array($arr1)) {
633
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', gettype($arr1)));
634
  }
635
 
636
  if ($arr2 instanceof Traversable) {
637
  $arr2 = iterator_to_array($arr2);
638
  } elseif (!is_array($arr2)) {
639
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', gettype($arr2)));
640
  }
641
 
642
  return array_merge($arr1, $arr2);
645
  /**
646
  * Slices a variable.
647
  *
648
+ * @param Twig_SupTwg_Environment $env
649
  * @param mixed $item A variable
650
  * @param int $start Start of the slice
651
  * @param int $length Size of the slice
653
  *
654
  * @return mixed The sliced variable
655
  */
656
+ function Twig_SupTwg_slice(Twig_SupTwg_Environment $env, $item, $start, $length = null, $preserveKeys = false)
657
  {
658
  if ($item instanceof Traversable) {
659
  while ($item instanceof IteratorAggregate) {
687
  /**
688
  * Returns the first element of the item.
689
  *
690
+ * @param Twig_SupTwg_Environment $env
691
  * @param mixed $item A variable
692
  *
693
  * @return mixed The first element of the item
694
  */
695
+ function Twig_SupTwg_first(Twig_SupTwg_Environment $env, $item)
696
  {
697
+ $elements = Twig_SupTwg_slice($env, $item, 0, 1, false);
698
 
699
  return is_string($elements) ? $elements : current($elements);
700
  }
702
  /**
703
  * Returns the last element of the item.
704
  *
705
+ * @param Twig_SupTwg_Environment $env
706
  * @param mixed $item A variable
707
  *
708
  * @return mixed The last element of the item
709
  */
710
+ function Twig_SupTwg_last(Twig_SupTwg_Environment $env, $item)
711
  {
712
+ $elements = Twig_SupTwg_slice($env, $item, -1, 1, false);
713
 
714
  return is_string($elements) ? $elements : current($elements);
715
  }
732
  *
733
  * @return string The concatenated string
734
  */
735
+ function Twig_SupTwg_join_filter($value, $glue = '')
736
  {
737
  if ($value instanceof Traversable) {
738
  $value = iterator_to_array($value, false);
758
  * {# returns [aa, bb, cc] #}
759
  * </pre>
760
  *
761
+ * @param Twig_SupTwg_Environment $env
762
  * @param string $value A string
763
  * @param string $delimiter The delimiter
764
  * @param int $limit The limit
765
  *
766
  * @return array The split string as an array
767
  */
768
+ function Twig_SupTwg_split_filter(Twig_SupTwg_Environment $env, $value, $delimiter, $limit = null)
769
  {
770
  if (!empty($delimiter)) {
771
  return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
798
  /**
799
  * @internal
800
  */
801
+ function _Twig_SupTwg_default_filter($value, $default = '')
802
  {
803
+ if (Twig_SupTwg_test_empty($value)) {
804
  return $default;
805
  }
806
 
822
  *
823
  * @return array The keys
824
  */
825
+ function Twig_SupTwg_get_array_keys_filter($array)
826
  {
827
  if ($array instanceof Traversable) {
828
  while ($array instanceof IteratorAggregate) {
858
  /**
859
  * Reverses a variable.
860
  *
861
+ * @param Twig_SupTwg_Environment $env
862
  * @param array|Traversable|string $item An array, a Traversable instance, or a string
863
  * @param bool $preserveKeys Whether to preserve key or not
864
  *
865
  * @return mixed The reversed input
866
  */
867
+ function Twig_SupTwg_reverse_filter(Twig_SupTwg_Environment $env, $item, $preserveKeys = false)
868
  {
869
  if ($item instanceof Traversable) {
870
  return array_reverse(iterator_to_array($item), $preserveKeys);
878
  $string = (string) $item;
879
 
880
  if ('UTF-8' !== $charset) {
881
+ $item = Twig_SupTwg_convert_encoding($string, 'UTF-8', $charset);
882
  }
883
 
884
  preg_match_all('/./us', $item, $matches);
886
  $string = implode('', array_reverse($matches[0]));
887
 
888
  if ('UTF-8' !== $charset) {
889
+ $string = Twig_SupTwg_convert_encoding($string, $charset, 'UTF-8');
890
  }
891
 
892
  return $string;
902
  *
903
  * @return array
904
  */
905
+ function Twig_SupTwg_sort_filter($array)
906
  {
907
  if ($array instanceof Traversable) {
908
  $array = iterator_to_array($array);
909
  } elseif (!is_array($array)) {
910
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', gettype($array)));
911
  }
912
 
913
  asort($array);
918
  /**
919
  * @internal
920
  */
921
+ function Twig_SupTwg_in_filter($value, $compare)
922
  {
923
  if (is_array($compare)) {
924
  return in_array($value, $compare, is_object($value) || is_resource($value));
950
  *
951
  * @return string
952
  *
953
+ * @throws Twig_SupTwg_Error_Runtime When an invalid trimming side is used (not a string or not 'left', 'right', or 'both')
954
  */
955
+ function Twig_SupTwg_trim_filter($string, $characterMask = null, $side = 'both')
956
  {
957
  if (null === $characterMask) {
958
  $characterMask = " \t\n\r\0\x0B";
966
  case 'right':
967
  return rtrim($string, $characterMask);
968
  default:
969
+ throw new Twig_SupTwg_Error_Runtime('Trimming side must be "left", "right" or "both".');
970
  }
971
  }
972
 
973
  /**
974
  * Escapes a string.
975
  *
976
+ * @param Twig_SupTwg_Environment $env
977
  * @param mixed $string The value to be escaped
978
  * @param string $strategy The escaping strategy
979
  * @param string $charset The charset
981
  *
982
  * @return string
983
  */
984
+ function Twig_SupTwg_escape_filter(Twig_SupTwg_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
985
  {
986
+ if ($autoescape && $string instanceof Twig_SupTwg_Markup) {
987
  return $string;
988
  }
989
 
1042
  return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
1043
  }
1044
 
1045
+ $string = Twig_SupTwg_convert_encoding($string, 'UTF-8', $charset);
1046
  $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
1047
 
1048
+ return Twig_SupTwg_convert_encoding($string, $charset, 'UTF-8');
1049
 
1050
  case 'js':
1051
  // escape all non-alphanumeric characters
1052
  // into their \xHH or \uHHHH representations
1053
  if ('UTF-8' !== $charset) {
1054
+ $string = Twig_SupTwg_convert_encoding($string, 'UTF-8', $charset);
1055
  }
1056
 
1057
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1058
+ throw new Twig_SupTwg_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1059
  }
1060
 
1061
+ $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_Twig_SupTwg_escape_js_callback', $string);
1062
 
1063
  if ('UTF-8' !== $charset) {
1064
+ $string = Twig_SupTwg_convert_encoding($string, $charset, 'UTF-8');
1065
  }
1066
 
1067
  return $string;
1068
 
1069
  case 'css':
1070
  if ('UTF-8' !== $charset) {
1071
+ $string = Twig_SupTwg_convert_encoding($string, 'UTF-8', $charset);
1072
  }
1073
 
1074
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1075
+ throw new Twig_SupTwg_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1076
  }
1077
 
1078
+ $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_Twig_SupTwg_escape_css_callback', $string);
1079
 
1080
  if ('UTF-8' !== $charset) {
1081
+ $string = Twig_SupTwg_convert_encoding($string, $charset, 'UTF-8');
1082
  }
1083
 
1084
  return $string;
1085
 
1086
  case 'html_attr':
1087
  if ('UTF-8' !== $charset) {
1088
+ $string = Twig_SupTwg_convert_encoding($string, 'UTF-8', $charset);
1089
  }
1090
 
1091
  if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1092
+ throw new Twig_SupTwg_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1093
  }
1094
 
1095
+ $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_Twig_SupTwg_escape_html_attr_callback', $string);
1096
 
1097
  if ('UTF-8' !== $charset) {
1098
+ $string = Twig_SupTwg_convert_encoding($string, $charset, 'UTF-8');
1099
  }
1100
 
1101
  return $string;
1111
  static $escapers;
1112
 
1113
  if (null === $escapers) {
1114
+ $escapers = $env->getExtension('Twig_SupTwg_Extension_Core')->getEscapers();
1115
  }
1116
 
1117
  if (isset($escapers[$strategy])) {
1120
 
1121
  $validStrategies = implode(', ', array_merge(array('html', 'js', 'url', 'css', 'html_attr'), array_keys($escapers)));
1122
 
1123
+ throw new Twig_SupTwg_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies));
1124
  }
1125
  }
1126
 
1127
  /**
1128
  * @internal
1129
  */
1130
+ function Twig_SupTwg_escape_filter_is_safe(Twig_SupTwg_Node $filterArgs)
1131
  {
1132
  foreach ($filterArgs as $arg) {
1133
+ if ($arg instanceof Twig_SupTwg_Node_Expression_Constant) {
1134
  return array($arg->getAttribute('value'));
1135
  }
1136
 
1141
  }
1142
 
1143
  if (function_exists('mb_convert_encoding')) {
1144
+ function Twig_SupTwg_convert_encoding($string, $to, $from)
1145
  {
1146
  return mb_convert_encoding($string, $to, $from);
1147
  }
1148
  } elseif (function_exists('iconv')) {
1149
+ function Twig_SupTwg_convert_encoding($string, $to, $from)
1150
  {
1151
  return iconv($from, $to, $string);
1152
  }
1153
  } else {
1154
+ function Twig_SupTwg_convert_encoding($string, $to, $from)
1155
  {
1156
+ throw new Twig_SupTwg_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
1157
  }
1158
  }
1159
 
1160
+ function _Twig_SupTwg_escape_js_callback($matches)
1161
  {
1162
  $char = $matches[0];
1163
 
1167
  }
1168
 
1169
  // \uHHHH
1170
+ $char = Twig_SupTwg_convert_encoding($char, 'UTF-16BE', 'UTF-8');
1171
  $char = strtoupper(bin2hex($char));
1172
 
1173
  if (4 >= strlen($char)) {
1177
  return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4));
1178
  }
1179
 
1180
+ function _Twig_SupTwg_escape_css_callback($matches)
1181
  {
1182
  $char = $matches[0];
1183
 
1192
  }
1193
 
1194
  // \uHHHH
1195
+ $char = Twig_SupTwg_convert_encoding($char, 'UTF-16BE', 'UTF-8');
1196
 
1197
  return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' ';
1198
  }
1203
  * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
1204
  * @license http://framework.zend.com/license/new-bsd New BSD License
1205
  */
1206
+ function _Twig_SupTwg_escape_html_attr_callback($matches)
1207
  {
1208
  /*
1209
  * While HTML supports far more named entities, the lowest common denominator
1236
  if (strlen($chr) == 1) {
1237
  $hex = strtoupper(substr('00'.bin2hex($chr), -2));
1238
  } else {
1239
+ $chr = Twig_SupTwg_convert_encoding($chr, 'UTF-16BE', 'UTF-8');
1240
  $hex = strtoupper(substr('0000'.bin2hex($chr), -4));
1241
  }
1242
 
1257
  /**
1258
  * Returns the length of a variable.
1259
  *
1260
+ * @param Twig_SupTwg_Environment $env
1261
  * @param mixed $thing A variable
1262
  *
1263
  * @return int The length of the value
1264
  */
1265
+ function Twig_SupTwg_length_filter(Twig_SupTwg_Environment $env, $thing)
1266
  {
1267
  if (is_scalar($thing)) {
1268
  return mb_strlen($thing, $env->getCharset());
1284
  /**
1285
  * Converts a string to uppercase.
1286
  *
1287
+ * @param Twig_SupTwg_Environment $env
1288
  * @param string $string A string
1289
  *
1290
  * @return string The uppercased string
1291
  */
1292
+ function Twig_SupTwg_upper_filter(Twig_SupTwg_Environment $env, $string)
1293
  {
1294
  if (null !== $charset = $env->getCharset()) {
1295
  return mb_strtoupper($string, $charset);
1301
  /**
1302
  * Converts a string to lowercase.
1303
  *
1304
+ * @param Twig_SupTwg_Environment $env
1305
  * @param string $string A string
1306
  *
1307
  * @return string The lowercased string
1308
  */
1309
+ function Twig_SupTwg_lower_filter(Twig_SupTwg_Environment $env, $string)
1310
  {
1311
  if (null !== $charset = $env->getCharset()) {
1312
  return mb_strtolower($string, $charset);
1318
  /**
1319
  * Returns a titlecased string.
1320
  *
1321
+ * @param Twig_SupTwg_Environment $env
1322
  * @param string $string A string
1323
  *
1324
  * @return string The titlecased string
1325
  */
1326
+ function Twig_SupTwg_title_string_filter(Twig_SupTwg_Environment $env, $string)
1327
  {
1328
  if (null !== $charset = $env->getCharset()) {
1329
  return mb_convert_case($string, MB_CASE_TITLE, $charset);
1335
  /**
1336
  * Returns a capitalized string.
1337
  *
1338
+ * @param Twig_SupTwg_Environment $env
1339
  * @param string $string A string
1340
  *
1341
  * @return string The capitalized string
1342
  */
1343
+ function Twig_SupTwg_capitalize_string_filter(Twig_SupTwg_Environment $env, $string)
1344
  {
1345
  if (null !== $charset = $env->getCharset()) {
1346
  return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset);
1354
  /**
1355
  * Returns the length of a variable.
1356
  *
1357
+ * @param Twig_SupTwg_Environment $env
1358
  * @param mixed $thing A variable
1359
  *
1360
  * @return int The length of the value
1361
  */
1362
+ function Twig_SupTwg_length_filter(Twig_SupTwg_Environment $env, $thing)
1363
  {
1364
  if (is_scalar($thing)) {
1365
  return strlen($thing);
1375
  /**
1376
  * Returns a titlecased string.
1377
  *
1378
+ * @param Twig_SupTwg_Environment $env
1379
  * @param string $string A string
1380
  *
1381
  * @return string The titlecased string
1382
  */
1383
+ function Twig_SupTwg_title_string_filter(Twig_SupTwg_Environment $env, $string)
1384
  {
1385
  return ucwords(strtolower($string));
1386
  }
1388
  /**
1389
  * Returns a capitalized string.
1390
  *
1391
+ * @param Twig_SupTwg_Environment $env
1392
  * @param string $string A string
1393
  *
1394
  * @return string The capitalized string
1395
  */
1396
+ function Twig_SupTwg_capitalize_string_filter(Twig_SupTwg_Environment $env, $string)
1397
  {
1398
  return ucfirst(strtolower($string));
1399
  }
1402
  /**
1403
  * @internal
1404
  */
1405
+ function Twig_SupTwg_ensure_traversable($seq)
1406
  {
1407
  if ($seq instanceof Traversable || is_array($seq)) {
1408
  return $seq;
1425
  *
1426
  * @return bool true if the value is empty, false otherwise
1427
  */
1428
+ function Twig_SupTwg_test_empty($value)
1429
  {
1430
  if ($value instanceof Countable) {
1431
  return 0 == count($value);
1452
  *
1453
  * @return bool true if the value is traversable
1454
  */
1455
+ function Twig_SupTwg_test_iterable($value)
1456
  {
1457
  return $value instanceof Traversable || is_array($value);
1458
  }
1460
  /**
1461
  * Renders a template.
1462
  *
1463
+ * @param Twig_SupTwg_Environment $env
1464
  * @param array $context
1465
  * @param string|array $template The template to render or an array of templates to try consecutively
1466
  * @param array $variables The variables to pass to the template
1470
  *
1471
  * @return string The rendered template
1472
  */
1473
+ function Twig_SupTwg_include(Twig_SupTwg_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false)
1474
  {
1475
  $alreadySandboxed = false;
1476
  $sandbox = null;
1478
  $variables = array_merge($context, $variables);
1479
  }
1480
 
1481
+ if ($isSandboxed = $sandboxed && $env->hasExtension('Twig_SupTwg_Extension_Sandbox')) {
1482
+ $sandbox = $env->getExtension('Twig_SupTwg_Extension_Sandbox');
1483
  if (!$alreadySandboxed = $sandbox->isSandboxed()) {
1484
  $sandbox->enableSandbox();
1485
  }
1488
  $result = null;
1489
  try {
1490
  $result = $env->resolveTemplate($template)->render($variables);
1491
+ } catch (Twig_SupTwg_Error_Loader $e) {
1492
  if (!$ignoreMissing) {
1493
  if ($isSandboxed && !$alreadySandboxed) {
1494
  $sandbox->disableSandbox();
1520
  /**
1521
  * Returns a template content without rendering it.
1522
  *
1523
+ * @param Twig_SupTwg_Environment $env
1524
  * @param string $name The template name
1525
  * @param bool $ignoreMissing Whether to ignore missing templates or not
1526
  *
1527
  * @return string The template source
1528
  */
1529
+ function Twig_SupTwg_source(Twig_SupTwg_Environment $env, $name, $ignoreMissing = false)
1530
  {
1531
  $loader = $env->getLoader();
1532
  try {
1533
+ if (!$loader instanceof Twig_SupTwg_SourceContextLoaderInterface) {
1534
  return $loader->getSource($name);
1535
  } else {
1536
  return $loader->getSourceContext($name)->getCode();
1537
  }
1538
+ } catch (Twig_SupTwg_Error_Loader $e) {
1539
  if (!$ignoreMissing) {
1540
  throw $e;
1541
  }
1550
  *
1551
  * @return string
1552
  */
1553
+ function Twig_SupTwg_constant($constant, $object = null)
1554
  {
1555
  if (null !== $object) {
1556
  $constant = get_class($object).'::'.$constant;
1567
  *
1568
  * @return bool
1569
  */
1570
+ function Twig_SupTwg_constant_is_defined($constant, $object = null)
1571
  {
1572
  if (null !== $object) {
1573
  $constant = get_class($object).'::'.$constant;
1585
  *
1586
  * @return array
1587
  */
1588
+ function Twig_SupTwg_array_batch($items, $size, $fill = null)
1589
  {
1590
  if ($items instanceof Traversable) {
1591
  $items = iterator_to_array($items, false);
vendor/Twig/Extension/Debug.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_Extension_Debug extends Twig_Extension
16
  {
17
  public function getFunctions()
18
  {
@@ -27,7 +27,7 @@ class Twig_Extension_Debug extends Twig_Extension
27
  ;
28
 
29
  return array(
30
- new Twig_SimpleFunction('dump', 'twig_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)),
31
  );
32
  }
33
 
@@ -37,7 +37,7 @@ class Twig_Extension_Debug extends Twig_Extension
37
  }
38
  }
39
 
40
- function twig_var_dump(Twig_Environment $env, $context)
41
  {
42
  if (!$env->isDebug()) {
43
  return;
@@ -49,7 +49,7 @@ function twig_var_dump(Twig_Environment $env, $context)
49
  if (2 === $count) {
50
  $vars = array();
51
  foreach ($context as $key => $value) {
52
- if (!$value instanceof Twig_Template) {
53
  $vars[$key] = $value;
54
  }
55
  }
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_Extension_Debug extends Twig_SupTwg_Extension
16
  {
17
  public function getFunctions()
18
  {
27
  ;
28
 
29
  return array(
30
+ new Twig_SupTwg_SimpleFunction('dump', 'Twig_SupTwg_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)),
31
  );
32
  }
33
 
37
  }
38
  }
39
 
40
+ function Twig_SupTwg_var_dump(Twig_SupTwg_Environment $env, $context)
41
  {
42
  if (!$env->isDebug()) {
43
  return;
49
  if (2 === $count) {
50
  $vars = array();
51
  foreach ($context as $key => $value) {
52
+ if (!$value instanceof Twig_SupTwg_Template) {
53
  $vars[$key] = $value;
54
  }
55
  }
vendor/Twig/Extension/Escaper.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_Extension_Escaper extends Twig_Extension
16
  {
17
  protected $defaultStrategy;
18
 
@@ -28,18 +28,18 @@ class Twig_Extension_Escaper extends Twig_Extension
28
 
29
  public function getTokenParsers()
30
  {
31
- return array(new Twig_TokenParser_AutoEscape());
32
  }
33
 
34
  public function getNodeVisitors()
35
  {
36
- return array(new Twig_NodeVisitor_Escaper());
37
  }
38
 
39
  public function getFilters()
40
  {
41
  return array(
42
- new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))),
43
  );
44
  }
45
 
@@ -67,7 +67,7 @@ class Twig_Extension_Escaper extends Twig_Extension
67
  }
68
 
69
  if ('name' === $defaultStrategy) {
70
- $defaultStrategy = array('Twig_FileExtensionEscapingStrategy', 'guess');
71
  }
72
 
73
  $this->defaultStrategy = $defaultStrategy;
@@ -104,7 +104,7 @@ class Twig_Extension_Escaper extends Twig_Extension
104
  *
105
  * @return string
106
  */
107
- function twig_raw_filter($string)
108
  {
109
  return $string;
110
  }
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_Extension_Escaper extends Twig_SupTwg_Extension
16
  {
17
  protected $defaultStrategy;
18
 
28
 
29
  public function getTokenParsers()
30
  {
31
+ return array(new Twig_SupTwg_TokenParser_AutoEscape());
32
  }
33
 
34
  public function getNodeVisitors()
35
  {
36
+ return array(new Twig_SupTwg_NodeVisitor_Escaper());
37
  }
38
 
39
  public function getFilters()
40
  {
41
  return array(
42
+ new Twig_SupTwg_SimpleFilter('raw', 'Twig_SupTwg_raw_filter', array('is_safe' => array('all'))),
43
  );
44
  }
45
 
67
  }
68
 
69
  if ('name' === $defaultStrategy) {
70
+ $defaultStrategy = array('Twig_SupTwg_FileExtensionEscapingStrategy', 'guess');
71
  }
72
 
73
  $this->defaultStrategy = $defaultStrategy;
104
  *
105
  * @return string
106
  */
107
+ function Twig_SupTwg_raw_filter($string)
108
  {
109
  return $string;
110
  }
vendor/Twig/Extension/GlobalsInterface.php CHANGED
@@ -10,13 +10,13 @@
10
  */
11
 
12
  /**
13
- * Enables usage of the deprecated Twig_Extension::getGlobals() method.
14
  *
15
  * Explicitly implement this interface if you really need to implement the
16
  * deprecated getGlobals() method in your extensions.
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
- interface Twig_Extension_GlobalsInterface
21
  {
22
  }
10
  */
11
 
12
  /**
13
+ * Enables usage of the deprecated Twig_SupTwg_Extension::getGlobals() method.
14
  *
15
  * Explicitly implement this interface if you really need to implement the
16
  * deprecated getGlobals() method in your extensions.
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
+ interface Twig_SupTwg_Extension_GlobalsInterface
21
  {
22
  }
vendor/Twig/Extension/InitRuntimeInterface.php CHANGED
@@ -10,13 +10,13 @@
10
  */
11
 
12
  /**
13
- * Enables usage of the deprecated Twig_Extension::initRuntime() method.
14
  *
15
  * Explicitly implement this interface if you really need to implement the
16
  * deprecated initRuntime() method in your extensions.
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
- interface Twig_Extension_InitRuntimeInterface
21
  {
22
  }
10
  */
11
 
12
  /**
13
+ * Enables usage of the deprecated Twig_SupTwg_Extension::initRuntime() method.
14
  *
15
  * Explicitly implement this interface if you really need to implement the
16
  * deprecated initRuntime() method in your extensions.
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
+ interface Twig_SupTwg_Extension_InitRuntimeInterface
21
  {
22
  }
vendor/Twig/Extension/Optimizer.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_Extension_Optimizer extends Twig_Extension
16
  {
17
  protected $optimizers;
18
 
@@ -23,7 +23,7 @@ class Twig_Extension_Optimizer extends Twig_Extension
23
 
24
  public function getNodeVisitors()
25
  {
26
- return array(new Twig_NodeVisitor_Optimizer($this->optimizers));
27
  }
28
 
29
  public function getName()
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_Extension_Optimizer extends Twig_SupTwg_Extension
16
  {
17
  protected $optimizers;
18
 
23
 
24
  public function getNodeVisitors()
25
  {
26
+ return array(new Twig_SupTwg_NodeVisitor_Optimizer($this->optimizers));
27
  }
28
 
29
  public function getName()
vendor/Twig/Extension/Profiler.php CHANGED
@@ -9,22 +9,22 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- class Twig_Extension_Profiler extends Twig_Extension
13
  {
14
  private $actives = array();
15
 
16
- public function __construct(Twig_Profiler_Profile $profile)
17
  {
18
  $this->actives[] = $profile;
19
  }
20
 
21
- public function enter(Twig_Profiler_Profile $profile)
22
  {
23
  $this->actives[0]->addProfile($profile);
24
  array_unshift($this->actives, $profile);
25
  }
26
 
27
- public function leave(Twig_Profiler_Profile $profile)
28
  {
29
  $profile->leave();
30
  array_shift($this->actives);
@@ -36,7 +36,7 @@ class Twig_Extension_Profiler extends Twig_Extension
36
 
37
  public function getNodeVisitors()
38
  {
39
- return array(new Twig_Profiler_NodeVisitor_Profiler(get_class($this)));
40
  }
41
 
42
  public function getName()
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ class Twig_SupTwg_Extension_Profiler extends Twig_SupTwg_Extension
13
  {
14
  private $actives = array();
15
 
16
+ public function __construct(Twig_SupTwg_Profiler_Profile $profile)
17
  {
18
  $this->actives[] = $profile;
19
  }
20
 
21
+ public function enter(Twig_SupTwg_Profiler_Profile $profile)
22
  {
23
  $this->actives[0]->addProfile($profile);
24
  array_unshift($this->actives, $profile);
25
  }
26
 
27
+ public function leave(Twig_SupTwg_Profiler_Profile $profile)
28
  {
29
  $profile->leave();
30
  array_shift($this->actives);
36
 
37
  public function getNodeVisitors()
38
  {
39
+ return array(new Twig_SupTwg_Profiler_NodeVisitor_Profiler(get_class($this)));
40
  }
41
 
42
  public function getName()
vendor/Twig/Extension/Sandbox.php CHANGED
@@ -12,13 +12,13 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_Extension_Sandbox extends Twig_Extension
16
  {
17
  protected $sandboxedGlobally;
18
  protected $sandboxed;
19
  protected $policy;
20
 
21
- public function __construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false)
22
  {
23
  $this->policy = $policy;
24
  $this->sandboxedGlobally = $sandboxed;
@@ -26,12 +26,12 @@ class Twig_Extension_Sandbox extends Twig_Extension
26
 
27
  public function getTokenParsers()
28
  {
29
- return array(new Twig_TokenParser_Sandbox());
30
  }
31
 
32
  public function getNodeVisitors()
33
  {
34
- return array(new Twig_NodeVisitor_Sandbox());
35
  }
36
 
37
  public function enableSandbox()
@@ -54,7 +54,7 @@ class Twig_Extension_Sandbox extends Twig_Extension
54
  return $this->sandboxedGlobally;
55
  }
56
 
57
- public function setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy)
58
  {
59
  $this->policy = $policy;
60
  }
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_Extension_Sandbox extends Twig_SupTwg_Extension
16
  {
17
  protected $sandboxedGlobally;
18
  protected $sandboxed;
19
  protected $policy;
20
 
21
+ public function __construct(Twig_SupTwg_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false)
22
  {
23
  $this->policy = $policy;
24
  $this->sandboxedGlobally = $sandboxed;
26
 
27
  public function getTokenParsers()
28
  {
29
+ return array(new Twig_SupTwg_TokenParser_Sandbox());
30
  }
31
 
32
  public function getNodeVisitors()
33
  {
34
+ return array(new Twig_SupTwg_NodeVisitor_Sandbox());
35
  }
36
 
37
  public function enableSandbox()
54
  return $this->sandboxedGlobally;
55
  }
56
 
57
+ public function setSecurityPolicy(Twig_SupTwg_Sandbox_SecurityPolicyInterface $policy)
58
  {
59
  $this->policy = $policy;
60
  }
vendor/Twig/Extension/Staging.php CHANGED
@@ -12,13 +12,13 @@
12
  /**
13
  * Internal class.
14
  *
15
- * This class is used by Twig_Environment as a staging area and must not be used directly.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @internal
20
  */
21
- class Twig_Extension_Staging extends Twig_Extension
22
  {
23
  protected $functions = array();
24
  protected $filters = array();
@@ -55,7 +55,7 @@ class Twig_Extension_Staging extends Twig_Extension
55
  return $this->filters;
56
  }
57
 
58
- public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
59
  {
60
  $this->visitors[] = $visitor;
61
  }
@@ -65,7 +65,7 @@ class Twig_Extension_Staging extends Twig_Extension
65
  return $this->visitors;
66
  }
67
 
68
- public function addTokenParser(Twig_TokenParserInterface $parser)
69
  {
70
  if (isset($this->tokenParsers[$parser->getTag()])) {
71
  @trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED);
12
  /**
13
  * Internal class.
14
  *
15
+ * This class is used by Twig_SupTwg_Environment as a staging area and must not be used directly.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @internal
20
  */
21
+ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
22
  {
23
  protected $functions = array();
24
  protected $filters = array();
55
  return $this->filters;
56
  }
57
 
58
+ public function addNodeVisitor(Twig_SupTwg_NodeVisitorInterface $visitor)
59
  {
60
  $this->visitors[] = $visitor;
61
  }
65
  return $this->visitors;
66
  }
67
 
68
+ public function addTokenParser(Twig_SupTwg_TokenParserInterface $parser)
69
  {
70
  if (isset($this->tokenParsers[$parser->getTag()])) {
71
  @trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED);
vendor/Twig/Extension/StringLoader.php CHANGED
@@ -12,12 +12,12 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_Extension_StringLoader extends Twig_Extension
16
  {
17
  public function getFunctions()
18
  {
19
  return array(
20
- new Twig_SimpleFunction('template_from_string', 'twig_template_from_string', array('needs_environment' => true)),
21
  );
22
  }
23
 
@@ -34,12 +34,12 @@ class Twig_Extension_StringLoader extends Twig_Extension
34
  * {{ include(template_from_string("Hello {{ name }}")) }}
35
  * </pre>
36
  *
37
- * @param Twig_Environment $env A Twig_Environment instance
38
  * @param string $template A template as a string or object implementing __toString()
39
  *
40
- * @return Twig_Template
41
  */
42
- function twig_template_from_string(Twig_Environment $env, $template)
43
  {
44
  return $env->createTemplate((string) $template);
45
  }
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_Extension_StringLoader extends Twig_SupTwg_Extension
16
  {
17
  public function getFunctions()
18
  {
19
  return array(
20
+ new Twig_SupTwg_SimpleFunction('template_from_string', 'Twig_SupTwg_template_from_string', array('needs_environment' => true)),
21
  );
22
  }
23
 
34
  * {{ include(template_from_string("Hello {{ name }}")) }}
35
  * </pre>
36
  *
37
+ * @param Twig_SupTwg_Environment $env A Twig_SupTwg_Environment instance
38
  * @param string $template A template as a string or object implementing __toString()
39
  *
40
+ * @return Twig_SupTwg_Template
41
  */
42
+ function Twig_SupTwg_template_from_string(Twig_SupTwg_Environment $env, $template)
43
  {
44
  return $env->createTemplate((string) $template);
45
  }
vendor/Twig/ExtensionInterface.php CHANGED
@@ -14,49 +14,49 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_ExtensionInterface
18
  {
19
  /**
20
  * Initializes the runtime environment.
21
  *
22
  * This is where you can load some file that contains filter functions for instance.
23
  *
24
- * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
25
  */
26
- public function initRuntime(Twig_Environment $environment);
27
 
28
  /**
29
  * Returns the token parser instances to add to the existing list.
30
  *
31
- * @return Twig_TokenParserInterface[]
32
  */
33
  public function getTokenParsers();
34
 
35
  /**
36
  * Returns the node visitor instances to add to the existing list.
37
  *
38
- * @return Twig_NodeVisitorInterface[]
39
  */
40
  public function getNodeVisitors();
41
 
42
  /**
43
  * Returns a list of filters to add to the existing list.
44
  *
45
- * @return Twig_SimpleFilter[]
46
  */
47
  public function getFilters();
48
 
49
  /**
50
  * Returns a list of tests to add to the existing list.
51
  *
52
- * @return Twig_SimpleTest[]
53
  */
54
  public function getTests();
55
 
56
  /**
57
  * Returns a list of functions to add to the existing list.
58
  *
59
- * @return Twig_SimpleFunction[]
60
  */
61
  public function getFunctions();
62
 
@@ -72,7 +72,7 @@ interface Twig_ExtensionInterface
72
  *
73
  * @return array An array of global variables
74
  *
75
- * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead
76
  */
77
  public function getGlobals();
78
 
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_ExtensionInterface
18
  {
19
  /**
20
  * Initializes the runtime environment.
21
  *
22
  * This is where you can load some file that contains filter functions for instance.
23
  *
24
+ * @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwg_Extension_InitRuntimeInterface instead
25
  */
26
+ public function initRuntime(Twig_SupTwg_Environment $environment);
27
 
28
  /**
29
  * Returns the token parser instances to add to the existing list.
30
  *
31
+ * @return Twig_SupTwg_TokenParserInterface[]
32
  */
33
  public function getTokenParsers();
34
 
35
  /**
36
  * Returns the node visitor instances to add to the existing list.
37
  *
38
+ * @return Twig_SupTwg_NodeVisitorInterface[]
39
  */
40
  public function getNodeVisitors();
41
 
42
  /**
43
  * Returns a list of filters to add to the existing list.
44
  *
45
+ * @return Twig_SupTwg_SimpleFilter[]
46
  */
47
  public function getFilters();
48
 
49
  /**
50
  * Returns a list of tests to add to the existing list.
51
  *
52
+ * @return Twig_SupTwg_SimpleTest[]
53
  */
54
  public function getTests();
55
 
56
  /**
57
  * Returns a list of functions to add to the existing list.
58
  *
59
+ * @return Twig_SupTwg_SimpleFunction[]
60
  */
61
  public function getFunctions();
62
 
72
  *
73
  * @return array An array of global variables
74
  *
75
+ * @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwg_Extension_GlobalsInterface instead
76
  */
77
  public function getGlobals();
78
 
vendor/Twig/FactoryRuntimeLoader.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Robin Chalas <robin.chalas@gmail.com>
16
  */
17
- class Twig_FactoryRuntimeLoader implements Twig_RuntimeLoaderInterface
18
  {
19
  private $map;
20
 
14
  *
15
  * @author Robin Chalas <robin.chalas@gmail.com>
16
  */
17
+ class Twig_SupTwg_FactoryRuntimeLoader implements Twig_SupTwg_RuntimeLoaderInterface
18
  {
19
  private $map;
20
 
vendor/Twig/FileExtensionEscapingStrategy.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
- class Twig_FileExtensionEscapingStrategy
24
  {
25
  /**
26
  * Guesses the best autoescaping strategy based on the file name.
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
+ class Twig_SupTwg_FileExtensionEscapingStrategy
24
  {
25
  /**
26
  * Guesses the best autoescaping strategy based on the file name.
vendor/Twig/Filter.php CHANGED
@@ -9,18 +9,18 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template filter.
16
  *
17
- * Use Twig_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface
24
  {
25
  protected $options;
26
  protected $arguments = array();
@@ -56,7 +56,7 @@ abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableI
56
  return $this->options['needs_context'];
57
  }
58
 
59
- public function getSafe(Twig_Node $filterArgs)
60
  {
61
  if (isset($this->options['is_safe'])) {
62
  return $this->options['is_safe'];
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template filter.
16
  *
17
+ * Use Twig_SupTwg_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ abstract class Twig_SupTwg_Filter implements Twig_SupTwg_FilterInterface, Twig_SupTwg_FilterCallableInterface
24
  {
25
  protected $options;
26
  protected $arguments = array();
56
  return $this->options['needs_context'];
57
  }
58
 
59
+ public function getSafe(Twig_SupTwg_Node $filterArgs)
60
  {
61
  if (isset($this->options['is_safe'])) {
62
  return $this->options['is_safe'];
vendor/Twig/Filter/Function.php CHANGED
@@ -9,18 +9,18 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a function template filter.
16
  *
17
- * Use Twig_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- class Twig_Filter_Function extends Twig_Filter
24
  {
25
  protected $function;
26
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a function template filter.
16
  *
17
+ * Use Twig_SupTwg_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ class Twig_SupTwg_Filter_Function extends Twig_SupTwg_Filter
24
  {
25
  protected $function;
26
 
vendor/Twig/Filter/Method.php CHANGED
@@ -9,23 +9,23 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a method template filter.
16
  *
17
- * Use Twig_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- class Twig_Filter_Method extends Twig_Filter
24
  {
25
  protected $extension;
26
  protected $method;
27
 
28
- public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array())
29
  {
30
  $options['callable'] = array($extension, $method);
31
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a method template filter.
16
  *
17
+ * Use Twig_SupTwg_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ class Twig_SupTwg_Filter_Method extends Twig_SupTwg_Filter
24
  {
25
  protected $extension;
26
  protected $method;
27
 
28
+ public function __construct(Twig_SupTwg_ExtensionInterface $extension, $method, array $options = array())
29
  {
30
  $options['callable'] = array($extension, $method);
31
 
vendor/Twig/Filter/Node.php CHANGED
@@ -9,18 +9,18 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template filter as a node.
16
  *
17
- * Use Twig_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- class Twig_Filter_Node extends Twig_Filter
24
  {
25
  protected $class;
26
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFilter instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template filter as a node.
16
  *
17
+ * Use Twig_SupTwg_SimpleFilter instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ class Twig_SupTwg_Filter_Node extends Twig_SupTwg_Filter
24
  {
25
  protected $class;
26
 
vendor/Twig/FilterCallableInterface.php CHANGED
@@ -12,13 +12,13 @@
12
  /**
13
  * Represents a callable template filter.
14
  *
15
- * Use Twig_SimpleFilter instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- interface Twig_FilterCallableInterface
22
  {
23
  public function getCallable();
24
  }
12
  /**
13
  * Represents a callable template filter.
14
  *
15
+ * Use Twig_SupTwg_SimpleFilter instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ interface Twig_SupTwg_FilterCallableInterface
22
  {
23
  public function getCallable();
24
  }
vendor/Twig/FilterInterface.php CHANGED
@@ -12,13 +12,13 @@
12
  /**
13
  * Represents a template filter.
14
  *
15
- * Use Twig_SimpleFilter instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- interface Twig_FilterInterface
22
  {
23
  /**
24
  * Compiles a filter.
@@ -31,7 +31,7 @@ interface Twig_FilterInterface
31
 
32
  public function needsContext();
33
 
34
- public function getSafe(Twig_Node $filterArgs);
35
 
36
  public function getPreservesSafety();
37
 
12
  /**
13
  * Represents a template filter.
14
  *
15
+ * Use Twig_SupTwg_SimpleFilter instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ interface Twig_SupTwg_FilterInterface
22
  {
23
  /**
24
  * Compiles a filter.
31
 
32
  public function needsContext();
33
 
34
+ public function getSafe(Twig_SupTwg_Node $filterArgs);
35
 
36
  public function getPreservesSafety();
37
 
vendor/Twig/Function.php CHANGED
@@ -9,18 +9,18 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template function.
16
  *
17
- * Use Twig_SimpleFunction instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface
24
  {
25
  protected $options;
26
  protected $arguments = array();
@@ -54,7 +54,7 @@ abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCal
54
  return $this->options['needs_context'];
55
  }
56
 
57
- public function getSafe(Twig_Node $functionArgs)
58
  {
59
  if (isset($this->options['is_safe'])) {
60
  return $this->options['is_safe'];
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFunction instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template function.
16
  *
17
+ * Use Twig_SupTwg_SimpleFunction instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ abstract class Twig_SupTwg_Function implements Twig_SupTwg_FunctionInterface, Twig_SupTwg_FunctionCallableInterface
24
  {
25
  protected $options;
26
  protected $arguments = array();
54
  return $this->options['needs_context'];
55
  }
56
 
57
+ public function getSafe(Twig_SupTwg_Node $functionArgs)
58
  {
59
  if (isset($this->options['is_safe'])) {
60
  return $this->options['is_safe'];
vendor/Twig/Function/Function.php CHANGED
@@ -10,18 +10,18 @@
10
  * file that was distributed with this source code.
11
  */
12
 
13
- @trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
14
 
15
  /**
16
  * Represents a function template function.
17
  *
18
- * Use Twig_SimpleFunction instead.
19
  *
20
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
21
  *
22
  * @deprecated since 1.12 (to be removed in 2.0)
23
  */
24
- class Twig_Function_Function extends Twig_Function
25
  {
26
  protected $function;
27
 
10
  * file that was distributed with this source code.
11
  */
12
 
13
+ @trigger_error('The Twig_SupTwg_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFunction instead.', E_USER_DEPRECATED);
14
 
15
  /**
16
  * Represents a function template function.
17
  *
18
+ * Use Twig_SupTwg_SimpleFunction instead.
19
  *
20
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
21
  *
22
  * @deprecated since 1.12 (to be removed in 2.0)
23
  */
24
+ class Twig_SupTwg_Function_Function extends Twig_SupTwg_Function
25
  {
26
  protected $function;
27
 
vendor/Twig/Function/Method.php CHANGED
@@ -10,23 +10,23 @@
10
  * file that was distributed with this source code.
11
  */
12
 
13
- @trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
14
 
15
  /**
16
  * Represents a method template function.
17
  *
18
- * Use Twig_SimpleFunction instead.
19
  *
20
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
21
  *
22
  * @deprecated since 1.12 (to be removed in 2.0)
23
  */
24
- class Twig_Function_Method extends Twig_Function
25
  {
26
  protected $extension;
27
  protected $method;
28
 
29
- public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array())
30
  {
31
  $options['callable'] = array($extension, $method);
32
 
10
  * file that was distributed with this source code.
11
  */
12
 
13
+ @trigger_error('The Twig_SupTwg_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFunction instead.', E_USER_DEPRECATED);
14
 
15
  /**
16
  * Represents a method template function.
17
  *
18
+ * Use Twig_SupTwg_SimpleFunction instead.
19
  *
20
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
21
  *
22
  * @deprecated since 1.12 (to be removed in 2.0)
23
  */
24
+ class Twig_SupTwg_Function_Method extends Twig_SupTwg_Function
25
  {
26
  protected $extension;
27
  protected $method;
28
 
29
+ public function __construct(Twig_SupTwg_ExtensionInterface $extension, $method, array $options = array())
30
  {
31
  $options['callable'] = array($extension, $method);
32
 
vendor/Twig/Function/Node.php CHANGED
@@ -9,18 +9,18 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template function as a node.
16
  *
17
- * Use Twig_SimpleFunction instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
- class Twig_Function_Node extends Twig_Function
24
  {
25
  protected $class;
26
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleFunction instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template function as a node.
16
  *
17
+ * Use Twig_SupTwg_SimpleFunction instead.
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  *
21
  * @deprecated since 1.12 (to be removed in 2.0)
22
  */
23
+ class Twig_SupTwg_Function_Node extends Twig_SupTwg_Function
24
  {
25
  protected $class;
26
 
vendor/Twig/FunctionCallableInterface.php CHANGED
@@ -12,13 +12,13 @@
12
  /**
13
  * Represents a callable template function.
14
  *
15
- * Use Twig_SimpleFunction instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- interface Twig_FunctionCallableInterface
22
  {
23
  public function getCallable();
24
  }
12
  /**
13
  * Represents a callable template function.
14
  *
15
+ * Use Twig_SupTwg_SimpleFunction instead.
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ interface Twig_SupTwg_FunctionCallableInterface
22
  {
23
  public function getCallable();
24
  }
vendor/Twig/FunctionInterface.php CHANGED
@@ -13,13 +13,13 @@
13
  /**
14
  * Represents a template function.
15
  *
16
- * Use Twig_SimpleFunction instead.
17
  *
18
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
19
  *
20
  * @deprecated since 1.12 (to be removed in 2.0)
21
  */
22
- interface Twig_FunctionInterface
23
  {
24
  /**
25
  * Compiles a function.
@@ -32,7 +32,7 @@ interface Twig_FunctionInterface
32
 
33
  public function needsContext();
34
 
35
- public function getSafe(Twig_Node $filterArgs);
36
 
37
  public function setArguments($arguments);
38
 
13
  /**
14
  * Represents a template function.
15
  *
16
+ * Use Twig_SupTwg_SimpleFunction instead.
17
  *
18
  * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
19
  *
20
  * @deprecated since 1.12 (to be removed in 2.0)
21
  */
22
+ interface Twig_SupTwg_FunctionInterface
23
  {
24
  /**
25
  * Compiles a function.
32
 
33
  public function needsContext();
34
 
35
+ public function getSafe(Twig_SupTwg_Node $filterArgs);
36
 
37
  public function setArguments($arguments);
38
 
vendor/Twig/Lexer.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Lexer implements Twig_LexerInterface
19
  {
20
  protected $tokens;
21
  protected $code;
@@ -49,7 +49,7 @@ class Twig_Lexer implements Twig_LexerInterface
49
  const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
50
  const PUNCTUATION = '()[]{}?:.,|';
51
 
52
- public function __construct(Twig_Environment $env, array $options = array())
53
  {
54
  $this->env = $env;
55
 
@@ -77,9 +77,9 @@ class Twig_Lexer implements Twig_LexerInterface
77
 
78
  public function tokenize($code, $name = null)
79
  {
80
- if (!$code instanceof Twig_Source) {
81
- @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
82
- $this->source = new Twig_Source($code, $name);
83
  } else {
84
  $this->source = $code;
85
  }
@@ -136,25 +136,25 @@ class Twig_Lexer implements Twig_LexerInterface
136
  }
137
  }
138
 
139
- $this->pushToken(Twig_Token::EOF_TYPE);
140
 
141
  if (!empty($this->brackets)) {
142
  list($expect, $lineno) = array_pop($this->brackets);
143
- throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
144
  }
145
 
146
  if ($mbEncoding) {
147
  mb_internal_encoding($mbEncoding);
148
  }
149
 
150
- return new Twig_TokenStream($this->tokens, $this->source);
151
  }
152
 
153
  protected function lexData()
154
  {
155
  // if no matches are left we return the rest of the template as simple text token
156
  if ($this->position == count($this->positions[0]) - 1) {
157
- $this->pushToken(Twig_Token::TEXT_TYPE, substr($this->code, $this->cursor));
158
  $this->cursor = $this->end;
159
 
160
  return;
@@ -174,7 +174,7 @@ class Twig_Lexer implements Twig_LexerInterface
174
  if (isset($this->positions[2][$this->position][0])) {
175
  $text = rtrim($text);
176
  }
177
- $this->pushToken(Twig_Token::TEXT_TYPE, $text);
178
  $this->moveCursor($textContent.$position[0]);
179
 
180
  switch ($this->positions[1][$this->position][0]) {
@@ -192,14 +192,14 @@ class Twig_Lexer implements Twig_LexerInterface
192
  $this->moveCursor($match[0]);
193
  $this->lineno = (int) $match[1];
194
  } else {
195
- $this->pushToken(Twig_Token::BLOCK_START_TYPE);
196
  $this->pushState(self::STATE_BLOCK);
197
  $this->currentVarBlockLine = $this->lineno;
198
  }
199
  break;
200
 
201
  case $this->options['tag_variable'][0]:
202
- $this->pushToken(Twig_Token::VAR_START_TYPE);
203
  $this->pushState(self::STATE_VAR);
204
  $this->currentVarBlockLine = $this->lineno;
205
  break;
@@ -209,7 +209,7 @@ class Twig_Lexer implements Twig_LexerInterface
209
  protected function lexBlock()
210
  {
211
  if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) {
212
- $this->pushToken(Twig_Token::BLOCK_END_TYPE);
213
  $this->moveCursor($match[0]);
214
  $this->popState();
215
  } else {
@@ -220,7 +220,7 @@ class Twig_Lexer implements Twig_LexerInterface
220
  protected function lexVar()
221
  {
222
  if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) {
223
- $this->pushToken(Twig_Token::VAR_END_TYPE);
224
  $this->moveCursor($match[0]);
225
  $this->popState();
226
  } else {
@@ -235,18 +235,18 @@ class Twig_Lexer implements Twig_LexerInterface
235
  $this->moveCursor($match[0]);
236
 
237
  if ($this->cursor >= $this->end) {
238
- throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
239
  }
240
  }
241
 
242
  // operators
243
  if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) {
244
- $this->pushToken(Twig_Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0]));
245
  $this->moveCursor($match[0]);
246
  }
247
  // names
248
  elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) {
249
- $this->pushToken(Twig_Token::NAME_TYPE, $match[0]);
250
  $this->moveCursor($match[0]);
251
  }
252
  // numbers
@@ -255,7 +255,7 @@ class Twig_Lexer implements Twig_LexerInterface
255
  if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) {
256
  $number = (int) $match[0]; // integers lower than the maximum
257
  }
258
- $this->pushToken(Twig_Token::NUMBER_TYPE, $number);
259
  $this->moveCursor($match[0]);
260
  }
261
  // punctuation
@@ -267,21 +267,21 @@ class Twig_Lexer implements Twig_LexerInterface
267
  // closing bracket
268
  elseif (false !== strpos(')]}', $this->code[$this->cursor])) {
269
  if (empty($this->brackets)) {
270
- throw new Twig_Error_Syntax(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
271
  }
272
 
273
  list($expect, $lineno) = array_pop($this->brackets);
274
  if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) {
275
- throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
276
  }
277
  }
278
 
279
- $this->pushToken(Twig_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]);
280
  ++$this->cursor;
281
  }
282
  // strings
283
  elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) {
284
- $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)));
285
  $this->moveCursor($match[0]);
286
  }
287
  // opening double quoted string
@@ -292,7 +292,7 @@ class Twig_Lexer implements Twig_LexerInterface
292
  }
293
  // unlexable
294
  else {
295
- throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
296
  }
297
  }
298
 
@@ -303,7 +303,7 @@ class Twig_Lexer implements Twig_LexerInterface
303
  }
304
 
305
  if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
306
- throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source);
307
  }
308
 
309
  $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
@@ -313,13 +313,13 @@ class Twig_Lexer implements Twig_LexerInterface
313
  $text = rtrim($text);
314
  }
315
 
316
- $this->pushToken(Twig_Token::TEXT_TYPE, $text);
317
  }
318
 
319
  protected function lexComment()
320
  {
321
  if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
322
- throw new Twig_Error_Syntax('Unclosed comment.', $this->lineno, $this->source);
323
  }
324
 
325
  $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]);
@@ -329,16 +329,16 @@ class Twig_Lexer implements Twig_LexerInterface
329
  {
330
  if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) {
331
  $this->brackets[] = array($this->options['interpolation'][0], $this->lineno);
332
- $this->pushToken(Twig_Token::INTERPOLATION_START_TYPE);
333
  $this->moveCursor($match[0]);
334
  $this->pushState(self::STATE_INTERPOLATION);
335
  } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) {
336
- $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0]));
337
  $this->moveCursor($match[0]);
338
  } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
339
  list($expect, $lineno) = array_pop($this->brackets);
340
  if ($this->code[$this->cursor] != '"') {
341
- throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
342
  }
343
 
344
  $this->popState();
@@ -351,7 +351,7 @@ class Twig_Lexer implements Twig_LexerInterface
351
  $bracket = end($this->brackets);
352
  if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) {
353
  array_pop($this->brackets);
354
- $this->pushToken(Twig_Token::INTERPOLATION_END_TYPE);
355
  $this->moveCursor($match[0]);
356
  $this->popState();
357
  } else {
@@ -362,11 +362,11 @@ class Twig_Lexer implements Twig_LexerInterface
362
  protected function pushToken($type, $value = '')
363
  {
364
  // do not push empty text tokens
365
- if (Twig_Token::TEXT_TYPE === $type && '' === $value) {
366
  return;
367
  }
368
 
369
- $this->tokens[] = new Twig_Token($type, $value, $this->lineno);
370
  }
371
 
372
  protected function moveCursor($text)
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
19
  {
20
  protected $tokens;
21
  protected $code;
49
  const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
50
  const PUNCTUATION = '()[]{}?:.,|';
51
 
52
+ public function __construct(Twig_SupTwg_Environment $env, array $options = array())
53
  {
54
  $this->env = $env;
55
 
77
 
78
  public function tokenize($code, $name = null)
79
  {
80
+ if (!$code instanceof Twig_SupTwg_Source) {
81
+ @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a Twig_SupTwg_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
82
+ $this->source = new Twig_SupTwg_Source($code, $name);
83
  } else {
84
  $this->source = $code;
85
  }
136
  }
137
  }
138
 
139
+ $this->pushToken(Twig_SupTwg_Token::EOF_TYPE);
140
 
141
  if (!empty($this->brackets)) {
142
  list($expect, $lineno) = array_pop($this->brackets);
143
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
144
  }
145
 
146
  if ($mbEncoding) {
147
  mb_internal_encoding($mbEncoding);
148
  }
149
 
150
+ return new Twig_SupTwg_TokenStream($this->tokens, $this->source);
151
  }
152
 
153
  protected function lexData()
154
  {
155
  // if no matches are left we return the rest of the template as simple text token
156
  if ($this->position == count($this->positions[0]) - 1) {
157
+ $this->pushToken(Twig_SupTwg_Token::TEXT_TYPE, substr($this->code, $this->cursor));
158
  $this->cursor = $this->end;
159
 
160
  return;
174
  if (isset($this->positions[2][$this->position][0])) {
175
  $text = rtrim($text);
176
  }
177
+ $this->pushToken(Twig_SupTwg_Token::TEXT_TYPE, $text);
178
  $this->moveCursor($textContent.$position[0]);
179
 
180
  switch ($this->positions[1][$this->position][0]) {
192
  $this->moveCursor($match[0]);
193
  $this->lineno = (int) $match[1];
194
  } else {
195
+ $this->pushToken(Twig_SupTwg_Token::BLOCK_START_TYPE);
196
  $this->pushState(self::STATE_BLOCK);
197
  $this->currentVarBlockLine = $this->lineno;
198
  }
199
  break;
200
 
201
  case $this->options['tag_variable'][0]:
202
+ $this->pushToken(Twig_SupTwg_Token::VAR_START_TYPE);
203
  $this->pushState(self::STATE_VAR);
204
  $this->currentVarBlockLine = $this->lineno;
205
  break;
209
  protected function lexBlock()
210
  {
211
  if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) {
212
+ $this->pushToken(Twig_SupTwg_Token::BLOCK_END_TYPE);
213
  $this->moveCursor($match[0]);
214
  $this->popState();
215
  } else {
220
  protected function lexVar()
221
  {
222
  if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) {
223
+ $this->pushToken(Twig_SupTwg_Token::VAR_END_TYPE);
224
  $this->moveCursor($match[0]);
225
  $this->popState();
226
  } else {
235
  $this->moveCursor($match[0]);
236
 
237
  if ($this->cursor >= $this->end) {
238
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
239
  }
240
  }
241
 
242
  // operators
243
  if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) {
244
+ $this->pushToken(Twig_SupTwg_Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0]));
245
  $this->moveCursor($match[0]);
246
  }
247
  // names
248
  elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) {
249
+ $this->pushToken(Twig_SupTwg_Token::NAME_TYPE, $match[0]);
250
  $this->moveCursor($match[0]);
251
  }
252
  // numbers
255
  if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) {
256
  $number = (int) $match[0]; // integers lower than the maximum
257
  }
258
+ $this->pushToken(Twig_SupTwg_Token::NUMBER_TYPE, $number);
259
  $this->moveCursor($match[0]);
260
  }
261
  // punctuation
267
  // closing bracket
268
  elseif (false !== strpos(')]}', $this->code[$this->cursor])) {
269
  if (empty($this->brackets)) {
270
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
271
  }
272
 
273
  list($expect, $lineno) = array_pop($this->brackets);
274
  if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) {
275
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
276
  }
277
  }
278
 
279
+ $this->pushToken(Twig_SupTwg_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]);
280
  ++$this->cursor;
281
  }
282
  // strings
283
  elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) {
284
+ $this->pushToken(Twig_SupTwg_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)));
285
  $this->moveCursor($match[0]);
286
  }
287
  // opening double quoted string
292
  }
293
  // unlexable
294
  else {
295
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
296
  }
297
  }
298
 
303
  }
304
 
305
  if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
306
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source);
307
  }
308
 
309
  $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
313
  $text = rtrim($text);
314
  }
315
 
316
+ $this->pushToken(Twig_SupTwg_Token::TEXT_TYPE, $text);
317
  }
318
 
319
  protected function lexComment()
320
  {
321
  if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
322
+ throw new Twig_SupTwg_Error_Syntax('Unclosed comment.', $this->lineno, $this->source);
323
  }
324
 
325
  $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]);
329
  {
330
  if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) {
331
  $this->brackets[] = array($this->options['interpolation'][0], $this->lineno);
332
+ $this->pushToken(Twig_SupTwg_Token::INTERPOLATION_START_TYPE);
333
  $this->moveCursor($match[0]);
334
  $this->pushState(self::STATE_INTERPOLATION);
335
  } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) {
336
+ $this->pushToken(Twig_SupTwg_Token::STRING_TYPE, stripcslashes($match[0]));
337
  $this->moveCursor($match[0]);
338
  } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
339
  list($expect, $lineno) = array_pop($this->brackets);
340
  if ($this->code[$this->cursor] != '"') {
341
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
342
  }
343
 
344
  $this->popState();
351
  $bracket = end($this->brackets);
352
  if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) {
353
  array_pop($this->brackets);
354
+ $this->pushToken(Twig_SupTwg_Token::INTERPOLATION_END_TYPE);
355
  $this->moveCursor($match[0]);
356
  $this->popState();
357
  } else {
362
  protected function pushToken($type, $value = '')
363
  {
364
  // do not push empty text tokens
365
+ if (Twig_SupTwg_Token::TEXT_TYPE === $type && '' === $value) {
366
  return;
367
  }
368
 
369
+ $this->tokens[] = new Twig_SupTwg_Token($type, $value, $this->lineno);
370
  }
371
 
372
  protected function moveCursor($text)
vendor/Twig/LexerInterface.php CHANGED
@@ -16,17 +16,17 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_LexerInterface
20
  {
21
  /**
22
  * Tokenizes a source code.
23
  *
24
- * @param string|Twig_Source $code The source code
25
  * @param string $name A unique identifier for the source code
26
  *
27
- * @return Twig_TokenStream
28
  *
29
- * @throws Twig_Error_Syntax When the code is syntactically wrong
30
  */
31
  public function tokenize($code, $name = null);
32
  }
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_LexerInterface
20
  {
21
  /**
22
  * Tokenizes a source code.
23
  *
24
+ * @param string|Twig_SupTwg_Source $code The source code
25
  * @param string $name A unique identifier for the source code
26
  *
27
+ * @return Twig_SupTwg_TokenStream
28
  *
29
+ * @throws Twig_SupTwg_Error_Syntax When the code is syntactically wrong
30
  */
31
  public function tokenize($code, $name = null);
32
  }
vendor/Twig/Loader/Array.php CHANGED
@@ -23,7 +23,7 @@
23
  *
24
  * @author Fabien Potencier <fabien@symfony.com>
25
  */
26
- class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface
27
  {
28
  protected $templates = array();
29
 
@@ -52,7 +52,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
52
 
53
  $name = (string) $name;
54
  if (!isset($this->templates[$name])) {
55
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
56
  }
57
 
58
  return $this->templates[$name];
@@ -62,10 +62,10 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
62
  {
63
  $name = (string) $name;
64
  if (!isset($this->templates[$name])) {
65
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
66
  }
67
 
68
- return new Twig_Source($this->templates[$name], $name);
69
  }
70
 
71
  public function exists($name)
@@ -77,7 +77,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
77
  {
78
  $name = (string) $name;
79
  if (!isset($this->templates[$name])) {
80
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
81
  }
82
 
83
  return $name.':'.$this->templates[$name];
@@ -87,7 +87,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
87
  {
88
  $name = (string) $name;
89
  if (!isset($this->templates[$name])) {
90
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
91
  }
92
 
93
  return true;
23
  *
24
  * @author Fabien Potencier <fabien@symfony.com>
25
  */
26
+ class Twig_SupTwg_Loader_Array implements Twig_SupTwg_LoaderInterface, Twig_SupTwg_ExistsLoaderInterface, Twig_SupTwg_SourceContextLoaderInterface
27
  {
28
  protected $templates = array();
29
 
52
 
53
  $name = (string) $name;
54
  if (!isset($this->templates[$name])) {
55
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined.', $name));
56
  }
57
 
58
  return $this->templates[$name];
62
  {
63
  $name = (string) $name;
64
  if (!isset($this->templates[$name])) {
65
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined.', $name));
66
  }
67
 
68
+ return new Twig_SupTwg_Source($this->templates[$name], $name);
69
  }
70
 
71
  public function exists($name)
77
  {
78
  $name = (string) $name;
79
  if (!isset($this->templates[$name])) {
80
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined.', $name));
81
  }
82
 
83
  return $name.':'.$this->templates[$name];
87
  {
88
  $name = (string) $name;
89
  if (!isset($this->templates[$name])) {
90
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined.', $name));
91
  }
92
 
93
  return true;
vendor/Twig/Loader/Chain.php CHANGED
@@ -16,13 +16,13 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface
20
  {
21
  private $hasSourceCache = array();
22
  protected $loaders = array();
23
 
24
  /**
25
- * @param Twig_LoaderInterface[] $loaders
26
  */
27
  public function __construct(array $loaders = array())
28
  {
@@ -31,7 +31,7 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
31
  }
32
  }
33
 
34
- public function addLoader(Twig_LoaderInterface $loader)
35
  {
36
  $this->loaders[] = $loader;
37
  $this->hasSourceCache = array();
@@ -43,40 +43,40 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
43
 
44
  $exceptions = array();
45
  foreach ($this->loaders as $loader) {
46
- if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
47
  continue;
48
  }
49
 
50
  try {
51
  return $loader->getSource($name);
52
- } catch (Twig_Error_Loader $e) {
53
  $exceptions[] = $e->getMessage();
54
  }
55
  }
56
 
57
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
58
  }
59
 
60
  public function getSourceContext($name)
61
  {
62
  $exceptions = array();
63
  foreach ($this->loaders as $loader) {
64
- if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
65
  continue;
66
  }
67
 
68
  try {
69
- if ($loader instanceof Twig_SourceContextLoaderInterface) {
70
  return $loader->getSourceContext($name);
71
  }
72
 
73
- return new Twig_Source($loader->getSource($name), $name);
74
- } catch (Twig_Error_Loader $e) {
75
  $exceptions[] = $e->getMessage();
76
  }
77
  }
78
 
79
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
80
  }
81
 
82
  public function exists($name)
@@ -88,7 +88,7 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
88
  }
89
 
90
  foreach ($this->loaders as $loader) {
91
- if ($loader instanceof Twig_ExistsLoaderInterface) {
92
  if ($loader->exists($name)) {
93
  return $this->hasSourceCache[$name] = true;
94
  }
@@ -97,14 +97,14 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
97
  }
98
 
99
  try {
100
- if ($loader instanceof Twig_SourceContextLoaderInterface) {
101
  $loader->getSourceContext($name);
102
  } else {
103
  $loader->getSource($name);
104
  }
105
 
106
  return $this->hasSourceCache[$name] = true;
107
- } catch (Twig_Error_Loader $e) {
108
  }
109
  }
110
 
@@ -115,35 +115,35 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
115
  {
116
  $exceptions = array();
117
  foreach ($this->loaders as $loader) {
118
- if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
119
  continue;
120
  }
121
 
122
  try {
123
  return $loader->getCacheKey($name);
124
- } catch (Twig_Error_Loader $e) {
125
  $exceptions[] = get_class($loader).': '.$e->getMessage();
126
  }
127
  }
128
 
129
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
130
  }
131
 
132
  public function isFresh($name, $time)
133
  {
134
  $exceptions = array();
135
  foreach ($this->loaders as $loader) {
136
- if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
137
  continue;
138
  }
139
 
140
  try {
141
  return $loader->isFresh($name, $time);
142
- } catch (Twig_Error_Loader $e) {
143
  $exceptions[] = get_class($loader).': '.$e->getMessage();
144
  }
145
  }
146
 
147
- throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
148
  }
149
  }
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupTwg_ExistsLoaderInterface, Twig_SupTwg_SourceContextLoaderInterface
20
  {
21
  private $hasSourceCache = array();
22
  protected $loaders = array();
23
 
24
  /**
25
+ * @param Twig_SupTwg_LoaderInterface[] $loaders
26
  */
27
  public function __construct(array $loaders = array())
28
  {
31
  }
32
  }
33
 
34
+ public function addLoader(Twig_SupTwg_LoaderInterface $loader)
35
  {
36
  $this->loaders[] = $loader;
37
  $this->hasSourceCache = array();
43
 
44
  $exceptions = array();
45
  foreach ($this->loaders as $loader) {
46
+ if ($loader instanceof Twig_SupTwg_ExistsLoaderInterface && !$loader->exists($name)) {
47
  continue;
48
  }
49
 
50
  try {
51
  return $loader->getSource($name);
52
+ } catch (Twig_SupTwg_Error_Loader $e) {
53
  $exceptions[] = $e->getMessage();
54
  }
55
  }
56
 
57
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
58
  }
59
 
60
  public function getSourceContext($name)
61
  {
62
  $exceptions = array();
63
  foreach ($this->loaders as $loader) {
64
+ if ($loader instanceof Twig_SupTwg_ExistsLoaderInterface && !$loader->exists($name)) {
65
  continue;
66
  }
67
 
68
  try {
69
+ if ($loader instanceof Twig_SupTwg_SourceContextLoaderInterface) {
70
  return $loader->getSourceContext($name);
71
  }
72
 
73
+ return new Twig_SupTwg_Source($loader->getSource($name), $name);
74
+ } catch (Twig_SupTwg_Error_Loader $e) {
75
  $exceptions[] = $e->getMessage();
76
  }
77
  }
78
 
79
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
80
  }
81
 
82
  public function exists($name)
88
  }
89
 
90
  foreach ($this->loaders as $loader) {
91
+ if ($loader instanceof Twig_SupTwg_ExistsLoaderInterface) {
92
  if ($loader->exists($name)) {
93
  return $this->hasSourceCache[$name] = true;
94
  }
97
  }
98
 
99
  try {
100
+ if ($loader instanceof Twig_SupTwg_SourceContextLoaderInterface) {
101
  $loader->getSourceContext($name);
102
  } else {
103
  $loader->getSource($name);
104
  }
105
 
106
  return $this->hasSourceCache[$name] = true;
107
+ } catch (Twig_SupTwg_Error_Loader $e) {
108
  }
109
  }
110
 
115
  {
116
  $exceptions = array();
117
  foreach ($this->loaders as $loader) {
118
+ if ($loader instanceof Twig_SupTwg_ExistsLoaderInterface && !$loader->exists($name)) {
119
  continue;
120
  }
121
 
122
  try {
123
  return $loader->getCacheKey($name);
124
+ } catch (Twig_SupTwg_Error_Loader $e) {
125
  $exceptions[] = get_class($loader).': '.$e->getMessage();
126
  }
127
  }
128
 
129
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
130
  }
131
 
132
  public function isFresh($name, $time)
133
  {
134
  $exceptions = array();
135
  foreach ($this->loaders as $loader) {
136
+ if ($loader instanceof Twig_SupTwg_ExistsLoaderInterface && !$loader->exists($name)) {
137
  continue;
138
  }
139
 
140
  try {
141
  return $loader->isFresh($name, $time);
142
+ } catch (Twig_SupTwg_Error_Loader $e) {
143
  $exceptions[] = get_class($loader).': '.$e->getMessage();
144
  }
145
  }
146
 
147
+ throw new Twig_SupTwg_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
148
  }
149
  }
vendor/Twig/Loader/Filesystem.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface
18
  {
19
  /** Identifier of the main namespace. */
20
  const MAIN_NAMESPACE = '__main__';
@@ -89,7 +89,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
89
  * @param string $path A path where to look for templates
90
  * @param string $namespace A path namespace
91
  *
92
- * @throws Twig_Error_Loader
93
  */
94
  public function addPath($path, $namespace = self::MAIN_NAMESPACE)
95
  {
@@ -98,7 +98,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
98
 
99
  $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
100
  if (!is_dir($checkPath)) {
101
- throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
102
  }
103
 
104
  $this->paths[$namespace][] = rtrim($path, '/\\');
@@ -110,7 +110,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
110
  * @param string $path A path where to look for templates
111
  * @param string $namespace A path namespace
112
  *
113
- * @throws Twig_Error_Loader
114
  */
115
  public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
116
  {
@@ -119,7 +119,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
119
 
120
  $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
121
  if (!is_dir($checkPath)) {
122
- throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
123
  }
124
 
125
  $path = rtrim($path, '/\\');
@@ -142,7 +142,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
142
  {
143
  $path = $this->findTemplate($name);
144
 
145
- return new Twig_Source(file_get_contents($path), $name, $path);
146
  }
147
 
148
  public function getCacheKey($name)
@@ -166,7 +166,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
166
 
167
  try {
168
  return false !== $this->findTemplate($name, false);
169
- } catch (Twig_Error_Loader $exception) {
170
  @trigger_error(sprintf('In %s::findTemplate(), you must accept a second argument that when set to "false" returns "false" instead of throwing an exception. Not supporting this argument is deprecated since version 1.27.', get_class($this)), E_USER_DEPRECATED);
171
 
172
  return false;
@@ -192,7 +192,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
192
  return false;
193
  }
194
 
195
- throw new Twig_Error_Loader($this->errorCache[$name]);
196
  }
197
 
198
  $this->validateName($name);
@@ -206,7 +206,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
206
  return false;
207
  }
208
 
209
- throw new Twig_Error_Loader($this->errorCache[$name]);
210
  }
211
 
212
  foreach ($this->paths[$namespace] as $path) {
@@ -229,14 +229,14 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
229
  return false;
230
  }
231
 
232
- throw new Twig_Error_Loader($this->errorCache[$name]);
233
  }
234
 
235
  protected function parseName($name, $default = self::MAIN_NAMESPACE)
236
  {
237
  if (isset($name[0]) && '@' == $name[0]) {
238
  if (false === $pos = strpos($name, '/')) {
239
- throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name));
240
  }
241
 
242
  $namespace = substr($name, 1, $pos - 1);
@@ -256,7 +256,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
256
  protected function validateName($name)
257
  {
258
  if (false !== strpos($name, "\0")) {
259
- throw new Twig_Error_Loader('A template name cannot contain NUL bytes.');
260
  }
261
 
262
  $name = ltrim($name, '/');
@@ -270,7 +270,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
270
  }
271
 
272
  if ($level < 0) {
273
- throw new Twig_Error_Loader(sprintf('Looks like you try to load a template outside configured directories (%s).', $name));
274
  }
275
  }
276
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig_SupTwg_ExistsLoaderInterface, Twig_SupTwg_SourceContextLoaderInterface
18
  {
19
  /** Identifier of the main namespace. */
20
  const MAIN_NAMESPACE = '__main__';
89
  * @param string $path A path where to look for templates
90
  * @param string $namespace A path namespace
91
  *
92
+ * @throws Twig_SupTwg_Error_Loader
93
  */
94
  public function addPath($path, $namespace = self::MAIN_NAMESPACE)
95
  {
98
 
99
  $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
100
  if (!is_dir($checkPath)) {
101
+ throw new Twig_SupTwg_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
102
  }
103
 
104
  $this->paths[$namespace][] = rtrim($path, '/\\');
110
  * @param string $path A path where to look for templates
111
  * @param string $namespace A path namespace
112
  *
113
+ * @throws Twig_SupTwg_Error_Loader
114
  */
115
  public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
116
  {
119
 
120
  $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
121
  if (!is_dir($checkPath)) {
122
+ throw new Twig_SupTwg_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
123
  }
124
 
125
  $path = rtrim($path, '/\\');
142
  {
143
  $path = $this->findTemplate($name);
144
 
145
+ return new Twig_SupTwg_Source(file_get_contents($path), $name, $path);
146
  }
147
 
148
  public function getCacheKey($name)
166
 
167
  try {
168
  return false !== $this->findTemplate($name, false);
169
+ } catch (Twig_SupTwg_Error_Loader $exception) {
170
  @trigger_error(sprintf('In %s::findTemplate(), you must accept a second argument that when set to "false" returns "false" instead of throwing an exception. Not supporting this argument is deprecated since version 1.27.', get_class($this)), E_USER_DEPRECATED);
171
 
172
  return false;
192
  return false;
193
  }
194
 
195
+ throw new Twig_SupTwg_Error_Loader($this->errorCache[$name]);
196
  }
197
 
198
  $this->validateName($name);
206
  return false;
207
  }
208
 
209
+ throw new Twig_SupTwg_Error_Loader($this->errorCache[$name]);
210
  }
211
 
212
  foreach ($this->paths[$namespace] as $path) {
229
  return false;
230
  }
231
 
232
+ throw new Twig_SupTwg_Error_Loader($this->errorCache[$name]);
233
  }
234
 
235
  protected function parseName($name, $default = self::MAIN_NAMESPACE)
236
  {
237
  if (isset($name[0]) && '@' == $name[0]) {
238
  if (false === $pos = strpos($name, '/')) {
239
+ throw new Twig_SupTwg_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name));
240
  }
241
 
242
  $namespace = substr($name, 1, $pos - 1);
256
  protected function validateName($name)
257
  {
258
  if (false !== strpos($name, "\0")) {
259
+ throw new Twig_SupTwg_Error_Loader('A template name cannot contain NUL bytes.');
260
  }
261
 
262
  $name = ltrim($name, '/');
270
  }
271
 
272
  if ($level < 0) {
273
+ throw new Twig_SupTwg_Error_Loader(sprintf('Looks like you try to load a template outside configured directories (%s).', $name));
274
  }
275
  }
276
  }
vendor/Twig/Loader/String.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Loads a template from a string.
@@ -27,7 +27,7 @@
27
  *
28
  * @author Fabien Potencier <fabien@symfony.com>
29
  */
30
- class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface
31
  {
32
  public function getSource($name)
33
  {
@@ -38,7 +38,7 @@ class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInter
38
 
39
  public function getSourceContext($name)
40
  {
41
- return new Twig_Source($name, $name);
42
  }
43
 
44
  public function exists($name)
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_SupTwg_Loader_Array instead or Twig_SupTwg_Environment::createTemplate().', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Loads a template from a string.
27
  *
28
  * @author Fabien Potencier <fabien@symfony.com>
29
  */
30
+ class Twig_SupTwg_Loader_String implements Twig_SupTwg_LoaderInterface, Twig_SupTwg_ExistsLoaderInterface, Twig_SupTwg_SourceContextLoaderInterface
31
  {
32
  public function getSource($name)
33
  {
38
 
39
  public function getSourceContext($name)
40
  {
41
+ return new Twig_SupTwg_Source($name, $name);
42
  }
43
 
44
  public function exists($name)
vendor/Twig/LoaderInterface.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_LoaderInterface
18
  {
19
  /**
20
  * Gets the source code of a template, given its name.
@@ -23,9 +23,9 @@ interface Twig_LoaderInterface
23
  *
24
  * @return string The template source code
25
  *
26
- * @throws Twig_Error_Loader When $name is not found
27
  *
28
- * @deprecated since 1.27 (to be removed in 2.0), implement Twig_SourceContextLoaderInterface
29
  */
30
  public function getSource($name);
31
 
@@ -36,7 +36,7 @@ interface Twig_LoaderInterface
36
  *
37
  * @return string The cache key
38
  *
39
- * @throws Twig_Error_Loader When $name is not found
40
  */
41
  public function getCacheKey($name);
42
 
@@ -49,7 +49,7 @@ interface Twig_LoaderInterface
49
  *
50
  * @return bool true if the template is fresh, false otherwise
51
  *
52
- * @throws Twig_Error_Loader When $name is not found
53
  */
54
  public function isFresh($name, $time);
55
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_LoaderInterface
18
  {
19
  /**
20
  * Gets the source code of a template, given its name.
23
  *
24
  * @return string The template source code
25
  *
26
+ * @throws Twig_SupTwg_Error_Loader When $name is not found
27
  *
28
+ * @deprecated since 1.27 (to be removed in 2.0), implement Twig_SupTwg_SourceContextLoaderInterface
29
  */
30
  public function getSource($name);
31
 
36
  *
37
  * @return string The cache key
38
  *
39
+ * @throws Twig_SupTwg_Error_Loader When $name is not found
40
  */
41
  public function getCacheKey($name);
42
 
49
  *
50
  * @return bool true if the template is fresh, false otherwise
51
  *
52
+ * @throws Twig_SupTwg_Error_Loader When $name is not found
53
  */
54
  public function isFresh($name, $time);
55
  }
vendor/Twig/Markup.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Markup implements Countable
18
  {
19
  protected $content;
20
  protected $charset;
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Markup implements Countable
18
  {
19
  protected $content;
20
  protected $charset;
vendor/Twig/Node.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node implements Twig_NodeInterface
19
  {
20
  protected $nodes;
21
  protected $attributes;
@@ -38,9 +38,9 @@ class Twig_Node implements Twig_NodeInterface
38
  public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
39
  {
40
  foreach ($nodes as $name => $node) {
41
- if (!$node instanceof Twig_NodeInterface) {
42
- @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
43
- }
44
  }
45
  $this->nodes = $nodes;
46
  $this->attributes = $attributes;
@@ -111,7 +111,7 @@ class Twig_Node implements Twig_NodeInterface
111
  return $asDom ? $dom : $dom->saveXML();
112
  }
113
 
114
- public function compile(Twig_Compiler $compiler)
115
  {
116
  foreach ($this->nodes as $node) {
117
  $node->compile($compiler);
@@ -181,7 +181,7 @@ class Twig_Node implements Twig_NodeInterface
181
  }
182
 
183
  /**
184
- * @return Twig_Node
185
  */
186
  public function getNode($name)
187
  {
@@ -194,9 +194,9 @@ class Twig_Node implements Twig_NodeInterface
194
 
195
  public function setNode($name, $node = null)
196
  {
197
- if (!$node instanceof Twig_NodeInterface) {
198
- @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
199
- }
200
 
201
  $this->nodes[$name] = $node;
202
  }
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
19
  {
20
  protected $nodes;
21
  protected $attributes;
38
  public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
39
  {
40
  foreach ($nodes as $name => $node) {
41
+ // if (!$node instanceof Twig_SupTwg_NodeInterface) {
42
+ // @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
43
+ // }
44
  }
45
  $this->nodes = $nodes;
46
  $this->attributes = $attributes;
111
  return $asDom ? $dom : $dom->saveXML();
112
  }
113
 
114
+ public function compile(Twig_SupTwg_Compiler $compiler)
115
  {
116
  foreach ($this->nodes as $node) {
117
  $node->compile($compiler);
181
  }
182
 
183
  /**
184
+ * @return Twig_SupTwg_Node
185
  */
186
  public function getNode($name)
187
  {
194
 
195
  public function setNode($name, $node = null)
196
  {
197
+ // if (!$node instanceof Twig_SupTwg_NodeInterface) {
198
+ // @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
199
+ // }
200
 
201
  $this->nodes[$name] = $node;
202
  }
vendor/Twig/Node/AutoEscape.php CHANGED
@@ -20,14 +20,14 @@
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
- class Twig_Node_AutoEscape extends Twig_Node
24
  {
25
- public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape')
26
  {
27
  parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
28
  }
29
 
30
- public function compile(Twig_Compiler $compiler)
31
  {
32
  $compiler->subcompile($this->getNode('body'));
33
  }
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
+ class Twig_SupTwg_Node_AutoEscape extends Twig_SupTwg_Node
24
  {
25
+ public function __construct($value, Twig_SupTwg_NodeInterface $body, $lineno, $tag = 'autoescape')
26
  {
27
  parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
28
  }
29
 
30
+ public function compile(Twig_SupTwg_Compiler $compiler)
31
  {
32
  $compiler->subcompile($this->getNode('body'));
33
  }
vendor/Twig/Node/Block.php CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Block extends Twig_Node
19
  {
20
- public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null)
21
  {
22
  parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Block extends Twig_SupTwg_Node
19
  {
20
+ public function __construct($name, Twig_SupTwg_NodeInterface $body, $lineno, $tag = null)
21
  {
22
  parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
vendor/Twig/Node/BlockReference.php CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface
19
  {
20
  public function __construct($name, $lineno, $tag = null)
21
  {
22
  parent::__construct(array(), array('name' => $name), $lineno, $tag);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_BlockReference extends Twig_SupTwg_Node implements Twig_SupTwg_NodeOutputInterface
19
  {
20
  public function __construct($name, $lineno, $tag = null)
21
  {
22
  parent::__construct(array(), array('name' => $name), $lineno, $tag);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
vendor/Twig/Node/Body.php CHANGED
@@ -14,6 +14,6 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Body extends Twig_Node
18
  {
19
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Body extends Twig_SupTwg_Node
18
  {
19
  }
vendor/Twig/Node/CheckSecurity.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @author Fabien Potencier <fabien@symfony.com>
14
  */
15
- class Twig_Node_CheckSecurity extends Twig_Node
16
  {
17
  protected $usedFilters;
18
  protected $usedTags;
@@ -27,12 +27,12 @@ class Twig_Node_CheckSecurity extends Twig_Node
27
  parent::__construct();
28
  }
29
 
30
- public function compile(Twig_Compiler $compiler)
31
  {
32
  $tags = $filters = $functions = array();
33
  foreach (array('tags', 'filters', 'functions') as $type) {
34
  foreach ($this->{'used'.ucfirst($type)} as $name => $node) {
35
- if ($node instanceof Twig_Node) {
36
  ${$type}[$name] = $node->getTemplateLine();
37
  } else {
38
  ${$type}[$node] = null;
@@ -46,7 +46,7 @@ class Twig_Node_CheckSecurity extends Twig_Node
46
  ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n")
47
  ->write("try {\n")
48
  ->indent()
49
- ->write("\$this->env->getExtension('Twig_Extension_Sandbox')->checkSecurity(\n")
50
  ->indent()
51
  ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n")
52
  ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n")
@@ -54,18 +54,18 @@ class Twig_Node_CheckSecurity extends Twig_Node
54
  ->outdent()
55
  ->write(");\n")
56
  ->outdent()
57
- ->write("} catch (Twig_Sandbox_SecurityError \$e) {\n")
58
  ->indent()
59
  ->write("\$e->setSourceContext(\$this->getSourceContext());\n\n")
60
- ->write("if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")
61
  ->indent()
62
  ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")
63
  ->outdent()
64
- ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")
65
  ->indent()
66
  ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")
67
  ->outdent()
68
- ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")
69
  ->indent()
70
  ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")
71
  ->outdent()
12
  /**
13
  * @author Fabien Potencier <fabien@symfony.com>
14
  */
15
+ class Twig_SupTwg_Node_CheckSecurity extends Twig_SupTwg_Node
16
  {
17
  protected $usedFilters;
18
  protected $usedTags;
27
  parent::__construct();
28
  }
29
 
30
+ public function compile(Twig_SupTwg_Compiler $compiler)
31
  {
32
  $tags = $filters = $functions = array();
33
  foreach (array('tags', 'filters', 'functions') as $type) {
34
  foreach ($this->{'used'.ucfirst($type)} as $name => $node) {
35
+ if ($node instanceof Twig_SupTwg_Node) {
36
  ${$type}[$name] = $node->getTemplateLine();
37
  } else {
38
  ${$type}[$node] = null;
46
  ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n")
47
  ->write("try {\n")
48
  ->indent()
49
+ ->write("\$this->env->getExtension('Twig_SupTwg_Extension_Sandbox')->checkSecurity(\n")
50
  ->indent()
51
  ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n")
52
  ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n")
54
  ->outdent()
55
  ->write(");\n")
56
  ->outdent()
57
+ ->write("} catch (Twig_SupTwg_Sandbox_SecurityError \$e) {\n")
58
  ->indent()
59
  ->write("\$e->setSourceContext(\$this->getSourceContext());\n\n")
60
+ ->write("if (\$e instanceof Twig_SupTwg_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")
61
  ->indent()
62
  ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")
63
  ->outdent()
64
+ ->write("} elseif (\$e instanceof Twig_SupTwg_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")
65
  ->indent()
66
  ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")
67
  ->outdent()
68
+ ->write("} elseif (\$e instanceof Twig_SupTwg_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")
69
  ->indent()
70
  ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")
71
  ->outdent()
vendor/Twig/Node/Do.php CHANGED
@@ -14,14 +14,14 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Do extends Twig_Node
18
  {
19
- public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Do extends Twig_SupTwg_Node
18
  {
19
+ public function __construct(Twig_SupTwg_Node_Expression $expr, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
vendor/Twig/Node/Embed.php CHANGED
@@ -14,12 +14,12 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Embed extends Twig_Node_Include
18
  {
19
  // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module)
20
- public function __construct($name, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
21
  {
22
- parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag);
23
 
24
  $this->setAttribute('name', $name);
25
  // to be removed in 2.0, used name instead
@@ -27,7 +27,7 @@ class Twig_Node_Embed extends Twig_Node_Include
27
  $this->setAttribute('index', $index);
28
  }
29
 
30
- protected function addGetTemplate(Twig_Compiler $compiler)
31
  {
32
  $compiler
33
  ->write('$this->loadTemplate(')
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Embed extends Twig_SupTwg_Node_Include
18
  {
19
  // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module)
20
+ public function __construct($name, $index, Twig_SupTwg_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
21
  {
22
+ parent::__construct(new Twig_SupTwg_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag);
23
 
24
  $this->setAttribute('name', $name);
25
  // to be removed in 2.0, used name instead
27
  $this->setAttribute('index', $index);
28
  }
29
 
30
+ protected function addGetTemplate(Twig_SupTwg_Compiler $compiler)
31
  {
32
  $compiler
33
  ->write('$this->loadTemplate(')
vendor/Twig/Node/Expression.php CHANGED
@@ -15,6 +15,6 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- abstract class Twig_Node_Expression extends Twig_Node
19
  {
20
  }
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ abstract class Twig_SupTwg_Node_Expression extends Twig_SupTwg_Node
19
  {
20
  }
vendor/Twig/Node/Expression/Array.php CHANGED
@@ -8,7 +8,7 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Array extends Twig_Node_Expression
12
  {
13
  protected $index;
14
 
@@ -18,7 +18,7 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression
18
 
19
  $this->index = -1;
20
  foreach ($this->getKeyValuePairs() as $pair) {
21
- if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) {
22
  $this->index = $pair['key']->getAttribute('value');
23
  }
24
  }
@@ -38,7 +38,7 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression
38
  return $pairs;
39
  }
40
 
41
- public function hasElement(Twig_Node_Expression $key)
42
  {
43
  foreach ($this->getKeyValuePairs() as $pair) {
44
  // we compare the string representation of the keys
@@ -51,16 +51,16 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression
51
  return false;
52
  }
53
 
54
- public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null)
55
  {
56
  if (null === $key) {
57
- $key = new Twig_Node_Expression_Constant(++$this->index, $value->getTemplateLine());
58
  }
59
 
60
  array_push($this->nodes, $key, $value);
61
  }
62
 
63
- public function compile(Twig_Compiler $compiler)
64
  {
65
  $compiler->raw('array(');
66
  $first = true;
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Array extends Twig_SupTwg_Node_Expression
12
  {
13
  protected $index;
14
 
18
 
19
  $this->index = -1;
20
  foreach ($this->getKeyValuePairs() as $pair) {
21
+ if ($pair['key'] instanceof Twig_SupTwg_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) {
22
  $this->index = $pair['key']->getAttribute('value');
23
  }
24
  }
38
  return $pairs;
39
  }
40
 
41
+ public function hasElement(Twig_SupTwg_Node_Expression $key)
42
  {
43
  foreach ($this->getKeyValuePairs() as $pair) {
44
  // we compare the string representation of the keys
51
  return false;
52
  }
53
 
54
+ public function addElement(Twig_SupTwg_Node_Expression $value, Twig_SupTwg_Node_Expression $key = null)
55
  {
56
  if (null === $key) {
57
+ $key = new Twig_SupTwg_Node_Expression_Constant(++$this->index, $value->getTemplateLine());
58
  }
59
 
60
  array_push($this->nodes, $key, $value);
61
  }
62
 
63
+ public function compile(Twig_SupTwg_Compiler $compiler)
64
  {
65
  $compiler->raw('array(');
66
  $first = true;
vendor/Twig/Node/Expression/AssignName.php CHANGED
@@ -10,9 +10,9 @@
10
  * file that was distributed with this source code.
11
  */
12
 
13
- class Twig_Node_Expression_AssignName extends Twig_Node_Expression_Name
14
  {
15
- public function compile(Twig_Compiler $compiler)
16
  {
17
  $compiler
18
  ->raw('$context[')
10
  * file that was distributed with this source code.
11
  */
12
 
13
+ class Twig_SupTwg_Node_Expression_AssignName extends Twig_SupTwg_Node_Expression_Name
14
  {
15
+ public function compile(Twig_SupTwg_Compiler $compiler)
16
  {
17
  $compiler
18
  ->raw('$context[')
vendor/Twig/Node/Expression/Binary.php CHANGED
@@ -9,14 +9,14 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- abstract class Twig_Node_Expression_Binary extends Twig_Node_Expression
13
  {
14
- public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
15
  {
16
  parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('(')
@@ -31,5 +31,5 @@ abstract class Twig_Node_Expression_Binary extends Twig_Node_Expression
31
  ;
32
  }
33
 
34
- abstract public function operator(Twig_Compiler $compiler);
35
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ abstract class Twig_SupTwg_Node_Expression_Binary extends Twig_SupTwg_Node_Expression
13
  {
14
+ public function __construct(Twig_SupTwg_NodeInterface $left, Twig_SupTwg_NodeInterface $right, $lineno)
15
  {
16
  parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('(')
31
  ;
32
  }
33
 
34
+ abstract public function operator(Twig_SupTwg_Compiler $compiler);
35
  }
vendor/Twig/Node/Expression/Binary/Add.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Add extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('+');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Add extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('+');
17
  }
vendor/Twig/Node/Expression/Binary/And.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_And extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('&&');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_And extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('&&');
17
  }
vendor/Twig/Node/Expression/Binary/BitwiseAnd.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_BitwiseAnd extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('&');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_BitwiseAnd extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('&');
17
  }
vendor/Twig/Node/Expression/Binary/BitwiseOr.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_BitwiseOr extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('|');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_BitwiseOr extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('|');
17
  }
vendor/Twig/Node/Expression/Binary/BitwiseXor.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_BitwiseXor extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('^');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_BitwiseXor extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('^');
17
  }
vendor/Twig/Node/Expression/Binary/Concat.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Concat extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('.');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Concat extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('.');
17
  }
vendor/Twig/Node/Expression/Binary/Div.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Div extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('/');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Div extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('/');
17
  }
vendor/Twig/Node/Expression/Binary/EndsWith.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $left = $compiler->getVarName();
16
  $right = $compiler->getVarName();
@@ -23,7 +23,7 @@ class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary
23
  ;
24
  }
25
 
26
- public function operator(Twig_Compiler $compiler)
27
  {
28
  return $compiler->raw('');
29
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_EndsWith extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $left = $compiler->getVarName();
16
  $right = $compiler->getVarName();
23
  ;
24
  }
25
 
26
+ public function operator(Twig_SupTwg_Compiler $compiler)
27
  {
28
  return $compiler->raw('');
29
  }
vendor/Twig/Node/Expression/Binary/Equal.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Equal extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('==');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Equal extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('==');
16
  }
vendor/Twig/Node/Expression/Binary/FloorDiv.php CHANGED
@@ -8,16 +8,16 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $compiler->raw('(int) floor(');
16
  parent::compile($compiler);
17
  $compiler->raw(')');
18
  }
19
 
20
- public function operator(Twig_Compiler $compiler)
21
  {
22
  return $compiler->raw('/');
23
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_FloorDiv extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $compiler->raw('(int) floor(');
16
  parent::compile($compiler);
17
  $compiler->raw(')');
18
  }
19
 
20
+ public function operator(Twig_SupTwg_Compiler $compiler)
21
  {
22
  return $compiler->raw('/');
23
  }
vendor/Twig/Node/Expression/Binary/Greater.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Greater extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('>');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Greater extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('>');
16
  }
vendor/Twig/Node/Expression/Binary/GreaterEqual.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_GreaterEqual extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('>=');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_GreaterEqual extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('>=');
16
  }
vendor/Twig/Node/Expression/Binary/In.php CHANGED
@@ -8,12 +8,12 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_In extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $compiler
16
- ->raw('twig_in_filter(')
17
  ->subcompile($this->getNode('left'))
18
  ->raw(', ')
19
  ->subcompile($this->getNode('right'))
@@ -21,7 +21,7 @@ class Twig_Node_Expression_Binary_In extends Twig_Node_Expression_Binary
21
  ;
22
  }
23
 
24
- public function operator(Twig_Compiler $compiler)
25
  {
26
  return $compiler->raw('in');
27
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_In extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $compiler
16
+ ->raw('Twig_SupTwg_in_filter(')
17
  ->subcompile($this->getNode('left'))
18
  ->raw(', ')
19
  ->subcompile($this->getNode('right'))
21
  ;
22
  }
23
 
24
+ public function operator(Twig_SupTwg_Compiler $compiler)
25
  {
26
  return $compiler->raw('in');
27
  }
vendor/Twig/Node/Expression/Binary/Less.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Less extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('<');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Less extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('<');
16
  }
vendor/Twig/Node/Expression/Binary/LessEqual.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_LessEqual extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('<=');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_LessEqual extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('<=');
16
  }
vendor/Twig/Node/Expression/Binary/Matches.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Matches extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $compiler
16
  ->raw('preg_match(')
@@ -21,7 +21,7 @@ class Twig_Node_Expression_Binary_Matches extends Twig_Node_Expression_Binary
21
  ;
22
  }
23
 
24
- public function operator(Twig_Compiler $compiler)
25
  {
26
  return $compiler->raw('');
27
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Matches extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $compiler
16
  ->raw('preg_match(')
21
  ;
22
  }
23
 
24
+ public function operator(Twig_SupTwg_Compiler $compiler)
25
  {
26
  return $compiler->raw('');
27
  }
vendor/Twig/Node/Expression/Binary/Mod.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Mod extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('%');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Mod extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('%');
17
  }
vendor/Twig/Node/Expression/Binary/Mul.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Mul extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('*');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Mul extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('*');
17
  }
vendor/Twig/Node/Expression/Binary/NotEqual.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_NotEqual extends Twig_Node_Expression_Binary
12
  {
13
- public function operator(Twig_Compiler $compiler)
14
  {
15
  return $compiler->raw('!=');
16
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_NotEqual extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function operator(Twig_SupTwg_Compiler $compiler)
14
  {
15
  return $compiler->raw('!=');
16
  }
vendor/Twig/Node/Expression/Binary/NotIn.php CHANGED
@@ -8,12 +8,12 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_NotIn extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $compiler
16
- ->raw('!twig_in_filter(')
17
  ->subcompile($this->getNode('left'))
18
  ->raw(', ')
19
  ->subcompile($this->getNode('right'))
@@ -21,7 +21,7 @@ class Twig_Node_Expression_Binary_NotIn extends Twig_Node_Expression_Binary
21
  ;
22
  }
23
 
24
- public function operator(Twig_Compiler $compiler)
25
  {
26
  return $compiler->raw('not in');
27
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_NotIn extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $compiler
16
+ ->raw('!Twig_SupTwg_in_filter(')
17
  ->subcompile($this->getNode('left'))
18
  ->raw(', ')
19
  ->subcompile($this->getNode('right'))
21
  ;
22
  }
23
 
24
+ public function operator(Twig_SupTwg_Compiler $compiler)
25
  {
26
  return $compiler->raw('not in');
27
  }
vendor/Twig/Node/Expression/Binary/Or.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Or extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('||');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Or extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('||');
17
  }
vendor/Twig/Node/Expression/Binary/Power.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  if (PHP_VERSION_ID >= 50600) {
16
  return parent::compile($compiler);
@@ -25,7 +25,7 @@ class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
25
  ;
26
  }
27
 
28
- public function operator(Twig_Compiler $compiler)
29
  {
30
  return $compiler->raw('**');
31
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Power extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  if (PHP_VERSION_ID >= 50600) {
16
  return parent::compile($compiler);
25
  ;
26
  }
27
 
28
+ public function operator(Twig_SupTwg_Compiler $compiler)
29
  {
30
  return $compiler->raw('**');
31
  }
vendor/Twig/Node/Expression/Binary/Range.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_Range extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $compiler
16
  ->raw('range(')
@@ -21,7 +21,7 @@ class Twig_Node_Expression_Binary_Range extends Twig_Node_Expression_Binary
21
  ;
22
  }
23
 
24
- public function operator(Twig_Compiler $compiler)
25
  {
26
  return $compiler->raw('..');
27
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_Range extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $compiler
16
  ->raw('range(')
21
  ;
22
  }
23
 
24
+ public function operator(Twig_SupTwg_Compiler $compiler)
25
  {
26
  return $compiler->raw('..');
27
  }
vendor/Twig/Node/Expression/Binary/StartsWith.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Binary_StartsWith extends Twig_Node_Expression_Binary
12
  {
13
- public function compile(Twig_Compiler $compiler)
14
  {
15
  $left = $compiler->getVarName();
16
  $right = $compiler->getVarName();
@@ -23,7 +23,7 @@ class Twig_Node_Expression_Binary_StartsWith extends Twig_Node_Expression_Binary
23
  ;
24
  }
25
 
26
- public function operator(Twig_Compiler $compiler)
27
  {
28
  return $compiler->raw('');
29
  }
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Binary_StartsWith extends Twig_SupTwg_Node_Expression_Binary
12
  {
13
+ public function compile(Twig_SupTwg_Compiler $compiler)
14
  {
15
  $left = $compiler->getVarName();
16
  $right = $compiler->getVarName();
23
  ;
24
  }
25
 
26
+ public function operator(Twig_SupTwg_Compiler $compiler)
27
  {
28
  return $compiler->raw('');
29
  }
vendor/Twig/Node/Expression/Binary/Sub.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Binary_Sub extends Twig_Node_Expression_Binary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  return $compiler->raw('-');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Binary_Sub extends Twig_SupTwg_Node_Expression_Binary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  return $compiler->raw('-');
17
  }
vendor/Twig/Node/Expression/BlockReference.php CHANGED
@@ -15,12 +15,12 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
19
  {
20
  /**
21
- * @param Twig_Node|null $template
22
  */
23
- public function __construct(Twig_NodeInterface $name, $template = null, $lineno, $tag = null)
24
  {
25
  if (is_bool($template)) {
26
  @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);
@@ -36,7 +36,7 @@ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
36
  parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
37
  }
38
 
39
- public function compile(Twig_Compiler $compiler)
40
  {
41
  if ($this->getAttribute('is_defined_test')) {
42
  $this->compileTemplateCall($compiler, 'hasBlock');
@@ -53,7 +53,7 @@ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
53
  }
54
  }
55
 
56
- private function compileTemplateCall(Twig_Compiler $compiler, $method)
57
  {
58
  if (!$this->hasNode('template')) {
59
  $compiler->write('$this');
@@ -75,7 +75,7 @@ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
75
  return $compiler;
76
  }
77
 
78
- private function compileBlockArguments(Twig_Compiler $compiler)
79
  {
80
  $compiler
81
  ->raw('(')
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Expression_BlockReference extends Twig_SupTwg_Node_Expression
19
  {
20
  /**
21
+ * @param Twig_SupTwg_Node|null $template
22
  */
23
+ public function __construct(Twig_SupTwg_NodeInterface $name, $template = null, $lineno, $tag = null)
24
  {
25
  if (is_bool($template)) {
26
  @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);
36
  parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
37
  }
38
 
39
+ public function compile(Twig_SupTwg_Compiler $compiler)
40
  {
41
  if ($this->getAttribute('is_defined_test')) {
42
  $this->compileTemplateCall($compiler, 'hasBlock');
53
  }
54
  }
55
 
56
+ private function compileTemplateCall(Twig_SupTwg_Compiler $compiler, $method)
57
  {
58
  if (!$this->hasNode('template')) {
59
  $compiler->write('$this');
75
  return $compiler;
76
  }
77
 
78
+ private function compileBlockArguments(Twig_SupTwg_Compiler $compiler)
79
  {
80
  $compiler
81
  ->raw('(')
vendor/Twig/Node/Expression/Call.php CHANGED
@@ -8,11 +8,11 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
12
  {
13
  private $reflector;
14
 
15
- protected function compileCallable(Twig_Compiler $compiler)
16
  {
17
  $closingParenthesis = false;
18
  if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) {
@@ -26,7 +26,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
26
  } else {
27
  $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
28
  }
29
- } elseif ($r instanceof ReflectionMethod && $callable[0] instanceof Twig_ExtensionInterface) {
30
  $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', get_class($callable[0]), $callable[1]));
31
  } else {
32
  $type = ucfirst($this->getAttribute('type'));
@@ -45,7 +45,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
45
  }
46
  }
47
 
48
- protected function compileArguments(Twig_Compiler $compiler)
49
  {
50
  $compiler->raw('(');
51
 
@@ -111,7 +111,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
111
  $named = true;
112
  $name = $this->normalizeName($name);
113
  } elseif ($named) {
114
- throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName));
115
  }
116
 
117
  $parameters[$name] = $node;
@@ -143,11 +143,11 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
143
 
144
  if (array_key_exists($name, $parameters)) {
145
  if (array_key_exists($pos, $parameters)) {
146
- throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
147
  }
148
 
149
  if (count($missingArguments)) {
150
- throw new Twig_Error_Syntax(sprintf(
151
  'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
152
  $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
153
  );
@@ -164,7 +164,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
164
  $optionalArguments = array();
165
  ++$pos;
166
  } elseif ($callableParameter->isDefaultValueAvailable()) {
167
- $optionalArguments[] = new Twig_Node_Expression_Constant($callableParameter->getDefaultValue(), -1);
168
  } elseif ($callableParameter->isOptional()) {
169
  if (empty($parameters)) {
170
  break;
@@ -172,17 +172,17 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
172
  $missingArguments[] = $name;
173
  }
174
  } else {
175
- throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName));
176
  }
177
  }
178
 
179
  if ($isVariadic) {
180
- $arbitraryArguments = new Twig_Node_Expression_Array(array(), -1);
181
  foreach ($parameters as $key => $value) {
182
  if (is_int($key)) {
183
  $arbitraryArguments->addElement($value);
184
  } else {
185
- $arbitraryArguments->addElement($value, new Twig_Node_Expression_Constant($key, -1));
186
  }
187
  unset($parameters[$key]);
188
  }
@@ -196,13 +196,13 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
196
  if (!empty($parameters)) {
197
  $unknownParameter = null;
198
  foreach ($parameters as $parameter) {
199
- if ($parameter instanceof Twig_Node) {
200
  $unknownParameter = $parameter;
201
  break;
202
  }
203
  }
204
 
205
- throw new Twig_Error_Syntax(sprintf(
206
  'Unknown argument%s "%s" for %s "%s(%s)".',
207
  count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names)
208
  ), $unknownParameter ? $unknownParameter->getTemplateLine() : -1);
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Expression
12
  {
13
  private $reflector;
14
 
15
+ protected function compileCallable(Twig_SupTwg_Compiler $compiler)
16
  {
17
  $closingParenthesis = false;
18
  if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) {
26
  } else {
27
  $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
28
  }
29
+ } elseif ($r instanceof ReflectionMethod && $callable[0] instanceof Twig_SupTwg_ExtensionInterface) {
30
  $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', get_class($callable[0]), $callable[1]));
31
  } else {
32
  $type = ucfirst($this->getAttribute('type'));
45
  }
46
  }
47
 
48
+ protected function compileArguments(Twig_SupTwg_Compiler $compiler)
49
  {
50
  $compiler->raw('(');
51
 
111
  $named = true;
112
  $name = $this->normalizeName($name);
113
  } elseif ($named) {
114
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName));
115
  }
116
 
117
  $parameters[$name] = $node;
143
 
144
  if (array_key_exists($name, $parameters)) {
145
  if (array_key_exists($pos, $parameters)) {
146
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
147
  }
148
 
149
  if (count($missingArguments)) {
150
+ throw new Twig_SupTwg_Error_Syntax(sprintf(
151
  'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
152
  $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
153
  );
164
  $optionalArguments = array();
165
  ++$pos;
166
  } elseif ($callableParameter->isDefaultValueAvailable()) {
167
+ $optionalArguments[] = new Twig_SupTwg_Node_Expression_Constant($callableParameter->getDefaultValue(), -1);
168
  } elseif ($callableParameter->isOptional()) {
169
  if (empty($parameters)) {
170
  break;
172
  $missingArguments[] = $name;
173
  }
174
  } else {
175
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName));
176
  }
177
  }
178
 
179
  if ($isVariadic) {
180
+ $arbitraryArguments = new Twig_SupTwg_Node_Expression_Array(array(), -1);
181
  foreach ($parameters as $key => $value) {
182
  if (is_int($key)) {
183
  $arbitraryArguments->addElement($value);
184
  } else {
185
+ $arbitraryArguments->addElement($value, new Twig_SupTwg_Node_Expression_Constant($key, -1));
186
  }
187
  unset($parameters[$key]);
188
  }
196
  if (!empty($parameters)) {
197
  $unknownParameter = null;
198
  foreach ($parameters as $parameter) {
199
+ if ($parameter instanceof Twig_SupTwg_Node) {
200
  $unknownParameter = $parameter;
201
  break;
202
  }
203
  }
204
 
205
+ throw new Twig_SupTwg_Error_Syntax(sprintf(
206
  'Unknown argument%s "%s" for %s "%s(%s)".',
207
  count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names)
208
  ), $unknownParameter ? $unknownParameter->getTemplateLine() : -1);
vendor/Twig/Node/Expression/Conditional.php CHANGED
@@ -9,14 +9,14 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Conditional extends Twig_Node_Expression
13
  {
14
- public function __construct(Twig_Node_Expression $expr1, Twig_Node_Expression $expr2, Twig_Node_Expression $expr3, $lineno)
15
  {
16
  parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('((')
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Conditional extends Twig_SupTwg_Node_Expression
13
  {
14
+ public function __construct(Twig_SupTwg_Node_Expression $expr1, Twig_SupTwg_Node_Expression $expr2, Twig_SupTwg_Node_Expression $expr3, $lineno)
15
  {
16
  parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('((')
vendor/Twig/Node/Expression/Constant.php CHANGED
@@ -9,14 +9,14 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Constant extends Twig_Node_Expression
13
  {
14
  public function __construct($value, $lineno)
15
  {
16
  parent::__construct(array(), array('value' => $value), $lineno);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $compiler->repr($this->getAttribute('value'));
22
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Constant extends Twig_SupTwg_Node_Expression
13
  {
14
  public function __construct($value, $lineno)
15
  {
16
  parent::__construct(array(), array('value' => $value), $lineno);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $compiler->repr($this->getAttribute('value'));
22
  }
vendor/Twig/Node/Expression/ExtensionReference.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Node_Expression_ExtensionReference class is deprecated since version 1.23 and will be removed in 2.0.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents an extension call node.
@@ -18,14 +18,14 @@
18
  *
19
  * @deprecated since 1.23 and will be removed in 2.0.
20
  */
21
- class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression
22
  {
23
  public function __construct($name, $lineno, $tag = null)
24
  {
25
  parent::__construct(array(), array('name' => $name), $lineno, $tag);
26
  }
27
 
28
- public function compile(Twig_Compiler $compiler)
29
  {
30
  $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name')));
31
  }
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Node_Expression_ExtensionReference class is deprecated since version 1.23 and will be removed in 2.0.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents an extension call node.
18
  *
19
  * @deprecated since 1.23 and will be removed in 2.0.
20
  */
21
+ class Twig_SupTwg_Node_Expression_ExtensionReference extends Twig_SupTwg_Node_Expression
22
  {
23
  public function __construct($name, $lineno, $tag = null)
24
  {
25
  parent::__construct(array(), array('name' => $name), $lineno, $tag);
26
  }
27
 
28
+ public function compile(Twig_SupTwg_Compiler $compiler)
29
  {
30
  $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name')));
31
  }
vendor/Twig/Node/Expression/Filter.php CHANGED
@@ -9,14 +9,14 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Filter extends Twig_Node_Expression_Call
13
  {
14
- public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
15
  {
16
  parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $name = $this->getNode('filter')->getAttribute('value');
22
  $filter = $compiler->getEnvironment()->getFilter($name);
@@ -27,10 +27,10 @@ class Twig_Node_Expression_Filter extends Twig_Node_Expression_Call
27
  $this->setAttribute('needs_environment', $filter->needsEnvironment());
28
  $this->setAttribute('needs_context', $filter->needsContext());
29
  $this->setAttribute('arguments', $filter->getArguments());
30
- if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) {
31
  $this->setAttribute('callable', $filter->getCallable());
32
  }
33
- if ($filter instanceof Twig_SimpleFilter) {
34
  $this->setAttribute('is_variadic', $filter->isVariadic());
35
  }
36
 
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Filter extends Twig_SupTwg_Node_Expression_Call
13
  {
14
+ public function __construct(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Node_Expression_Constant $filterName, Twig_SupTwg_NodeInterface $arguments, $lineno, $tag = null)
15
  {
16
  parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $name = $this->getNode('filter')->getAttribute('value');
22
  $filter = $compiler->getEnvironment()->getFilter($name);
27
  $this->setAttribute('needs_environment', $filter->needsEnvironment());
28
  $this->setAttribute('needs_context', $filter->needsContext());
29
  $this->setAttribute('arguments', $filter->getArguments());
30
+ if ($filter instanceof Twig_SupTwg_FilterCallableInterface || $filter instanceof Twig_SupTwg_SimpleFilter) {
31
  $this->setAttribute('callable', $filter->getCallable());
32
  }
33
+ if ($filter instanceof Twig_SupTwg_SimpleFilter) {
34
  $this->setAttribute('is_variadic', $filter->isVariadic());
35
  }
36
 
vendor/Twig/Node/Expression/Filter/Default.php CHANGED
@@ -18,17 +18,17 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter
22
  {
23
- public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
24
  {
25
- $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine());
26
 
27
- if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) {
28
- $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getTemplateLine());
29
- $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getTemplateLine());
30
 
31
- $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getTemplateLine());
32
  } else {
33
  $node = $default;
34
  }
@@ -36,7 +36,7 @@ class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter
36
  parent::__construct($node, $filterName, $arguments, $lineno, $tag);
37
  }
38
 
39
- public function compile(Twig_Compiler $compiler)
40
  {
41
  $compiler->subcompile($this->getNode('node'));
42
  }
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_Node_Expression_Filter_Default extends Twig_SupTwg_Node_Expression_Filter
22
  {
23
+ public function __construct(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Node_Expression_Constant $filterName, Twig_SupTwg_NodeInterface $arguments, $lineno, $tag = null)
24
  {
25
+ $default = new Twig_SupTwg_Node_Expression_Filter($node, new Twig_SupTwg_Node_Expression_Constant('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine());
26
 
27
+ if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_SupTwg_Node_Expression_Name || $node instanceof Twig_SupTwg_Node_Expression_GetAttr)) {
28
+ $test = new Twig_SupTwg_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_SupTwg_Node(), $node->getTemplateLine());
29
+ $false = count($arguments) ? $arguments->getNode(0) : new Twig_SupTwg_Node_Expression_Constant('', $node->getTemplateLine());
30
 
31
+ $node = new Twig_SupTwg_Node_Expression_Conditional($test, $default, $false, $node->getTemplateLine());
32
  } else {
33
  $node = $default;
34
  }
36
  parent::__construct($node, $filterName, $arguments, $lineno, $tag);
37
  }
38
 
39
+ public function compile(Twig_SupTwg_Compiler $compiler)
40
  {
41
  $compiler->subcompile($this->getNode('node'));
42
  }
vendor/Twig/Node/Expression/Function.php CHANGED
@@ -8,14 +8,14 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
12
  {
13
- public function __construct($name, Twig_NodeInterface $arguments, $lineno)
14
  {
15
  parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno);
16
  }
17
 
18
- public function compile(Twig_Compiler $compiler)
19
  {
20
  $name = $this->getAttribute('name');
21
  $function = $compiler->getEnvironment()->getFunction($name);
@@ -26,15 +26,15 @@ class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
26
  $this->setAttribute('needs_environment', $function->needsEnvironment());
27
  $this->setAttribute('needs_context', $function->needsContext());
28
  $this->setAttribute('arguments', $function->getArguments());
29
- if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
30
  $callable = $function->getCallable();
31
  if ('constant' === $name && $this->getAttribute('is_defined_test')) {
32
- $callable = 'twig_constant_is_defined';
33
  }
34
 
35
  $this->setAttribute('callable', $callable);
36
  }
37
- if ($function instanceof Twig_SimpleFunction) {
38
  $this->setAttribute('is_variadic', $function->isVariadic());
39
  }
40
 
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Function extends Twig_SupTwg_Node_Expression_Call
12
  {
13
+ public function __construct($name, Twig_SupTwg_NodeInterface $arguments, $lineno)
14
  {
15
  parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno);
16
  }
17
 
18
+ public function compile(Twig_SupTwg_Compiler $compiler)
19
  {
20
  $name = $this->getAttribute('name');
21
  $function = $compiler->getEnvironment()->getFunction($name);
26
  $this->setAttribute('needs_environment', $function->needsEnvironment());
27
  $this->setAttribute('needs_context', $function->needsContext());
28
  $this->setAttribute('arguments', $function->getArguments());
29
+ if ($function instanceof Twig_SupTwg_FunctionCallableInterface || $function instanceof Twig_SupTwg_SimpleFunction) {
30
  $callable = $function->getCallable();
31
  if ('constant' === $name && $this->getAttribute('is_defined_test')) {
32
+ $callable = 'Twig_SupTwg_constant_is_defined';
33
  }
34
 
35
  $this->setAttribute('callable', $callable);
36
  }
37
+ if ($function instanceof Twig_SupTwg_SimpleFunction) {
38
  $this->setAttribute('is_variadic', $function->isVariadic());
39
  }
40
 
vendor/Twig/Node/Expression/GetAttr.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
13
  {
14
- public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
15
  {
16
  $nodes = array('node' => $node, 'attribute' => $attribute);
17
  if (null !== $arguments) {
@@ -21,14 +21,14 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
21
  parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  if ($this->getAttribute('disable_c_ext')) {
27
  @trigger_error(sprintf('Using the "disable_c_ext" attribute on %s is deprecated since version 1.30 and will be removed in 2.0.', __CLASS__), E_USER_DEPRECATED);
28
  }
29
 
30
- if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) {
31
- $compiler->raw('twig_template_get_attributes($this, ');
32
  } else {
33
  $compiler->raw('$this->getAttribute(');
34
  }
@@ -44,7 +44,7 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
44
  // only generate optional arguments when needed (to make generated code more readable)
45
  $needFourth = $this->getAttribute('ignore_strict_check');
46
  $needThird = $needFourth || $this->getAttribute('is_defined_test');
47
- $needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type');
48
  $needFirst = $needSecond || $this->hasNode('arguments');
49
 
50
  if ($needFirst) {
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_GetAttr extends Twig_SupTwg_Node_Expression
13
  {
14
+ public function __construct(Twig_SupTwg_Node_Expression $node, Twig_SupTwg_Node_Expression $attribute, Twig_SupTwg_Node_Expression $arguments = null, $type, $lineno)
15
  {
16
  $nodes = array('node' => $node, 'attribute' => $attribute);
17
  if (null !== $arguments) {
21
  parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  if ($this->getAttribute('disable_c_ext')) {
27
  @trigger_error(sprintf('Using the "disable_c_ext" attribute on %s is deprecated since version 1.30 and will be removed in 2.0.', __CLASS__), E_USER_DEPRECATED);
28
  }
29
 
30
+ if (function_exists('Twig_SupTwg_template_get_attributes') && !$this->getAttribute('disable_c_ext')) {
31
+ $compiler->raw('Twig_SupTwg_template_get_attributes($this, ');
32
  } else {
33
  $compiler->raw('$this->getAttribute(');
34
  }
44
  // only generate optional arguments when needed (to make generated code more readable)
45
  $needFourth = $this->getAttribute('ignore_strict_check');
46
  $needThird = $needFourth || $this->getAttribute('is_defined_test');
47
+ $needSecond = $needThird || Twig_SupTwg_Template::ANY_CALL !== $this->getAttribute('type');
48
  $needFirst = $needSecond || $this->hasNode('arguments');
49
 
50
  if ($needFirst) {
vendor/Twig/Node/Expression/MethodCall.php CHANGED
@@ -8,18 +8,18 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_MethodCall extends Twig_Node_Expression
12
  {
13
- public function __construct(Twig_Node_Expression $node, $method, Twig_Node_Expression_Array $arguments, $lineno)
14
  {
15
  parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno);
16
 
17
- if ($node instanceof Twig_Node_Expression_Name) {
18
  $node->setAttribute('always_defined', true);
19
  }
20
  }
21
 
22
- public function compile(Twig_Compiler $compiler)
23
  {
24
  $compiler
25
  ->subcompile($this->getNode('node'))
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_MethodCall extends Twig_SupTwg_Node_Expression
12
  {
13
+ public function __construct(Twig_SupTwg_Node_Expression $node, $method, Twig_SupTwg_Node_Expression_Array $arguments, $lineno)
14
  {
15
  parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno);
16
 
17
+ if ($node instanceof Twig_SupTwg_Node_Expression_Name) {
18
  $node->setAttribute('always_defined', true);
19
  }
20
  }
21
 
22
+ public function compile(Twig_SupTwg_Compiler $compiler)
23
  {
24
  $compiler
25
  ->subcompile($this->getNode('node'))
vendor/Twig/Node/Expression/Name.php CHANGED
@@ -9,7 +9,7 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Name extends Twig_Node_Expression
13
  {
14
  protected $specialVars = array(
15
  '_self' => '$this',
@@ -22,7 +22,7 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression
22
  parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $name = $this->getAttribute('name');
28
 
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Name extends Twig_SupTwg_Node_Expression
13
  {
14
  protected $specialVars = array(
15
  '_self' => '$this',
22
  parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $name = $this->getAttribute('name');
28
 
vendor/Twig/Node/Expression/NullCoalesce.php CHANGED
@@ -8,20 +8,20 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
12
  {
13
- public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
14
  {
15
- $test = new Twig_Node_Expression_Binary_And(
16
- new Twig_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_Node(), $left->getTemplateLine()),
17
- new Twig_Node_Expression_Unary_Not(new Twig_Node_Expression_Test_Null($left, 'null', new Twig_Node(), $left->getTemplateLine()), $left->getTemplateLine()),
18
  $left->getTemplateLine()
19
  );
20
 
21
  parent::__construct($test, $left, $right, $lineno);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  /*
27
  * This optimizes only one case. PHP 7 also supports more complex expressions
@@ -30,7 +30,7 @@ class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
30
  * cases might be implemented as an optimizer node visitor, but has not been done
31
  * as benefits are probably not worth the added complexity.
32
  */
33
- if (PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof Twig_Node_Expression_Name) {
34
  $this->getNode('expr2')->setAttribute('always_defined', true);
35
  $compiler
36
  ->raw('((')
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_NullCoalesce extends Twig_SupTwg_Node_Expression_Conditional
12
  {
13
+ public function __construct(Twig_SupTwg_NodeInterface $left, Twig_SupTwg_NodeInterface $right, $lineno)
14
  {
15
+ $test = new Twig_SupTwg_Node_Expression_Binary_And(
16
+ new Twig_SupTwg_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_SupTwg_Node(), $left->getTemplateLine()),
17
+ new Twig_SupTwg_Node_Expression_Unary_Not(new Twig_SupTwg_Node_Expression_Test_Null($left, 'null', new Twig_SupTwg_Node(), $left->getTemplateLine()), $left->getTemplateLine()),
18
  $left->getTemplateLine()
19
  );
20
 
21
  parent::__construct($test, $left, $right, $lineno);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  /*
27
  * This optimizes only one case. PHP 7 also supports more complex expressions
30
  * cases might be implemented as an optimizer node visitor, but has not been done
31
  * as benefits are probably not worth the added complexity.
32
  */
33
+ if (PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof Twig_SupTwg_Node_Expression_Name) {
34
  $this->getNode('expr2')->setAttribute('always_defined', true);
35
  $compiler
36
  ->raw('((')
vendor/Twig/Node/Expression/Parent.php CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Expression_Parent extends Twig_Node_Expression
19
  {
20
  public function __construct($name, $lineno, $tag = null)
21
  {
22
  parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  if ($this->getAttribute('output')) {
28
  $compiler
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Expression_Parent extends Twig_SupTwg_Node_Expression
19
  {
20
  public function __construct($name, $lineno, $tag = null)
21
  {
22
  parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  if ($this->getAttribute('output')) {
28
  $compiler
vendor/Twig/Node/Expression/TempName.php CHANGED
@@ -8,14 +8,14 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_TempName extends Twig_Node_Expression
12
  {
13
  public function __construct($name, $lineno)
14
  {
15
  parent::__construct(array(), array('name' => $name), $lineno);
16
  }
17
 
18
- public function compile(Twig_Compiler $compiler)
19
  {
20
  $compiler
21
  ->raw('$_')
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_TempName extends Twig_SupTwg_Node_Expression
12
  {
13
  public function __construct($name, $lineno)
14
  {
15
  parent::__construct(array(), array('name' => $name), $lineno);
16
  }
17
 
18
+ public function compile(Twig_SupTwg_Compiler $compiler)
19
  {
20
  $compiler
21
  ->raw('$_')
vendor/Twig/Node/Expression/Test.php CHANGED
@@ -8,9 +8,9 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
12
  {
13
- public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
14
  {
15
  $nodes = array('node' => $node);
16
  if (null !== $arguments) {
@@ -20,7 +20,7 @@ class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
20
  parent::__construct($nodes, array('name' => $name), $lineno);
21
  }
22
 
23
- public function compile(Twig_Compiler $compiler)
24
  {
25
  $name = $this->getAttribute('name');
26
  $test = $compiler->getEnvironment()->getTest($name);
@@ -28,10 +28,10 @@ class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
28
  $this->setAttribute('name', $name);
29
  $this->setAttribute('type', 'test');
30
  $this->setAttribute('thing', $test);
31
- if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) {
32
  $this->setAttribute('callable', $test->getCallable());
33
  }
34
- if ($test instanceof Twig_SimpleTest) {
35
  $this->setAttribute('is_variadic', $test->isVariadic());
36
  }
37
 
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ class Twig_SupTwg_Node_Expression_Test extends Twig_SupTwg_Node_Expression_Call
12
  {
13
+ public function __construct(Twig_SupTwg_NodeInterface $node, $name, Twig_SupTwg_NodeInterface $arguments = null, $lineno)
14
  {
15
  $nodes = array('node' => $node);
16
  if (null !== $arguments) {
20
  parent::__construct($nodes, array('name' => $name), $lineno);
21
  }
22
 
23
+ public function compile(Twig_SupTwg_Compiler $compiler)
24
  {
25
  $name = $this->getAttribute('name');
26
  $test = $compiler->getEnvironment()->getTest($name);
28
  $this->setAttribute('name', $name);
29
  $this->setAttribute('type', 'test');
30
  $this->setAttribute('thing', $test);
31
+ if ($test instanceof Twig_SupTwg_TestCallableInterface || $test instanceof Twig_SupTwg_SimpleTest) {
32
  $this->setAttribute('callable', $test->getCallable());
33
  }
34
+ if ($test instanceof Twig_SupTwg_SimpleTest) {
35
  $this->setAttribute('is_variadic', $test->isVariadic());
36
  }
37
 
vendor/Twig/Node/Expression/Test/Constant.php CHANGED
@@ -20,9 +20,9 @@
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
- class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
24
  {
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $compiler
28
  ->raw('(')
20
  *
21
  * @author Fabien Potencier <fabien@symfony.com>
22
  */
23
+ class Twig_SupTwg_Node_Expression_Test_Constant extends Twig_SupTwg_Node_Expression_Test
24
  {
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $compiler
28
  ->raw('(')
vendor/Twig/Node/Expression/Test/Defined.php CHANGED
@@ -21,38 +21,38 @@
21
  *
22
  * @author Fabien Potencier <fabien@symfony.com>
23
  */
24
- class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test
25
  {
26
- public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
27
  {
28
- if ($node instanceof Twig_Node_Expression_Name) {
29
  $node->setAttribute('is_defined_test', true);
30
- } elseif ($node instanceof Twig_Node_Expression_GetAttr) {
31
  $node->setAttribute('is_defined_test', true);
32
  $this->changeIgnoreStrictCheck($node);
33
- } elseif ($node instanceof Twig_Node_Expression_BlockReference) {
34
  $node->setAttribute('is_defined_test', true);
35
- } elseif ($node instanceof Twig_Node_Expression_Function && 'constant' === $node->getAttribute('name')) {
36
  $node->setAttribute('is_defined_test', true);
37
- } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) {
38
- $node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine());
39
  } else {
40
- throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getTemplateLine());
41
  }
42
 
43
  parent::__construct($node, $name, $arguments, $lineno);
44
  }
45
 
46
- protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node)
47
  {
48
  $node->setAttribute('ignore_strict_check', true);
49
 
50
- if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) {
51
  $this->changeIgnoreStrictCheck($node->getNode('node'));
52
  }
53
  }
54
 
55
- public function compile(Twig_Compiler $compiler)
56
  {
57
  $compiler->subcompile($this->getNode('node'));
58
  }
21
  *
22
  * @author Fabien Potencier <fabien@symfony.com>
23
  */
24
+ class Twig_SupTwg_Node_Expression_Test_Defined extends Twig_SupTwg_Node_Expression_Test
25
  {
26
+ public function __construct(Twig_SupTwg_NodeInterface $node, $name, Twig_SupTwg_NodeInterface $arguments = null, $lineno)
27
  {
28
+ if ($node instanceof Twig_SupTwg_Node_Expression_Name) {
29
  $node->setAttribute('is_defined_test', true);
30
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_GetAttr) {
31
  $node->setAttribute('is_defined_test', true);
32
  $this->changeIgnoreStrictCheck($node);
33
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_BlockReference) {
34
  $node->setAttribute('is_defined_test', true);
35
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Function && 'constant' === $node->getAttribute('name')) {
36
  $node->setAttribute('is_defined_test', true);
37
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Constant || $node instanceof Twig_SupTwg_Node_Expression_Array) {
38
+ $node = new Twig_SupTwg_Node_Expression_Constant(true, $node->getTemplateLine());
39
  } else {
40
+ throw new Twig_SupTwg_Error_Syntax('The "defined" test only works with simple variables.', $this->getTemplateLine());
41
  }
42
 
43
  parent::__construct($node, $name, $arguments, $lineno);
44
  }
45
 
46
+ protected function changeIgnoreStrictCheck(Twig_SupTwg_Node_Expression_GetAttr $node)
47
  {
48
  $node->setAttribute('ignore_strict_check', true);
49
 
50
+ if ($node->getNode('node') instanceof Twig_SupTwg_Node_Expression_GetAttr) {
51
  $this->changeIgnoreStrictCheck($node->getNode('node'));
52
  }
53
  }
54
 
55
+ public function compile(Twig_SupTwg_Compiler $compiler)
56
  {
57
  $compiler->subcompile($this->getNode('node'));
58
  }
vendor/Twig/Node/Expression/Test/Divisibleby.php CHANGED
@@ -18,9 +18,9 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test
22
  {
23
- public function compile(Twig_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(0 == ')
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_Node_Expression_Test_Divisibleby extends Twig_SupTwg_Node_Expression_Test
22
  {
23
+ public function compile(Twig_SupTwg_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(0 == ')
vendor/Twig/Node/Expression/Test/Even.php CHANGED
@@ -18,9 +18,9 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test
22
  {
23
- public function compile(Twig_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(')
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_Node_Expression_Test_Even extends Twig_SupTwg_Node_Expression_Test
22
  {
23
+ public function compile(Twig_SupTwg_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(')
vendor/Twig/Node/Expression/Test/Null.php CHANGED
@@ -18,9 +18,9 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
22
  {
23
- public function compile(Twig_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(null === ')
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_Node_Expression_Test_Null extends Twig_SupTwg_Node_Expression_Test
22
  {
23
+ public function compile(Twig_SupTwg_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(null === ')
vendor/Twig/Node/Expression/Test/Odd.php CHANGED
@@ -18,9 +18,9 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test
22
  {
23
- public function compile(Twig_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(')
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_Node_Expression_Test_Odd extends Twig_SupTwg_Node_Expression_Test
22
  {
23
+ public function compile(Twig_SupTwg_Compiler $compiler)
24
  {
25
  $compiler
26
  ->raw('(')
vendor/Twig/Node/Expression/Test/Sameas.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
18
  {
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('(')
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Expression_Test_Sameas extends Twig_SupTwg_Node_Expression_Test
18
  {
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $compiler
22
  ->raw('(')
vendor/Twig/Node/Expression/Unary.php CHANGED
@@ -9,19 +9,19 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- abstract class Twig_Node_Expression_Unary extends Twig_Node_Expression
13
  {
14
- public function __construct(Twig_NodeInterface $node, $lineno)
15
  {
16
  parent::__construct(array('node' => $node), array(), $lineno);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $compiler->raw(' ');
22
  $this->operator($compiler);
23
  $compiler->subcompile($this->getNode('node'));
24
  }
25
 
26
- abstract public function operator(Twig_Compiler $compiler);
27
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ abstract class Twig_SupTwg_Node_Expression_Unary extends Twig_SupTwg_Node_Expression
13
  {
14
+ public function __construct(Twig_SupTwg_NodeInterface $node, $lineno)
15
  {
16
  parent::__construct(array('node' => $node), array(), $lineno);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $compiler->raw(' ');
22
  $this->operator($compiler);
23
  $compiler->subcompile($this->getNode('node'));
24
  }
25
 
26
+ abstract public function operator(Twig_SupTwg_Compiler $compiler);
27
  }
vendor/Twig/Node/Expression/Unary/Neg.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Unary_Neg extends Twig_Node_Expression_Unary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  $compiler->raw('-');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Unary_Neg extends Twig_SupTwg_Node_Expression_Unary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  $compiler->raw('-');
17
  }
vendor/Twig/Node/Expression/Unary/Not.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Unary_Not extends Twig_Node_Expression_Unary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  $compiler->raw('!');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Unary_Not extends Twig_SupTwg_Node_Expression_Unary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  $compiler->raw('!');
17
  }
vendor/Twig/Node/Expression/Unary/Pos.php CHANGED
@@ -9,9 +9,9 @@
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
- class Twig_Node_Expression_Unary_Pos extends Twig_Node_Expression_Unary
13
  {
14
- public function operator(Twig_Compiler $compiler)
15
  {
16
  $compiler->raw('+');
17
  }
9
  * For the full copyright and license information, please view the LICENSE
10
  * file that was distributed with this source code.
11
  */
12
+ class Twig_SupTwg_Node_Expression_Unary_Pos extends Twig_SupTwg_Node_Expression_Unary
13
  {
14
+ public function operator(Twig_SupTwg_Compiler $compiler)
15
  {
16
  $compiler->raw('+');
17
  }
vendor/Twig/Node/Flush.php CHANGED
@@ -14,14 +14,14 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Flush extends Twig_Node
18
  {
19
  public function __construct($lineno, $tag)
20
  {
21
  parent::__construct(array(), array(), $lineno, $tag);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Flush extends Twig_SupTwg_Node
18
  {
19
  public function __construct($lineno, $tag)
20
  {
21
  parent::__construct(array(), array(), $lineno, $tag);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
vendor/Twig/Node/For.php CHANGED
@@ -15,16 +15,16 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_For extends Twig_Node
19
  {
20
  protected $loop;
21
 
22
- public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null)
23
  {
24
- $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag)));
25
 
26
  if (null !== $ifexpr) {
27
- $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag);
28
  }
29
 
30
  $nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body);
@@ -35,12 +35,12 @@ class Twig_Node_For extends Twig_Node
35
  parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag);
36
  }
37
 
38
- public function compile(Twig_Compiler $compiler)
39
  {
40
  $compiler
41
  ->addDebugInfo($this)
42
  ->write("\$context['_parent'] = \$context;\n")
43
- ->write("\$context['_seq'] = twig_ensure_traversable(")
44
  ->subcompile($this->getNode('seq'))
45
  ->raw(");\n")
46
  ;
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_For extends Twig_SupTwg_Node
19
  {
20
  protected $loop;
21
 
22
+ public function __construct(Twig_SupTwg_Node_Expression_AssignName $keyTarget, Twig_SupTwg_Node_Expression_AssignName $valueTarget, Twig_SupTwg_Node_Expression $seq, Twig_SupTwg_Node_Expression $ifexpr = null, Twig_SupTwg_NodeInterface $body, Twig_SupTwg_NodeInterface $else = null, $lineno, $tag = null)
23
  {
24
+ $body = new Twig_SupTwg_Node(array($body, $this->loop = new Twig_SupTwg_Node_ForLoop($lineno, $tag)));
25
 
26
  if (null !== $ifexpr) {
27
+ $body = new Twig_SupTwg_Node_If(new Twig_SupTwg_Node(array($ifexpr, $body)), null, $lineno, $tag);
28
  }
29
 
30
  $nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body);
35
  parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag);
36
  }
37
 
38
+ public function compile(Twig_SupTwg_Compiler $compiler)
39
  {
40
  $compiler
41
  ->addDebugInfo($this)
42
  ->write("\$context['_parent'] = \$context;\n")
43
+ ->write("\$context['_seq'] = Twig_SupTwg_ensure_traversable(")
44
  ->subcompile($this->getNode('seq'))
45
  ->raw(");\n")
46
  ;
vendor/Twig/Node/ForLoop.php CHANGED
@@ -14,14 +14,14 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_ForLoop extends Twig_Node
18
  {
19
  public function __construct($lineno, $tag = null)
20
  {
21
  parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  if ($this->getAttribute('else')) {
27
  $compiler->write("\$context['_iterated'] = true;\n");
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_ForLoop extends Twig_SupTwg_Node
18
  {
19
  public function __construct($lineno, $tag = null)
20
  {
21
  parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  if ($this->getAttribute('else')) {
27
  $compiler->write("\$context['_iterated'] = true;\n");
vendor/Twig/Node/If.php CHANGED
@@ -15,9 +15,9 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_If extends Twig_Node
19
  {
20
- public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null)
21
  {
22
  $nodes = array('tests' => $tests);
23
  if (null !== $else) {
@@ -27,7 +27,7 @@ class Twig_Node_If extends Twig_Node
27
  parent::__construct($nodes, array(), $lineno, $tag);
28
  }
29
 
30
- public function compile(Twig_Compiler $compiler)
31
  {
32
  $compiler->addDebugInfo($this);
33
  for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) {
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_If extends Twig_SupTwg_Node
19
  {
20
+ public function __construct(Twig_SupTwg_NodeInterface $tests, Twig_SupTwg_NodeInterface $else = null, $lineno, $tag = null)
21
  {
22
  $nodes = array('tests' => $tests);
23
  if (null !== $else) {
27
  parent::__construct($nodes, array(), $lineno, $tag);
28
  }
29
 
30
+ public function compile(Twig_SupTwg_Compiler $compiler)
31
  {
32
  $compiler->addDebugInfo($this);
33
  for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) {
vendor/Twig/Node/Import.php CHANGED
@@ -14,14 +14,14 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Import extends Twig_Node
18
  {
19
- public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
@@ -30,7 +30,7 @@ class Twig_Node_Import extends Twig_Node
30
  ->raw(' = ')
31
  ;
32
 
33
- if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) {
34
  $compiler->raw('$this');
35
  } else {
36
  $compiler
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Import extends Twig_SupTwg_Node
18
  {
19
+ public function __construct(Twig_SupTwg_Node_Expression $expr, Twig_SupTwg_Node_Expression $var, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
30
  ->raw(' = ')
31
  ;
32
 
33
+ if ($this->getNode('expr') instanceof Twig_SupTwg_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) {
34
  $compiler->raw('$this');
35
  } else {
36
  $compiler
vendor/Twig/Node/Include.php CHANGED
@@ -15,9 +15,9 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
19
  {
20
- public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
21
  {
22
  $nodes = array('expr' => $expr);
23
  if (null !== $variables) {
@@ -27,7 +27,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
27
  parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag);
28
  }
29
 
30
- public function compile(Twig_Compiler $compiler)
31
  {
32
  $compiler->addDebugInfo($this);
33
 
@@ -49,7 +49,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
49
  if ($this->getAttribute('ignore_missing')) {
50
  $compiler
51
  ->outdent()
52
- ->write("} catch (Twig_Error_Loader \$e) {\n")
53
  ->indent()
54
  ->write("// ignore missing template\n")
55
  ->outdent()
@@ -58,7 +58,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
58
  }
59
  }
60
 
61
- protected function addGetTemplate(Twig_Compiler $compiler)
62
  {
63
  $compiler
64
  ->write('$this->loadTemplate(')
@@ -71,7 +71,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
71
  ;
72
  }
73
 
74
- protected function addTemplateArguments(Twig_Compiler $compiler)
75
  {
76
  if (!$this->hasNode('variables')) {
77
  $compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()');
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Include extends Twig_SupTwg_Node implements Twig_SupTwg_NodeOutputInterface
19
  {
20
+ public function __construct(Twig_SupTwg_Node_Expression $expr, Twig_SupTwg_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
21
  {
22
  $nodes = array('expr' => $expr);
23
  if (null !== $variables) {
27
  parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag);
28
  }
29
 
30
+ public function compile(Twig_SupTwg_Compiler $compiler)
31
  {
32
  $compiler->addDebugInfo($this);
33
 
49
  if ($this->getAttribute('ignore_missing')) {
50
  $compiler
51
  ->outdent()
52
+ ->write("} catch (Twig_SupTwg_Error_Loader \$e) {\n")
53
  ->indent()
54
  ->write("// ignore missing template\n")
55
  ->outdent()
58
  }
59
  }
60
 
61
+ protected function addGetTemplate(Twig_SupTwg_Compiler $compiler)
62
  {
63
  $compiler
64
  ->write('$this->loadTemplate(')
71
  ;
72
  }
73
 
74
+ protected function addTemplateArguments(Twig_SupTwg_Compiler $compiler)
75
  {
76
  if (!$this->hasNode('variables')) {
77
  $compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()');
vendor/Twig/Node/Macro.php CHANGED
@@ -14,22 +14,22 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Macro extends Twig_Node
18
  {
19
  const VARARGS_NAME = 'varargs';
20
 
21
- public function __construct($name, Twig_NodeInterface $body, Twig_NodeInterface $arguments, $lineno, $tag = null)
22
  {
23
  foreach ($arguments as $argumentName => $argument) {
24
  if (self::VARARGS_NAME === $argumentName) {
25
- throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine());
26
  }
27
  }
28
 
29
  parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag);
30
  }
31
 
32
- public function compile(Twig_Compiler $compiler)
33
  {
34
  $compiler
35
  ->addDebugInfo($this)
@@ -115,7 +115,7 @@ class Twig_Node_Macro extends Twig_Node
115
  ->write("throw \$e;\n")
116
  ->outdent()
117
  ->write("}\n\n")
118
- ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n")
119
  ->outdent()
120
  ->write("}\n\n")
121
  ;
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Macro extends Twig_SupTwg_Node
18
  {
19
  const VARARGS_NAME = 'varargs';
20
 
21
+ public function __construct($name, Twig_SupTwg_NodeInterface $body, Twig_SupTwg_NodeInterface $arguments, $lineno, $tag = null)
22
  {
23
  foreach ($arguments as $argumentName => $argument) {
24
  if (self::VARARGS_NAME === $argumentName) {
25
+ throw new Twig_SupTwg_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine());
26
  }
27
  }
28
 
29
  parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag);
30
  }
31
 
32
+ public function compile(Twig_SupTwg_Compiler $compiler)
33
  {
34
  $compiler
35
  ->addDebugInfo($this)
115
  ->write("throw \$e;\n")
116
  ->outdent()
117
  ->write("}\n\n")
118
+ ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_SupTwg_Markup(\$tmp, \$this->env->getCharset());\n")
119
  ->outdent()
120
  ->write("}\n\n")
121
  ;
vendor/Twig/Node/Module.php CHANGED
@@ -19,15 +19,15 @@
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  */
22
- class Twig_Node_Module extends Twig_Node
23
  {
24
  private $source;
25
 
26
- public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '')
27
  {
28
- if (!$name instanceof Twig_Source) {
29
- @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
30
- $this->source = new Twig_Source($source, $name);
31
  } else {
32
  $this->source = $name;
33
  }
@@ -37,11 +37,11 @@ class Twig_Node_Module extends Twig_Node
37
  'blocks' => $blocks,
38
  'macros' => $macros,
39
  'traits' => $traits,
40
- 'display_start' => new Twig_Node(),
41
- 'display_end' => new Twig_Node(),
42
- 'constructor_start' => new Twig_Node(),
43
- 'constructor_end' => new Twig_Node(),
44
- 'class_end' => new Twig_Node(),
45
  );
46
  if (null !== $parent) {
47
  $nodes['parent'] = $parent;
@@ -66,7 +66,7 @@ class Twig_Node_Module extends Twig_Node
66
  $this->setAttribute('index', $index);
67
  }
68
 
69
- public function compile(Twig_Compiler $compiler)
70
  {
71
  $this->compileTemplate($compiler);
72
 
@@ -75,7 +75,7 @@ class Twig_Node_Module extends Twig_Node
75
  }
76
  }
77
 
78
- protected function compileTemplate(Twig_Compiler $compiler)
79
  {
80
  if (!$this->getAttribute('index')) {
81
  $compiler->write('<?php');
@@ -87,7 +87,7 @@ class Twig_Node_Module extends Twig_Node
87
  count($this->getNode('blocks'))
88
  || count($this->getNode('traits'))
89
  || !$this->hasNode('parent')
90
- || $this->getNode('parent') instanceof Twig_Node_Expression_Constant
91
  || count($this->getNode('constructor_start'))
92
  || count($this->getNode('constructor_end'))
93
  ) {
@@ -115,7 +115,7 @@ class Twig_Node_Module extends Twig_Node
115
  $this->compileClassFooter($compiler);
116
  }
117
 
118
- protected function compileGetParent(Twig_Compiler $compiler)
119
  {
120
  if (!$this->hasNode('parent')) {
121
  return;
@@ -129,7 +129,7 @@ class Twig_Node_Module extends Twig_Node
129
  ->write('return ')
130
  ;
131
 
132
- if ($parent instanceof Twig_Node_Expression_Constant) {
133
  $compiler->subcompile($parent);
134
  } else {
135
  $compiler
@@ -150,7 +150,7 @@ class Twig_Node_Module extends Twig_Node
150
  ;
151
  }
152
 
153
- protected function compileClassHeader(Twig_Compiler $compiler)
154
  {
155
  $compiler
156
  ->write("\n\n")
@@ -163,10 +163,10 @@ class Twig_Node_Module extends Twig_Node
163
  ;
164
  }
165
 
166
- protected function compileConstructor(Twig_Compiler $compiler)
167
  {
168
  $compiler
169
- ->write("public function __construct(Twig_Environment \$env)\n", "{\n")
170
  ->indent()
171
  ->subcompile($this->getNode('constructor_start'))
172
  ->write("parent::__construct(\$env);\n\n")
@@ -175,7 +175,7 @@ class Twig_Node_Module extends Twig_Node
175
  // parent
176
  if (!$this->hasNode('parent')) {
177
  $compiler->write("\$this->parent = false;\n\n");
178
- } elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_Node_Expression_Constant) {
179
  $compiler
180
  ->addDebugInfo($parent)
181
  ->write('$this->parent = $this->loadTemplate(')
@@ -198,7 +198,7 @@ class Twig_Node_Module extends Twig_Node
198
  ->addDebugInfo($trait->getNode('template'))
199
  ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))
200
  ->indent()
201
- ->write("throw new Twig_Error_Runtime('Template \"'.")
202
  ->subcompile($trait->getNode('template'))
203
  ->raw(".'\" cannot be used as a trait.');\n")
204
  ->outdent()
@@ -212,7 +212,7 @@ class Twig_Node_Module extends Twig_Node
212
  ->string($key)
213
  ->raw("])) {\n")
214
  ->indent()
215
- ->write("throw new Twig_Error_Runtime(sprintf('Block ")
216
  ->string($key)
217
  ->raw(' is not defined in trait ')
218
  ->subcompile($trait->getNode('template'))
@@ -292,7 +292,7 @@ class Twig_Node_Module extends Twig_Node
292
  ;
293
  }
294
 
295
- protected function compileDisplay(Twig_Compiler $compiler)
296
  {
297
  $compiler
298
  ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
@@ -304,7 +304,7 @@ class Twig_Node_Module extends Twig_Node
304
  if ($this->hasNode('parent')) {
305
  $parent = $this->getNode('parent');
306
  $compiler->addDebugInfo($parent);
307
- if ($parent instanceof Twig_Node_Expression_Constant) {
308
  $compiler->write('$this->parent');
309
  } else {
310
  $compiler->write('$this->getParent($context)');
@@ -319,7 +319,7 @@ class Twig_Node_Module extends Twig_Node
319
  ;
320
  }
321
 
322
- protected function compileClassFooter(Twig_Compiler $compiler)
323
  {
324
  $compiler
325
  ->subcompile($this->getNode('class_end'))
@@ -328,12 +328,12 @@ class Twig_Node_Module extends Twig_Node
328
  ;
329
  }
330
 
331
- protected function compileMacros(Twig_Compiler $compiler)
332
  {
333
  $compiler->subcompile($this->getNode('macros'));
334
  }
335
 
336
- protected function compileGetTemplateName(Twig_Compiler $compiler)
337
  {
338
  $compiler
339
  ->write("public function getTemplateName()\n", "{\n")
@@ -346,7 +346,7 @@ class Twig_Node_Module extends Twig_Node
346
  ;
347
  }
348
 
349
- protected function compileIsTraitable(Twig_Compiler $compiler)
350
  {
351
  // A template can be used as a trait if:
352
  // * it has no parent
@@ -357,14 +357,14 @@ class Twig_Node_Module extends Twig_Node
357
  // only contains blocks and use statements.
358
  $traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros'));
359
  if ($traitable) {
360
- if ($this->getNode('body') instanceof Twig_Node_Body) {
361
  $nodes = $this->getNode('body')->getNode(0);
362
  } else {
363
  $nodes = $this->getNode('body');
364
  }
365
 
366
  if (!count($nodes)) {
367
- $nodes = new Twig_Node(array($nodes));
368
  }
369
 
370
  foreach ($nodes as $node) {
@@ -372,11 +372,11 @@ class Twig_Node_Module extends Twig_Node
372
  continue;
373
  }
374
 
375
- if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) {
376
  continue;
377
  }
378
 
379
- if ($node instanceof Twig_Node_BlockReference) {
380
  continue;
381
  }
382
 
@@ -398,7 +398,7 @@ class Twig_Node_Module extends Twig_Node
398
  ;
399
  }
400
 
401
- protected function compileDebugInfo(Twig_Compiler $compiler)
402
  {
403
  $compiler
404
  ->write("public function getDebugInfo()\n", "{\n")
@@ -409,7 +409,7 @@ class Twig_Node_Module extends Twig_Node
409
  ;
410
  }
411
 
412
- protected function compileGetSource(Twig_Compiler $compiler)
413
  {
414
  $compiler
415
  ->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")
@@ -423,12 +423,12 @@ class Twig_Node_Module extends Twig_Node
423
  ;
424
  }
425
 
426
- protected function compileGetSourceContext(Twig_Compiler $compiler)
427
  {
428
  $compiler
429
  ->write("public function getSourceContext()\n", "{\n")
430
  ->indent()
431
- ->write('return new Twig_Source(')
432
  ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '')
433
  ->raw(', ')
434
  ->string($this->source->getName())
@@ -440,9 +440,9 @@ class Twig_Node_Module extends Twig_Node
440
  ;
441
  }
442
 
443
- protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var)
444
  {
445
- if ($node instanceof Twig_Node_Expression_Constant) {
446
  $compiler
447
  ->write(sprintf('%s = $this->loadTemplate(', $var))
448
  ->subcompile($node)
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  */
22
+ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
23
  {
24
  private $source;
25
 
26
+ public function __construct(Twig_SupTwg_NodeInterface $body, Twig_SupTwg_Node_Expression $parent = null, Twig_SupTwg_NodeInterface $blocks, Twig_SupTwg_NodeInterface $macros, Twig_SupTwg_NodeInterface $traits, $embeddedTemplates, $name, $source = '')
27
  {
28
+ if (!$name instanceof Twig_SupTwg_Source) {
29
+ @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwg_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
30
+ $this->source = new Twig_SupTwg_Source($source, $name);
31
  } else {
32
  $this->source = $name;
33
  }
37
  'blocks' => $blocks,
38
  'macros' => $macros,
39
  'traits' => $traits,
40
+ 'display_start' => new Twig_SupTwg_Node(),
41
+ 'display_end' => new Twig_SupTwg_Node(),
42
+ 'constructor_start' => new Twig_SupTwg_Node(),
43
+ 'constructor_end' => new Twig_SupTwg_Node(),
44
+ 'class_end' => new Twig_SupTwg_Node(),
45
  );
46
  if (null !== $parent) {
47
  $nodes['parent'] = $parent;
66
  $this->setAttribute('index', $index);
67
  }
68
 
69
+ public function compile(Twig_SupTwg_Compiler $compiler)
70
  {
71
  $this->compileTemplate($compiler);
72
 
75
  }
76
  }
77
 
78
+ protected function compileTemplate(Twig_SupTwg_Compiler $compiler)
79
  {
80
  if (!$this->getAttribute('index')) {
81
  $compiler->write('<?php');
87
  count($this->getNode('blocks'))
88
  || count($this->getNode('traits'))
89
  || !$this->hasNode('parent')
90
+ || $this->getNode('parent') instanceof Twig_SupTwg_Node_Expression_Constant
91
  || count($this->getNode('constructor_start'))
92
  || count($this->getNode('constructor_end'))
93
  ) {
115
  $this->compileClassFooter($compiler);
116
  }
117
 
118
+ protected function compileGetParent(Twig_SupTwg_Compiler $compiler)
119
  {
120
  if (!$this->hasNode('parent')) {
121
  return;
129
  ->write('return ')
130
  ;
131
 
132
+ if ($parent instanceof Twig_SupTwg_Node_Expression_Constant) {
133
  $compiler->subcompile($parent);
134
  } else {
135
  $compiler
150
  ;
151
  }
152
 
153
+ protected function compileClassHeader(Twig_SupTwg_Compiler $compiler)
154
  {
155
  $compiler
156
  ->write("\n\n")
163
  ;
164
  }
165
 
166
+ protected function compileConstructor(Twig_SupTwg_Compiler $compiler)
167
  {
168
  $compiler
169
+ ->write("public function __construct(Twig_SupTwg_Environment \$env)\n", "{\n")
170
  ->indent()
171
  ->subcompile($this->getNode('constructor_start'))
172
  ->write("parent::__construct(\$env);\n\n")
175
  // parent
176
  if (!$this->hasNode('parent')) {
177
  $compiler->write("\$this->parent = false;\n\n");
178
+ } elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_SupTwg_Node_Expression_Constant) {
179
  $compiler
180
  ->addDebugInfo($parent)
181
  ->write('$this->parent = $this->loadTemplate(')
198
  ->addDebugInfo($trait->getNode('template'))
199
  ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))
200
  ->indent()
201
+ ->write("throw new Twig_SupTwg_Error_Runtime('Template \"'.")
202
  ->subcompile($trait->getNode('template'))
203
  ->raw(".'\" cannot be used as a trait.');\n")
204
  ->outdent()
212
  ->string($key)
213
  ->raw("])) {\n")
214
  ->indent()
215
+ ->write("throw new Twig_SupTwg_Error_Runtime(sprintf('Block ")
216
  ->string($key)
217
  ->raw(' is not defined in trait ')
218
  ->subcompile($trait->getNode('template'))
292
  ;
293
  }
294
 
295
+ protected function compileDisplay(Twig_SupTwg_Compiler $compiler)
296
  {
297
  $compiler
298
  ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
304
  if ($this->hasNode('parent')) {
305
  $parent = $this->getNode('parent');
306
  $compiler->addDebugInfo($parent);
307
+ if ($parent instanceof Twig_SupTwg_Node_Expression_Constant) {
308
  $compiler->write('$this->parent');
309
  } else {
310
  $compiler->write('$this->getParent($context)');
319
  ;
320
  }
321
 
322
+ protected function compileClassFooter(Twig_SupTwg_Compiler $compiler)
323
  {
324
  $compiler
325
  ->subcompile($this->getNode('class_end'))
328
  ;
329
  }
330
 
331
+ protected function compileMacros(Twig_SupTwg_Compiler $compiler)
332
  {
333
  $compiler->subcompile($this->getNode('macros'));
334
  }
335
 
336
+ protected function compileGetTemplateName(Twig_SupTwg_Compiler $compiler)
337
  {
338
  $compiler
339
  ->write("public function getTemplateName()\n", "{\n")
346
  ;
347
  }
348
 
349
+ protected function compileIsTraitable(Twig_SupTwg_Compiler $compiler)
350
  {
351
  // A template can be used as a trait if:
352
  // * it has no parent
357
  // only contains blocks and use statements.
358
  $traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros'));
359
  if ($traitable) {
360
+ if ($this->getNode('body') instanceof Twig_SupTwg_Node_Body) {
361
  $nodes = $this->getNode('body')->getNode(0);
362
  } else {
363
  $nodes = $this->getNode('body');
364
  }
365
 
366
  if (!count($nodes)) {
367
+ $nodes = new Twig_SupTwg_Node(array($nodes));
368
  }
369
 
370
  foreach ($nodes as $node) {
372
  continue;
373
  }
374
 
375
+ if ($node instanceof Twig_SupTwg_Node_Text && ctype_space($node->getAttribute('data'))) {
376
  continue;
377
  }
378
 
379
+ if ($node instanceof Twig_SupTwg_Node_BlockReference) {
380
  continue;
381
  }
382
 
398
  ;
399
  }
400
 
401
+ protected function compileDebugInfo(Twig_SupTwg_Compiler $compiler)
402
  {
403
  $compiler
404
  ->write("public function getDebugInfo()\n", "{\n")
409
  ;
410
  }
411
 
412
+ protected function compileGetSource(Twig_SupTwg_Compiler $compiler)
413
  {
414
  $compiler
415
  ->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")
423
  ;
424
  }
425
 
426
+ protected function compileGetSourceContext(Twig_SupTwg_Compiler $compiler)
427
  {
428
  $compiler
429
  ->write("public function getSourceContext()\n", "{\n")
430
  ->indent()
431
+ ->write('return new Twig_SupTwg_Source(')
432
  ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '')
433
  ->raw(', ')
434
  ->string($this->source->getName())
440
  ;
441
  }
442
 
443
+ protected function compileLoadTemplate(Twig_SupTwg_Compiler $compiler, $node, $var)
444
  {
445
+ if ($node instanceof Twig_SupTwg_Node_Expression_Constant) {
446
  $compiler
447
  ->write(sprintf('%s = $this->loadTemplate(', $var))
448
  ->subcompile($node)
vendor/Twig/Node/Print.php CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface
19
  {
20
- public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null)
21
  {
22
  parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Print extends Twig_SupTwg_Node implements Twig_SupTwg_NodeOutputInterface
19
  {
20
+ public function __construct(Twig_SupTwg_Node_Expression $expr, $lineno, $tag = null)
21
  {
22
  parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
vendor/Twig/Node/Sandbox.php CHANGED
@@ -14,18 +14,18 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Sandbox extends Twig_Node
18
  {
19
- public function __construct(Twig_NodeInterface $body, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('body' => $body), array(), $lineno, $tag);
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
28
- ->write("\$sandbox = \$this->env->getExtension('Twig_Extension_Sandbox');\n")
29
  ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n")
30
  ->indent()
31
  ->write("\$sandbox->enableSandbox();\n")
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Sandbox extends Twig_SupTwg_Node
18
  {
19
+ public function __construct(Twig_SupTwg_NodeInterface $body, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('body' => $body), array(), $lineno, $tag);
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
28
+ ->write("\$sandbox = \$this->env->getExtension('Twig_SupTwg_Extension_Sandbox');\n")
29
  ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n")
30
  ->indent()
31
  ->write("\$sandbox->enableSandbox();\n")
vendor/Twig/Node/SandboxedPrint.php CHANGED
@@ -10,7 +10,7 @@
10
  */
11
 
12
  /**
13
- * Twig_Node_SandboxedPrint adds a check for the __toString() method
14
  * when the variable is an object and the sandbox is activated.
15
  *
16
  * When there is a simple Print statement, like {{ article }},
@@ -19,13 +19,13 @@
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  */
22
- class Twig_Node_SandboxedPrint extends Twig_Node_Print
23
  {
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
28
- ->write('echo $this->env->getExtension(\'Twig_Extension_Sandbox\')->ensureToStringAllowed(')
29
  ->subcompile($this->getNode('expr'))
30
  ->raw(");\n")
31
  ;
@@ -36,11 +36,11 @@ class Twig_Node_SandboxedPrint extends Twig_Node_Print
36
  *
37
  * This is mostly needed when another visitor adds filters (like the escaper one).
38
  *
39
- * @return Twig_Node
40
  */
41
- protected function removeNodeFilter(Twig_Node $node)
42
  {
43
- if ($node instanceof Twig_Node_Expression_Filter) {
44
  return $this->removeNodeFilter($node->getNode('node'));
45
  }
46
 
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_Node_SandboxedPrint adds a check for the __toString() method
14
  * when the variable is an object and the sandbox is activated.
15
  *
16
  * When there is a simple Print statement, like {{ article }},
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  */
22
+ class Twig_SupTwg_Node_SandboxedPrint extends Twig_SupTwg_Node_Print
23
  {
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->addDebugInfo($this)
28
+ ->write('echo $this->env->getExtension(\'Twig_SupTwg_Extension_Sandbox\')->ensureToStringAllowed(')
29
  ->subcompile($this->getNode('expr'))
30
  ->raw(");\n")
31
  ;
36
  *
37
  * This is mostly needed when another visitor adds filters (like the escaper one).
38
  *
39
+ * @return Twig_SupTwg_Node
40
  */
41
+ protected function removeNodeFilter(Twig_SupTwg_Node $node)
42
  {
43
+ if ($node instanceof Twig_SupTwg_Node_Expression_Filter) {
44
  return $this->removeNodeFilter($node->getNode('node'));
45
  }
46
 
vendor/Twig/Node/Set.php CHANGED
@@ -14,29 +14,29 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface
18
  {
19
- public function __construct($capture, Twig_NodeInterface $names, Twig_NodeInterface $values, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag);
22
 
23
  /*
24
  * Optimizes the node when capture is used for a large block of text.
25
  *
26
- * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig_Markup("foo");
27
  */
28
  if ($this->getAttribute('capture')) {
29
  $this->setAttribute('safe', true);
30
 
31
  $values = $this->getNode('values');
32
- if ($values instanceof Twig_Node_Text) {
33
- $this->setNode('values', new Twig_Node_Expression_Constant($values->getAttribute('data'), $values->getTemplateLine()));
34
  $this->setAttribute('capture', false);
35
  }
36
  }
37
  }
38
 
39
- public function compile(Twig_Compiler $compiler)
40
  {
41
  $compiler->addDebugInfo($this);
42
 
@@ -61,7 +61,7 @@ class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface
61
  $compiler->subcompile($this->getNode('names'), false);
62
 
63
  if ($this->getAttribute('capture')) {
64
- $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())");
65
  }
66
  }
67
 
@@ -83,7 +83,7 @@ class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface
83
  $compiler
84
  ->raw("('' === \$tmp = ")
85
  ->subcompile($this->getNode('values'))
86
- ->raw(") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())")
87
  ;
88
  } else {
89
  $compiler->subcompile($this->getNode('values'));
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_Set extends Twig_SupTwg_Node implements Twig_SupTwg_NodeCaptureInterface
18
  {
19
+ public function __construct($capture, Twig_SupTwg_NodeInterface $names, Twig_SupTwg_NodeInterface $values, $lineno, $tag = null)
20
  {
21
  parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag);
22
 
23
  /*
24
  * Optimizes the node when capture is used for a large block of text.
25
  *
26
+ * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig_SupTwg_Markup("foo");
27
  */
28
  if ($this->getAttribute('capture')) {
29
  $this->setAttribute('safe', true);
30
 
31
  $values = $this->getNode('values');
32
+ if ($values instanceof Twig_SupTwg_Node_Text) {
33
+ $this->setNode('values', new Twig_SupTwg_Node_Expression_Constant($values->getAttribute('data'), $values->getTemplateLine()));
34
  $this->setAttribute('capture', false);
35
  }
36
  }
37
  }
38
 
39
+ public function compile(Twig_SupTwg_Compiler $compiler)
40
  {
41
  $compiler->addDebugInfo($this);
42
 
61
  $compiler->subcompile($this->getNode('names'), false);
62
 
63
  if ($this->getAttribute('capture')) {
64
+ $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_SupTwg_Markup(\$tmp, \$this->env->getCharset())");
65
  }
66
  }
67
 
83
  $compiler
84
  ->raw("('' === \$tmp = ")
85
  ->subcompile($this->getNode('values'))
86
+ ->raw(") ? '' : new Twig_SupTwg_Markup(\$tmp, \$this->env->getCharset())")
87
  ;
88
  } else {
89
  $compiler->subcompile($this->getNode('values'));
vendor/Twig/Node/SetTemp.php CHANGED
@@ -9,14 +9,14 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- class Twig_Node_SetTemp extends Twig_Node
13
  {
14
  public function __construct($name, $lineno)
15
  {
16
  parent::__construct(array(), array('name' => $name), $lineno);
17
  }
18
 
19
- public function compile(Twig_Compiler $compiler)
20
  {
21
  $name = $this->getAttribute('name');
22
  $compiler
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ class Twig_SupTwg_Node_SetTemp extends Twig_SupTwg_Node
13
  {
14
  public function __construct($name, $lineno)
15
  {
16
  parent::__construct(array(), array('name' => $name), $lineno);
17
  }
18
 
19
+ public function compile(Twig_SupTwg_Compiler $compiler)
20
  {
21
  $name = $this->getAttribute('name');
22
  $compiler
vendor/Twig/Node/Spaceless.php CHANGED
@@ -16,14 +16,14 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_Node_Spaceless extends Twig_Node
20
  {
21
- public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless')
22
  {
23
  parent::__construct(array('body' => $body), array(), $lineno, $tag);
24
  }
25
 
26
- public function compile(Twig_Compiler $compiler)
27
  {
28
  $compiler
29
  ->addDebugInfo($this)
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_Node_Spaceless extends Twig_SupTwg_Node
20
  {
21
+ public function __construct(Twig_SupTwg_NodeInterface $body, $lineno, $tag = 'spaceless')
22
  {
23
  parent::__construct(array('body' => $body), array(), $lineno, $tag);
24
  }
25
 
26
+ public function compile(Twig_SupTwg_Compiler $compiler)
27
  {
28
  $compiler
29
  ->addDebugInfo($this)
vendor/Twig/Node/Text.php CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface
19
  {
20
  public function __construct($data, $lineno)
21
  {
22
  parent::__construct(array(), array('data' => $data), $lineno);
23
  }
24
 
25
- public function compile(Twig_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Node_Text extends Twig_SupTwg_Node implements Twig_SupTwg_NodeOutputInterface
19
  {
20
  public function __construct($data, $lineno)
21
  {
22
  parent::__construct(array(), array('data' => $data), $lineno);
23
  }
24
 
25
+ public function compile(Twig_SupTwg_Compiler $compiler)
26
  {
27
  $compiler
28
  ->addDebugInfo($this)
vendor/Twig/Node/With.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Node_With extends Twig_Node
18
  {
19
- public function __construct(Twig_Node $body, Twig_Node $variables = null, $only = false, $lineno, $tag = null)
20
  {
21
  $nodes = array('body' => $body);
22
  if (null !== $variables) {
@@ -26,7 +26,7 @@ class Twig_Node_With extends Twig_Node
26
  parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag);
27
  }
28
 
29
- public function compile(Twig_Compiler $compiler)
30
  {
31
  $compiler->addDebugInfo($this);
32
 
@@ -38,7 +38,7 @@ class Twig_Node_With extends Twig_Node
38
  ->raw(";\n")
39
  ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName))
40
  ->indent()
41
- ->write("throw new Twig_Error_Runtime('Variables passed to the \"with\" tag must be a hash.');\n")
42
  ->outdent()
43
  ->write("}\n")
44
  ;
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Node_With extends Twig_SupTwg_Node
18
  {
19
+ public function __construct(Twig_SupTwg_Node $body, Twig_SupTwg_Node $variables = null, $only = false, $lineno, $tag = null)
20
  {
21
  $nodes = array('body' => $body);
22
  if (null !== $variables) {
26
  parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag);
27
  }
28
 
29
+ public function compile(Twig_SupTwg_Compiler $compiler)
30
  {
31
  $compiler->addDebugInfo($this);
32
 
38
  ->raw(";\n")
39
  ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName))
40
  ->indent()
41
+ ->write("throw new Twig_SupTwg_Error_Runtime('Variables passed to the \"with\" tag must be a hash.');\n")
42
  ->outdent()
43
  ->write("}\n")
44
  ;
vendor/Twig/NodeCaptureInterface.php CHANGED
@@ -14,6 +14,6 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_NodeCaptureInterface
18
  {
19
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_NodeCaptureInterface
18
  {
19
  }
vendor/Twig/NodeInterface.php CHANGED
@@ -16,12 +16,12 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_NodeInterface extends Countable, IteratorAggregate
20
  {
21
  /**
22
  * Compiles the node to PHP.
23
  */
24
- public function compile(Twig_Compiler $compiler);
25
 
26
  /**
27
  * @deprecated since 1.27 (to be removed in 2.0)
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_NodeInterface extends Countable, IteratorAggregate
20
  {
21
  /**
22
  * Compiles the node to PHP.
23
  */
24
+ public function compile(Twig_SupTwg_Compiler $compiler);
25
 
26
  /**
27
  * @deprecated since 1.27 (to be removed in 2.0)
vendor/Twig/NodeOutputInterface.php CHANGED
@@ -14,6 +14,6 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_NodeOutputInterface
18
  {
19
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_NodeOutputInterface
18
  {
19
  }
vendor/Twig/NodeTraverser.php CHANGED
@@ -10,7 +10,7 @@
10
  */
11
 
12
  /**
13
- * Twig_NodeTraverser is a node traverser.
14
  *
15
  * It visits all nodes and their children and calls the given visitor for each.
16
  *
@@ -18,16 +18,16 @@
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
- class Twig_NodeTraverser
22
  {
23
  protected $env;
24
  protected $visitors = array();
25
 
26
  /**
27
- * @param Twig_Environment $env
28
- * @param Twig_NodeVisitorInterface[] $visitors
29
  */
30
- public function __construct(Twig_Environment $env, array $visitors = array())
31
  {
32
  $this->env = $env;
33
  foreach ($visitors as $visitor) {
@@ -35,7 +35,7 @@ class Twig_NodeTraverser
35
  }
36
  }
37
 
38
- public function addVisitor(Twig_NodeVisitorInterface $visitor)
39
  {
40
  if (!isset($this->visitors[$visitor->getPriority()])) {
41
  $this->visitors[$visitor->getPriority()] = array();
@@ -47,9 +47,9 @@ class Twig_NodeTraverser
47
  /**
48
  * Traverses a node and calls the registered visitors.
49
  *
50
- * @return Twig_NodeInterface
51
  */
52
- public function traverse(Twig_NodeInterface $node)
53
  {
54
  ksort($this->visitors);
55
  foreach ($this->visitors as $visitors) {
@@ -61,7 +61,7 @@ class Twig_NodeTraverser
61
  return $node;
62
  }
63
 
64
- protected function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node = null)
65
  {
66
  if (null === $node) {
67
  return;
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_NodeTraverser is a node traverser.
14
  *
15
  * It visits all nodes and their children and calls the given visitor for each.
16
  *
18
  *
19
  * @author Fabien Potencier <fabien@symfony.com>
20
  */
21
+ class Twig_SupTwg_NodeTraverser
22
  {
23
  protected $env;
24
  protected $visitors = array();
25
 
26
  /**
27
+ * @param Twig_SupTwg_Environment $env
28
+ * @param Twig_SupTwg_NodeVisitorInterface[] $visitors
29
  */
30
+ public function __construct(Twig_SupTwg_Environment $env, array $visitors = array())
31
  {
32
  $this->env = $env;
33
  foreach ($visitors as $visitor) {
35
  }
36
  }
37
 
38
+ public function addVisitor(Twig_SupTwg_NodeVisitorInterface $visitor)
39
  {
40
  if (!isset($this->visitors[$visitor->getPriority()])) {
41
  $this->visitors[$visitor->getPriority()] = array();
47
  /**
48
  * Traverses a node and calls the registered visitors.
49
  *
50
+ * @return Twig_SupTwg_NodeInterface
51
  */
52
+ public function traverse(Twig_SupTwg_NodeInterface $node)
53
  {
54
  ksort($this->visitors);
55
  foreach ($this->visitors as $visitors) {
61
  return $node;
62
  }
63
 
64
+ protected function traverseForVisitor(Twig_SupTwg_NodeVisitorInterface $visitor, Twig_SupTwg_NodeInterface $node = null)
65
  {
66
  if (null === $node) {
67
  return;
vendor/Twig/NodeVisitor/Escaper.php CHANGED
@@ -10,13 +10,13 @@
10
  */
11
 
12
  /**
13
- * Twig_NodeVisitor_Escaper implements output escaping.
14
  *
15
  * @final
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
20
  {
21
  protected $statusStack = array();
22
  protected $blocks = array();
@@ -27,50 +27,50 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
27
 
28
  public function __construct()
29
  {
30
- $this->safeAnalysis = new Twig_NodeVisitor_SafeAnalysis();
31
  }
32
 
33
- protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
34
  {
35
- if ($node instanceof Twig_Node_Module) {
36
- if ($env->hasExtension('Twig_Extension_Escaper') && $defaultStrategy = $env->getExtension('Twig_Extension_Escaper')->getDefaultStrategy($node->getTemplateName())) {
37
  $this->defaultStrategy = $defaultStrategy;
38
  }
39
  $this->safeVars = array();
40
  $this->blocks = array();
41
- } elseif ($node instanceof Twig_Node_AutoEscape) {
42
  $this->statusStack[] = $node->getAttribute('value');
43
- } elseif ($node instanceof Twig_Node_Block) {
44
  $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env);
45
- } elseif ($node instanceof Twig_Node_Import) {
46
  $this->safeVars[] = $node->getNode('var')->getAttribute('name');
47
  }
48
 
49
  return $node;
50
  }
51
 
52
- protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
53
  {
54
- if ($node instanceof Twig_Node_Module) {
55
  $this->defaultStrategy = false;
56
  $this->safeVars = array();
57
  $this->blocks = array();
58
- } elseif ($node instanceof Twig_Node_Expression_Filter) {
59
  return $this->preEscapeFilterNode($node, $env);
60
- } elseif ($node instanceof Twig_Node_Print) {
61
  return $this->escapePrintNode($node, $env, $this->needEscaping($env));
62
  }
63
 
64
- if ($node instanceof Twig_Node_AutoEscape || $node instanceof Twig_Node_Block) {
65
  array_pop($this->statusStack);
66
- } elseif ($node instanceof Twig_Node_BlockReference) {
67
  $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env);
68
  }
69
 
70
  return $node;
71
  }
72
 
73
- protected function escapePrintNode(Twig_Node_Print $node, Twig_Environment $env, $type)
74
  {
75
  if (false === $type) {
76
  return $node;
@@ -90,7 +90,7 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
90
  );
91
  }
92
 
93
- protected function preEscapeFilterNode(Twig_Node_Expression_Filter $filter, Twig_Environment $env)
94
  {
95
  $name = $filter->getNode('filter')->getAttribute('value');
96
 
@@ -109,13 +109,13 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
109
  return $filter;
110
  }
111
 
112
- protected function isSafeFor($type, Twig_NodeInterface $expression, $env)
113
  {
114
  $safe = $this->safeAnalysis->getSafe($expression);
115
 
116
  if (null === $safe) {
117
  if (null === $this->traverser) {
118
- $this->traverser = new Twig_NodeTraverser($env, array($this->safeAnalysis));
119
  }
120
 
121
  $this->safeAnalysis->setSafeVars($this->safeVars);
@@ -127,7 +127,7 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
127
  return in_array($type, $safe) || in_array('all', $safe);
128
  }
129
 
130
- protected function needEscaping(Twig_Environment $env)
131
  {
132
  if (count($this->statusStack)) {
133
  return $this->statusStack[count($this->statusStack) - 1];
@@ -136,13 +136,13 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
136
  return $this->defaultStrategy ? $this->defaultStrategy : false;
137
  }
138
 
139
- protected function getEscaperFilter($type, Twig_NodeInterface $node)
140
  {
141
  $line = $node->getTemplateLine();
142
- $name = new Twig_Node_Expression_Constant('escape', $line);
143
- $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line), new Twig_Node_Expression_Constant(null, $line), new Twig_Node_Expression_Constant(true, $line)));
144
 
145
- return new Twig_Node_Expression_Filter($node, $name, $args, $line);
146
  }
147
 
148
  public function getPriority()
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_NodeVisitor_Escaper implements output escaping.
14
  *
15
  * @final
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
20
  {
21
  protected $statusStack = array();
22
  protected $blocks = array();
27
 
28
  public function __construct()
29
  {
30
+ $this->safeAnalysis = new Twig_SupTwg_NodeVisitor_SafeAnalysis();
31
  }
32
 
33
+ protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
34
  {
35
+ if ($node instanceof Twig_SupTwg_Node_Module) {
36
+ if ($env->hasExtension('Twig_SupTwg_Extension_Escaper') && $defaultStrategy = $env->getExtension('Twig_SupTwg_Extension_Escaper')->getDefaultStrategy($node->getTemplateName())) {
37
  $this->defaultStrategy = $defaultStrategy;
38
  }
39
  $this->safeVars = array();
40
  $this->blocks = array();
41
+ } elseif ($node instanceof Twig_SupTwg_Node_AutoEscape) {
42
  $this->statusStack[] = $node->getAttribute('value');
43
+ } elseif ($node instanceof Twig_SupTwg_Node_Block) {
44
  $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env);
45
+ } elseif ($node instanceof Twig_SupTwg_Node_Import) {
46
  $this->safeVars[] = $node->getNode('var')->getAttribute('name');
47
  }
48
 
49
  return $node;
50
  }
51
 
52
+ protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
53
  {
54
+ if ($node instanceof Twig_SupTwg_Node_Module) {
55
  $this->defaultStrategy = false;
56
  $this->safeVars = array();
57
  $this->blocks = array();
58
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Filter) {
59
  return $this->preEscapeFilterNode($node, $env);
60
+ } elseif ($node instanceof Twig_SupTwg_Node_Print) {
61
  return $this->escapePrintNode($node, $env, $this->needEscaping($env));
62
  }
63
 
64
+ if ($node instanceof Twig_SupTwg_Node_AutoEscape || $node instanceof Twig_SupTwg_Node_Block) {
65
  array_pop($this->statusStack);
66
+ } elseif ($node instanceof Twig_SupTwg_Node_BlockReference) {
67
  $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env);
68
  }
69
 
70
  return $node;
71
  }
72
 
73
+ protected function escapePrintNode(Twig_SupTwg_Node_Print $node, Twig_SupTwg_Environment $env, $type)
74
  {
75
  if (false === $type) {
76
  return $node;
90
  );
91
  }
92
 
93
+ protected function preEscapeFilterNode(Twig_SupTwg_Node_Expression_Filter $filter, Twig_SupTwg_Environment $env)
94
  {
95
  $name = $filter->getNode('filter')->getAttribute('value');
96
 
109
  return $filter;
110
  }
111
 
112
+ protected function isSafeFor($type, Twig_SupTwg_NodeInterface $expression, $env)
113
  {
114
  $safe = $this->safeAnalysis->getSafe($expression);
115
 
116
  if (null === $safe) {
117
  if (null === $this->traverser) {
118
+ $this->traverser = new Twig_SupTwg_NodeTraverser($env, array($this->safeAnalysis));
119
  }
120
 
121
  $this->safeAnalysis->setSafeVars($this->safeVars);
127
  return in_array($type, $safe) || in_array('all', $safe);
128
  }
129
 
130
+ protected function needEscaping(Twig_SupTwg_Environment $env)
131
  {
132
  if (count($this->statusStack)) {
133
  return $this->statusStack[count($this->statusStack) - 1];
136
  return $this->defaultStrategy ? $this->defaultStrategy : false;
137
  }
138
 
139
+ protected function getEscaperFilter($type, Twig_SupTwg_NodeInterface $node)
140
  {
141
  $line = $node->getTemplateLine();
142
+ $name = new Twig_SupTwg_Node_Expression_Constant('escape', $line);
143
+ $args = new Twig_SupTwg_Node(array(new Twig_SupTwg_Node_Expression_Constant((string) $type, $line), new Twig_SupTwg_Node_Expression_Constant(null, $line), new Twig_SupTwg_Node_Expression_Constant(true, $line)));
144
 
145
+ return new Twig_SupTwg_Node_Expression_Filter($node, $name, $args, $line);
146
  }
147
 
148
  public function getPriority()
vendor/Twig/NodeVisitor/Optimizer.php CHANGED
@@ -10,7 +10,7 @@
10
  */
11
 
12
  /**
13
- * Twig_NodeVisitor_Optimizer tries to optimizes the AST.
14
  *
15
  * This visitor is always the last registered one.
16
  *
@@ -21,7 +21,7 @@
21
  *
22
  * @author Fabien Potencier <fabien@symfony.com>
23
  */
24
- class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
25
  {
26
  const OPTIMIZE_ALL = -1;
27
  const OPTIMIZE_NONE = 0;
@@ -47,22 +47,22 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
47
  $this->optimizers = $optimizers;
48
  }
49
 
50
- protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
51
  {
52
  if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
53
  $this->enterOptimizeFor($node, $env);
54
  }
55
 
56
- if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) {
57
  if ($this->inABody) {
58
- if (!$node instanceof Twig_Node_Expression) {
59
- if (get_class($node) !== 'Twig_Node') {
60
  array_unshift($this->prependedNodes, array());
61
  }
62
  } else {
63
  $node = $this->optimizeVariables($node, $env);
64
  }
65
- } elseif ($node instanceof Twig_Node_Body) {
66
  $this->inABody = true;
67
  }
68
  }
@@ -70,9 +70,9 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
70
  return $node;
71
  }
72
 
73
- protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
74
  {
75
- $expression = $node instanceof Twig_Node_Expression;
76
 
77
  if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
78
  $this->leaveOptimizeFor($node, $env);
@@ -84,18 +84,18 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
84
 
85
  $node = $this->optimizePrintNode($node, $env);
86
 
87
- if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) {
88
- if ($node instanceof Twig_Node_Body) {
89
  $this->inABody = false;
90
  } elseif ($this->inABody) {
91
- if (!$expression && get_class($node) !== 'Twig_Node' && $prependedNodes = array_shift($this->prependedNodes)) {
92
  $nodes = array();
93
  foreach (array_unique($prependedNodes) as $name) {
94
- $nodes[] = new Twig_Node_SetTemp($name, $node->getTemplateLine());
95
  }
96
 
97
  $nodes[] = $node;
98
- $node = new Twig_Node($nodes);
99
  }
100
  }
101
  }
@@ -103,12 +103,12 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
103
  return $node;
104
  }
105
 
106
- protected function optimizeVariables(Twig_NodeInterface $node, Twig_Environment $env)
107
  {
108
- if ('Twig_Node_Expression_Name' === get_class($node) && $node->isSimple()) {
109
  $this->prependedNodes[0][] = $node->getAttribute('name');
110
 
111
- return new Twig_Node_Expression_TempName($node->getAttribute('name'), $node->getTemplateLine());
112
  }
113
 
114
  return $node;
@@ -121,18 +121,18 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
121
  *
122
  * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
123
  *
124
- * @return Twig_NodeInterface
125
  */
126
- protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
127
  {
128
- if (!$node instanceof Twig_Node_Print) {
129
  return $node;
130
  }
131
 
132
  $exprNode = $node->getNode('expr');
133
  if (
134
- $exprNode instanceof Twig_Node_Expression_BlockReference ||
135
- $exprNode instanceof Twig_Node_Expression_Parent
136
  ) {
137
  $exprNode->setAttribute('output', true);
138
 
@@ -145,11 +145,11 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
145
  /**
146
  * Removes "raw" filters.
147
  *
148
- * @return Twig_NodeInterface
149
  */
150
- protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
151
  {
152
- if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) {
153
  return $node->getNode('node');
154
  }
155
 
@@ -159,9 +159,9 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
159
  /**
160
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
161
  */
162
- protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
163
  {
164
- if ($node instanceof Twig_Node_For) {
165
  // disable the loop variable by default
166
  $node->setAttribute('with_loop', false);
167
  array_unshift($this->loops, $node);
@@ -175,28 +175,28 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
175
  // when do we need to add the loop variable back?
176
 
177
  // the loop variable is referenced for the current loop
178
- elseif ($node instanceof Twig_Node_Expression_Name && 'loop' === $node->getAttribute('name')) {
179
  $node->setAttribute('always_defined', true);
180
  $this->addLoopToCurrent();
181
  }
182
 
183
  // optimize access to loop targets
184
- elseif ($node instanceof Twig_Node_Expression_Name && in_array($node->getAttribute('name'), $this->loopsTargets)) {
185
  $node->setAttribute('always_defined', true);
186
  }
187
 
188
  // block reference
189
- elseif ($node instanceof Twig_Node_BlockReference || $node instanceof Twig_Node_Expression_BlockReference) {
190
  $this->addLoopToCurrent();
191
  }
192
 
193
  // include without the only attribute
194
- elseif ($node instanceof Twig_Node_Include && !$node->getAttribute('only')) {
195
  $this->addLoopToAll();
196
  }
197
 
198
  // include function without the with_context=false parameter
199
- elseif ($node instanceof Twig_Node_Expression_Function
200
  && 'include' === $node->getAttribute('name')
201
  && (!$node->getNode('arguments')->hasNode('with_context')
202
  || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value')
@@ -206,12 +206,12 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
206
  }
207
 
208
  // the loop variable is referenced via an attribute
209
- elseif ($node instanceof Twig_Node_Expression_GetAttr
210
- && (!$node->getNode('attribute') instanceof Twig_Node_Expression_Constant
211
  || 'parent' === $node->getNode('attribute')->getAttribute('value')
212
  )
213
  && (true === $this->loops[0]->getAttribute('with_loop')
214
- || ($node->getNode('node') instanceof Twig_Node_Expression_Name
215
  && 'loop' === $node->getNode('node')->getAttribute('name')
216
  )
217
  )
@@ -223,9 +223,9 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
223
  /**
224
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
225
  */
226
- protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
227
  {
228
- if ($node instanceof Twig_Node_For) {
229
  array_shift($this->loops);
230
  array_shift($this->loopsTargets);
231
  array_shift($this->loopsTargets);
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_NodeVisitor_Optimizer tries to optimizes the AST.
14
  *
15
  * This visitor is always the last registered one.
16
  *
21
  *
22
  * @author Fabien Potencier <fabien@symfony.com>
23
  */
24
+ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
25
  {
26
  const OPTIMIZE_ALL = -1;
27
  const OPTIMIZE_NONE = 0;
47
  $this->optimizers = $optimizers;
48
  }
49
 
50
+ protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
51
  {
52
  if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
53
  $this->enterOptimizeFor($node, $env);
54
  }
55
 
56
+ if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_SupTwg_Extension_Sandbox')) {
57
  if ($this->inABody) {
58
+ if (!$node instanceof Twig_SupTwg_Node_Expression) {
59
+ if (get_class($node) !== 'Twig_SupTwg_Node') {
60
  array_unshift($this->prependedNodes, array());
61
  }
62
  } else {
63
  $node = $this->optimizeVariables($node, $env);
64
  }
65
+ } elseif ($node instanceof Twig_SupTwg_Node_Body) {
66
  $this->inABody = true;
67
  }
68
  }
70
  return $node;
71
  }
72
 
73
+ protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
74
  {
75
+ $expression = $node instanceof Twig_SupTwg_Node_Expression;
76
 
77
  if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
78
  $this->leaveOptimizeFor($node, $env);
84
 
85
  $node = $this->optimizePrintNode($node, $env);
86
 
87
+ if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_SupTwg_Extension_Sandbox')) {
88
+ if ($node instanceof Twig_SupTwg_Node_Body) {
89
  $this->inABody = false;
90
  } elseif ($this->inABody) {
91
+ if (!$expression && get_class($node) !== 'Twig_SupTwg_Node' && $prependedNodes = array_shift($this->prependedNodes)) {
92
  $nodes = array();
93
  foreach (array_unique($prependedNodes) as $name) {
94
+ $nodes[] = new Twig_SupTwg_Node_SetTemp($name, $node->getTemplateLine());
95
  }
96
 
97
  $nodes[] = $node;
98
+ $node = new Twig_SupTwg_Node($nodes);
99
  }
100
  }
101
  }
103
  return $node;
104
  }
105
 
106
+ protected function optimizeVariables(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
107
  {
108
+ if ('Twig_SupTwg_Node_Expression_Name' === get_class($node) && $node->isSimple()) {
109
  $this->prependedNodes[0][] = $node->getAttribute('name');
110
 
111
+ return new Twig_SupTwg_Node_Expression_TempName($node->getAttribute('name'), $node->getTemplateLine());
112
  }
113
 
114
  return $node;
121
  *
122
  * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
123
  *
124
+ * @return Twig_SupTwg_NodeInterface
125
  */
126
+ protected function optimizePrintNode(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
127
  {
128
+ if (!$node instanceof Twig_SupTwg_Node_Print) {
129
  return $node;
130
  }
131
 
132
  $exprNode = $node->getNode('expr');
133
  if (
134
+ $exprNode instanceof Twig_SupTwg_Node_Expression_BlockReference ||
135
+ $exprNode instanceof Twig_SupTwg_Node_Expression_Parent
136
  ) {
137
  $exprNode->setAttribute('output', true);
138
 
145
  /**
146
  * Removes "raw" filters.
147
  *
148
+ * @return Twig_SupTwg_NodeInterface
149
  */
150
+ protected function optimizeRawFilter(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
151
  {
152
+ if ($node instanceof Twig_SupTwg_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) {
153
  return $node->getNode('node');
154
  }
155
 
159
  /**
160
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
161
  */
162
+ protected function enterOptimizeFor(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
163
  {
164
+ if ($node instanceof Twig_SupTwg_Node_For) {
165
  // disable the loop variable by default
166
  $node->setAttribute('with_loop', false);
167
  array_unshift($this->loops, $node);
175
  // when do we need to add the loop variable back?
176
 
177
  // the loop variable is referenced for the current loop
178
+ elseif ($node instanceof Twig_SupTwg_Node_Expression_Name && 'loop' === $node->getAttribute('name')) {
179
  $node->setAttribute('always_defined', true);
180
  $this->addLoopToCurrent();
181
  }
182
 
183
  // optimize access to loop targets
184
+ elseif ($node instanceof Twig_SupTwg_Node_Expression_Name && in_array($node->getAttribute('name'), $this->loopsTargets)) {
185
  $node->setAttribute('always_defined', true);
186
  }
187
 
188
  // block reference
189
+ elseif ($node instanceof Twig_SupTwg_Node_BlockReference || $node instanceof Twig_SupTwg_Node_Expression_BlockReference) {
190
  $this->addLoopToCurrent();
191
  }
192
 
193
  // include without the only attribute
194
+ elseif ($node instanceof Twig_SupTwg_Node_Include && !$node->getAttribute('only')) {
195
  $this->addLoopToAll();
196
  }
197
 
198
  // include function without the with_context=false parameter
199
+ elseif ($node instanceof Twig_SupTwg_Node_Expression_Function
200
  && 'include' === $node->getAttribute('name')
201
  && (!$node->getNode('arguments')->hasNode('with_context')
202
  || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value')
206
  }
207
 
208
  // the loop variable is referenced via an attribute
209
+ elseif ($node instanceof Twig_SupTwg_Node_Expression_GetAttr
210
+ && (!$node->getNode('attribute') instanceof Twig_SupTwg_Node_Expression_Constant
211
  || 'parent' === $node->getNode('attribute')->getAttribute('value')
212
  )
213
  && (true === $this->loops[0]->getAttribute('with_loop')
214
+ || ($node->getNode('node') instanceof Twig_SupTwg_Node_Expression_Name
215
  && 'loop' === $node->getNode('node')->getAttribute('name')
216
  )
217
  )
223
  /**
224
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
225
  */
226
+ protected function leaveOptimizeFor(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env)
227
  {
228
+ if ($node instanceof Twig_SupTwg_Node_For) {
229
  array_shift($this->loops);
230
  array_shift($this->loopsTargets);
231
  array_shift($this->loopsTargets);
vendor/Twig/NodeVisitor/SafeAnalysis.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @final
14
  */
15
- class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
16
  {
17
  protected $data = array();
18
  protected $safeVars = array();
@@ -22,7 +22,7 @@ class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
22
  $this->safeVars = $safeVars;
23
  }
24
 
25
- public function getSafe(Twig_NodeInterface $node)
26
  {
27
  $hash = spl_object_hash($node);
28
  if (!isset($this->data[$hash])) {
@@ -42,7 +42,7 @@ class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
42
  }
43
  }
44
 
45
- protected function setSafe(Twig_NodeInterface $node, array $safe)
46
  {
47
  $hash = spl_object_hash($node);
48
  if (isset($this->data[$hash])) {
@@ -60,27 +60,27 @@ class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
60
  );
61
  }
62
 
63
- protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
64
  {
65
  return $node;
66
  }
67
 
68
- protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
69
  {
70
- if ($node instanceof Twig_Node_Expression_Constant) {
71
  // constants are marked safe for all
72
  $this->setSafe($node, array('all'));
73
- } elseif ($node instanceof Twig_Node_Expression_BlockReference) {
74
  // blocks are safe by definition
75
  $this->setSafe($node, array('all'));
76
- } elseif ($node instanceof Twig_Node_Expression_Parent) {
77
  // parent block is safe by definition
78
  $this->setSafe($node, array('all'));
79
- } elseif ($node instanceof Twig_Node_Expression_Conditional) {
80
  // intersect safeness of both operands
81
  $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3')));
82
  $this->setSafe($node, $safe);
83
- } elseif ($node instanceof Twig_Node_Expression_Filter) {
84
  // filter expression is safe when the filter is safe
85
  $name = $node->getNode('filter')->getAttribute('value');
86
  $args = $node->getNode('arguments');
@@ -93,7 +93,7 @@ class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
93
  } else {
94
  $this->setSafe($node, array());
95
  }
96
- } elseif ($node instanceof Twig_Node_Expression_Function) {
97
  // function expression is safe when the function is safe
98
  $name = $node->getAttribute('name');
99
  $args = $node->getNode('arguments');
@@ -103,13 +103,13 @@ class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor
103
  } else {
104
  $this->setSafe($node, array());
105
  }
106
- } elseif ($node instanceof Twig_Node_Expression_MethodCall) {
107
  if ($node->getAttribute('safe')) {
108
  $this->setSafe($node, array('all'));
109
  } else {
110
  $this->setSafe($node, array());
111
  }
112
- } elseif ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name) {
113
  $name = $node->getNode('node')->getAttribute('name');
114
  // attributes on template instances are safe
115
  if ('_self' == $name || in_array($name, $this->safeVars)) {
12
  /**
13
  * @final
14
  */
15
+ class Twig_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
16
  {
17
  protected $data = array();
18
  protected $safeVars = array();
22
  $this->safeVars = $safeVars;
23
  }
24
 
25
+ public function getSafe(Twig_SupTwg_NodeInterface $node)
26
  {
27
  $hash = spl_object_hash($node);
28
  if (!isset($this->data[$hash])) {
42
  }
43
  }
44
 
45
+ protected function setSafe(Twig_SupTwg_NodeInterface $node, array $safe)
46
  {
47
  $hash = spl_object_hash($node);
48
  if (isset($this->data[$hash])) {
60
  );
61
  }
62
 
63
+ protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
64
  {
65
  return $node;
66
  }
67
 
68
+ protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
69
  {
70
+ if ($node instanceof Twig_SupTwg_Node_Expression_Constant) {
71
  // constants are marked safe for all
72
  $this->setSafe($node, array('all'));
73
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_BlockReference) {
74
  // blocks are safe by definition
75
  $this->setSafe($node, array('all'));
76
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Parent) {
77
  // parent block is safe by definition
78
  $this->setSafe($node, array('all'));
79
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Conditional) {
80
  // intersect safeness of both operands
81
  $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3')));
82
  $this->setSafe($node, $safe);
83
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Filter) {
84
  // filter expression is safe when the filter is safe
85
  $name = $node->getNode('filter')->getAttribute('value');
86
  $args = $node->getNode('arguments');
93
  } else {
94
  $this->setSafe($node, array());
95
  }
96
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_Function) {
97
  // function expression is safe when the function is safe
98
  $name = $node->getAttribute('name');
99
  $args = $node->getNode('arguments');
103
  } else {
104
  $this->setSafe($node, array());
105
  }
106
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_MethodCall) {
107
  if ($node->getAttribute('safe')) {
108
  $this->setSafe($node, array('all'));
109
  } else {
110
  $this->setSafe($node, array());
111
  }
112
+ } elseif ($node instanceof Twig_SupTwg_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwg_Node_Expression_Name) {
113
  $name = $node->getNode('node')->getAttribute('name');
114
  // attributes on template instances are safe
115
  if ('_self' == $name || in_array($name, $this->safeVars)) {
vendor/Twig/NodeVisitor/Sandbox.php CHANGED
@@ -10,22 +10,22 @@
10
  */
11
 
12
  /**
13
- * Twig_NodeVisitor_Sandbox implements sandboxing.
14
  *
15
  * @final
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor
20
  {
21
  protected $inAModule = false;
22
  protected $tags;
23
  protected $filters;
24
  protected $functions;
25
 
26
- protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
27
  {
28
- if ($node instanceof Twig_Node_Module) {
29
  $this->inAModule = true;
30
  $this->tags = array();
31
  $this->filters = array();
@@ -39,30 +39,30 @@ class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor
39
  }
40
 
41
  // look for filters
42
- if ($node instanceof Twig_Node_Expression_Filter && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) {
43
  $this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
44
  }
45
 
46
  // look for functions
47
- if ($node instanceof Twig_Node_Expression_Function && !isset($this->functions[$node->getAttribute('name')])) {
48
  $this->functions[$node->getAttribute('name')] = $node;
49
  }
50
 
51
  // wrap print to check __toString() calls
52
- if ($node instanceof Twig_Node_Print) {
53
- return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag());
54
  }
55
  }
56
 
57
  return $node;
58
  }
59
 
60
- protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
61
  {
62
- if ($node instanceof Twig_Node_Module) {
63
  $this->inAModule = false;
64
 
65
- $node->setNode('display_start', new Twig_Node(array(new Twig_Node_CheckSecurity($this->filters, $this->tags, $this->functions), $node->getNode('display_start'))));
66
  }
67
 
68
  return $node;
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_NodeVisitor_Sandbox implements sandboxing.
14
  *
15
  * @final
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_NodeVisitor_Sandbox extends Twig_SupTwg_BaseNodeVisitor
20
  {
21
  protected $inAModule = false;
22
  protected $tags;
23
  protected $filters;
24
  protected $functions;
25
 
26
+ protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
27
  {
28
+ if ($node instanceof Twig_SupTwg_Node_Module) {
29
  $this->inAModule = true;
30
  $this->tags = array();
31
  $this->filters = array();
39
  }
40
 
41
  // look for filters
42
+ if ($node instanceof Twig_SupTwg_Node_Expression_Filter && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) {
43
  $this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
44
  }
45
 
46
  // look for functions
47
+ if ($node instanceof Twig_SupTwg_Node_Expression_Function && !isset($this->functions[$node->getAttribute('name')])) {
48
  $this->functions[$node->getAttribute('name')] = $node;
49
  }
50
 
51
  // wrap print to check __toString() calls
52
+ if ($node instanceof Twig_SupTwg_Node_Print) {
53
+ return new Twig_SupTwg_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag());
54
  }
55
  }
56
 
57
  return $node;
58
  }
59
 
60
+ protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
61
  {
62
+ if ($node instanceof Twig_SupTwg_Node_Module) {
63
  $this->inAModule = false;
64
 
65
+ $node->setNode('display_start', new Twig_SupTwg_Node(array(new Twig_SupTwg_Node_CheckSecurity($this->filters, $this->tags, $this->functions), $node->getNode('display_start'))));
66
  }
67
 
68
  return $node;
vendor/Twig/NodeVisitorInterface.php CHANGED
@@ -10,25 +10,25 @@
10
  */
11
 
12
  /**
13
- * Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_NodeVisitorInterface
18
  {
19
  /**
20
  * Called before child nodes are visited.
21
  *
22
- * @return Twig_NodeInterface The modified node
23
  */
24
- public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
25
 
26
  /**
27
  * Called after child nodes are visited.
28
  *
29
- * @return Twig_NodeInterface|false The modified node or false if the node must be removed
30
  */
31
- public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
32
 
33
  /**
34
  * Returns the priority for this visitor.
10
  */
11
 
12
  /**
13
+ * Twig_SupTwg_NodeVisitorInterface is the interface the all node visitor classes must implement.
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_NodeVisitorInterface
18
  {
19
  /**
20
  * Called before child nodes are visited.
21
  *
22
+ * @return Twig_SupTwg_NodeInterface The modified node
23
  */
24
+ public function enterNode(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env);
25
 
26
  /**
27
  * Called after child nodes are visited.
28
  *
29
+ * @return Twig_SupTwg_NodeInterface|false The modified node or false if the node must be removed
30
  */
31
+ public function leaveNode(Twig_SupTwg_NodeInterface $node, Twig_SupTwg_Environment $env);
32
 
33
  /**
34
  * Returns the priority for this visitor.
vendor/Twig/Parser.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
- class Twig_Parser implements Twig_ParserInterface
19
  {
20
  protected $stack = array();
21
  protected $stream;
@@ -32,7 +32,7 @@ class Twig_Parser implements Twig_ParserInterface
32
  protected $traits;
33
  protected $embeddedTemplates = array();
34
 
35
- public function __construct(Twig_Environment $env)
36
  {
37
  $this->env = $env;
38
  }
@@ -62,7 +62,7 @@ class Twig_Parser implements Twig_ParserInterface
62
  return $this->stream->getSourceContext()->getName();
63
  }
64
 
65
- public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false)
66
  {
67
  // push all variables into the stack to keep the current state of the parser
68
  // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336
@@ -87,7 +87,7 @@ class Twig_Parser implements Twig_ParserInterface
87
  }
88
 
89
  if (null === $this->expressionParser) {
90
- $this->expressionParser = new Twig_ExpressionParser($this, $this->env);
91
  }
92
 
93
  $this->stream = $stream;
@@ -103,9 +103,9 @@ class Twig_Parser implements Twig_ParserInterface
103
  $body = $this->subparse($test, $dropNeedle);
104
 
105
  if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) {
106
- $body = new Twig_Node();
107
  }
108
- } catch (Twig_Error_Syntax $e) {
109
  if (!$e->getSourceContext()) {
110
  $e->setSourceContext($this->stream->getSourceContext());
111
  }
@@ -117,9 +117,9 @@ class Twig_Parser implements Twig_ParserInterface
117
  throw $e;
118
  }
119
 
120
- $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext());
121
 
122
- $traverser = new Twig_NodeTraverser($this->env, $this->visitors);
123
 
124
  $node = $traverser->traverse($node);
125
 
@@ -137,24 +137,24 @@ class Twig_Parser implements Twig_ParserInterface
137
  $rv = array();
138
  while (!$this->stream->isEOF()) {
139
  switch ($this->getCurrentToken()->getType()) {
140
- case Twig_Token::TEXT_TYPE:
141
  $token = $this->stream->next();
142
- $rv[] = new Twig_Node_Text($token->getValue(), $token->getLine());
143
  break;
144
 
145
- case Twig_Token::VAR_START_TYPE:
146
  $token = $this->stream->next();
147
  $expr = $this->expressionParser->parseExpression();
148
- $this->stream->expect(Twig_Token::VAR_END_TYPE);
149
- $rv[] = new Twig_Node_Print($expr, $token->getLine());
150
  break;
151
 
152
- case Twig_Token::BLOCK_START_TYPE:
153
  $this->stream->next();
154
  $token = $this->getCurrentToken();
155
 
156
- if ($token->getType() !== Twig_Token::NAME_TYPE) {
157
- throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
158
  }
159
 
160
  if (null !== $test && call_user_func($test, $token)) {
@@ -166,19 +166,19 @@ class Twig_Parser implements Twig_ParserInterface
166
  return $rv[0];
167
  }
168
 
169
- return new Twig_Node($rv, array(), $lineno);
170
  }
171
 
172
  $subparser = $this->handlers->getTokenParser($token->getValue());
173
  if (null === $subparser) {
174
  if (null !== $test) {
175
- $e = new Twig_Error_Syntax(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
176
 
177
- if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) {
178
  $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno));
179
  }
180
  } else {
181
- $e = new Twig_Error_Syntax(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
182
  $e->addSuggestions($token->getValue(), array_keys($this->env->getTags()));
183
  }
184
 
@@ -194,7 +194,7 @@ class Twig_Parser implements Twig_ParserInterface
194
  break;
195
 
196
  default:
197
- throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext());
198
  }
199
  }
200
 
@@ -202,7 +202,7 @@ class Twig_Parser implements Twig_ParserInterface
202
  return $rv[0];
203
  }
204
 
205
- return new Twig_Node($rv, array(), $lineno);
206
  }
207
 
208
  /**
@@ -218,7 +218,7 @@ class Twig_Parser implements Twig_ParserInterface
218
  /**
219
  * @deprecated since 1.27 (to be removed in 2.0)
220
  */
221
- public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
222
  {
223
  @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
224
 
@@ -255,9 +255,9 @@ class Twig_Parser implements Twig_ParserInterface
255
  return $this->blocks[$name];
256
  }
257
 
258
- public function setBlock($name, Twig_Node_Block $value)
259
  {
260
- $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getTemplateLine());
261
  }
262
 
263
  public function hasMacro($name)
@@ -265,10 +265,10 @@ class Twig_Parser implements Twig_ParserInterface
265
  return isset($this->macros[$name]);
266
  }
267
 
268
- public function setMacro($name, Twig_Node_Macro $node)
269
  {
270
  if ($this->isReservedMacroName($name)) {
271
- throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext());
272
  }
273
 
274
  $this->macros[$name] = $node;
@@ -301,14 +301,14 @@ class Twig_Parser implements Twig_ParserInterface
301
  return count($this->traits) > 0;
302
  }
303
 
304
- public function embedTemplate(Twig_Node_Module $template)
305
  {
306
  $template->setIndex(mt_rand());
307
 
308
  $this->embeddedTemplates[] = $template;
309
  }
310
 
311
- public function addImportedSymbol($type, $alias, $name = null, Twig_Node_Expression $node = null)
312
  {
313
  $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node);
314
  }
@@ -338,7 +338,7 @@ class Twig_Parser implements Twig_ParserInterface
338
  }
339
 
340
  /**
341
- * @return Twig_ExpressionParser
342
  */
343
  public function getExpressionParser()
344
  {
@@ -356,7 +356,7 @@ class Twig_Parser implements Twig_ParserInterface
356
  }
357
 
358
  /**
359
- * @return Twig_TokenStream
360
  */
361
  public function getStream()
362
  {
@@ -364,34 +364,34 @@ class Twig_Parser implements Twig_ParserInterface
364
  }
365
 
366
  /**
367
- * @return Twig_Token
368
  */
369
  public function getCurrentToken()
370
  {
371
  return $this->stream->getCurrent();
372
  }
373
 
374
- protected function filterBodyNodes(Twig_NodeInterface $node)
375
  {
376
  // check that the body does not contain non-empty output nodes
377
  if (
378
- ($node instanceof Twig_Node_Text && !ctype_space($node->getAttribute('data')))
379
  ||
380
- (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface)
381
  ) {
382
  if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) {
383
- throw new Twig_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext());
384
  }
385
 
386
- throw new Twig_Error_Syntax('A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext());
387
  }
388
 
389
  // bypass nodes that will "capture" the output
390
- if ($node instanceof Twig_NodeCaptureInterface) {
391
  return $node;
392
  }
393
 
394
- if ($node instanceof Twig_NodeOutputInterface) {
395
  return;
396
  }
397
 
15
  *
16
  * @author Fabien Potencier <fabien@symfony.com>
17
  */
18
+ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
19
  {
20
  protected $stack = array();
21
  protected $stream;
32
  protected $traits;
33
  protected $embeddedTemplates = array();
34
 
35
+ public function __construct(Twig_SupTwg_Environment $env)
36
  {
37
  $this->env = $env;
38
  }
62
  return $this->stream->getSourceContext()->getName();
63
  }
64
 
65
+ public function parse(Twig_SupTwg_TokenStream $stream, $test = null, $dropNeedle = false)
66
  {
67
  // push all variables into the stack to keep the current state of the parser
68
  // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336
87
  }
88
 
89
  if (null === $this->expressionParser) {
90
+ $this->expressionParser = new Twig_SupTwg_ExpressionParser($this, $this->env);
91
  }
92
 
93
  $this->stream = $stream;
103
  $body = $this->subparse($test, $dropNeedle);
104
 
105
  if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) {
106
+ $body = new Twig_SupTwg_Node();
107
  }
108
+ } catch (Twig_SupTwg_Error_Syntax $e) {
109
  if (!$e->getSourceContext()) {
110
  $e->setSourceContext($this->stream->getSourceContext());
111
  }
117
  throw $e;
118
  }
119
 
120
+ $node = new Twig_SupTwg_Node_Module(new Twig_SupTwg_Node_Body(array($body)), $this->parent, new Twig_SupTwg_Node($this->blocks), new Twig_SupTwg_Node($this->macros), new Twig_SupTwg_Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext());
121
 
122
+ $traverser = new Twig_SupTwg_NodeTraverser($this->env, $this->visitors);
123
 
124
  $node = $traverser->traverse($node);
125
 
137
  $rv = array();
138
  while (!$this->stream->isEOF()) {
139
  switch ($this->getCurrentToken()->getType()) {
140
+ case Twig_SupTwg_Token::TEXT_TYPE:
141
  $token = $this->stream->next();
142
+ $rv[] = new Twig_SupTwg_Node_Text($token->getValue(), $token->getLine());
143
  break;
144
 
145
+ case Twig_SupTwg_Token::VAR_START_TYPE:
146
  $token = $this->stream->next();
147
  $expr = $this->expressionParser->parseExpression();
148
+ $this->stream->expect(Twig_SupTwg_Token::VAR_END_TYPE);
149
+ $rv[] = new Twig_SupTwg_Node_Print($expr, $token->getLine());
150
  break;
151
 
152
+ case Twig_SupTwg_Token::BLOCK_START_TYPE:
153
  $this->stream->next();
154
  $token = $this->getCurrentToken();
155
 
156
+ if ($token->getType() !== Twig_SupTwg_Token::NAME_TYPE) {
157
+ throw new Twig_SupTwg_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
158
  }
159
 
160
  if (null !== $test && call_user_func($test, $token)) {
166
  return $rv[0];
167
  }
168
 
169
+ return new Twig_SupTwg_Node($rv, array(), $lineno);
170
  }
171
 
172
  $subparser = $this->handlers->getTokenParser($token->getValue());
173
  if (null === $subparser) {
174
  if (null !== $test) {
175
+ $e = new Twig_SupTwg_Error_Syntax(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
176
 
177
+ if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_SupTwg_TokenParserInterface) {
178
  $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno));
179
  }
180
  } else {
181
+ $e = new Twig_SupTwg_Error_Syntax(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
182
  $e->addSuggestions($token->getValue(), array_keys($this->env->getTags()));
183
  }
184
 
194
  break;
195
 
196
  default:
197
+ throw new Twig_SupTwg_Error_Syntax('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext());
198
  }
199
  }
200
 
202
  return $rv[0];
203
  }
204
 
205
+ return new Twig_SupTwg_Node($rv, array(), $lineno);
206
  }
207
 
208
  /**
218
  /**
219
  * @deprecated since 1.27 (to be removed in 2.0)
220
  */
221
+ public function addNodeVisitor(Twig_SupTwg_NodeVisitorInterface $visitor)
222
  {
223
  @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
224
 
255
  return $this->blocks[$name];
256
  }
257
 
258
+ public function setBlock($name, Twig_SupTwg_Node_Block $value)
259
  {
260
+ $this->blocks[$name] = new Twig_SupTwg_Node_Body(array($value), array(), $value->getTemplateLine());
261
  }
262
 
263
  public function hasMacro($name)
265
  return isset($this->macros[$name]);
266
  }
267
 
268
+ public function setMacro($name, Twig_SupTwg_Node_Macro $node)
269
  {
270
  if ($this->isReservedMacroName($name)) {
271
+ throw new Twig_SupTwg_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext());
272
  }
273
 
274
  $this->macros[$name] = $node;
301
  return count($this->traits) > 0;
302
  }
303
 
304
+ public function embedTemplate(Twig_SupTwg_Node_Module $template)
305
  {
306
  $template->setIndex(mt_rand());
307
 
308
  $this->embeddedTemplates[] = $template;
309
  }
310
 
311
+ public function addImportedSymbol($type, $alias, $name = null, Twig_SupTwg_Node_Expression $node = null)
312
  {
313
  $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node);
314
  }
338
  }
339
 
340
  /**
341
+ * @return Twig_SupTwg_ExpressionParser
342
  */
343
  public function getExpressionParser()
344
  {
356
  }
357
 
358
  /**
359
+ * @return Twig_SupTwg_TokenStream
360
  */
361
  public function getStream()
362
  {
364
  }
365
 
366
  /**
367
+ * @return Twig_SupTwg_Token
368
  */
369
  public function getCurrentToken()
370
  {
371
  return $this->stream->getCurrent();
372
  }
373
 
374
+ protected function filterBodyNodes(Twig_SupTwg_NodeInterface $node)
375
  {
376
  // check that the body does not contain non-empty output nodes
377
  if (
378
+ ($node instanceof Twig_SupTwg_Node_Text && !ctype_space($node->getAttribute('data')))
379
  ||
380
+ (!$node instanceof Twig_SupTwg_Node_Text && !$node instanceof Twig_SupTwg_Node_BlockReference && $node instanceof Twig_SupTwg_NodeOutputInterface)
381
  ) {
382
  if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) {
383
+ throw new Twig_SupTwg_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext());
384
  }
385
 
386
+ throw new Twig_SupTwg_Error_Syntax('A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext());
387
  }
388
 
389
  // bypass nodes that will "capture" the output
390
+ if ($node instanceof Twig_SupTwg_NodeCaptureInterface) {
391
  return $node;
392
  }
393
 
394
+ if ($node instanceof Twig_SupTwg_NodeOutputInterface) {
395
  return;
396
  }
397
 
vendor/Twig/ParserInterface.php CHANGED
@@ -16,14 +16,14 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_ParserInterface
20
  {
21
  /**
22
  * Converts a token stream to a node tree.
23
  *
24
- * @return Twig_Node_Module
25
  *
26
- * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
27
  */
28
- public function parse(Twig_TokenStream $stream);
29
  }
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_ParserInterface
20
  {
21
  /**
22
  * Converts a token stream to a node tree.
23
  *
24
+ * @return Twig_SupTwg_Node_Module
25
  *
26
+ * @throws Twig_SupTwg_Error_Syntax When the token stream is syntactically or semantically wrong
27
  */
28
+ public function parse(Twig_SupTwg_TokenStream $stream);
29
  }
vendor/Twig/Profiler/Dumper/Blackfire.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Profiler_Dumper_Blackfire
18
  {
19
- public function dump(Twig_Profiler_Profile $profile)
20
  {
21
  $data = array();
22
  $this->dumpProfile('main()', $profile, $data);
@@ -38,7 +38,7 @@ EOF;
38
  return $str;
39
  }
40
 
41
- private function dumpChildren($parent, Twig_Profiler_Profile $profile, &$data)
42
  {
43
  foreach ($profile as $p) {
44
  if ($p->isTemplate()) {
@@ -51,7 +51,7 @@ EOF;
51
  }
52
  }
53
 
54
- private function dumpProfile($edge, Twig_Profiler_Profile $profile, &$data)
55
  {
56
  if (isset($data[$edge])) {
57
  $data[$edge]['ct'] += 1;
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Profiler_Dumper_Blackfire
18
  {
19
+ public function dump(Twig_SupTwg_Profiler_Profile $profile)
20
  {
21
  $data = array();
22
  $this->dumpProfile('main()', $profile, $data);
38
  return $str;
39
  }
40
 
41
+ private function dumpChildren($parent, Twig_SupTwg_Profiler_Profile $profile, &$data)
42
  {
43
  foreach ($profile as $p) {
44
  if ($p->isTemplate()) {
51
  }
52
  }
53
 
54
+ private function dumpProfile($edge, Twig_SupTwg_Profiler_Profile $profile, &$data)
55
  {
56
  if (isset($data[$edge])) {
57
  $data[$edge]['ct'] += 1;
vendor/Twig/Profiler/Dumper/Html.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text
18
  {
19
  private static $colors = array(
20
  'block' => '#dfd',
@@ -23,22 +23,22 @@ class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text
23
  'big' => '#d44',
24
  );
25
 
26
- public function dump(Twig_Profiler_Profile $profile)
27
  {
28
  return '<pre>'.parent::dump($profile).'</pre>';
29
  }
30
 
31
- protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix)
32
  {
33
  return sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());
34
  }
35
 
36
- protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
37
  {
38
  return sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName());
39
  }
40
 
41
- protected function formatTime(Twig_Profiler_Profile $profile, $percent)
42
  {
43
  return sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent);
44
  }
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Profiler_Dumper_Html extends Twig_SupTwg_Profiler_Dumper_Text
18
  {
19
  private static $colors = array(
20
  'block' => '#dfd',
23
  'big' => '#d44',
24
  );
25
 
26
+ public function dump(Twig_SupTwg_Profiler_Profile $profile)
27
  {
28
  return '<pre>'.parent::dump($profile).'</pre>';
29
  }
30
 
31
+ protected function formatTemplate(Twig_SupTwg_Profiler_Profile $profile, $prefix)
32
  {
33
  return sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());
34
  }
35
 
36
+ protected function formatNonTemplate(Twig_SupTwg_Profiler_Profile $profile, $prefix)
37
  {
38
  return sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName());
39
  }
40
 
41
+ protected function formatTime(Twig_SupTwg_Profiler_Profile $profile, $percent)
42
  {
43
  return sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent);
44
  }
vendor/Twig/Profiler/Dumper/Text.php CHANGED
@@ -14,31 +14,31 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Profiler_Dumper_Text
18
  {
19
  private $root;
20
 
21
- public function dump(Twig_Profiler_Profile $profile)
22
  {
23
  return $this->dumpProfile($profile);
24
  }
25
 
26
- protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix)
27
  {
28
  return sprintf('%s└ %s', $prefix, $profile->getTemplate());
29
  }
30
 
31
- protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
32
  {
33
  return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
34
  }
35
 
36
- protected function formatTime(Twig_Profiler_Profile $profile, $percent)
37
  {
38
  return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
39
  }
40
 
41
- private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false)
42
  {
43
  if ($profile->isRoot()) {
44
  $this->root = $profile->getDuration();
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Profiler_Dumper_Text
18
  {
19
  private $root;
20
 
21
+ public function dump(Twig_SupTwg_Profiler_Profile $profile)
22
  {
23
  return $this->dumpProfile($profile);
24
  }
25
 
26
+ protected function formatTemplate(Twig_SupTwg_Profiler_Profile $profile, $prefix)
27
  {
28
  return sprintf('%s└ %s', $prefix, $profile->getTemplate());
29
  }
30
 
31
+ protected function formatNonTemplate(Twig_SupTwg_Profiler_Profile $profile, $prefix)
32
  {
33
  return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
34
  }
35
 
36
+ protected function formatTime(Twig_SupTwg_Profiler_Profile $profile, $percent)
37
  {
38
  return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
39
  }
40
 
41
+ private function dumpProfile(Twig_SupTwg_Profiler_Profile $profile, $prefix = '', $sibling = false)
42
  {
43
  if ($profile->isRoot()) {
44
  $this->root = $profile->getDuration();
vendor/Twig/Profiler/Node/EnterProfile.php CHANGED
@@ -14,20 +14,20 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Profiler_Node_EnterProfile extends Twig_Node
18
  {
19
  public function __construct($extensionName, $type, $name, $varName)
20
  {
21
  parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName));
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name')))
28
  ->repr($this->getAttribute('extension_name'))
29
  ->raw(");\n")
30
- ->write(sprintf('$%s->enter($%s = new Twig_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof'))
31
  ->repr($this->getAttribute('type'))
32
  ->raw(', ')
33
  ->repr($this->getAttribute('name'))
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Profiler_Node_EnterProfile extends Twig_SupTwg_Node
18
  {
19
  public function __construct($extensionName, $type, $name, $varName)
20
  {
21
  parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName));
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name')))
28
  ->repr($this->getAttribute('extension_name'))
29
  ->raw(");\n")
30
+ ->write(sprintf('$%s->enter($%s = new Twig_SupTwg_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof'))
31
  ->repr($this->getAttribute('type'))
32
  ->raw(', ')
33
  ->repr($this->getAttribute('name'))
vendor/Twig/Profiler/Node/LeaveProfile.php CHANGED
@@ -14,14 +14,14 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Profiler_Node_LeaveProfile extends Twig_Node
18
  {
19
  public function __construct($varName)
20
  {
21
  parent::__construct(array(), array('var_name' => $varName));
22
  }
23
 
24
- public function compile(Twig_Compiler $compiler)
25
  {
26
  $compiler
27
  ->write("\n")
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Profiler_Node_LeaveProfile extends Twig_SupTwg_Node
18
  {
19
  public function __construct($varName)
20
  {
21
  parent::__construct(array(), array('var_name' => $varName));
22
  }
23
 
24
+ public function compile(Twig_SupTwg_Compiler $compiler)
25
  {
26
  $compiler
27
  ->write("\n")
vendor/Twig/Profiler/NodeVisitor/Profiler.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
18
  {
19
  private $extensionName;
20
 
@@ -23,30 +23,30 @@ class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
23
  $this->extensionName = $extensionName;
24
  }
25
 
26
- protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
27
  {
28
  return $node;
29
  }
30
 
31
- protected function doLeaveNode(Twig_Node $node, Twig_Environment $env)
32
  {
33
- if ($node instanceof Twig_Node_Module) {
34
  $varName = $this->getVarName();
35
- $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start'))));
36
- $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end'))));
37
- } elseif ($node instanceof Twig_Node_Block) {
38
  $varName = $this->getVarName();
39
- $node->setNode('body', new Twig_Node_Body(array(
40
- new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName),
41
  $node->getNode('body'),
42
- new Twig_Profiler_Node_LeaveProfile($varName),
43
  )));
44
- } elseif ($node instanceof Twig_Node_Macro) {
45
  $varName = $this->getVarName();
46
- $node->setNode('body', new Twig_Node_Body(array(
47
- new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName),
48
  $node->getNode('body'),
49
- new Twig_Profiler_Node_LeaveProfile($varName),
50
  )));
51
  }
52
 
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Profiler_NodeVisitor_Profiler extends Twig_SupTwg_BaseNodeVisitor
18
  {
19
  private $extensionName;
20
 
23
  $this->extensionName = $extensionName;
24
  }
25
 
26
+ protected function doEnterNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
27
  {
28
  return $node;
29
  }
30
 
31
+ protected function doLeaveNode(Twig_SupTwg_Node $node, Twig_SupTwg_Environment $env)
32
  {
33
+ if ($node instanceof Twig_SupTwg_Node_Module) {
34
  $varName = $this->getVarName();
35
+ $node->setNode('display_start', new Twig_SupTwg_Node(array(new Twig_SupTwg_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwg_Profiler_Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start'))));
36
+ $node->setNode('display_end', new Twig_SupTwg_Node(array(new Twig_SupTwg_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end'))));
37
+ } elseif ($node instanceof Twig_SupTwg_Node_Block) {
38
  $varName = $this->getVarName();
39
+ $node->setNode('body', new Twig_SupTwg_Node_Body(array(
40
+ new Twig_SupTwg_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwg_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName),
41
  $node->getNode('body'),
42
+ new Twig_SupTwg_Profiler_Node_LeaveProfile($varName),
43
  )));
44
+ } elseif ($node instanceof Twig_SupTwg_Node_Macro) {
45
  $varName = $this->getVarName();
46
+ $node->setNode('body', new Twig_SupTwg_Node_Body(array(
47
+ new Twig_SupTwg_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwg_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName),
48
  $node->getNode('body'),
49
+ new Twig_SupTwg_Profiler_Node_LeaveProfile($varName),
50
  )));
51
  }
52
 
vendor/Twig/Profiler/Profile.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Profiler_Profile implements IteratorAggregate, Serializable
18
  {
19
  const ROOT = 'ROOT';
20
  const BLOCK = 'block';
@@ -76,7 +76,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
76
  return $this->profiles;
77
  }
78
 
79
- public function addProfile(Twig_Profiler_Profile $profile)
80
  {
81
  $this->profiles[] = $profile;
82
  }
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Profiler_Profile implements IteratorAggregate, Serializable
18
  {
19
  const ROOT = 'ROOT';
20
  const BLOCK = 'block';
76
  return $this->profiles;
77
  }
78
 
79
+ public function addProfile(Twig_SupTwg_Profiler_Profile $profile)
80
  {
81
  $this->profiles[] = $profile;
82
  }
vendor/Twig/RuntimeLoaderInterface.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_RuntimeLoaderInterface
18
  {
19
  /**
20
  * Creates the runtime implementation of a Twig element (filter/function/test).
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_RuntimeLoaderInterface
18
  {
19
  /**
20
  * Creates the runtime implementation of a Twig element (filter/function/test).
vendor/Twig/Sandbox/SecurityError.php CHANGED
@@ -14,6 +14,6 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- class Twig_Sandbox_SecurityError extends Twig_Error
18
  {
19
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityError extends Twig_SupTwg_Error
18
  {
19
  }
vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
- class Twig_Sandbox_SecurityNotAllowedFilterError extends Twig_Sandbox_SecurityError
18
  {
19
  private $filterName;
20
 
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityNotAllowedFilterError extends Twig_SupTwg_Sandbox_SecurityError
18
  {
19
  private $filterName;
20
 
vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
- class Twig_Sandbox_SecurityNotAllowedFunctionError extends Twig_Sandbox_SecurityError
18
  {
19
  private $functionName;
20
 
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityNotAllowedFunctionError extends Twig_SupTwg_Sandbox_SecurityError
18
  {
19
  private $functionName;
20
 
vendor/Twig/Sandbox/SecurityNotAllowedMethodError.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Kit Burton-Senior <mail@kitbs.com>
16
  */
17
- class Twig_Sandbox_SecurityNotAllowedMethodError extends Twig_Sandbox_SecurityError
18
  {
19
  private $className;
20
  private $methodName;
14
  *
15
  * @author Kit Burton-Senior <mail@kitbs.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityNotAllowedMethodError extends Twig_SupTwg_Sandbox_SecurityError
18
  {
19
  private $className;
20
  private $methodName;
vendor/Twig/Sandbox/SecurityNotAllowedPropertyError.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Kit Burton-Senior <mail@kitbs.com>
16
  */
17
- class Twig_Sandbox_SecurityNotAllowedPropertyError extends Twig_Sandbox_SecurityError
18
  {
19
  private $className;
20
  private $propertyName;
14
  *
15
  * @author Kit Burton-Senior <mail@kitbs.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityNotAllowedPropertyError extends Twig_SupTwg_Sandbox_SecurityError
18
  {
19
  private $className;
20
  private $propertyName;
vendor/Twig/Sandbox/SecurityNotAllowedTagError.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
- class Twig_Sandbox_SecurityNotAllowedTagError extends Twig_Sandbox_SecurityError
18
  {
19
  private $tagName;
20
 
14
  *
15
  * @author Martin Hasoň <martin.hason@gmail.com>
16
  */
17
+ class Twig_SupTwg_Sandbox_SecurityNotAllowedTagError extends Twig_SupTwg_Sandbox_SecurityError
18
  {
19
  private $tagName;
20
 
vendor/Twig/Sandbox/SecurityPolicy.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface
20
  {
21
  protected $allowedTags;
22
  protected $allowedFilters;
@@ -65,26 +65,26 @@ class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterfac
65
  {
66
  foreach ($tags as $tag) {
67
  if (!in_array($tag, $this->allowedTags)) {
68
- throw new Twig_Sandbox_SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag);
69
  }
70
  }
71
 
72
  foreach ($filters as $filter) {
73
  if (!in_array($filter, $this->allowedFilters)) {
74
- throw new Twig_Sandbox_SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter);
75
  }
76
  }
77
 
78
  foreach ($functions as $function) {
79
  if (!in_array($function, $this->allowedFunctions)) {
80
- throw new Twig_Sandbox_SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function);
81
  }
82
  }
83
  }
84
 
85
  public function checkMethodAllowed($obj, $method)
86
  {
87
- if ($obj instanceof Twig_TemplateInterface || $obj instanceof Twig_Markup) {
88
  return true;
89
  }
90
 
@@ -100,7 +100,7 @@ class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterfac
100
 
101
  if (!$allowed) {
102
  $class = get_class($obj);
103
- throw new Twig_Sandbox_SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method);
104
  }
105
  }
106
 
@@ -117,7 +117,7 @@ class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterfac
117
 
118
  if (!$allowed) {
119
  $class = get_class($obj);
120
- throw new Twig_Sandbox_SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property);
121
  }
122
  }
123
  }
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_Sandbox_SecurityPolicy implements Twig_SupTwg_Sandbox_SecurityPolicyInterface
20
  {
21
  protected $allowedTags;
22
  protected $allowedFilters;
65
  {
66
  foreach ($tags as $tag) {
67
  if (!in_array($tag, $this->allowedTags)) {
68
+ throw new Twig_SupTwg_Sandbox_SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag);
69
  }
70
  }
71
 
72
  foreach ($filters as $filter) {
73
  if (!in_array($filter, $this->allowedFilters)) {
74
+ throw new Twig_SupTwg_Sandbox_SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter);
75
  }
76
  }
77
 
78
  foreach ($functions as $function) {
79
  if (!in_array($function, $this->allowedFunctions)) {
80
+ throw new Twig_SupTwg_Sandbox_SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function);
81
  }
82
  }
83
  }
84
 
85
  public function checkMethodAllowed($obj, $method)
86
  {
87
+ if ($obj instanceof Twig_SupTwg_TemplateInterface || $obj instanceof Twig_SupTwg_Markup) {
88
  return true;
89
  }
90
 
100
 
101
  if (!$allowed) {
102
  $class = get_class($obj);
103
+ throw new Twig_SupTwg_Sandbox_SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method);
104
  }
105
  }
106
 
117
 
118
  if (!$allowed) {
119
  $class = get_class($obj);
120
+ throw new Twig_SupTwg_Sandbox_SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property);
121
  }
122
  }
123
  }
vendor/Twig/Sandbox/SecurityPolicyInterface.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_Sandbox_SecurityPolicyInterface
18
  {
19
  public function checkSecurity($tags, $filters, $functions);
20
 
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_Sandbox_SecurityPolicyInterface
18
  {
19
  public function checkSecurity($tags, $filters, $functions);
20
 
vendor/Twig/SimpleFilter.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_SimpleFilter
20
  {
21
  protected $name;
22
  protected $callable;
@@ -35,7 +35,7 @@ class Twig_SimpleFilter
35
  'is_safe_callback' => null,
36
  'pre_escape' => null,
37
  'preserves_safety' => null,
38
- 'node_class' => 'Twig_Node_Expression_Filter',
39
  'deprecated' => false,
40
  'alternative' => null,
41
  ), $options);
@@ -76,7 +76,7 @@ class Twig_SimpleFilter
76
  return $this->options['needs_context'];
77
  }
78
 
79
- public function getSafe(Twig_Node $filterArgs)
80
  {
81
  if (null !== $this->options['is_safe']) {
82
  return $this->options['is_safe'];
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_SimpleFilter
20
  {
21
  protected $name;
22
  protected $callable;
35
  'is_safe_callback' => null,
36
  'pre_escape' => null,
37
  'preserves_safety' => null,
38
+ 'node_class' => 'Twig_SupTwg_Node_Expression_Filter',
39
  'deprecated' => false,
40
  'alternative' => null,
41
  ), $options);
76
  return $this->options['needs_context'];
77
  }
78
 
79
+ public function getSafe(Twig_SupTwg_Node $filterArgs)
80
  {
81
  if (null !== $this->options['is_safe']) {
82
  return $this->options['is_safe'];
vendor/Twig/SimpleFunction.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_SimpleFunction
20
  {
21
  protected $name;
22
  protected $callable;
@@ -33,7 +33,7 @@ class Twig_SimpleFunction
33
  'is_variadic' => false,
34
  'is_safe' => null,
35
  'is_safe_callback' => null,
36
- 'node_class' => 'Twig_Node_Expression_Function',
37
  'deprecated' => false,
38
  'alternative' => null,
39
  ), $options);
@@ -74,7 +74,7 @@ class Twig_SimpleFunction
74
  return $this->options['needs_context'];
75
  }
76
 
77
- public function getSafe(Twig_Node $functionArgs)
78
  {
79
  if (null !== $this->options['is_safe']) {
80
  return $this->options['is_safe'];
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_SimpleFunction
20
  {
21
  protected $name;
22
  protected $callable;
33
  'is_variadic' => false,
34
  'is_safe' => null,
35
  'is_safe_callback' => null,
36
+ 'node_class' => 'Twig_SupTwg_Node_Expression_Function',
37
  'deprecated' => false,
38
  'alternative' => null,
39
  ), $options);
74
  return $this->options['needs_context'];
75
  }
76
 
77
+ public function getSafe(Twig_SupTwg_Node $functionArgs)
78
  {
79
  if (null !== $this->options['is_safe']) {
80
  return $this->options['is_safe'];
vendor/Twig/SimpleTest.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_SimpleTest
20
  {
21
  protected $name;
22
  protected $callable;
@@ -28,7 +28,7 @@ class Twig_SimpleTest
28
  $this->callable = $callable;
29
  $this->options = array_merge(array(
30
  'is_variadic' => false,
31
- 'node_class' => 'Twig_Node_Expression_Test',
32
  'deprecated' => false,
33
  'alternative' => null,
34
  ), $options);
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_SimpleTest
20
  {
21
  protected $name;
22
  protected $callable;
28
  $this->callable = $callable;
29
  $this->options = array_merge(array(
30
  'is_variadic' => false,
31
+ 'node_class' => 'Twig_SupTwg_Node_Expression_Test',
32
  'deprecated' => false,
33
  'alternative' => null,
34
  ), $options);
vendor/Twig/Source.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
- class Twig_Source
20
  {
21
  private $code;
22
  private $name;
16
  *
17
  * @author Fabien Potencier <fabien@symfony.com>
18
  */
19
+ class Twig_SupTwg_Source
20
  {
21
  private $code;
22
  private $name;
vendor/Twig/SourceContextLoaderInterface.php CHANGED
@@ -16,16 +16,16 @@
16
  *
17
  * @deprecated since 1.27 (to be removed in 3.0)
18
  */
19
- interface Twig_SourceContextLoaderInterface
20
  {
21
  /**
22
  * Returns the source context for a given template logical name.
23
  *
24
  * @param string $name The template logical name
25
  *
26
- * @return Twig_Source
27
  *
28
- * @throws Twig_Error_Loader When $name is not found
29
  */
30
  public function getSourceContext($name);
31
  }
16
  *
17
  * @deprecated since 1.27 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_SourceContextLoaderInterface
20
  {
21
  /**
22
  * Returns the source context for a given template logical name.
23
  *
24
  * @param string $name The template logical name
25
  *
26
+ * @return Twig_SupTwg_Source
27
  *
28
+ * @throws Twig_SupTwg_Error_Loader When $name is not found
29
  */
30
  public function getSourceContext($name);
31
  }
vendor/Twig/Template.php CHANGED
@@ -15,13 +15,13 @@
15
  *
16
  * This class is an implementation detail of how template compilation currently
17
  * works, which might change. It should never be used directly. Use $twig->load()
18
- * instead, which returns an instance of Twig_TemplateWrapper.
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  *
22
  * @internal
23
  */
24
- abstract class Twig_Template implements Twig_TemplateInterface
25
  {
26
  /**
27
  * @internal
@@ -34,7 +34,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
34
  protected $blocks = array();
35
  protected $traits = array();
36
 
37
- public function __construct(Twig_Environment $env)
38
  {
39
  $this->env = $env;
40
  }
@@ -83,11 +83,11 @@ abstract class Twig_Template implements Twig_TemplateInterface
83
  /**
84
  * Returns information about the original template source code.
85
  *
86
- * @return Twig_Source
87
  */
88
  public function getSourceContext()
89
  {
90
- return new Twig_Source('', $this->getTemplateName());
91
  }
92
 
93
  /**
@@ -108,7 +108,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
108
  *
109
  * @param array $context
110
  *
111
- * @return Twig_TemplateInterface|false The parent template or false if there is no parent
112
  *
113
  * @internal
114
  */
@@ -132,7 +132,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
132
  if (!isset($this->parents[$parent])) {
133
  $this->parents[$parent] = $this->loadTemplate($parent);
134
  }
135
- } catch (Twig_Error_Loader $e) {
136
  $e->setSourceContext(null);
137
  $e->guess();
138
 
@@ -173,7 +173,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
173
  } elseif (false !== $parent = $this->getParent($context)) {
174
  $parent->displayBlock($name, $context, $blocks, false);
175
  } else {
176
- throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext());
177
  }
178
  }
179
 
@@ -207,19 +207,19 @@ abstract class Twig_Template implements Twig_TemplateInterface
207
 
208
  // avoid RCEs when sandbox is enabled
209
  if (null !== $template && !$template instanceof self) {
210
- throw new LogicException('A block must be a method on a Twig_Template instance.');
211
  }
212
 
213
  if (null !== $template) {
214
  try {
215
  $template->$block($context, $blocks);
216
- } catch (Twig_Error $e) {
217
  if (!$e->getSourceContext()) {
218
  $e->setSourceContext($template->getSourceContext());
219
  }
220
 
221
- // this is mostly useful for Twig_Error_Loader exceptions
222
- // see Twig_Error_Loader
223
  if (false === $e->getTemplateLine()) {
224
  $e->setTemplateLine(-1);
225
  $e->guess();
@@ -227,7 +227,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
227
 
228
  throw $e;
229
  } catch (Exception $e) {
230
- throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
231
  }
232
  } elseif (false !== $parent = $this->getParent($context)) {
233
  $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
@@ -359,14 +359,14 @@ abstract class Twig_Template implements Twig_TemplateInterface
359
  return $template;
360
  }
361
 
362
- if ($template instanceof Twig_TemplateWrapper) {
363
  return $template;
364
  }
365
 
366
  return $this->env->loadTemplate($template, $index);
367
- } catch (Twig_Error $e) {
368
  if (!$e->getSourceContext()) {
369
- $e->setSourceContext($templateName ? new Twig_Source('', $templateName) : $this->getSourceContext());
370
  }
371
 
372
  if ($e->getTemplateLine()) {
@@ -430,13 +430,13 @@ abstract class Twig_Template implements Twig_TemplateInterface
430
  {
431
  try {
432
  $this->doDisplay($context, $blocks);
433
- } catch (Twig_Error $e) {
434
  if (!$e->getSourceContext()) {
435
  $e->setSourceContext($this->getSourceContext());
436
  }
437
 
438
- // this is mostly useful for Twig_Error_Loader exceptions
439
- // see Twig_Error_Loader
440
  if (false === $e->getTemplateLine()) {
441
  $e->setTemplateLine(-1);
442
  $e->guess();
@@ -444,7 +444,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
444
 
445
  throw $e;
446
  } catch (Exception $e) {
447
- throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
448
  }
449
  }
450
 
@@ -473,7 +473,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
473
  *
474
  * @return mixed The content of the context variable
475
  *
476
- * @throws Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode
477
  *
478
  * @internal
479
  */
@@ -484,7 +484,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
484
  return;
485
  }
486
 
487
- throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext());
488
  }
489
 
490
  return $context[$item];
@@ -496,13 +496,13 @@ abstract class Twig_Template implements Twig_TemplateInterface
496
  * @param mixed $object The object or array from where to get the item
497
  * @param mixed $item The item to get from the array or object
498
  * @param array $arguments An array of arguments to pass if the item is an object method
499
- * @param string $type The type of attribute (@see Twig_Template constants)
500
  * @param bool $isDefinedTest Whether this is only a defined check
501
  * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
502
  *
503
  * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
504
  *
505
- * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
506
  *
507
  * @internal
508
  */
@@ -553,7 +553,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
553
  $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
554
  }
555
 
556
- throw new Twig_Error_Runtime($message, -1, $this->getSourceContext());
557
  }
558
  }
559
 
@@ -572,18 +572,18 @@ abstract class Twig_Template implements Twig_TemplateInterface
572
  $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
573
  }
574
 
575
- throw new Twig_Error_Runtime($message, -1, $this->getSourceContext());
576
  }
577
 
578
  // object property
579
- if (self::METHOD_CALL !== $type && !$object instanceof self) { // Twig_Template does not have public properties, and we don't want to allow access to internal ones
580
- if (isset($object->$item) || array_key_exists((string) $item, $object)) {
581
  if ($isDefinedTest) {
582
  return true;
583
  }
584
 
585
- if ($this->env->hasExtension('Twig_Extension_Sandbox')) {
586
- $this->env->getExtension('Twig_Extension_Sandbox')->checkPropertyAllowed($object, $item);
587
  }
588
 
589
  return $object->$item;
@@ -657,15 +657,15 @@ abstract class Twig_Template implements Twig_TemplateInterface
657
  return;
658
  }
659
 
660
- throw new Twig_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext());
661
  }
662
 
663
  if ($isDefinedTest) {
664
  return true;
665
  }
666
 
667
- if ($this->env->hasExtension('Twig_Extension_Sandbox')) {
668
- $this->env->getExtension('Twig_Extension_Sandbox')->checkMethodAllowed($object, $method);
669
  }
670
 
671
  // Some objects throw exceptions when they have __call, and the method we try
@@ -684,7 +684,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
684
  }
685
 
686
  // @deprecated in 1.28
687
- if ($object instanceof Twig_TemplateInterface) {
688
  $self = $object->getTemplateName() === $this->getTemplateName();
689
  $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName());
690
  if ('renderBlock' === $method || 'displayBlock' === $method) {
@@ -696,7 +696,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
696
  }
697
  @trigger_error($message, E_USER_DEPRECATED);
698
 
699
- return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset());
700
  }
701
 
702
  return $ret;
15
  *
16
  * This class is an implementation detail of how template compilation currently
17
  * works, which might change. It should never be used directly. Use $twig->load()
18
+ * instead, which returns an instance of Twig_SupTwg_TemplateWrapper.
19
  *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
  *
22
  * @internal
23
  */
24
+ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
25
  {
26
  /**
27
  * @internal
34
  protected $blocks = array();
35
  protected $traits = array();
36
 
37
+ public function __construct(Twig_SupTwg_Environment $env)
38
  {
39
  $this->env = $env;
40
  }
83
  /**
84
  * Returns information about the original template source code.
85
  *
86
+ * @return Twig_SupTwg_Source
87
  */
88
  public function getSourceContext()
89
  {
90
+ return new Twig_SupTwg_Source('', $this->getTemplateName());
91
  }
92
 
93
  /**
108
  *
109
  * @param array $context
110
  *
111
+ * @return Twig_SupTwg_TemplateInterface|false The parent template or false if there is no parent
112
  *
113
  * @internal
114
  */
132
  if (!isset($this->parents[$parent])) {
133
  $this->parents[$parent] = $this->loadTemplate($parent);
134
  }
135
+ } catch (Twig_SupTwg_Error_Loader $e) {
136
  $e->setSourceContext(null);
137
  $e->guess();
138
 
173
  } elseif (false !== $parent = $this->getParent($context)) {
174
  $parent->displayBlock($name, $context, $blocks, false);
175
  } else {
176
+ throw new Twig_SupTwg_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext());
177
  }
178
  }
179
 
207
 
208
  // avoid RCEs when sandbox is enabled
209
  if (null !== $template && !$template instanceof self) {
210
+ throw new LogicException('A block must be a method on a Twig_SupTwg_Template instance.');
211
  }
212
 
213
  if (null !== $template) {
214
  try {
215
  $template->$block($context, $blocks);
216
+ } catch (Twig_SupTwg_Error $e) {
217
  if (!$e->getSourceContext()) {
218
  $e->setSourceContext($template->getSourceContext());
219
  }
220
 
221
+ // this is mostly useful for Twig_SupTwg_Error_Loader exceptions
222
+ // see Twig_SupTwg_Error_Loader
223
  if (false === $e->getTemplateLine()) {
224
  $e->setTemplateLine(-1);
225
  $e->guess();
227
 
228
  throw $e;
229
  } catch (Exception $e) {
230
+ throw new Twig_SupTwg_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
231
  }
232
  } elseif (false !== $parent = $this->getParent($context)) {
233
  $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
359
  return $template;
360
  }
361
 
362
+ if ($template instanceof Twig_SupTwg_TemplateWrapper) {
363
  return $template;
364
  }
365
 
366
  return $this->env->loadTemplate($template, $index);
367
+ } catch (Twig_SupTwg_Error $e) {
368
  if (!$e->getSourceContext()) {
369
+ $e->setSourceContext($templateName ? new Twig_SupTwg_Source('', $templateName) : $this->getSourceContext());
370
  }
371
 
372
  if ($e->getTemplateLine()) {
430
  {
431
  try {
432
  $this->doDisplay($context, $blocks);
433
+ } catch (Twig_SupTwg_Error $e) {
434
  if (!$e->getSourceContext()) {
435
  $e->setSourceContext($this->getSourceContext());
436
  }
437
 
438
+ // this is mostly useful for Twig_SupTwg_Error_Loader exceptions
439
+ // see Twig_SupTwg_Error_Loader
440
  if (false === $e->getTemplateLine()) {
441
  $e->setTemplateLine(-1);
442
  $e->guess();
444
 
445
  throw $e;
446
  } catch (Exception $e) {
447
+ throw new Twig_SupTwg_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
448
  }
449
  }
450
 
473
  *
474
  * @return mixed The content of the context variable
475
  *
476
+ * @throws Twig_SupTwg_Error_Runtime if the variable does not exist and Twig is running in strict mode
477
  *
478
  * @internal
479
  */
484
  return;
485
  }
486
 
487
+ throw new Twig_SupTwg_Error_Runtime(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext());
488
  }
489
 
490
  return $context[$item];
496
  * @param mixed $object The object or array from where to get the item
497
  * @param mixed $item The item to get from the array or object
498
  * @param array $arguments An array of arguments to pass if the item is an object method
499
+ * @param string $type The type of attribute (@see Twig_SupTwg_Template constants)
500
  * @param bool $isDefinedTest Whether this is only a defined check
501
  * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
502
  *
503
  * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
504
  *
505
+ * @throws Twig_SupTwg_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
506
  *
507
  * @internal
508
  */
553
  $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
554
  }
555
 
556
+ throw new Twig_SupTwg_Error_Runtime($message, -1, $this->getSourceContext());
557
  }
558
  }
559
 
572
  $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
573
  }
574
 
575
+ throw new Twig_SupTwg_Error_Runtime($message, -1, $this->getSourceContext());
576
  }
577
 
578
  // object property
579
+ if (self::METHOD_CALL !== $type && !$object instanceof self) { // Twig_SupTwg_Template does not have public properties, and we don't want to allow access to internal ones
580
+ if (isset($object->$item) || !empty($object->$item)) {
581
  if ($isDefinedTest) {
582
  return true;
583
  }
584
 
585
+ if ($this->env->hasExtension('Twig_SupTwg_Extension_Sandbox')) {
586
+ $this->env->getExtension('Twig_SupTwg_Extension_Sandbox')->checkPropertyAllowed($object, $item);
587
  }
588
 
589
  return $object->$item;
657
  return;
658
  }
659
 
660
+ throw new Twig_SupTwg_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext());
661
  }
662
 
663
  if ($isDefinedTest) {
664
  return true;
665
  }
666
 
667
+ if ($this->env->hasExtension('Twig_SupTwg_Extension_Sandbox')) {
668
+ $this->env->getExtension('Twig_SupTwg_Extension_Sandbox')->checkMethodAllowed($object, $method);
669
  }
670
 
671
  // Some objects throw exceptions when they have __call, and the method we try
684
  }
685
 
686
  // @deprecated in 1.28
687
+ if ($object instanceof Twig_SupTwg_TemplateInterface) {
688
  $self = $object->getTemplateName() === $this->getTemplateName();
689
  $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName());
690
  if ('renderBlock' === $method || 'displayBlock' === $method) {
696
  }
697
  @trigger_error($message, E_USER_DEPRECATED);
698
 
699
+ return $ret === '' ? '' : new Twig_SupTwg_Markup($ret, $this->env->getCharset());
700
  }
701
 
702
  return $ret;
vendor/Twig/TemplateInterface.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
- interface Twig_TemplateInterface
20
  {
21
  const ANY_CALL = 'any';
22
  const ARRAY_CALL = 'array';
@@ -42,7 +42,7 @@ interface Twig_TemplateInterface
42
  /**
43
  * Returns the bound environment for this template.
44
  *
45
- * @return Twig_Environment
46
  */
47
  public function getEnvironment();
48
  }
16
  *
17
  * @deprecated since 1.12 (to be removed in 3.0)
18
  */
19
+ interface Twig_SupTwg_TemplateInterface
20
  {
21
  const ANY_CALL = 'any';
22
  const ARRAY_CALL = 'array';
42
  /**
43
  * Returns the bound environment for this template.
44
  *
45
+ * @return Twig_SupTwg_Environment
46
  */
47
  public function getEnvironment();
48
  }
vendor/Twig/TemplateWrapper.php CHANGED
@@ -14,18 +14,18 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- final class Twig_TemplateWrapper
18
  {
19
  private $env;
20
  private $template;
21
 
22
  /**
23
  * This method is for internal use only and should never be called
24
- * directly (use Twig_Environment::load() instead).
25
  *
26
  * @internal
27
  */
28
- public function __construct(Twig_Environment $env, Twig_Template $template)
29
  {
30
  $this->env = $env;
31
  $this->template = $template;
@@ -122,7 +122,7 @@ final class Twig_TemplateWrapper
122
  }
123
 
124
  /**
125
- * @return Twig_Source
126
  */
127
  public function getSourceContext()
128
  {
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ final class Twig_SupTwg_TemplateWrapper
18
  {
19
  private $env;
20
  private $template;
21
 
22
  /**
23
  * This method is for internal use only and should never be called
24
+ * directly (use Twig_SupTwg_Environment::load() instead).
25
  *
26
  * @internal
27
  */
28
+ public function __construct(Twig_SupTwg_Environment $env, Twig_SupTwg_Template $template)
29
  {
30
  $this->env = $env;
31
  $this->template = $template;
122
  }
123
 
124
  /**
125
+ * @return Twig_SupTwg_Source
126
  */
127
  public function getSourceContext()
128
  {
vendor/Twig/Test.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Test class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template test.
@@ -18,7 +18,7 @@
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface
22
  {
23
  protected $options;
24
  protected $arguments = array();
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Test class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template test.
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ abstract class Twig_SupTwg_Test implements Twig_SupTwg_TestInterface, Twig_SupTwg_TestCallableInterface
22
  {
23
  protected $options;
24
  protected $arguments = array();
vendor/Twig/Test/Function.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a function template test.
@@ -18,7 +18,7 @@
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- class Twig_Test_Function extends Twig_Test
22
  {
23
  protected $function;
24
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a function template test.
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ class Twig_SupTwg_Test_Function extends Twig_SupTwg_Test
22
  {
23
  protected $function;
24
 
vendor/Twig/Test/IntegrationTestCase.php CHANGED
@@ -15,7 +15,7 @@
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  * @author Karma Dordrak <drak@zikula.org>
17
  */
18
- abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
19
  {
20
  /**
21
  * @return string
@@ -23,7 +23,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
23
  abstract protected function getFixturesDir();
24
 
25
  /**
26
- * @return Twig_ExtensionInterface[]
27
  */
28
  protected function getExtensions()
29
  {
@@ -31,7 +31,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
31
  }
32
 
33
  /**
34
- * @return Twig_SimpleFilter[]
35
  */
36
  protected function getTwigFilters()
37
  {
@@ -39,7 +39,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
39
  }
40
 
41
  /**
42
- * @return Twig_SimpleFunction[]
43
  */
44
  protected function getTwigFunctions()
45
  {
@@ -47,7 +47,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
47
  }
48
 
49
  /**
50
- * @return Twig_SimpleTest[]
51
  */
52
  protected function getTwigTests()
53
  {
@@ -132,14 +132,14 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
132
  }
133
  }
134
 
135
- $loader = new Twig_Loader_Array($templates);
136
 
137
  foreach ($outputs as $i => $match) {
138
  $config = array_merge(array(
139
  'cache' => false,
140
  'strict_variables' => true,
141
  ), $match[2] ? eval($match[2].';') : array());
142
- $twig = new Twig_Environment($loader, $config);
143
  $twig->addGlobal('global', 'global');
144
  foreach ($this->getExtensions() as $extension) {
145
  $twig->addExtension($extension);
@@ -177,7 +177,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
177
  return;
178
  }
179
 
180
- throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
181
  }
182
 
183
  try {
@@ -189,7 +189,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
189
  return;
190
  }
191
 
192
- $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
193
 
194
  $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage()));
195
  }
@@ -207,8 +207,8 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
207
  foreach (array_keys($templates) as $name) {
208
  echo "Template: $name\n";
209
  $loader = $twig->getLoader();
210
- if (!$loader instanceof Twig_SourceContextLoaderInterface) {
211
- $source = new Twig_Source($loader->getSource($name), $name);
212
  } else {
213
  $source = $loader->getSourceContext($name);
214
  }
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  * @author Karma Dordrak <drak@zikula.org>
17
  */
18
+ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
19
  {
20
  /**
21
  * @return string
23
  abstract protected function getFixturesDir();
24
 
25
  /**
26
+ * @return Twig_SupTwg_ExtensionInterface[]
27
  */
28
  protected function getExtensions()
29
  {
31
  }
32
 
33
  /**
34
+ * @return Twig_SupTwg_SimpleFilter[]
35
  */
36
  protected function getTwigFilters()
37
  {
39
  }
40
 
41
  /**
42
+ * @return Twig_SupTwg_SimpleFunction[]
43
  */
44
  protected function getTwigFunctions()
45
  {
47
  }
48
 
49
  /**
50
+ * @return Twig_SupTwg_SimpleTest[]
51
  */
52
  protected function getTwigTests()
53
  {
132
  }
133
  }
134
 
135
+ $loader = new Twig_SupTwg_Loader_Array($templates);
136
 
137
  foreach ($outputs as $i => $match) {
138
  $config = array_merge(array(
139
  'cache' => false,
140
  'strict_variables' => true,
141
  ), $match[2] ? eval($match[2].';') : array());
142
+ $twig = new Twig_SupTwg_Environment($loader, $config);
143
  $twig->addGlobal('global', 'global');
144
  foreach ($this->getExtensions() as $extension) {
145
  $twig->addExtension($extension);
177
  return;
178
  }
179
 
180
+ throw new Twig_SupTwg_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
181
  }
182
 
183
  try {
189
  return;
190
  }
191
 
192
+ $e = new Twig_SupTwg_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
193
 
194
  $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage()));
195
  }
207
  foreach (array_keys($templates) as $name) {
208
  echo "Template: $name\n";
209
  $loader = $twig->getLoader();
210
+ if (!$loader instanceof Twig_SupTwg_SourceContextLoaderInterface) {
211
+ $source = new Twig_SupTwg_Source($loader->getSource($name), $name);
212
  } else {
213
  $source = $loader->getSourceContext($name);
214
  }
vendor/Twig/Test/Method.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a method template test.
@@ -18,12 +18,12 @@
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- class Twig_Test_Method extends Twig_Test
22
  {
23
  protected $extension;
24
  protected $method;
25
 
26
- public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array())
27
  {
28
  $options['callable'] = array($extension, $method);
29
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwg_SimpleTest instead.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a method template test.
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ class Twig_SupTwg_Test_Method extends Twig_SupTwg_Test
22
  {
23
  protected $extension;
24
  protected $method;
25
 
26
+ public function __construct(Twig_SupTwg_ExtensionInterface $extension, $method, array $options = array())
27
  {
28
  $options['callable'] = array($extension, $method);
29
 
vendor/Twig/Test/Node.php CHANGED
@@ -9,7 +9,7 @@
9
  * file that was distributed with this source code.
10
  */
11
 
12
- @trigger_error('The Twig_Test_Node class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template test as a Node.
@@ -18,7 +18,7 @@
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
- class Twig_Test_Node extends Twig_Test
22
  {
23
  protected $class;
24
 
9
  * file that was distributed with this source code.
10
  */
11
 
12
+ @trigger_error('The Twig_SupTwg_Test_Node class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
13
 
14
  /**
15
  * Represents a template test as a Node.
18
  *
19
  * @deprecated since 1.12 (to be removed in 2.0)
20
  */
21
+ class Twig_SupTwg_Test_Node extends Twig_SupTwg_Test
22
  {
23
  protected $class;
24
 
vendor/Twig/Test/NodeTestCase.php CHANGED
@@ -8,7 +8,7 @@
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
- abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
12
  {
13
  abstract public function getTests();
14
 
@@ -20,7 +20,7 @@ abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
20
  $this->assertNodeCompilation($source, $node, $environment, $isPattern);
21
  }
22
 
23
- public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false)
24
  {
25
  $compiler = $this->getCompiler($environment);
26
  $compiler->compile($node);
@@ -32,14 +32,14 @@ abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
32
  }
33
  }
34
 
35
- protected function getCompiler(Twig_Environment $environment = null)
36
  {
37
- return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment);
38
  }
39
 
40
  protected function getEnvironment()
41
  {
42
- return new Twig_Environment(new Twig_Loader_Array(array()));
43
  }
44
 
45
  protected function getVariableGetter($name, $line = false)
@@ -59,8 +59,8 @@ abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
59
 
60
  protected function getAttributeGetter()
61
  {
62
- if (function_exists('twig_template_get_attributes')) {
63
- return 'twig_template_get_attributes($this, ';
64
  }
65
 
66
  return '$this->getAttribute(';
8
  * For the full copyright and license information, please view the LICENSE
9
  * file that was distributed with this source code.
10
  */
11
+ abstract class Twig_SupTwg_Test_NodeTestCase extends PHPUnit_Framework_TestCase
12
  {
13
  abstract public function getTests();
14
 
20
  $this->assertNodeCompilation($source, $node, $environment, $isPattern);
21
  }
22
 
23
+ public function assertNodeCompilation($source, Twig_SupTwg_Node $node, Twig_SupTwg_Environment $environment = null, $isPattern = false)
24
  {
25
  $compiler = $this->getCompiler($environment);
26
  $compiler->compile($node);
32
  }
33
  }
34
 
35
+ protected function getCompiler(Twig_SupTwg_Environment $environment = null)
36
  {
37
+ return new Twig_SupTwg_Compiler(null === $environment ? $this->getEnvironment() : $environment);
38
  }
39
 
40
  protected function getEnvironment()
41
  {
42
+ return new Twig_SupTwg_Environment(new Twig_SupTwg_Loader_Array(array()));
43
  }
44
 
45
  protected function getVariableGetter($name, $line = false)
59
 
60
  protected function getAttributeGetter()
61
  {
62
+ if (function_exists('Twig_SupTwg_template_get_attributes')) {
63
+ return 'Twig_SupTwg_template_get_attributes($this, ';
64
  }
65
 
66
  return '$this->getAttribute(';
vendor/Twig/TestCallableInterface.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 2.0)
18
  */
19
- interface Twig_TestCallableInterface
20
  {
21
  public function getCallable();
22
  }
16
  *
17
  * @deprecated since 1.12 (to be removed in 2.0)
18
  */
19
+ interface Twig_SupTwg_TestCallableInterface
20
  {
21
  public function getCallable();
22
  }
vendor/Twig/TestInterface.php CHANGED
@@ -16,7 +16,7 @@
16
  *
17
  * @deprecated since 1.12 (to be removed in 2.0)
18
  */
19
- interface Twig_TestInterface
20
  {
21
  /**
22
  * Compiles a test.
16
  *
17
  * @deprecated since 1.12 (to be removed in 2.0)
18
  */
19
+ interface Twig_SupTwg_TestInterface
20
  {
21
  /**
22
  * Compiles a test.
vendor/Twig/Token.php CHANGED
@@ -17,7 +17,7 @@
17
  *
18
  * @final
19
  */
20
- class Twig_Token
21
  {
22
  protected $value;
23
  protected $type;
@@ -159,7 +159,7 @@ class Twig_Token
159
  throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
160
  }
161
 
162
- return $short ? $name : 'Twig_Token::'.$name;
163
  }
164
 
165
  /**
17
  *
18
  * @final
19
  */
20
+ class Twig_SupTwg_Token
21
  {
22
  protected $value;
23
  protected $type;
159
  throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
160
  }
161
 
162
+ return $short ? $name : 'Twig_SupTwg_Token::'.$name;
163
  }
164
 
165
  /**
vendor/Twig/TokenParser.php CHANGED
@@ -14,17 +14,17 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- abstract class Twig_TokenParser implements Twig_TokenParserInterface
18
  {
19
  /**
20
- * @var Twig_Parser
21
  */
22
  protected $parser;
23
 
24
  /**
25
  * Sets the parser associated with this token parser.
26
  */
27
- public function setParser(Twig_Parser $parser)
28
  {
29
  $this->parser = $parser;
30
  }
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ abstract class Twig_SupTwg_TokenParser implements Twig_SupTwg_TokenParserInterface
18
  {
19
  /**
20
+ * @var Twig_SupTwg_Parser
21
  */
22
  protected $parser;
23
 
24
  /**
25
  * Sets the parser associated with this token parser.
26
  */
27
+ public function setParser(Twig_SupTwg_Parser $parser)
28
  {
29
  $this->parser = $parser;
30
  }
vendor/Twig/TokenParser/AutoEscape.php CHANGED
@@ -29,19 +29,19 @@
29
  *
30
  * @final
31
  */
32
- class Twig_TokenParser_AutoEscape extends Twig_TokenParser
33
  {
34
- public function parse(Twig_Token $token)
35
  {
36
  $lineno = $token->getLine();
37
  $stream = $this->parser->getStream();
38
 
39
- if ($stream->test(Twig_Token::BLOCK_END_TYPE)) {
40
  $value = 'html';
41
  } else {
42
  $expr = $this->parser->getExpressionParser()->parseExpression();
43
- if (!$expr instanceof Twig_Node_Expression_Constant) {
44
- throw new Twig_Error_Syntax('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
45
  }
46
  $value = $expr->getAttribute('value');
47
 
@@ -51,25 +51,25 @@ class Twig_TokenParser_AutoEscape extends Twig_TokenParser
51
  $value = 'html';
52
  }
53
 
54
- if ($compat && $stream->test(Twig_Token::NAME_TYPE)) {
55
  @trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', E_USER_DEPRECATED);
56
 
57
  if (false === $value) {
58
- throw new Twig_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
59
  }
60
 
61
  $value = $stream->next()->getValue();
62
  }
63
  }
64
 
65
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
66
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
67
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
68
 
69
- return new Twig_Node_AutoEscape($value, $body, $lineno, $this->getTag());
70
  }
71
 
72
- public function decideBlockEnd(Twig_Token $token)
73
  {
74
  return $token->test('endautoescape');
75
  }
29
  *
30
  * @final
31
  */
32
+ class Twig_SupTwg_TokenParser_AutoEscape extends Twig_SupTwg_TokenParser
33
  {
34
+ public function parse(Twig_SupTwg_Token $token)
35
  {
36
  $lineno = $token->getLine();
37
  $stream = $this->parser->getStream();
38
 
39
+ if ($stream->test(Twig_SupTwg_Token::BLOCK_END_TYPE)) {
40
  $value = 'html';
41
  } else {
42
  $expr = $this->parser->getExpressionParser()->parseExpression();
43
+ if (!$expr instanceof Twig_SupTwg_Node_Expression_Constant) {
44
+ throw new Twig_SupTwg_Error_Syntax('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
45
  }
46
  $value = $expr->getAttribute('value');
47
 
51
  $value = 'html';
52
  }
53
 
54
+ if ($compat && $stream->test(Twig_SupTwg_Token::NAME_TYPE)) {
55
  @trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', E_USER_DEPRECATED);
56
 
57
  if (false === $value) {
58
+ throw new Twig_SupTwg_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
59
  }
60
 
61
  $value = $stream->next()->getValue();
62
  }
63
  }
64
 
65
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
66
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
67
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
68
 
69
+ return new Twig_SupTwg_Node_AutoEscape($value, $body, $lineno, $this->getTag());
70
  }
71
 
72
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
73
  {
74
  return $token->test('endautoescape');
75
  }
vendor/Twig/TokenParser/Block.php CHANGED
@@ -22,44 +22,44 @@
22
  *
23
  * @final
24
  */
25
- class Twig_TokenParser_Block extends Twig_TokenParser
26
  {
27
- public function parse(Twig_Token $token)
28
  {
29
  $lineno = $token->getLine();
30
  $stream = $this->parser->getStream();
31
- $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
32
  if ($this->parser->hasBlock($name)) {
33
- throw new Twig_Error_Syntax(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext());
34
  }
35
- $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno));
36
  $this->parser->pushLocalScope();
37
  $this->parser->pushBlockStack($name);
38
 
39
- if ($stream->nextIf(Twig_Token::BLOCK_END_TYPE)) {
40
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
41
- if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
42
  $value = $token->getValue();
43
 
44
  if ($value != $name) {
45
- throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
46
  }
47
  }
48
  } else {
49
- $body = new Twig_Node(array(
50
- new Twig_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno),
51
  ));
52
  }
53
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
54
 
55
  $block->setNode('body', $body);
56
  $this->parser->popBlockStack();
57
  $this->parser->popLocalScope();
58
 
59
- return new Twig_Node_BlockReference($name, $lineno, $this->getTag());
60
  }
61
 
62
- public function decideBlockEnd(Twig_Token $token)
63
  {
64
  return $token->test('endblock');
65
  }
22
  *
23
  * @final
24
  */
25
+ class Twig_SupTwg_TokenParser_Block extends Twig_SupTwg_TokenParser
26
  {
27
+ public function parse(Twig_SupTwg_Token $token)
28
  {
29
  $lineno = $token->getLine();
30
  $stream = $this->parser->getStream();
31
+ $name = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
32
  if ($this->parser->hasBlock($name)) {
33
+ throw new Twig_SupTwg_Error_Syntax(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext());
34
  }
35
+ $this->parser->setBlock($name, $block = new Twig_SupTwg_Node_Block($name, new Twig_SupTwg_Node(array()), $lineno));
36
  $this->parser->pushLocalScope();
37
  $this->parser->pushBlockStack($name);
38
 
39
+ if ($stream->nextIf(Twig_SupTwg_Token::BLOCK_END_TYPE)) {
40
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
41
+ if ($token = $stream->nextIf(Twig_SupTwg_Token::NAME_TYPE)) {
42
  $value = $token->getValue();
43
 
44
  if ($value != $name) {
45
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
46
  }
47
  }
48
  } else {
49
+ $body = new Twig_SupTwg_Node(array(
50
+ new Twig_SupTwg_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno),
51
  ));
52
  }
53
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
54
 
55
  $block->setNode('body', $body);
56
  $this->parser->popBlockStack();
57
  $this->parser->popLocalScope();
58
 
59
+ return new Twig_SupTwg_Node_BlockReference($name, $lineno, $this->getTag());
60
  }
61
 
62
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
63
  {
64
  return $token->test('endblock');
65
  }
vendor/Twig/TokenParser/Do.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @final
16
  */
17
- class Twig_TokenParser_Do extends Twig_TokenParser
18
  {
19
- public function parse(Twig_Token $token)
20
  {
21
  $expr = $this->parser->getExpressionParser()->parseExpression();
22
 
23
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
24
 
25
- return new Twig_Node_Do($expr, $token->getLine(), $this->getTag());
26
  }
27
 
28
  public function getTag()
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_TokenParser_Do extends Twig_SupTwg_TokenParser
18
  {
19
+ public function parse(Twig_SupTwg_Token $token)
20
  {
21
  $expr = $this->parser->getExpressionParser()->parseExpression();
22
 
23
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
24
 
25
+ return new Twig_SupTwg_Node_Do($expr, $token->getLine(), $this->getTag());
26
  }
27
 
28
  public function getTag()
vendor/Twig/TokenParser/Embed.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @final
16
  */
17
- class Twig_TokenParser_Embed extends Twig_TokenParser_Include
18
  {
19
- public function parse(Twig_Token $token)
20
  {
21
  $stream = $this->parser->getStream();
22
 
@@ -24,19 +24,19 @@ class Twig_TokenParser_Embed extends Twig_TokenParser_Include
24
 
25
  list($variables, $only, $ignoreMissing) = $this->parseArguments();
26
 
27
- $parentToken = $fakeParentToken = new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine());
28
- if ($parent instanceof Twig_Node_Expression_Constant) {
29
- $parentToken = new Twig_Token(Twig_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine());
30
- } elseif ($parent instanceof Twig_Node_Expression_Name) {
31
- $parentToken = new Twig_Token(Twig_Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine());
32
  }
33
 
34
  // inject a fake parent to make the parent() function work
35
  $stream->injectTokens(array(
36
- new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()),
37
- new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()),
38
  $parentToken,
39
- new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()),
40
  ));
41
 
42
  $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true);
@@ -48,12 +48,12 @@ class Twig_TokenParser_Embed extends Twig_TokenParser_Include
48
 
49
  $this->parser->embedTemplate($module);
50
 
51
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
52
 
53
- return new Twig_Node_Embed($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
54
  }
55
 
56
- public function decideBlockEnd(Twig_Token $token)
57
  {
58
  return $token->test('endembed');
59
  }
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_TokenParser_Embed extends Twig_SupTwg_TokenParser_Include
18
  {
19
+ public function parse(Twig_SupTwg_Token $token)
20
  {
21
  $stream = $this->parser->getStream();
22
 
24
 
25
  list($variables, $only, $ignoreMissing) = $this->parseArguments();
26
 
27
+ $parentToken = $fakeParentToken = new Twig_SupTwg_Token(Twig_SupTwg_Token::STRING_TYPE, '__parent__', $token->getLine());
28
+ if ($parent instanceof Twig_SupTwg_Node_Expression_Constant) {
29
+ $parentToken = new Twig_SupTwg_Token(Twig_SupTwg_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine());
30
+ } elseif ($parent instanceof Twig_SupTwg_Node_Expression_Name) {
31
+ $parentToken = new Twig_SupTwg_Token(Twig_SupTwg_Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine());
32
  }
33
 
34
  // inject a fake parent to make the parent() function work
35
  $stream->injectTokens(array(
36
+ new Twig_SupTwg_Token(Twig_SupTwg_Token::BLOCK_START_TYPE, '', $token->getLine()),
37
+ new Twig_SupTwg_Token(Twig_SupTwg_Token::NAME_TYPE, 'extends', $token->getLine()),
38
  $parentToken,
39
+ new Twig_SupTwg_Token(Twig_SupTwg_Token::BLOCK_END_TYPE, '', $token->getLine()),
40
  ));
41
 
42
  $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true);
48
 
49
  $this->parser->embedTemplate($module);
50
 
51
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
52
 
53
+ return new Twig_SupTwg_Node_Embed($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
54
  }
55
 
56
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
57
  {
58
  return $token->test('endembed');
59
  }
vendor/Twig/TokenParser/Extends.php CHANGED
@@ -19,22 +19,22 @@
19
  *
20
  * @final
21
  */
22
- class Twig_TokenParser_Extends extends Twig_TokenParser
23
  {
24
- public function parse(Twig_Token $token)
25
  {
26
  $stream = $this->parser->getStream();
27
 
28
  if (!$this->parser->isMainScope()) {
29
- throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext());
30
  }
31
 
32
  if (null !== $this->parser->getParent()) {
33
- throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext());
34
  }
35
  $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
36
 
37
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
38
  }
39
 
40
  public function getTag()
19
  *
20
  * @final
21
  */
22
+ class Twig_SupTwg_TokenParser_Extends extends Twig_SupTwg_TokenParser
23
  {
24
+ public function parse(Twig_SupTwg_Token $token)
25
  {
26
  $stream = $this->parser->getStream();
27
 
28
  if (!$this->parser->isMainScope()) {
29
+ throw new Twig_SupTwg_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext());
30
  }
31
 
32
  if (null !== $this->parser->getParent()) {
33
+ throw new Twig_SupTwg_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext());
34
  }
35
  $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
36
 
37
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
38
  }
39
 
40
  public function getTag()
vendor/Twig/TokenParser/Filter.php CHANGED
@@ -20,26 +20,26 @@
20
  *
21
  * @final
22
  */
23
- class Twig_TokenParser_Filter extends Twig_TokenParser
24
  {
25
- public function parse(Twig_Token $token)
26
  {
27
  $name = $this->parser->getVarName();
28
- $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), null, $token->getLine(), $this->getTag());
29
 
30
  $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
31
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
32
 
33
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
34
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
35
 
36
- $block = new Twig_Node_Block($name, $body, $token->getLine());
37
  $this->parser->setBlock($name, $block);
38
 
39
- return new Twig_Node_Print($filter, $token->getLine(), $this->getTag());
40
  }
41
 
42
- public function decideBlockEnd(Twig_Token $token)
43
  {
44
  return $token->test('endfilter');
45
  }
20
  *
21
  * @final
22
  */
23
+ class Twig_SupTwg_TokenParser_Filter extends Twig_SupTwg_TokenParser
24
  {
25
+ public function parse(Twig_SupTwg_Token $token)
26
  {
27
  $name = $this->parser->getVarName();
28
+ $ref = new Twig_SupTwg_Node_Expression_BlockReference(new Twig_SupTwg_Node_Expression_Constant($name, $token->getLine()), null, $token->getLine(), $this->getTag());
29
 
30
  $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
31
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
32
 
33
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
34
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
35
 
36
+ $block = new Twig_SupTwg_Node_Block($name, $body, $token->getLine());
37
  $this->parser->setBlock($name, $block);
38
 
39
+ return new Twig_SupTwg_Node_Print($filter, $token->getLine(), $this->getTag());
40
  }
41
 
42
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
43
  {
44
  return $token->test('endfilter');
45
  }
vendor/Twig/TokenParser/Flush.php CHANGED
@@ -16,13 +16,13 @@
16
  *
17
  * @final
18
  */
19
- class Twig_TokenParser_Flush extends Twig_TokenParser
20
  {
21
- public function parse(Twig_Token $token)
22
  {
23
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
24
 
25
- return new Twig_Node_Flush($token->getLine(), $this->getTag());
26
  }
27
 
28
  public function getTag()
16
  *
17
  * @final
18
  */
19
+ class Twig_SupTwg_TokenParser_Flush extends Twig_SupTwg_TokenParser
20
  {
21
+ public function parse(Twig_SupTwg_Token $token)
22
  {
23
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
24
 
25
+ return new Twig_SupTwg_Node_Flush($token->getLine(), $this->getTag());
26
  }
27
 
28
  public function getTag()
vendor/Twig/TokenParser/For.php CHANGED
@@ -23,40 +23,40 @@
23
  *
24
  * @final
25
  */
26
- class Twig_TokenParser_For extends Twig_TokenParser
27
  {
28
- public function parse(Twig_Token $token)
29
  {
30
  $lineno = $token->getLine();
31
  $stream = $this->parser->getStream();
32
  $targets = $this->parser->getExpressionParser()->parseAssignmentExpression();
33
- $stream->expect(Twig_Token::OPERATOR_TYPE, 'in');
34
  $seq = $this->parser->getExpressionParser()->parseExpression();
35
 
36
  $ifexpr = null;
37
- if ($stream->nextIf(Twig_Token::NAME_TYPE, 'if')) {
38
  $ifexpr = $this->parser->getExpressionParser()->parseExpression();
39
  }
40
 
41
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
42
  $body = $this->parser->subparse(array($this, 'decideForFork'));
43
  if ($stream->next()->getValue() == 'else') {
44
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
45
  $else = $this->parser->subparse(array($this, 'decideForEnd'), true);
46
  } else {
47
  $else = null;
48
  }
49
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
50
 
51
  if (count($targets) > 1) {
52
  $keyTarget = $targets->getNode(0);
53
- $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine());
54
  $valueTarget = $targets->getNode(1);
55
- $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
56
  } else {
57
- $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno);
58
  $valueTarget = $targets->getNode(0);
59
- $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
60
  }
61
 
62
  if ($ifexpr) {
@@ -64,24 +64,24 @@ class Twig_TokenParser_For extends Twig_TokenParser
64
  $this->checkLoopUsageBody($stream, $body);
65
  }
66
 
67
- return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag());
68
  }
69
 
70
- public function decideForFork(Twig_Token $token)
71
  {
72
  return $token->test(array('else', 'endfor'));
73
  }
74
 
75
- public function decideForEnd(Twig_Token $token)
76
  {
77
  return $token->test('endfor');
78
  }
79
 
80
  // the loop variable cannot be used in the condition
81
- protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node)
82
  {
83
- if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
84
- throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext());
85
  }
86
 
87
  foreach ($node as $n) {
@@ -95,17 +95,17 @@ class Twig_TokenParser_For extends Twig_TokenParser
95
 
96
  // check usage of non-defined loop-items
97
  // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include)
98
- protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterface $node)
99
  {
100
- if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
101
  $attribute = $node->getNode('attribute');
102
- if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) {
103
- throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext());
104
  }
105
  }
106
 
107
  // should check for parent.loop.XXX usage
108
- if ($node instanceof Twig_Node_For) {
109
  return;
110
  }
111
 
23
  *
24
  * @final
25
  */
26
+ class Twig_SupTwg_TokenParser_For extends Twig_SupTwg_TokenParser
27
  {
28
+ public function parse(Twig_SupTwg_Token $token)
29
  {
30
  $lineno = $token->getLine();
31
  $stream = $this->parser->getStream();
32
  $targets = $this->parser->getExpressionParser()->parseAssignmentExpression();
33
+ $stream->expect(Twig_SupTwg_Token::OPERATOR_TYPE, 'in');
34
  $seq = $this->parser->getExpressionParser()->parseExpression();
35
 
36
  $ifexpr = null;
37
+ if ($stream->nextIf(Twig_SupTwg_Token::NAME_TYPE, 'if')) {
38
  $ifexpr = $this->parser->getExpressionParser()->parseExpression();
39
  }
40
 
41
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
42
  $body = $this->parser->subparse(array($this, 'decideForFork'));
43
  if ($stream->next()->getValue() == 'else') {
44
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
45
  $else = $this->parser->subparse(array($this, 'decideForEnd'), true);
46
  } else {
47
  $else = null;
48
  }
49
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
50
 
51
  if (count($targets) > 1) {
52
  $keyTarget = $targets->getNode(0);
53
+ $keyTarget = new Twig_SupTwg_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine());
54
  $valueTarget = $targets->getNode(1);
55
+ $valueTarget = new Twig_SupTwg_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
56
  } else {
57
+ $keyTarget = new Twig_SupTwg_Node_Expression_AssignName('_key', $lineno);
58
  $valueTarget = $targets->getNode(0);
59
+ $valueTarget = new Twig_SupTwg_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
60
  }
61
 
62
  if ($ifexpr) {
64
  $this->checkLoopUsageBody($stream, $body);
65
  }
66
 
67
+ return new Twig_SupTwg_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag());
68
  }
69
 
70
+ public function decideForFork(Twig_SupTwg_Token $token)
71
  {
72
  return $token->test(array('else', 'endfor'));
73
  }
74
 
75
+ public function decideForEnd(Twig_SupTwg_Token $token)
76
  {
77
  return $token->test('endfor');
78
  }
79
 
80
  // the loop variable cannot be used in the condition
81
+ protected function checkLoopUsageCondition(Twig_SupTwg_TokenStream $stream, Twig_SupTwg_NodeInterface $node)
82
  {
83
+ if ($node instanceof Twig_SupTwg_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwg_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
84
+ throw new Twig_SupTwg_Error_Syntax('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext());
85
  }
86
 
87
  foreach ($node as $n) {
95
 
96
  // check usage of non-defined loop-items
97
  // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include)
98
+ protected function checkLoopUsageBody(Twig_SupTwg_TokenStream $stream, Twig_SupTwg_NodeInterface $node)
99
  {
100
+ if ($node instanceof Twig_SupTwg_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwg_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
101
  $attribute = $node->getNode('attribute');
102
+ if ($attribute instanceof Twig_SupTwg_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) {
103
+ throw new Twig_SupTwg_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext());
104
  }
105
  }
106
 
107
  // should check for parent.loop.XXX usage
108
+ if ($node instanceof Twig_SupTwg_Node_For) {
109
  return;
110
  }
111
 
vendor/Twig/TokenParser/From.php CHANGED
@@ -18,9 +18,9 @@
18
  *
19
  * @final
20
  */
21
- class Twig_TokenParser_From extends Twig_TokenParser
22
  {
23
- public function parse(Twig_Token $token)
24
  {
25
  $macro = $this->parser->getExpressionParser()->parseExpression();
26
  $stream = $this->parser->getStream();
@@ -28,27 +28,27 @@ class Twig_TokenParser_From extends Twig_TokenParser
28
 
29
  $targets = array();
30
  do {
31
- $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
32
 
33
  $alias = $name;
34
  if ($stream->nextIf('as')) {
35
- $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
36
  }
37
 
38
  $targets[$name] = $alias;
39
 
40
- if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
41
  break;
42
  }
43
  } while (true);
44
 
45
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
46
 
47
- $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag());
48
 
49
  foreach ($targets as $name => $alias) {
50
  if ($this->parser->isReservedMacroName($name)) {
51
- throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
52
  }
53
 
54
  $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var'));
18
  *
19
  * @final
20
  */
21
+ class Twig_SupTwg_TokenParser_From extends Twig_SupTwg_TokenParser
22
  {
23
+ public function parse(Twig_SupTwg_Token $token)
24
  {
25
  $macro = $this->parser->getExpressionParser()->parseExpression();
26
  $stream = $this->parser->getStream();
28
 
29
  $targets = array();
30
  do {
31
+ $name = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
32
 
33
  $alias = $name;
34
  if ($stream->nextIf('as')) {
35
+ $alias = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
36
  }
37
 
38
  $targets[$name] = $alias;
39
 
40
+ if (!$stream->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',')) {
41
  break;
42
  }
43
  } while (true);
44
 
45
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
46
 
47
+ $node = new Twig_SupTwg_Node_Import($macro, new Twig_SupTwg_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag());
48
 
49
  foreach ($targets as $name => $alias) {
50
  if ($this->parser->isReservedMacroName($name)) {
51
+ throw new Twig_SupTwg_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
52
  }
53
 
54
  $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var'));
vendor/Twig/TokenParser/If.php CHANGED
@@ -25,14 +25,14 @@
25
  *
26
  * @final
27
  */
28
- class Twig_TokenParser_If extends Twig_TokenParser
29
  {
30
- public function parse(Twig_Token $token)
31
  {
32
  $lineno = $token->getLine();
33
  $expr = $this->parser->getExpressionParser()->parseExpression();
34
  $stream = $this->parser->getStream();
35
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
36
  $body = $this->parser->subparse(array($this, 'decideIfFork'));
37
  $tests = array($expr, $body);
38
  $else = null;
@@ -41,13 +41,13 @@ class Twig_TokenParser_If extends Twig_TokenParser
41
  while (!$end) {
42
  switch ($stream->next()->getValue()) {
43
  case 'else':
44
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
45
  $else = $this->parser->subparse(array($this, 'decideIfEnd'));
46
  break;
47
 
48
  case 'elseif':
49
  $expr = $this->parser->getExpressionParser()->parseExpression();
50
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
51
  $body = $this->parser->subparse(array($this, 'decideIfFork'));
52
  $tests[] = $expr;
53
  $tests[] = $body;
@@ -58,21 +58,21 @@ class Twig_TokenParser_If extends Twig_TokenParser
58
  break;
59
 
60
  default:
61
- throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext());
62
  }
63
  }
64
 
65
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
66
 
67
- return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag());
68
  }
69
 
70
- public function decideIfFork(Twig_Token $token)
71
  {
72
  return $token->test(array('elseif', 'else', 'endif'));
73
  }
74
 
75
- public function decideIfEnd(Twig_Token $token)
76
  {
77
  return $token->test(array('endif'));
78
  }
25
  *
26
  * @final
27
  */
28
+ class Twig_SupTwg_TokenParser_If extends Twig_SupTwg_TokenParser
29
  {
30
+ public function parse(Twig_SupTwg_Token $token)
31
  {
32
  $lineno = $token->getLine();
33
  $expr = $this->parser->getExpressionParser()->parseExpression();
34
  $stream = $this->parser->getStream();
35
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
36
  $body = $this->parser->subparse(array($this, 'decideIfFork'));
37
  $tests = array($expr, $body);
38
  $else = null;
41
  while (!$end) {
42
  switch ($stream->next()->getValue()) {
43
  case 'else':
44
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
45
  $else = $this->parser->subparse(array($this, 'decideIfEnd'));
46
  break;
47
 
48
  case 'elseif':
49
  $expr = $this->parser->getExpressionParser()->parseExpression();
50
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
51
  $body = $this->parser->subparse(array($this, 'decideIfFork'));
52
  $tests[] = $expr;
53
  $tests[] = $body;
58
  break;
59
 
60
  default:
61
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext());
62
  }
63
  }
64
 
65
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
66
 
67
+ return new Twig_SupTwg_Node_If(new Twig_SupTwg_Node($tests), $else, $lineno, $this->getTag());
68
  }
69
 
70
+ public function decideIfFork(Twig_SupTwg_Token $token)
71
  {
72
  return $token->test(array('elseif', 'else', 'endif'));
73
  }
74
 
75
+ public function decideIfEnd(Twig_SupTwg_Token $token)
76
  {
77
  return $token->test(array('endif'));
78
  }
vendor/Twig/TokenParser/Import.php CHANGED
@@ -18,18 +18,18 @@
18
  *
19
  * @final
20
  */
21
- class Twig_TokenParser_Import extends Twig_TokenParser
22
  {
23
- public function parse(Twig_Token $token)
24
  {
25
  $macro = $this->parser->getExpressionParser()->parseExpression();
26
  $this->parser->getStream()->expect('as');
27
- $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine());
28
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
29
 
30
  $this->parser->addImportedSymbol('template', $var->getAttribute('name'));
31
 
32
- return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag());
33
  }
34
 
35
  public function getTag()
18
  *
19
  * @final
20
  */
21
+ class Twig_SupTwg_TokenParser_Import extends Twig_SupTwg_TokenParser
22
  {
23
+ public function parse(Twig_SupTwg_Token $token)
24
  {
25
  $macro = $this->parser->getExpressionParser()->parseExpression();
26
  $this->parser->getStream()->expect('as');
27
+ $var = new Twig_SupTwg_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue(), $token->getLine());
28
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
29
 
30
  $this->parser->addImportedSymbol('template', $var->getAttribute('name'));
31
 
32
+ return new Twig_SupTwg_Node_Import($macro, $var, $token->getLine(), $this->getTag());
33
  }
34
 
35
  public function getTag()
vendor/Twig/TokenParser/Include.php CHANGED
@@ -21,15 +21,15 @@
21
  *
22
  * @final
23
  */
24
- class Twig_TokenParser_Include extends Twig_TokenParser
25
  {
26
- public function parse(Twig_Token $token)
27
  {
28
  $expr = $this->parser->getExpressionParser()->parseExpression();
29
 
30
  list($variables, $only, $ignoreMissing) = $this->parseArguments();
31
 
32
- return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
33
  }
34
 
35
  protected function parseArguments()
@@ -37,23 +37,23 @@ class Twig_TokenParser_Include extends Twig_TokenParser
37
  $stream = $this->parser->getStream();
38
 
39
  $ignoreMissing = false;
40
- if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) {
41
- $stream->expect(Twig_Token::NAME_TYPE, 'missing');
42
 
43
  $ignoreMissing = true;
44
  }
45
 
46
  $variables = null;
47
- if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) {
48
  $variables = $this->parser->getExpressionParser()->parseExpression();
49
  }
50
 
51
  $only = false;
52
- if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) {
53
  $only = true;
54
  }
55
 
56
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
57
 
58
  return array($variables, $only, $ignoreMissing);
59
  }
21
  *
22
  * @final
23
  */
24
+ class Twig_SupTwg_TokenParser_Include extends Twig_SupTwg_TokenParser
25
  {
26
+ public function parse(Twig_SupTwg_Token $token)
27
  {
28
  $expr = $this->parser->getExpressionParser()->parseExpression();
29
 
30
  list($variables, $only, $ignoreMissing) = $this->parseArguments();
31
 
32
+ return new Twig_SupTwg_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
33
  }
34
 
35
  protected function parseArguments()
37
  $stream = $this->parser->getStream();
38
 
39
  $ignoreMissing = false;
40
+ if ($stream->nextIf(Twig_SupTwg_Token::NAME_TYPE, 'ignore')) {
41
+ $stream->expect(Twig_SupTwg_Token::NAME_TYPE, 'missing');
42
 
43
  $ignoreMissing = true;
44
  }
45
 
46
  $variables = null;
47
+ if ($stream->nextIf(Twig_SupTwg_Token::NAME_TYPE, 'with')) {
48
  $variables = $this->parser->getExpressionParser()->parseExpression();
49
  }
50
 
51
  $only = false;
52
+ if ($stream->nextIf(Twig_SupTwg_Token::NAME_TYPE, 'only')) {
53
  $only = true;
54
  }
55
 
56
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
57
 
58
  return array($variables, $only, $ignoreMissing);
59
  }
vendor/Twig/TokenParser/Macro.php CHANGED
@@ -20,33 +20,33 @@
20
  *
21
  * @final
22
  */
23
- class Twig_TokenParser_Macro extends Twig_TokenParser
24
  {
25
- public function parse(Twig_Token $token)
26
  {
27
  $lineno = $token->getLine();
28
  $stream = $this->parser->getStream();
29
- $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
30
 
31
  $arguments = $this->parser->getExpressionParser()->parseArguments(true, true);
32
 
33
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
34
  $this->parser->pushLocalScope();
35
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
36
- if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
37
  $value = $token->getValue();
38
 
39
  if ($value != $name) {
40
- throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
41
  }
42
  }
43
  $this->parser->popLocalScope();
44
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
45
 
46
- $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag()));
47
  }
48
 
49
- public function decideBlockEnd(Twig_Token $token)
50
  {
51
  return $token->test('endmacro');
52
  }
20
  *
21
  * @final
22
  */
23
+ class Twig_SupTwg_TokenParser_Macro extends Twig_SupTwg_TokenParser
24
  {
25
+ public function parse(Twig_SupTwg_Token $token)
26
  {
27
  $lineno = $token->getLine();
28
  $stream = $this->parser->getStream();
29
+ $name = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
30
 
31
  $arguments = $this->parser->getExpressionParser()->parseArguments(true, true);
32
 
33
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
34
  $this->parser->pushLocalScope();
35
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
36
+ if ($token = $stream->nextIf(Twig_SupTwg_Token::NAME_TYPE)) {
37
  $value = $token->getValue();
38
 
39
  if ($value != $name) {
40
+ throw new Twig_SupTwg_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
41
  }
42
  }
43
  $this->parser->popLocalScope();
44
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
45
 
46
+ $this->parser->setMacro($name, new Twig_SupTwg_Node_Macro($name, new Twig_SupTwg_Node_Body(array($body)), $arguments, $lineno, $this->getTag()));
47
  }
48
 
49
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
50
  {
51
  return $token->test('endmacro');
52
  }
vendor/Twig/TokenParser/Sandbox.php CHANGED
@@ -22,32 +22,32 @@
22
  *
23
  * @final
24
  */
25
- class Twig_TokenParser_Sandbox extends Twig_TokenParser
26
  {
27
- public function parse(Twig_Token $token)
28
  {
29
  $stream = $this->parser->getStream();
30
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
31
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
32
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
33
 
34
  // in a sandbox tag, only include tags are allowed
35
- if (!$body instanceof Twig_Node_Include) {
36
  foreach ($body as $node) {
37
- if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) {
38
  continue;
39
  }
40
 
41
- if (!$node instanceof Twig_Node_Include) {
42
- throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext());
43
  }
44
  }
45
  }
46
 
47
- return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag());
48
  }
49
 
50
- public function decideBlockEnd(Twig_Token $token)
51
  {
52
  return $token->test('endsandbox');
53
  }
22
  *
23
  * @final
24
  */
25
+ class Twig_SupTwg_TokenParser_Sandbox extends Twig_SupTwg_TokenParser
26
  {
27
+ public function parse(Twig_SupTwg_Token $token)
28
  {
29
  $stream = $this->parser->getStream();
30
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
31
  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
32
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
33
 
34
  // in a sandbox tag, only include tags are allowed
35
+ if (!$body instanceof Twig_SupTwg_Node_Include) {
36
  foreach ($body as $node) {
37
+ if ($node instanceof Twig_SupTwg_Node_Text && ctype_space($node->getAttribute('data'))) {
38
  continue;
39
  }
40
 
41
+ if (!$node instanceof Twig_SupTwg_Node_Include) {
42
+ throw new Twig_SupTwg_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext());
43
  }
44
  }
45
  }
46
 
47
+ return new Twig_SupTwg_Node_Sandbox($body, $token->getLine(), $this->getTag());
48
  }
49
 
50
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
51
  {
52
  return $token->test('endsandbox');
53
  }
vendor/Twig/TokenParser/Set.php CHANGED
@@ -28,40 +28,40 @@
28
  *
29
  * @final
30
  */
31
- class Twig_TokenParser_Set extends Twig_TokenParser
32
  {
33
- public function parse(Twig_Token $token)
34
  {
35
  $lineno = $token->getLine();
36
  $stream = $this->parser->getStream();
37
  $names = $this->parser->getExpressionParser()->parseAssignmentExpression();
38
 
39
  $capture = false;
40
- if ($stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) {
41
  $values = $this->parser->getExpressionParser()->parseMultitargetExpression();
42
 
43
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
44
 
45
  if (count($names) !== count($values)) {
46
- throw new Twig_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
47
  }
48
  } else {
49
  $capture = true;
50
 
51
  if (count($names) > 1) {
52
- throw new Twig_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
53
  }
54
 
55
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
56
 
57
  $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
58
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
59
  }
60
 
61
- return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag());
62
  }
63
 
64
- public function decideBlockEnd(Twig_Token $token)
65
  {
66
  return $token->test('endset');
67
  }
28
  *
29
  * @final
30
  */
31
+ class Twig_SupTwg_TokenParser_Set extends Twig_SupTwg_TokenParser
32
  {
33
+ public function parse(Twig_SupTwg_Token $token)
34
  {
35
  $lineno = $token->getLine();
36
  $stream = $this->parser->getStream();
37
  $names = $this->parser->getExpressionParser()->parseAssignmentExpression();
38
 
39
  $capture = false;
40
+ if ($stream->nextIf(Twig_SupTwg_Token::OPERATOR_TYPE, '=')) {
41
  $values = $this->parser->getExpressionParser()->parseMultitargetExpression();
42
 
43
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
44
 
45
  if (count($names) !== count($values)) {
46
+ throw new Twig_SupTwg_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
47
  }
48
  } else {
49
  $capture = true;
50
 
51
  if (count($names) > 1) {
52
+ throw new Twig_SupTwg_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
53
  }
54
 
55
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
56
 
57
  $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
58
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
59
  }
60
 
61
+ return new Twig_SupTwg_Node_Set($capture, $names, $values, $lineno, $this->getTag());
62
  }
63
 
64
+ public function decideBlockEnd(Twig_SupTwg_Token $token)
65
  {
66
  return $token->test('endset');
67
  }
vendor/Twig/TokenParser/Spaceless.php CHANGED
@@ -24,20 +24,20 @@
24
  *
25
  * @final
26
  */
27
- class Twig_TokenParser_Spaceless extends Twig_TokenParser
28
  {
29
- public function parse(Twig_Token $token)
30
  {
31
  $lineno = $token->getLine();
32
 
33
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
34
  $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
35
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
36
 
37
- return new Twig_Node_Spaceless($body, $lineno, $this->getTag());
38
  }
39
 
40
- public function decideSpacelessEnd(Twig_Token $token)
41
  {
42
  return $token->test('endspaceless');
43
  }
24
  *
25
  * @final
26
  */
27
+ class Twig_SupTwg_TokenParser_Spaceless extends Twig_SupTwg_TokenParser
28
  {
29
+ public function parse(Twig_SupTwg_Token $token)
30
  {
31
  $lineno = $token->getLine();
32
 
33
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
34
  $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
35
+ $this->parser->getStream()->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
36
 
37
+ return new Twig_SupTwg_Node_Spaceless($body, $lineno, $this->getTag());
38
  }
39
 
40
+ public function decideSpacelessEnd(Twig_SupTwg_Token $token)
41
  {
42
  return $token->test('endspaceless');
43
  }
vendor/Twig/TokenParser/Use.php CHANGED
@@ -25,38 +25,38 @@
25
  *
26
  * @final
27
  */
28
- class Twig_TokenParser_Use extends Twig_TokenParser
29
  {
30
- public function parse(Twig_Token $token)
31
  {
32
  $template = $this->parser->getExpressionParser()->parseExpression();
33
  $stream = $this->parser->getStream();
34
 
35
- if (!$template instanceof Twig_Node_Expression_Constant) {
36
- throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
37
  }
38
 
39
  $targets = array();
40
  if ($stream->nextIf('with')) {
41
  do {
42
- $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
43
 
44
  $alias = $name;
45
  if ($stream->nextIf('as')) {
46
- $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
47
  }
48
 
49
- $targets[$name] = new Twig_Node_Expression_Constant($alias, -1);
50
 
51
- if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
52
  break;
53
  }
54
  } while (true);
55
  }
56
 
57
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
58
 
59
- $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
60
  }
61
 
62
  public function getTag()
25
  *
26
  * @final
27
  */
28
+ class Twig_SupTwg_TokenParser_Use extends Twig_SupTwg_TokenParser
29
  {
30
+ public function parse(Twig_SupTwg_Token $token)
31
  {
32
  $template = $this->parser->getExpressionParser()->parseExpression();
33
  $stream = $this->parser->getStream();
34
 
35
+ if (!$template instanceof Twig_SupTwg_Node_Expression_Constant) {
36
+ throw new Twig_SupTwg_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
37
  }
38
 
39
  $targets = array();
40
  if ($stream->nextIf('with')) {
41
  do {
42
+ $name = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
43
 
44
  $alias = $name;
45
  if ($stream->nextIf('as')) {
46
+ $alias = $stream->expect(Twig_SupTwg_Token::NAME_TYPE)->getValue();
47
  }
48
 
49
+ $targets[$name] = new Twig_SupTwg_Node_Expression_Constant($alias, -1);
50
 
51
+ if (!$stream->nextIf(Twig_SupTwg_Token::PUNCTUATION_TYPE, ',')) {
52
  break;
53
  }
54
  } while (true);
55
  }
56
 
57
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
58
 
59
+ $this->parser->addTrait(new Twig_SupTwg_Node(array('template' => $template, 'targets' => new Twig_SupTwg_Node($targets))));
60
  }
61
 
62
  public function getTag()
vendor/Twig/TokenParser/With.php CHANGED
@@ -16,29 +16,29 @@
16
  *
17
  * @final
18
  */
19
- class Twig_TokenParser_With extends Twig_TokenParser
20
  {
21
- public function parse(Twig_Token $token)
22
  {
23
  $stream = $this->parser->getStream();
24
 
25
  $variables = null;
26
  $only = false;
27
- if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
28
  $variables = $this->parser->getExpressionParser()->parseExpression();
29
- $only = $stream->nextIf(Twig_Token::NAME_TYPE, 'only');
30
  }
31
 
32
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
33
 
34
  $body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
35
 
36
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
37
 
38
- return new Twig_Node_With($body, $variables, $only, $token->getLine(), $this->getTag());
39
  }
40
 
41
- public function decideWithEnd(Twig_Token $token)
42
  {
43
  return $token->test('endwith');
44
  }
16
  *
17
  * @final
18
  */
19
+ class Twig_SupTwg_TokenParser_With extends Twig_SupTwg_TokenParser
20
  {
21
+ public function parse(Twig_SupTwg_Token $token)
22
  {
23
  $stream = $this->parser->getStream();
24
 
25
  $variables = null;
26
  $only = false;
27
+ if (!$stream->test(Twig_SupTwg_Token::BLOCK_END_TYPE)) {
28
  $variables = $this->parser->getExpressionParser()->parseExpression();
29
+ $only = $stream->nextIf(Twig_SupTwg_Token::NAME_TYPE, 'only');
30
  }
31
 
32
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
33
 
34
  $body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
35
 
36
+ $stream->expect(Twig_SupTwg_Token::BLOCK_END_TYPE);
37
 
38
+ return new Twig_SupTwg_Node_With($body, $variables, $only, $token->getLine(), $this->getTag());
39
  }
40
 
41
+ public function decideWithEnd(Twig_SupTwg_Token $token)
42
  {
43
  return $token->test('endwith');
44
  }
vendor/Twig/TokenParserBroker.php CHANGED
@@ -17,15 +17,15 @@
17
  *
18
  * @deprecated since 1.12 (to be removed in 2.0)
19
  */
20
- class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
21
  {
22
  protected $parser;
23
  protected $parsers = array();
24
  protected $brokers = array();
25
 
26
  /**
27
- * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
28
- * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances
29
  * @param bool $triggerDeprecationError
30
  */
31
  public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true)
@@ -35,25 +35,25 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
35
  }
36
 
37
  foreach ($parsers as $parser) {
38
- if (!$parser instanceof Twig_TokenParserInterface) {
39
- throw new LogicException('$parsers must a an array of Twig_TokenParserInterface.');
40
  }
41
  $this->parsers[$parser->getTag()] = $parser;
42
  }
43
  foreach ($brokers as $broker) {
44
- if (!$broker instanceof Twig_TokenParserBrokerInterface) {
45
- throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface.');
46
  }
47
  $this->brokers[] = $broker;
48
  }
49
  }
50
 
51
- public function addTokenParser(Twig_TokenParserInterface $parser)
52
  {
53
  $this->parsers[$parser->getTag()] = $parser;
54
  }
55
 
56
- public function removeTokenParser(Twig_TokenParserInterface $parser)
57
  {
58
  $name = $parser->getTag();
59
  if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) {
@@ -61,12 +61,12 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
61
  }
62
  }
63
 
64
- public function addTokenParserBroker(Twig_TokenParserBroker $broker)
65
  {
66
  $this->brokers[] = $broker;
67
  }
68
 
69
- public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
70
  {
71
  if (false !== $pos = array_search($broker, $this->brokers)) {
72
  unset($this->brokers[$pos]);
@@ -80,7 +80,7 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
80
  *
81
  * @param string $tag A tag name
82
  *
83
- * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
84
  */
85
  public function getTokenParser($tag)
86
  {
@@ -107,7 +107,7 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
107
  return $this->parser;
108
  }
109
 
110
- public function setParser(Twig_ParserInterface $parser)
111
  {
112
  $this->parser = $parser;
113
  foreach ($this->parsers as $tokenParser) {
17
  *
18
  * @deprecated since 1.12 (to be removed in 2.0)
19
  */
20
+ class Twig_SupTwg_TokenParserBroker implements Twig_SupTwg_TokenParserBrokerInterface
21
  {
22
  protected $parser;
23
  protected $parsers = array();
24
  protected $brokers = array();
25
 
26
  /**
27
+ * @param array|Traversable $parsers A Traversable of Twig_SupTwg_TokenParserInterface instances
28
+ * @param array|Traversable $brokers A Traversable of Twig_SupTwg_TokenParserBrokerInterface instances
29
  * @param bool $triggerDeprecationError
30
  */
31
  public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true)
35
  }
36
 
37
  foreach ($parsers as $parser) {
38
+ if (!$parser instanceof Twig_SupTwg_TokenParserInterface) {
39
+ throw new LogicException('$parsers must a an array of Twig_SupTwg_TokenParserInterface.');
40
  }
41
  $this->parsers[$parser->getTag()] = $parser;
42
  }
43
  foreach ($brokers as $broker) {
44
+ if (!$broker instanceof Twig_SupTwg_TokenParserBrokerInterface) {
45
+ throw new LogicException('$brokers must a an array of Twig_SupTwg_TokenParserBrokerInterface.');
46
  }
47
  $this->brokers[] = $broker;
48
  }
49
  }
50
 
51
+ public function addTokenParser(Twig_SupTwg_TokenParserInterface $parser)
52
  {
53
  $this->parsers[$parser->getTag()] = $parser;
54
  }
55
 
56
+ public function removeTokenParser(Twig_SupTwg_TokenParserInterface $parser)
57
  {
58
  $name = $parser->getTag();
59
  if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) {
61
  }
62
  }
63
 
64
+ public function addTokenParserBroker(Twig_SupTwg_TokenParserBroker $broker)
65
  {
66
  $this->brokers[] = $broker;
67
  }
68
 
69
+ public function removeTokenParserBroker(Twig_SupTwg_TokenParserBroker $broker)
70
  {
71
  if (false !== $pos = array_search($broker, $this->brokers)) {
72
  unset($this->brokers[$pos]);
80
  *
81
  * @param string $tag A tag name
82
  *
83
+ * @return null|Twig_SupTwg_TokenParserInterface A Twig_SupTwg_TokenParserInterface or null if no suitable TokenParser was found
84
  */
85
  public function getTokenParser($tag)
86
  {
107
  return $this->parser;
108
  }
109
 
110
+ public function setParser(Twig_SupTwg_ParserInterface $parser)
111
  {
112
  $this->parser = $parser;
113
  foreach ($this->parsers as $tokenParser) {
vendor/Twig/TokenParserBrokerInterface.php CHANGED
@@ -19,26 +19,26 @@
19
  *
20
  * @deprecated since 1.12 (to be removed in 2.0)
21
  */
22
- interface Twig_TokenParserBrokerInterface
23
  {
24
  /**
25
  * Gets a TokenParser suitable for a tag.
26
  *
27
  * @param string $tag A tag name
28
  *
29
- * @return Twig_TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found
30
  */
31
  public function getTokenParser($tag);
32
 
33
  /**
34
- * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
35
  */
36
- public function setParser(Twig_ParserInterface $parser);
37
 
38
  /**
39
- * Gets the Twig_ParserInterface.
40
  *
41
- * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null
42
  */
43
  public function getParser();
44
  }
19
  *
20
  * @deprecated since 1.12 (to be removed in 2.0)
21
  */
22
+ interface Twig_SupTwg_TokenParserBrokerInterface
23
  {
24
  /**
25
  * Gets a TokenParser suitable for a tag.
26
  *
27
  * @param string $tag A tag name
28
  *
29
+ * @return Twig_SupTwg_TokenParserInterface|null A Twig_SupTwg_TokenParserInterface or null if no suitable TokenParser was found
30
  */
31
  public function getTokenParser($tag);
32
 
33
  /**
34
+ * Calls Twig_SupTwg_TokenParserInterface::setParser on all parsers the implementation knows of.
35
  */
36
+ public function setParser(Twig_SupTwg_ParserInterface $parser);
37
 
38
  /**
39
+ * Gets the Twig_SupTwg_ParserInterface.
40
  *
41
+ * @return null|Twig_SupTwg_ParserInterface A Twig_SupTwg_ParserInterface instance or null
42
  */
43
  public function getParser();
44
  }
vendor/Twig/TokenParserInterface.php CHANGED
@@ -14,21 +14,21 @@
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
- interface Twig_TokenParserInterface
18
  {
19
  /**
20
  * Sets the parser associated with this token parser.
21
  */
22
- public function setParser(Twig_Parser $parser);
23
 
24
  /**
25
  * Parses a token and returns a node.
26
  *
27
- * @return Twig_NodeInterface
28
  *
29
- * @throws Twig_Error_Syntax
30
  */
31
- public function parse(Twig_Token $token);
32
 
33
  /**
34
  * Gets the tag name associated with this token parser.
14
  *
15
  * @author Fabien Potencier <fabien@symfony.com>
16
  */
17
+ interface Twig_SupTwg_TokenParserInterface
18
  {
19
  /**
20
  * Sets the parser associated with this token parser.
21
  */
22
+ public function setParser(Twig_SupTwg_Parser $parser);
23
 
24
  /**
25
  * Parses a token and returns a node.
26
  *
27
+ * @return Twig_SupTwg_NodeInterface
28
  *
29
+ * @throws Twig_SupTwg_Error_Syntax
30
  */
31
+ public function parse(Twig_SupTwg_Token $token);
32
 
33
  /**
34
  * Gets the tag name associated with this token parser.
vendor/Twig/TokenStream.php CHANGED
@@ -17,7 +17,7 @@
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
- class Twig_TokenStream
21
  {
22
  protected $tokens;
23
  protected $current = 0;
@@ -32,11 +32,11 @@ class Twig_TokenStream
32
  */
33
  public function __construct(array $tokens, $name = null, $source = null)
34
  {
35
- if (!$name instanceof Twig_Source) {
36
  if (null !== $name || null !== $source) {
37
- @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
38
  }
39
- $this->source = new Twig_Source($source, $name);
40
  } else {
41
  $this->source = $name;
42
  }
@@ -60,12 +60,12 @@ class Twig_TokenStream
60
  /**
61
  * Sets the pointer to the next token and returns the old one.
62
  *
63
- * @return Twig_Token
64
  */
65
  public function next()
66
  {
67
  if (!isset($this->tokens[++$this->current])) {
68
- throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source);
69
  }
70
 
71
  return $this->tokens[$this->current - 1];
@@ -74,7 +74,7 @@ class Twig_TokenStream
74
  /**
75
  * Tests a token, sets the pointer to the next one and returns it or throws a syntax error.
76
  *
77
- * @return Twig_Token|null The next token if the condition is true, null otherwise
78
  */
79
  public function nextIf($primary, $secondary = null)
80
  {
@@ -86,17 +86,17 @@ class Twig_TokenStream
86
  /**
87
  * Tests a token and returns it or throws a syntax error.
88
  *
89
- * @return Twig_Token
90
  */
91
  public function expect($type, $value = null, $message = null)
92
  {
93
  $token = $this->tokens[$this->current];
94
  if (!$token->test($type, $value)) {
95
  $line = $token->getLine();
96
- throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).',
97
  $message ? $message.'. ' : '',
98
- Twig_Token::typeToEnglish($token->getType()), $token->getValue(),
99
- Twig_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''),
100
  $line,
101
  $this->source
102
  );
@@ -111,12 +111,12 @@ class Twig_TokenStream
111
  *
112
  * @param int $number
113
  *
114
- * @return Twig_Token
115
  */
116
  public function look($number = 1)
117
  {
118
  if (!isset($this->tokens[$this->current + $number])) {
119
- throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source);
120
  }
121
 
122
  return $this->tokens[$this->current + $number];
@@ -139,11 +139,11 @@ class Twig_TokenStream
139
  */
140
  public function isEOF()
141
  {
142
- return $this->tokens[$this->current]->getType() === Twig_Token::EOF_TYPE;
143
  }
144
 
145
  /**
146
- * @return Twig_Token
147
  */
148
  public function getCurrent()
149
  {
@@ -183,7 +183,7 @@ class Twig_TokenStream
183
  /**
184
  * Gets the source associated with this stream.
185
  *
186
- * @return Twig_Source
187
  *
188
  * @internal
189
  */
17
  *
18
  * @author Fabien Potencier <fabien@symfony.com>
19
  */
20
+ class Twig_SupTwg_TokenStream
21
  {
22
  protected $tokens;
23
  protected $current = 0;
32
  */
33
  public function __construct(array $tokens, $name = null, $source = null)
34
  {
35
+ if (!$name instanceof Twig_SupTwg_Source) {
36
  if (null !== $name || null !== $source) {
37
+ @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwg_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
38
  }
39
+ $this->source = new Twig_SupTwg_Source($source, $name);
40
  } else {
41
  $this->source = $name;
42
  }
60
  /**
61
  * Sets the pointer to the next token and returns the old one.
62
  *
63
+ * @return Twig_SupTwg_Token
64
  */
65
  public function next()
66
  {
67
  if (!isset($this->tokens[++$this->current])) {
68
+ throw new Twig_SupTwg_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source);
69
  }
70
 
71
  return $this->tokens[$this->current - 1];
74
  /**
75
  * Tests a token, sets the pointer to the next one and returns it or throws a syntax error.
76
  *
77
+ * @return Twig_SupTwg_Token|null The next token if the condition is true, null otherwise
78
  */
79
  public function nextIf($primary, $secondary = null)
80
  {
86
  /**
87
  * Tests a token and returns it or throws a syntax error.
88
  *
89
+ * @return Twig_SupTwg_Token
90
  */
91
  public function expect($type, $value = null, $message = null)
92
  {
93
  $token = $this->tokens[$this->current];
94
  if (!$token->test($type, $value)) {
95
  $line = $token->getLine();
96
+ throw new Twig_SupTwg_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).',
97
  $message ? $message.'. ' : '',
98
+ Twig_SupTwg_Token::typeToEnglish($token->getType()), $token->getValue(),
99
+ Twig_SupTwg_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''),
100
  $line,
101
  $this->source
102
  );
111
  *
112
  * @param int $number
113
  *
114
+ * @return Twig_SupTwg_Token
115
  */
116
  public function look($number = 1)
117
  {
118
  if (!isset($this->tokens[$this->current + $number])) {
119
+ throw new Twig_SupTwg_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source);
120
  }
121
 
122
  return $this->tokens[$this->current + $number];
139
  */
140
  public function isEOF()
141
  {
142
+ return $this->tokens[$this->current]->getType() === Twig_SupTwg_Token::EOF_TYPE;
143
  }
144
 
145
  /**
146
+ * @return Twig_SupTwg_Token
147
  */
148
  public function getCurrent()
149
  {
183
  /**
184
  * Gets the source associated with this stream.
185
  *
186
+ * @return Twig_SupTwg_Source
187
  *
188
  * @internal
189
  */
vendor/Twig/Util/DeprecationCollector.php CHANGED
@@ -14,12 +14,12 @@
14
  *
15
  * @final
16
  */
17
- class Twig_Util_DeprecationCollector
18
  {
19
  private $twig;
20
  private $deprecations;
21
 
22
- public function __construct(Twig_Environment $twig)
23
  {
24
  $this->twig = $twig;
25
  }
@@ -40,7 +40,7 @@ class Twig_Util_DeprecationCollector
40
  ), '{'.preg_quote($ext).'$}'
41
  );
42
 
43
- return $this->collect(new Twig_Util_TemplateDirIterator($iterator));
44
  }
45
 
46
  /**
@@ -58,8 +58,8 @@ class Twig_Util_DeprecationCollector
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
  }
65
  }
14
  *
15
  * @final
16
  */
17
+ class Twig_SupTwg_Util_DeprecationCollector
18
  {
19
  private $twig;
20
  private $deprecations;
21
 
22
+ public function __construct(Twig_SupTwg_Environment $twig)
23
  {
24
  $this->twig = $twig;
25
  }
40
  ), '{'.preg_quote($ext).'$}'
41
  );
42
 
43
+ return $this->collect(new Twig_SupTwg_Util_TemplateDirIterator($iterator));
44
  }
45
 
46
  /**
58
 
59
  foreach ($iterator as $name => $contents) {
60
  try {
61
+ $this->twig->parse($this->twig->tokenize(new Twig_SupTwg_Source($contents, $name)));
62
+ } catch (Twig_SupTwg_Error_Syntax $e) {
63
  // ignore templates containing syntax errors
64
  }
65
  }
vendor/Twig/Util/TemplateDirIterator.php CHANGED
@@ -12,7 +12,7 @@
12
  /**
13
  * @author Fabien Potencier <fabien@symfony.com>
14
  */
15
- class Twig_Util_TemplateDirIterator extends IteratorIterator
16
  {
17
  public function current()
18
  {
12
  /**
13
  * @author Fabien Potencier <fabien@symfony.com>
14
  */
15
+ class Twig_SupTwg_Util_TemplateDirIterator extends IteratorIterator
16
  {
17
  public function current()
18
  {