Version Description
Download this release
Release Info
Developer | supsystic.com |
Plugin | Data Tables Generator by Supsystic |
Version | 1.10.23 |
Comparing to | |
See all releases |
Code changes from version 1.10.20 to 1.10.23
- app/SupsysticTables.php +7 -7
- app/assets/css/supsystic-ui.css +19 -4
- app/templates/layout.twig +50 -11
- index.php +20 -1
- readme.txt +17 -1
- src/SupsysticTables/Core/BaseController.php +6 -6
- src/SupsysticTables/Core/BaseModel.php +4 -4
- src/SupsysticTables/Core/BaseModule.php +1 -1
- src/SupsysticTables/Core/Controller.php +1 -1
- src/SupsysticTables/Core/ModelsFactory.php +8 -8
- src/SupsysticTables/Core/Module.php +37 -5
- src/SupsysticTables/Featuredplugins/Controller.php +0 -53
- src/SupsysticTables/Featuredplugins/Module.php +0 -57
- src/SupsysticTables/Featuredplugins/assets/css/admin.featured-plugins.css +0 -289
- src/SupsysticTables/Featuredplugins/assets/css/img/bg_texture.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Backup_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Coming_Soon_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Contact_Form_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Data_Tables_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Digital_Publication_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Gallery_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Google_Maps_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Live_Chat_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Popup_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Pricing_Table_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/Slider_256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/heatmap.jpg +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/icon-256x256.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/kinsta_banner.png +0 -0
- src/SupsysticTables/Featuredplugins/assets/img/shapes.jpg +0 -0
- src/SupsysticTables/Featuredplugins/views/index.twig +0 -46
- src/SupsysticTables/Migrationfree/Controller.php +3 -3
- src/SupsysticTables/Overview/Controller.php +64 -6
- src/SupsysticTables/Overview/Module.php +4 -4
- src/SupsysticTables/Overview/assets/css/overview.css +253 -47
- src/SupsysticTables/Overview/assets/img/overview-01.png +0 -0
- src/SupsysticTables/Overview/assets/img/overview-02.png +0 -0
- src/SupsysticTables/Overview/assets/img/overview-03.png +0 -0
- src/SupsysticTables/Overview/assets/img/plugin-icon.png +0 -0
- src/SupsysticTables/Overview/assets/img/supsystic-logo-small.png +0 -0
- src/SupsysticTables/Overview/assets/js/overview.settings.js +143 -10
- src/SupsysticTables/Overview/views/index.twig +191 -162
- src/SupsysticTables/Promo/Controller.php +4 -4
- src/SupsysticTables/Promo/Module.php +52 -52
- src/SupsysticTables/Settings/Controller.php +4 -4
- src/SupsysticTables/Tables/Controller.php +45 -45
- src/SupsysticTables/Tables/Model/Tables.php +2 -2
- src/SupsysticTables/Tables/Module.php +2 -2
- src/SupsysticTables/Tables/views/view.twig +5 -5
- src/SupsysticTables/Ui/Asset.php +2 -2
- vendor/Rsc/Autoloader.php +7 -7
- vendor/Rsc/Cache.php +6 -6
- vendor/Rsc/Cache/Dummy.php +1 -1
- vendor/Rsc/Cache/Filesystem.php +1 -1
- vendor/Rsc/Cache/Interface.php +1 -1
- vendor/Rsc/ClassLoader.php +8 -8
- vendor/Rsc/Common/Collection.php +31 -7
- vendor/Rsc/Config.php +11 -11
- vendor/Rsc/Config/ListenerInterface.php +1 -1
- vendor/Rsc/Config/Loader.php +4 -4
- vendor/Rsc/Dispatcher.php +8 -8
- vendor/Rsc/Environment.php +45 -55
- vendor/Rsc/Environment/Aware.php +4 -4
- vendor/Rsc/Environment/AwareInterface.php +3 -3
- vendor/Rsc/Exception/ConfigLoaderException.php +1 -1
- vendor/Rsc/Exception/EnvironmentRuntimeException.php +1 -1
- vendor/Rsc/Exception/LangException.php +1 -1
- vendor/Rsc/Feedback/Mailer.php +6 -6
- vendor/Rsc/Feedback/SupportMailer.php +9 -9
- vendor/Rsc/Form/Filter/Custom.php +1 -1
- vendor/Rsc/Form/Filter/Interface.php +1 -1
- vendor/Rsc/Form/Filter/XssClear.php +1 -1
- vendor/Rsc/Form/Rule/Interface.php +1 -1
- vendor/Rsc/Form/Rule/Numeric.php +2 -2
- vendor/Rsc/Form/Rule/Regex.php +3 -3
- vendor/Rsc/Form/Rule/Required.php +3 -3
- vendor/Rsc/Form/Validator.php +27 -27
- vendor/Rsc/Form/Validator/EmptyRequestException.php +1 -1
- vendor/Rsc/Form/Validator/InvalidMethodException.php +1 -1
- vendor/Rsc/Form/Validator/UnexpectedRuleException.php +1 -1
- vendor/Rsc/Html.php +1 -1
- vendor/Rsc/Http/Parameters.php +1 -1
- vendor/Rsc/Http/Request.php +12 -12
- vendor/Rsc/Http/Response.php +3 -3
- vendor/Rsc/Http/ServerParameters.php +1 -1
- vendor/Rsc/Installer.php +4 -4
- vendor/Rsc/Installer/Parser.php +2 -2
- vendor/Rsc/Installer/PhpParser.php +1 -1
- vendor/Rsc/Lang.php +11 -11
- vendor/Rsc/Logger.php +3 -3
- vendor/Rsc/Logger/AwareInterface.php +3 -3
- vendor/Rsc/Logger/Exception/InvalidPathException.php +2 -2
- vendor/Rsc/Logger/Interface.php +1 -1
- vendor/Rsc/Menu/Item.php +9 -9
- vendor/Rsc/Menu/Page.php +16 -16
- vendor/Rsc/Mvc/Controller.php +14 -14
- vendor/Rsc/Mvc/Model.php +1 -1
- vendor/Rsc/Mvc/Module.php +13 -13
- vendor/Rsc/Profiler.php +1 -1
- vendor/Rsc/Resolver.php +20 -20
- vendor/Twig/Autoloader.php +5 -5
- vendor/Twig/BaseNodeVisitor.php +12 -12
- vendor/Twig/Cache/Filesystem.php +1 -1
- vendor/Twig/Cache/Null.php +1 -1
- vendor/Twig/CacheInterface.php +1 -1
- vendor/Twig/Compiler.php +11 -11
- vendor/Twig/CompilerInterface.php +2 -2
- vendor/Twig/ContainerRuntimeLoader.php +1 -1
- vendor/Twig/Environment.php +158 -158
- vendor/Twig/Error.php +12 -12
- vendor/Twig/Error/Loader.php +3 -3
- vendor/Twig/Error/Runtime.php +1 -1
- vendor/Twig/Error/Syntax.php +1 -1
- vendor/Twig/ExistsLoaderInterface.php +1 -1
- vendor/Twig/ExpressionParser.php +140 -140
- vendor/Twig/Extension.php +4 -4
- vendor/Twig/Extension/Core.php +227 -227
- vendor/Twig/Extension/Debug.php +4 -4
- vendor/Twig/Extension/Escaper.php +8 -8
- vendor/Twig/Extension/GlobalsInterface.php +2 -2
- vendor/Twig/Extension/InitRuntimeInterface.php +2 -2
- vendor/Twig/Extension/Optimizer.php +2 -2
- vendor/Twig/Extension/Profiler.php +5 -5
- vendor/Twig/Extension/Sandbox.php +5 -5
- vendor/Twig/Extension/Staging.php +8 -8
- vendor/Twig/Extension/StringLoader.php +5 -5
- vendor/Twig/ExtensionInterface.php +9 -9
- vendor/Twig/FactoryRuntimeLoader.php +1 -1
- vendor/Twig/FileExtensionEscapingStrategy.php +1 -1
- vendor/Twig/Filter.php +4 -4
- vendor/Twig/Filter/Function.php +3 -3
- vendor/Twig/Filter/Method.php +4 -4
- vendor/Twig/Filter/Node.php +3 -3
- vendor/Twig/FilterCallableInterface.php +2 -2
- vendor/Twig/FilterInterface.php +3 -3
- vendor/Twig/Function.php +4 -4
- vendor/Twig/Function/Function.php +3 -3
- vendor/Twig/Function/Method.php +4 -4
- vendor/Twig/Function/Node.php +3 -3
- vendor/Twig/FunctionCallableInterface.php +2 -2
- vendor/Twig/FunctionInterface.php +3 -3
- vendor/Twig/Lexer.php +48 -48
- vendor/Twig/LexerInterface.php +4 -4
- vendor/Twig/Loader/Array.php +7 -7
- vendor/Twig/Loader/Chain.php +21 -21
- vendor/Twig/Loader/Filesystem.php +17 -17
- vendor/Twig/Loader/String.php +4 -4
- vendor/Twig/LoaderInterface.php +5 -5
- vendor/Twig/Markup.php +2 -2
- vendor/Twig/Node.php +21 -17
- vendor/Twig/Node/AutoEscape.php +3 -3
- vendor/Twig/Node/Block.php +3 -3
- vendor/Twig/Node/BlockReference.php +2 -2
- vendor/Twig/Node/Body.php +1 -1
- vendor/Twig/Node/CheckSecurity.php +8 -8
- vendor/Twig/Node/Do.php +3 -3
- vendor/Twig/Node/Embed.php +4 -4
- vendor/Twig/Node/Expression.php +1 -1
- vendor/Twig/Node/Expression/Array.php +6 -6
- vendor/Twig/Node/Expression/AssignName.php +2 -2
- vendor/Twig/Node/Expression/Binary.php +4 -4
- vendor/Twig/Node/Expression/Binary/Add.php +2 -2
- vendor/Twig/Node/Expression/Binary/And.php +2 -2
- vendor/Twig/Node/Expression/Binary/BitwiseAnd.php +2 -2
- vendor/Twig/Node/Expression/Binary/BitwiseOr.php +2 -2
- vendor/Twig/Node/Expression/Binary/BitwiseXor.php +2 -2
- vendor/Twig/Node/Expression/Binary/Concat.php +2 -2
- vendor/Twig/Node/Expression/Binary/Div.php +2 -2
- vendor/Twig/Node/Expression/Binary/EndsWith.php +3 -3
- vendor/Twig/Node/Expression/Binary/Equal.php +2 -2
- vendor/Twig/Node/Expression/Binary/FloorDiv.php +3 -3
- vendor/Twig/Node/Expression/Binary/Greater.php +2 -2
- vendor/Twig/Node/Expression/Binary/GreaterEqual.php +2 -2
- vendor/Twig/Node/Expression/Binary/In.php +4 -4
- vendor/Twig/Node/Expression/Binary/Less.php +2 -2
- vendor/Twig/Node/Expression/Binary/LessEqual.php +2 -2
- vendor/Twig/Node/Expression/Binary/Matches.php +3 -3
- vendor/Twig/Node/Expression/Binary/Mod.php +2 -2
- vendor/Twig/Node/Expression/Binary/Mul.php +2 -2
- vendor/Twig/Node/Expression/Binary/NotEqual.php +2 -2
- vendor/Twig/Node/Expression/Binary/NotIn.php +4 -4
- vendor/Twig/Node/Expression/Binary/Or.php +2 -2
- vendor/Twig/Node/Expression/Binary/Power.php +3 -3
- vendor/Twig/Node/Expression/Binary/Range.php +3 -3
- vendor/Twig/Node/Expression/Binary/StartsWith.php +3 -3
- vendor/Twig/Node/Expression/Binary/Sub.php +2 -2
- vendor/Twig/Node/Expression/BlockReference.php +7 -7
- vendor/Twig/Node/Expression/Call.php +13 -13
- vendor/Twig/Node/Expression/Conditional.php +3 -3
- vendor/Twig/Node/Expression/Constant.php +2 -2
- vendor/Twig/Node/Expression/ExtensionReference.php +3 -3
- vendor/Twig/Node/Expression/Filter.php +5 -5
- vendor/Twig/Node/Expression/Filter/Default.php +8 -8
- vendor/Twig/Node/Expression/Function.php +6 -6
- vendor/Twig/Node/Expression/GetAttr.php +7 -7
- vendor/Twig/Node/Expression/MethodCall.php +4 -4
- vendor/Twig/Node/Expression/Name.php +2 -2
- vendor/Twig/Node/Expression/NullCoalesce.php +7 -7
- vendor/Twig/Node/Expression/Parent.php +2 -2
- vendor/Twig/Node/Expression/TempName.php +2 -2
- vendor/Twig/Node/Expression/Test.php +5 -5
- vendor/Twig/Node/Expression/Test/Constant.php +2 -2
- vendor/Twig/Node/Expression/Test/Defined.php +12 -12
- vendor/Twig/Node/Expression/Test/Divisibleby.php +2 -2
- vendor/Twig/Node/Expression/Test/Even.php +2 -2
- vendor/Twig/Node/Expression/Test/Null.php +2 -2
- vendor/Twig/Node/Expression/Test/Odd.php +2 -2
- vendor/Twig/Node/Expression/Test/Sameas.php +2 -2
- vendor/Twig/Node/Expression/Unary.php +4 -4
- vendor/Twig/Node/Expression/Unary/Neg.php +2 -2
- vendor/Twig/Node/Expression/Unary/Not.php +2 -2
- vendor/Twig/Node/Expression/Unary/Pos.php +2 -2
- vendor/Twig/Node/Flush.php +2 -2
- vendor/Twig/Node/For.php +6 -6
- vendor/Twig/Node/ForLoop.php +2 -2
- vendor/Twig/Node/If.php +3 -3
- vendor/Twig/Node/Import.php +4 -4
- vendor/Twig/Node/Include.php +6 -6
- vendor/Twig/Node/Macro.php +5 -5
- vendor/Twig/Node/Module.php +38 -38
- vendor/Twig/Node/Print.php +3 -3
- vendor/Twig/Node/Sandbox.php +4 -4
- vendor/Twig/Node/SandboxedPrint.php +7 -7
- vendor/Twig/Node/Set.php +8 -8
- vendor/Twig/Node/SetTemp.php +2 -2
- vendor/Twig/Node/Spaceless.php +3 -3
- vendor/Twig/Node/Text.php +2 -2
- vendor/Twig/Node/With.php +4 -4
- vendor/Twig/NodeCaptureInterface.php +1 -1
- vendor/Twig/NodeInterface.php +2 -2
- vendor/Twig/NodeOutputInterface.php +1 -1
- vendor/Twig/NodeTraverser.php +9 -9
- vendor/Twig/NodeVisitor/Escaper.php +24 -24
- vendor/Twig/NodeVisitor/Optimizer.php +37 -37
- vendor/Twig/NodeVisitor/SafeAnalysis.php +13 -13
- vendor/Twig/NodeVisitor/Sandbox.php +11 -11
- vendor/Twig/NodeVisitorInterface.php +6 -6
- vendor/Twig/Parser.php +43 -43
- vendor/Twig/ParserInterface.php +4 -4
- vendor/Twig/Profiler/Dumper/Blackfire.php +4 -4
- vendor/Twig/Profiler/Dumper/Html.php +5 -5
- vendor/Twig/Profiler/Dumper/Text.php +6 -6
- vendor/Twig/Profiler/Node/EnterProfile.php +3 -3
- vendor/Twig/Profiler/Node/LeaveProfile.php +2 -2
- vendor/Twig/Profiler/NodeVisitor/Profiler.php +14 -14
- vendor/Twig/Profiler/Profile.php +2 -2
- vendor/Twig/RuntimeLoaderInterface.php +1 -1
- vendor/Twig/Sandbox/SecurityError.php +1 -1
- vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php +1 -1
- vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php +1 -1
- vendor/Twig/Sandbox/SecurityNotAllowedMethodError.php +1 -1
- vendor/Twig/Sandbox/SecurityNotAllowedPropertyError.php +1 -1
- vendor/Twig/Sandbox/SecurityNotAllowedTagError.php +1 -1
- vendor/Twig/Sandbox/SecurityPolicy.php +7 -7
- vendor/Twig/Sandbox/SecurityPolicyInterface.php +1 -1
- vendor/Twig/SimpleFilter.php +3 -3
- vendor/Twig/SimpleFunction.php +3 -3
- vendor/Twig/SimpleTest.php +2 -2
- vendor/Twig/Source.php +1 -1
- vendor/Twig/SourceContextLoaderInterface.php +3 -3
- vendor/Twig/Template.php +40 -40
- vendor/Twig/TemplateInterface.php +2 -2
- vendor/Twig/TemplateWrapper.php +4 -4
- vendor/Twig/Test.php +2 -2
- vendor/Twig/Test/Function.php +2 -2
- vendor/Twig/Test/IntegrationTestCase.php +11 -11
- vendor/Twig/Test/Method.php +3 -3
- vendor/Twig/Test/Node.php +2 -2
- vendor/Twig/Test/NodeTestCase.php +7 -7
- vendor/Twig/TestCallableInterface.php +1 -1
- vendor/Twig/TestInterface.php +1 -1
- vendor/Twig/Token.php +2 -2
- vendor/Twig/TokenParser.php +3 -3
- vendor/Twig/TokenParser/AutoEscape.php +12 -12
- vendor/Twig/TokenParser/Block.php +13 -13
- vendor/Twig/TokenParser/Do.php +4 -4
- vendor/Twig/TokenParser/Embed.php +13 -13
- vendor/Twig/TokenParser/Extends.php +5 -5
- vendor/Twig/TokenParser/Filter.php +8 -8
- vendor/Twig/TokenParser/Flush.php +4 -4
- vendor/Twig/TokenParser/For.php +22 -22
- vendor/Twig/TokenParser/From.php +8 -8
- vendor/Twig/TokenParser/If.php +10 -10
- vendor/Twig/TokenParser/Import.php +5 -5
- vendor/Twig/TokenParser/Include.php +8 -8
- vendor/Twig/TokenParser/Macro.php +9 -9
- vendor/Twig/TokenParser/Sandbox.php +10 -10
- vendor/Twig/TokenParser/Set.php +10 -10
- vendor/Twig/TokenParser/Spaceless.php +6 -6
- vendor/Twig/TokenParser/Use.php +10 -10
- vendor/Twig/TokenParser/With.php +8 -8
- vendor/Twig/TokenParserBroker.php +14 -14
- vendor/Twig/TokenParserBrokerInterface.php +6 -6
- vendor/Twig/TokenParserInterface.php +5 -5
- vendor/Twig/TokenStream.php +18 -18
- vendor/Twig/Util/DeprecationCollector.php +5 -5
- vendor/Twig/Util/TemplateDirIterator.php +1 -1
app/SupsysticTables.php
CHANGED
@@ -9,16 +9,16 @@ class SupsysticTables
|
|
9 |
|
10 |
public function __construct()
|
11 |
{
|
12 |
-
if (!class_exists('
|
13 |
require dirname(dirname(__FILE__)) . '/vendor/Rsc/Autoloader.php';
|
14 |
-
|
15 |
}
|
16 |
|
17 |
add_action('init', array($this, 'addShortcodeButton'));
|
18 |
|
19 |
$menuSlug = 'supsystic-tables';
|
20 |
$pluginPath = dirname(dirname(__FILE__));
|
21 |
-
$environment = new
|
22 |
|
23 |
/* Configure */
|
24 |
$environment->configure(
|
@@ -32,8 +32,8 @@ class SupsysticTables
|
|
32 |
'plugin_source' => $pluginPath . '/src',
|
33 |
'plugin_title_name' => 'Data Tables',
|
34 |
'plugin_menu' => array(
|
35 |
-
'page_title' => __('Tables by Supsystic', $menuSlug),
|
36 |
-
'menu_title' => __('Tables by Supsystic', $menuSlug),
|
37 |
'capability' => 'manage_options',
|
38 |
'menu_slug' => $menuSlug,
|
39 |
'icon_url' => 'dashicons-editor-table',
|
@@ -226,11 +226,11 @@ class SupsysticTables
|
|
226 |
|
227 |
protected function getPluginEnvironment()
|
228 |
{
|
229 |
-
$environment =
|
230 |
|
231 |
if (defined('WP_DEBUG') && WP_DEBUG) {
|
232 |
if (defined('SUPSYSTIC_STB_DEBUG') && SUPSYSTIC_STB_DEBUG) {
|
233 |
-
$environment =
|
234 |
}
|
235 |
}
|
236 |
|
9 |
|
10 |
public function __construct()
|
11 |
{
|
12 |
+
if (!class_exists('RscDtgs_Autoloader', false)) {
|
13 |
require dirname(dirname(__FILE__)) . '/vendor/Rsc/Autoloader.php';
|
14 |
+
RscDtgs_Autoloader::register();
|
15 |
}
|
16 |
|
17 |
add_action('init', array($this, 'addShortcodeButton'));
|
18 |
|
19 |
$menuSlug = 'supsystic-tables';
|
20 |
$pluginPath = dirname(dirname(__FILE__));
|
21 |
+
$environment = new RscDtgs_Environment('st', '1.10.23', $pluginPath);
|
22 |
|
23 |
/* Configure */
|
24 |
$environment->configure(
|
32 |
'plugin_source' => $pluginPath . '/src',
|
33 |
'plugin_title_name' => 'Data Tables',
|
34 |
'plugin_menu' => array(
|
35 |
+
'page_title' => __('Data Tables by Supsystic', $menuSlug),
|
36 |
+
'menu_title' => __('Data Tables by Supsystic', $menuSlug),
|
37 |
'capability' => 'manage_options',
|
38 |
'menu_slug' => $menuSlug,
|
39 |
'icon_url' => 'dashicons-editor-table',
|
226 |
|
227 |
protected function getPluginEnvironment()
|
228 |
{
|
229 |
+
$environment = RscDtgs_Environment::ENV_PRODUCTION;
|
230 |
|
231 |
if (defined('WP_DEBUG') && WP_DEBUG) {
|
232 |
if (defined('SUPSYSTIC_STB_DEBUG') && SUPSYSTIC_STB_DEBUG) {
|
233 |
+
$environment = RscDtgs_Environment::ENV_DEVELOPMENT;
|
234 |
}
|
235 |
}
|
236 |
|
app/assets/css/supsystic-ui.css
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
.wrapper h1,
|
2 |
.wrapper h2 {
|
3 |
font-size: 23px;
|
@@ -67,12 +70,14 @@
|
|
67 |
box-sizing: border-box;
|
68 |
float: left;
|
69 |
position: relative;
|
70 |
-
width:
|
71 |
min-height: 353px;
|
72 |
}
|
73 |
|
74 |
.supsystic-plugin .supsystic-content .supsystic-container {
|
75 |
-
|
|
|
|
|
76 |
/*overflow: hidden;
|
77 |
margin-top: 10px;*/
|
78 |
}
|
@@ -302,6 +307,10 @@ input[type="color"] {
|
|
302 |
background-color: transparent;
|
303 |
margin-left: 75px;
|
304 |
padding: 5px 0px;
|
|
|
|
|
|
|
|
|
305 |
/*-moz-box-shadow: 0 3px 0 rgba(12,12,12,0.03);
|
306 |
-webkit-box-shadow: 0 3px 0 rgba(12,12,12,0.03);
|
307 |
box-shadow: 0 3px 0 rgba(12,12,12,0.03);*/
|
@@ -326,10 +335,13 @@ input[type="color"] {
|
|
326 |
.supsystic-container .supsystic-item {
|
327 |
min-height:420px !important;
|
328 |
}
|
|
|
|
|
|
|
|
|
329 |
.supsystic-item {
|
330 |
background: #fff;
|
331 |
-
|
332 |
-
padding-bottom: 20px;
|
333 |
position: relative;
|
334 |
}
|
335 |
|
@@ -930,3 +942,6 @@ h3.nav-tab-wrapper {
|
|
930 |
background: #4ae8ea !important;
|
931 |
border-color: #4ae8ea !important;
|
932 |
}
|
|
|
|
|
|
1 |
+
.wrapper {
|
2 |
+
margin: 10px 20px 0 2px;
|
3 |
+
}
|
4 |
.wrapper h1,
|
5 |
.wrapper h2 {
|
6 |
font-size: 23px;
|
70 |
box-sizing: border-box;
|
71 |
float: left;
|
72 |
position: relative;
|
73 |
+
width: 100%;
|
74 |
min-height: 353px;
|
75 |
}
|
76 |
|
77 |
.supsystic-plugin .supsystic-content .supsystic-container {
|
78 |
+
margin-left: 75px;
|
79 |
+
min-height: 360px;
|
80 |
+
background-color: #fff;
|
81 |
/*overflow: hidden;
|
82 |
margin-top: 10px;*/
|
83 |
}
|
307 |
background-color: transparent;
|
308 |
margin-left: 75px;
|
309 |
padding: 5px 0px;
|
310 |
+
background: #263546;
|
311 |
+
color: white;
|
312 |
+
margin-left: 75px;
|
313 |
+
padding: 10px;
|
314 |
/*-moz-box-shadow: 0 3px 0 rgba(12,12,12,0.03);
|
315 |
-webkit-box-shadow: 0 3px 0 rgba(12,12,12,0.03);
|
316 |
box-shadow: 0 3px 0 rgba(12,12,12,0.03);*/
|
335 |
.supsystic-container .supsystic-item {
|
336 |
min-height:420px !important;
|
337 |
}
|
338 |
+
.supsystic-container {
|
339 |
+
background: #fff;
|
340 |
+
padding: 10px 10px 10px 40px;
|
341 |
+
}
|
342 |
.supsystic-item {
|
343 |
background: #fff;
|
344 |
+
padding-bottom: 20px;
|
|
|
345 |
position: relative;
|
346 |
}
|
347 |
|
942 |
background: #4ae8ea !important;
|
943 |
border-color: #4ae8ea !important;
|
944 |
}
|
945 |
+
.supsystic-navigation ul li:hover a i, .supsystic-navigation ul li.active a i {
|
946 |
+
color: #4ae8ea;
|
947 |
+
}
|
app/templates/layout.twig
CHANGED
@@ -2,7 +2,14 @@
|
|
2 |
|
3 |
{% block layout %}
|
4 |
<div class="supsystic-plugin">
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<nav class="supsystic-navigation supsystic-sticky supsystic-sticky-active">
|
7 |
<ul>
|
8 |
{% block navigation %}
|
@@ -14,7 +21,7 @@
|
|
14 |
</li>
|
15 |
<li>
|
16 |
<a id="menuItem_addTable" href="#add">
|
17 |
-
<i class="fa fa-
|
18 |
<span>{{ environment.translate('Add new table') }}</span>
|
19 |
</a>
|
20 |
</li>
|
@@ -38,12 +45,6 @@
|
|
38 |
</a>
|
39 |
</li>
|
40 |
{% endif %}
|
41 |
-
<li {% if environment.isModule('featuredplugins') %} class="active"{% endif %}>
|
42 |
-
<a id="menuItem_tables" href="{{ environment.generateUrl('featuredplugins') }}">
|
43 |
-
<i class="fa fa-fw fa-heart"></i>
|
44 |
-
<span>{{ environment.translate('Featured Plugins') }}</span>
|
45 |
-
</a>
|
46 |
-
</li>
|
47 |
{% endblock %}
|
48 |
</ul>
|
49 |
<div class="clear"></div>
|
@@ -53,9 +54,9 @@
|
|
53 |
<div class="supsystic-container">
|
54 |
{{ environment.getDispatcher().dispatch('notices') }}
|
55 |
{{ environment.getDispatcher().dispatch('messages') }}
|
56 |
-
|
57 |
{% block content %}{% endblock %}
|
58 |
-
|
59 |
<div id="dtgAddDialog" style="display: none;" title="{{ environment.translate('Add new table') }}" style="min-height: 70px;">
|
60 |
<form id="tableForm">
|
61 |
<div class="supRow">
|
@@ -85,9 +86,47 @@
|
|
85 |
</div>
|
86 |
</div>
|
87 |
<!-- /#dtgAddDialog -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
</div>
|
89 |
<!-- /.supsystic-container -->
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
91 |
<!-- /.supsystic-content -->
|
92 |
</div>
|
93 |
<!-- /.supsystic-plugin -->
|
2 |
|
3 |
{% block layout %}
|
4 |
<div class="supsystic-plugin">
|
5 |
+
|
6 |
+
{% block header %}
|
7 |
+
<nav id="supsystic-breadcrumbs" class="supsystic-breadcrumbs">
|
8 |
+
<a href="{{ environment.generateUrl('tables') }}">{{ translate('Data Tables by Supsystic') }}</a>
|
9 |
+
</nav>
|
10 |
+
{% endblock %}
|
11 |
+
|
12 |
+
<section class="supsystic-content">
|
13 |
<nav class="supsystic-navigation supsystic-sticky supsystic-sticky-active">
|
14 |
<ul>
|
15 |
{% block navigation %}
|
21 |
</li>
|
22 |
<li>
|
23 |
<a id="menuItem_addTable" href="#add">
|
24 |
+
<i class="fa fa-plus-circle"></i>
|
25 |
<span>{{ environment.translate('Add new table') }}</span>
|
26 |
</a>
|
27 |
</li>
|
45 |
</a>
|
46 |
</li>
|
47 |
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
{% endblock %}
|
49 |
</ul>
|
50 |
<div class="clear"></div>
|
54 |
<div class="supsystic-container">
|
55 |
{{ environment.getDispatcher().dispatch('notices') }}
|
56 |
{{ environment.getDispatcher().dispatch('messages') }}
|
57 |
+
<div class="clear"></div>
|
58 |
{% block content %}{% endblock %}
|
59 |
+
<div class="clear"></div>
|
60 |
<div id="dtgAddDialog" style="display: none;" title="{{ environment.translate('Add new table') }}" style="min-height: 70px;">
|
61 |
<form id="tableForm">
|
62 |
<div class="supRow">
|
86 |
</div>
|
87 |
</div>
|
88 |
<!-- /#dtgAddDialog -->
|
89 |
+
|
90 |
+
{% if DTGS_AC_SHOW == true %}
|
91 |
+
<div class="supsysticOverviewACFormOverlay">
|
92 |
+
<form method="post" id="overview-ac-form" class="supsysticOverviewACForm">
|
93 |
+
<div class="supsysticOverviewACTitle">
|
94 |
+
<div class="supsysticOverviewACClose"><i class="fa fa-times" aria-hidden="true"></i></div>
|
95 |
+
<a href="https://supsystic.com/" target="_blank"><img src="{{ DTGS_PLUGIN_URL }}/src/SupsysticTables/Overview/assets/img/supsystic-logo-small.png"></a><br>
|
96 |
+
<b>PRO plugins</b> and <b>amazing gifts</b>!
|
97 |
+
</div>
|
98 |
+
<label>Name *</label>
|
99 |
+
<input type="text" name="username" value="{{ DTGS_USER_NAME }}">
|
100 |
+
<label>Email *</label>
|
101 |
+
<input type="text" name="email" value="{{ DTGS_USER_EMAIL }}">
|
102 |
+
<input type="hidden" name="_wpnonce" value="{{ _wpnonce }}">
|
103 |
+
<button id="subscribe-btn" type="submit" class="button button-primary button-hero">
|
104 |
+
<i class="fa fa-check-square" aria-hidden="true"></i>
|
105 |
+
Subscribe
|
106 |
+
</button>
|
107 |
+
<div class="button button-primary button-hero supsysticOverviewACBtn supsysticOverviewACBtnRemind"><i class="fa fa-hourglass-half" aria-hidden="true"></i> Remind me tomorrow</div>
|
108 |
+
<div class="button button-primary button-hero supsysticOverviewACBtn supsysticOverviewACBtnDisable"><i class="fa fa-times" aria-hidden="true"></i> Do not disturb me again</div>
|
109 |
+
<div class="supsysticOverviewACFormNotification" style="color: red; float: left;" hidden>Fields with * are required to fill</div>
|
110 |
+
</form>
|
111 |
+
<div class="clear"></div>
|
112 |
+
</div>
|
113 |
+
<div id="supsysticOverviewACFormDialog" hidden>
|
114 |
+
<div class="on-error" style="display:none">
|
115 |
+
<p>{{ translate('Some errors occurred while sending mail please send your message trough this contact form:') }}</p>
|
116 |
+
<p><a href="https://supsystic.com/plugins/photo-gallery/#contact" target="_blank">https://supsystic.com/plugins/photo-gallery/#contact</a></p>
|
117 |
+
</div>
|
118 |
+
<div class="message"></div>
|
119 |
+
</div>
|
120 |
+
{% endif %}
|
121 |
+
|
122 |
</div>
|
123 |
<!-- /.supsystic-container -->
|
124 |
+
<div class="supsystic-footer-wrapper">
|
125 |
+
<div class="supsystic-footer-add-review">Add your <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/data-tables-generator-by-supsystic?filter=5#postform">★★★★★</a> on wordpress.org</div>
|
126 |
+
<a href="https://supsystic.com/" target="_blank"><img src="{{DTGS_PLUGIN_URL}}/src/SupsysticTables/Overview/assets/img/supsystic-logo-small.png"></a>
|
127 |
+
<div class="supsystic-footer-plugin-version">Data Tables by Supsystic Version: {{' '}} {{DTGS_PLUGIN_VERSION}}</div>
|
128 |
+
</div>
|
129 |
+
</section>
|
130 |
<!-- /.supsystic-content -->
|
131 |
</div>
|
132 |
<!-- /.supsystic-plugin -->
|
index.php
CHANGED
@@ -4,13 +4,32 @@
|
|
4 |
* Plugin Name: Data Tables Generator by Supsystic
|
5 |
* Plugin URI: http://supsystic.com
|
6 |
* Description: Create and manage beautiful data tables with custom design. No HTML knowledge is required
|
7 |
-
* Version: 1.10.
|
8 |
* Author: supsystic.com
|
9 |
* Author URI: http://supsystic.com
|
10 |
* Text Domain: supsystic_tables
|
11 |
* Domain Path: /app/langs
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
include dirname(__FILE__) . '/app/SupsysticTables.php';
|
15 |
|
16 |
if (!defined('SUPSYSTIC_STB_DEBUG')) {
|
4 |
* Plugin Name: Data Tables Generator by Supsystic
|
5 |
* Plugin URI: http://supsystic.com
|
6 |
* Description: Create and manage beautiful data tables with custom design. No HTML knowledge is required
|
7 |
+
* Version: 1.10.23
|
8 |
* Author: supsystic.com
|
9 |
* Author URI: http://supsystic.com
|
10 |
* Text Domain: supsystic_tables
|
11 |
* Domain Path: /app/langs
|
12 |
*/
|
13 |
|
14 |
+
//Fix RSC Class rename for PRO plugin
|
15 |
+
function dtgsChangeProVersionNotice(){
|
16 |
+
global $pagenow;
|
17 |
+
if ( $pagenow == 'admin.php' || $pagenow == 'plugins.php' ) {
|
18 |
+
echo '<div class="notice notice-warning is-dismissible"><p><b>WARNING!</b> You using <b>OLD Data Tables by Supsystic PRO</b> version! For continued use and before activating the PRO plugin - please <b>UPDATE PRO VERSION</b>. Thank you.<br><b>You can download new compatible PRO version direct from this <a href="https://supsystic.com/pro/tables-generator-pro.zip">LINK</a></b>.</p></div>';
|
19 |
+
}
|
20 |
+
}
|
21 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
22 |
+
$proPluginPath = dirname(__FILE__);
|
23 |
+
$proPluginPath = str_replace('data-tables-generator-by-supsystic', 'tables-generator-pro', $proPluginPath);
|
24 |
+
$proPluginPath = $proPluginPath . '/index.php';
|
25 |
+
if (file_exists($proPluginPath)) {
|
26 |
+
$pluginData = get_file_data($proPluginPath, array('Version' => 'Version'), false);
|
27 |
+
if (!empty($pluginData['Version']) && version_compare($pluginData['Version'], '1.7.12', '<')) {
|
28 |
+
add_action('admin_notices', 'dtgsChangeProVersionNotice');
|
29 |
+
deactivate_plugins('tables-generator-pro/index.php');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
include dirname(__FILE__) . '/app/SupsysticTables.php';
|
34 |
|
35 |
if (!defined('SUPSYSTIC_STB_DEBUG')) {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://supsystic.com/plugins/data-tables-generator-plugin/
|
|
5 |
Donate link: https://supsystic.com/plugins/data-tables-generator-plugin/
|
6 |
Tags: data table, spreadsheet, table builder, charts, graphs, wordpress table plugin, excel, line chart, pie chart, visualise data
|
7 |
Tested up to: 6.0
|
8 |
-
Stable tag: 1.10.
|
9 |
|
10 |
Create data tables with charts and graphs. Custom design, navigation, searching and ordering functions. Export to PDF, CSV, Print. Excel spreadsheet. WooCommerce Integration.
|
11 |
|
@@ -217,6 +217,22 @@ It's perfect for product [Price List](http://woo.supsystic.com/price-list "Price
|
|
217 |
Create custom order forms which increase your conversion rate!
|
218 |
|
219 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
1.10.20 /19.06.2022 =
|
221 |
* XSS security fix
|
222 |
|
5 |
Donate link: https://supsystic.com/plugins/data-tables-generator-plugin/
|
6 |
Tags: data table, spreadsheet, table builder, charts, graphs, wordpress table plugin, excel, line chart, pie chart, visualise data
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 1.10.23
|
9 |
|
10 |
Create data tables with charts and graphs. Custom design, navigation, searching and ordering functions. Export to PDF, CSV, Print. Excel spreadsheet. WooCommerce Integration.
|
11 |
|
217 |
Create custom order forms which increase your conversion rate!
|
218 |
|
219 |
== Changelog ==
|
220 |
+
1.10.23 /30.08.2022 =
|
221 |
+
* REQUIRED PRO version min 1.7.12
|
222 |
+
|
223 |
+
1.10.22 /30.08.2022 =
|
224 |
+
* BEFORE update please deactivate PRO version. Only after that update Free version.
|
225 |
+
* REQUIRED PRO version min 1.7.13
|
226 |
+
|
227 |
+
|
228 |
+
1.10.21 /30.08.2022 =
|
229 |
+
* BEFORE update please deactivate PRO version. Only after that update Free version.
|
230 |
+
* REQUIRED PRO version min 1.7.13
|
231 |
+
* Major update
|
232 |
+
* Fixes for PHP 8.1
|
233 |
+
* Fixes for Wordpress 6.0
|
234 |
+
* interface updates
|
235 |
+
|
236 |
1.10.20 /19.06.2022 =
|
237 |
* XSS security fix
|
238 |
|
src/SupsysticTables/Core/BaseController.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
abstract class SupsysticTables_Core_BaseController extends
|
5 |
{
|
6 |
/**
|
7 |
* Returns an instance of the model.
|
@@ -17,7 +17,7 @@ abstract class SupsysticTables_Core_BaseController extends Rsc_Mvc_Controller
|
|
17 |
/**
|
18 |
* Creates an instance of the model and returns it.
|
19 |
* @param string $model
|
20 |
-
* @param string|
|
21 |
* @return SupsysticTables_Core_BaseModel
|
22 |
*/
|
23 |
public function createModel($model, $module = null)
|
@@ -51,12 +51,12 @@ abstract class SupsysticTables_Core_BaseController extends Rsc_Mvc_Controller
|
|
51 |
/**
|
52 |
* Returns AJAX success response.
|
53 |
* @param array $data
|
54 |
-
* @return
|
55 |
*/
|
56 |
public function ajaxSuccess(array $data = array())
|
57 |
{
|
58 |
return $this->response(
|
59 |
-
|
60 |
array_merge($data, array('success' => true))
|
61 |
);
|
62 |
}
|
@@ -65,14 +65,14 @@ abstract class SupsysticTables_Core_BaseController extends Rsc_Mvc_Controller
|
|
65 |
* Returns AJAX error response.
|
66 |
* @param string $message
|
67 |
* @param array $data
|
68 |
-
* @return
|
69 |
*/
|
70 |
public function ajaxError(
|
71 |
$message = 'Something went wrong.',
|
72 |
array $data = array()
|
73 |
) {
|
74 |
return $this->response(
|
75 |
-
|
76 |
array_merge($data, array('success' => false, 'message' => $message))
|
77 |
);
|
78 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
abstract class SupsysticTables_Core_BaseController extends RscDtgs_Mvc_Controller
|
5 |
{
|
6 |
/**
|
7 |
* Returns an instance of the model.
|
17 |
/**
|
18 |
* Creates an instance of the model and returns it.
|
19 |
* @param string $model
|
20 |
+
* @param string|RscDtgs_Mvc_Module $module
|
21 |
* @return SupsysticTables_Core_BaseModel
|
22 |
*/
|
23 |
public function createModel($model, $module = null)
|
51 |
/**
|
52 |
* Returns AJAX success response.
|
53 |
* @param array $data
|
54 |
+
* @return RscDtgs_Http_Response
|
55 |
*/
|
56 |
public function ajaxSuccess(array $data = array())
|
57 |
{
|
58 |
return $this->response(
|
59 |
+
RscDtgs_Http_Response::AJAX,
|
60 |
array_merge($data, array('success' => true))
|
61 |
);
|
62 |
}
|
65 |
* Returns AJAX error response.
|
66 |
* @param string $message
|
67 |
* @param array $data
|
68 |
+
* @return RscDtgs_Http_Response
|
69 |
*/
|
70 |
public function ajaxError(
|
71 |
$message = 'Something went wrong.',
|
72 |
array $data = array()
|
73 |
) {
|
74 |
return $this->response(
|
75 |
+
RscDtgs_Http_Response::AJAX,
|
76 |
array_merge($data, array('success' => false, 'message' => $message))
|
77 |
);
|
78 |
}
|
src/SupsysticTables/Core/BaseModel.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
abstract class SupsysticTables_Core_BaseModel extends
|
5 |
{
|
6 |
/**
|
7 |
-
* @var
|
8 |
*/
|
9 |
protected $environment;
|
10 |
|
11 |
/**
|
12 |
* Sets the environment.
|
13 |
-
* @param
|
14 |
*/
|
15 |
-
public function setEnvironment(
|
16 |
{
|
17 |
$this->environment = $environment;
|
18 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
abstract class SupsysticTables_Core_BaseModel extends RscDtgs_Mvc_Model implements RscDtgs_Environment_AwareInterface
|
5 |
{
|
6 |
/**
|
7 |
+
* @var RscDtgs_Environment
|
8 |
*/
|
9 |
protected $environment;
|
10 |
|
11 |
/**
|
12 |
* Sets the environment.
|
13 |
+
* @param RscDtgs_Environment $environment
|
14 |
*/
|
15 |
+
public function setEnvironment(RscDtgs_Environment $environment)
|
16 |
{
|
17 |
$this->environment = $environment;
|
18 |
}
|
src/SupsysticTables/Core/BaseModule.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
abstract class SupsysticTables_Core_BaseModule extends
|
5 |
{
|
6 |
/**
|
7 |
* {@inheritdoc}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
abstract class SupsysticTables_Core_BaseModule extends RscDtgs_Mvc_Module
|
5 |
{
|
6 |
/**
|
7 |
* {@inheritdoc}
|
src/SupsysticTables/Core/Controller.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
class SupsysticTables_Core_Controller extends SupsysticTables_Core_BaseController
|
4 |
{
|
5 |
-
public function rollbackAction(
|
6 |
{
|
7 |
$config = $this->getEnvironment()->getConfig();
|
8 |
$revision = (int)$request->query->get('revision');
|
2 |
|
3 |
class SupsysticTables_Core_Controller extends SupsysticTables_Core_BaseController
|
4 |
{
|
5 |
+
public function rollbackAction(RscDtgs_Http_Request $request)
|
6 |
{
|
7 |
$config = $this->getEnvironment()->getConfig();
|
8 |
$revision = (int)$request->query->get('revision');
|
src/SupsysticTables/Core/ModelsFactory.php
CHANGED
@@ -9,15 +9,15 @@ class SupsysticTables_Core_ModelsFactory
|
|
9 |
protected $models;
|
10 |
|
11 |
/**
|
12 |
-
* @var
|
13 |
*/
|
14 |
protected $environment;
|
15 |
|
16 |
/**
|
17 |
* Constructs the models factory
|
18 |
-
* @param
|
19 |
*/
|
20 |
-
public function __construct(
|
21 |
{
|
22 |
$this->models = array();
|
23 |
$this->environment = $environment;
|
@@ -25,7 +25,7 @@ class SupsysticTables_Core_ModelsFactory
|
|
25 |
|
26 |
/**
|
27 |
* @param string $model
|
28 |
-
* @param string|
|
29 |
*/
|
30 |
public function factory($model, $module = null)
|
31 |
{
|
@@ -55,7 +55,7 @@ class SupsysticTables_Core_ModelsFactory
|
|
55 |
|
56 |
$class = new $className;
|
57 |
|
58 |
-
if ($class instanceof
|
59 |
$class->setEnvironment($this->environment);
|
60 |
}
|
61 |
|
@@ -68,7 +68,7 @@ class SupsysticTables_Core_ModelsFactory
|
|
68 |
|
69 |
/**
|
70 |
* @param string $model
|
71 |
-
* @param string|
|
72 |
* @return SupsysticTables_Core_BaseModel
|
73 |
*/
|
74 |
public function get($model, $module = null)
|
@@ -89,7 +89,7 @@ class SupsysticTables_Core_ModelsFactory
|
|
89 |
/**
|
90 |
* Builds the model name.
|
91 |
* @param string $model
|
92 |
-
* @param string|
|
93 |
* @param string $prefix
|
94 |
* @return string
|
95 |
*/
|
@@ -103,7 +103,7 @@ class SupsysticTables_Core_ModelsFactory
|
|
103 |
$module = $model;
|
104 |
}
|
105 |
|
106 |
-
if ($module instanceof
|
107 |
$e = explode('_', get_class($module));
|
108 |
$prefix = array_shift($e);
|
109 |
$module = $module->getModuleName();
|
9 |
protected $models;
|
10 |
|
11 |
/**
|
12 |
+
* @var RscDtgs_Environment
|
13 |
*/
|
14 |
protected $environment;
|
15 |
|
16 |
/**
|
17 |
* Constructs the models factory
|
18 |
+
* @param RscDtgs_Environment $environment
|
19 |
*/
|
20 |
+
public function __construct(RscDtgs_Environment $environment)
|
21 |
{
|
22 |
$this->models = array();
|
23 |
$this->environment = $environment;
|
25 |
|
26 |
/**
|
27 |
* @param string $model
|
28 |
+
* @param string|RscDtgs_Mvc_Module $module
|
29 |
*/
|
30 |
public function factory($model, $module = null)
|
31 |
{
|
55 |
|
56 |
$class = new $className;
|
57 |
|
58 |
+
if ($class instanceof RscDtgs_Environment_AwareInterface) {
|
59 |
$class->setEnvironment($this->environment);
|
60 |
}
|
61 |
|
68 |
|
69 |
/**
|
70 |
* @param string $model
|
71 |
+
* @param string|RscDtgs_Mvc_Module $module
|
72 |
* @return SupsysticTables_Core_BaseModel
|
73 |
*/
|
74 |
public function get($model, $module = null)
|
89 |
/**
|
90 |
* Builds the model name.
|
91 |
* @param string $model
|
92 |
+
* @param string|RscDtgs_Mvc_Module $module
|
93 |
* @param string $prefix
|
94 |
* @return string
|
95 |
*/
|
103 |
$module = $model;
|
104 |
}
|
105 |
|
106 |
+
if ($module instanceof RscDtgs_Mvc_Module) {
|
107 |
$e = explode('_', get_class($module));
|
108 |
$prefix = array_shift($e);
|
109 |
$module = $module->getModuleName();
|
src/SupsysticTables/Core/Module.php
CHANGED
@@ -627,24 +627,56 @@ class SupsysticTables_Core_Module extends SupsysticTables_Core_BaseModule
|
|
627 |
$twig = $this->getEnvironment()->getTwig();
|
628 |
|
629 |
$twig->addFunction(
|
630 |
-
new
|
631 |
);
|
632 |
$twig->addFunction(
|
633 |
-
new
|
634 |
);
|
635 |
$twig->addFunction(
|
636 |
-
new
|
637 |
);
|
638 |
if (function_exists('dump') && $this->getEnvironment()->isDev()) {
|
639 |
$twig->addFunction(
|
640 |
-
new
|
641 |
);
|
642 |
}
|
643 |
if (function_exists('preg_replace')) {
|
644 |
$twig->addFilter(
|
645 |
-
new
|
646 |
);
|
647 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
}
|
649 |
|
650 |
private function cleanTablesCache() {
|
627 |
$twig = $this->getEnvironment()->getTwig();
|
628 |
|
629 |
$twig->addFunction(
|
630 |
+
new Twig_SupTwgDtgs_SimpleFunction('plugin_directory_url', array($this, 'getPluginDirectoryUrl'))
|
631 |
);
|
632 |
$twig->addFunction(
|
633 |
+
new Twig_SupTwgDtgs_SimpleFunction('build_pro_url', array($this, 'buildProUrl'))
|
634 |
);
|
635 |
$twig->addFunction(
|
636 |
+
new Twig_SupTwgDtgs_SimpleFunction('translate', array($this, 'translate'))
|
637 |
);
|
638 |
if (function_exists('dump') && $this->getEnvironment()->isDev()) {
|
639 |
$twig->addFunction(
|
640 |
+
new Twig_SupTwgDtgs_SimpleFunction('dump', 'dump')
|
641 |
);
|
642 |
}
|
643 |
if (function_exists('preg_replace')) {
|
644 |
$twig->addFilter(
|
645 |
+
new Twig_SupTwgDtgs_SimpleFilter('preg_replace', array($this, 'addPregReplaceFilter'))
|
646 |
);
|
647 |
}
|
648 |
+
$config = $this->getEnvironment()->getConfig();
|
649 |
+
$twig->addGlobal('DTGS_PLUGIN_URL', DTGS_PLUGIN_URL);
|
650 |
+
$twig->addGlobal('DTGS_PLUGIN_VERSION', $config->get('plugin_version'));
|
651 |
+
$twig->addGlobal('DTGS_PLUGIN_NAME', $config->get('plugin_name'));
|
652 |
+
global $current_user;
|
653 |
+
if ($current_user) :
|
654 |
+
$twig->addGlobal('DTGS_USER_NAME', $current_user->user_firstname . ' ' .
|
655 |
+
$current_user->user_lastname);
|
656 |
+
$twig->addGlobal('DTGS_USER_EMAIL', $current_user->user_email);
|
657 |
+
endif;
|
658 |
+
$twig->addGlobal('DTGS_WEBSITE', get_bloginfo('url'));
|
659 |
+
$twig->addGlobal('_wpnonce', wp_create_nonce('supsystic-tables'));
|
660 |
+
|
661 |
+
$show = true;
|
662 |
+
$acRemind = get_option('dtgs_ac_remind', false);
|
663 |
+
if (!empty($acRemind)) {
|
664 |
+
$currentDate = date('Y-m-d h:i:s');
|
665 |
+
if ($currentDate > $acRemind) {
|
666 |
+
$show = true;
|
667 |
+
} else {
|
668 |
+
$show = false;
|
669 |
+
}
|
670 |
+
}
|
671 |
+
$acSubscribe = get_option('dtgs_ac_subscribe', false);
|
672 |
+
if (!empty($acSubscribe)) {
|
673 |
+
$show = false;
|
674 |
+
}
|
675 |
+
$acDisabled = get_option('dtgs_ac_disabled', false);
|
676 |
+
if (!empty($acDisabled)) {
|
677 |
+
$show = false;
|
678 |
+
}
|
679 |
+
$twig->addGlobal('DTGS_AC_SHOW', $show);
|
680 |
}
|
681 |
|
682 |
private function cleanTablesCache() {
|
src/SupsysticTables/Featuredplugins/Controller.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class SupsysticTables_Featuredplugins_Controller
|
5 |
-
* Featuredplugins page controller
|
6 |
-
*
|
7 |
-
* @package SupsysticTables\Featuredplugins
|
8 |
-
*/
|
9 |
-
class SupsysticTables_Featuredplugins_Controller extends SupsysticTables_Core_BaseController
|
10 |
-
{
|
11 |
-
/**
|
12 |
-
* @param Rsc_Http_Request $request
|
13 |
-
*/
|
14 |
-
public function indexAction(Rsc_Http_Request $request)
|
15 |
-
{
|
16 |
-
$environment = $this->getEnvironment();
|
17 |
-
|
18 |
-
$pluginsUrl = 'https://supsystic.com/plugins/';
|
19 |
-
$uploadsUrl = DTGS_PLUGIN_URL.'src/SupsysticTables/Featuredplugins/assets/img/';
|
20 |
-
$downloadsUrl = 'https://downloads.wordpress.org/plugin/';
|
21 |
-
$promoCampaign = 'tables';
|
22 |
-
$pluginsList = array(
|
23 |
-
array('label' => $environment->translate('Popup Plugin'), 'url' => $pluginsUrl. 'popup-plugin/', 'img' => $uploadsUrl. 'Popup_256.png', 'desc' => $environment->translate('The Best WordPress PopUp option plugin to help you gain more subscribers, social followers or advertisement. Responsive pop-ups with friendly options.'), 'download' => $downloadsUrl. 'popup-by-supsystic.zip'),
|
24 |
-
array('label' => $environment->translate('Slider Plugin'), 'url' => $pluginsUrl. 'slider/', 'img' => $uploadsUrl. 'Slider_256.png', 'desc' => $environment->translate('Creating slideshows with Slider plugin is fast and easy. Simply select images from your WordPress Media Library, Flickr, Instagram or Facebook, set slide captions, links and SEO fields all from one page.'), 'download' => $downloadsUrl. 'slider-by-supsystic.zip'),
|
25 |
-
array('label' => $environment->translate('Photo Gallery Plugin'), 'url' => $pluginsUrl. 'photo-gallery/', 'img' => $uploadsUrl. 'Gallery_256.png', 'desc' => $environment->translate('Photo Gallery Plugin with a great number of layouts will help you to create quality respectable portfolios and image galleries.'), 'download' => $downloadsUrl. 'gallery-by-supsystic.zip'),
|
26 |
-
array('label' => $environment->translate('Data Tables Generator'), 'url' => $pluginsUrl. 'data-tables-generator-plugin/', 'img' => $uploadsUrl. 'Data_Tables_256.png', 'desc' => $environment->translate('Create and manage beautiful data tables with custom design. No HTML knowledge is required.'), 'download' => $downloadsUrl. 'data-tables-generator-by-supsystic.zip'),
|
27 |
-
array('label' => $environment->translate('Social Share Buttons'), 'url' => $pluginsUrl. 'social-share-plugin/', 'img' => $uploadsUrl. 'Social_Buttons_256.png', 'desc' => $environment->translate('Social share buttons to increase social traffic and popularity. Social sharing to Facebook, Twitter and other social networks.'), 'download' => $downloadsUrl. 'social-share-buttons-by-supsystic.zip'),
|
28 |
-
array('label' => $environment->translate('Live Chat Plugin'), 'url' => $pluginsUrl. 'live-chat/', 'img' => $uploadsUrl. 'Live_Chat_256.png', 'desc' => $environment->translate('Be closer to your visitors and customers with Live Chat Support by Supsystic. Help you visitors, support them in real-time with exceptional Live Chat WordPress plugin by Supsystic.'), 'download' => $downloadsUrl. 'live-chat-by-supsystic.zip'),
|
29 |
-
array('label' => $environment->translate('Pricing Table'), 'url' => $pluginsUrl. 'pricing-table/', 'img' => $uploadsUrl. 'Pricing_Table_256.png', 'desc' => $environment->translate('It’s never been so easy to create and manage pricing and comparison tables with table builder. Any element of the table can be customise with mouse click.'), 'download' => $downloadsUrl. 'pricing-table-by-supsystic.zip'),
|
30 |
-
array('label' => $environment->translate('Coming Soon Plugin'), 'url' => $pluginsUrl. 'coming-soon-plugin/', 'img' => $uploadsUrl. 'Coming_Soon_256.png', 'desc' => $environment->translate('Coming soon page with drag-and-drop builder or under construction | maintenance mode to notify visitors and collects emails.'), 'download' => $downloadsUrl. 'coming-soon-by-supsystic.zip'),
|
31 |
-
array('label' => $environment->translate('Backup Plugin'), 'url' => $pluginsUrl. 'backup-plugin/', 'img' => $uploadsUrl. 'Backup_256.png', 'desc' => $environment->translate('Backup and Restore WordPress Plugin by Supsystic provides quick and unhitched DropBox, FTP, Amazon S3, Google Drive backup for your WordPress website.'), 'download' => $downloadsUrl. 'backup-by-supsystic.zip'),
|
32 |
-
array('label' => $environment->translate('Google Maps Easy'), 'url' => $pluginsUrl. 'google-maps-plugin/', 'img' => $uploadsUrl. 'Google_Maps_256.png', 'desc' => $environment->translate('Display custom Google Maps. Set markers and locations with text, images, categories and links. Customize google map in a simple and intuitive way.'), 'download' => $downloadsUrl. 'google-maps-easy.zip'),
|
33 |
-
array('label' => $environment->translate('Digital Publication Plugin'), 'url' => $pluginsUrl. 'digital-publication-plugin/', 'img' => $uploadsUrl. 'Digital_Publication_256.png', 'desc' => $environment->translate('Digital Publication WordPress Plugin by Supsystic for Magazines, Catalogs, Portfolios. Convert images, posts, PDF to the page flip book.'), 'download' => $downloadsUrl. 'digital-publications-by-supsystic.zip'),
|
34 |
-
array('label' => $environment->translate('Contact Form Plugin'), 'url' => $pluginsUrl. 'contact-form-plugin/', 'img' => $uploadsUrl. 'Contact_Form_256.png', 'desc' => $environment->translate('One of the best plugin for creating Contact Forms on your WordPress site. Changeable fonts, backgrounds, an option for adding fields etc.'), 'download' => $downloadsUrl. 'contact-form-by-supsystic.zip'),
|
35 |
-
array('label' => $environment->translate('Newsletter Plugin'), 'url' => $pluginsUrl. 'newsletter-plugin/', 'img' => $uploadsUrl. 'icon-256x256.png', 'desc' => $environment->translate('Supsystic Newsletter plugin for automatic mailing of your letters. You will have no need to control it or send them manually. No coding, hard skills or long hours of customizing are required.'), 'download' => $downloadsUrl. 'newsletter-by-supsystic.zip'),
|
36 |
-
array('label' => $environment->translate('Membership by Supsystic'), 'url' => $pluginsUrl. 'membership-plugin/', 'img' => $uploadsUrl. '256.png', 'desc' => $environment->translate('Create online membership community with custom user profiles, roles, FrontEnd registration and login. Members Directory, activity, groups, messages.'), 'download' => $downloadsUrl. 'membership-by-supsystic.zip'),
|
37 |
-
array('label' => $environment->translate('Kinsta Hosting'), 'url' => 'https://kinsta.com?kaid=MNRQQASUYJRT', 'external' => true, 'img' => $this->getEnvironment()->getModule('core')->getPluginDirectoryUrl('app/assets/img/kinsta_banner.png'), 'desc' => $environment->translate('If you want to host a business site or a blog, Kinsta managed WordPress hosting is the best place to stop on. Without any hesitation, we can say Kinsta is incredible when it comes to uptime and speed.')),
|
38 |
-
);
|
39 |
-
foreach($pluginsList as $i => $p) {
|
40 |
-
if(empty($p['external'])) {
|
41 |
-
$pluginsList[ $i ]['url'] = $pluginsList[ $i ]['url']. '?utm_source=plugin&utm_medium=featured_plugins&utm_campaign='. $promoCampaign;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
return $this->response(
|
46 |
-
'@featuredplugins/index.twig',
|
47 |
-
array(
|
48 |
-
'pluginsList' => $pluginsList,
|
49 |
-
'bundleUrl' => 'https://supsystic.com/product/plugins-bundle/'. '?utm_source=plugin&utm_medium=featured_plugins&utm_campaign='. $promoCampaign,
|
50 |
-
)
|
51 |
-
);
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/SupsysticTables/Featuredplugins/Module.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class SupsysticTables_Featuredplugins_Module extends SupsysticTables_Core_BaseModule
|
5 |
-
{
|
6 |
-
|
7 |
-
/**
|
8 |
-
* {@inheritdoc}
|
9 |
-
*/
|
10 |
-
public function onInit()
|
11 |
-
{
|
12 |
-
parent::onInit();
|
13 |
-
$this->registerMenu();
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Loads the assets required by the module
|
18 |
-
*/
|
19 |
-
public function afterUiLoaded(SupsysticTables_Ui_Module $ui)
|
20 |
-
{
|
21 |
-
parent::afterUiLoaded($ui);
|
22 |
-
|
23 |
-
if($this->getEnvironment()->isModule('featuredplugins')) {
|
24 |
-
$hook = 'admin_enqueue_scripts';
|
25 |
-
$ui->add(
|
26 |
-
$ui->createStyle('supTablesUI')->setHookName(
|
27 |
-
$hook
|
28 |
-
)->setLocalSource('css/libraries/supsystic/suptablesui.min.css')
|
29 |
-
);
|
30 |
-
$ui->add(
|
31 |
-
$ui->createStyle('supsystic-tables-featured-plugins-css')->setHookName(
|
32 |
-
$hook
|
33 |
-
)->setModuleSource($this, 'css/admin.featured-plugins.css')
|
34 |
-
);
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
public function registerMenu()
|
39 |
-
{
|
40 |
-
$menu = $this->getMenu();
|
41 |
-
$plugin_menu = $this->getConfig()->get('plugin_menu');
|
42 |
-
$capability = $plugin_menu['capability'];
|
43 |
-
$submenu = $menu->createSubmenuItem();
|
44 |
-
|
45 |
-
$submenu->setCapability($capability)
|
46 |
-
->setMenuSlug($menu->getMenuSlug(). '&module=featuredplugins')
|
47 |
-
->setMenuTitle($this->translate('Featured Plugins'))
|
48 |
-
->setPageTitle($this->translate('Featured Plugins'))
|
49 |
-
->setModuleName('featuredplugins');
|
50 |
-
// Avoid conflicts with old vendor version
|
51 |
-
if(method_exists($submenu, 'setSortOrder')) {
|
52 |
-
$submenu->setSortOrder(99);
|
53 |
-
}
|
54 |
-
|
55 |
-
$menu->addSubmenuItem('featuredplugins', $submenu);
|
56 |
-
}
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/SupsysticTables/Featuredplugins/assets/css/admin.featured-plugins.css
DELETED
@@ -1,289 +0,0 @@
|
|
1 |
-
#supsystic-featured-plugins, #supsystic-featured-plugins * {
|
2 |
-
-webkit-box-sizing: border-box;
|
3 |
-
-moz-box-sizing: border-box;
|
4 |
-
box-sizing: border-box;
|
5 |
-
}
|
6 |
-
#supsystic-featured-plugins {
|
7 |
-
font-family: Montserrat, Hind-Regular, sans-serif;
|
8 |
-
font-style: normal;
|
9 |
-
font-weight: 400;
|
10 |
-
font-size: 14px;
|
11 |
-
line-height: 25px;
|
12 |
-
background-color: #ffffff;
|
13 |
-
color: #4D4C4C;
|
14 |
-
}
|
15 |
-
#supsystic-featured-plugins a {
|
16 |
-
text-decoration: none !important;
|
17 |
-
}
|
18 |
-
#supsystic-featured-plugins {
|
19 |
-
overflow:auto;
|
20 |
-
clear:both;
|
21 |
-
}
|
22 |
-
.catitem .text-center {
|
23 |
-
text-align:center;
|
24 |
-
}
|
25 |
-
.catitem .download-product-item .dp-title a {
|
26 |
-
display: inline-block;
|
27 |
-
width: 100%;
|
28 |
-
text-overflow: ellipsis;
|
29 |
-
overflow: hidden;
|
30 |
-
white-space: nowrap;
|
31 |
-
font-size: 24px;
|
32 |
-
font-style: normal;
|
33 |
-
text-align: center;
|
34 |
-
padding: 8px 20px;
|
35 |
-
background-image: url(img/bg_texture.png);
|
36 |
-
color: #ffffff;
|
37 |
-
text-decoration: none;
|
38 |
-
}
|
39 |
-
.catitem .download-product-item .dp-title a:hover {
|
40 |
-
color: #ffffff;
|
41 |
-
text-decoration: none;
|
42 |
-
}
|
43 |
-
.catitem .download-product-item .dp-excerpt {
|
44 |
-
display: block;
|
45 |
-
height: 210px;
|
46 |
-
min-height: 210px;
|
47 |
-
max-height: 210px;
|
48 |
-
padding: 15px;
|
49 |
-
text-align: center;
|
50 |
-
overflow: hidden;
|
51 |
-
}
|
52 |
-
.catitem .download-product-item .dp-excerpt .dp-excerpt-wrapper {
|
53 |
-
height: 100%;
|
54 |
-
column-width: 210px;
|
55 |
-
-webkit-column-width: 210px;
|
56 |
-
}
|
57 |
-
.catitem .download-product-item .dp-thumb {
|
58 |
-
margin: 30px 0;
|
59 |
-
height: 190px;
|
60 |
-
min-height: 190px;
|
61 |
-
}
|
62 |
-
.catitem .download-product-item .dp-thumb img, .all-plugins-item .dp-thumb img {
|
63 |
-
width: auto;
|
64 |
-
max-height: 100%;
|
65 |
-
margin: 0 auto;
|
66 |
-
}
|
67 |
-
.catitem .download-product-item .dp-excerpt, .catitem .download-product-item .dp-buttons {
|
68 |
-
background: #FAFAFA;
|
69 |
-
}
|
70 |
-
.catitem .download-product-item .dp-buttons {
|
71 |
-
padding-bottom: 20px;
|
72 |
-
}
|
73 |
-
.catitem .download-product-item .dp-buttons a {
|
74 |
-
display: inline-block;
|
75 |
-
width: 40%;
|
76 |
-
padding: 10px 0 !important;
|
77 |
-
margin-left: 6%;
|
78 |
-
}
|
79 |
-
.catitem .download-product-item .dp-buttons a.btn-info {
|
80 |
-
border: none !important;
|
81 |
-
color: #ffffff !important;
|
82 |
-
font-size: 18px !important;
|
83 |
-
padding: 12px 0 !important;
|
84 |
-
}
|
85 |
-
.catitem .download-product-item .dp-buttons a.btn-center {
|
86 |
-
display: block;
|
87 |
-
margin: 0 auto;
|
88 |
-
}
|
89 |
-
.catitem .download-product-item .dp-buttons a.dp-full {
|
90 |
-
border-color: #e8eded!important;
|
91 |
-
}
|
92 |
-
.catitem .download-product-item {
|
93 |
-
font-size: 16px;
|
94 |
-
border: 2px solid #4D4C4C;
|
95 |
-
}
|
96 |
-
.catitem .bottom-buttons a, .catitem .free-product-item p {
|
97 |
-
font-weight: 400;
|
98 |
-
}
|
99 |
-
.select_version .selecter-item:hover {
|
100 |
-
background: #4ae8ea;
|
101 |
-
color: #fff;
|
102 |
-
}
|
103 |
-
.selecter.open {
|
104 |
-
z-index: 99999999!important;
|
105 |
-
}
|
106 |
-
.catitem {
|
107 |
-
display: block;
|
108 |
-
margin-bottom: 30px;
|
109 |
-
}
|
110 |
-
.catitem .free-label, .catitem .psd-label, .catitem .responsive-label {
|
111 |
-
margin-bottom: 5px;
|
112 |
-
display: inline-block;
|
113 |
-
}
|
114 |
-
.catitem .labels {
|
115 |
-
position: absolute;
|
116 |
-
top: 10px;
|
117 |
-
right: 5px;
|
118 |
-
width: 25px;
|
119 |
-
z-index: 0;
|
120 |
-
}
|
121 |
-
.catitem .responsive-label {
|
122 |
-
width: 21px;
|
123 |
-
height: 14px;
|
124 |
-
background: url(img/pattern.png) -130px -32px no-repeat;
|
125 |
-
}
|
126 |
-
.catitem .free-label {
|
127 |
-
width: 17px;
|
128 |
-
height: 17px;
|
129 |
-
background: url(img/pattern.png) -135px -47px no-repeat;
|
130 |
-
}
|
131 |
-
.catitem .psd-label {
|
132 |
-
width: 22px;
|
133 |
-
height: 8px;
|
134 |
-
background: url(img/pattern.png) -80px -32px no-repeat;
|
135 |
-
}
|
136 |
-
.catitem .zoom-label {
|
137 |
-
width: 13px;
|
138 |
-
height: 13px;
|
139 |
-
display: inline-block;
|
140 |
-
background: url(img/pattern.png) -115px -32px no-repeat;
|
141 |
-
position: absolute;
|
142 |
-
right: 11px;
|
143 |
-
bottom: 10px;
|
144 |
-
}
|
145 |
-
.catitem .fpi {
|
146 |
-
border: 1px solid #e8eded;
|
147 |
-
display: inline-block;
|
148 |
-
position: relative;
|
149 |
-
z-index: 10;
|
150 |
-
margin-bottom: 15px;
|
151 |
-
}
|
152 |
-
.catitem .free-product-item {
|
153 |
-
display: inline-block;
|
154 |
-
}
|
155 |
-
.catitem .free-product-item p {
|
156 |
-
font-size: 16px;
|
157 |
-
font-style: normal;
|
158 |
-
display: inline-block;
|
159 |
-
}
|
160 |
-
.catitem .free-product-item .fpi {
|
161 |
-
transition: all .3s;
|
162 |
-
-moz-transition: all .3s;
|
163 |
-
-webkit-transition: all .3s;
|
164 |
-
-o-transition: all .3s;
|
165 |
-
}
|
166 |
-
.catitem .free-product-item .fpi.hover {
|
167 |
-
background: #4ae8ea;
|
168 |
-
}
|
169 |
-
.catitem .fpi img {
|
170 |
-
border: 3px solid rgba(215, 219, 219, .4);
|
171 |
-
margin: -13px 0 0 -35px;
|
172 |
-
}
|
173 |
-
.catitem .bottom-buttons a {
|
174 |
-
color: #4D4C4C;
|
175 |
-
text-align: center;
|
176 |
-
display: block;
|
177 |
-
padding: 5px 35px 5px 5px;
|
178 |
-
font-size: 18px;
|
179 |
-
font-style: normal;
|
180 |
-
}
|
181 |
-
.btn, .btn-download, .btn-preview, .btn-pro, .btn-extension, .btn-black {
|
182 |
-
font-size: 18px!important;
|
183 |
-
font-weight: 400!important;
|
184 |
-
font-style: normal!important;
|
185 |
-
}
|
186 |
-
.supsystic-plugin #supsystic-featured-plugins .btn {
|
187 |
-
color: #4D4C4C;
|
188 |
-
/*-webkit-transition-timing-function: initial;
|
189 |
-
transition-timing-function: initial;*/
|
190 |
-
}
|
191 |
-
.btn {
|
192 |
-
background: transparent;
|
193 |
-
color: #4D4C4C;
|
194 |
-
text-align: center;
|
195 |
-
border: 2px solid #4D4C4C !important;
|
196 |
-
border-radius: 0!important;
|
197 |
-
-moz-border-radius: 0!important;
|
198 |
-
-webkit-border-radius: 0!important;
|
199 |
-
padding: 17px 45px !important;
|
200 |
-
}
|
201 |
-
.btn-full {
|
202 |
-
width: 100%;
|
203 |
-
}
|
204 |
-
.btn-info {
|
205 |
-
padding: 12px 38px !important;
|
206 |
-
background-color: #4ae8ea !important;
|
207 |
-
border: none !important;
|
208 |
-
color: #ffffff !important;
|
209 |
-
font-size: 18px !important;
|
210 |
-
}
|
211 |
-
.btn-revert {
|
212 |
-
color: #ffffff !important;
|
213 |
-
border-color: #ffffff !important;
|
214 |
-
}
|
215 |
-
/* Shutter Out Horizontal Start */
|
216 |
-
.hvr-shutter-out-horizontal {
|
217 |
-
display: inline-block;
|
218 |
-
vertical-align: middle;
|
219 |
-
-webkit-transform: translateZ(0);
|
220 |
-
transform: translateZ(0);
|
221 |
-
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
|
222 |
-
/*-webkit-backface-visibility: hidden;
|
223 |
-
backface-visibility: hidden;*/
|
224 |
-
-moz-osx-font-smoothing: grayscale;
|
225 |
-
position: relative;
|
226 |
-
/*background: #e1e1e1;*/
|
227 |
-
-webkit-transition-property: color;
|
228 |
-
transition-property: color;
|
229 |
-
-webkit-transition-duration: 0.3s;
|
230 |
-
transition-duration: 0.3s;
|
231 |
-
}
|
232 |
-
.hvr-shutter-out-horizontal:before {
|
233 |
-
content: "";
|
234 |
-
position: absolute;
|
235 |
-
z-index: -1;
|
236 |
-
top: 0;
|
237 |
-
bottom: 0;
|
238 |
-
left: 0;
|
239 |
-
right: 0;
|
240 |
-
background: #2098d1;
|
241 |
-
-webkit-transform: scaleX(0);
|
242 |
-
transform: scaleX(0);
|
243 |
-
-webkit-transform-origin: 50%;
|
244 |
-
transform-origin: 50%;
|
245 |
-
-webkit-transition-property: transform;
|
246 |
-
transition-property: transform;
|
247 |
-
-webkit-transition-duration: 0.3s;
|
248 |
-
transition-duration: 0.3s;
|
249 |
-
-webkit-transition-timing-function: ease-out;
|
250 |
-
transition-timing-function: ease-out;
|
251 |
-
}
|
252 |
-
.hvr-shutter-out-horizontal:hover, .hvr-shutter-out-horizontal:focus, .hvr-shutter-out-horizontal:active {
|
253 |
-
color: white !important;
|
254 |
-
}
|
255 |
-
.hvr-shutter-out-horizontal:hover:before, .hvr-shutter-out-horizontal:focus:before, .hvr-shutter-out-horizontal:active:before {
|
256 |
-
-webkit-transform: scaleX(1);
|
257 |
-
transform: scaleX(1);
|
258 |
-
}
|
259 |
-
/* For blog navigation */
|
260 |
-
.meta-nav.hvr-shutter-out-horizontal:before, .supsystic-social-button.hvr-shutter-out-horizontal:before {
|
261 |
-
border-radius: 100%;
|
262 |
-
}
|
263 |
-
/* Shutter Out Horizontal End */
|
264 |
-
/* Page Bundle Container Styles Start */
|
265 |
-
.supsysticPageBundleContainer {
|
266 |
-
background-color: #56DADC;
|
267 |
-
padding-top: 28px;
|
268 |
-
padding-bottom: 28px;
|
269 |
-
display: table;
|
270 |
-
width: 100%;
|
271 |
-
}
|
272 |
-
.supsysticPageBundleContainer .bundle-text {
|
273 |
-
padding-top: 5px;
|
274 |
-
font-size: 25px;
|
275 |
-
color: #ffffff;
|
276 |
-
}
|
277 |
-
.supsysticPageBundleContainer .bundle-btn a {
|
278 |
-
font-size: 15px !important;
|
279 |
-
padding: 5px 38px !important;
|
280 |
-
}
|
281 |
-
/*.supsysticPageBundleContainer .container {
|
282 |
-
width: 100% !important;
|
283 |
-
}*/
|
284 |
-
@media only screen and (max-width:991px) {
|
285 |
-
.supsysticPageBundleContainer .bundle-btn {
|
286 |
-
margin-top: 20px;
|
287 |
-
}
|
288 |
-
}
|
289 |
-
/* Page Bundle Container Styles End */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/SupsysticTables/Featuredplugins/assets/css/img/bg_texture.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Backup_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Coming_Soon_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Contact_Form_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Data_Tables_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Digital_Publication_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Gallery_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Google_Maps_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Live_Chat_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Popup_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Pricing_Table_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/Slider_256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/heatmap.jpg
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/icon-256x256.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/kinsta_banner.png
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/assets/img/shapes.jpg
DELETED
Binary file
|
src/SupsysticTables/Featuredplugins/views/index.twig
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
{% extends 'layout.twig' %}
|
2 |
-
|
3 |
-
{% block content %}
|
4 |
-
<div id="supsystic-featured-plugins" class="supsystic-item supsystic-item-autoheight">
|
5 |
-
<div class="supsysticPageBundleContainer container-fluid">
|
6 |
-
<div class="bundle-text supMd7 supXs12">{{ translate('Get plugins bundle today and save over 80%', PPS_LANG_CODE) }}</div>
|
7 |
-
<div class="bundle-btn supMd5 supXs12">
|
8 |
-
<a href="{{ bundleUrl }}" class="btn btn-full btn-revert hvr-shutter-out-horizontal" target="_blank">
|
9 |
-
{{ translate('Check It out', PPS_LANG_CODE) }}
|
10 |
-
</a>
|
11 |
-
</div>
|
12 |
-
</div>
|
13 |
-
<hr />
|
14 |
-
{% for p in pluginsList %}
|
15 |
-
<div class="catitem supMd4 supSm6 supXs12">
|
16 |
-
<div class="download-product-item">
|
17 |
-
<div class="dp-thumb text-center">
|
18 |
-
<a href="{{ p.url }}" target="_blank">
|
19 |
-
<img src="{{ p.img }}" class="img-responsive wp-post-image" alt="{{ p.label }}" />
|
20 |
-
</a>
|
21 |
-
</div>
|
22 |
-
<div class="dp-title">
|
23 |
-
<a href="{{ p.url }}" target="_blank">
|
24 |
-
{{ p.label }}
|
25 |
-
</a>
|
26 |
-
</div>
|
27 |
-
<div class="dp-excerpt">
|
28 |
-
<div class="dp-excerpt-wrapper">
|
29 |
-
{{ p.desc }}
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
<div class="dp-buttons">
|
33 |
-
<a href="{{ p.url }}" target="_blank" class="btn btn-full hvr-shutter-out-horizontal {% if p.download is empty %}btn-center{% endif %}">
|
34 |
-
{{ translate('More info') }}
|
35 |
-
</a>
|
36 |
-
{% if p.download is not empty %}
|
37 |
-
<a href="{{ p.download }}" target="_blank" class="btn btn-full btn-info hvr-shutter-out-horizontal">
|
38 |
-
{{ translate('Download') }}
|
39 |
-
</a>
|
40 |
-
{% endif %}
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
{% endfor %}
|
45 |
-
</div>
|
46 |
-
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/SupsysticTables/Migrationfree/Controller.php
CHANGED
@@ -4,10 +4,10 @@ class SupsysticTables_Migrationfree_Controller extends SupsysticTables_Core_Base
|
|
4 |
{
|
5 |
/**
|
6 |
* Generates download url.
|
7 |
-
* @param \
|
8 |
-
* @return \
|
9 |
*/
|
10 |
-
public function generateUrlAction(
|
11 |
{
|
12 |
if (!$this->_checkNonce($request)) die();
|
13 |
$id = $request->post->get_esc_html('id');
|
4 |
{
|
5 |
/**
|
6 |
* Generates download url.
|
7 |
+
* @param \RscDtgs_Http_Request $request
|
8 |
+
* @return \RscDtgs_Http_Response
|
9 |
*/
|
10 |
+
public function generateUrlAction(RscDtgs_Http_Request $request)
|
11 |
{
|
12 |
if (!$this->_checkNonce($request)) die();
|
13 |
$id = $request->post->get_esc_html('id');
|
src/SupsysticTables/Overview/Controller.php
CHANGED
@@ -1,14 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
class SupsysticTables_Overview_Controller extends SupsysticTables_Core_BaseController
|
5 |
{
|
6 |
-
public function indexAction(
|
7 |
{
|
8 |
$serverSettings = $this->getServerSettings();
|
9 |
$config = $this->getEnvironment()->getConfig();
|
10 |
global $current_user;
|
11 |
-
|
12 |
|
13 |
return $this->response(
|
14 |
'@overview/index.twig',
|
@@ -24,7 +22,67 @@ class SupsysticTables_Overview_Controller extends SupsysticTables_Core_BaseContr
|
|
24 |
);
|
25 |
}
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
$mail = $request->post['route']['data'];
|
29 |
|
30 |
$headers = array(
|
@@ -59,7 +117,7 @@ class SupsysticTables_Overview_Controller extends SupsysticTables_Core_BaseContr
|
|
59 |
);
|
60 |
}
|
61 |
|
62 |
-
return $this->response(
|
63 |
}
|
64 |
|
65 |
protected function getMailErrors() {
|
1 |
<?php
|
|
|
|
|
2 |
class SupsysticTables_Overview_Controller extends SupsysticTables_Core_BaseController
|
3 |
{
|
4 |
+
public function indexAction(RscDtgs_Http_Request $request)
|
5 |
{
|
6 |
$serverSettings = $this->getServerSettings();
|
7 |
$config = $this->getEnvironment()->getConfig();
|
8 |
global $current_user;
|
9 |
+
wp_get_current_user();
|
10 |
|
11 |
return $this->response(
|
12 |
'@overview/index.twig',
|
22 |
);
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @param RscDtgs_Http_Request $request
|
27 |
+
*/
|
28 |
+
public function sendSubscribeMailAction(RscDtgs_Http_Request $request)
|
29 |
+
{
|
30 |
+
$apiUrl = 'https://supsystic.com/wp-admin/admin-ajax.php';
|
31 |
+
$reqUrl = $apiUrl . '?action=ac_get_plugin_installed';
|
32 |
+
$config = $this->getEnvironment()->getConfig();
|
33 |
+
$mail = $request->post['route']['data'];
|
34 |
+
$isPro = !empty($config->get('is_pro')) ? true : false;
|
35 |
+
$data = array(
|
36 |
+
'body' => array(
|
37 |
+
'key' => 'kJ#f3(FjkF9fasd124t5t589u9d4389r3r3R#2asdas3(#R03r#(r#t-4t5t589u9d4389r3r3R#$%lfdj',
|
38 |
+
'user_name' => $mail['username'],
|
39 |
+
'user_email' => $mail['email'],
|
40 |
+
'site_url' => get_bloginfo('wpurl'),
|
41 |
+
'site_name' => get_bloginfo('name'),
|
42 |
+
'plugin_code' => 'dtgs',
|
43 |
+
'is_pro' => $isPro,
|
44 |
+
),
|
45 |
+
);
|
46 |
+
$response = wp_remote_post(
|
47 |
+
$reqUrl,
|
48 |
+
$data
|
49 |
+
);
|
50 |
+
if (is_wp_error($response)) {
|
51 |
+
$response = array(
|
52 |
+
'success' => false,
|
53 |
+
'message' => $this->translate('Some errors.')
|
54 |
+
);
|
55 |
+
} else {
|
56 |
+
$response = array(
|
57 |
+
'success' => true,
|
58 |
+
'message' => $this->translate('Thank you for subscribtions.')
|
59 |
+
);
|
60 |
+
update_option('dtgs_ac_subscribe', true);
|
61 |
+
}
|
62 |
+
return $this->response(RscDtgs_Http_Response::AJAX, $response);
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @param RscDtgs_Http_Request $request
|
67 |
+
*/
|
68 |
+
public function sendSubscribeRemindAction(RscDtgs_Http_Request $request)
|
69 |
+
{
|
70 |
+
update_option('dtgs_ac_remind', date("Y-m-d h:i:s", time() + 86400));
|
71 |
+
$response = array ('success' => true);
|
72 |
+
return $this->response(RscDtgs_Http_Response::AJAX, $response);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param RscDtgs_Http_Request $request
|
77 |
+
*/
|
78 |
+
public function sendSubscribeDisableAction(RscDtgs_Http_Request $request)
|
79 |
+
{
|
80 |
+
update_option('dtgs_ac_disabled', true);
|
81 |
+
$response = array ('success' => true);
|
82 |
+
return $this->response(RscDtgs_Http_Response::AJAX, $response);
|
83 |
+
}
|
84 |
+
|
85 |
+
public function sendMailAction(RscDtgs_Http_Request $request) {
|
86 |
$mail = $request->post['route']['data'];
|
87 |
|
88 |
$headers = array(
|
117 |
);
|
118 |
}
|
119 |
|
120 |
+
return $this->response(RscDtgs_Http_Response::AJAX, $response);
|
121 |
}
|
122 |
|
123 |
protected function getMailErrors() {
|
src/SupsysticTables/Overview/Module.php
CHANGED
@@ -24,9 +24,9 @@ class SupsysticTables_Overview_Module extends SupsysticTables_Core_BaseModule
|
|
24 |
{
|
25 |
parent::afterUiLoaded($ui);
|
26 |
|
27 |
-
if (!$this->getEnvironment()->isModule('overview')) {
|
28 |
-
|
29 |
-
}
|
30 |
|
31 |
$hook = 'admin_enqueue_scripts';
|
32 |
$ui->add(
|
@@ -79,4 +79,4 @@ class SupsysticTables_Overview_Module extends SupsysticTables_Core_BaseModule
|
|
79 |
|
80 |
$menu->addSubmenuItem('overview', $submenu);
|
81 |
}
|
82 |
-
}
|
24 |
{
|
25 |
parent::afterUiLoaded($ui);
|
26 |
|
27 |
+
// if (!$this->getEnvironment()->isModule('overview')) {
|
28 |
+
// return;
|
29 |
+
// }
|
30 |
|
31 |
$hook = 'admin_enqueue_scripts';
|
32 |
$ui->add(
|
79 |
|
80 |
$menu->addSubmenuItem('overview', $submenu);
|
81 |
}
|
82 |
+
}
|
src/SupsysticTables/Overview/assets/css/overview.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
.supsystic-overview {
|
2 |
width: 100%;
|
3 |
-
|
4 |
float: left;
|
5 |
}
|
6 |
|
@@ -18,6 +18,19 @@
|
|
18 |
width: 40%;
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
.supsystic-overview .faq-title {
|
22 |
cursor: pointer;
|
23 |
}
|
@@ -44,6 +57,11 @@
|
|
44 |
display: block;
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
47 |
.supsystic-overview .settings-title {
|
48 |
font-size: 14px;
|
49 |
font-weight: 600;
|
@@ -85,6 +103,7 @@
|
|
85 |
font-size: 18px;
|
86 |
font-weight: 800;
|
87 |
margin-top: 10px;
|
|
|
88 |
}
|
89 |
|
90 |
.supsystic-overview form input,
|
@@ -95,65 +114,252 @@
|
|
95 |
width: calc(100% - 50px);
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
|
100 |
}
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
margin-top: 10px;
|
107 |
-
white-space: nowrap;
|
108 |
}
|
109 |
|
110 |
.supsystic-overview .half-page > div {
|
111 |
-
|
112 |
-
|
113 |
}
|
114 |
-
|
115 |
-
|
116 |
-
border-bottom: none;
|
117 |
}
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
121 |
}
|
122 |
-
|
123 |
-
#
|
124 |
-
font-size: 15px;
|
125 |
}
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
-
.
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
138 |
}
|
139 |
-
.
|
140 |
-
|
141 |
-
|
142 |
-
margin-bottom: 20px;
|
143 |
}
|
144 |
-
.
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
151 |
}
|
152 |
-
.
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
1 |
.supsystic-overview {
|
2 |
width: 100%;
|
3 |
+
margin-top: 20px;
|
4 |
float: left;
|
5 |
}
|
6 |
|
18 |
width: 40%;
|
19 |
}
|
20 |
|
21 |
+
.supsystic-overview .half-page > div {
|
22 |
+
border-bottom: 1px solid rgba(164, 170, 172, 0.28);
|
23 |
+
padding-bottom: 20px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.supsystic-overview .half-page > div:last-child {
|
27 |
+
border-bottom: none;
|
28 |
+
}
|
29 |
+
|
30 |
+
.supsystic-overview .text-block {
|
31 |
+
margin: 10px 0;
|
32 |
+
}
|
33 |
+
|
34 |
.supsystic-overview .faq-title {
|
35 |
cursor: pointer;
|
36 |
}
|
57 |
display: block;
|
58 |
}
|
59 |
|
60 |
+
.supsystic-overview .faq-list .button.button-primary.button-hero{
|
61 |
+
float: left;
|
62 |
+
margin-left: 10px;
|
63 |
+
}
|
64 |
+
|
65 |
.supsystic-overview .settings-title {
|
66 |
font-size: 14px;
|
67 |
font-weight: 600;
|
103 |
font-size: 18px;
|
104 |
font-weight: 800;
|
105 |
margin-top: 10px;
|
106 |
+
white-space: nowrap;
|
107 |
}
|
108 |
|
109 |
.supsystic-overview form input,
|
114 |
width: calc(100% - 50px);
|
115 |
}
|
116 |
|
117 |
+
#contact-form-dialog p {
|
118 |
+
font-size: 15px;
|
119 |
}
|
120 |
+
#contact-form-dialog a {
|
121 |
+
color: #4ae8ea;
|
122 |
+
}
|
123 |
+
#contact-form-dialog a:focus {
|
124 |
+
outline: none;
|
|
|
|
|
125 |
}
|
126 |
|
127 |
.supsystic-overview .half-page > div {
|
128 |
+
border-bottom:0px;
|
129 |
+
padding-bottom:inherit;
|
130 |
}
|
131 |
+
.overview-section {
|
132 |
+
display:none;
|
|
|
133 |
}
|
134 |
+
.overview-section-btn {
|
135 |
+
list-style:square;
|
136 |
+
cursor:pointer;
|
137 |
+
margin-left:20px;
|
138 |
}
|
139 |
+
.overview-section-btn:hover {
|
140 |
+
color: #4ae8ea;
|
|
|
141 |
}
|
142 |
+
.border-wrapper {
|
143 |
+
display:block;
|
144 |
+
position:relative;
|
145 |
+
border:1px solid rgba(164, 170, 172, 0.28) !important;
|
146 |
+
padding:30px;
|
147 |
+
padding-top:0px;
|
148 |
+
margin-bottom:20px;
|
149 |
+
border-left: 3px solid #4ae8ea !important;
|
150 |
}
|
151 |
+
.border-wrapper .button-hero {
|
152 |
+
margin-bottom:30px;
|
153 |
+
line-height:auto !important;
|
154 |
+
padding:0px 10px !important;
|
155 |
+
margin:10px 4px !important;
|
156 |
+
}
|
157 |
+
.overview-section-btn-active {
|
158 |
+
color: #4ae8ea;
|
159 |
+
font-weight:bold;
|
160 |
+
}
|
161 |
+
.overview-contact-form form {
|
162 |
+
margin:0px !important;
|
163 |
+
padding:0px !important;
|
164 |
+
}
|
165 |
+
.overview-contact-form input,
|
166 |
+
.overview-contact-form select,
|
167 |
+
.overview-contact-form textarea {
|
168 |
+
display:block;
|
169 |
+
position:relative;
|
170 |
+
width:100%;
|
171 |
+
max-width:100% !important;
|
172 |
+
background-color: #f6f7f7;
|
173 |
+
color: #252728;
|
174 |
+
border: 1px solid #dfe4e4;
|
175 |
+
outline:0px;
|
176 |
+
}
|
177 |
+
.overview-contact-form #form-settings {
|
178 |
+
height:auto;
|
179 |
+
}
|
180 |
+
.overview-section-btn a {
|
181 |
+
text-decoration:none;
|
182 |
+
color: #3c434a;
|
183 |
+
}
|
184 |
+
.overview-section-btn a:hover {
|
185 |
+
color: #4ae8ea;
|
186 |
+
}
|
187 |
+
.overview-section h3 {
|
188 |
+
border-bottom:1px solid rgba(164, 170, 172, 0.28) !important;
|
189 |
+
padding-bottom:.5em;
|
190 |
+
margin-bottom:.5em;
|
191 |
+
}
|
192 |
+
.contact-info-section {
|
193 |
+
border: 1px solid rgba(164, 170, 172, 0.28) !important;
|
194 |
+
padding: 5px;
|
195 |
+
}
|
196 |
+
.contact-info-section p {
|
197 |
+
font-size:12px;
|
198 |
+
white-space: inherit;
|
199 |
+
line-height: 18px;
|
200 |
+
}
|
201 |
+
.contact-info-section ul {
|
202 |
+
margin:0px;
|
203 |
+
}
|
204 |
+
.contact-info-section ul li {
|
205 |
+
padding-left:5px;
|
206 |
+
line-height: 18px;
|
207 |
+
margin:0px;
|
208 |
+
padding:0px;
|
209 |
+
}
|
210 |
+
.contact-info-section {
|
211 |
+
margin-bottom:20px;
|
212 |
+
}
|
213 |
+
.overview-section-btn sup {
|
214 |
+
font-size:10px !important;
|
215 |
+
line-height:0px;
|
216 |
+
}
|
217 |
+
.plugin-title {
|
218 |
+
display: flex;
|
219 |
+
position: relative;
|
220 |
+
flex-direction: row;
|
221 |
+
align-content: center;
|
222 |
+
flex-wrap: nowrap;
|
223 |
+
align-items: center;
|
224 |
+
font-size:24px;
|
225 |
+
color:#313846;
|
226 |
+
font-weight:bold;
|
227 |
+
margin-bottom:10px;
|
228 |
+
}
|
229 |
+
.plugin-title img {
|
230 |
+
padding-right:15px;
|
231 |
+
}
|
232 |
+
.plugin-description {
|
233 |
+
margin-bottom:20px;
|
234 |
+
}
|
235 |
+
.supsystic-overview-flex {
|
236 |
+
display: flex;
|
237 |
+
position: relative;
|
238 |
+
flex-direction: row;
|
239 |
+
flex-wrap: nowrap;
|
240 |
+
align-content: center;
|
241 |
+
align-items: stretch;
|
242 |
+
justify-content: space-between;
|
243 |
+
}
|
244 |
+
.half-page {
|
245 |
+
display:inline-block;
|
246 |
+
position:relative;
|
247 |
+
width:49% !important;
|
248 |
+
float:inherit !important;
|
249 |
+
margin:0px !important;
|
250 |
+
padding:0px !important;
|
251 |
+
border:0px !important;
|
252 |
+
}
|
253 |
+
.full-page {
|
254 |
+
width:98%;
|
255 |
+
}
|
256 |
+
.overview-supsystic-img {
|
257 |
+
max-width:770px;
|
258 |
+
width:100%;
|
259 |
+
}
|
260 |
+
@media (max-width:1100px) {
|
261 |
+
.supsystic-overview-flex {
|
262 |
+
flex-direction: column;
|
263 |
+
}
|
264 |
+
.half-page {
|
265 |
+
width: 100% !important;
|
266 |
+
}
|
267 |
+
.full-page {
|
268 |
+
width:100%;
|
269 |
+
}
|
270 |
}
|
271 |
|
272 |
+
.supsysticOverviewACTitle {
|
273 |
+
background:#2a3545;
|
274 |
+
color:white;
|
275 |
+
font-size:14px;
|
276 |
+
padding:10px 0px;
|
277 |
+
text-align:center;
|
278 |
+
margin-bottom:10px;
|
279 |
+
width:100%;
|
280 |
}
|
281 |
+
.supsysticOverviewACForm input {
|
282 |
+
width:94%;
|
283 |
+
text-align:center;
|
|
|
284 |
}
|
285 |
+
.supsysticOverviewACForm button, .supsysticOverviewACBtn {
|
286 |
+
display:block;
|
287 |
+
position:relative;
|
288 |
+
width:94%;
|
289 |
+
margin:0px;
|
290 |
+
padding:0px;
|
291 |
+
text-align:center;
|
292 |
+
margin-top:10px !important;
|
293 |
}
|
294 |
+
.supsysticOverviewACFormOverlay {
|
295 |
+
display:block;
|
296 |
+
position:absolute;
|
297 |
+
left:0px;
|
298 |
+
top:0px;
|
299 |
+
width:100%;
|
300 |
+
height:100%;
|
301 |
+
background: rgb(223 223 223 / 80%);
|
302 |
+
z-index:99;
|
303 |
}
|
304 |
+
#overview-ac-form {
|
305 |
+
position: relative;
|
306 |
+
display: flex;
|
307 |
+
flex-direction: column;
|
308 |
+
flex-wrap: nowrap;
|
309 |
+
align-content: center;
|
310 |
+
align-items: center;
|
311 |
+
justify-content: flex-start;
|
312 |
+
background:white;
|
313 |
+
box-shadow: 0px 3px 9px 0px #919191cf;
|
314 |
+
margin:30px auto;
|
315 |
+
width: 100%;
|
316 |
+
max-width: 300px;
|
317 |
+
padding-bottom:20px;
|
318 |
+
}
|
319 |
+
.supsystic-footer-wrapper {
|
320 |
+
display: flex;
|
321 |
+
position: relative;
|
322 |
+
background: #263546;
|
323 |
+
margin-left: 75px;
|
324 |
+
color: white;
|
325 |
+
padding: 10px;
|
326 |
+
flex-direction: row;
|
327 |
+
flex-wrap: nowrap;
|
328 |
+
align-content: center;
|
329 |
+
justify-content: space-between;
|
330 |
+
align-items: center;
|
331 |
+
}
|
332 |
+
.supsystic-panel {
|
333 |
+
margin-bottom:0px;
|
334 |
+
}
|
335 |
+
.supsystic-breadcrumbs {
|
336 |
+
background: #263546;
|
337 |
+
color: white;
|
338 |
+
margin-left: 75px;
|
339 |
+
padding: 10px;
|
340 |
+
}
|
341 |
+
.supsystic-breadcrumbs * {
|
342 |
+
color: white !important;
|
343 |
+
}
|
344 |
+
.ui-dialog-titlebar-close {
|
345 |
+
display:none;
|
346 |
+
}
|
347 |
+
.supsysticOverviewACFormNotification,
|
348 |
+
.required-notification {
|
349 |
+
margin-top:10px;
|
350 |
+
}
|
351 |
+
.supsysticOverviewACClose {
|
352 |
+
display:inline-block;
|
353 |
+
position:absolute;
|
354 |
+
right:-7.5px;
|
355 |
+
top:-7.5px;
|
356 |
+
background:#4ae8ea !important;
|
357 |
+
border-radius:50%;
|
358 |
+
text-align:center;
|
359 |
+
font-size:18px;
|
360 |
+
width:21px;
|
361 |
+
height:21px;
|
362 |
+
cursor:pointer;
|
363 |
+
z-index:99;
|
364 |
+
text-shadow: 0px 1px 2px black;
|
365 |
}
|
src/SupsysticTables/Overview/assets/img/overview-01.png
ADDED
Binary file
|
src/SupsysticTables/Overview/assets/img/overview-02.png
ADDED
Binary file
|
src/SupsysticTables/Overview/assets/img/overview-03.png
ADDED
Binary file
|
src/SupsysticTables/Overview/assets/img/plugin-icon.png
ADDED
Binary file
|
src/SupsysticTables/Overview/assets/img/supsystic-logo-small.png
ADDED
Binary file
|
src/SupsysticTables/Overview/assets/js/overview.settings.js
CHANGED
@@ -3,9 +3,12 @@
|
|
3 |
var Controller = function () {
|
4 |
this.$newsContainer = $('.supsystic-overview-news');
|
5 |
this.$mailButton = $('#send-mail');
|
|
|
|
|
|
|
6 |
this.$faqToggles = $('.faq-title');
|
7 |
};
|
8 |
-
|
9 |
Controller.prototype.initScroll = function() {
|
10 |
|
11 |
this.$newsContainer.slimScroll({
|
@@ -20,7 +23,7 @@
|
|
20 |
var self = this,
|
21 |
$userMail = $('[name="email"]'),
|
22 |
$userText = $('[name="message"]'),
|
23 |
-
$dialog
|
24 |
|
25 |
function sendMail() {
|
26 |
|
@@ -33,11 +36,11 @@
|
|
33 |
data[obj.name] = obj.value;
|
34 |
});
|
35 |
|
36 |
-
|
37 |
module: 'overview',
|
38 |
action: 'sendMail',
|
39 |
data: data
|
40 |
-
}).
|
41 |
self.$mailButton.find('i').attr('class', defaultIconClass);
|
42 |
self.$mailButton.attr('disabled', false);
|
43 |
|
@@ -58,8 +61,6 @@
|
|
58 |
}
|
59 |
}
|
60 |
});
|
61 |
-
}).fail(function(response) {
|
62 |
-
console.log(response, 'fail');
|
63 |
});
|
64 |
}
|
65 |
|
@@ -74,14 +75,130 @@
|
|
74 |
$('.required-notification').hide();
|
75 |
sendMail();
|
76 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
};
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
Controller.prototype.initFaqToggles = function() {
|
80 |
var self = this;
|
81 |
|
82 |
this.$faqToggles.on('click', function() {
|
83 |
-
//self.$faqToggles.find('div.description').hide();
|
84 |
-
//$(this).find('div.description').show();
|
85 |
jQuery(this).find('div.description').toggle();
|
86 |
});
|
87 |
};
|
@@ -89,12 +206,28 @@
|
|
89 |
Controller.prototype.init = function() {
|
90 |
this.initScroll();
|
91 |
this.checkMail();
|
|
|
|
|
|
|
92 |
this.initFaqToggles();
|
93 |
};
|
94 |
|
95 |
$(document).ready(function() {
|
96 |
var controller = new Controller();
|
97 |
-
|
98 |
controller.init();
|
99 |
});
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var Controller = function () {
|
4 |
this.$newsContainer = $('.supsystic-overview-news');
|
5 |
this.$mailButton = $('#send-mail');
|
6 |
+
this.$subscribeButton = $('#subscribe-btn');
|
7 |
+
this.$subscribeButtonRemind = $('.supsysticOverviewACBtnRemind');
|
8 |
+
this.$subscribeButtonDisable = $('.supsysticOverviewACBtnDisable');
|
9 |
this.$faqToggles = $('.faq-title');
|
10 |
};
|
11 |
+
|
12 |
Controller.prototype.initScroll = function() {
|
13 |
|
14 |
this.$newsContainer.slimScroll({
|
23 |
var self = this,
|
24 |
$userMail = $('[name="email"]'),
|
25 |
$userText = $('[name="message"]'),
|
26 |
+
$dialog = $('#contact-form-dialog');
|
27 |
|
28 |
function sendMail() {
|
29 |
|
36 |
data[obj.name] = obj.value;
|
37 |
});
|
38 |
|
39 |
+
app.Ajax.Post({
|
40 |
module: 'overview',
|
41 |
action: 'sendMail',
|
42 |
data: data
|
43 |
+
}).send(function(response) {
|
44 |
self.$mailButton.find('i').attr('class', defaultIconClass);
|
45 |
self.$mailButton.attr('disabled', false);
|
46 |
|
61 |
}
|
62 |
}
|
63 |
});
|
|
|
|
|
64 |
});
|
65 |
}
|
66 |
|
75 |
$('.required-notification').hide();
|
76 |
sendMail();
|
77 |
});
|
78 |
+
|
79 |
+
};
|
80 |
+
|
81 |
+
Controller.prototype.subscribeMail = function() {
|
82 |
+
var self = this,
|
83 |
+
$userMail = $('.supsysticOverviewACForm [name="email"]'),
|
84 |
+
$userName = $('.supsysticOverviewACForm [name="username"]'),
|
85 |
+
$dialog = $('#supsysticOverviewACFormDialog');
|
86 |
+
|
87 |
+
function sendSubscribeMail() {
|
88 |
+
|
89 |
+
var defaultIconClass = self.$subscribeButton.find('i').attr('class');
|
90 |
+
self.$subscribeButton.find('i').attr('class', 'fa fa-spinner fa-spin');
|
91 |
+
self.$subscribeButton.attr('disabled', true);
|
92 |
+
|
93 |
+
data = {};
|
94 |
+
$.each($('#overview-ac-form').serializeArray(), function(index, obj){
|
95 |
+
data[obj.name] = obj.value;
|
96 |
+
});
|
97 |
+
|
98 |
+
var nonce = jQuery("[name='nonce']").val();
|
99 |
+
jQuery.ajax({
|
100 |
+
url : ajaxurl,
|
101 |
+
type : 'post',
|
102 |
+
data : {'action' : 'supsystic-tables', 'route': {'module' : 'overview', 'action' : 'sendSubscribeMail', 'nonce' : nonce, 'data' : data}, 'nonce' : nonce},
|
103 |
+
success : function( response ) {
|
104 |
+
self.$subscribeButtonDisable.find('i').attr('class', defaultIconClass);
|
105 |
+
self.$subscribeButtonDisable.attr('disabled', false);
|
106 |
+
$('.supsysticOverviewACFormOverlay').fadeOut();
|
107 |
+
|
108 |
+
$('#supsysticOverviewACFormDialog').find('.message').text(response.message);
|
109 |
+
$('#supsysticOverviewACFormDialog').dialog({
|
110 |
+
autoOpen: true,
|
111 |
+
resizable: false,
|
112 |
+
width: 500,
|
113 |
+
height: 280,
|
114 |
+
modal: true,
|
115 |
+
buttons: {
|
116 |
+
Close: function() {
|
117 |
+
$('#supsysticOverviewACFormDialog').find('.on-error').hide();
|
118 |
+
$('.supsysticOverviewACFormOverlay').fadeOut();
|
119 |
+
$(this).dialog("close");
|
120 |
+
}
|
121 |
+
}
|
122 |
+
});
|
123 |
+
|
124 |
+
},
|
125 |
+
fail : function( err ) {
|
126 |
+
$('#supsysticOverviewACFormDialog').find('.on-error').show();
|
127 |
+
}
|
128 |
+
});
|
129 |
+
}
|
130 |
+
|
131 |
+
this.$subscribeButton.on('click', function(e) {
|
132 |
+
e.preventDefault();
|
133 |
+
if(!$userMail.val() || !$userName.val()) {
|
134 |
+
$('.supsysticOverviewACFormNotification').show();
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
$('.supsysticOverviewACFormNotification').hide();
|
138 |
+
jQuery('#subscribe-btn, .supsysticOverviewACBtnRemind, .supsysticOverviewACBtnDisable').attr('disabled','disabled').prop('disabled','disabled');
|
139 |
+
sendSubscribeMail();
|
140 |
+
});
|
141 |
+
|
142 |
+
};
|
143 |
+
|
144 |
+
Controller.prototype.subscribeRemind = function() {
|
145 |
+
var self = this;
|
146 |
+
function sendSubscribeRemind() {
|
147 |
+
var defaultIconClass = self.$subscribeButtonRemind.find('i').attr('class');
|
148 |
+
self.$subscribeButtonRemind.find('i').attr('class', 'fa fa-spinner fa-spin');
|
149 |
+
self.$subscribeButtonRemind.attr('disabled', true);
|
150 |
+
var form_data = jQuery('#overview-ac-form').serializeArray();
|
151 |
+
var nonce = jQuery("[name='nonce']").val();
|
152 |
+
jQuery.ajax({
|
153 |
+
url : ajaxurl,
|
154 |
+
type : 'post',
|
155 |
+
data : {'action' : 'supsystic-tables', 'route': {'module' : 'overview', 'action' : 'sendSubscribeRemind', 'nonce' : nonce}, 'nonce' : nonce},
|
156 |
+
success : function( response ) {
|
157 |
+
self.$subscribeButtonDisable.find('i').attr('class', defaultIconClass);
|
158 |
+
self.$subscribeButtonDisable.attr('disabled', false);
|
159 |
+
$('.supsysticOverviewACFormOverlay').fadeOut();
|
160 |
+
},
|
161 |
+
fail : function( err ) {
|
162 |
+
}
|
163 |
+
});
|
164 |
+
}
|
165 |
+
this.$subscribeButtonRemind.on('click', function(e) {
|
166 |
+
e.preventDefault();
|
167 |
+
sendSubscribeRemind();
|
168 |
+
});
|
169 |
};
|
170 |
|
171 |
+
Controller.prototype.subscribeDisable = function() {
|
172 |
+
var self = this;
|
173 |
+
function sendSubscribeDisable() {
|
174 |
+
var defaultIconClass = self.$subscribeButtonDisable.find('i').attr('class');
|
175 |
+
self.$subscribeButtonDisable.find('i').attr('class', 'fa fa-spinner fa-spin');
|
176 |
+
self.$subscribeButtonDisable.attr('disabled', true);
|
177 |
+
var form_data = jQuery('#overview-ac-form').serializeArray();
|
178 |
+
var nonce = jQuery("[name='nonce']").val();
|
179 |
+
jQuery.ajax({
|
180 |
+
url : ajaxurl,
|
181 |
+
type : 'post',
|
182 |
+
data : {'action' : 'supsystic-tables', 'route': {'module' : 'overview', 'action' : 'sendSubscribeDisable', 'nonce' : nonce}, 'nonce' : nonce},
|
183 |
+
success : function( response ) {
|
184 |
+
self.$subscribeButtonDisable.find('i').attr('class', defaultIconClass);
|
185 |
+
self.$subscribeButtonDisable.attr('disabled', false);
|
186 |
+
$('.supsysticOverviewACFormOverlay').fadeOut();
|
187 |
+
},
|
188 |
+
fail : function( err ) {
|
189 |
+
}
|
190 |
+
});
|
191 |
+
}
|
192 |
+
this.$subscribeButtonDisable.on('click', function(e) {
|
193 |
+
e.preventDefault();
|
194 |
+
sendSubscribeDisable();
|
195 |
+
});
|
196 |
+
};
|
197 |
+
|
198 |
Controller.prototype.initFaqToggles = function() {
|
199 |
var self = this;
|
200 |
|
201 |
this.$faqToggles.on('click', function() {
|
|
|
|
|
202 |
jQuery(this).find('div.description').toggle();
|
203 |
});
|
204 |
};
|
206 |
Controller.prototype.init = function() {
|
207 |
this.initScroll();
|
208 |
this.checkMail();
|
209 |
+
this.subscribeMail();
|
210 |
+
this.subscribeRemind();
|
211 |
+
this.subscribeDisable();
|
212 |
this.initFaqToggles();
|
213 |
};
|
214 |
|
215 |
$(document).ready(function() {
|
216 |
var controller = new Controller();
|
|
|
217 |
controller.init();
|
218 |
});
|
219 |
+
|
220 |
+
})(jQuery);
|
221 |
+
|
222 |
+
jQuery(document).ready(function(){
|
223 |
+
jQuery('.overview-section-btn').on('click', function(){
|
224 |
+
jQuery(".overview-section").hide();
|
225 |
+
jQuery(".overview-section[data-section='"+jQuery(this).data("section")+"']").show();
|
226 |
+
jQuery('.overview-section-btn-active').removeClass('overview-section-btn-active');
|
227 |
+
jQuery(this).addClass('overview-section-btn-active');
|
228 |
+
});
|
229 |
+
jQuery('.supsysticOverviewACBtnDisable, .supsysticOverviewACClose, .supsysticOverviewACBtnRemind').on('click', function(){
|
230 |
+
jQuery('.supsysticOverviewACFormOverlay').fadeOut();
|
231 |
+
});
|
232 |
+
jQuery('.overview-section-btn').eq(0).trigger('click');
|
233 |
+
});
|
src/SupsysticTables/Overview/views/index.twig
CHANGED
@@ -2,165 +2,46 @@
|
|
2 |
|
3 |
{% block content %}
|
4 |
<div class="supsystic-overview">
|
|
|
|
|
|
|
|
|
|
|
5 |
<div class="half-page half-page-left">
|
6 |
-
<div class="
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
</
|
12 |
-
<
|
|
|
|
|
|
|
|
|
13 |
</div>
|
14 |
-
<div class="faq-list">
|
15 |
-
<h3>FAQ and Documentation</h3>
|
16 |
-
<div class="faq-title">
|
17 |
-
<i class="fa fa-info-circle"></i>
|
18 |
-
Data Tables Plugin Installation
|
19 |
-
<div class="description" hidden>
|
20 |
-
One more advantage of Data Tables WordPress Plugin is an easy installation. To install it, you should make three following steps:
|
21 |
-
1. Download Data Tables Generator by Supsystic plugin.<br/>
|
22 |
-
2. Upload to your WordPress plugins directory. <br/>
|
23 |
-
3. Activate and enjoy.
|
24 |
-
</div>
|
25 |
-
</div>
|
26 |
-
<div class="faq-title">
|
27 |
-
<i class="fa fa-info-circle"></i>
|
28 |
-
How to use Data Tables Generator plugin?
|
29 |
-
<div class="description" hidden>
|
30 |
-
<strong>Step 1: Creating Responsive Data Table</strong><br/>
|
31 |
-
1. On the left navigation menu click “Add new table”.
|
32 |
-
<br/>
|
33 |
-
2. Enter the title of table, set the number of Rows and Columns.
|
34 |
-
<br/>
|
35 |
-
3. Click “OK”. <br/>
|
36 |
-
<strong>Step 2: Adding data to the Tables by Supsystic</strong>
|
37 |
-
<br/>
|
38 |
-
More detail information you can find here –
|
39 |
-
<a href="http://supsystic.com/how-to-create-data-tables-in-wordpress/">How to Create Data Tables in WordPress</a>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
<div class="faq-title">
|
43 |
-
<i class="fa fa-info-circle"></i>
|
44 |
-
How to make table responsive?
|
45 |
-
<div class="description" hidden>
|
46 |
-
Data Tables Generator by Supsystic automatically creates responsive tables. So you don’t need to activate for this any options, it will be responsive by default. <br>Besides on Settings tab you can find “Responsive mode” option with which you are able to choose different responsive modes for your table (Standard Responsive mode, Automatic column hiding, Horizontal scroll or simply disable it).
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
|
50 |
-
<div class="faq-title">
|
51 |
-
<i class="fa fa-info-circle"></i>
|
52 |
-
How to search by the table?
|
53 |
-
<div class="description" hidden>
|
54 |
-
1. In the Settings of a table go to “Features” section.
|
55 |
-
<br/>
|
56 |
-
2. Find “Searching” option and activate it. <br/>
|
57 |
-
3. Over the table will appear the search field.
|
58 |
-
</div>
|
59 |
-
</div>
|
60 |
-
|
61 |
-
<div class="faq-title">
|
62 |
-
<i class="fa fa-info-circle"></i>
|
63 |
-
How to sort the table?
|
64 |
-
<div class="description" hidden>
|
65 |
-
With Data Tables by Supsystic you can alter the ordering characteristics of the table. Using ordering (sorting) option, you can set the table to display the data in exactly the order that you want.
|
66 |
-
<br/>
|
67 |
-
1. In the Settings of a table go to “Features” section.
|
68 |
-
<br/>
|
69 |
-
2. Find “Ordering” option and activate it.
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
5. Check the result of formula in the table on your site.
|
86 |
-
<br/>
|
87 |
-
<br/>
|
88 |
-
Learn more about how to do this <a href="//supsystic.com/how-to-use-tables/" target="_blank">here</a>.
|
89 |
-
</div>
|
90 |
</div>
|
91 |
-
|
92 |
-
<div class="faq-title">
|
93 |
-
<i class="fa fa-info-circle"></i>
|
94 |
-
How to format content of the table?
|
95 |
-
<div class="description" hidden>
|
96 |
-
In order to format content of the table – click “Editor” button. Here you can:
|
97 |
-
<br/>
|
98 |
-
- insert row and column to the table <br/>
|
99 |
-
- set the font of text – bold and italic <br/>
|
100 |
-
- choose text and background color <br/>
|
101 |
-
- specify horizontal and vertical alignment <br/>
|
102 |
-
Besides, by clicking the right button of the mouse (choose the certain cell, column or row and click the right button of mouse) you have such abilities –
|
103 |
-
<br/>
|
104 |
-
- cancel or restore your actions <br/>
|
105 |
-
- insert row or column where you want <br/>
|
106 |
-
- remove row or column <br/>
|
107 |
-
- enable “Read only” mode for any cells, rows and columns and even for the whole table
|
108 |
-
<br/>
|
109 |
-
- set the alignment of text <br/>
|
110 |
-
- Also you have the ability to change the column / row width – use your mouse, move the cursor on right side of the column boundary / (bottom side of the row boundary) you want until it becomes a resize cursor, and then drag the boundary.
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
|
114 |
-
<div style="clear: both;"></div>
|
115 |
-
<a href="http://supsystic.com/plugins/data-tables-generator-plugin/#faq?utm_source=plugin&utm_medium=faq&utm_campaign=tables" class="button button-primary button-hero">
|
116 |
-
<i class="fa fa-info-circle"></i>
|
117 |
-
Check all FAQs
|
118 |
-
</a>
|
119 |
-
<div style="clear: both;"></div>
|
120 |
-
</div>
|
121 |
-
<div class="video">
|
122 |
-
<h3>Video tutorial</h3>
|
123 |
-
<iframe type="text/html"
|
124 |
-
width="80%"
|
125 |
-
height="240px"
|
126 |
-
src="https://www.youtube.com/embed/Fa3EI7-oBfc"
|
127 |
-
frameborder="0">
|
128 |
-
</iframe>
|
129 |
-
</div>
|
130 |
-
<div class="server-settings">
|
131 |
-
<h3>Server Settings</h3>
|
132 |
-
<ul class="settings-list">
|
133 |
-
{% for title, element in serverSettings %}
|
134 |
-
<li class="settings-line" style="float: none;">
|
135 |
-
<div class="settings-title">{{ title|trim }}:</div>
|
136 |
-
<span>{{ element.value|trim }}</span>
|
137 |
-
</li>
|
138 |
-
{% endfor %}
|
139 |
-
</ul>
|
140 |
-
</div>
|
141 |
-
</div>
|
142 |
-
<div class="half-page half-page-right">
|
143 |
-
<div class="supsystic-overview-news-container">
|
144 |
-
<h3>News</h3>
|
145 |
-
<div class="supsystic-overview-news">
|
146 |
-
{{ news|raw }}
|
147 |
-
</div>
|
148 |
-
<a href="http://supsystic.com/plugins/data-tables-generator-plugin/" class="button button-primary button-hero">
|
149 |
-
<i class="fa fa-info-circle"></i>All news
|
150 |
-
</a>
|
151 |
-
<div class="clear"></div>
|
152 |
-
</div>
|
153 |
-
<div class="overview-contact-form">
|
154 |
-
<h3>Contact form</h3>
|
155 |
-
{#<div class="description">Translate plugin in your language and get a Premium license for FREE</div>#}
|
156 |
{% import '@core/form.twig' as form %}
|
157 |
|
158 |
-
{{ form.open('post', environment.generateUrl('overview', 'sendMail'), { 'id': 'form-settings', 'style': 'max-width:
|
159 |
|
160 |
<table class="contact-form-table" style="width: 100%;">
|
161 |
<thead>
|
162 |
{{ form.row(translate('Name') ~ ' *',
|
163 |
-
form.text('name',
|
164 |
|
165 |
{{ form.row(translate('Email') ~ ' *',
|
166 |
form.text('email', contactForm.email, { 'required': '' })) }}
|
@@ -185,6 +66,9 @@
|
|
185 |
<option value="functionallity">
|
186 |
{{ translate('Require a new functionallity') }}
|
187 |
</option>
|
|
|
|
|
|
|
188 |
<option value="other">
|
189 |
{{ translate('Other') }}
|
190 |
</option>
|
@@ -199,29 +83,174 @@
|
|
199 |
<textarea id="mail-text" name="message" cols="50" rows="3" placeholder="{{ translate('Hello Supsystic Team!') }}" required=""></textarea>
|
200 |
</td>
|
201 |
</tr>
|
|
|
202 |
</thead>
|
203 |
</table>
|
204 |
<button id="send-mail" type="submit" class="button button-primary button-hero">
|
205 |
-
<i class="fa fa-
|
206 |
Send email
|
207 |
</button>
|
208 |
<div class="required-notification" style="color: red; float: left;" hidden>Fields with * are required to fill</div>
|
209 |
{{ form.close() }}
|
210 |
<div class="clear"></div>
|
211 |
</div>
|
212 |
-
|
213 |
-
|
214 |
-
<
|
215 |
-
<
|
216 |
-
|
|
|
|
|
217 |
</div>
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
</div>
|
224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
</div>
|
226 |
</div>
|
227 |
-
{% endblock %}
|
2 |
|
3 |
{% block content %}
|
4 |
<div class="supsystic-overview">
|
5 |
+
<div class="full-page">
|
6 |
+
<div class="plugin-title"><img src="{{ DTGS_PLUGIN_URL }}/src/SupsysticTables/Overview/assets/img/plugin-icon.png">Data Tables by Supsystic</div>
|
7 |
+
<div class="plugin-description">Creating tables and charts on a WordPress website has never been easier thanks to this powerful data table maker plugin. With just a few clicks, WordPress users can have their data table online quickly and displayed exactly the way they want it. And the best part? Data Tables Generator is lightweight and fast.</div>
|
8 |
+
</div>
|
9 |
+
<div class="supsystic-overview-flex">
|
10 |
<div class="half-page half-page-left">
|
11 |
+
<div class="border-wrapper">
|
12 |
+
<ul>
|
13 |
+
<li class="overview-section-btn" data-section="faq"><i class="fa fa-info-circle"></i> FAQ and Documentation</li>
|
14 |
+
<li class="overview-section-btn" data-section="video"><i class="fa fa-play"></i> Video tutorial</li>
|
15 |
+
<li class="overview-section-btn" data-section="settings"><i class="fa fa-cog"></i> Server Settings</li>
|
16 |
+
<li class="overview-section-btn" data-section="support"><i class="fa fa-life-ring"></i> Support</li>
|
17 |
+
<li class="overview-section-btn" data-section="promo_video"><i class="fa fa-star"></i> Our promo video</li>
|
18 |
+
<li class="overview-section-btn"><a target="_blank" title="Go to supsystic.com" href="https://supsystic.com/plugins/data-tables-generator-plugin/?utm_source=plugin&utm_campaign=tables"> Plugin page on supsystic.com <sup><i class="fa fa-external-link"></i></sup></a></li>
|
19 |
+
<li class="overview-section-btn"><a target="_blank" title="Go to supsystic.com" href="https://supsystic.com/plugins/data-tables-generator-plugin/?utm_source=plugin&utm_campaign=tables"> Compare FREE and PRO features <sup><i class="fa fa-external-link"></i></sup></a></li>
|
20 |
+
<li class="overview-section-btn"><a target="_blank" title="Go to supsystic.com" href="https://supsystic.com/all-plugins/?utm_source=plugin&utm_campaign=tables"> Check other supsystic FREE plugins <sup><i class="fa fa-external-link"></i></sup></a></li>
|
21 |
+
</ul>
|
22 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
<div class="border-wrapper">
|
25 |
+
<div class="overview-contact-form overview-section" data-section="support">
|
26 |
+
<h3><i class="fa fa-life-ring"></i> Support</h3>
|
27 |
+
<div class="contact-info-section">
|
28 |
+
<p><i class="fa fa-clock-o" aria-hidden="true"></i> Our official support hours are 09:00 -18:00 GMT+02:00, Monday to Friday – excluding bank holidays and other official holidays.</p>
|
29 |
+
<p>The timescales listed below refer to these working hours.</p><br>
|
30 |
+
<p><em>Support requests are prioritized based on the type of license:</em></p>
|
31 |
+
<ul>
|
32 |
+
<li><p><em>Pro Support</em> is reserved for customers with an active Pro license. We respond to new priority support requests within 12 hours.</p></li>
|
33 |
+
<li><p><em>Standard Support</em> is provided to customers with an active Free license. We respond to standard support requests within 24h-48h.</p></li>
|
34 |
+
</ul><br>
|
35 |
+
<p><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> While we don’t guarantee that we will resolve the request in this time period, we will acknowledge it and communicate with the customer as appropriate to help resolve the issue.</p>
|
|
|
|
|
|
|
|
|
|
|
36 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
{% import '@core/form.twig' as form %}
|
38 |
|
39 |
+
{{ form.open('post', environment.generateUrl('overview', 'sendMail'), { 'id': 'form-settings', 'style': 'max-width: 100%;', '_wpnonce': _wpnonce }) }}
|
40 |
|
41 |
<table class="contact-form-table" style="width: 100%;">
|
42 |
<thead>
|
43 |
{{ form.row(translate('Name') ~ ' *',
|
44 |
+
form.text('name', SG_USER_NAME, { 'required': '' })) }}
|
45 |
|
46 |
{{ form.row(translate('Email') ~ ' *',
|
47 |
form.text('email', contactForm.email, { 'required': '' })) }}
|
66 |
<option value="functionallity">
|
67 |
{{ translate('Require a new functionallity') }}
|
68 |
</option>
|
69 |
+
<option value="security_issue">
|
70 |
+
{{ translate('Report about security issue (XSS/SQLi and others)') }}
|
71 |
+
</option>
|
72 |
<option value="other">
|
73 |
{{ translate('Other') }}
|
74 |
</option>
|
83 |
<textarea id="mail-text" name="message" cols="50" rows="3" placeholder="{{ translate('Hello Supsystic Team!') }}" required=""></textarea>
|
84 |
</td>
|
85 |
</tr>
|
86 |
+
|
87 |
</thead>
|
88 |
</table>
|
89 |
<button id="send-mail" type="submit" class="button button-primary button-hero">
|
90 |
+
<i class="fa fa-check-square" aria-hidden="true"></i>
|
91 |
Send email
|
92 |
</button>
|
93 |
<div class="required-notification" style="color: red; float: left;" hidden>Fields with * are required to fill</div>
|
94 |
{{ form.close() }}
|
95 |
<div class="clear"></div>
|
96 |
</div>
|
97 |
+
|
98 |
+
<div id="contact-form-dialog" hidden>
|
99 |
+
<div class="on-error" style="display:none">
|
100 |
+
<p>{{ translate('Some errors occurred while sending mail please send your message trough this contact form:') }}</p>
|
101 |
+
<p><a href="https://supsystic.com/plugins/data-tables-generator-plugin/#contact" target="_blank">https://supsystic.com/plugins/data-tables-generator-plugin/#contact</a></p>
|
102 |
+
</div>
|
103 |
+
<div class="message"></div>
|
104 |
</div>
|
105 |
+
|
106 |
+
<div data-section="faq" class="faq-list overview-section">
|
107 |
+
<h3>FAQ and Documentation</h3>
|
108 |
+
<div class="faq-title">
|
109 |
+
<i class="fa fa-info-circle"></i>
|
110 |
+
Data Tables Plugin Installation
|
111 |
+
<div class="description" hidden>
|
112 |
+
One more advantage of Data Tables WordPress Plugin is an easy installation. To install it, you should make three following steps:
|
113 |
+
1. Download Data Tables Generator by Supsystic plugin.<br/>
|
114 |
+
2. Upload to your WordPress plugins directory. <br/>
|
115 |
+
3. Activate and enjoy.
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
<div class="faq-title">
|
119 |
+
<i class="fa fa-info-circle"></i>
|
120 |
+
How to use Data Tables Generator plugin?
|
121 |
+
<div class="description" hidden>
|
122 |
+
<strong>Step 1: Creating Responsive Data Table</strong><br/>
|
123 |
+
1. On the left navigation menu click “Add new table”.
|
124 |
+
<br/>
|
125 |
+
2. Enter the title of table, set the number of Rows and Columns.
|
126 |
+
<br/>
|
127 |
+
3. Click “OK”. <br/>
|
128 |
+
<strong>Step 2: Adding data to the Tables by Supsystic</strong>
|
129 |
+
<br/>
|
130 |
+
More detail information you can find here –
|
131 |
+
<a href="http://supsystic.com/how-to-create-data-tables-in-wordpress/">How to Create Data Tables in WordPress</a>
|
132 |
+
</div>
|
133 |
+
</div>
|
134 |
+
<div class="faq-title">
|
135 |
+
<i class="fa fa-info-circle"></i>
|
136 |
+
How to make table responsive?
|
137 |
+
<div class="description" hidden>
|
138 |
+
Data Tables Generator by Supsystic automatically creates responsive tables. So you don’t need to activate for this any options, it will be responsive by default. <br>Besides on Settings tab you can find “Responsive mode” option with which you are able to choose different responsive modes for your table (Standard Responsive mode, Automatic column hiding, Horizontal scroll or simply disable it).
|
139 |
+
</div>
|
140 |
+
</div>
|
141 |
+
<div class="faq-title">
|
142 |
+
<i class="fa fa-info-circle"></i>
|
143 |
+
How to search by the table?
|
144 |
+
<div class="description" hidden>
|
145 |
+
1. In the Settings of a table go to “Features” section.
|
146 |
+
<br/>
|
147 |
+
2. Find “Searching” option and activate it. <br/>
|
148 |
+
3. Over the table will appear the search field.
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
<div class="faq-title">
|
152 |
+
<i class="fa fa-info-circle"></i>
|
153 |
+
How to sort the table?
|
154 |
+
<div class="description" hidden>
|
155 |
+
With Data Tables by Supsystic you can alter the ordering characteristics of the table. Using ordering (sorting) option, you can set the table to display the data in exactly the order that you want.
|
156 |
+
<br/>
|
157 |
+
1. In the Settings of a table go to “Features” section.
|
158 |
+
<br/>
|
159 |
+
2. Find “Ordering” option and activate it.
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
<div class="faq-title">
|
163 |
+
<i class="fa fa-info-circle"></i>
|
164 |
+
How to use formulas in the table?
|
165 |
+
<div class="description" hidden>
|
166 |
+
1. In the Settings of a table go to “Features” section.Go to Editor of Data Table.
|
167 |
+
<br/>
|
168 |
+
2. Select a cell and start typing. In a cell, type an equal sign “=” to start the formula.
|
169 |
+
<br/>
|
170 |
+
3. Fill in the rest of the formula.
|
171 |
+
<br/>
|
172 |
+
4. Save the changes of table.
|
173 |
+
<br/>
|
174 |
+
5. Check the result of formula in the table on your site.
|
175 |
+
<br/>
|
176 |
+
<br/>
|
177 |
+
Learn more about how to do this <a href="//supsystic.com/how-to-use-tables/" target="_blank">here</a>.
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
<div class="faq-title">
|
181 |
+
<i class="fa fa-info-circle"></i>
|
182 |
+
How to format content of the table?
|
183 |
+
<div class="description" hidden>
|
184 |
+
In order to format content of the table – click “Editor” button. Here you can:
|
185 |
+
<br/>
|
186 |
+
- insert row and column to the table <br/>
|
187 |
+
- set the font of text – bold and italic <br/>
|
188 |
+
- choose text and background color <br/>
|
189 |
+
- specify horizontal and vertical alignment <br/>
|
190 |
+
Besides, by clicking the right button of the mouse (choose the certain cell, column or row and click the right button of mouse) you have such abilities –
|
191 |
+
<br/>
|
192 |
+
- cancel or restore your actions <br/>
|
193 |
+
- insert row or column where you want <br/>
|
194 |
+
- remove row or column <br/>
|
195 |
+
- enable “Read only” mode for any cells, rows and columns and even for the whole table
|
196 |
+
<br/>
|
197 |
+
- set the alignment of text <br/>
|
198 |
+
- Also you have the ability to change the column / row width – use your mouse, move the cursor on right side of the column boundary / (bottom side of the row boundary) you want until it becomes a resize cursor, and then drag the boundary.
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
<div style="clear: both;"></div>
|
202 |
+
<a href="https://supsystic.com/docs/data-tables/#faq?utm_source=plugin&utm_medium=faq&utm_campaign=tables" class="button button-primary button-hero">
|
203 |
+
<i class="fa fa-info-circle"></i>
|
204 |
+
Check all FAQs
|
205 |
+
</a>
|
206 |
+
<div style="clear: both;"></div>
|
207 |
+
<div class="clear"></div>
|
208 |
+
</div>
|
209 |
+
|
210 |
+
<div data-section="video" class="video overview-section">
|
211 |
+
<h3><i class="fa fa-play"></i> Video tutorial</h3>
|
212 |
+
<iframe type="text/html"
|
213 |
+
width="100%"
|
214 |
+
height="350px"
|
215 |
+
src="https://www.youtube.com/embed/Fa3EI7-oBfc"
|
216 |
+
frameborder="0">
|
217 |
+
</iframe>
|
218 |
+
<div class="clear"></div>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
<div data-section="promo_video" class="video overview-section">
|
222 |
+
<h3><i class="fa fa-star"></i> Our promo video</h3>
|
223 |
+
<iframe type="text/html"
|
224 |
+
width="100%"
|
225 |
+
height="350px"
|
226 |
+
src="http://www.youtube.com/embed/dKd_9g6JzfU"
|
227 |
+
frameborder="0">
|
228 |
+
</iframe>
|
229 |
+
<div class="clear"></div>
|
230 |
</div>
|
231 |
+
|
232 |
+
<div data-section="settings" class="server-settings overview-section">
|
233 |
+
<h3><i class="fa fa-cog"></i> Server settings</h3>
|
234 |
+
<ul class="settings-list">
|
235 |
+
{% for title, element in serverSettings %}
|
236 |
+
<li class="settings-line" style="float: none;">
|
237 |
+
<div class="settings-title">{{ title|trim }}:</div>
|
238 |
+
<span>{{ element.value|trim }}</span>
|
239 |
+
</li>
|
240 |
+
{% endfor %}
|
241 |
+
</ul>
|
242 |
+
<div class="clear"></div>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
|
246 |
+
</div>
|
247 |
+
|
248 |
+
<div class="half-page half-page-right">
|
249 |
+
<a href="https://supsystic.com/pricing/?utm_source=plugin&utm_campaign=tables" target="_blank"><img class="overview-supsystic-img" src="{{ DTGS_PLUGIN_URL }}/src/SupsysticTables/Overview/assets/img/overview-01.png"></a>
|
250 |
+
<a href="https://supsystic.com/bundle-mix/?utm_source=plugin&utm_campaign=tables" target="_blank"><img class="overview-supsystic-img" src="{{ DTGS_PLUGIN_URL }}/src/SupsysticTables/Overview/assets/img/overview-02.png"></a>
|
251 |
+
<a href="https://supsystic.com/all-plugins/?utm_source=plugin&utm_campaign=tables" target="_blank"><img style="margin-top:20px;" class="overview-supsystic-img" src="{{ DTGS_PLUGIN_URL }}/src/SupsysticTables/Overview/assets/img/overview-03.png"></a>
|
252 |
+
<div class="clear"></div>
|
253 |
+
</div>
|
254 |
</div>
|
255 |
</div>
|
256 |
+
{% endblock %}
|
src/SupsysticTables/Promo/Controller.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*/
|
5 |
class SupsysticTables_Promo_Controller extends SupsysticTables_Core_BaseController
|
6 |
{
|
7 |
-
public function indexAction(
|
8 |
{
|
9 |
$environment = $this->getEnvironment();
|
10 |
|
@@ -37,10 +37,10 @@ class SupsysticTables_Promo_Controller extends SupsysticTables_Core_BaseControll
|
|
37 |
|
38 |
/**
|
39 |
* Just let us know. Love is Sharing
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
-
public function saveDeactivateDataAction(
|
44 |
{
|
45 |
$this->getModel('promo')->saveDeactivateData(array(
|
46 |
'deactivate_reason' => $request->query->get('deactivate_reason'),
|
4 |
*/
|
5 |
class SupsysticTables_Promo_Controller extends SupsysticTables_Core_BaseController
|
6 |
{
|
7 |
+
public function indexAction(RscDtgs_Http_Request $request)
|
8 |
{
|
9 |
$environment = $this->getEnvironment();
|
10 |
|
37 |
|
38 |
/**
|
39 |
* Just let us know. Love is Sharing
|
40 |
+
* @param RscDtgs_Http_Request $request
|
41 |
+
* @return RscDtgs_Http_Response
|
42 |
*/
|
43 |
+
public function saveDeactivateDataAction(RscDtgs_Http_Request $request)
|
44 |
{
|
45 |
$this->getModel('promo')->saveDeactivateData(array(
|
46 |
'deactivate_reason' => $request->query->get('deactivate_reason'),
|
src/SupsysticTables/Promo/Module.php
CHANGED
@@ -22,7 +22,7 @@ class SupsysticTables_Promo_Module extends SupsysticTables_Core_BaseModule
|
|
22 |
$dispatcher->on('messages', array($this, 'renderDiscountMsg'));
|
23 |
|
24 |
$this->_checkFirstRun();
|
25 |
-
add_action('admin_footer', array($this, 'checkPluginDeactivation'));
|
26 |
}
|
27 |
}
|
28 |
|
@@ -189,31 +189,31 @@ class SupsysticTables_Promo_Module extends SupsysticTables_Core_BaseModule
|
|
189 |
|
190 |
public function renderDiscountMsg()
|
191 |
{
|
192 |
-
$environment = $this->getEnvironment();
|
193 |
-
if($environment->isPro() && $environment->isModule('license') && $environment->getModule('license')->isActive()) {
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
}
|
217 |
}
|
218 |
|
219 |
public function getDiscountBuyUrl() {
|
@@ -226,31 +226,31 @@ class SupsysticTables_Promo_Module extends SupsysticTables_Core_BaseModule
|
|
226 |
}
|
227 |
|
228 |
public function checkPluginDeactivation() {
|
229 |
-
if(function_exists('get_current_screen')) {
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
}
|
255 |
}
|
256 |
}
|
22 |
$dispatcher->on('messages', array($this, 'renderDiscountMsg'));
|
23 |
|
24 |
$this->_checkFirstRun();
|
25 |
+
// add_action('admin_footer', array($this, 'checkPluginDeactivation'));
|
26 |
}
|
27 |
}
|
28 |
|
189 |
|
190 |
public function renderDiscountMsg()
|
191 |
{
|
192 |
+
// $environment = $this->getEnvironment();
|
193 |
+
// if($environment->isPro() && $environment->isModule('license') && $environment->getModule('license')->isActive()) {
|
194 |
+
// $proPluginsList = array(
|
195 |
+
// 'ultimate-maps-by-supsystic-pro', 'newsletters-by-supsystic-pro', 'contact-form-by-supsystic-pro', 'live-chat-pro',
|
196 |
+
// 'digital-publications-supsystic-pro', 'coming-soon-supsystic-pro', 'price-table-supsystic-pro', 'tables-generator-pro',
|
197 |
+
// 'social-share-pro', 'popup-by-supsystic-pro', 'supsystic_slider_pro', 'supsystic-gallery-pro', 'google-maps-easy-pro',
|
198 |
+
// 'backup-supsystic-pro',
|
199 |
+
// );
|
200 |
+
// $activePluginsList = get_option('active_plugins', array());
|
201 |
+
// $activeProPluginsCount = 0;
|
202 |
+
// foreach($activePluginsList as $actPl) {
|
203 |
+
// foreach($proPluginsList as $proPl) {
|
204 |
+
// if(strpos($actPl, $proPl) !== false) {
|
205 |
+
// $activeProPluginsCount++;
|
206 |
+
// }
|
207 |
+
// }
|
208 |
+
// }
|
209 |
+
// if($activeProPluginsCount === 1) {
|
210 |
+
// $twig = $this->getEnvironment()->getTwig();
|
211 |
+
// $twig->display('@promo/discountMessage.twig', array(
|
212 |
+
// 'bundlePageLink' => '//supsystic.com/all-plugins/',
|
213 |
+
// 'buyLink' => $this->getDiscountBuyUrl(),
|
214 |
+
// ));
|
215 |
+
// }
|
216 |
+
// }
|
217 |
}
|
218 |
|
219 |
public function getDiscountBuyUrl() {
|
226 |
}
|
227 |
|
228 |
public function checkPluginDeactivation() {
|
229 |
+
// if(function_exists('get_current_screen')) {
|
230 |
+
// $screen = get_current_screen();
|
231 |
+
// if($screen && isset($screen->base) && $screen->base == 'plugins') {
|
232 |
+
// $twig = $this->getEnvironment()->getTwig();
|
233 |
+
// $twig->display('@promo/pluginDeactivation.twig', array(
|
234 |
+
// 'pluginName' => $this->getConfig()->get('plugin_title_name'),
|
235 |
+
// ));
|
236 |
+
// $modulePath = untrailingslashit(plugin_dir_url(__FILE__));
|
237 |
+
// wp_enqueue_script('jquery-ui-dialog');
|
238 |
+
// wp_enqueue_script(
|
239 |
+
// $this->config('db_prefix'). 'plug-deactivation',
|
240 |
+
// $modulePath . '/assets/js/admin.plugins.js',
|
241 |
+
// array('jquery-ui-dialog')
|
242 |
+
// );
|
243 |
+
// $pluginPath = $this->getEnvironment()->getPluginPath();
|
244 |
+
// $pluginDirName = basename($pluginPath);
|
245 |
+
// $pluginUrl = plugin_dir_url($pluginPath). $pluginDirName. '/';
|
246 |
+
// wp_enqueue_script('jquery-ui-dialog');
|
247 |
+
// wp_enqueue_style('tables-ui-styles', $pluginUrl. '/app/assets/css/supsystic-ui.css');
|
248 |
+
// wp_enqueue_style('jquery-ui');
|
249 |
+
// wp_enqueue_style('supsystic-font-awesome', '/app/assets/css/libraries/fontawesome/font-awesome.min.css');
|
250 |
+
// wp_localize_script($this->config('db_prefix'). 'plug-deactivation', 'dtsPluginsData', array(
|
251 |
+
// 'plugName' => $pluginDirName. '/index.php',
|
252 |
+
// ));
|
253 |
+
// }
|
254 |
+
// }
|
255 |
}
|
256 |
}
|
src/SupsysticTables/Settings/Controller.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
class SupsysticTables_Settings_Controller extends SupsysticTables_Core_BaseController
|
5 |
{
|
6 |
/**
|
7 |
-
* @return
|
8 |
*/
|
9 |
public function indexAction()
|
10 |
{
|
@@ -25,17 +25,17 @@ class SupsysticTables_Settings_Controller extends SupsysticTables_Core_BaseContr
|
|
25 |
}
|
26 |
}
|
27 |
/**
|
28 |
-
* @return
|
29 |
*/
|
30 |
public function getSettingsAction() {
|
31 |
$settings = get_option($this->getConfig()->get('db_prefix') . 'settings');
|
32 |
return $this->response(
|
33 |
-
|
34 |
array_merge(array('settings'=>$settings), array('success' => true))
|
35 |
);
|
36 |
|
37 |
}
|
38 |
-
public function saveSettingsAction(
|
39 |
if (!$this->_checkNonce($request)) die();
|
40 |
$optionsName = $this->getConfig()->get('db_prefix') . 'settings';
|
41 |
$currentSettings = get_option($optionsName);
|
4 |
class SupsysticTables_Settings_Controller extends SupsysticTables_Core_BaseController
|
5 |
{
|
6 |
/**
|
7 |
+
* @return RscDtgs_Http_Response
|
8 |
*/
|
9 |
public function indexAction()
|
10 |
{
|
25 |
}
|
26 |
}
|
27 |
/**
|
28 |
+
* @return RscDtgs_Http_Response
|
29 |
*/
|
30 |
public function getSettingsAction() {
|
31 |
$settings = get_option($this->getConfig()->get('db_prefix') . 'settings');
|
32 |
return $this->response(
|
33 |
+
RscDtgs_Http_Response::AJAX,
|
34 |
array_merge(array('settings'=>$settings), array('success' => true))
|
35 |
);
|
36 |
|
37 |
}
|
38 |
+
public function saveSettingsAction(RscDtgs_Http_Request $request) {
|
39 |
if (!$this->_checkNonce($request)) die();
|
40 |
$optionsName = $this->getConfig()->get('db_prefix') . 'settings';
|
41 |
$currentSettings = get_option($optionsName);
|
src/SupsysticTables/Tables/Controller.php
CHANGED
@@ -5,7 +5,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
5 |
{
|
6 |
/**
|
7 |
* Shows the list of the tables.
|
8 |
-
* @return
|
9 |
*/
|
10 |
public function indexAction()
|
11 |
{
|
@@ -23,10 +23,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
23 |
|
24 |
/**
|
25 |
* Validate and creates the new table.
|
26 |
-
* @param
|
27 |
-
* @return
|
28 |
*/
|
29 |
-
public function createAction(
|
30 |
{
|
31 |
if (!$this->_checkNonce($request)) die();
|
32 |
$title = sanitize_text_field(trim($request->post->get('title')));
|
@@ -69,10 +69,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
69 |
|
70 |
/**
|
71 |
* Removes the table.
|
72 |
-
* @param
|
73 |
-
* @return
|
74 |
*/
|
75 |
-
public function removeAction(
|
76 |
{
|
77 |
if (!$this->_checkNonce($request)) die();
|
78 |
$id = $this->isAjax() ? $request->post->get('id') : $request->query->get('id');
|
@@ -99,10 +99,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
99 |
|
100 |
/**
|
101 |
* Show the table settings, editor, etc.
|
102 |
-
* @param
|
103 |
-
* @return
|
104 |
*/
|
105 |
-
public function viewAction(
|
106 |
{
|
107 |
|
108 |
$this->getEnvironment()->getModule('tables')->setIniLimits();
|
@@ -165,10 +165,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
165 |
|
166 |
/**
|
167 |
* Renames the table.
|
168 |
-
* @param
|
169 |
-
* @return
|
170 |
*/
|
171 |
-
public function renameAction(
|
172 |
{
|
173 |
if (!$this->_checkNonce($request)) die();
|
174 |
$id = $request->post->get('id');
|
@@ -187,10 +187,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
187 |
|
188 |
/**
|
189 |
* Get Data for AJAX paging.
|
190 |
-
* @param
|
191 |
-
* @return
|
192 |
*/
|
193 |
-
public function getPageRowsAction(
|
194 |
{
|
195 |
if ( !$this->_checkNonce($request) && !$this->_checkNonceFrontend($request) ) die();
|
196 |
$id = (int)$request->post->get('id');
|
@@ -257,10 +257,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
257 |
|
258 |
/**
|
259 |
* Returns the table columns.
|
260 |
-
* @param
|
261 |
-
* @return
|
262 |
*/
|
263 |
-
public function getColumnsAction(
|
264 |
{
|
265 |
if (!$this->_checkNonce($request)) die();
|
266 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
@@ -278,10 +278,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
278 |
|
279 |
/**
|
280 |
* Updates the table columns.
|
281 |
-
* @param
|
282 |
-
* @return
|
283 |
*/
|
284 |
-
public function updateColumnsAction(
|
285 |
{
|
286 |
if (!$this->_checkNonce($request)) die();
|
287 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
@@ -307,10 +307,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
307 |
|
308 |
/**
|
309 |
* Returns count of table rows.
|
310 |
-
* @param
|
311 |
-
* @return
|
312 |
*/
|
313 |
-
public function getCountRowsAction(
|
314 |
{
|
315 |
if (!$this->_checkNonce($request)) die();
|
316 |
$tables = $this->getModel('tables');
|
@@ -329,10 +329,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
329 |
|
330 |
/**
|
331 |
* Returns the table rows.
|
332 |
-
* @param
|
333 |
-
* @return
|
334 |
*/
|
335 |
-
public function getRowsAction(
|
336 |
{
|
337 |
if (!$this->_checkNonce($request)) die();
|
338 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
@@ -354,10 +354,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
354 |
|
355 |
/**
|
356 |
* Updates the table rows.
|
357 |
-
* @param
|
358 |
-
* @return
|
359 |
*/
|
360 |
-
public function updateRowsAction(
|
361 |
{
|
362 |
if (!$this->_checkNonce($request)) die();
|
363 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
@@ -404,10 +404,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
404 |
|
405 |
/**
|
406 |
* Saves the table settings.
|
407 |
-
* @param
|
408 |
-
* @return
|
409 |
*/
|
410 |
-
public function saveSettingsAction(
|
411 |
{
|
412 |
if (!$this->_checkNonce($request)) die();
|
413 |
$id = $request->post->get('id');
|
@@ -440,10 +440,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
440 |
|
441 |
/**
|
442 |
* Renders the table.
|
443 |
-
* @param
|
444 |
-
* @return
|
445 |
*/
|
446 |
-
public function renderAction(
|
447 |
{
|
448 |
if (!$this->_checkNonce($request)) die();
|
449 |
/** @var SupsysticTables_Tables_Module $tables */
|
@@ -477,10 +477,10 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
477 |
|
478 |
/**
|
479 |
* Updates table meta (Cells merging, etc)
|
480 |
-
* @param \
|
481 |
-
* @return \
|
482 |
*/
|
483 |
-
public function updateMetaAction(
|
484 |
{
|
485 |
if (!$this->_checkNonce($request)) die();
|
486 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
@@ -515,7 +515,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
515 |
return $this->ajaxSuccess();
|
516 |
}
|
517 |
|
518 |
-
public function getMetaAction(
|
519 |
{
|
520 |
if (!$this->_checkNonce($request)) die();
|
521 |
$id = $request->post->get('id');
|
@@ -586,7 +586,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
586 |
return $decodedData;
|
587 |
}
|
588 |
|
589 |
-
public function cloneTableAction(
|
590 |
{
|
591 |
if (!$this->_checkNonce($request)) die();
|
592 |
$tablesModule = $this->getEnvironment()->getModule('tables');
|
@@ -625,7 +625,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
625 |
}
|
626 |
}
|
627 |
|
628 |
-
public function reviewNoticeResponseAction(
|
629 |
if (!$this->_checkNonce($request)) die();
|
630 |
$responseCode = $request->post->get('responseCode');
|
631 |
$responseType = $request->post->get('responseType');
|
@@ -660,7 +660,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
660 |
* Returns full list of the tables.
|
661 |
* Uses for adding of shortcode button to TinyMCE Editor.
|
662 |
*
|
663 |
-
* @return
|
664 |
*/
|
665 |
public function listAction() {
|
666 |
try{
|
@@ -674,7 +674,7 @@ class SupsysticTables_Tables_Controller extends SupsysticTables_Core_BaseControl
|
|
674 |
}
|
675 |
}
|
676 |
|
677 |
-
public function getListForTblAction(
|
678 |
{
|
679 |
if (!$this->_checkNonce($request)) die();
|
680 |
$data = $request->post->get('data');
|
5 |
{
|
6 |
/**
|
7 |
* Shows the list of the tables.
|
8 |
+
* @return RscDtgs_Http_Response
|
9 |
*/
|
10 |
public function indexAction()
|
11 |
{
|
23 |
|
24 |
/**
|
25 |
* Validate and creates the new table.
|
26 |
+
* @param RscDtgs_Http_Request $request
|
27 |
+
* @return RscDtgs_Http_Response
|
28 |
*/
|
29 |
+
public function createAction(RscDtgs_Http_Request $request)
|
30 |
{
|
31 |
if (!$this->_checkNonce($request)) die();
|
32 |
$title = sanitize_text_field(trim($request->post->get('title')));
|
69 |
|
70 |
/**
|
71 |
* Removes the table.
|
72 |
+
* @param RscDtgs_Http_Request $request
|
73 |
+
* @return RscDtgs_Http_Response
|
74 |
*/
|
75 |
+
public function removeAction(RscDtgs_Http_Request $request)
|
76 |
{
|
77 |
if (!$this->_checkNonce($request)) die();
|
78 |
$id = $this->isAjax() ? $request->post->get('id') : $request->query->get('id');
|
99 |
|
100 |
/**
|
101 |
* Show the table settings, editor, etc.
|
102 |
+
* @param RscDtgs_Http_Request $request
|
103 |
+
* @return RscDtgs_Http_Response
|
104 |
*/
|
105 |
+
public function viewAction(RscDtgs_Http_Request $request)
|
106 |
{
|
107 |
|
108 |
$this->getEnvironment()->getModule('tables')->setIniLimits();
|
165 |
|
166 |
/**
|
167 |
* Renames the table.
|
168 |
+
* @param RscDtgs_Http_Request $request
|
169 |
+
* @return RscDtgs_Http_Response
|
170 |
*/
|
171 |
+
public function renameAction(RscDtgs_Http_Request $request)
|
172 |
{
|
173 |
if (!$this->_checkNonce($request)) die();
|
174 |
$id = $request->post->get('id');
|
187 |
|
188 |
/**
|
189 |
* Get Data for AJAX paging.
|
190 |
+
* @param RscDtgs_Http_Request $request
|
191 |
+
* @return RscDtgs_Http_Response
|
192 |
*/
|
193 |
+
public function getPageRowsAction(RscDtgs_Http_Request $request)
|
194 |
{
|
195 |
if ( !$this->_checkNonce($request) && !$this->_checkNonceFrontend($request) ) die();
|
196 |
$id = (int)$request->post->get('id');
|
257 |
|
258 |
/**
|
259 |
* Returns the table columns.
|
260 |
+
* @param RscDtgs_Http_Request $request
|
261 |
+
* @return RscDtgs_Http_Response
|
262 |
*/
|
263 |
+
public function getColumnsAction(RscDtgs_Http_Request $request)
|
264 |
{
|
265 |
if (!$this->_checkNonce($request)) die();
|
266 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
278 |
|
279 |
/**
|
280 |
* Updates the table columns.
|
281 |
+
* @param RscDtgs_Http_Request $request
|
282 |
+
* @return RscDtgs_Http_Response
|
283 |
*/
|
284 |
+
public function updateColumnsAction(RscDtgs_Http_Request $request)
|
285 |
{
|
286 |
if (!$this->_checkNonce($request)) die();
|
287 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
307 |
|
308 |
/**
|
309 |
* Returns count of table rows.
|
310 |
+
* @param RscDtgs_Http_Request $request
|
311 |
+
* @return RscDtgs_Http_Response
|
312 |
*/
|
313 |
+
public function getCountRowsAction(RscDtgs_Http_Request $request)
|
314 |
{
|
315 |
if (!$this->_checkNonce($request)) die();
|
316 |
$tables = $this->getModel('tables');
|
329 |
|
330 |
/**
|
331 |
* Returns the table rows.
|
332 |
+
* @param RscDtgs_Http_Request $request
|
333 |
+
* @return RscDtgs_Http_Response
|
334 |
*/
|
335 |
+
public function getRowsAction(RscDtgs_Http_Request $request)
|
336 |
{
|
337 |
if (!$this->_checkNonce($request)) die();
|
338 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
354 |
|
355 |
/**
|
356 |
* Updates the table rows.
|
357 |
+
* @param RscDtgs_Http_Request $request
|
358 |
+
* @return RscDtgs_Http_Response
|
359 |
*/
|
360 |
+
public function updateRowsAction(RscDtgs_Http_Request $request)
|
361 |
{
|
362 |
if (!$this->_checkNonce($request)) die();
|
363 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
404 |
|
405 |
/**
|
406 |
* Saves the table settings.
|
407 |
+
* @param RscDtgs_Http_Request $request
|
408 |
+
* @return RscDtgs_Http_Response
|
409 |
*/
|
410 |
+
public function saveSettingsAction(RscDtgs_Http_Request $request)
|
411 |
{
|
412 |
if (!$this->_checkNonce($request)) die();
|
413 |
$id = $request->post->get('id');
|
440 |
|
441 |
/**
|
442 |
* Renders the table.
|
443 |
+
* @param RscDtgs_Http_Request $request
|
444 |
+
* @return RscDtgs_Http_Response
|
445 |
*/
|
446 |
+
public function renderAction(RscDtgs_Http_Request $request)
|
447 |
{
|
448 |
if (!$this->_checkNonce($request)) die();
|
449 |
/** @var SupsysticTables_Tables_Module $tables */
|
477 |
|
478 |
/**
|
479 |
* Updates table meta (Cells merging, etc)
|
480 |
+
* @param \RscDtgs_Http_Request $request
|
481 |
+
* @return \RscDtgs_Http_Response
|
482 |
*/
|
483 |
+
public function updateMetaAction(RscDtgs_Http_Request $request)
|
484 |
{
|
485 |
if (!$this->_checkNonce($request)) die();
|
486 |
/** @var SupsysticTables_Tables_Model_Tables $tables */
|
515 |
return $this->ajaxSuccess();
|
516 |
}
|
517 |
|
518 |
+
public function getMetaAction(RscDtgs_Http_Request $request)
|
519 |
{
|
520 |
if (!$this->_checkNonce($request)) die();
|
521 |
$id = $request->post->get('id');
|
586 |
return $decodedData;
|
587 |
}
|
588 |
|
589 |
+
public function cloneTableAction(RscDtgs_Http_Request $request)
|
590 |
{
|
591 |
if (!$this->_checkNonce($request)) die();
|
592 |
$tablesModule = $this->getEnvironment()->getModule('tables');
|
625 |
}
|
626 |
}
|
627 |
|
628 |
+
public function reviewNoticeResponseAction(RscDtgs_Http_Request $request) {
|
629 |
if (!$this->_checkNonce($request)) die();
|
630 |
$responseCode = $request->post->get('responseCode');
|
631 |
$responseType = $request->post->get('responseType');
|
660 |
* Returns full list of the tables.
|
661 |
* Uses for adding of shortcode button to TinyMCE Editor.
|
662 |
*
|
663 |
+
* @return RscDtgs_Http_Response
|
664 |
*/
|
665 |
public function listAction() {
|
666 |
try{
|
674 |
}
|
675 |
}
|
676 |
|
677 |
+
public function getListForTblAction(RscDtgs_Http_Request $request)
|
678 |
{
|
679 |
if (!$this->_checkNonce($request)) die();
|
680 |
$data = $request->post->get('data');
|
src/SupsysticTables/Tables/Model/Tables.php
CHANGED
@@ -1583,13 +1583,13 @@ class SupsysticTables_Tables_Model_Tables extends SupsysticTables_Core_BaseModel
|
|
1583 |
$table->view_id = $table->id . '_' . mt_rand(1, 99999);
|
1584 |
$table->columns = $this->getColumns($table->id);
|
1585 |
|
1586 |
-
$table->settings = htmlspecialchars_decode($table->settings, ENT_QUOTES);
|
1587 |
$table->settings = $this->fixIncorrectSerialize($table->settings);
|
1588 |
$table->settings = unserialize($table->settings);
|
1589 |
|
1590 |
// rev 41
|
1591 |
if (property_exists($table, 'meta')) {
|
1592 |
-
$table->meta = htmlspecialchars_decode($table->meta, ENT_QUOTES);
|
1593 |
$table->meta = $this->fixIncorrectSerialize($table->meta);
|
1594 |
$table->meta = unserialize($table->meta);
|
1595 |
}
|
1583 |
$table->view_id = $table->id . '_' . mt_rand(1, 99999);
|
1584 |
$table->columns = $this->getColumns($table->id);
|
1585 |
|
1586 |
+
$table->settings = htmlspecialchars_decode((string)$table->settings, ENT_QUOTES);
|
1587 |
$table->settings = $this->fixIncorrectSerialize($table->settings);
|
1588 |
$table->settings = unserialize($table->settings);
|
1589 |
|
1590 |
// rev 41
|
1591 |
if (property_exists($table, 'meta')) {
|
1592 |
+
$table->meta = htmlspecialchars_decode((string)$table->meta, ENT_QUOTES);
|
1593 |
$table->meta = $this->fixIncorrectSerialize($table->meta);
|
1594 |
$table->meta = unserialize($table->meta);
|
1595 |
}
|
src/SupsysticTables/Tables/Module.php
CHANGED
@@ -860,14 +860,14 @@ class SupsysticTables_Tables_Module extends SupsysticTables_Core_BaseModule
|
|
860 |
$callable = array($this, 'render');
|
861 |
|
862 |
|
863 |
-
$twig->addFunction(new
|
864 |
}
|
865 |
|
866 |
private function addTwigHighlighter()
|
867 |
{
|
868 |
$twig = $this->getEnvironment()->getTwig();
|
869 |
|
870 |
-
$twig->addFilter( new
|
871 |
}
|
872 |
|
873 |
/**
|
860 |
$callable = array($this, 'render');
|
861 |
|
862 |
|
863 |
+
$twig->addFunction(new Twig_SupTwgDtgs_SimpleFunction('render_table', $callable, array('is_safe' => array('html'))));
|
864 |
}
|
865 |
|
866 |
private function addTwigHighlighter()
|
867 |
{
|
868 |
$twig = $this->getEnvironment()->getTwig();
|
869 |
|
870 |
+
$twig->addFilter( new Twig_SupTwgDtgs_SimpleFilter('highlight', 'highlight_string', array('is_safe' => array('html'))));
|
871 |
}
|
872 |
|
873 |
/**
|
src/SupsysticTables/Tables/views/view.twig
CHANGED
@@ -1901,7 +1901,7 @@
|
|
1901 |
</button>
|
1902 |
<div id="toolbar-rows" class="toolbar-content">
|
1903 |
<a href="#" data-method="row">
|
1904 |
-
<i class="fa fa-
|
1905 |
</a>
|
1906 |
<a href="#" data-method="remove_row">
|
1907 |
<i class="fa fa-fw fa-trash-o"></i>
|
@@ -1914,7 +1914,7 @@
|
|
1914 |
</button>
|
1915 |
<div id="toolbar-cols" class="toolbar-content">
|
1916 |
<a href="#" data-method="column">
|
1917 |
-
<i class="fa fa-
|
1918 |
</a>
|
1919 |
<a href="#" data-method="remove_col">
|
1920 |
<i class="fa fa-fw fa-trash-o"></i>
|
@@ -2151,7 +2151,7 @@
|
|
2151 |
</span>
|
2152 |
</button>
|
2153 |
<div id="toolbar-invisibleCell" class="toolbar-content">
|
2154 |
-
<a href="#" data-method="addInvisibleCell"><i class="fa fa-
|
2155 |
<a href="#" data-method="removeInvisibleCell"><i class="fa fa-fw fa-trash-o"></i></a>
|
2156 |
</div>
|
2157 |
</li>
|
@@ -2163,7 +2163,7 @@
|
|
2163 |
</span>
|
2164 |
</button>
|
2165 |
<div id="toolbar-hiddenCell" class="toolbar-content">
|
2166 |
-
<a href="#" data-method="addHiddenCell"><i class="fa fa-
|
2167 |
<a href="#" data-method="removeHiddenCell"><i class="fa fa-fw fa-trash-o"></i></a>
|
2168 |
</div>
|
2169 |
</li>
|
@@ -2175,7 +2175,7 @@
|
|
2175 |
</span>
|
2176 |
</button>
|
2177 |
<div id="toolbar-unescapeHtml" class="toolbar-content">
|
2178 |
-
<a href="#" data-method="addUnescapeHtml"><i class="fa fa-
|
2179 |
<a href="#" data-method="removeUnescapeHtml"><i class="fa fa-fw fa-trash-o"></i></a>
|
2180 |
</div>
|
2181 |
</li>
|
1901 |
</button>
|
1902 |
<div id="toolbar-rows" class="toolbar-content">
|
1903 |
<a href="#" data-method="row">
|
1904 |
+
<i class="fa fa-plus-circle"></i>
|
1905 |
</a>
|
1906 |
<a href="#" data-method="remove_row">
|
1907 |
<i class="fa fa-fw fa-trash-o"></i>
|
1914 |
</button>
|
1915 |
<div id="toolbar-cols" class="toolbar-content">
|
1916 |
<a href="#" data-method="column">
|
1917 |
+
<i class="fa fa-plus-circle"></i>
|
1918 |
</a>
|
1919 |
<a href="#" data-method="remove_col">
|
1920 |
<i class="fa fa-fw fa-trash-o"></i>
|
2151 |
</span>
|
2152 |
</button>
|
2153 |
<div id="toolbar-invisibleCell" class="toolbar-content">
|
2154 |
+
<a href="#" data-method="addInvisibleCell"><i class="fa fa-plus-circle"></i></a>
|
2155 |
<a href="#" data-method="removeInvisibleCell"><i class="fa fa-fw fa-trash-o"></i></a>
|
2156 |
</div>
|
2157 |
</li>
|
2163 |
</span>
|
2164 |
</button>
|
2165 |
<div id="toolbar-hiddenCell" class="toolbar-content">
|
2166 |
+
<a href="#" data-method="addHiddenCell"><i class="fa fa-plus-circle"></i></a>
|
2167 |
<a href="#" data-method="removeHiddenCell"><i class="fa fa-fw fa-trash-o"></i></a>
|
2168 |
</div>
|
2169 |
</li>
|
2175 |
</span>
|
2176 |
</button>
|
2177 |
<div id="toolbar-unescapeHtml" class="toolbar-content">
|
2178 |
+
<a href="#" data-method="addUnescapeHtml"><i class="fa fa-plus-circle"></i></a>
|
2179 |
<a href="#" data-method="removeUnescapeHtml"><i class="fa fa-fw fa-trash-o"></i></a>
|
2180 |
</div>
|
2181 |
</li>
|
src/SupsysticTables/Ui/Asset.php
CHANGED
@@ -153,7 +153,7 @@ abstract class SupsysticTables_Ui_Asset implements SupsysticTables_Ui_AssetInter
|
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
-
* @param string|
|
157 |
* @param string $moduleSource
|
158 |
* @return SupsysticTables_Ui_Asset
|
159 |
*/
|
@@ -163,7 +163,7 @@ abstract class SupsysticTables_Ui_Asset implements SupsysticTables_Ui_AssetInter
|
|
163 |
|
164 |
if (is_string($module)) {
|
165 |
$module = $baseUrl . ucfirst($module);
|
166 |
-
} elseif ($module instanceof
|
167 |
$module = $module->getLocationUrl();
|
168 |
} else {
|
169 |
throw new InvalidArgumentException(
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
+
* @param string|RscDtgs_Mvc_Module $module
|
157 |
* @param string $moduleSource
|
158 |
* @return SupsysticTables_Ui_Asset
|
159 |
*/
|
163 |
|
164 |
if (is_string($module)) {
|
165 |
$module = $baseUrl . ucfirst($module);
|
166 |
+
} elseif ($module instanceof RscDtgs_Mvc_Module) {
|
167 |
$module = $module->getLocationUrl();
|
168 |
} else {
|
169 |
throw new InvalidArgumentException(
|
vendor/Rsc/Autoloader.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* Register
|
9 |
*/
|
10 |
public static function register()
|
11 |
{
|
@@ -23,12 +23,12 @@ class Rsc_Autoloader
|
|
23 |
die(); exit();
|
24 |
}
|
25 |
}
|
26 |
-
|
27 |
-
|
28 |
-
return;
|
29 |
}
|
30 |
-
|
31 |
-
|
|
|
32 |
require_once $file;
|
33 |
}
|
34 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Autoloader
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* Register RscDtgs_Autoloader in the SPL autoloader stack
|
9 |
*/
|
10 |
public static function register()
|
11 |
{
|
23 |
die(); exit();
|
24 |
}
|
25 |
}
|
26 |
+
if (substr($classname, 0, 7) !== 'RscDtgs') {
|
27 |
+
return;
|
|
|
28 |
}
|
29 |
+
$classname = str_replace('RscDtgs', '', $classname);
|
30 |
+
$file = dirname(__FILE__) . '/' . str_replace(array('_', '\0'), array('/', ''), $classname) . '.php';
|
31 |
+
if (is_file($file)) {
|
32 |
require_once $file;
|
33 |
}
|
34 |
}
|
vendor/Rsc/Cache.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
protected $adapter;
|
11 |
|
@@ -21,9 +21,9 @@ class Rsc_Cache
|
|
21 |
|
22 |
/**
|
23 |
* Constructor
|
24 |
-
* @param
|
25 |
*/
|
26 |
-
public function __construct(
|
27 |
{
|
28 |
$this->adapter = $adapter;
|
29 |
}
|
@@ -71,7 +71,7 @@ class Rsc_Cache
|
|
71 |
/**
|
72 |
* Sets the prefix for keys
|
73 |
* @param string $prefix
|
74 |
-
* @return
|
75 |
*/
|
76 |
public function setPrefix($prefix)
|
77 |
{
|
@@ -91,7 +91,7 @@ class Rsc_Cache
|
|
91 |
/**
|
92 |
* Sets the time to life for cached data
|
93 |
* @param int $ttl
|
94 |
-
* @return
|
95 |
*/
|
96 |
public function setTtl($ttl)
|
97 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Cache
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Cache_Interface
|
9 |
*/
|
10 |
protected $adapter;
|
11 |
|
21 |
|
22 |
/**
|
23 |
* Constructor
|
24 |
+
* @param RscDtgs_Cache_Interface $adapter The caching adapter
|
25 |
*/
|
26 |
+
public function __construct(RscDtgs_Cache_Interface $adapter)
|
27 |
{
|
28 |
$this->adapter = $adapter;
|
29 |
}
|
71 |
/**
|
72 |
* Sets the prefix for keys
|
73 |
* @param string $prefix
|
74 |
+
* @return RscDtgs_Cache
|
75 |
*/
|
76 |
public function setPrefix($prefix)
|
77 |
{
|
91 |
/**
|
92 |
* Sets the time to life for cached data
|
93 |
* @param int $ttl
|
94 |
+
* @return RscDtgs_Cache
|
95 |
*/
|
96 |
public function setTtl($ttl)
|
97 |
{
|
vendor/Rsc/Cache/Dummy.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Cache_Dummy implements RscDtgs_Cache_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
vendor/Rsc/Cache/Filesystem.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Cache_Filesystem implements RscDtgs_Cache_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
vendor/Rsc/Cache/Interface.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
interface
|
5 |
{
|
6 |
/**
|
7 |
* Caches data
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
interface RscDtgs_Cache_Interface
|
5 |
{
|
6 |
/**
|
7 |
* Caches data
|
vendor/Rsc/ClassLoader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -22,7 +22,7 @@ class Rsc_ClassLoader
|
|
22 |
* Add vendor prefix to the autoload stack
|
23 |
* @param string $prefix Vendor prefix
|
24 |
* @param string|array $path Classes path
|
25 |
-
* @return
|
26 |
*/
|
27 |
public function add($prefix, $path)
|
28 |
{
|
@@ -38,7 +38,7 @@ class Rsc_ClassLoader
|
|
38 |
/**
|
39 |
* Remove prefixes from the autoload stack
|
40 |
* @param string|array $prefix Vendor prefixes to remove
|
41 |
-
* @return
|
42 |
*/
|
43 |
public function remove($prefix)
|
44 |
{
|
@@ -56,7 +56,7 @@ class Rsc_ClassLoader
|
|
56 |
/**
|
57 |
* Add an array of prefixes to the autoload stack
|
58 |
* @param array $prefixes An array of prefixes
|
59 |
-
* @return
|
60 |
*/
|
61 |
public function addPrefixes(array $prefixes)
|
62 |
{
|
@@ -70,7 +70,7 @@ class Rsc_ClassLoader
|
|
70 |
/**
|
71 |
* Set an array of the vendor prefixes
|
72 |
* @param array $prefixes An array of prefixes
|
73 |
-
* @return
|
74 |
*/
|
75 |
public function setPrefixes(array $prefixes)
|
76 |
{
|
@@ -145,7 +145,7 @@ class Rsc_ClassLoader
|
|
145 |
}
|
146 |
|
147 |
if (stripos($class,'Twig_') !== false) {
|
148 |
-
$className = str_replace('
|
149 |
$classDelimeters = explode('_', $className);
|
150 |
|
151 |
$newName = '';
|
@@ -153,10 +153,10 @@ class Rsc_ClassLoader
|
|
153 |
$newName .= DIRECTORY_SEPARATOR . $classDelimeters[$i];
|
154 |
}
|
155 |
$path .= 'Twig' . $newName . '.php';
|
156 |
-
if ($class == '
|
157 |
$path = DIRECTORY_SEPARATOR.'SupsysticSlider'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Attachment.php';
|
158 |
}
|
159 |
-
if ($class == '
|
160 |
$path = DIRECTORY_SEPARATOR.'SupsysticSliderPro'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Video.php';
|
161 |
}
|
162 |
} else {
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_ClassLoader
|
5 |
{
|
6 |
|
7 |
/**
|
22 |
* Add vendor prefix to the autoload stack
|
23 |
* @param string $prefix Vendor prefix
|
24 |
* @param string|array $path Classes path
|
25 |
+
* @return RscDtgs_ClassLoader
|
26 |
*/
|
27 |
public function add($prefix, $path)
|
28 |
{
|
38 |
/**
|
39 |
* Remove prefixes from the autoload stack
|
40 |
* @param string|array $prefix Vendor prefixes to remove
|
41 |
+
* @return RscDtgs_ClassLoader
|
42 |
*/
|
43 |
public function remove($prefix)
|
44 |
{
|
56 |
/**
|
57 |
* Add an array of prefixes to the autoload stack
|
58 |
* @param array $prefixes An array of prefixes
|
59 |
+
* @return RscDtgs_ClassLoader
|
60 |
*/
|
61 |
public function addPrefixes(array $prefixes)
|
62 |
{
|
70 |
/**
|
71 |
* Set an array of the vendor prefixes
|
72 |
* @param array $prefixes An array of prefixes
|
73 |
+
* @return RscDtgs_ClassLoader
|
74 |
*/
|
75 |
public function setPrefixes(array $prefixes)
|
76 |
{
|
145 |
}
|
146 |
|
147 |
if (stripos($class,'Twig_') !== false) {
|
148 |
+
$className = str_replace('Twig_SupTwgDtgs_', '', $name);
|
149 |
$classDelimeters = explode('_', $className);
|
150 |
|
151 |
$newName = '';
|
153 |
$newName .= DIRECTORY_SEPARATOR . $classDelimeters[$i];
|
154 |
}
|
155 |
$path .= 'Twig' . $newName . '.php';
|
156 |
+
if ($class == 'SupsysticSlider_Slider_Twig_SupTwgDtgs_Attachment') {
|
157 |
$path = DIRECTORY_SEPARATOR.'SupsysticSlider'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Attachment.php';
|
158 |
}
|
159 |
+
if ($class == 'SupsysticSliderPro_Slider_Twig_SupTwgDtgs_Video') {
|
160 |
$path = DIRECTORY_SEPARATOR.'SupsysticSliderPro'.DIRECTORY_SEPARATOR.'Slider'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Video.php';
|
161 |
}
|
162 |
} else {
|
vendor/Rsc/Common/Collection.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/** @var array */
|
@@ -16,6 +16,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
16 |
$this->collection = $collection;
|
17 |
}
|
18 |
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Return data for the key
|
21 |
* @param string $key
|
@@ -64,6 +67,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
64 |
* @param string $key Key to verify
|
65 |
* @return bool TRUE if the key exists, FALSE otherwise
|
66 |
*/
|
|
|
67 |
public function has($key)
|
68 |
{
|
69 |
return isset($this->collection[$key]);
|
@@ -75,6 +79,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
75 |
* @param bool $strict If set TRUE then method use strict check, FALSE means non-strict
|
76 |
* @return bool
|
77 |
*/
|
|
|
78 |
public function hasValue($value, $strict = true)
|
79 |
{
|
80 |
foreach ($this->collection as $collectionValue) {
|
@@ -96,6 +101,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
96 |
* Returns all items in the collection
|
97 |
* @return array
|
98 |
*/
|
|
|
99 |
public function all()
|
100 |
{
|
101 |
return $this->collection;
|
@@ -105,8 +111,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
105 |
* Adds a new item to the collection
|
106 |
* @param string $key Key to add
|
107 |
* @param mixed $value Value of the element
|
108 |
-
* @return
|
109 |
*/
|
|
|
110 |
public function add($key, $value)
|
111 |
{
|
112 |
if (!$this->has($key)) {
|
@@ -120,8 +127,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
120 |
* Change the value of an existing key
|
121 |
* @param string $key The key to be edited
|
122 |
* @param mixed $value The new value
|
123 |
-
* @return
|
124 |
*/
|
|
|
125 |
public function set($key, $value)
|
126 |
{
|
127 |
if ($this->has($key)) {
|
@@ -137,6 +145,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
137 |
* @param mixed $default Value that returns method if the specified key is not in the collection
|
138 |
* @return mixed
|
139 |
*/
|
|
|
140 |
public function get($key, $default = null)
|
141 |
{
|
142 |
if (is_array($key)) {
|
@@ -155,6 +164,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
155 |
* @param string $key Name of the key to be deleted
|
156 |
* @return bool TRUE if the key exists and removed, FALSE otherwise
|
157 |
*/
|
|
|
158 |
public function delete($key)
|
159 |
{
|
160 |
if ($this->has($key)) {
|
@@ -168,8 +178,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
168 |
/**
|
169 |
* Change the current collection to the specified
|
170 |
* @param array $collection Array elements of the new collection
|
171 |
-
* @return
|
172 |
*/
|
|
|
173 |
public function replace(array $collection)
|
174 |
{
|
175 |
$this->collection = $collection;
|
@@ -180,8 +191,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
180 |
/**
|
181 |
* Merge the specified array with the current collection
|
182 |
* @param array $collection Array elements
|
183 |
-
* @return
|
184 |
*/
|
|
|
185 |
public function merge(array $collection)
|
186 |
{
|
187 |
$this->collection = array_merge($this->collection, $collection);
|
@@ -192,8 +204,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
192 |
/**
|
193 |
* Applies the callback to the elements of the collection
|
194 |
* @param callable $callback Callback function to run for each element in the collection
|
195 |
-
* @return
|
196 |
*/
|
|
|
197 |
public function map(Callable $callback)
|
198 |
{
|
199 |
$this->collection = array_map($callback, $this->collection);
|
@@ -205,6 +218,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
205 |
* Returns collection keys
|
206 |
* @return array
|
207 |
*/
|
|
|
208 |
public function getKeys()
|
209 |
{
|
210 |
return array_keys($this->collection);
|
@@ -214,6 +228,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
214 |
* Returns collection values
|
215 |
* @return array
|
216 |
*/
|
|
|
217 |
public function getValues()
|
218 |
{
|
219 |
return array_values($this->collection);
|
@@ -223,6 +238,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
223 |
* Checks whether the collection is empty
|
224 |
* @return bool
|
225 |
*/
|
|
|
226 |
public function isEmpty()
|
227 |
{
|
228 |
return (count($this->collection) < 1);
|
@@ -235,6 +251,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
235 |
* @return Traversable An instance of an object implementing <b>Iterator</b> or
|
236 |
* <b>Traversable</b>
|
237 |
*/
|
|
|
238 |
public function getIterator()
|
239 |
{
|
240 |
return new ArrayIterator($this->collection);
|
@@ -246,6 +263,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
246 |
* @link http://php.net/manual/en/serializable.serialize.php
|
247 |
* @return string the string representation of the object or null
|
248 |
*/
|
|
|
249 |
public function serialize()
|
250 |
{
|
251 |
return serialize($this->collection);
|
@@ -260,6 +278,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
260 |
* </p>
|
261 |
* @return void
|
262 |
*/
|
|
|
263 |
public function unserialize($serialized)
|
264 |
{
|
265 |
$this->collection = unserialize($serialized);
|
@@ -274,6 +293,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
274 |
* <p>
|
275 |
* The return value is cast to an integer.
|
276 |
*/
|
|
|
277 |
public function count()
|
278 |
{
|
279 |
return count($this->collection);
|
@@ -291,6 +311,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
291 |
* <p>
|
292 |
* The return value will be casted to boolean if non-boolean was returned.
|
293 |
*/
|
|
|
294 |
public function offsetExists($offset)
|
295 |
{
|
296 |
return $this->has($offset);
|
@@ -305,6 +326,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
305 |
* </p>
|
306 |
* @return mixed Can return all value types.
|
307 |
*/
|
|
|
308 |
public function offsetGet($offset)
|
309 |
{
|
310 |
return $this->get($offset, null);
|
@@ -322,6 +344,7 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
322 |
* </p>
|
323 |
* @return void
|
324 |
*/
|
|
|
325 |
public function offsetSet($offset, $value)
|
326 |
{
|
327 |
if (is_null($offset)) {
|
@@ -340,8 +363,9 @@ class Rsc_Common_Collection implements Countable, IteratorAggregate, Serializabl
|
|
340 |
* </p>
|
341 |
* @return void
|
342 |
*/
|
|
|
343 |
public function offsetUnset($offset)
|
344 |
{
|
345 |
$this->delete($offset);
|
346 |
}
|
347 |
-
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Common_Collection implements Countable, IteratorAggregate, Serializable, ArrayAccess
|
5 |
{
|
6 |
|
7 |
/** @var array */
|
16 |
$this->collection = $collection;
|
17 |
}
|
18 |
|
19 |
+
public function __serialize(): array {}
|
20 |
+
public function __unserialize(array $data): void {}
|
21 |
+
|
22 |
/**
|
23 |
* Return data for the key
|
24 |
* @param string $key
|
67 |
* @param string $key Key to verify
|
68 |
* @return bool TRUE if the key exists, FALSE otherwise
|
69 |
*/
|
70 |
+
#[\ReturnTypeWillChange]
|
71 |
public function has($key)
|
72 |
{
|
73 |
return isset($this->collection[$key]);
|
79 |
* @param bool $strict If set TRUE then method use strict check, FALSE means non-strict
|
80 |
* @return bool
|
81 |
*/
|
82 |
+
#[\ReturnTypeWillChange]
|
83 |
public function hasValue($value, $strict = true)
|
84 |
{
|
85 |
foreach ($this->collection as $collectionValue) {
|
101 |
* Returns all items in the collection
|
102 |
* @return array
|
103 |
*/
|
104 |
+
#[\ReturnTypeWillChange]
|
105 |
public function all()
|
106 |
{
|
107 |
return $this->collection;
|
111 |
* Adds a new item to the collection
|
112 |
* @param string $key Key to add
|
113 |
* @param mixed $value Value of the element
|
114 |
+
* @return RscDtgs_Common_Collection
|
115 |
*/
|
116 |
+
#[\ReturnTypeWillChange]
|
117 |
public function add($key, $value)
|
118 |
{
|
119 |
if (!$this->has($key)) {
|
127 |
* Change the value of an existing key
|
128 |
* @param string $key The key to be edited
|
129 |
* @param mixed $value The new value
|
130 |
+
* @return RscDtgs_Common_Collection
|
131 |
*/
|
132 |
+
#[\ReturnTypeWillChange]
|
133 |
public function set($key, $value)
|
134 |
{
|
135 |
if ($this->has($key)) {
|
145 |
* @param mixed $default Value that returns method if the specified key is not in the collection
|
146 |
* @return mixed
|
147 |
*/
|
148 |
+
#[\ReturnTypeWillChange]
|
149 |
public function get($key, $default = null)
|
150 |
{
|
151 |
if (is_array($key)) {
|
164 |
* @param string $key Name of the key to be deleted
|
165 |
* @return bool TRUE if the key exists and removed, FALSE otherwise
|
166 |
*/
|
167 |
+
#[\ReturnTypeWillChange]
|
168 |
public function delete($key)
|
169 |
{
|
170 |
if ($this->has($key)) {
|
178 |
/**
|
179 |
* Change the current collection to the specified
|
180 |
* @param array $collection Array elements of the new collection
|
181 |
+
* @return RscDtgs_Common_Collection
|
182 |
*/
|
183 |
+
#[\ReturnTypeWillChange]
|
184 |
public function replace(array $collection)
|
185 |
{
|
186 |
$this->collection = $collection;
|
191 |
/**
|
192 |
* Merge the specified array with the current collection
|
193 |
* @param array $collection Array elements
|
194 |
+
* @return RscDtgs_Common_Collection
|
195 |
*/
|
196 |
+
#[\ReturnTypeWillChange]
|
197 |
public function merge(array $collection)
|
198 |
{
|
199 |
$this->collection = array_merge($this->collection, $collection);
|
204 |
/**
|
205 |
* Applies the callback to the elements of the collection
|
206 |
* @param callable $callback Callback function to run for each element in the collection
|
207 |
+
* @return RscDtgs_Common_Collection
|
208 |
*/
|
209 |
+
#[\ReturnTypeWillChange]
|
210 |
public function map(Callable $callback)
|
211 |
{
|
212 |
$this->collection = array_map($callback, $this->collection);
|
218 |
* Returns collection keys
|
219 |
* @return array
|
220 |
*/
|
221 |
+
#[\ReturnTypeWillChange]
|
222 |
public function getKeys()
|
223 |
{
|
224 |
return array_keys($this->collection);
|
228 |
* Returns collection values
|
229 |
* @return array
|
230 |
*/
|
231 |
+
#[\ReturnTypeWillChange]
|
232 |
public function getValues()
|
233 |
{
|
234 |
return array_values($this->collection);
|
238 |
* Checks whether the collection is empty
|
239 |
* @return bool
|
240 |
*/
|
241 |
+
#[\ReturnTypeWillChange]
|
242 |
public function isEmpty()
|
243 |
{
|
244 |
return (count($this->collection) < 1);
|
251 |
* @return Traversable An instance of an object implementing <b>Iterator</b> or
|
252 |
* <b>Traversable</b>
|
253 |
*/
|
254 |
+
#[\ReturnTypeWillChange]
|
255 |
public function getIterator()
|
256 |
{
|
257 |
return new ArrayIterator($this->collection);
|
263 |
* @link http://php.net/manual/en/serializable.serialize.php
|
264 |
* @return string the string representation of the object or null
|
265 |
*/
|
266 |
+
#[\ReturnTypeWillChange]
|
267 |
public function serialize()
|
268 |
{
|
269 |
return serialize($this->collection);
|
278 |
* </p>
|
279 |
* @return void
|
280 |
*/
|
281 |
+
#[\ReturnTypeWillChange]
|
282 |
public function unserialize($serialized)
|
283 |
{
|
284 |
$this->collection = unserialize($serialized);
|
293 |
* <p>
|
294 |
* The return value is cast to an integer.
|
295 |
*/
|
296 |
+
#[\ReturnTypeWillChange]
|
297 |
public function count()
|
298 |
{
|
299 |
return count($this->collection);
|
311 |
* <p>
|
312 |
* The return value will be casted to boolean if non-boolean was returned.
|
313 |
*/
|
314 |
+
#[\ReturnTypeWillChange]
|
315 |
public function offsetExists($offset)
|
316 |
{
|
317 |
return $this->has($offset);
|
326 |
* </p>
|
327 |
* @return mixed Can return all value types.
|
328 |
*/
|
329 |
+
#[\ReturnTypeWillChange]
|
330 |
public function offsetGet($offset)
|
331 |
{
|
332 |
return $this->get($offset, null);
|
344 |
* </p>
|
345 |
* @return void
|
346 |
*/
|
347 |
+
#[\ReturnTypeWillChange]
|
348 |
public function offsetSet($offset, $value)
|
349 |
{
|
350 |
if (is_null($offset)) {
|
363 |
* </p>
|
364 |
* @return void
|
365 |
*/
|
366 |
+
#[\ReturnTypeWillChange]
|
367 |
public function offsetUnset($offset)
|
368 |
{
|
369 |
$this->delete($offset);
|
370 |
}
|
371 |
+
}
|
vendor/Rsc/Config.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
protected $loader;
|
11 |
|
12 |
/**
|
13 |
-
* @var
|
14 |
*/
|
15 |
protected $listener;
|
16 |
|
@@ -22,7 +22,7 @@ class Rsc_Config extends Rsc_Common_Collection
|
|
22 |
{
|
23 |
parent::__construct($config);
|
24 |
|
25 |
-
$this->loader = new
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -55,8 +55,8 @@ class Rsc_Config extends Rsc_Common_Collection
|
|
55 |
try {
|
56 |
$this->merge($this->loader->load($filename));
|
57 |
return true;
|
58 |
-
} catch(
|
59 |
-
if ($this->isEnvironment(
|
60 |
wp_die ($e->getMessage());
|
61 |
}
|
62 |
|
@@ -66,7 +66,7 @@ class Rsc_Config extends Rsc_Common_Collection
|
|
66 |
|
67 |
/**
|
68 |
* Returns the instance of the config loader
|
69 |
-
* @return
|
70 |
*/
|
71 |
public function getLoader()
|
72 |
{
|
@@ -76,10 +76,10 @@ class Rsc_Config extends Rsc_Common_Collection
|
|
76 |
/**
|
77 |
* Adds the listener
|
78 |
* @param string $name The unique name of the listener
|
79 |
-
* @param
|
80 |
-
* @return
|
81 |
*/
|
82 |
-
public function addListener($name,
|
83 |
{
|
84 |
$this->listener[$name] = $listener;
|
85 |
return $this;
|
@@ -156,6 +156,6 @@ class Rsc_Config extends Rsc_Common_Collection
|
|
156 |
{
|
157 |
$loader = $this->getLoader();
|
158 |
|
159 |
-
$loader->add($defaultPath,
|
160 |
}
|
161 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Config extends RscDtgs_Common_Collection
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Config_Loader
|
9 |
*/
|
10 |
protected $loader;
|
11 |
|
12 |
/**
|
13 |
+
* @var RscDtgs_Config_ListenerInterface[]
|
14 |
*/
|
15 |
protected $listener;
|
16 |
|
22 |
{
|
23 |
parent::__construct($config);
|
24 |
|
25 |
+
$this->loader = new RscDtgs_Config_Loader();
|
26 |
}
|
27 |
|
28 |
/**
|
55 |
try {
|
56 |
$this->merge($this->loader->load($filename));
|
57 |
return true;
|
58 |
+
} catch(RscDtgs_Exception_ConfigLoaderException $e) {
|
59 |
+
if ($this->isEnvironment(RscDtgs_Environment::ENV_DEVELOPMENT)) {
|
60 |
wp_die ($e->getMessage());
|
61 |
}
|
62 |
|
66 |
|
67 |
/**
|
68 |
* Returns the instance of the config loader
|
69 |
+
* @return RscDtgs_Config_Loader
|
70 |
*/
|
71 |
public function getLoader()
|
72 |
{
|
76 |
/**
|
77 |
* Adds the listener
|
78 |
* @param string $name The unique name of the listener
|
79 |
+
* @param RscDtgs_Config_ListenerInterface $listener
|
80 |
+
* @return RscDtgs_Config
|
81 |
*/
|
82 |
+
public function addListener($name, RscDtgs_Config_ListenerInterface $listener)
|
83 |
{
|
84 |
$this->listener[$name] = $listener;
|
85 |
return $this;
|
156 |
{
|
157 |
$loader = $this->getLoader();
|
158 |
|
159 |
+
$loader->add($defaultPath, RscDtgs_Config_Loader::DEFAULT_NAMESPACE);
|
160 |
}
|
161 |
}
|
vendor/Rsc/Config/ListenerInterface.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
interface
|
5 |
{
|
6 |
|
7 |
public function onAdd($key, $value);
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
interface RscDtgs_Config_ListenerInterface
|
5 |
{
|
6 |
|
7 |
public function onAdd($key, $value);
|
vendor/Rsc/Config/Loader.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
const DEFAULT_NAMESPACE = 'app';
|
@@ -15,7 +15,7 @@ class Rsc_Config_Loader
|
|
15 |
* Adds
|
16 |
* @param string $path
|
17 |
* @param string $namespace
|
18 |
-
* @return
|
19 |
*/
|
20 |
public function add($path, $namespace = self::DEFAULT_NAMESPACE)
|
21 |
{
|
@@ -53,7 +53,7 @@ class Rsc_Config_Loader
|
|
53 |
/**
|
54 |
* @param string $file The full path to the file
|
55 |
* @return array
|
56 |
-
* @throws
|
57 |
*/
|
58 |
public function load($file)
|
59 |
{
|
@@ -64,7 +64,7 @@ class Rsc_Config_Loader
|
|
64 |
try {
|
65 |
return $this->loadFromNamespace($file);
|
66 |
} catch (Exception $e) {
|
67 |
-
throw new
|
68 |
'Unable to load config %s: %s',
|
69 |
$file,
|
70 |
$e->getMessage()
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Config_Loader
|
5 |
{
|
6 |
|
7 |
const DEFAULT_NAMESPACE = 'app';
|
15 |
* Adds
|
16 |
* @param string $path
|
17 |
* @param string $namespace
|
18 |
+
* @return RscDtgs_Config_Loader
|
19 |
*/
|
20 |
public function add($path, $namespace = self::DEFAULT_NAMESPACE)
|
21 |
{
|
53 |
/**
|
54 |
* @param string $file The full path to the file
|
55 |
* @return array
|
56 |
+
* @throws RscDtgs_Exception_ConfigLoaderException
|
57 |
*/
|
58 |
public function load($file)
|
59 |
{
|
64 |
try {
|
65 |
return $this->loadFromNamespace($file);
|
66 |
} catch (Exception $e) {
|
67 |
+
throw new RscDtgs_Exception_ConfigLoaderException(sprintf(
|
68 |
'Unable to load config %s: %s',
|
69 |
$file,
|
70 |
$e->getMessage()
|
vendor/Rsc/Dispatcher.php
CHANGED
@@ -4,19 +4,19 @@
|
|
4 |
* In-plugin event dispatcher.
|
5 |
* Dispatchers plugin-specific events.
|
6 |
*/
|
7 |
-
class
|
8 |
{
|
9 |
|
10 |
/**
|
11 |
-
* @var
|
12 |
*/
|
13 |
protected $environment;
|
14 |
|
15 |
/**
|
16 |
* Constructor.
|
17 |
-
* @param
|
18 |
*/
|
19 |
-
public function __construct(
|
20 |
{
|
21 |
$this->environment = $environment;
|
22 |
}
|
@@ -31,13 +31,13 @@ class Rsc_Dispatcher
|
|
31 |
* @param int $priority Used to specify the order in which the functions associated with a particular action are executed.
|
32 |
* @param int $args The number of arguments the hooked function accepts.
|
33 |
* @throws InvalidArgumentException
|
34 |
-
* @return
|
35 |
*/
|
36 |
public function on($action, $function, $priority = 10, $args = 1)
|
37 |
{
|
38 |
if (!is_callable($function)) {
|
39 |
throw new InvalidArgumentException(sprintf(
|
40 |
-
'Argument 2 passed to
|
41 |
gettype($function)
|
42 |
));
|
43 |
}
|
@@ -97,14 +97,14 @@ class Rsc_Dispatcher
|
|
97 |
* @param type $function
|
98 |
* @param type $priority
|
99 |
* @param type $args
|
100 |
-
* @return \
|
101 |
* @throws InvalidArgumentException
|
102 |
*/
|
103 |
public function filter($action, $function, $priority = 10, $args = 1)
|
104 |
{
|
105 |
if (!is_callable($function)) {
|
106 |
throw new InvalidArgumentException(sprintf(
|
107 |
-
'Argument 2 passed to
|
108 |
gettype($function)
|
109 |
));
|
110 |
}
|
4 |
* In-plugin event dispatcher.
|
5 |
* Dispatchers plugin-specific events.
|
6 |
*/
|
7 |
+
class RscDtgs_Dispatcher
|
8 |
{
|
9 |
|
10 |
/**
|
11 |
+
* @var RscDtgs_Environment;
|
12 |
*/
|
13 |
protected $environment;
|
14 |
|
15 |
/**
|
16 |
* Constructor.
|
17 |
+
* @param RscDtgs_Environment $environment Plugin environment.
|
18 |
*/
|
19 |
+
public function __construct(RscDtgs_Environment $environment)
|
20 |
{
|
21 |
$this->environment = $environment;
|
22 |
}
|
31 |
* @param int $priority Used to specify the order in which the functions associated with a particular action are executed.
|
32 |
* @param int $args The number of arguments the hooked function accepts.
|
33 |
* @throws InvalidArgumentException
|
34 |
+
* @return RscDtgs_Dispatcher
|
35 |
*/
|
36 |
public function on($action, $function, $priority = 10, $args = 1)
|
37 |
{
|
38 |
if (!is_callable($function)) {
|
39 |
throw new InvalidArgumentException(sprintf(
|
40 |
+
'Argument 2 passed to RscDtgs_Dispatcher::on() must be a callable, %s given.',
|
41 |
gettype($function)
|
42 |
));
|
43 |
}
|
97 |
* @param type $function
|
98 |
* @param type $priority
|
99 |
* @param type $args
|
100 |
+
* @return \RscDtgs_Dispatcher
|
101 |
* @throws InvalidArgumentException
|
102 |
*/
|
103 |
public function filter($action, $function, $priority = 10, $args = 1)
|
104 |
{
|
105 |
if (!is_callable($function)) {
|
106 |
throw new InvalidArgumentException(sprintf(
|
107 |
+
'Argument 2 passed to RscDtgs_Dispatcher::filter() must be a callable, %s given.',
|
108 |
gettype($function)
|
109 |
));
|
110 |
}
|
vendor/Rsc/Environment.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
const ENV_DEVELOPMENT = 'development';
|
@@ -27,42 +27,42 @@ class Rsc_Environment
|
|
27 |
protected $pluginPath;
|
28 |
|
29 |
/**
|
30 |
-
* @var
|
31 |
*/
|
32 |
protected $config;
|
33 |
|
34 |
/**
|
35 |
-
* @var
|
36 |
*/
|
37 |
protected $cache;
|
38 |
|
39 |
/**
|
40 |
-
* @var
|
41 |
*/
|
42 |
protected $loader;
|
43 |
|
44 |
/**
|
45 |
-
* @var
|
46 |
*/
|
47 |
protected $lang;
|
48 |
|
49 |
/**
|
50 |
-
* @var
|
51 |
*/
|
52 |
protected $menu;
|
53 |
|
54 |
/**
|
55 |
-
* @var
|
56 |
*/
|
57 |
protected $resolver;
|
58 |
|
59 |
/**
|
60 |
-
* @var
|
61 |
*/
|
62 |
protected $twig;
|
63 |
|
64 |
/**
|
65 |
-
* @var
|
66 |
*/
|
67 |
protected $logger;
|
68 |
|
@@ -72,7 +72,7 @@ class Rsc_Environment
|
|
72 |
protected $profilerEnabled;
|
73 |
|
74 |
/**
|
75 |
-
* @var
|
76 |
*/
|
77 |
protected $dispatcher;
|
78 |
|
@@ -92,13 +92,13 @@ class Rsc_Environment
|
|
92 |
$this->pluginPath = $path;
|
93 |
|
94 |
/* Class loader */
|
95 |
-
$this->loader = new
|
96 |
|
97 |
/* Modules resolver */
|
98 |
-
$this->resolver = new
|
99 |
|
100 |
/* Config */
|
101 |
-
$this->config = new
|
102 |
$this->config->setDefaultPath(untrailingslashit($path) . '/app/configs');
|
103 |
try {
|
104 |
$this->config->load('@app/global.php');
|
@@ -109,7 +109,7 @@ class Rsc_Environment
|
|
109 |
$this->config->add('plugin_path', $path);
|
110 |
|
111 |
/* Dispatcher */
|
112 |
-
$this->dispatcher = new
|
113 |
|
114 |
add_action('init', array($this, 'wpInitCallback'));
|
115 |
}
|
@@ -125,7 +125,7 @@ class Rsc_Environment
|
|
125 |
/**
|
126 |
* Configure plugin environment
|
127 |
* @param array $parameters An associative array with the parameters
|
128 |
-
* @return
|
129 |
*/
|
130 |
public function configure(array $parameters)
|
131 |
{
|
@@ -168,8 +168,8 @@ class Rsc_Environment
|
|
168 |
try {
|
169 |
$templatesPath = $this->getPluginPath() . '/app/templates';
|
170 |
|
171 |
-
$this->twig = new
|
172 |
-
new
|
173 |
array(
|
174 |
'cache' => $this->config->get('plugin_cache_twig', false),
|
175 |
'debug' => $this->isDev(),
|
@@ -178,9 +178,9 @@ class Rsc_Environment
|
|
178 |
|
179 |
|
180 |
if ($this->isDev()) {
|
181 |
-
$this->twig->addExtension(new
|
182 |
}
|
183 |
-
} catch (
|
184 |
wp_die(
|
185 |
sprintf('Invalid plugin path specified: "%s"', $e->getMessage())
|
186 |
);
|
@@ -190,7 +190,7 @@ class Rsc_Environment
|
|
190 |
|
191 |
/** @TODO THROW TRY CATCH */
|
192 |
if ($this->config->has('plugin_menu')) {
|
193 |
-
$this->menu = new
|
194 |
|
195 |
foreach ($parameters = $this->config->get('plugin_menu') as $key => $value) {
|
196 |
if (method_exists($this->menu, $method = sprintf('set%s', str_replace('_', '', $key)))) {
|
@@ -207,7 +207,7 @@ class Rsc_Environment
|
|
207 |
}
|
208 |
|
209 |
$this->twig->addGlobal('environment', $this);
|
210 |
-
$this->twig->addGlobal('request', new
|
211 |
|
212 |
$this->resolver = apply_filters(
|
213 |
sprintf('%s_before_resolver_register', $this->pluginName),
|
@@ -259,7 +259,7 @@ class Rsc_Environment
|
|
259 |
|
260 |
/**
|
261 |
* Returns an instance of the Twig
|
262 |
-
* @return
|
263 |
*/
|
264 |
public function getTwig()
|
265 |
{
|
@@ -268,7 +268,7 @@ class Rsc_Environment
|
|
268 |
|
269 |
/**
|
270 |
* Returns an instance of the language class
|
271 |
-
* @return
|
272 |
*/
|
273 |
public function getLang()
|
274 |
{
|
@@ -287,7 +287,7 @@ class Rsc_Environment
|
|
287 |
$this->config->add('lang_path', $path);
|
288 |
}
|
289 |
|
290 |
-
$this->lang = new
|
291 |
}
|
292 |
|
293 |
return $this->lang;
|
@@ -295,7 +295,7 @@ class Rsc_Environment
|
|
295 |
|
296 |
/**
|
297 |
* Returns plugin environment configurations
|
298 |
-
* @return
|
299 |
*/
|
300 |
public function getConfig()
|
301 |
{
|
@@ -304,7 +304,7 @@ class Rsc_Environment
|
|
304 |
|
305 |
/**
|
306 |
* Returns an instance of the caching class
|
307 |
-
* @return
|
308 |
*/
|
309 |
public function getCache()
|
310 |
{
|
@@ -313,7 +313,7 @@ class Rsc_Environment
|
|
313 |
|
314 |
/**
|
315 |
* Returns ClassLoader
|
316 |
-
* @return
|
317 |
*/
|
318 |
public function getLoader()
|
319 |
{
|
@@ -322,7 +322,7 @@ class Rsc_Environment
|
|
322 |
|
323 |
/**
|
324 |
* Returns an instance of the current menu page
|
325 |
-
* @return \
|
326 |
*/
|
327 |
public function getMenu()
|
328 |
{
|
@@ -331,7 +331,7 @@ class Rsc_Environment
|
|
331 |
|
332 |
/**
|
333 |
* Returns an instance of the modules resolver
|
334 |
-
* @return
|
335 |
*/
|
336 |
public function getResolver()
|
337 |
{
|
@@ -339,17 +339,17 @@ class Rsc_Environment
|
|
339 |
}
|
340 |
|
341 |
/**
|
342 |
-
* @param \
|
343 |
-
* @return
|
344 |
*/
|
345 |
-
public function setLogger(
|
346 |
{
|
347 |
$this->logger = $logger;
|
348 |
return $this;
|
349 |
}
|
350 |
|
351 |
/**
|
352 |
-
* @return \
|
353 |
*/
|
354 |
public function getLogger()
|
355 |
{
|
@@ -402,27 +402,17 @@ class Rsc_Environment
|
|
402 |
}
|
403 |
public function getNonceFrontend()
|
404 |
{
|
405 |
-
|
406 |
-
if ($pluginName === 'sss') {
|
407 |
-
return wp_create_nonce('ssbs_nonce_frontend');
|
408 |
-
} else {
|
409 |
-
return wp_create_nonce('dtgs_nonce_frontend');
|
410 |
-
}
|
411 |
}
|
412 |
public function getNonce()
|
413 |
{
|
414 |
-
|
415 |
-
if ($pluginName === 'sss') {
|
416 |
-
return wp_create_nonce('ssbs_nonce');
|
417 |
-
} else {
|
418 |
-
return wp_create_nonce('dtgs_nonce');
|
419 |
-
}
|
420 |
}
|
421 |
|
422 |
/**
|
423 |
* Returns an instance of the specified module
|
424 |
* @param string $module The name of the module
|
425 |
-
* @return
|
426 |
*/
|
427 |
public function getModule($module)
|
428 |
{
|
@@ -441,19 +431,19 @@ class Rsc_Environment
|
|
441 |
|
442 |
/**
|
443 |
* Set an instance of the caching class
|
444 |
-
* @param
|
445 |
-
* @return
|
446 |
*/
|
447 |
-
public function setCacheAdapter(
|
448 |
{
|
449 |
-
$this->cache = new
|
450 |
return $this;
|
451 |
}
|
452 |
|
453 |
/**
|
454 |
* Set profiler state
|
455 |
* @param boolean $profilerEnabled
|
456 |
-
* @return
|
457 |
*/
|
458 |
public function setProfilerEnabled($profilerEnabled)
|
459 |
{
|
@@ -508,7 +498,7 @@ class Rsc_Environment
|
|
508 |
*/
|
509 |
public function isPluginPage()
|
510 |
{
|
511 |
-
$request = new
|
512 |
$menuSlug = $this->menu->getMenuSlug();
|
513 |
|
514 |
if ($menuSlug === null) {
|
@@ -527,7 +517,7 @@ class Rsc_Environment
|
|
527 |
*/
|
528 |
public function isModule($module, $action = null)
|
529 |
{
|
530 |
-
$request = new
|
531 |
$default = $this->config->get('default_module');
|
532 |
|
533 |
if (!$this->isPluginPage()) {
|
@@ -551,7 +541,7 @@ class Rsc_Environment
|
|
551 |
*/
|
552 |
public function isAction($action)
|
553 |
{
|
554 |
-
$request = new
|
555 |
|
556 |
if (!$this->isPluginPage()) {
|
557 |
return false;
|
@@ -573,7 +563,7 @@ class Rsc_Environment
|
|
573 |
/**
|
574 |
* Returns event dispatcher
|
575 |
*
|
576 |
-
* @return \
|
577 |
*/
|
578 |
public function getDispatcher()
|
579 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Environment
|
5 |
{
|
6 |
|
7 |
const ENV_DEVELOPMENT = 'development';
|
27 |
protected $pluginPath;
|
28 |
|
29 |
/**
|
30 |
+
* @var RscDtgs_Config
|
31 |
*/
|
32 |
protected $config;
|
33 |
|
34 |
/**
|
35 |
+
* @var RscDtgs_Cache
|
36 |
*/
|
37 |
protected $cache;
|
38 |
|
39 |
/**
|
40 |
+
* @var RscDtgs_ClassLoader
|
41 |
*/
|
42 |
protected $loader;
|
43 |
|
44 |
/**
|
45 |
+
* @var RscDtgs_Lang
|
46 |
*/
|
47 |
protected $lang;
|
48 |
|
49 |
/**
|
50 |
+
* @var RscDtgs_Menu_Page
|
51 |
*/
|
52 |
protected $menu;
|
53 |
|
54 |
/**
|
55 |
+
* @var RscDtgs_Resolver
|
56 |
*/
|
57 |
protected $resolver;
|
58 |
|
59 |
/**
|
60 |
+
* @var Twig_SupTwgDtgs_Environment
|
61 |
*/
|
62 |
protected $twig;
|
63 |
|
64 |
/**
|
65 |
+
* @var RscDtgs_Logger_Interface
|
66 |
*/
|
67 |
protected $logger;
|
68 |
|
72 |
protected $profilerEnabled;
|
73 |
|
74 |
/**
|
75 |
+
* @var RscDtgs_Dispatcher
|
76 |
*/
|
77 |
protected $dispatcher;
|
78 |
|
92 |
$this->pluginPath = $path;
|
93 |
|
94 |
/* Class loader */
|
95 |
+
$this->loader = new RscDtgs_ClassLoader();
|
96 |
|
97 |
/* Modules resolver */
|
98 |
+
$this->resolver = new RscDtgs_Resolver($this);
|
99 |
|
100 |
/* Config */
|
101 |
+
$this->config = new RscDtgs_Config($this->defaults);
|
102 |
$this->config->setDefaultPath(untrailingslashit($path) . '/app/configs');
|
103 |
try {
|
104 |
$this->config->load('@app/global.php');
|
109 |
$this->config->add('plugin_path', $path);
|
110 |
|
111 |
/* Dispatcher */
|
112 |
+
$this->dispatcher = new RscDtgs_Dispatcher($this);
|
113 |
|
114 |
add_action('init', array($this, 'wpInitCallback'));
|
115 |
}
|
125 |
/**
|
126 |
* Configure plugin environment
|
127 |
* @param array $parameters An associative array with the parameters
|
128 |
+
* @return RscDtgs_Environment
|
129 |
*/
|
130 |
public function configure(array $parameters)
|
131 |
{
|
168 |
try {
|
169 |
$templatesPath = $this->getPluginPath() . '/app/templates';
|
170 |
|
171 |
+
$this->twig = new Twig_SupTwgDtgs_Environment(
|
172 |
+
new Twig_SupTwgDtgs_Loader_Filesystem($templatesPath),
|
173 |
array(
|
174 |
'cache' => $this->config->get('plugin_cache_twig', false),
|
175 |
'debug' => $this->isDev(),
|
178 |
|
179 |
|
180 |
if ($this->isDev()) {
|
181 |
+
$this->twig->addExtension(new Twig_SupTwgDtgs_Extension_Debug());
|
182 |
}
|
183 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
184 |
wp_die(
|
185 |
sprintf('Invalid plugin path specified: "%s"', $e->getMessage())
|
186 |
);
|
190 |
|
191 |
/** @TODO THROW TRY CATCH */
|
192 |
if ($this->config->has('plugin_menu')) {
|
193 |
+
$this->menu = new RscDtgs_Menu_Page($this->resolver);
|
194 |
|
195 |
foreach ($parameters = $this->config->get('plugin_menu') as $key => $value) {
|
196 |
if (method_exists($this->menu, $method = sprintf('set%s', str_replace('_', '', $key)))) {
|
207 |
}
|
208 |
|
209 |
$this->twig->addGlobal('environment', $this);
|
210 |
+
$this->twig->addGlobal('request', new RscDtgs_Http_Request());
|
211 |
|
212 |
$this->resolver = apply_filters(
|
213 |
sprintf('%s_before_resolver_register', $this->pluginName),
|
259 |
|
260 |
/**
|
261 |
* Returns an instance of the Twig
|
262 |
+
* @return Twig_SupTwgDtgs_Environment
|
263 |
*/
|
264 |
public function getTwig()
|
265 |
{
|
268 |
|
269 |
/**
|
270 |
* Returns an instance of the language class
|
271 |
+
* @return RscDtgs_Lang
|
272 |
*/
|
273 |
public function getLang()
|
274 |
{
|
287 |
$this->config->add('lang_path', $path);
|
288 |
}
|
289 |
|
290 |
+
$this->lang = new RscDtgs_Lang($domain, $path);
|
291 |
}
|
292 |
|
293 |
return $this->lang;
|
295 |
|
296 |
/**
|
297 |
* Returns plugin environment configurations
|
298 |
+
* @return RscDtgs_Config
|
299 |
*/
|
300 |
public function getConfig()
|
301 |
{
|
304 |
|
305 |
/**
|
306 |
* Returns an instance of the caching class
|
307 |
+
* @return RscDtgs_Cache
|
308 |
*/
|
309 |
public function getCache()
|
310 |
{
|
313 |
|
314 |
/**
|
315 |
* Returns ClassLoader
|
316 |
+
* @return RscDtgs_ClassLoader
|
317 |
*/
|
318 |
public function getLoader()
|
319 |
{
|
322 |
|
323 |
/**
|
324 |
* Returns an instance of the current menu page
|
325 |
+
* @return \RscDtgs_Menu_Page
|
326 |
*/
|
327 |
public function getMenu()
|
328 |
{
|
331 |
|
332 |
/**
|
333 |
* Returns an instance of the modules resolver
|
334 |
+
* @return RscDtgs_Resolver
|
335 |
*/
|
336 |
public function getResolver()
|
337 |
{
|
339 |
}
|
340 |
|
341 |
/**
|
342 |
+
* @param \RscDtgs_Logger_Interface $logger
|
343 |
+
* @return RscDtgs_Environment
|
344 |
*/
|
345 |
+
public function setLogger(RscDtgs_Logger_Interface $logger)
|
346 |
{
|
347 |
$this->logger = $logger;
|
348 |
return $this;
|
349 |
}
|
350 |
|
351 |
/**
|
352 |
+
* @return \RscDtgs_Logger_Interface
|
353 |
*/
|
354 |
public function getLogger()
|
355 |
{
|
402 |
}
|
403 |
public function getNonceFrontend()
|
404 |
{
|
405 |
+
return wp_create_nonce('dtgs_nonce_frontend');
|
|
|
|
|
|
|
|
|
|
|
406 |
}
|
407 |
public function getNonce()
|
408 |
{
|
409 |
+
return wp_create_nonce('dtgs_nonce');
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
|
412 |
/**
|
413 |
* Returns an instance of the specified module
|
414 |
* @param string $module The name of the module
|
415 |
+
* @return RscDtgs_Mvc_Module|null
|
416 |
*/
|
417 |
public function getModule($module)
|
418 |
{
|
431 |
|
432 |
/**
|
433 |
* Set an instance of the caching class
|
434 |
+
* @param RscDtgs_Cache_Interface $adapter
|
435 |
+
* @return RscDtgs_Environment
|
436 |
*/
|
437 |
+
public function setCacheAdapter(RscDtgs_Cache_Interface $adapter)
|
438 |
{
|
439 |
+
$this->cache = new RscDtgs_Cache($adapter);
|
440 |
return $this;
|
441 |
}
|
442 |
|
443 |
/**
|
444 |
* Set profiler state
|
445 |
* @param boolean $profilerEnabled
|
446 |
+
* @return RscDtgs_Environment
|
447 |
*/
|
448 |
public function setProfilerEnabled($profilerEnabled)
|
449 |
{
|
498 |
*/
|
499 |
public function isPluginPage()
|
500 |
{
|
501 |
+
$request = new RscDtgs_Http_Request();
|
502 |
$menuSlug = $this->menu->getMenuSlug();
|
503 |
|
504 |
if ($menuSlug === null) {
|
517 |
*/
|
518 |
public function isModule($module, $action = null)
|
519 |
{
|
520 |
+
$request = new RscDtgs_Http_Request();
|
521 |
$default = $this->config->get('default_module');
|
522 |
|
523 |
if (!$this->isPluginPage()) {
|
541 |
*/
|
542 |
public function isAction($action)
|
543 |
{
|
544 |
+
$request = new RscDtgs_Http_Request();
|
545 |
|
546 |
if (!$this->isPluginPage()) {
|
547 |
return false;
|
563 |
/**
|
564 |
* Returns event dispatcher
|
565 |
*
|
566 |
+
* @return \RscDtgs_Dispatcher
|
567 |
*/
|
568 |
public function getDispatcher()
|
569 |
{
|
vendor/Rsc/Environment/Aware.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
protected $environment;
|
11 |
|
12 |
/**
|
13 |
* Sets the environment.
|
14 |
*
|
15 |
-
* @param
|
16 |
*/
|
17 |
-
public function setEnvironment(
|
18 |
{
|
19 |
$this->environment = $environment;
|
20 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Environment_Aware implements RscDtgs_Environment_AwareInterface
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Environment
|
9 |
*/
|
10 |
protected $environment;
|
11 |
|
12 |
/**
|
13 |
* Sets the environment.
|
14 |
*
|
15 |
+
* @param RscDtgs_Environment $environment
|
16 |
*/
|
17 |
+
public function setEnvironment(RscDtgs_Environment $environment)
|
18 |
{
|
19 |
$this->environment = $environment;
|
20 |
}
|
vendor/Rsc/Environment/AwareInterface.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
interface
|
4 |
{
|
5 |
|
6 |
/**
|
7 |
* Sets the environment.
|
8 |
-
* @param
|
9 |
*/
|
10 |
-
public function setEnvironment(
|
11 |
}
|
1 |
<?php
|
2 |
|
3 |
+
interface RscDtgs_Environment_AwareInterface
|
4 |
{
|
5 |
|
6 |
/**
|
7 |
* Sets the environment.
|
8 |
+
* @param RscDtgs_Environment $environment
|
9 |
*/
|
10 |
+
public function setEnvironment(RscDtgs_Environment $environment);
|
11 |
}
|
vendor/Rsc/Exception/ConfigLoaderException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Exception_ConfigLoaderException extends RuntimeException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Exception/EnvironmentRuntimeException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Exception_EnvironmentRuntimeException extends RuntimeException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Exception/LangException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Exception_LangException extends InvalidArgumentException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Feedback/Mailer.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
/**
|
7 |
* @var array
|
@@ -66,7 +66,7 @@ class Rsc_Feedback_Mailer
|
|
66 |
*
|
67 |
* @param array $headers
|
68 |
* @throws InvalidArgumentException If the headers is not an array or not a string
|
69 |
-
* @return
|
70 |
*/
|
71 |
public function setHeaders(array $headers)
|
72 |
{
|
@@ -94,7 +94,7 @@ class Rsc_Feedback_Mailer
|
|
94 |
* Sets the attachments
|
95 |
*
|
96 |
* @param array $attachments
|
97 |
-
* @return
|
98 |
* @throws InvalidArgumentException If the attachments is not an array or not a string
|
99 |
*/
|
100 |
public function setAttachments(array $attachments)
|
@@ -129,7 +129,7 @@ class Rsc_Feedback_Mailer
|
|
129 |
* @param array $emails
|
130 |
* @throws LogicException
|
131 |
* @throws InvalidArgumentException
|
132 |
-
* @return
|
133 |
*/
|
134 |
public function setEmails(array $emails)
|
135 |
{
|
@@ -187,7 +187,7 @@ class Rsc_Feedback_Mailer
|
|
187 |
* Sets the message
|
188 |
*
|
189 |
* @param string $message
|
190 |
-
* @return
|
191 |
*/
|
192 |
public function setMessage($message)
|
193 |
{
|
@@ -209,7 +209,7 @@ class Rsc_Feedback_Mailer
|
|
209 |
* Sets the subject
|
210 |
*
|
211 |
* @param string $subject
|
212 |
-
* @return
|
213 |
*/
|
214 |
public function setSubject($subject)
|
215 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Feedback_Mailer
|
5 |
{
|
6 |
/**
|
7 |
* @var array
|
66 |
*
|
67 |
* @param array $headers
|
68 |
* @throws InvalidArgumentException If the headers is not an array or not a string
|
69 |
+
* @return RscDtgs_Feedback_Mailer
|
70 |
*/
|
71 |
public function setHeaders(array $headers)
|
72 |
{
|
94 |
* Sets the attachments
|
95 |
*
|
96 |
* @param array $attachments
|
97 |
+
* @return RscDtgs_Feedback_Mailer
|
98 |
* @throws InvalidArgumentException If the attachments is not an array or not a string
|
99 |
*/
|
100 |
public function setAttachments(array $attachments)
|
129 |
* @param array $emails
|
130 |
* @throws LogicException
|
131 |
* @throws InvalidArgumentException
|
132 |
+
* @return RscDtgs_Feedback_Mailer
|
133 |
*/
|
134 |
public function setEmails(array $emails)
|
135 |
{
|
187 |
* Sets the message
|
188 |
*
|
189 |
* @param string $message
|
190 |
+
* @return RscDtgs_Feedback_Mailer
|
191 |
*/
|
192 |
public function setMessage($message)
|
193 |
{
|
209 |
* Sets the subject
|
210 |
*
|
211 |
* @param string $subject
|
212 |
+
* @return RscDtgs_Feedback_Mailer
|
213 |
*/
|
214 |
public function setSubject($subject)
|
215 |
{
|
vendor/Rsc/Feedback/SupportMailer.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Class
|
5 |
* @package Rsc\Feedback
|
6 |
*/
|
7 |
-
class
|
8 |
{
|
9 |
/**
|
10 |
-
* @var
|
11 |
*/
|
12 |
private $mailer;
|
13 |
|
@@ -19,14 +19,14 @@ class Rsc_Feedback_SupportMailer
|
|
19 |
/**
|
20 |
* Constructor
|
21 |
*
|
22 |
-
* @param
|
23 |
* @param string $subject
|
24 |
* @param string $message
|
25 |
* @param array $parameters
|
26 |
*/
|
27 |
-
public function __construct(
|
28 |
{
|
29 |
-
$this->mailer = (is_null($mailer) ? new
|
30 |
|
31 |
$this->mailer->setSubject($subject);
|
32 |
$this->mailer->setMessage($message);
|
@@ -38,7 +38,7 @@ class Rsc_Feedback_SupportMailer
|
|
38 |
* Sets the message
|
39 |
*
|
40 |
* @param string $message
|
41 |
-
* @return
|
42 |
*/
|
43 |
public function setMessage($message)
|
44 |
{
|
@@ -51,7 +51,7 @@ class Rsc_Feedback_SupportMailer
|
|
51 |
* Sets the subject
|
52 |
*
|
53 |
* @param string $subject
|
54 |
-
* @return
|
55 |
*/
|
56 |
public function setSubject($subject)
|
57 |
{
|
@@ -64,7 +64,7 @@ class Rsc_Feedback_SupportMailer
|
|
64 |
* Sets the parameters
|
65 |
*
|
66 |
* @param array $parameters
|
67 |
-
* @return
|
68 |
*/
|
69 |
public function setParameters(array $parameters)
|
70 |
{
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Class RscDtgs_Feedback_SupportMailer
|
5 |
* @package Rsc\Feedback
|
6 |
*/
|
7 |
+
class RscDtgs_Feedback_SupportMailer
|
8 |
{
|
9 |
/**
|
10 |
+
* @var RscDtgs_Feedback_Mailer
|
11 |
*/
|
12 |
private $mailer;
|
13 |
|
19 |
/**
|
20 |
* Constructor
|
21 |
*
|
22 |
+
* @param RscDtgs_Feedback_Mailer $mailer
|
23 |
* @param string $subject
|
24 |
* @param string $message
|
25 |
* @param array $parameters
|
26 |
*/
|
27 |
+
public function __construct(RscDtgs_Feedback_Mailer $mailer = null, $subject = '', $message = '', array $parameters = array())
|
28 |
{
|
29 |
+
$this->mailer = (is_null($mailer) ? new RscDtgs_Feedback_Mailer() : $mailer);
|
30 |
|
31 |
$this->mailer->setSubject($subject);
|
32 |
$this->mailer->setMessage($message);
|
38 |
* Sets the message
|
39 |
*
|
40 |
* @param string $message
|
41 |
+
* @return RscDtgs_Feedback_SupportMailer
|
42 |
*/
|
43 |
public function setMessage($message)
|
44 |
{
|
51 |
* Sets the subject
|
52 |
*
|
53 |
* @param string $subject
|
54 |
+
* @return RscDtgs_Feedback_SupportMailer
|
55 |
*/
|
56 |
public function setSubject($subject)
|
57 |
{
|
64 |
* Sets the parameters
|
65 |
*
|
66 |
* @param array $parameters
|
67 |
+
* @return RscDtgs_Feedback_SupportMailer
|
68 |
*/
|
69 |
public function setParameters(array $parameters)
|
70 |
{
|
vendor/Rsc/Form/Filter/Custom.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
public $function;
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Filter_Custom implements RscDtgs_Form_Filter_Interface
|
5 |
{
|
6 |
|
7 |
public $function;
|
vendor/Rsc/Form/Filter/Interface.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
interface
|
5 |
{
|
6 |
/**
|
7 |
* Filters data
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
interface RscDtgs_Form_Filter_Interface
|
5 |
{
|
6 |
/**
|
7 |
* Filters data
|
vendor/Rsc/Form/Filter/XssClear.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
/**
|
7 |
* Filters data
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Filter_XssClear implements RscDtgs_Form_Filter_Interface
|
5 |
{
|
6 |
/**
|
7 |
* Filters data
|
vendor/Rsc/Form/Rule/Interface.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
interface
|
5 |
{
|
6 |
/**
|
7 |
* Constructor
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
interface RscDtgs_Form_Rule_Interface
|
5 |
{
|
6 |
/**
|
7 |
* Constructor
|
vendor/Rsc/Form/Rule/Numeric.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -66,7 +66,7 @@ class Rsc_Form_Rule_Numeric implements Rsc_Form_Rule_Interface
|
|
66 |
* Creates the new instance
|
67 |
* @param string $label Field label
|
68 |
* @param null $parameters Rule parameters
|
69 |
-
* @return
|
70 |
*/
|
71 |
public static function create($label, $parameters)
|
72 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Rule_Numeric implements RscDtgs_Form_Rule_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
66 |
* Creates the new instance
|
67 |
* @param string $label Field label
|
68 |
* @param null $parameters Rule parameters
|
69 |
+
* @return RscDtgs_Form_Rule_Numeric
|
70 |
*/
|
71 |
public static function create($label, $parameters)
|
72 |
{
|
vendor/Rsc/Form/Rule/Regex.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -62,7 +62,7 @@ class Rsc_Form_Rule_Regex implements Rsc_Form_Rule_Interface
|
|
62 |
/**
|
63 |
* Sets the error message
|
64 |
* @param string $message Error message
|
65 |
-
* @return
|
66 |
*/
|
67 |
public function setMessage($message)
|
68 |
{
|
@@ -75,7 +75,7 @@ class Rsc_Form_Rule_Regex implements Rsc_Form_Rule_Interface
|
|
75 |
* Creates the new instance
|
76 |
* @param string $label Field label
|
77 |
* @param string $parameters Rule parameters
|
78 |
-
* @return
|
79 |
*/
|
80 |
public static function create($label, $parameters)
|
81 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Rule_Regex implements RscDtgs_Form_Rule_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
62 |
/**
|
63 |
* Sets the error message
|
64 |
* @param string $message Error message
|
65 |
+
* @return RscDtgs_Form_Rule_Regex
|
66 |
*/
|
67 |
public function setMessage($message)
|
68 |
{
|
75 |
* Creates the new instance
|
76 |
* @param string $label Field label
|
77 |
* @param string $parameters Rule parameters
|
78 |
+
* @return RscDtgs_Form_Rule_Regex
|
79 |
*/
|
80 |
public static function create($label, $parameters)
|
81 |
{
|
vendor/Rsc/Form/Rule/Required.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -73,11 +73,11 @@ class Rsc_Form_Rule_Required implements Rsc_Form_Rule_Interface
|
|
73 |
/**
|
74 |
* Creates the new instance of the rule for chaining
|
75 |
* <code>
|
76 |
-
*
|
77 |
* </code>
|
78 |
* @param string $label Field label
|
79 |
* @param null $parameters An array of parameters
|
80 |
-
* @return
|
81 |
*/
|
82 |
public static function create($label, $parameters = null)
|
83 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Rule_Required implements RscDtgs_Form_Rule_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
73 |
/**
|
74 |
* Creates the new instance of the rule for chaining
|
75 |
* <code>
|
76 |
+
* RscDtgs_Form_Rule_Required::create('Control label', $params)->setMessage('The field %s is required');
|
77 |
* </code>
|
78 |
* @param string $label Field label
|
79 |
* @param null $parameters An array of parameters
|
80 |
+
* @return RscDtgs_Form_Rule_Required
|
81 |
*/
|
82 |
public static function create($label, $parameters = null)
|
83 |
{
|
vendor/Rsc/Form/Validator.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
const METHOD_POST = 'post';
|
8 |
const METHOD_GET = 'query';
|
9 |
|
10 |
/**
|
11 |
-
* @var
|
12 |
*/
|
13 |
protected $request;
|
14 |
|
@@ -18,12 +18,12 @@ class Rsc_Form_Validator
|
|
18 |
protected $method;
|
19 |
|
20 |
/**
|
21 |
-
* @var
|
22 |
*/
|
23 |
protected $rules;
|
24 |
|
25 |
/**
|
26 |
-
* @var
|
27 |
*/
|
28 |
protected $filters;
|
29 |
|
@@ -34,14 +34,14 @@ class Rsc_Form_Validator
|
|
34 |
|
35 |
/**
|
36 |
* Constructor
|
37 |
-
* @param
|
38 |
* @param string|null $method
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
*/
|
42 |
-
public function __construct(
|
43 |
{
|
44 |
-
$this->request = ($request === null ?
|
45 |
$this->method = ($method === null ? self::METHOD_POST : $this->prepareMethod($method));
|
46 |
$this->rules = $rules;
|
47 |
$this->filters = $filters;
|
@@ -50,15 +50,15 @@ class Rsc_Form_Validator
|
|
50 |
/**
|
51 |
* Is valid HTTP request?
|
52 |
* @return bool
|
53 |
-
* @throws
|
54 |
*/
|
55 |
public function isValid()
|
56 |
{
|
57 |
if (!$this->request) {
|
58 |
-
throw new
|
59 |
}
|
60 |
|
61 |
-
/** @var
|
62 |
$method = $this->request->{$this->method};
|
63 |
|
64 |
if ($method->isEmpty()) {
|
@@ -77,10 +77,10 @@ class Rsc_Form_Validator
|
|
77 |
|
78 |
/**
|
79 |
* Set current HTTP request for validation
|
80 |
-
* @param
|
81 |
-
* @return
|
82 |
*/
|
83 |
-
public function setRequest(
|
84 |
{
|
85 |
$this->request = $request;
|
86 |
return $this;
|
@@ -88,7 +88,7 @@ class Rsc_Form_Validator
|
|
88 |
|
89 |
/**
|
90 |
* Returns object of current HTTP request
|
91 |
-
* @return
|
92 |
*/
|
93 |
public function getRequest()
|
94 |
{
|
@@ -98,15 +98,15 @@ class Rsc_Form_Validator
|
|
98 |
/**
|
99 |
* Set HTTP method to validate
|
100 |
* @param string $method HTTP method to validate (POST or GET)
|
101 |
-
* @throws
|
102 |
-
* @return
|
103 |
*/
|
104 |
public function setMethod($method)
|
105 |
{
|
106 |
$method = $this->prepareMethod($method);
|
107 |
|
108 |
if (!in_array($method, array(self::METHOD_GET, self::METHOD_POST))) {
|
109 |
-
throw new
|
110 |
}
|
111 |
|
112 |
return $this;
|
@@ -124,7 +124,7 @@ class Rsc_Form_Validator
|
|
124 |
/**
|
125 |
* Set fields filters
|
126 |
* @param array $filters
|
127 |
-
* @return
|
128 |
*/
|
129 |
public function setFilters(array $filters)
|
130 |
{
|
@@ -145,7 +145,7 @@ class Rsc_Form_Validator
|
|
145 |
/**
|
146 |
* Set validation rules
|
147 |
* @param array $rules
|
148 |
-
* @return
|
149 |
*/
|
150 |
public function setRules(array $rules)
|
151 |
{
|
@@ -198,15 +198,15 @@ class Rsc_Form_Validator
|
|
198 |
|
199 |
/**
|
200 |
* Applies the specified filters
|
201 |
-
* @param
|
202 |
*/
|
203 |
-
protected function applyFilters(
|
204 |
{
|
205 |
if (empty($this->filters)) {
|
206 |
return;
|
207 |
}
|
208 |
|
209 |
-
/** @var
|
210 |
foreach ($this->filters as $field => $filters) {
|
211 |
|
212 |
if (!is_array($this->filters[$field])) {
|
@@ -225,15 +225,15 @@ class Rsc_Form_Validator
|
|
225 |
|
226 |
/**
|
227 |
* Do validation
|
228 |
-
* @param
|
229 |
*/
|
230 |
-
protected function doValidation(
|
231 |
{
|
232 |
if (empty($this->rules)) {
|
233 |
return;
|
234 |
}
|
235 |
|
236 |
-
/** @var
|
237 |
foreach ($this->rules as $field => $rules) {
|
238 |
|
239 |
if (!is_array($this->rules[$field])) {
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Validator
|
5 |
{
|
6 |
|
7 |
const METHOD_POST = 'post';
|
8 |
const METHOD_GET = 'query';
|
9 |
|
10 |
/**
|
11 |
+
* @var RscDtgs_Http_Request
|
12 |
*/
|
13 |
protected $request;
|
14 |
|
18 |
protected $method;
|
19 |
|
20 |
/**
|
21 |
+
* @var RscDtgs_Common_Collection
|
22 |
*/
|
23 |
protected $rules;
|
24 |
|
25 |
/**
|
26 |
+
* @var RscDtgs_Common_Collection
|
27 |
*/
|
28 |
protected $filters;
|
29 |
|
34 |
|
35 |
/**
|
36 |
* Constructor
|
37 |
+
* @param RscDtgs_Http_Request $request
|
38 |
* @param string|null $method
|
39 |
+
* @param RscDtgs_Common_Collection|array $rules
|
40 |
+
* @param RscDtgs_Common_Collection|array $filters
|
41 |
*/
|
42 |
+
public function __construct(RscDtgs_Http_Request $request = null, $method = null, array $rules = array(), array $filters = array())
|
43 |
{
|
44 |
+
$this->request = ($request === null ? RscDtgs_Http_Request::create() : $request);
|
45 |
$this->method = ($method === null ? self::METHOD_POST : $this->prepareMethod($method));
|
46 |
$this->rules = $rules;
|
47 |
$this->filters = $filters;
|
50 |
/**
|
51 |
* Is valid HTTP request?
|
52 |
* @return bool
|
53 |
+
* @throws RscDtgs_Form_Validator_EmptyRequestException If HTTP request is not specified
|
54 |
*/
|
55 |
public function isValid()
|
56 |
{
|
57 |
if (!$this->request) {
|
58 |
+
throw new RscDtgs_Form_Validator_EmptyRequestException('You must submit the request via ' . __CLASS__ . '::setRequest() method');
|
59 |
}
|
60 |
|
61 |
+
/** @var RscDtgs_Http_Parameters $method */
|
62 |
$method = $this->request->{$this->method};
|
63 |
|
64 |
if ($method->isEmpty()) {
|
77 |
|
78 |
/**
|
79 |
* Set current HTTP request for validation
|
80 |
+
* @param RscDtgs_Http_Request $request
|
81 |
+
* @return RscDtgs_Form_Validator
|
82 |
*/
|
83 |
+
public function setRequest(RscDtgs_Http_Request $request)
|
84 |
{
|
85 |
$this->request = $request;
|
86 |
return $this;
|
88 |
|
89 |
/**
|
90 |
* Returns object of current HTTP request
|
91 |
+
* @return RscDtgs_Http_Request
|
92 |
*/
|
93 |
public function getRequest()
|
94 |
{
|
98 |
/**
|
99 |
* Set HTTP method to validate
|
100 |
* @param string $method HTTP method to validate (POST or GET)
|
101 |
+
* @throws RscDtgs_Form_Validator_InvalidMethodException If specified method is wrong
|
102 |
+
* @return RscDtgs_Form_Validator
|
103 |
*/
|
104 |
public function setMethod($method)
|
105 |
{
|
106 |
$method = $this->prepareMethod($method);
|
107 |
|
108 |
if (!in_array($method, array(self::METHOD_GET, self::METHOD_POST))) {
|
109 |
+
throw new RscDtgs_Form_Validator_InvalidMethodException('Invalid method. Type of the method can only be POST or GET (QUERY)');
|
110 |
}
|
111 |
|
112 |
return $this;
|
124 |
/**
|
125 |
* Set fields filters
|
126 |
* @param array $filters
|
127 |
+
* @return RscDtgs_Form_Validator
|
128 |
*/
|
129 |
public function setFilters(array $filters)
|
130 |
{
|
145 |
/**
|
146 |
* Set validation rules
|
147 |
* @param array $rules
|
148 |
+
* @return RscDtgs_Form_Validator
|
149 |
*/
|
150 |
public function setRules(array $rules)
|
151 |
{
|
198 |
|
199 |
/**
|
200 |
* Applies the specified filters
|
201 |
+
* @param RscDtgs_Http_Parameters $method
|
202 |
*/
|
203 |
+
protected function applyFilters(RscDtgs_Http_Parameters $method)
|
204 |
{
|
205 |
if (empty($this->filters)) {
|
206 |
return;
|
207 |
}
|
208 |
|
209 |
+
/** @var RscDtgs_Form_Filter_Interface $filter */
|
210 |
foreach ($this->filters as $field => $filters) {
|
211 |
|
212 |
if (!is_array($this->filters[$field])) {
|
225 |
|
226 |
/**
|
227 |
* Do validation
|
228 |
+
* @param RscDtgs_Http_Parameters $method
|
229 |
*/
|
230 |
+
protected function doValidation(RscDtgs_Http_Parameters $method)
|
231 |
{
|
232 |
if (empty($this->rules)) {
|
233 |
return;
|
234 |
}
|
235 |
|
236 |
+
/** @var RscDtgs_Form_Rule_Interface $rule */
|
237 |
foreach ($this->rules as $field => $rules) {
|
238 |
|
239 |
if (!is_array($this->rules[$field])) {
|
vendor/Rsc/Form/Validator/EmptyRequestException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Validator_EmptyRequestException extends RuntimeException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Form/Validator/InvalidMethodException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Validator_InvalidMethodException extends InvalidArgumentException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Form/Validator/UnexpectedRuleException.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Form_Validator_UnexpectedRuleException extends InvalidArgumentException
|
5 |
{
|
6 |
|
7 |
}
|
vendor/Rsc/Html.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
static public function nameToClassId($name, $params = array()) {
|
4 |
if(!empty($params) && isset($params['attrs']) && strpos($params['attrs'], 'id="') !== false) {
|
5 |
preg_match('/id="(.+)"/ui', $params['attrs'], $idMatches);
|
1 |
<?php
|
2 |
+
class RscDtgs_Html {
|
3 |
static public function nameToClassId($name, $params = array()) {
|
4 |
if(!empty($params) && isset($params['attrs']) && strpos($params['attrs'], 'id="') !== false) {
|
5 |
preg_match('/id="(.+)"/ui', $params['attrs'], $idMatches);
|
vendor/Rsc/Http/Parameters.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
public function get_esc_html($key, $default = null)
|
7 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Http_Parameters extends RscDtgs_Common_Collection
|
5 |
{
|
6 |
public function get_esc_html($key, $default = null)
|
7 |
{
|
vendor/Rsc/Http/Request.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
/**
|
7 |
-
* @var
|
8 |
*/
|
9 |
public $post;
|
10 |
|
11 |
/**
|
12 |
-
* @var
|
13 |
*/
|
14 |
public $query;
|
15 |
|
16 |
/**
|
17 |
-
* @var
|
18 |
*/
|
19 |
public $files;
|
20 |
|
21 |
/**
|
22 |
-
* @var
|
23 |
*/
|
24 |
public $server;
|
25 |
|
26 |
/**
|
27 |
-
* @var
|
28 |
*/
|
29 |
public $headers;
|
30 |
|
@@ -40,16 +40,16 @@ class Rsc_Http_Request
|
|
40 |
if(!is_array($postTempVar)) {
|
41 |
$postTempVar = array();
|
42 |
}
|
43 |
-
$this->post = new
|
44 |
-
$this->query = new
|
45 |
-
$this->files = new
|
46 |
-
$this->server = new
|
47 |
-
$this->headers = new
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Returns new request from the global variables
|
52 |
-
* @return
|
53 |
*/
|
54 |
public static function create()
|
55 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Http_Request
|
5 |
{
|
6 |
/**
|
7 |
+
* @var RscDtgs_Http_Parameters
|
8 |
*/
|
9 |
public $post;
|
10 |
|
11 |
/**
|
12 |
+
* @var RscDtgs_Http_Parameters
|
13 |
*/
|
14 |
public $query;
|
15 |
|
16 |
/**
|
17 |
+
* @var RscDtgs_Http_Parameters
|
18 |
*/
|
19 |
public $files;
|
20 |
|
21 |
/**
|
22 |
+
* @var RscDtgs_Http_ServerParameters
|
23 |
*/
|
24 |
public $server;
|
25 |
|
26 |
/**
|
27 |
+
* @var RscDtgs_Http_Parameters
|
28 |
*/
|
29 |
public $headers;
|
30 |
|
40 |
if(!is_array($postTempVar)) {
|
41 |
$postTempVar = array();
|
42 |
}
|
43 |
+
$this->post = new RscDtgs_Http_Parameters($postTempVar);
|
44 |
+
$this->query = new RscDtgs_Http_Parameters($_GET);
|
45 |
+
$this->files = new RscDtgs_Http_Parameters($_FILES);
|
46 |
+
$this->server = new RscDtgs_Http_ServerParameters($_SERVER);
|
47 |
+
$this->headers = new RscDtgs_Http_Parameters($this->server->getHeaders());
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Returns new request from the global variables
|
52 |
+
* @return RscDtgs_Http_Request
|
53 |
*/
|
54 |
public static function create()
|
55 |
{
|
vendor/Rsc/Http/Response.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
const AJAX = 'ajax';
|
@@ -13,7 +13,7 @@ class Rsc_Http_Response
|
|
13 |
|
14 |
/**
|
15 |
* Creates the new response for chaining methods
|
16 |
-
* @return
|
17 |
*/
|
18 |
public static function create()
|
19 |
{
|
@@ -23,7 +23,7 @@ class Rsc_Http_Response
|
|
23 |
/**
|
24 |
* Sets the content of the response
|
25 |
* @param string $content
|
26 |
-
* @return
|
27 |
*/
|
28 |
public function setContent($content)
|
29 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Http_Response
|
5 |
{
|
6 |
|
7 |
const AJAX = 'ajax';
|
13 |
|
14 |
/**
|
15 |
* Creates the new response for chaining methods
|
16 |
+
* @return RscDtgs_Http_Response
|
17 |
*/
|
18 |
public static function create()
|
19 |
{
|
23 |
/**
|
24 |
* Sets the content of the response
|
25 |
* @param string $content
|
26 |
+
* @return RscDtgs_Http_Response
|
27 |
*/
|
28 |
public function setContent($content)
|
29 |
{
|
vendor/Rsc/Http/ServerParameters.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Http_ServerParameters extends RscDtgs_Http_Parameters
|
5 |
{
|
6 |
|
7 |
/**
|
vendor/Rsc/Installer.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
/**
|
7 |
-
* @var
|
8 |
*/
|
9 |
private $parser;
|
10 |
|
11 |
/**
|
12 |
-
* @param
|
13 |
*/
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
$this->parser = $parser;
|
17 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Installer
|
5 |
{
|
6 |
/**
|
7 |
+
* @var RscDtgs_Installer_Parser
|
8 |
*/
|
9 |
private $parser;
|
10 |
|
11 |
/**
|
12 |
+
* @param RscDtgs_Installer_Parser $parser
|
13 |
*/
|
14 |
+
public function __construct(RscDtgs_Installer_Parser $parser)
|
15 |
{
|
16 |
$this->parser = $parser;
|
17 |
}
|
vendor/Rsc/Installer/Parser.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Class
|
5 |
* Abstract parser
|
6 |
*/
|
7 |
-
abstract class
|
8 |
{
|
9 |
/**
|
10 |
* @var string
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Class RscDtgs_Installer_Parser
|
5 |
* Abstract parser
|
6 |
*/
|
7 |
+
abstract class RscDtgs_Installer_Parser
|
8 |
{
|
9 |
/**
|
10 |
* @var string
|
vendor/Rsc/Installer/PhpParser.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
/**
|
7 |
* Checks whether the required resource is supported by selected parser
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Installer_PhpParser extends RscDtgs_Installer_Parser
|
5 |
{
|
6 |
/**
|
7 |
* Checks whether the required resource is supported by selected parser
|
vendor/Rsc/Lang.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -20,7 +20,7 @@ class Rsc_Lang
|
|
20 |
protected $files;
|
21 |
|
22 |
/**
|
23 |
-
* @var
|
24 |
*/
|
25 |
protected $cache;
|
26 |
|
@@ -28,9 +28,9 @@ class Rsc_Lang
|
|
28 |
* Constructor
|
29 |
* @param null|string $domain Text domain
|
30 |
* @param null|string $path Path to the *.mo files
|
31 |
-
* @param
|
32 |
*/
|
33 |
-
public function __construct($domain = null, $path = null,
|
34 |
{
|
35 |
$this->domain = $domain;
|
36 |
$this->path = $path;
|
@@ -39,10 +39,10 @@ class Rsc_Lang
|
|
39 |
|
40 |
/**
|
41 |
* Set caching class
|
42 |
-
* @param \
|
43 |
-
* @return
|
44 |
*/
|
45 |
-
public function setCache(
|
46 |
{
|
47 |
$this->cache = $cache;
|
48 |
return $this;
|
@@ -50,7 +50,7 @@ class Rsc_Lang
|
|
50 |
|
51 |
/**
|
52 |
* Load text domain
|
53 |
-
* @throws
|
54 |
*/
|
55 |
public function loadTextDomain()
|
56 |
{
|
@@ -77,7 +77,7 @@ class Rsc_Lang
|
|
77 |
}
|
78 |
|
79 |
/**
|
80 |
-
* Alias for
|
81 |
* @param string $msgid Message ID
|
82 |
* @return string|void
|
83 |
*/
|
@@ -139,7 +139,7 @@ class Rsc_Lang
|
|
139 |
/**
|
140 |
* Set text domain
|
141 |
* @param string $domain
|
142 |
-
* @return
|
143 |
*/
|
144 |
public function setDomain($domain)
|
145 |
{
|
@@ -159,7 +159,7 @@ class Rsc_Lang
|
|
159 |
/**
|
160 |
* Set domain path
|
161 |
* @param string $path
|
162 |
-
* @return
|
163 |
*/
|
164 |
public function setPath($path)
|
165 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Lang
|
5 |
{
|
6 |
|
7 |
/**
|
20 |
protected $files;
|
21 |
|
22 |
/**
|
23 |
+
* @var RscDtgs_Cache_Interface
|
24 |
*/
|
25 |
protected $cache;
|
26 |
|
28 |
* Constructor
|
29 |
* @param null|string $domain Text domain
|
30 |
* @param null|string $path Path to the *.mo files
|
31 |
+
* @param RscDtgs_Cache $cache Caching class
|
32 |
*/
|
33 |
+
public function __construct($domain = null, $path = null, RscDtgs_Cache $cache = null)
|
34 |
{
|
35 |
$this->domain = $domain;
|
36 |
$this->path = $path;
|
39 |
|
40 |
/**
|
41 |
* Set caching class
|
42 |
+
* @param \RscDtgs_Cache_Interface $cache
|
43 |
+
* @return RscDtgs_Lang
|
44 |
*/
|
45 |
+
public function setCache(RscDtgs_Cache_Interface $cache)
|
46 |
{
|
47 |
$this->cache = $cache;
|
48 |
return $this;
|
50 |
|
51 |
/**
|
52 |
* Load text domain
|
53 |
+
* @throws RscDtgs_Exception_LangException If path or domain is not specified
|
54 |
*/
|
55 |
public function loadTextDomain()
|
56 |
{
|
77 |
}
|
78 |
|
79 |
/**
|
80 |
+
* Alias for RscDtgs_Lang::translate()
|
81 |
* @param string $msgid Message ID
|
82 |
* @return string|void
|
83 |
*/
|
139 |
/**
|
140 |
* Set text domain
|
141 |
* @param string $domain
|
142 |
+
* @return RscDtgs_Lang
|
143 |
*/
|
144 |
public function setDomain($domain)
|
145 |
{
|
159 |
/**
|
160 |
* Set domain path
|
161 |
* @param string $path
|
162 |
+
* @return RscDtgs_Lang
|
163 |
*/
|
164 |
public function setPath($path)
|
165 |
{
|
vendor/Rsc/Logger.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -23,7 +23,7 @@ class Rsc_Logger implements Rsc_Logger_Interface
|
|
23 |
* Sets the path to the log files.
|
24 |
*
|
25 |
* @param string $path Path to the log files
|
26 |
-
* @return
|
27 |
*/
|
28 |
public function setPath($path)
|
29 |
{
|
@@ -154,7 +154,7 @@ class Rsc_Logger implements Rsc_Logger_Interface
|
|
154 |
* @param mixed $level
|
155 |
* @param string $message
|
156 |
* @param array $context
|
157 |
-
* @throws
|
158 |
* @return null
|
159 |
*/
|
160 |
public function log($level, $message, array $context = array())
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Logger implements RscDtgs_Logger_Interface
|
5 |
{
|
6 |
|
7 |
/**
|
23 |
* Sets the path to the log files.
|
24 |
*
|
25 |
* @param string $path Path to the log files
|
26 |
+
* @return RscDtgs_Logger
|
27 |
*/
|
28 |
public function setPath($path)
|
29 |
{
|
154 |
* @param mixed $level
|
155 |
* @param string $message
|
156 |
* @param array $context
|
157 |
+
* @throws RscDtgs_Logger_Exception_InvalidPathException If path is does not exists or does not writable
|
158 |
* @return null
|
159 |
*/
|
160 |
public function log($level, $message, array $context = array())
|
vendor/Rsc/Logger/AwareInterface.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
/**
|
4 |
* Describes a logger-aware instance
|
5 |
*/
|
6 |
-
interface
|
7 |
{
|
8 |
/**
|
9 |
* Sets a logger instance on the object
|
10 |
*
|
11 |
-
* @param
|
12 |
* @return null
|
13 |
*/
|
14 |
-
public function setLogger(
|
15 |
}
|
3 |
/**
|
4 |
* Describes a logger-aware instance
|
5 |
*/
|
6 |
+
interface RscDtgs_Logger_AwareInterface
|
7 |
{
|
8 |
/**
|
9 |
* Sets a logger instance on the object
|
10 |
*
|
11 |
+
* @param RscDtgs_Logger_Interface $logger
|
12 |
* @return null
|
13 |
*/
|
14 |
+
public function setLogger(RscDtgs_Logger_Interface $logger);
|
15 |
}
|
vendor/Rsc/Logger/Exception/InvalidPathException.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Class
|
5 |
*/
|
6 |
-
class
|
7 |
{
|
8 |
|
9 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Class RscDtgs_Logger_Exception_InvalidPathException
|
5 |
*/
|
6 |
+
class RscDtgs_Logger_Exception_InvalidPathException extends RuntimeException
|
7 |
{
|
8 |
|
9 |
}
|
vendor/Rsc/Logger/Interface.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
16 |
* for the full interface specification.
|
17 |
*/
|
18 |
-
interface
|
19 |
{
|
20 |
/**
|
21 |
* System is unusable.
|
15 |
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
16 |
* for the full interface specification.
|
17 |
*/
|
18 |
+
interface RscDtgs_Logger_Interface
|
19 |
{
|
20 |
/**
|
21 |
* System is unusable.
|
vendor/Rsc/Menu/Item.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
@@ -30,7 +30,7 @@ class Rsc_Menu_Item
|
|
30 |
protected $menuSlug;
|
31 |
|
32 |
/**
|
33 |
-
* @var
|
34 |
*/
|
35 |
protected $resolver;
|
36 |
|
@@ -47,9 +47,9 @@ class Rsc_Menu_Item
|
|
47 |
/**
|
48 |
* Constructor
|
49 |
* @param string $parentSlug
|
50 |
-
* @param
|
51 |
*/
|
52 |
-
public function __construct($parentSlug,
|
53 |
{
|
54 |
$this->parentSlug = $parentSlug;
|
55 |
$this->resolver = $resolver;
|
@@ -58,7 +58,7 @@ class Rsc_Menu_Item
|
|
58 |
/**
|
59 |
* Set the capability
|
60 |
* @param string $capability The capability required for this menu to be displayed to the user
|
61 |
-
* @return
|
62 |
*/
|
63 |
public function setCapability($capability)
|
64 |
{
|
@@ -78,7 +78,7 @@ class Rsc_Menu_Item
|
|
78 |
/**
|
79 |
* Set the menu slug
|
80 |
* @param string $menuSlug The slug name to refer to this menu by
|
81 |
-
* @return
|
82 |
*/
|
83 |
public function setMenuSlug($menuSlug)
|
84 |
{
|
@@ -98,7 +98,7 @@ class Rsc_Menu_Item
|
|
98 |
/**
|
99 |
* Set the menu title
|
100 |
* @param string $menuTitle The text to be used for the menu
|
101 |
-
* @return
|
102 |
*/
|
103 |
public function setMenuTitle($menuTitle)
|
104 |
{
|
@@ -118,7 +118,7 @@ class Rsc_Menu_Item
|
|
118 |
/**
|
119 |
* Set the page title
|
120 |
* @param string $pageTitle The text to be displayed in the title tags of the page when the menu is selected
|
121 |
-
* @return
|
122 |
*/
|
123 |
public function setPageTitle($pageTitle)
|
124 |
{
|
@@ -138,7 +138,7 @@ class Rsc_Menu_Item
|
|
138 |
/**
|
139 |
* Sets the module name
|
140 |
* @param string $moduleName
|
141 |
-
* @return
|
142 |
*/
|
143 |
public function setModuleName($moduleName)
|
144 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Menu_Item
|
5 |
{
|
6 |
|
7 |
/**
|
30 |
protected $menuSlug;
|
31 |
|
32 |
/**
|
33 |
+
* @var RscDtgs_Resolver
|
34 |
*/
|
35 |
protected $resolver;
|
36 |
|
47 |
/**
|
48 |
* Constructor
|
49 |
* @param string $parentSlug
|
50 |
+
* @param RscDtgs_Resolver $resolver
|
51 |
*/
|
52 |
+
public function __construct($parentSlug, RscDtgs_Resolver $resolver)
|
53 |
{
|
54 |
$this->parentSlug = $parentSlug;
|
55 |
$this->resolver = $resolver;
|
58 |
/**
|
59 |
* Set the capability
|
60 |
* @param string $capability The capability required for this menu to be displayed to the user
|
61 |
+
* @return RscDtgs_Menu_Item
|
62 |
*/
|
63 |
public function setCapability($capability)
|
64 |
{
|
78 |
/**
|
79 |
* Set the menu slug
|
80 |
* @param string $menuSlug The slug name to refer to this menu by
|
81 |
+
* @return RscDtgs_Menu_Item
|
82 |
*/
|
83 |
public function setMenuSlug($menuSlug)
|
84 |
{
|
98 |
/**
|
99 |
* Set the menu title
|
100 |
* @param string $menuTitle The text to be used for the menu
|
101 |
+
* @return RscDtgs_Menu_Item
|
102 |
*/
|
103 |
public function setMenuTitle($menuTitle)
|
104 |
{
|
118 |
/**
|
119 |
* Set the page title
|
120 |
* @param string $pageTitle The text to be displayed in the title tags of the page when the menu is selected
|
121 |
+
* @return RscDtgs_Menu_Item
|
122 |
*/
|
123 |
public function setPageTitle($pageTitle)
|
124 |
{
|
138 |
/**
|
139 |
* Sets the module name
|
140 |
* @param string $moduleName
|
141 |
+
* @return RscDtgs_Menu_Item
|
142 |
*/
|
143 |
public function setModuleName($moduleName)
|
144 |
{
|
vendor/Rsc/Menu/Page.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
protected $resolver;
|
11 |
|
@@ -44,7 +44,7 @@ class Rsc_Menu_Page
|
|
44 |
*/
|
45 |
protected $submenu;
|
46 |
|
47 |
-
public function __construct(
|
48 |
{
|
49 |
$this->resolver = $resolver;
|
50 |
}
|
@@ -52,7 +52,7 @@ class Rsc_Menu_Page
|
|
52 |
/**
|
53 |
* Set the capability
|
54 |
* @param string $capability The capability required for this menu to be displayed to the user
|
55 |
-
* @return
|
56 |
*/
|
57 |
public function setCapability($capability)
|
58 |
{
|
@@ -72,7 +72,7 @@ class Rsc_Menu_Page
|
|
72 |
/**
|
73 |
* Set the icon url
|
74 |
* @param string $iconUrl The icon for this menu
|
75 |
-
* @return
|
76 |
*/
|
77 |
public function setIconUrl($iconUrl)
|
78 |
{
|
@@ -92,7 +92,7 @@ class Rsc_Menu_Page
|
|
92 |
/**
|
93 |
* Set the slug name
|
94 |
* @param string $menuSlug The slug name to refer to this menu by
|
95 |
-
* @return
|
96 |
*/
|
97 |
public function setMenuSlug($menuSlug)
|
98 |
{
|
@@ -112,7 +112,7 @@ class Rsc_Menu_Page
|
|
112 |
/**
|
113 |
* Set the menu title
|
114 |
* @param string $menuTitle The on-screen name text for the menu
|
115 |
-
* @return
|
116 |
*/
|
117 |
public function setMenuTitle($menuTitle)
|
118 |
{
|
@@ -132,7 +132,7 @@ class Rsc_Menu_Page
|
|
132 |
/**
|
133 |
* Set the page title
|
134 |
* @param string $pageTitle The text to be displayed in the title tags of the page when the menu is selected
|
135 |
-
* @return
|
136 |
*/
|
137 |
public function setPageTitle($pageTitle)
|
138 |
{
|
@@ -152,7 +152,7 @@ class Rsc_Menu_Page
|
|
152 |
/**
|
153 |
* Set the position
|
154 |
* @param int|string $position The position in the menu order this menu should appear
|
155 |
-
* @return
|
156 |
*/
|
157 |
public function setPosition($position)
|
158 |
{
|
@@ -172,19 +172,19 @@ class Rsc_Menu_Page
|
|
172 |
|
173 |
/**
|
174 |
* Create an instance of the submenu item class
|
175 |
-
* @return
|
176 |
*/
|
177 |
public function createSubmenuItem()
|
178 |
{
|
179 |
-
return new
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
* @param string $handle The handle of the item
|
184 |
-
* @param
|
185 |
-
* @return
|
186 |
*/
|
187 |
-
public function addSubmenuItem($handle,
|
188 |
{
|
189 |
$this->submenu[$handle] = $submenu;
|
190 |
return $this;
|
@@ -208,7 +208,7 @@ class Rsc_Menu_Page
|
|
208 |
/**
|
209 |
* Returns an instance of the submenu item
|
210 |
* @param string $handle The handle of the submenu item
|
211 |
-
* @return null|
|
212 |
*/
|
213 |
public function getSubmenuItem($handle)
|
214 |
{
|
@@ -227,7 +227,7 @@ class Rsc_Menu_Page
|
|
227 |
add_action('admin_menu', array($this, 'addMenuPage'));
|
228 |
if(is_array($this->submenu) && count($this->submenu) > 0) {
|
229 |
usort($this->submenu, array($this, 'sortSubMenuItemsClb'));
|
230 |
-
/** @var
|
231 |
foreach ($this->submenu as $submenu) {
|
232 |
add_action('admin_menu', array($submenu, 'register'));
|
233 |
}
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Menu_Page
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Resolver
|
9 |
*/
|
10 |
protected $resolver;
|
11 |
|
44 |
*/
|
45 |
protected $submenu;
|
46 |
|
47 |
+
public function __construct(RscDtgs_Resolver $resolver)
|
48 |
{
|
49 |
$this->resolver = $resolver;
|
50 |
}
|
52 |
/**
|
53 |
* Set the capability
|
54 |
* @param string $capability The capability required for this menu to be displayed to the user
|
55 |
+
* @return RscDtgs_Menu_Page
|
56 |
*/
|
57 |
public function setCapability($capability)
|
58 |
{
|
72 |
/**
|
73 |
* Set the icon url
|
74 |
* @param string $iconUrl The icon for this menu
|
75 |
+
* @return RscDtgs_Menu_Page
|
76 |
*/
|
77 |
public function setIconUrl($iconUrl)
|
78 |
{
|
92 |
/**
|
93 |
* Set the slug name
|
94 |
* @param string $menuSlug The slug name to refer to this menu by
|
95 |
+
* @return RscDtgs_Menu_Page
|
96 |
*/
|
97 |
public function setMenuSlug($menuSlug)
|
98 |
{
|
112 |
/**
|
113 |
* Set the menu title
|
114 |
* @param string $menuTitle The on-screen name text for the menu
|
115 |
+
* @return RscDtgs_Menu_Page
|
116 |
*/
|
117 |
public function setMenuTitle($menuTitle)
|
118 |
{
|
132 |
/**
|
133 |
* Set the page title
|
134 |
* @param string $pageTitle The text to be displayed in the title tags of the page when the menu is selected
|
135 |
+
* @return RscDtgs_Menu_Page
|
136 |
*/
|
137 |
public function setPageTitle($pageTitle)
|
138 |
{
|
152 |
/**
|
153 |
* Set the position
|
154 |
* @param int|string $position The position in the menu order this menu should appear
|
155 |
+
* @return RscDtgs_Menu_Page
|
156 |
*/
|
157 |
public function setPosition($position)
|
158 |
{
|
172 |
|
173 |
/**
|
174 |
* Create an instance of the submenu item class
|
175 |
+
* @return RscDtgs_Menu_Item
|
176 |
*/
|
177 |
public function createSubmenuItem()
|
178 |
{
|
179 |
+
return new RscDtgs_Menu_Item($this->menuSlug, $this->resolver);
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
* @param string $handle The handle of the item
|
184 |
+
* @param RscDtgs_Menu_Item $submenu An instance of the submenu item class
|
185 |
+
* @return RscDtgs_Menu_Page
|
186 |
*/
|
187 |
+
public function addSubmenuItem($handle, RscDtgs_Menu_Item $submenu)
|
188 |
{
|
189 |
$this->submenu[$handle] = $submenu;
|
190 |
return $this;
|
208 |
/**
|
209 |
* Returns an instance of the submenu item
|
210 |
* @param string $handle The handle of the submenu item
|
211 |
+
* @return null|RscDtgs_Menu_Item
|
212 |
*/
|
213 |
public function getSubmenuItem($handle)
|
214 |
{
|
227 |
add_action('admin_menu', array($this, 'addMenuPage'));
|
228 |
if(is_array($this->submenu) && count($this->submenu) > 0) {
|
229 |
usort($this->submenu, array($this, 'sortSubMenuItemsClb'));
|
230 |
+
/** @var RscDtgs_Menu_Item $submenu */
|
231 |
foreach ($this->submenu as $submenu) {
|
232 |
add_action('admin_menu', array($submenu, 'register'));
|
233 |
}
|
vendor/Rsc/Mvc/Controller.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
12 |
/**
|
13 |
-
* @var
|
14 |
*/
|
15 |
private $request;
|
16 |
|
17 |
/**
|
18 |
* Constructor
|
19 |
-
* @param
|
20 |
-
* @param
|
21 |
*/
|
22 |
public function __construct(
|
23 |
-
|
24 |
-
|
25 |
) {
|
26 |
$this->environment = $environment;
|
27 |
$this->request = $request;
|
@@ -52,11 +52,11 @@ class Rsc_Mvc_Controller
|
|
52 |
* Creates new response
|
53 |
* @param string $template The name of the template
|
54 |
* @param array $data An associative array of the data
|
55 |
-
* @return
|
56 |
*/
|
57 |
public function response($template, array $data = array())
|
58 |
{
|
59 |
-
if ($template !=
|
60 |
try {
|
61 |
$twig = $this->environment->getTwig();
|
62 |
$content = $twig->render($template, $data);
|
@@ -67,7 +67,7 @@ class Rsc_Mvc_Controller
|
|
67 |
wp_send_json($data);
|
68 |
}
|
69 |
|
70 |
-
return
|
71 |
}
|
72 |
|
73 |
/**
|
@@ -88,7 +88,7 @@ class Rsc_Mvc_Controller
|
|
88 |
/**
|
89 |
* Makes redirects to the specified URL
|
90 |
* @param string $url
|
91 |
-
* @return \
|
92 |
*/
|
93 |
public function redirect($url)
|
94 |
{
|
@@ -99,12 +99,12 @@ class Rsc_Mvc_Controller
|
|
99 |
|
100 |
$content = "<script type=\"text/javascript\">document.location.href = '$url'</script>";
|
101 |
|
102 |
-
return
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
* Returns an instance of the environment
|
107 |
-
* @return \
|
108 |
*/
|
109 |
public function getEnvironment()
|
110 |
{
|
@@ -113,7 +113,7 @@ class Rsc_Mvc_Controller
|
|
113 |
|
114 |
/**
|
115 |
* Returns an instance of the current request
|
116 |
-
* @return \
|
117 |
*/
|
118 |
public function getRequest()
|
119 |
{
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Mvc_Controller
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Environment
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
12 |
/**
|
13 |
+
* @var RscDtgs_Http_Request
|
14 |
*/
|
15 |
private $request;
|
16 |
|
17 |
/**
|
18 |
* Constructor
|
19 |
+
* @param RscDtgs_Environment $environment
|
20 |
+
* @param RscDtgs_Http_Request $request
|
21 |
*/
|
22 |
public function __construct(
|
23 |
+
RscDtgs_Environment $environment,
|
24 |
+
RscDtgs_Http_Request $request
|
25 |
) {
|
26 |
$this->environment = $environment;
|
27 |
$this->request = $request;
|
52 |
* Creates new response
|
53 |
* @param string $template The name of the template
|
54 |
* @param array $data An associative array of the data
|
55 |
+
* @return RscDtgs_Http_Response
|
56 |
*/
|
57 |
public function response($template, array $data = array())
|
58 |
{
|
59 |
+
if ($template != RscDtgs_Http_Response::AJAX) {
|
60 |
try {
|
61 |
$twig = $this->environment->getTwig();
|
62 |
$content = $twig->render($template, $data);
|
67 |
wp_send_json($data);
|
68 |
}
|
69 |
|
70 |
+
return RscDtgs_Http_Response::create()->setContent($content);
|
71 |
}
|
72 |
|
73 |
/**
|
88 |
/**
|
89 |
* Makes redirects to the specified URL
|
90 |
* @param string $url
|
91 |
+
* @return \RscDtgs_Http_Response
|
92 |
*/
|
93 |
public function redirect($url)
|
94 |
{
|
99 |
|
100 |
$content = "<script type=\"text/javascript\">document.location.href = '$url'</script>";
|
101 |
|
102 |
+
return RscDtgs_Http_Response::create()->setContent($content);
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
* Returns an instance of the environment
|
107 |
+
* @return \RscDtgs_Environment
|
108 |
*/
|
109 |
public function getEnvironment()
|
110 |
{
|
113 |
|
114 |
/**
|
115 |
* Returns an instance of the current request
|
116 |
+
* @return \RscDtgs_Http_Request
|
117 |
*/
|
118 |
public function getRequest()
|
119 |
{
|
vendor/Rsc/Mvc/Model.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Mvc_Model
|
5 |
{
|
6 |
|
7 |
/**
|
vendor/Rsc/Mvc/Module.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
@@ -20,12 +20,12 @@ class Rsc_Mvc_Module
|
|
20 |
private $namespace;
|
21 |
|
22 |
/**
|
23 |
-
* @var
|
24 |
*/
|
25 |
private $request;
|
26 |
|
27 |
/**
|
28 |
-
* @var
|
29 |
*/
|
30 |
private $controller;
|
31 |
|
@@ -36,11 +36,11 @@ class Rsc_Mvc_Module
|
|
36 |
|
37 |
/**
|
38 |
* Constructor.
|
39 |
-
* @param
|
40 |
* @param string $location Full path to the directory where is module
|
41 |
* @param string $namespace Module prefix
|
42 |
*/
|
43 |
-
public function __construct(
|
44 |
{
|
45 |
$this->environment = $environment;
|
46 |
$this->location = $location;
|
@@ -66,7 +66,7 @@ class Rsc_Mvc_Module
|
|
66 |
|
67 |
/**
|
68 |
* Returns an instance of the current environment
|
69 |
-
* @return
|
70 |
*/
|
71 |
public function getEnvironment()
|
72 |
{
|
@@ -116,7 +116,7 @@ class Rsc_Mvc_Module
|
|
116 |
|
117 |
/**
|
118 |
* Returns an instance of controller
|
119 |
-
* @return null|
|
120 |
*/
|
121 |
public function getController()
|
122 |
{
|
@@ -129,7 +129,7 @@ class Rsc_Mvc_Module
|
|
129 |
|
130 |
/**
|
131 |
* Returns the HTTP request to the module
|
132 |
-
* @return
|
133 |
*/
|
134 |
public function getRequest()
|
135 |
{
|
@@ -138,10 +138,10 @@ class Rsc_Mvc_Module
|
|
138 |
|
139 |
/**
|
140 |
* Set HTTP request to the module
|
141 |
-
* @param
|
142 |
-
* @return
|
143 |
*/
|
144 |
-
public function setRequest(
|
145 |
{
|
146 |
$this->request = $request;
|
147 |
return $this;
|
@@ -171,7 +171,7 @@ class Rsc_Mvc_Module
|
|
171 |
|
172 |
$twig = $this->environment->getTwig();
|
173 |
|
174 |
-
return
|
175 |
'controller' => $this->getModuleName(),
|
176 |
'action' => $action,
|
177 |
)));
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Mvc_Module
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Environment
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
20 |
private $namespace;
|
21 |
|
22 |
/**
|
23 |
+
* @var RscDtgs_Http_Request
|
24 |
*/
|
25 |
private $request;
|
26 |
|
27 |
/**
|
28 |
+
* @var RscDtgs_Mvc_Controller
|
29 |
*/
|
30 |
private $controller;
|
31 |
|
36 |
|
37 |
/**
|
38 |
* Constructor.
|
39 |
+
* @param RscDtgs_Environment $environment An instance of the current environment
|
40 |
* @param string $location Full path to the directory where is module
|
41 |
* @param string $namespace Module prefix
|
42 |
*/
|
43 |
+
public function __construct(RscDtgs_Environment $environment, $location, $namespace)
|
44 |
{
|
45 |
$this->environment = $environment;
|
46 |
$this->location = $location;
|
66 |
|
67 |
/**
|
68 |
* Returns an instance of the current environment
|
69 |
+
* @return RscDtgs_Environment
|
70 |
*/
|
71 |
public function getEnvironment()
|
72 |
{
|
116 |
|
117 |
/**
|
118 |
* Returns an instance of controller
|
119 |
+
* @return null|RscDtgs_Mvc_Controller
|
120 |
*/
|
121 |
public function getController()
|
122 |
{
|
129 |
|
130 |
/**
|
131 |
* Returns the HTTP request to the module
|
132 |
+
* @return RscDtgs_Http_Request
|
133 |
*/
|
134 |
public function getRequest()
|
135 |
{
|
138 |
|
139 |
/**
|
140 |
* Set HTTP request to the module
|
141 |
+
* @param RscDtgs_Http_Request $request HTTP request
|
142 |
+
* @return RscDtgs_Mvc_Module
|
143 |
*/
|
144 |
+
public function setRequest(RscDtgs_Http_Request $request)
|
145 |
{
|
146 |
$this->request = $request;
|
147 |
return $this;
|
171 |
|
172 |
$twig = $this->environment->getTwig();
|
173 |
|
174 |
+
return RscDtgs_Http_Response::create()->setContent($twig->render('404.twig', array(
|
175 |
'controller' => $this->getModuleName(),
|
176 |
'action' => $action,
|
177 |
)));
|
vendor/Rsc/Profiler.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Profiler
|
5 |
{
|
6 |
|
7 |
|
vendor/Rsc/Resolver.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
class
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
12 |
/**
|
13 |
-
* @var
|
14 |
*/
|
15 |
protected $modules;
|
16 |
|
17 |
/**
|
18 |
-
* @var
|
19 |
*/
|
20 |
protected $request;
|
21 |
|
@@ -31,19 +31,19 @@ class Rsc_Resolver
|
|
31 |
|
32 |
/**
|
33 |
* Constructor
|
34 |
-
* @param
|
35 |
*/
|
36 |
-
public function __construct(
|
37 |
{
|
38 |
$this->environment = $environment;
|
39 |
-
$this->modules = new
|
40 |
-
$this->request = new
|
41 |
$this->routes = array();
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
* Returns an instance of environment
|
46 |
-
* @return
|
47 |
*/
|
48 |
public function getEnvironment()
|
49 |
{
|
@@ -52,7 +52,7 @@ class Rsc_Resolver
|
|
52 |
|
53 |
/**
|
54 |
* Returns the collection of the found modules
|
55 |
-
* @return
|
56 |
*/
|
57 |
public function getModules()
|
58 |
{
|
@@ -62,7 +62,7 @@ class Rsc_Resolver
|
|
62 |
public function setModules($modules)
|
63 |
{
|
64 |
if (is_array($modules)) {
|
65 |
-
$modules = new
|
66 |
}
|
67 |
|
68 |
$this->modules = $modules;
|
@@ -81,7 +81,7 @@ class Rsc_Resolver
|
|
81 |
{
|
82 |
$modules = $this->getModulesList();
|
83 |
|
84 |
-
/** @var
|
85 |
foreach ($modules as $name => $module) {
|
86 |
$module->onInstall();
|
87 |
}
|
@@ -97,7 +97,7 @@ class Rsc_Resolver
|
|
97 |
|
98 |
$modules = $this->getModulesList();
|
99 |
|
100 |
-
/** @var
|
101 |
foreach ($modules as $name => $instance) {
|
102 |
/* Set http request to the module */
|
103 |
$instance->setRequest($this->request)->onInit();
|
@@ -114,7 +114,7 @@ class Rsc_Resolver
|
|
114 |
|
115 |
/* We add module's location to the template & config loaders */
|
116 |
|
117 |
-
/** @var
|
118 |
try {
|
119 |
$loader = $this->environment->getTwig()->getLoader();
|
120 |
$loader->addPath($instance->getLocation() . '/views', strtolower($name));
|
@@ -135,7 +135,7 @@ class Rsc_Resolver
|
|
135 |
do_action($actionName);
|
136 |
}
|
137 |
}
|
138 |
-
} catch (
|
139 |
|
140 |
$configLoader = $config->getLoader();
|
141 |
$configLoader->add($instance->getLocation() . '/configs', strtolower($name));
|
@@ -200,7 +200,7 @@ class Rsc_Resolver
|
|
200 |
|
201 |
try {
|
202 |
$twig->addPath($location . '/views', $name . '_pro');
|
203 |
-
} catch (
|
204 |
// Do nothing. Path does not exists.
|
205 |
}
|
206 |
|
@@ -222,7 +222,7 @@ class Rsc_Resolver
|
|
222 |
if (in_array($query->get('page'), array_keys($this->routes))) {
|
223 |
$name = $this->routes[$query->get('page')];
|
224 |
} else {
|
225 |
-
/** @var
|
226 |
$name = $query->get('module', $this->environment->getConfig()->get('default_module'));
|
227 |
}
|
228 |
|
@@ -230,10 +230,10 @@ class Rsc_Resolver
|
|
230 |
wp_die ('The module that you requested is not found');
|
231 |
}
|
232 |
|
233 |
-
/** @var
|
234 |
$response = $module = $this->modules->get(strtolower($name))->setRequest($this->request)->handle();
|
235 |
|
236 |
-
if (!is_object($response) || !$response instanceof
|
237 |
wp_die ('The controller must return the response');
|
238 |
}
|
239 |
|
@@ -286,7 +286,7 @@ class Rsc_Resolver
|
|
286 |
}
|
287 |
}
|
288 |
|
289 |
-
$this->modulesList = new
|
290 |
}
|
291 |
|
292 |
return $this->modulesList;
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
class RscDtgs_Resolver
|
5 |
{
|
6 |
|
7 |
/**
|
8 |
+
* @var RscDtgs_Environment
|
9 |
*/
|
10 |
private $environment;
|
11 |
|
12 |
/**
|
13 |
+
* @var RscDtgs_Common_Collection
|
14 |
*/
|
15 |
protected $modules;
|
16 |
|
17 |
/**
|
18 |
+
* @var RscDtgs_Http_Request
|
19 |
*/
|
20 |
protected $request;
|
21 |
|
31 |
|
32 |
/**
|
33 |
* Constructor
|
34 |
+
* @param RscDtgs_Environment $environment An instance of current environment
|
35 |
*/
|
36 |
+
public function __construct(RscDtgs_Environment $environment)
|
37 |
{
|
38 |
$this->environment = $environment;
|
39 |
+
$this->modules = new RscDtgs_Common_Collection();
|
40 |
+
$this->request = new RscDtgs_Http_Request();
|
41 |
$this->routes = array();
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
* Returns an instance of environment
|
46 |
+
* @return RscDtgs_Environment
|
47 |
*/
|
48 |
public function getEnvironment()
|
49 |
{
|
52 |
|
53 |
/**
|
54 |
* Returns the collection of the found modules
|
55 |
+
* @return RscDtgs_Common_Collection
|
56 |
*/
|
57 |
public function getModules()
|
58 |
{
|
62 |
public function setModules($modules)
|
63 |
{
|
64 |
if (is_array($modules)) {
|
65 |
+
$modules = new RscDtgs_Common_Collection($modules);
|
66 |
}
|
67 |
|
68 |
$this->modules = $modules;
|
81 |
{
|
82 |
$modules = $this->getModulesList();
|
83 |
|
84 |
+
/** @var RscDtgs_Mvc_Module $module */
|
85 |
foreach ($modules as $name => $module) {
|
86 |
$module->onInstall();
|
87 |
}
|
97 |
|
98 |
$modules = $this->getModulesList();
|
99 |
|
100 |
+
/** @var RscDtgs_Mvc_Module $instance */
|
101 |
foreach ($modules as $name => $instance) {
|
102 |
/* Set http request to the module */
|
103 |
$instance->setRequest($this->request)->onInit();
|
114 |
|
115 |
/* We add module's location to the template & config loaders */
|
116 |
|
117 |
+
/** @var Twig_SupTwgDtgs_Loader_Filesystem $loader */
|
118 |
try {
|
119 |
$loader = $this->environment->getTwig()->getLoader();
|
120 |
$loader->addPath($instance->getLocation() . '/views', strtolower($name));
|
135 |
do_action($actionName);
|
136 |
}
|
137 |
}
|
138 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) { }
|
139 |
|
140 |
$configLoader = $config->getLoader();
|
141 |
$configLoader->add($instance->getLocation() . '/configs', strtolower($name));
|
200 |
|
201 |
try {
|
202 |
$twig->addPath($location . '/views', $name . '_pro');
|
203 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
204 |
// Do nothing. Path does not exists.
|
205 |
}
|
206 |
|
222 |
if (in_array($query->get('page'), array_keys($this->routes))) {
|
223 |
$name = $this->routes[$query->get('page')];
|
224 |
} else {
|
225 |
+
/** @var RscDtgs_Mvc_Module $module */
|
226 |
$name = $query->get('module', $this->environment->getConfig()->get('default_module'));
|
227 |
}
|
228 |
|
230 |
wp_die ('The module that you requested is not found');
|
231 |
}
|
232 |
|
233 |
+
/** @var RscDtgs_Http_Response $response */
|
234 |
$response = $module = $this->modules->get(strtolower($name))->setRequest($this->request)->handle();
|
235 |
|
236 |
+
if (!is_object($response) || !$response instanceof RscDtgs_Http_Response) {
|
237 |
wp_die ('The controller must return the response');
|
238 |
}
|
239 |
|
286 |
}
|
287 |
}
|
288 |
|
289 |
+
$this->modulesList = new RscDtgs_Common_Collection($modulesList);
|
290 |
}
|
291 |
|
292 |
return $this->modulesList;
|
vendor/Twig/Autoloader.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
|
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
|
22 |
{
|
23 |
/**
|
24 |
-
* Registers
|
25 |
*
|
26 |
* @param bool $prepend whether to prepend the autoloader or not
|
27 |
*/
|
28 |
public static function register($prepend = false)
|
29 |
{
|
30 |
-
|
31 |
|
32 |
if (PHP_VERSION_ID < 50300) {
|
33 |
spl_autoload_register(array(__CLASS__, 'autoload'));
|
@@ -43,7 +43,7 @@ class Twig_SupTwg_Autoloader
|
|
43 |
*/
|
44 |
public static function autoload($class)
|
45 |
{
|
46 |
-
if (0 !== strpos($class, '
|
47 |
return;
|
48 |
}
|
49 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_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_SupTwgDtgs_Autoloader
|
22 |
{
|
23 |
/**
|
24 |
+
* Registers Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs')) {
|
47 |
return;
|
48 |
}
|
49 |
|
vendor/Twig/BaseNodeVisitor.php
CHANGED
@@ -10,25 +10,25 @@
|
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
-
abstract class
|
18 |
{
|
19 |
-
final public function enterNode(
|
20 |
{
|
21 |
-
if (!$node instanceof
|
22 |
-
throw new LogicException('
|
23 |
}
|
24 |
|
25 |
return $this->doEnterNode($node, $env);
|
26 |
}
|
27 |
|
28 |
-
final public function leaveNode(
|
29 |
{
|
30 |
-
if (!$node instanceof
|
31 |
-
throw new LogicException('
|
32 |
}
|
33 |
|
34 |
return $this->doLeaveNode($node, $env);
|
@@ -37,14 +37,14 @@ abstract class Twig_SupTwg_BaseNodeVisitor implements Twig_SupTwg_NodeVisitorInt
|
|
37 |
/**
|
38 |
* Called before child nodes are visited.
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
-
abstract protected function doEnterNode(
|
43 |
|
44 |
/**
|
45 |
* Called after child nodes are visited.
|
46 |
*
|
47 |
-
* @return
|
48 |
*/
|
49 |
-
abstract protected function doLeaveNode(
|
50 |
}
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_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_SupTwgDtgs_BaseNodeVisitor implements Twig_SupTwgDtgs_NodeVisitorInterface
|
18 |
{
|
19 |
+
final public function enterNode(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
20 |
{
|
21 |
+
if (!$node instanceof Twig_SupTwgDtgs_Node) {
|
22 |
+
throw new LogicException('Twig_SupTwgDtgs_BaseNodeVisitor only supports Twig_SupTwgDtgs_Node instances.');
|
23 |
}
|
24 |
|
25 |
return $this->doEnterNode($node, $env);
|
26 |
}
|
27 |
|
28 |
+
final public function leaveNode(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
29 |
{
|
30 |
+
if (!$node instanceof Twig_SupTwgDtgs_Node) {
|
31 |
+
throw new LogicException('Twig_SupTwgDtgs_BaseNodeVisitor only supports Twig_SupTwgDtgs_Node instances.');
|
32 |
}
|
33 |
|
34 |
return $this->doLeaveNode($node, $env);
|
37 |
/**
|
38 |
* Called before child nodes are visited.
|
39 |
*
|
40 |
+
* @return Twig_SupTwgDtgs_Node The modified node
|
41 |
*/
|
42 |
+
abstract protected function doEnterNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env);
|
43 |
|
44 |
/**
|
45 |
* Called after child nodes are visited.
|
46 |
*
|
47 |
+
* @return Twig_SupTwgDtgs_Node|false The modified node or false if the node must be removed
|
48 |
*/
|
49 |
+
abstract protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env);
|
50 |
}
|
vendor/Twig/Cache/Filesystem.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @author Andrew Tch <andrew@noop.lv>
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
const FORCE_BYTECODE_INVALIDATION = 1;
|
20 |
|
14 |
*
|
15 |
* @author Andrew Tch <andrew@noop.lv>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Cache_Filesystem implements Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
public function generateKey($name, $className)
|
22 |
{
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_Cache_Null implements Twig_SupTwgDtgs_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
|
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_SupTwgDtgs_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
|
19 |
{
|
20 |
protected $lastLine;
|
21 |
protected $source;
|
@@ -26,7 +26,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
26 |
protected $sourceLine;
|
27 |
protected $filename;
|
28 |
|
29 |
-
public function __construct(
|
30 |
{
|
31 |
$this->env = $env;
|
32 |
}
|
@@ -36,7 +36,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
36 |
*/
|
37 |
public function getFilename()
|
38 |
{
|
39 |
-
|
40 |
|
41 |
return $this->filename;
|
42 |
}
|
@@ -44,7 +44,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
44 |
/**
|
45 |
* Returns the environment instance related to this compiler.
|
46 |
*
|
47 |
-
* @return
|
48 |
*/
|
49 |
public function getEnvironment()
|
50 |
{
|
@@ -64,12 +64,12 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
64 |
/**
|
65 |
* Compiles a node.
|
66 |
*
|
67 |
-
* @param
|
68 |
* @param int $indentation The current indentation
|
69 |
*
|
70 |
* @return $this
|
71 |
*/
|
72 |
-
public function compile(
|
73 |
{
|
74 |
$this->lastLine = null;
|
75 |
$this->source = '';
|
@@ -79,7 +79,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
79 |
$this->sourceLine = 1;
|
80 |
$this->indentation = $indentation;
|
81 |
|
82 |
-
if ($node instanceof
|
83 |
// to be removed in 2.0
|
84 |
$this->filename = $node->getTemplateName();
|
85 |
}
|
@@ -89,7 +89,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
89 |
return $this;
|
90 |
}
|
91 |
|
92 |
-
public function subcompile(
|
93 |
{
|
94 |
if (false === $raw) {
|
95 |
$this->source .= str_repeat(' ', $this->indentation * 4);
|
@@ -138,7 +138,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
138 |
*/
|
139 |
public function addIndentation()
|
140 |
{
|
141 |
-
|
142 |
|
143 |
$this->source .= str_repeat(' ', $this->indentation * 4);
|
144 |
|
@@ -207,7 +207,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
207 |
*
|
208 |
* @return $this
|
209 |
*/
|
210 |
-
public function addDebugInfo(
|
211 |
{
|
212 |
if ($node->getTemplateLine() != $this->lastLine) {
|
213 |
$this->write(sprintf("// line %d\n", $node->getTemplateLine()));
|
@@ -216,7 +216,7 @@ class Twig_SupTwg_Compiler implements Twig_SupTwg_CompilerInterface
|
|
216 |
// mb_substr_count() replaces substr_count()
|
217 |
// but they have different signatures!
|
218 |
if (((int) ini_get('mbstring.func_overload')) & 2) {
|
219 |
-
|
220 |
|
221 |
// this is much slower than the "right" version
|
222 |
$this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n");
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Compiler implements Twig_SupTwgDtgs_CompilerInterface
|
19 |
{
|
20 |
protected $lastLine;
|
21 |
protected $source;
|
26 |
protected $sourceLine;
|
27 |
protected $filename;
|
28 |
|
29 |
+
public function __construct(Twig_SupTwgDtgs_Environment $env)
|
30 |
{
|
31 |
$this->env = $env;
|
32 |
}
|
36 |
*/
|
37 |
public function getFilename()
|
38 |
{
|
39 |
+
//@trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
|
40 |
|
41 |
return $this->filename;
|
42 |
}
|
44 |
/**
|
45 |
* Returns the environment instance related to this compiler.
|
46 |
*
|
47 |
+
* @return Twig_SupTwgDtgs_Environment
|
48 |
*/
|
49 |
public function getEnvironment()
|
50 |
{
|
64 |
/**
|
65 |
* Compiles a node.
|
66 |
*
|
67 |
+
* @param Twig_SupTwgDtgs_NodeInterface $node The node to compile
|
68 |
* @param int $indentation The current indentation
|
69 |
*
|
70 |
* @return $this
|
71 |
*/
|
72 |
+
public function compile(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_NodeInterface $node, $raw = true)
|
93 |
{
|
94 |
if (false === $raw) {
|
95 |
$this->source .= str_repeat(' ', $this->indentation * 4);
|
138 |
*/
|
139 |
public function addIndentation()
|
140 |
{
|
141 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use write(\'\') instead.', E_USER_DEPRECATED);
|
142 |
|
143 |
$this->source .= str_repeat(' ', $this->indentation * 4);
|
144 |
|
207 |
*
|
208 |
* @return $this
|
209 |
*/
|
210 |
+
public function addDebugInfo(Twig_SupTwgDtgs_NodeInterface $node)
|
211 |
{
|
212 |
if ($node->getTemplateLine() != $this->lastLine) {
|
213 |
$this->write(sprintf("// line %d\n", $node->getTemplateLine()));
|
216 |
// mb_substr_count() replaces substr_count()
|
217 |
// but they have different signatures!
|
218 |
if (((int) ini_get('mbstring.func_overload')) & 2) {
|
219 |
+
//@trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED);
|
220 |
|
221 |
// this is much slower than the "right" version
|
222 |
$this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n");
|
vendor/Twig/CompilerInterface.php
CHANGED
@@ -16,14 +16,14 @@
|
|
16 |
*
|
17 |
* @deprecated since 1.12 (to be removed in 3.0)
|
18 |
*/
|
19 |
-
interface
|
20 |
{
|
21 |
/**
|
22 |
* Compiles a node.
|
23 |
*
|
24 |
* @return $this
|
25 |
*/
|
26 |
-
public function compile(
|
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_SupTwgDtgs_CompilerInterface
|
20 |
{
|
21 |
/**
|
22 |
* Compiles a node.
|
23 |
*
|
24 |
* @return $this
|
25 |
*/
|
26 |
+
public function compile(Twig_SupTwgDtgs_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
|
23 |
{
|
24 |
private $container;
|
25 |
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
* @author Robin Chalas <robin.chalas@gmail.com>
|
21 |
*/
|
22 |
+
class Twig_SupTwgDtgs_ContainerRuntimeLoader implements Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
const VERSION = '1.33.2';
|
20 |
const VERSION_ID = 13302;
|
@@ -70,10 +70,10 @@ class Twig_SupTwg_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
|
74 |
*
|
75 |
* * cache: An absolute path where to store the compiled templates,
|
76 |
-
* a
|
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_SupTwg_Environment
|
|
94 |
* (default to -1 which means that all optimizations are enabled;
|
95 |
* set it to 0 to disable).
|
96 |
*
|
97 |
-
* @param
|
98 |
* @param array $options An array of options
|
99 |
*/
|
100 |
-
public function __construct(
|
101 |
{
|
102 |
if (null !== $loader) {
|
103 |
$this->setLoader($loader);
|
104 |
} else {
|
105 |
-
|
106 |
}
|
107 |
|
108 |
$options = array_merge(array(
|
109 |
'debug' => false,
|
110 |
'charset' => 'UTF-8',
|
111 |
-
'base_template_class' => '
|
112 |
'strict_variables' => false,
|
113 |
'autoescape' => 'html',
|
114 |
'cache' => false,
|
@@ -123,23 +123,23 @@ class Twig_SupTwg_Environment
|
|
123 |
$this->strictVariables = (bool) $options['strict_variables'];
|
124 |
$this->setCache($options['cache']);
|
125 |
|
126 |
-
$this->addExtension(new
|
127 |
-
$this->addExtension(new
|
128 |
-
$this->addExtension(new
|
129 |
-
$this->staging = new
|
130 |
|
131 |
// For BC
|
132 |
if (is_string($this->originalCache)) {
|
133 |
$r = new ReflectionMethod($this, 'writeCacheFile');
|
134 |
if ($r->getDeclaringClass()->getName() !== __CLASS__) {
|
135 |
-
|
136 |
|
137 |
$this->bcWriteCacheFile = true;
|
138 |
}
|
139 |
|
140 |
$r = new ReflectionMethod($this, 'getCacheFilename');
|
141 |
if ($r->getDeclaringClass()->getName() !== __CLASS__) {
|
142 |
-
|
143 |
|
144 |
$this->bcGetCacheFilename = true;
|
145 |
}
|
@@ -254,7 +254,7 @@ class Twig_SupTwg_Environment
|
|
254 |
*
|
255 |
* @param bool $original Whether to return the original cache option or the real cache instance
|
256 |
*
|
257 |
-
* @return
|
258 |
* an absolute path to the compiled templates,
|
259 |
* or false to disable cache
|
260 |
*/
|
@@ -266,7 +266,7 @@ class Twig_SupTwg_Environment
|
|
266 |
/**
|
267 |
* Sets the current cache implementation.
|
268 |
*
|
269 |
-
* @param
|
270 |
* an absolute path to the compiled templates,
|
271 |
* or false to disable cache
|
272 |
*/
|
@@ -274,18 +274,18 @@ class Twig_SupTwg_Environment
|
|
274 |
{
|
275 |
if (is_string($cache)) {
|
276 |
$this->originalCache = $cache;
|
277 |
-
$this->cache = new
|
278 |
} elseif (false === $cache) {
|
279 |
$this->originalCache = $cache;
|
280 |
-
$this->cache = new
|
281 |
} elseif (null === $cache) {
|
282 |
-
|
283 |
$this->originalCache = false;
|
284 |
-
$this->cache = new
|
285 |
-
} elseif ($cache instanceof
|
286 |
$this->originalCache = $this->cache = $cache;
|
287 |
} else {
|
288 |
-
throw new LogicException(sprintf('Cache can only be a string, false, or a
|
289 |
}
|
290 |
}
|
291 |
|
@@ -300,7 +300,7 @@ class Twig_SupTwg_Environment
|
|
300 |
*/
|
301 |
public function getCacheFilename($name)
|
302 |
{
|
303 |
-
|
304 |
|
305 |
$key = $this->cache->generateKey($name, $this->getTemplateClass($name));
|
306 |
|
@@ -340,7 +340,7 @@ class Twig_SupTwg_Environment
|
|
340 |
*/
|
341 |
public function getTemplateClassPrefix()
|
342 |
{
|
343 |
-
|
344 |
|
345 |
return $this->templateClassPrefix;
|
346 |
}
|
@@ -353,9 +353,9 @@ class Twig_SupTwg_Environment
|
|
353 |
*
|
354 |
* @return string The rendered template
|
355 |
*
|
356 |
-
* @throws
|
357 |
-
* @throws
|
358 |
-
* @throws
|
359 |
*/
|
360 |
public function render($name, array $context = array())
|
361 |
{
|
@@ -368,9 +368,9 @@ class Twig_SupTwg_Environment
|
|
368 |
* @param string $name The template name
|
369 |
* @param array $context An array of parameters to pass to the template
|
370 |
*
|
371 |
-
* @throws
|
372 |
-
* @throws
|
373 |
-
* @throws
|
374 |
*/
|
375 |
public function display($name, array $context = array())
|
376 |
{
|
@@ -380,21 +380,21 @@ class Twig_SupTwg_Environment
|
|
380 |
/**
|
381 |
* Loads a template.
|
382 |
*
|
383 |
-
* @param string|
|
384 |
*
|
385 |
-
* @return
|
386 |
*/
|
387 |
public function load($name)
|
388 |
{
|
389 |
-
if ($name instanceof
|
390 |
return $name;
|
391 |
}
|
392 |
|
393 |
-
if ($name instanceof
|
394 |
-
return new
|
395 |
}
|
396 |
|
397 |
-
return new
|
398 |
}
|
399 |
|
400 |
/**
|
@@ -406,11 +406,11 @@ class Twig_SupTwg_Environment
|
|
406 |
* @param string $name The template name
|
407 |
* @param int $index The index if it is an embedded template
|
408 |
*
|
409 |
-
* @return
|
410 |
*
|
411 |
-
* @throws
|
412 |
-
* @throws
|
413 |
-
* @throws
|
414 |
*
|
415 |
* @internal
|
416 |
*/
|
@@ -438,8 +438,8 @@ class Twig_SupTwg_Environment
|
|
438 |
|
439 |
if (!class_exists($cls, false)) {
|
440 |
$loader = $this->getLoader();
|
441 |
-
if (!$loader instanceof
|
442 |
-
$source = new
|
443 |
} else {
|
444 |
$source = $loader->getSourceContext($name);
|
445 |
}
|
@@ -464,7 +464,7 @@ class Twig_SupTwg_Environment
|
|
464 |
}
|
465 |
|
466 |
if (!class_exists($cls, false)) {
|
467 |
-
throw new
|
468 |
}
|
469 |
}
|
470 |
|
@@ -482,17 +482,17 @@ class Twig_SupTwg_Environment
|
|
482 |
*
|
483 |
* @param string $template The template name
|
484 |
*
|
485 |
-
* @return
|
486 |
*
|
487 |
-
* @throws
|
488 |
-
* @throws
|
489 |
*/
|
490 |
public function createTemplate($template)
|
491 |
{
|
492 |
$name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false));
|
493 |
|
494 |
-
$loader = new
|
495 |
-
new
|
496 |
$current = $this->getLoader(),
|
497 |
));
|
498 |
|
@@ -542,15 +542,15 @@ class Twig_SupTwg_Environment
|
|
542 |
/**
|
543 |
* Tries to load a template consecutively from an array.
|
544 |
*
|
545 |
-
* Similar to loadTemplate() but it also accepts
|
546 |
* of templates where each is tried to be loaded.
|
547 |
*
|
548 |
-
* @param string|
|
549 |
*
|
550 |
-
* @return
|
551 |
*
|
552 |
-
* @throws
|
553 |
-
* @throws
|
554 |
*/
|
555 |
public function resolveTemplate($names)
|
556 |
{
|
@@ -559,13 +559,13 @@ class Twig_SupTwg_Environment
|
|
559 |
}
|
560 |
|
561 |
foreach ($names as $name) {
|
562 |
-
if ($name instanceof
|
563 |
return $name;
|
564 |
}
|
565 |
|
566 |
try {
|
567 |
return $this->loadTemplate($name);
|
568 |
-
} catch (
|
569 |
}
|
570 |
}
|
571 |
|
@@ -573,7 +573,7 @@ class Twig_SupTwg_Environment
|
|
573 |
throw $e;
|
574 |
}
|
575 |
|
576 |
-
throw new
|
577 |
}
|
578 |
|
579 |
/**
|
@@ -583,7 +583,7 @@ class Twig_SupTwg_Environment
|
|
583 |
*/
|
584 |
public function clearTemplateCache()
|
585 |
{
|
586 |
-
|
587 |
|
588 |
$this->loadedTemplates = array();
|
589 |
}
|
@@ -595,7 +595,7 @@ class Twig_SupTwg_Environment
|
|
595 |
*/
|
596 |
public function clearCacheFiles()
|
597 |
{
|
598 |
-
|
599 |
|
600 |
if (is_string($this->originalCache)) {
|
601 |
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->originalCache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
|
@@ -609,22 +609,22 @@ class Twig_SupTwg_Environment
|
|
609 |
/**
|
610 |
* Gets the Lexer instance.
|
611 |
*
|
612 |
-
* @return
|
613 |
*
|
614 |
* @deprecated since 1.25 (to be removed in 2.0)
|
615 |
*/
|
616 |
public function getLexer()
|
617 |
{
|
618 |
-
|
619 |
|
620 |
if (null === $this->lexer) {
|
621 |
-
$this->lexer = new
|
622 |
}
|
623 |
|
624 |
return $this->lexer;
|
625 |
}
|
626 |
|
627 |
-
public function setLexer(
|
628 |
{
|
629 |
$this->lexer = $lexer;
|
630 |
}
|
@@ -632,22 +632,22 @@ class Twig_SupTwg_Environment
|
|
632 |
/**
|
633 |
* Tokenizes a source code.
|
634 |
*
|
635 |
-
* @param string|
|
636 |
* @param string $name The template name (deprecated)
|
637 |
*
|
638 |
-
* @return
|
639 |
*
|
640 |
-
* @throws
|
641 |
*/
|
642 |
public function tokenize($source, $name = null)
|
643 |
{
|
644 |
-
if (!$source instanceof
|
645 |
-
|
646 |
-
$source = new
|
647 |
}
|
648 |
|
649 |
if (null === $this->lexer) {
|
650 |
-
$this->lexer = new
|
651 |
}
|
652 |
|
653 |
return $this->lexer->tokenize($source);
|
@@ -656,22 +656,22 @@ class Twig_SupTwg_Environment
|
|
656 |
/**
|
657 |
* Gets the Parser instance.
|
658 |
*
|
659 |
-
* @return
|
660 |
*
|
661 |
* @deprecated since 1.25 (to be removed in 2.0)
|
662 |
*/
|
663 |
public function getParser()
|
664 |
{
|
665 |
-
|
666 |
|
667 |
if (null === $this->parser) {
|
668 |
-
$this->parser = new
|
669 |
}
|
670 |
|
671 |
return $this->parser;
|
672 |
}
|
673 |
|
674 |
-
public function setParser(
|
675 |
{
|
676 |
$this->parser = $parser;
|
677 |
}
|
@@ -679,14 +679,14 @@ class Twig_SupTwg_Environment
|
|
679 |
/**
|
680 |
* Converts a token stream to a node tree.
|
681 |
*
|
682 |
-
* @return
|
683 |
*
|
684 |
-
* @throws
|
685 |
*/
|
686 |
-
public function parse(
|
687 |
{
|
688 |
if (null === $this->parser) {
|
689 |
-
$this->parser = new
|
690 |
}
|
691 |
|
692 |
return $this->parser->parse($stream);
|
@@ -695,22 +695,22 @@ class Twig_SupTwg_Environment
|
|
695 |
/**
|
696 |
* Gets the Compiler instance.
|
697 |
*
|
698 |
-
* @return
|
699 |
*
|
700 |
* @deprecated since 1.25 (to be removed in 2.0)
|
701 |
*/
|
702 |
public function getCompiler()
|
703 |
{
|
704 |
-
|
705 |
|
706 |
if (null === $this->compiler) {
|
707 |
-
$this->compiler = new
|
708 |
}
|
709 |
|
710 |
return $this->compiler;
|
711 |
}
|
712 |
|
713 |
-
public function setCompiler(
|
714 |
{
|
715 |
$this->compiler = $compiler;
|
716 |
}
|
@@ -720,10 +720,10 @@ class Twig_SupTwg_Environment
|
|
720 |
*
|
721 |
* @return string The compiled PHP source code
|
722 |
*/
|
723 |
-
public function compile(
|
724 |
{
|
725 |
if (null === $this->compiler) {
|
726 |
-
$this->compiler = new
|
727 |
}
|
728 |
|
729 |
return $this->compiler->compile($node)->getSource();
|
@@ -732,34 +732,34 @@ class Twig_SupTwg_Environment
|
|
732 |
/**
|
733 |
* Compiles a template source code.
|
734 |
*
|
735 |
-
* @param string|
|
736 |
* @param string $name The template name (deprecated)
|
737 |
*
|
738 |
* @return string The compiled PHP source code
|
739 |
*
|
740 |
-
* @throws
|
741 |
*/
|
742 |
public function compileSource($source, $name = null)
|
743 |
{
|
744 |
-
if (!$source instanceof
|
745 |
-
|
746 |
-
$source = new
|
747 |
}
|
748 |
|
749 |
try {
|
750 |
return $this->compile($this->parse($this->tokenize($source)));
|
751 |
-
} catch (
|
752 |
$e->setSourceContext($source);
|
753 |
throw $e;
|
754 |
} catch (Exception $e) {
|
755 |
-
throw new
|
756 |
}
|
757 |
}
|
758 |
|
759 |
-
public function setLoader(
|
760 |
{
|
761 |
-
if (!$loader instanceof
|
762 |
-
|
763 |
}
|
764 |
|
765 |
$this->loader = $loader;
|
@@ -768,7 +768,7 @@ class Twig_SupTwg_Environment
|
|
768 |
/**
|
769 |
* Gets the Loader instance.
|
770 |
*
|
771 |
-
* @return
|
772 |
*/
|
773 |
public function getLoader()
|
774 |
{
|
@@ -809,11 +809,11 @@ class Twig_SupTwg_Environment
|
|
809 |
$this->runtimeInitialized = true;
|
810 |
|
811 |
foreach ($this->getExtensions() as $name => $extension) {
|
812 |
-
if (!$extension instanceof
|
813 |
$m = new ReflectionMethod($extension, 'initRuntime');
|
814 |
|
815 |
-
if ('
|
816 |
-
|
817 |
}
|
818 |
}
|
819 |
|
@@ -833,7 +833,7 @@ class Twig_SupTwg_Environment
|
|
833 |
$class = ltrim($class, '\\');
|
834 |
if (isset($this->extensions[$class])) {
|
835 |
if ($class !== get_class($this->extensions[$class])) {
|
836 |
-
|
837 |
}
|
838 |
|
839 |
return true;
|
@@ -845,7 +845,7 @@ class Twig_SupTwg_Environment
|
|
845 |
/**
|
846 |
* Adds a runtime loader.
|
847 |
*/
|
848 |
-
public function addRuntimeLoader(
|
849 |
{
|
850 |
$this->runtimeLoaders[] = $loader;
|
851 |
}
|
@@ -855,7 +855,7 @@ class Twig_SupTwg_Environment
|
|
855 |
*
|
856 |
* @param string $class The extension class name
|
857 |
*
|
858 |
-
* @return
|
859 |
*/
|
860 |
public function getExtension($class)
|
861 |
{
|
@@ -863,14 +863,14 @@ class Twig_SupTwg_Environment
|
|
863 |
|
864 |
if (isset($this->extensions[$class])) {
|
865 |
if ($class !== get_class($this->extensions[$class])) {
|
866 |
-
|
867 |
}
|
868 |
|
869 |
return $this->extensions[$class];
|
870 |
}
|
871 |
|
872 |
if (!isset($this->extensionsByClass[$class])) {
|
873 |
-
throw new
|
874 |
}
|
875 |
|
876 |
return $this->extensionsByClass[$class];
|
@@ -883,7 +883,7 @@ class Twig_SupTwg_Environment
|
|
883 |
*
|
884 |
* @return object The runtime implementation
|
885 |
*
|
886 |
-
* @throws
|
887 |
*/
|
888 |
public function getRuntime($class)
|
889 |
{
|
@@ -897,10 +897,10 @@ class Twig_SupTwg_Environment
|
|
897 |
}
|
898 |
}
|
899 |
|
900 |
-
throw new
|
901 |
}
|
902 |
|
903 |
-
public function addExtension(
|
904 |
{
|
905 |
if ($this->extensionInitialized) {
|
906 |
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
|
@@ -910,7 +910,7 @@ class Twig_SupTwg_Environment
|
|
910 |
if ($class !== $extension->getName()) {
|
911 |
if (isset($this->extensions[$extension->getName()])) {
|
912 |
unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]);
|
913 |
-
|
914 |
}
|
915 |
}
|
916 |
|
@@ -931,7 +931,7 @@ class Twig_SupTwg_Environment
|
|
931 |
*/
|
932 |
public function removeExtension($name)
|
933 |
{
|
934 |
-
|
935 |
|
936 |
if ($this->extensionInitialized) {
|
937 |
throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
|
@@ -940,7 +940,7 @@ class Twig_SupTwg_Environment
|
|
940 |
$class = ltrim($name, '\\');
|
941 |
if (isset($this->extensions[$class])) {
|
942 |
if ($class !== get_class($this->extensions[$class])) {
|
943 |
-
|
944 |
}
|
945 |
|
946 |
unset($this->extensions[$class]);
|
@@ -965,14 +965,14 @@ class Twig_SupTwg_Environment
|
|
965 |
/**
|
966 |
* Returns all registered extensions.
|
967 |
*
|
968 |
-
* @return
|
969 |
*/
|
970 |
public function getExtensions()
|
971 |
{
|
972 |
return $this->extensions;
|
973 |
}
|
974 |
|
975 |
-
public function addTokenParser(
|
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_SupTwg_Environment
|
|
984 |
/**
|
985 |
* Gets the registered Token Parsers.
|
986 |
*
|
987 |
-
* @return
|
988 |
*
|
989 |
* @internal
|
990 |
*/
|
@@ -1000,9 +1000,9 @@ class Twig_SupTwg_Environment
|
|
1000 |
/**
|
1001 |
* Gets registered tags.
|
1002 |
*
|
1003 |
-
* Be warned that this method cannot return tags defined by
|
1004 |
*
|
1005 |
-
* @return
|
1006 |
*
|
1007 |
* @internal
|
1008 |
*/
|
@@ -1010,7 +1010,7 @@ class Twig_SupTwg_Environment
|
|
1010 |
{
|
1011 |
$tags = array();
|
1012 |
foreach ($this->getTokenParsers()->getParsers() as $parser) {
|
1013 |
-
if ($parser instanceof
|
1014 |
$tags[$parser->getTag()] = $parser;
|
1015 |
}
|
1016 |
}
|
@@ -1018,7 +1018,7 @@ class Twig_SupTwg_Environment
|
|
1018 |
return $tags;
|
1019 |
}
|
1020 |
|
1021 |
-
public function addNodeVisitor(
|
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_SupTwg_Environment
|
|
1030 |
/**
|
1031 |
* Gets the registered Node Visitors.
|
1032 |
*
|
1033 |
-
* @return
|
1034 |
*
|
1035 |
* @internal
|
1036 |
*/
|
@@ -1046,20 +1046,20 @@ class Twig_SupTwg_Environment
|
|
1046 |
/**
|
1047 |
* Registers a Filter.
|
1048 |
*
|
1049 |
-
* @param string|
|
1050 |
-
* @param
|
1051 |
*/
|
1052 |
public function addFilter($name, $filter = null)
|
1053 |
{
|
1054 |
-
if (!$name instanceof
|
1055 |
-
throw new LogicException('A filter must be an instance of
|
1056 |
}
|
1057 |
|
1058 |
-
if ($name instanceof
|
1059 |
$filter = $name;
|
1060 |
$name = $filter->getName();
|
1061 |
} else {
|
1062 |
-
|
1063 |
}
|
1064 |
|
1065 |
if ($this->extensionInitialized) {
|
@@ -1077,7 +1077,7 @@ class Twig_SupTwg_Environment
|
|
1077 |
*
|
1078 |
* @param string $name The filter name
|
1079 |
*
|
1080 |
-
* @return
|
1081 |
*
|
1082 |
* @internal
|
1083 |
*/
|
@@ -1123,7 +1123,7 @@ class Twig_SupTwg_Environment
|
|
1123 |
*
|
1124 |
* Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
|
1125 |
*
|
1126 |
-
* @return
|
1127 |
*
|
1128 |
* @see registerUndefinedFilterCallback
|
1129 |
*
|
@@ -1141,20 +1141,20 @@ class Twig_SupTwg_Environment
|
|
1141 |
/**
|
1142 |
* Registers a Test.
|
1143 |
*
|
1144 |
-
* @param string|
|
1145 |
-
* @param
|
1146 |
*/
|
1147 |
public function addTest($name, $test = null)
|
1148 |
{
|
1149 |
-
if (!$name instanceof
|
1150 |
-
throw new LogicException('A test must be an instance of
|
1151 |
}
|
1152 |
|
1153 |
-
if ($name instanceof
|
1154 |
$test = $name;
|
1155 |
$name = $test->getName();
|
1156 |
} else {
|
1157 |
-
|
1158 |
}
|
1159 |
|
1160 |
if ($this->extensionInitialized) {
|
@@ -1167,7 +1167,7 @@ class Twig_SupTwg_Environment
|
|
1167 |
/**
|
1168 |
* Gets the registered Tests.
|
1169 |
*
|
1170 |
-
* @return
|
1171 |
*
|
1172 |
* @internal
|
1173 |
*/
|
@@ -1185,7 +1185,7 @@ class Twig_SupTwg_Environment
|
|
1185 |
*
|
1186 |
* @param string $name The test name
|
1187 |
*
|
1188 |
-
* @return
|
1189 |
*
|
1190 |
* @internal
|
1191 |
*/
|
@@ -1205,20 +1205,20 @@ class Twig_SupTwg_Environment
|
|
1205 |
/**
|
1206 |
* Registers a Function.
|
1207 |
*
|
1208 |
-
* @param string|
|
1209 |
-
* @param
|
1210 |
*/
|
1211 |
public function addFunction($name, $function = null)
|
1212 |
{
|
1213 |
-
if (!$name instanceof
|
1214 |
-
throw new LogicException('A function must be an instance of
|
1215 |
}
|
1216 |
|
1217 |
-
if ($name instanceof
|
1218 |
$function = $name;
|
1219 |
$name = $function->getName();
|
1220 |
} else {
|
1221 |
-
|
1222 |
}
|
1223 |
|
1224 |
if ($this->extensionInitialized) {
|
@@ -1236,7 +1236,7 @@ class Twig_SupTwg_Environment
|
|
1236 |
*
|
1237 |
* @param string $name function name
|
1238 |
*
|
1239 |
-
* @return
|
1240 |
*
|
1241 |
* @internal
|
1242 |
*/
|
@@ -1282,7 +1282,7 @@ class Twig_SupTwg_Environment
|
|
1282 |
*
|
1283 |
* Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
|
1284 |
*
|
1285 |
-
* @return
|
1286 |
*
|
1287 |
* @see registerUndefinedFunctionCallback
|
1288 |
*
|
@@ -1315,7 +1315,7 @@ class Twig_SupTwg_Environment
|
|
1315 |
|
1316 |
if (!array_key_exists($name, $this->globals)) {
|
1317 |
// The deprecation notice must be turned into the following exception in Twig 2.0
|
1318 |
-
|
1319 |
//throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
|
1320 |
}
|
1321 |
}
|
@@ -1405,9 +1405,9 @@ class Twig_SupTwg_Environment
|
|
1405 |
*/
|
1406 |
public function computeAlternatives($name, $items)
|
1407 |
{
|
1408 |
-
|
1409 |
|
1410 |
-
return
|
1411 |
}
|
1412 |
|
1413 |
/**
|
@@ -1417,11 +1417,11 @@ class Twig_SupTwg_Environment
|
|
1417 |
{
|
1418 |
$globals = array();
|
1419 |
foreach ($this->extensions as $name => $extension) {
|
1420 |
-
if (!$extension instanceof
|
1421 |
$m = new ReflectionMethod($extension, 'getGlobals');
|
1422 |
|
1423 |
-
if ('
|
1424 |
-
|
1425 |
}
|
1426 |
}
|
1427 |
|
@@ -1447,7 +1447,7 @@ class Twig_SupTwg_Environment
|
|
1447 |
return;
|
1448 |
}
|
1449 |
|
1450 |
-
$this->parsers = new
|
1451 |
$this->filters = array();
|
1452 |
$this->functions = array();
|
1453 |
$this->tests = array();
|
@@ -1466,14 +1466,14 @@ class Twig_SupTwg_Environment
|
|
1466 |
/**
|
1467 |
* @internal
|
1468 |
*/
|
1469 |
-
protected function initExtension(
|
1470 |
{
|
1471 |
// filters
|
1472 |
foreach ($extension->getFilters() as $name => $filter) {
|
1473 |
-
if ($filter instanceof
|
1474 |
$name = $filter->getName();
|
1475 |
} else {
|
1476 |
-
|
1477 |
}
|
1478 |
|
1479 |
$this->filters[$name] = $filter;
|
@@ -1481,10 +1481,10 @@ class Twig_SupTwg_Environment
|
|
1481 |
|
1482 |
// functions
|
1483 |
foreach ($extension->getFunctions() as $name => $function) {
|
1484 |
-
if ($function instanceof
|
1485 |
$name = $function->getName();
|
1486 |
} else {
|
1487 |
-
|
1488 |
}
|
1489 |
|
1490 |
$this->functions[$name] = $function;
|
@@ -1492,10 +1492,10 @@ class Twig_SupTwg_Environment
|
|
1492 |
|
1493 |
// tests
|
1494 |
foreach ($extension->getTests() as $name => $test) {
|
1495 |
-
if ($test instanceof
|
1496 |
$name = $test->getName();
|
1497 |
} else {
|
1498 |
-
|
1499 |
}
|
1500 |
|
1501 |
$this->tests[$name] = $test;
|
@@ -1503,14 +1503,14 @@ class Twig_SupTwg_Environment
|
|
1503 |
|
1504 |
// token parsers
|
1505 |
foreach ($extension->getTokenParsers() as $parser) {
|
1506 |
-
if ($parser instanceof
|
1507 |
$this->parsers->addTokenParser($parser);
|
1508 |
-
} elseif ($parser instanceof
|
1509 |
-
|
1510 |
|
1511 |
$this->parsers->addTokenParserBroker($parser);
|
1512 |
} else {
|
1513 |
-
throw new LogicException('getTokenParsers() must return an array of
|
1514 |
}
|
1515 |
}
|
1516 |
|
@@ -1547,7 +1547,7 @@ class Twig_SupTwg_Environment
|
|
1547 |
$hashParts = array_merge(
|
1548 |
array_keys($this->extensions),
|
1549 |
array(
|
1550 |
-
(int) function_exists('
|
1551 |
PHP_MAJOR_VERSION,
|
1552 |
PHP_MINOR_VERSION,
|
1553 |
self::VERSION,
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_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_SupTwgDtgs_Template).
|
74 |
*
|
75 |
* * cache: An absolute path where to store the compiled templates,
|
76 |
+
* a Twig_SupTwgDtgs_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_SupTwgDtgs_LoaderInterface $loader
|
98 |
* @param array $options An array of options
|
99 |
*/
|
100 |
+
public function __construct(Twig_SupTwgDtgs_LoaderInterface $loader = null, $options = array())
|
101 |
{
|
102 |
if (null !== $loader) {
|
103 |
$this->setLoader($loader);
|
104 |
} else {
|
105 |
+
//@trigger_error('Not passing a Twig_SupTwgDtgs_LoaderInterface as the first constructor argument of Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Extension_Core());
|
127 |
+
$this->addExtension(new Twig_SupTwgDtgs_Extension_Escaper($options['autoescape']));
|
128 |
+
$this->addExtension(new Twig_SupTwgDtgs_Extension_Optimizer($options['optimizations']));
|
129 |
+
$this->staging = new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_CacheInterface|string|false A Twig_SupTwgDtgs_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_SupTwgDtgs_CacheInterface|string|false $cache A Twig_SupTwgDtgs_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_SupTwgDtgs_Cache_Filesystem($cache);
|
278 |
} elseif (false === $cache) {
|
279 |
$this->originalCache = $cache;
|
280 |
+
$this->cache = new Twig_SupTwgDtgs_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_SupTwgDtgs_Cache_Null();
|
285 |
+
} elseif ($cache instanceof Twig_SupTwgDtgs_CacheInterface) {
|
286 |
$this->originalCache = $this->cache = $cache;
|
287 |
} else {
|
288 |
+
throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_SupTwgDtgs_CacheInterface implementation.'));
|
289 |
}
|
290 |
}
|
291 |
|
300 |
*/
|
301 |
public function getCacheFilename($name)
|
302 |
{
|
303 |
+
//@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
|
304 |
|
305 |
$key = $this->cache->generateKey($name, $this->getTemplateClass($name));
|
306 |
|
340 |
*/
|
341 |
public function getTemplateClassPrefix()
|
342 |
{
|
343 |
+
//@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
|
344 |
|
345 |
return $this->templateClassPrefix;
|
346 |
}
|
353 |
*
|
354 |
* @return string The rendered template
|
355 |
*
|
356 |
+
* @throws Twig_SupTwgDtgs_Error_Loader When the template cannot be found
|
357 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax When an error occurred during compilation
|
358 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Loader When the template cannot be found
|
372 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax When an error occurred during compilation
|
373 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_TemplateWrapper|Twig_SupTwgDtgs_Template $name The template name
|
384 |
*
|
385 |
+
* @return Twig_SupTwgDtgs_TemplateWrapper
|
386 |
*/
|
387 |
public function load($name)
|
388 |
{
|
389 |
+
if ($name instanceof Twig_SupTwgDtgs_TemplateWrapper) {
|
390 |
return $name;
|
391 |
}
|
392 |
|
393 |
+
if ($name instanceof Twig_SupTwgDtgs_Template) {
|
394 |
+
return new Twig_SupTwgDtgs_TemplateWrapper($this, $name);
|
395 |
}
|
396 |
|
397 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_TemplateInterface A template instance representing the given template name
|
410 |
*
|
411 |
+
* @throws Twig_SupTwgDtgs_Error_Loader When the template cannot be found
|
412 |
+
* @throws Twig_SupTwgDtgs_Error_Runtime When a previously generated cache is corrupted
|
413 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_SourceContextLoaderInterface) {
|
442 |
+
$source = new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Template A template instance representing the given template name
|
486 |
*
|
487 |
+
* @throws Twig_SupTwgDtgs_Error_Loader When the template cannot be found
|
488 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_Loader_Chain(array(
|
495 |
+
new Twig_SupTwgDtgs_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_SupTwgDtgs_TemplateInterface instances and an array
|
546 |
* of templates where each is tried to be loaded.
|
547 |
*
|
548 |
+
* @param string|Twig_SupTwgDtgs_Template|array $names A template or an array of templates to try consecutively
|
549 |
*
|
550 |
+
* @return Twig_SupTwgDtgs_Template
|
551 |
*
|
552 |
+
* @throws Twig_SupTwgDtgs_Error_Loader When none of the templates can be found
|
553 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_Template) {
|
563 |
return $name;
|
564 |
}
|
565 |
|
566 |
try {
|
567 |
return $this->loadTemplate($name);
|
568 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
569 |
}
|
570 |
}
|
571 |
|
573 |
throw $e;
|
574 |
}
|
575 |
|
576 |
+
throw new Twig_SupTwgDtgs_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
|
577 |
}
|
578 |
|
579 |
/**
|
583 |
*/
|
584 |
public function clearTemplateCache()
|
585 |
{
|
586 |
+
//@trigger_error(sprintf('The %s method is deprecated since version 1.18.3 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
|
587 |
|
588 |
$this->loadedTemplates = array();
|
589 |
}
|
595 |
*/
|
596 |
public function clearCacheFiles()
|
597 |
{
|
598 |
+
//@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
|
599 |
|
600 |
if (is_string($this->originalCache)) {
|
601 |
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->originalCache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
|
609 |
/**
|
610 |
* Gets the Lexer instance.
|
611 |
*
|
612 |
+
* @return Twig_SupTwgDtgs_LexerInterface
|
613 |
*
|
614 |
* @deprecated since 1.25 (to be removed in 2.0)
|
615 |
*/
|
616 |
public function getLexer()
|
617 |
{
|
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_SupTwgDtgs_Lexer($this);
|
622 |
}
|
623 |
|
624 |
return $this->lexer;
|
625 |
}
|
626 |
|
627 |
+
public function setLexer(Twig_SupTwgDtgs_LexerInterface $lexer)
|
628 |
{
|
629 |
$this->lexer = $lexer;
|
630 |
}
|
632 |
/**
|
633 |
* Tokenizes a source code.
|
634 |
*
|
635 |
+
* @param string|Twig_SupTwgDtgs_Source $source The template source code
|
636 |
* @param string $name The template name (deprecated)
|
637 |
*
|
638 |
+
* @return Twig_SupTwgDtgs_TokenStream
|
639 |
*
|
640 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax When the code is syntactically wrong
|
641 |
*/
|
642 |
public function tokenize($source, $name = null)
|
643 |
{
|
644 |
+
if (!$source instanceof Twig_SupTwgDtgs_Source) {
|
645 |
+
//@trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwgDtgs_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
646 |
+
$source = new Twig_SupTwgDtgs_Source($source, $name);
|
647 |
}
|
648 |
|
649 |
if (null === $this->lexer) {
|
650 |
+
$this->lexer = new Twig_SupTwgDtgs_Lexer($this);
|
651 |
}
|
652 |
|
653 |
return $this->lexer->tokenize($source);
|
656 |
/**
|
657 |
* Gets the Parser instance.
|
658 |
*
|
659 |
+
* @return Twig_SupTwgDtgs_ParserInterface
|
660 |
*
|
661 |
* @deprecated since 1.25 (to be removed in 2.0)
|
662 |
*/
|
663 |
public function getParser()
|
664 |
{
|
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_SupTwgDtgs_Parser($this);
|
669 |
}
|
670 |
|
671 |
return $this->parser;
|
672 |
}
|
673 |
|
674 |
+
public function setParser(Twig_SupTwgDtgs_ParserInterface $parser)
|
675 |
{
|
676 |
$this->parser = $parser;
|
677 |
}
|
679 |
/**
|
680 |
* Converts a token stream to a node tree.
|
681 |
*
|
682 |
+
* @return Twig_SupTwgDtgs_Node_Module
|
683 |
*
|
684 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax When the token stream is syntactically or semantically wrong
|
685 |
*/
|
686 |
+
public function parse(Twig_SupTwgDtgs_TokenStream $stream)
|
687 |
{
|
688 |
if (null === $this->parser) {
|
689 |
+
$this->parser = new Twig_SupTwgDtgs_Parser($this);
|
690 |
}
|
691 |
|
692 |
return $this->parser->parse($stream);
|
695 |
/**
|
696 |
* Gets the Compiler instance.
|
697 |
*
|
698 |
+
* @return Twig_SupTwgDtgs_CompilerInterface
|
699 |
*
|
700 |
* @deprecated since 1.25 (to be removed in 2.0)
|
701 |
*/
|
702 |
public function getCompiler()
|
703 |
{
|
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_SupTwgDtgs_Compiler($this);
|
708 |
}
|
709 |
|
710 |
return $this->compiler;
|
711 |
}
|
712 |
|
713 |
+
public function setCompiler(Twig_SupTwgDtgs_CompilerInterface $compiler)
|
714 |
{
|
715 |
$this->compiler = $compiler;
|
716 |
}
|
720 |
*
|
721 |
* @return string The compiled PHP source code
|
722 |
*/
|
723 |
+
public function compile(Twig_SupTwgDtgs_NodeInterface $node)
|
724 |
{
|
725 |
if (null === $this->compiler) {
|
726 |
+
$this->compiler = new Twig_SupTwgDtgs_Compiler($this);
|
727 |
}
|
728 |
|
729 |
return $this->compiler->compile($node)->getSource();
|
732 |
/**
|
733 |
* Compiles a template source code.
|
734 |
*
|
735 |
+
* @param string|Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Source) {
|
745 |
+
//@trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwgDtgs_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
746 |
+
$source = new Twig_SupTwgDtgs_Source($source, $name);
|
747 |
}
|
748 |
|
749 |
try {
|
750 |
return $this->compile($this->parse($this->tokenize($source)));
|
751 |
+
} catch (Twig_SupTwgDtgs_Error $e) {
|
752 |
$e->setSourceContext($source);
|
753 |
throw $e;
|
754 |
} catch (Exception $e) {
|
755 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_LoaderInterface $loader)
|
760 |
{
|
761 |
+
if (!$loader instanceof Twig_SupTwgDtgs_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_SupTwgDtgs_LoaderInterface')) {
|
762 |
+
//@trigger_error(sprintf('Twig loader "%s" should implement Twig_SupTwgDtgs_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_SupTwgDtgs_LoaderInterface
|
772 |
*/
|
773 |
public function getLoader()
|
774 |
{
|
809 |
$this->runtimeInitialized = true;
|
810 |
|
811 |
foreach ($this->getExtensions() as $name => $extension) {
|
812 |
+
if (!$extension instanceof Twig_SupTwgDtgs_Extension_InitRuntimeInterface) {
|
813 |
$m = new ReflectionMethod($extension, 'initRuntime');
|
814 |
|
815 |
+
if ('Twig_SupTwgDtgs_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_SupTwgDtgs_Environment instance in filters, functions, or tests; or explicitly implement Twig_SupTwgDtgs_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
|
817 |
}
|
818 |
}
|
819 |
|
833 |
$class = ltrim($class, '\\');
|
834 |
if (isset($this->extensions[$class])) {
|
835 |
if ($class !== get_class($this->extensions[$class])) {
|
836 |
+
//@trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
|
837 |
}
|
838 |
|
839 |
return true;
|
845 |
/**
|
846 |
* Adds a runtime loader.
|
847 |
*/
|
848 |
+
public function addRuntimeLoader(Twig_SupTwgDtgs_RuntimeLoaderInterface $loader)
|
849 |
{
|
850 |
$this->runtimeLoaders[] = $loader;
|
851 |
}
|
855 |
*
|
856 |
* @param string $class The extension class name
|
857 |
*
|
858 |
+
* @return Twig_SupTwgDtgs_ExtensionInterface
|
859 |
*/
|
860 |
public function getExtension($class)
|
861 |
{
|
863 |
|
864 |
if (isset($this->extensions[$class])) {
|
865 |
if ($class !== get_class($this->extensions[$class])) {
|
866 |
+
//@trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
|
867 |
}
|
868 |
|
869 |
return $this->extensions[$class];
|
870 |
}
|
871 |
|
872 |
if (!isset($this->extensionsByClass[$class])) {
|
873 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Runtime When the template cannot be found
|
887 |
*/
|
888 |
public function getRuntime($class)
|
889 |
{
|
897 |
}
|
898 |
}
|
899 |
|
900 |
+
throw new Twig_SupTwgDtgs_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
|
901 |
}
|
902 |
|
903 |
+
public function addExtension(Twig_SupTwgDtgs_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()));
|
910 |
if ($class !== $extension->getName()) {
|
911 |
if (isset($this->extensions[$extension->getName()])) {
|
912 |
unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]);
|
913 |
+
//@trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $extension->getName()), E_USER_DEPRECATED);
|
914 |
}
|
915 |
}
|
916 |
|
931 |
*/
|
932 |
public function removeExtension($name)
|
933 |
{
|
934 |
+
//@trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
|
935 |
|
936 |
if ($this->extensionInitialized) {
|
937 |
throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
|
940 |
$class = ltrim($name, '\\');
|
941 |
if (isset($this->extensions[$class])) {
|
942 |
if ($class !== get_class($this->extensions[$class])) {
|
943 |
+
//@trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
|
944 |
}
|
945 |
|
946 |
unset($this->extensions[$class]);
|
965 |
/**
|
966 |
* Returns all registered extensions.
|
967 |
*
|
968 |
+
* @return Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_TokenParserBrokerInterface
|
988 |
*
|
989 |
* @internal
|
990 |
*/
|
1000 |
/**
|
1001 |
* Gets registered tags.
|
1002 |
*
|
1003 |
+
* Be warned that this method cannot return tags defined by Twig_SupTwgDtgs_TokenParserBrokerInterface classes.
|
1004 |
*
|
1005 |
+
* @return Twig_SupTwgDtgs_TokenParserInterface[]
|
1006 |
*
|
1007 |
* @internal
|
1008 |
*/
|
1010 |
{
|
1011 |
$tags = array();
|
1012 |
foreach ($this->getTokenParsers()->getParsers() as $parser) {
|
1013 |
+
if ($parser instanceof Twig_SupTwgDtgs_TokenParserInterface) {
|
1014 |
$tags[$parser->getTag()] = $parser;
|
1015 |
}
|
1016 |
}
|
1018 |
return $tags;
|
1019 |
}
|
1020 |
|
1021 |
+
public function addNodeVisitor(Twig_SupTwgDtgs_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_SupTwgDtgs_NodeVisitorInterface[]
|
1034 |
*
|
1035 |
* @internal
|
1036 |
*/
|
1046 |
/**
|
1047 |
* Registers a Filter.
|
1048 |
*
|
1049 |
+
* @param string|Twig_SupTwgDtgs_SimpleFilter $name The filter name or a Twig_SupTwgDtgs_SimpleFilter instance
|
1050 |
+
* @param Twig_SupTwgDtgs_FilterInterface|Twig_SupTwgDtgs_SimpleFilter $filter
|
1051 |
*/
|
1052 |
public function addFilter($name, $filter = null)
|
1053 |
{
|
1054 |
+
if (!$name instanceof Twig_SupTwgDtgs_SimpleFilter && !($filter instanceof Twig_SupTwgDtgs_SimpleFilter || $filter instanceof Twig_SupTwgDtgs_FilterInterface)) {
|
1055 |
+
throw new LogicException('A filter must be an instance of Twig_SupTwgDtgs_FilterInterface or Twig_SupTwgDtgs_SimpleFilter.');
|
1056 |
}
|
1057 |
|
1058 |
+
if ($name instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Filter|false A Twig_SupTwgDtgs_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_SupTwgDtgs_FilterInterface[]
|
1127 |
*
|
1128 |
* @see registerUndefinedFilterCallback
|
1129 |
*
|
1141 |
/**
|
1142 |
* Registers a Test.
|
1143 |
*
|
1144 |
+
* @param string|Twig_SupTwgDtgs_SimpleTest $name The test name or a Twig_SupTwgDtgs_SimpleTest instance
|
1145 |
+
* @param Twig_SupTwgDtgs_TestInterface|Twig_SupTwgDtgs_SimpleTest $test A Twig_SupTwgDtgs_TestInterface instance or a Twig_SupTwgDtgs_SimpleTest instance
|
1146 |
*/
|
1147 |
public function addTest($name, $test = null)
|
1148 |
{
|
1149 |
+
if (!$name instanceof Twig_SupTwgDtgs_SimpleTest && !($test instanceof Twig_SupTwgDtgs_SimpleTest || $test instanceof Twig_SupTwgDtgs_TestInterface)) {
|
1150 |
+
throw new LogicException('A test must be an instance of Twig_SupTwgDtgs_TestInterface or Twig_SupTwgDtgs_SimpleTest.');
|
1151 |
}
|
1152 |
|
1153 |
+
if ($name instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_TestInterface[]
|
1171 |
*
|
1172 |
* @internal
|
1173 |
*/
|
1185 |
*
|
1186 |
* @param string $name The test name
|
1187 |
*
|
1188 |
+
* @return Twig_SupTwgDtgs_Test|false A Twig_SupTwgDtgs_Test instance or false if the test does not exist
|
1189 |
*
|
1190 |
* @internal
|
1191 |
*/
|
1205 |
/**
|
1206 |
* Registers a Function.
|
1207 |
*
|
1208 |
+
* @param string|Twig_SupTwgDtgs_SimpleFunction $name The function name or a Twig_SupTwgDtgs_SimpleFunction instance
|
1209 |
+
* @param Twig_SupTwgDtgs_FunctionInterface|Twig_SupTwgDtgs_SimpleFunction $function
|
1210 |
*/
|
1211 |
public function addFunction($name, $function = null)
|
1212 |
{
|
1213 |
+
if (!$name instanceof Twig_SupTwgDtgs_SimpleFunction && !($function instanceof Twig_SupTwgDtgs_SimpleFunction || $function instanceof Twig_SupTwgDtgs_FunctionInterface)) {
|
1214 |
+
throw new LogicException('A function must be an instance of Twig_SupTwgDtgs_FunctionInterface or Twig_SupTwgDtgs_SimpleFunction.');
|
1215 |
}
|
1216 |
|
1217 |
+
if ($name instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Function|false A Twig_SupTwgDtgs_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_SupTwgDtgs_FunctionInterface[]
|
1286 |
*
|
1287 |
* @see registerUndefinedFunctionCallback
|
1288 |
*
|
1315 |
|
1316 |
if (!array_key_exists($name, $this->globals)) {
|
1317 |
// The deprecation notice must be turned into the following exception in Twig 2.0
|
1318 |
+
//@trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated since version 1.21.', $name), E_USER_DEPRECATED);
|
1319 |
//throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
|
1320 |
}
|
1321 |
}
|
1405 |
*/
|
1406 |
public function computeAlternatives($name, $items)
|
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_SupTwgDtgs_Error_Syntax::computeAlternatives($name, $items);
|
1411 |
}
|
1412 |
|
1413 |
/**
|
1417 |
{
|
1418 |
$globals = array();
|
1419 |
foreach ($this->extensions as $name => $extension) {
|
1420 |
+
if (!$extension instanceof Twig_SupTwgDtgs_Extension_GlobalsInterface) {
|
1421 |
$m = new ReflectionMethod($extension, 'getGlobals');
|
1422 |
|
1423 |
+
if ('Twig_SupTwgDtgs_Extension' !== $m->getDeclaringClass()->getName()) {
|
1424 |
+
//@trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_SupTwgDtgs_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED);
|
1425 |
}
|
1426 |
}
|
1427 |
|
1447 |
return;
|
1448 |
}
|
1449 |
|
1450 |
+
$this->parsers = new Twig_SupTwgDtgs_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_SupTwgDtgs_ExtensionInterface $extension)
|
1470 |
{
|
1471 |
// filters
|
1472 |
foreach ($extension->getFilters() as $name => $filter) {
|
1473 |
+
if ($filter instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_TokenParserInterface) {
|
1507 |
$this->parsers->addTokenParser($parser);
|
1508 |
+
} elseif ($parser instanceof Twig_SupTwgDtgs_TokenParserBrokerInterface) {
|
1509 |
+
//@trigger_error('Registering a Twig_SupTwgDtgs_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_SupTwgDtgs_TokenParserInterface or Twig_SupTwgDtgs_TokenParserBrokerInterface instances.');
|
1514 |
}
|
1515 |
}
|
1516 |
|
1547 |
$hashParts = array_merge(
|
1548 |
array_keys($this->extensions),
|
1549 |
array(
|
1550 |
+
(int) function_exists('Twig_SupTwgDtgs_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
|
35 |
{
|
36 |
protected $lineno;
|
37 |
// to be renamed to name in 2.0
|
@@ -56,14 +56,14 @@ class Twig_SupTwg_Error extends Exception
|
|
56 |
*
|
57 |
* @param string $message The error message
|
58 |
* @param int $lineno The template line where the error occurred
|
59 |
-
* @param
|
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
|
67 |
// for compat with the Twig C ext., passing the template name as string is accepted
|
68 |
$name = $source;
|
69 |
} else {
|
@@ -109,7 +109,7 @@ class Twig_SupTwg_Error extends Exception
|
|
109 |
*/
|
110 |
public function getTemplateFile()
|
111 |
{
|
112 |
-
|
113 |
|
114 |
return $this->filename;
|
115 |
}
|
@@ -123,7 +123,7 @@ class Twig_SupTwg_Error extends Exception
|
|
123 |
*/
|
124 |
public function setTemplateFile($name)
|
125 |
{
|
126 |
-
|
127 |
|
128 |
$this->filename = $name;
|
129 |
|
@@ -139,7 +139,7 @@ class Twig_SupTwg_Error extends Exception
|
|
139 |
*/
|
140 |
public function getTemplateName()
|
141 |
{
|
142 |
-
|
143 |
|
144 |
return $this->filename;
|
145 |
}
|
@@ -153,7 +153,7 @@ class Twig_SupTwg_Error extends Exception
|
|
153 |
*/
|
154 |
public function setTemplateName($name)
|
155 |
{
|
156 |
-
|
157 |
|
158 |
$this->filename = $name;
|
159 |
$this->sourceCode = $this->sourcePath = null;
|
@@ -186,17 +186,17 @@ class Twig_SupTwg_Error extends Exception
|
|
186 |
/**
|
187 |
* Gets the source context of the Twig template where the error occurred.
|
188 |
*
|
189 |
-
* @return
|
190 |
*/
|
191 |
public function getSourceContext()
|
192 |
{
|
193 |
-
return $this->filename ? new
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
* Sets the source context of the Twig template where the error occurred.
|
198 |
*/
|
199 |
-
public function setSourceContext(
|
200 |
{
|
201 |
if (null === $source) {
|
202 |
$this->sourceCode = $this->filename = $this->sourcePath = null;
|
@@ -231,7 +231,7 @@ class Twig_SupTwg_Error extends Exception
|
|
231 |
return $this->previous;
|
232 |
}
|
233 |
|
234 |
-
throw new BadMethodCallException(sprintf('Method "
|
235 |
}
|
236 |
|
237 |
public function appendMessage($rawMessage)
|
@@ -303,7 +303,7 @@ class Twig_SupTwg_Error extends Exception
|
|
303 |
}
|
304 |
|
305 |
foreach ($backtrace as $trace) {
|
306 |
-
if (isset($trace['object']) && $trace['object'] instanceof
|
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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Source) {
|
67 |
// for compat with the Twig C ext., passing the template name as string is accepted
|
68 |
$name = $source;
|
69 |
} else {
|
109 |
*/
|
110 |
public function getTemplateFile()
|
111 |
{
|
112 |
+
//@trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
113 |
|
114 |
return $this->filename;
|
115 |
}
|
123 |
*/
|
124 |
public function setTemplateFile($name)
|
125 |
{
|
126 |
+
//@trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
127 |
|
128 |
$this->filename = $name;
|
129 |
|
139 |
*/
|
140 |
public function getTemplateName()
|
141 |
{
|
142 |
+
//@trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
143 |
|
144 |
return $this->filename;
|
145 |
}
|
153 |
*/
|
154 |
public function setTemplateName($name)
|
155 |
{
|
156 |
+
//@trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
157 |
|
158 |
$this->filename = $name;
|
159 |
$this->sourceCode = $this->sourcePath = null;
|
186 |
/**
|
187 |
* Gets the source context of the Twig template where the error occurred.
|
188 |
*
|
189 |
+
* @return Twig_SupTwgDtgs_Source|null
|
190 |
*/
|
191 |
public function getSourceContext()
|
192 |
{
|
193 |
+
return $this->filename ? new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Template && 'Twig_SupTwgDtgs_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 |
-
*
|
20 |
*
|
21 |
-
* This strategy makes
|
22 |
*
|
23 |
* @author Fabien Potencier <fabien@symfony.com>
|
24 |
*/
|
25 |
-
class
|
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_SupTwgDtgs_Template::displayWithErrorHandling().
|
20 |
*
|
21 |
+
* This strategy makes Twig_SupTwgDtgs_Environment::resolveTemplate() much faster.
|
22 |
*
|
23 |
* @author Fabien Potencier <fabien@symfony.com>
|
24 |
*/
|
25 |
+
class Twig_SupTwgDtgs_Error_Loader extends Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
}
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Error_Runtime extends Twig_SupTwgDtgs_Error
|
19 |
{
|
20 |
}
|
vendor/Twig/Error/Syntax.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
-
class
|
19 |
{
|
20 |
/**
|
21 |
* Tweaks the error message to include suggestions.
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Error_Syntax extends Twig_SupTwgDtgs_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
|
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_SupTwgDtgs_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
|
26 |
{
|
27 |
const OPERATOR_LEFT = 1;
|
28 |
const OPERATOR_RIGHT = 2;
|
@@ -33,16 +33,16 @@ class Twig_SupTwg_ExpressionParser
|
|
33 |
|
34 |
private $env;
|
35 |
|
36 |
-
public function __construct(
|
37 |
{
|
38 |
$this->parser = $parser;
|
39 |
|
40 |
-
if ($env instanceof
|
41 |
$this->env = $env;
|
42 |
$this->unaryOperators = $env->getUnaryOperators();
|
43 |
$this->binaryOperators = $env->getBinaryOperators();
|
44 |
} else {
|
45 |
-
|
46 |
|
47 |
$this->env = $parser->getEnvironment();
|
48 |
$this->unaryOperators = func_get_arg(1);
|
@@ -91,10 +91,10 @@ class Twig_SupTwg_ExpressionParser
|
|
91 |
$class = $operator['class'];
|
92 |
|
93 |
return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
|
94 |
-
} elseif ($token->test(
|
95 |
$this->parser->getStream()->next();
|
96 |
$expr = $this->parseExpression();
|
97 |
-
$this->parser->getStream()->expect(
|
98 |
|
99 |
return $this->parsePostfixExpression($expr);
|
100 |
}
|
@@ -104,92 +104,92 @@ class Twig_SupTwg_ExpressionParser
|
|
104 |
|
105 |
protected function parseConditionalExpression($expr)
|
106 |
{
|
107 |
-
while ($this->parser->getStream()->nextIf(
|
108 |
-
if (!$this->parser->getStream()->nextIf(
|
109 |
$expr2 = $this->parseExpression();
|
110 |
-
if ($this->parser->getStream()->nextIf(
|
111 |
$expr3 = $this->parseExpression();
|
112 |
} else {
|
113 |
-
$expr3 = new
|
114 |
}
|
115 |
} else {
|
116 |
$expr2 = $expr;
|
117 |
$expr3 = $this->parseExpression();
|
118 |
}
|
119 |
|
120 |
-
$expr = new
|
121 |
}
|
122 |
|
123 |
return $expr;
|
124 |
}
|
125 |
|
126 |
-
protected function isUnary(
|
127 |
{
|
128 |
-
return $token->test(
|
129 |
}
|
130 |
|
131 |
-
protected function isBinary(
|
132 |
{
|
133 |
-
return $token->test(
|
134 |
}
|
135 |
|
136 |
public function parsePrimaryExpression()
|
137 |
{
|
138 |
$token = $this->parser->getCurrentToken();
|
139 |
switch ($token->getType()) {
|
140 |
-
case
|
141 |
$this->parser->getStream()->next();
|
142 |
switch ($token->getValue()) {
|
143 |
case 'true':
|
144 |
case 'TRUE':
|
145 |
-
$node = new
|
146 |
break;
|
147 |
|
148 |
case 'false':
|
149 |
case 'FALSE':
|
150 |
-
$node = new
|
151 |
break;
|
152 |
|
153 |
case 'none':
|
154 |
case 'NONE':
|
155 |
case 'null':
|
156 |
case 'NULL':
|
157 |
-
$node = new
|
158 |
break;
|
159 |
|
160 |
default:
|
161 |
if ('(' === $this->parser->getCurrentToken()->getValue()) {
|
162 |
$node = $this->getFunctionNode($token->getValue(), $token->getLine());
|
163 |
} else {
|
164 |
-
$node = new
|
165 |
}
|
166 |
}
|
167 |
break;
|
168 |
|
169 |
-
case
|
170 |
$this->parser->getStream()->next();
|
171 |
-
$node = new
|
172 |
break;
|
173 |
|
174 |
-
case
|
175 |
-
case
|
176 |
$node = $this->parseStringExpression();
|
177 |
break;
|
178 |
|
179 |
-
case
|
180 |
-
if (preg_match(
|
181 |
// in this context, string operators are variable names
|
182 |
$this->parser->getStream()->next();
|
183 |
-
$node = new
|
184 |
break;
|
185 |
} elseif (isset($this->unaryOperators[$token->getValue()])) {
|
186 |
$class = $this->unaryOperators[$token->getValue()]['class'];
|
187 |
|
188 |
$ref = new ReflectionClass($class);
|
189 |
-
$negClass = '
|
190 |
-
$posClass = '
|
191 |
if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) {
|
192 |
-
throw new
|
193 |
}
|
194 |
|
195 |
$this->parser->getStream()->next();
|
@@ -200,12 +200,12 @@ class Twig_SupTwg_ExpressionParser
|
|
200 |
}
|
201 |
|
202 |
default:
|
203 |
-
if ($token->test(
|
204 |
$node = $this->parseArrayExpression();
|
205 |
-
} elseif ($token->test(
|
206 |
$node = $this->parseHashExpression();
|
207 |
} else {
|
208 |
-
throw new
|
209 |
}
|
210 |
}
|
211 |
|
@@ -220,12 +220,12 @@ class Twig_SupTwg_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(
|
224 |
-
$nodes[] = new
|
225 |
$nextCanBeString = false;
|
226 |
-
} elseif ($stream->nextIf(
|
227 |
$nodes[] = $this->parseExpression();
|
228 |
-
$stream->expect(
|
229 |
$nextCanBeString = true;
|
230 |
} else {
|
231 |
break;
|
@@ -234,7 +234,7 @@ class Twig_SupTwg_ExpressionParser
|
|
234 |
|
235 |
$expr = array_shift($nodes);
|
236 |
foreach ($nodes as $node) {
|
237 |
-
$expr = new
|
238 |
}
|
239 |
|
240 |
return $expr;
|
@@ -243,16 +243,16 @@ class Twig_SupTwg_ExpressionParser
|
|
243 |
public function parseArrayExpression()
|
244 |
{
|
245 |
$stream = $this->parser->getStream();
|
246 |
-
$stream->expect(
|
247 |
|
248 |
-
$node = new
|
249 |
$first = true;
|
250 |
-
while (!$stream->test(
|
251 |
if (!$first) {
|
252 |
-
$stream->expect(
|
253 |
|
254 |
// trailing ,?
|
255 |
-
if ($stream->test(
|
256 |
break;
|
257 |
}
|
258 |
}
|
@@ -260,7 +260,7 @@ class Twig_SupTwg_ExpressionParser
|
|
260 |
|
261 |
$node->addElement($this->parseExpression());
|
262 |
}
|
263 |
-
$stream->expect(
|
264 |
|
265 |
return $node;
|
266 |
}
|
@@ -268,16 +268,16 @@ class Twig_SupTwg_ExpressionParser
|
|
268 |
public function parseHashExpression()
|
269 |
{
|
270 |
$stream = $this->parser->getStream();
|
271 |
-
$stream->expect(
|
272 |
|
273 |
-
$node = new
|
274 |
$first = true;
|
275 |
-
while (!$stream->test(
|
276 |
if (!$first) {
|
277 |
-
$stream->expect(
|
278 |
|
279 |
// trailing ,?
|
280 |
-
if ($stream->test(
|
281 |
break;
|
282 |
}
|
283 |
}
|
@@ -289,22 +289,22 @@ class Twig_SupTwg_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(
|
293 |
-
$key = new
|
294 |
-
} elseif ($stream->test(
|
295 |
$key = $this->parseExpression();
|
296 |
} else {
|
297 |
$current = $stream->getCurrent();
|
298 |
|
299 |
-
throw new
|
300 |
}
|
301 |
|
302 |
-
$stream->expect(
|
303 |
$value = $this->parseExpression();
|
304 |
|
305 |
$node->addElement($value, $key);
|
306 |
}
|
307 |
-
$stream->expect(
|
308 |
|
309 |
return $node;
|
310 |
}
|
@@ -313,7 +313,7 @@ class Twig_SupTwg_ExpressionParser
|
|
313 |
{
|
314 |
while (true) {
|
315 |
$token = $this->parser->getCurrentToken();
|
316 |
-
if ($token->getType() ==
|
317 |
if ('.' == $token->getValue() || '[' == $token->getValue()) {
|
318 |
$node = $this->parseSubscriptExpression($node);
|
319 |
} elseif ('|' == $token->getValue()) {
|
@@ -335,36 +335,36 @@ class Twig_SupTwg_ExpressionParser
|
|
335 |
case 'parent':
|
336 |
$this->parseArguments();
|
337 |
if (!count($this->parser->getBlockStack())) {
|
338 |
-
throw new
|
339 |
}
|
340 |
|
341 |
if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
|
342 |
-
throw new
|
343 |
}
|
344 |
|
345 |
-
return new
|
346 |
case 'block':
|
347 |
$args = $this->parseArguments();
|
348 |
if (count($args) < 1) {
|
349 |
-
throw new
|
350 |
}
|
351 |
|
352 |
-
return new
|
353 |
case 'attribute':
|
354 |
$args = $this->parseArguments();
|
355 |
if (count($args) < 2) {
|
356 |
-
throw new
|
357 |
}
|
358 |
|
359 |
-
return new
|
360 |
default:
|
361 |
if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) {
|
362 |
-
$arguments = new
|
363 |
foreach ($this->parseArguments() as $n) {
|
364 |
$arguments->addElement($n);
|
365 |
}
|
366 |
|
367 |
-
$node = new
|
368 |
$node->setAttribute('safe', true);
|
369 |
|
370 |
return $node;
|
@@ -382,81 +382,81 @@ class Twig_SupTwg_ExpressionParser
|
|
382 |
$stream = $this->parser->getStream();
|
383 |
$token = $stream->next();
|
384 |
$lineno = $token->getLine();
|
385 |
-
$arguments = new
|
386 |
-
$type =
|
387 |
if ($token->getValue() == '.') {
|
388 |
$token = $stream->next();
|
389 |
if (
|
390 |
-
$token->getType() ==
|
391 |
||
|
392 |
-
$token->getType() ==
|
393 |
||
|
394 |
-
($token->getType() ==
|
395 |
) {
|
396 |
-
$arg = new
|
397 |
|
398 |
-
if ($stream->test(
|
399 |
-
$type =
|
400 |
foreach ($this->parseArguments() as $n) {
|
401 |
$arguments->addElement($n);
|
402 |
}
|
403 |
}
|
404 |
} else {
|
405 |
-
throw new
|
406 |
}
|
407 |
|
408 |
-
if ($node instanceof
|
409 |
-
if (!$arg instanceof
|
410 |
-
throw new
|
411 |
}
|
412 |
|
413 |
$name = $arg->getAttribute('value');
|
414 |
|
415 |
if ($this->parser->isReservedMacroName($name)) {
|
416 |
-
throw new
|
417 |
}
|
418 |
|
419 |
-
$node = new
|
420 |
$node->setAttribute('safe', true);
|
421 |
|
422 |
return $node;
|
423 |
}
|
424 |
} else {
|
425 |
-
$type =
|
426 |
|
427 |
// slice?
|
428 |
$slice = false;
|
429 |
-
if ($stream->test(
|
430 |
$slice = true;
|
431 |
-
$arg = new
|
432 |
} else {
|
433 |
$arg = $this->parseExpression();
|
434 |
}
|
435 |
|
436 |
-
if ($stream->nextIf(
|
437 |
$slice = true;
|
438 |
}
|
439 |
|
440 |
if ($slice) {
|
441 |
-
if ($stream->test(
|
442 |
-
$length = new
|
443 |
} else {
|
444 |
$length = $this->parseExpression();
|
445 |
}
|
446 |
|
447 |
$class = $this->getFilterNodeClass('slice', $token->getLine());
|
448 |
-
$arguments = new
|
449 |
-
$filter = new $class($node, new
|
450 |
|
451 |
-
$stream->expect(
|
452 |
|
453 |
return $filter;
|
454 |
}
|
455 |
|
456 |
-
$stream->expect(
|
457 |
}
|
458 |
|
459 |
-
return new
|
460 |
}
|
461 |
|
462 |
public function parseFilterExpression($node)
|
@@ -469,11 +469,11 @@ class Twig_SupTwg_ExpressionParser
|
|
469 |
public function parseFilterExpressionRaw($node, $tag = null)
|
470 |
{
|
471 |
while (true) {
|
472 |
-
$token = $this->parser->getStream()->expect(
|
473 |
|
474 |
-
$name = new
|
475 |
-
if (!$this->parser->getStream()->test(
|
476 |
-
$arguments = new
|
477 |
} else {
|
478 |
$arguments = $this->parseArguments(true);
|
479 |
}
|
@@ -482,7 +482,7 @@ class Twig_SupTwg_ExpressionParser
|
|
482 |
|
483 |
$node = new $class($node, $name, $arguments, $token->getLine(), $tag);
|
484 |
|
485 |
-
if (!$this->parser->getStream()->test(
|
486 |
break;
|
487 |
}
|
488 |
|
@@ -498,32 +498,32 @@ class Twig_SupTwg_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
|
502 |
*
|
503 |
-
* @throws
|
504 |
*/
|
505 |
public function parseArguments($namedArguments = false, $definition = false)
|
506 |
{
|
507 |
$args = array();
|
508 |
$stream = $this->parser->getStream();
|
509 |
|
510 |
-
$stream->expect(
|
511 |
-
while (!$stream->test(
|
512 |
if (!empty($args)) {
|
513 |
-
$stream->expect(
|
514 |
}
|
515 |
|
516 |
if ($definition) {
|
517 |
-
$token = $stream->expect(
|
518 |
-
$value = new
|
519 |
} else {
|
520 |
$value = $this->parseExpression();
|
521 |
}
|
522 |
|
523 |
$name = null;
|
524 |
-
if ($namedArguments && $token = $stream->nextIf(
|
525 |
-
if (!$value instanceof
|
526 |
-
throw new
|
527 |
}
|
528 |
$name = $value->getAttribute('name');
|
529 |
|
@@ -531,7 +531,7 @@ class Twig_SupTwg_ExpressionParser
|
|
531 |
$value = $this->parsePrimaryExpression();
|
532 |
|
533 |
if (!$this->checkConstantExpression($value)) {
|
534 |
-
throw new
|
535 |
}
|
536 |
} else {
|
537 |
$value = $this->parseExpression();
|
@@ -541,7 +541,7 @@ class Twig_SupTwg_ExpressionParser
|
|
541 |
if ($definition) {
|
542 |
if (null === $name) {
|
543 |
$name = $value->getAttribute('name');
|
544 |
-
$value = new
|
545 |
}
|
546 |
$args[$name] = $value;
|
547 |
} else {
|
@@ -552,9 +552,9 @@ class Twig_SupTwg_ExpressionParser
|
|
552 |
}
|
553 |
}
|
554 |
}
|
555 |
-
$stream->expect(
|
556 |
|
557 |
-
return new
|
558 |
}
|
559 |
|
560 |
public function parseAssignmentExpression()
|
@@ -562,19 +562,19 @@ class Twig_SupTwg_ExpressionParser
|
|
562 |
$stream = $this->parser->getStream();
|
563 |
$targets = array();
|
564 |
while (true) {
|
565 |
-
$token = $stream->expect(
|
566 |
$value = $token->getValue();
|
567 |
if (in_array(strtolower($value), array('true', 'false', 'none', 'null'))) {
|
568 |
-
throw new
|
569 |
}
|
570 |
-
$targets[] = new
|
571 |
|
572 |
-
if (!$stream->nextIf(
|
573 |
break;
|
574 |
}
|
575 |
}
|
576 |
|
577 |
-
return new
|
578 |
}
|
579 |
|
580 |
public function parseMultitargetExpression()
|
@@ -582,27 +582,27 @@ class Twig_SupTwg_ExpressionParser
|
|
582 |
$targets = array();
|
583 |
while (true) {
|
584 |
$targets[] = $this->parseExpression();
|
585 |
-
if (!$this->parser->getStream()->nextIf(
|
586 |
break;
|
587 |
}
|
588 |
}
|
589 |
|
590 |
-
return new
|
591 |
}
|
592 |
|
593 |
-
private function parseNotTestExpression(
|
594 |
{
|
595 |
-
return new
|
596 |
}
|
597 |
|
598 |
-
private function parseTestExpression(
|
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(
|
606 |
$arguments = $this->parser->getExpressionParser()->parseArguments(true);
|
607 |
}
|
608 |
|
@@ -612,13 +612,13 @@ class Twig_SupTwg_ExpressionParser
|
|
612 |
private function getTest($line)
|
613 |
{
|
614 |
$stream = $this->parser->getStream();
|
615 |
-
$name = $stream->expect(
|
616 |
|
617 |
if ($test = $this->env->getTest($name)) {
|
618 |
return array($name, $test);
|
619 |
}
|
620 |
|
621 |
-
if ($stream->test(
|
622 |
// try 2-words tests
|
623 |
$name = $name.' '.$this->parser->getCurrentToken()->getValue();
|
624 |
|
@@ -629,7 +629,7 @@ class Twig_SupTwg_ExpressionParser
|
|
629 |
}
|
630 |
}
|
631 |
|
632 |
-
$e = new
|
633 |
$e->addSuggestions($name, array_keys($this->env->getTests()));
|
634 |
|
635 |
throw $e;
|
@@ -637,7 +637,7 @@ class Twig_SupTwg_ExpressionParser
|
|
637 |
|
638 |
private function getTestNodeClass($test)
|
639 |
{
|
640 |
-
if ($test instanceof
|
641 |
$stream = $this->parser->getStream();
|
642 |
$message = sprintf('Twig Test "%s" is deprecated', $test->getName());
|
643 |
if (!is_bool($test->getDeprecatedVersion())) {
|
@@ -649,26 +649,26 @@ class Twig_SupTwg_ExpressionParser
|
|
649 |
$src = $stream->getSourceContext();
|
650 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine());
|
651 |
|
652 |
-
|
653 |
}
|
654 |
|
655 |
-
if ($test instanceof
|
656 |
return $test->getNodeClass();
|
657 |
}
|
658 |
|
659 |
-
return $test instanceof
|
660 |
}
|
661 |
|
662 |
protected function getFunctionNodeClass($name, $line)
|
663 |
{
|
664 |
if (false === $function = $this->env->getFunction($name)) {
|
665 |
-
$e = new
|
666 |
$e->addSuggestions($name, array_keys($this->env->getFunctions()));
|
667 |
|
668 |
throw $e;
|
669 |
}
|
670 |
|
671 |
-
if ($function instanceof
|
672 |
$message = sprintf('Twig Function "%s" is deprecated', $function->getName());
|
673 |
if (!is_bool($function->getDeprecatedVersion())) {
|
674 |
$message .= sprintf(' since version %s', $function->getDeprecatedVersion());
|
@@ -679,26 +679,26 @@ class Twig_SupTwg_ExpressionParser
|
|
679 |
$src = $this->parser->getStream()->getSourceContext();
|
680 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
681 |
|
682 |
-
|
683 |
}
|
684 |
|
685 |
-
if ($function instanceof
|
686 |
return $function->getNodeClass();
|
687 |
}
|
688 |
|
689 |
-
return $function instanceof
|
690 |
}
|
691 |
|
692 |
protected function getFilterNodeClass($name, $line)
|
693 |
{
|
694 |
if (false === $filter = $this->env->getFilter($name)) {
|
695 |
-
$e = new
|
696 |
$e->addSuggestions($name, array_keys($this->env->getFilters()));
|
697 |
|
698 |
throw $e;
|
699 |
}
|
700 |
|
701 |
-
if ($filter instanceof
|
702 |
$message = sprintf('Twig Filter "%s" is deprecated', $filter->getName());
|
703 |
if (!is_bool($filter->getDeprecatedVersion())) {
|
704 |
$message .= sprintf(' since version %s', $filter->getDeprecatedVersion());
|
@@ -709,21 +709,21 @@ class Twig_SupTwg_ExpressionParser
|
|
709 |
$src = $this->parser->getStream()->getSourceContext();
|
710 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
711 |
|
712 |
-
|
713 |
}
|
714 |
|
715 |
-
if ($filter instanceof
|
716 |
return $filter->getNodeClass();
|
717 |
}
|
718 |
|
719 |
-
return $filter instanceof
|
720 |
}
|
721 |
|
722 |
// checks that the node only contains "constant" elements
|
723 |
-
protected function checkConstantExpression(
|
724 |
{
|
725 |
-
if (!($node instanceof
|
726 |
-
|| $node instanceof
|
727 |
)) {
|
728 |
return false;
|
729 |
}
|
22 |
*
|
23 |
* @internal
|
24 |
*/
|
25 |
+
class Twig_SupTwgDtgs_ExpressionParser
|
26 |
{
|
27 |
const OPERATOR_LEFT = 1;
|
28 |
const OPERATOR_RIGHT = 2;
|
33 |
|
34 |
private $env;
|
35 |
|
36 |
+
public function __construct(Twig_SupTwgDtgs_Parser $parser, $env = null)
|
37 |
{
|
38 |
$this->parser = $parser;
|
39 |
|
40 |
+
if ($env instanceof Twig_SupTwgDtgs_Environment) {
|
41 |
$this->env = $env;
|
42 |
$this->unaryOperators = $env->getUnaryOperators();
|
43 |
$this->binaryOperators = $env->getBinaryOperators();
|
44 |
} else {
|
45 |
+
//@trigger_error('Passing the operators as constructor arguments to '.__METHOD__.' is deprecated since version 1.27. Pass the environment instead.', E_USER_DEPRECATED);
|
46 |
|
47 |
$this->env = $parser->getEnvironment();
|
48 |
$this->unaryOperators = func_get_arg(1);
|
91 |
$class = $operator['class'];
|
92 |
|
93 |
return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
|
94 |
+
} elseif ($token->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '(')) {
|
95 |
$this->parser->getStream()->next();
|
96 |
$expr = $this->parseExpression();
|
97 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, '?')) {
|
108 |
+
if (!$this->parser->getStream()->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ':')) {
|
109 |
$expr2 = $this->parseExpression();
|
110 |
+
if ($this->parser->getStream()->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ':')) {
|
111 |
$expr3 = $this->parseExpression();
|
112 |
} else {
|
113 |
+
$expr3 = new Twig_SupTwgDtgs_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine());
|
114 |
}
|
115 |
} else {
|
116 |
$expr2 = $expr;
|
117 |
$expr3 = $this->parseExpression();
|
118 |
}
|
119 |
|
120 |
+
$expr = new Twig_SupTwgDtgs_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine());
|
121 |
}
|
122 |
|
123 |
return $expr;
|
124 |
}
|
125 |
|
126 |
+
protected function isUnary(Twig_SupTwgDtgs_Token $token)
|
127 |
{
|
128 |
+
return $token->test(Twig_SupTwgDtgs_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]);
|
129 |
}
|
130 |
|
131 |
+
protected function isBinary(Twig_SupTwgDtgs_Token $token)
|
132 |
{
|
133 |
+
return $token->test(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE:
|
141 |
$this->parser->getStream()->next();
|
142 |
switch ($token->getValue()) {
|
143 |
case 'true':
|
144 |
case 'TRUE':
|
145 |
+
$node = new Twig_SupTwgDtgs_Node_Expression_Constant(true, $token->getLine());
|
146 |
break;
|
147 |
|
148 |
case 'false':
|
149 |
case 'FALSE':
|
150 |
+
$node = new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Name($token->getValue(), $token->getLine());
|
165 |
}
|
166 |
}
|
167 |
break;
|
168 |
|
169 |
+
case Twig_SupTwgDtgs_Token::NUMBER_TYPE:
|
170 |
$this->parser->getStream()->next();
|
171 |
+
$node = new Twig_SupTwgDtgs_Node_Expression_Constant($token->getValue(), $token->getLine());
|
172 |
break;
|
173 |
|
174 |
+
case Twig_SupTwgDtgs_Token::STRING_TYPE:
|
175 |
+
case Twig_SupTwgDtgs_Token::INTERPOLATION_START_TYPE:
|
176 |
$node = $this->parseStringExpression();
|
177 |
break;
|
178 |
|
179 |
+
case Twig_SupTwgDtgs_Token::OPERATOR_TYPE:
|
180 |
+
if (preg_match(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Unary_Neg';
|
190 |
+
$posClass = 'Twig_SupTwgDtgs_Node_Expression_Unary_Pos';
|
191 |
if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) {
|
192 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, '[')) {
|
204 |
$node = $this->parseArrayExpression();
|
205 |
+
} elseif ($token->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '{')) {
|
206 |
$node = $this->parseHashExpression();
|
207 |
} else {
|
208 |
+
throw new Twig_SupTwgDtgs_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_SupTwgDtgs_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_SupTwgDtgs_Token::STRING_TYPE)) {
|
224 |
+
$nodes[] = new Twig_SupTwgDtgs_Node_Expression_Constant($token->getValue(), $token->getLine());
|
225 |
$nextCanBeString = false;
|
226 |
+
} elseif ($stream->nextIf(Twig_SupTwgDtgs_Token::INTERPOLATION_START_TYPE)) {
|
227 |
$nodes[] = $this->parseExpression();
|
228 |
+
$stream->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
|
247 |
|
248 |
+
$node = new Twig_SupTwgDtgs_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
|
249 |
$first = true;
|
250 |
+
while (!$stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ']')) {
|
251 |
if (!$first) {
|
252 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma');
|
253 |
|
254 |
// trailing ,?
|
255 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ']')) {
|
256 |
break;
|
257 |
}
|
258 |
}
|
260 |
|
261 |
$node->addElement($this->parseExpression());
|
262 |
}
|
263 |
+
$stream->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected');
|
272 |
|
273 |
+
$node = new Twig_SupTwgDtgs_Node_Expression_Array(array(), $stream->getCurrent()->getLine());
|
274 |
$first = true;
|
275 |
+
while (!$stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '}')) {
|
276 |
if (!$first) {
|
277 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma');
|
278 |
|
279 |
// trailing ,?
|
280 |
+
if ($stream->test(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_SupTwgDtgs_Token::NUMBER_TYPE)) {
|
293 |
+
$key = new Twig_SupTwgDtgs_Node_Expression_Constant($token->getValue(), $token->getLine());
|
294 |
+
} elseif ($stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '(')) {
|
295 |
$key = $this->parseExpression();
|
296 |
} else {
|
297 |
$current = $stream->getCurrent();
|
298 |
|
299 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
|
300 |
}
|
301 |
|
302 |
+
$stream->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Parent($this->parser->peekBlockStack(), $line);
|
346 |
case 'block':
|
347 |
$args = $this->parseArguments();
|
348 |
if (count($args) < 1) {
|
349 |
+
throw new Twig_SupTwgDtgs_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext());
|
350 |
}
|
351 |
|
352 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_SupTwgDtgs_Template::ANY_CALL, $line);
|
360 |
default:
|
361 |
if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) {
|
362 |
+
$arguments = new Twig_SupTwgDtgs_Node_Expression_Array(array(), $line);
|
363 |
foreach ($this->parseArguments() as $n) {
|
364 |
$arguments->addElement($n);
|
365 |
}
|
366 |
|
367 |
+
$node = new Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Array(array(), $lineno);
|
386 |
+
$type = Twig_SupTwgDtgs_Template::ANY_CALL;
|
387 |
if ($token->getValue() == '.') {
|
388 |
$token = $stream->next();
|
389 |
if (
|
390 |
+
$token->getType() == Twig_SupTwgDtgs_Token::NAME_TYPE
|
391 |
||
|
392 |
+
$token->getType() == Twig_SupTwgDtgs_Token::NUMBER_TYPE
|
393 |
||
|
394 |
+
($token->getType() == Twig_SupTwgDtgs_Token::OPERATOR_TYPE && preg_match(Twig_SupTwgDtgs_Lexer::REGEX_NAME, $token->getValue()))
|
395 |
) {
|
396 |
+
$arg = new Twig_SupTwgDtgs_Node_Expression_Constant($token->getValue(), $lineno);
|
397 |
|
398 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '(')) {
|
399 |
+
$type = Twig_SupTwgDtgs_Template::METHOD_CALL;
|
400 |
foreach ($this->parseArguments() as $n) {
|
401 |
$arguments->addElement($n);
|
402 |
}
|
403 |
}
|
404 |
} else {
|
405 |
+
throw new Twig_SupTwgDtgs_Error_Syntax('Expected name or number.', $lineno, $stream->getSourceContext());
|
406 |
}
|
407 |
|
408 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {
|
409 |
+
if (!$arg instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
410 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno);
|
420 |
$node->setAttribute('safe', true);
|
421 |
|
422 |
return $node;
|
423 |
}
|
424 |
} else {
|
425 |
+
$type = Twig_SupTwgDtgs_Template::ARRAY_CALL;
|
426 |
|
427 |
// slice?
|
428 |
$slice = false;
|
429 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ':')) {
|
430 |
$slice = true;
|
431 |
+
$arg = new Twig_SupTwgDtgs_Node_Expression_Constant(0, $token->getLine());
|
432 |
} else {
|
433 |
$arg = $this->parseExpression();
|
434 |
}
|
435 |
|
436 |
+
if ($stream->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ':')) {
|
437 |
$slice = true;
|
438 |
}
|
439 |
|
440 |
if ($slice) {
|
441 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ']')) {
|
442 |
+
$length = new Twig_SupTwgDtgs_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_SupTwgDtgs_Node(array($arg, $length));
|
449 |
+
$filter = new $class($node, new Twig_SupTwgDtgs_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine());
|
450 |
|
451 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ']');
|
452 |
|
453 |
return $filter;
|
454 |
}
|
455 |
|
456 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ']');
|
457 |
}
|
458 |
|
459 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE);
|
473 |
|
474 |
+
$name = new Twig_SupTwgDtgs_Node_Expression_Constant($token->getValue(), $token->getLine());
|
475 |
+
if (!$this->parser->getStream()->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, '(')) {
|
476 |
+
$arguments = new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node
|
502 |
*
|
503 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
|
511 |
+
while (!$stream->test(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ')')) {
|
512 |
if (!empty($args)) {
|
513 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
|
514 |
}
|
515 |
|
516 |
if ($definition) {
|
517 |
+
$token = $stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE, null, 'An argument must be a name');
|
518 |
+
$value = new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::OPERATOR_TYPE, '=')) {
|
525 |
+
if (!$value instanceof Twig_SupTwgDtgs_Node_Expression_Name) {
|
526 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine());
|
545 |
}
|
546 |
$args[$name] = $value;
|
547 |
} else {
|
552 |
}
|
553 |
}
|
554 |
}
|
555 |
+
$stream->expect(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis');
|
556 |
|
557 |
+
return new Twig_SupTwgDtgs_Node($args);
|
558 |
}
|
559 |
|
560 |
public function parseAssignmentExpression()
|
562 |
$stream = $this->parser->getStream();
|
563 |
$targets = array();
|
564 |
while (true) {
|
565 |
+
$token = $stream->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Syntax(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
|
569 |
}
|
570 |
+
$targets[] = new Twig_SupTwgDtgs_Node_Expression_AssignName($value, $token->getLine());
|
571 |
|
572 |
+
if (!$stream->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',')) {
|
573 |
break;
|
574 |
}
|
575 |
}
|
576 |
|
577 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',')) {
|
586 |
break;
|
587 |
}
|
588 |
}
|
589 |
|
590 |
+
return new Twig_SupTwgDtgs_Node($targets);
|
591 |
}
|
592 |
|
593 |
+
private function parseNotTestExpression(Twig_SupTwgDtgs_NodeInterface $node)
|
594 |
{
|
595 |
+
return new Twig_SupTwgDtgs_Node_Expression_Unary_Not($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine());
|
596 |
}
|
597 |
|
598 |
+
private function parseTestExpression(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
616 |
|
617 |
if ($test = $this->env->getTest($name)) {
|
618 |
return array($name, $test);
|
619 |
}
|
620 |
|
621 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::NAME_TYPE)) {
|
622 |
// try 2-words tests
|
623 |
$name = $name.' '.$this->parser->getCurrentToken()->getValue();
|
624 |
|
629 |
}
|
630 |
}
|
631 |
|
632 |
+
$e = new Twig_SupTwgDtgs_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_SupTwgDtgs_SimpleTest && $test->isDeprecated()) {
|
641 |
$stream = $this->parser->getStream();
|
642 |
$message = sprintf('Twig Test "%s" is deprecated', $test->getName());
|
643 |
if (!is_bool($test->getDeprecatedVersion())) {
|
649 |
$src = $stream->getSourceContext();
|
650 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine());
|
651 |
|
652 |
+
//@trigger_error($message, E_USER_DEPRECATED);
|
653 |
}
|
654 |
|
655 |
+
if ($test instanceof Twig_SupTwgDtgs_SimpleTest) {
|
656 |
return $test->getNodeClass();
|
657 |
}
|
658 |
|
659 |
+
return $test instanceof Twig_SupTwgDtgs_Test_Node ? $test->getClass() : 'Twig_SupTwgDtgs_Node_Expression_Test';
|
660 |
}
|
661 |
|
662 |
protected function getFunctionNodeClass($name, $line)
|
663 |
{
|
664 |
if (false === $function = $this->env->getFunction($name)) {
|
665 |
+
$e = new Twig_SupTwgDtgs_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_SupTwgDtgs_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());
|
679 |
$src = $this->parser->getStream()->getSourceContext();
|
680 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
681 |
|
682 |
+
//@trigger_error($message, E_USER_DEPRECATED);
|
683 |
}
|
684 |
|
685 |
+
if ($function instanceof Twig_SupTwgDtgs_SimpleFunction) {
|
686 |
return $function->getNodeClass();
|
687 |
}
|
688 |
|
689 |
+
return $function instanceof Twig_SupTwgDtgs_Function_Node ? $function->getClass() : 'Twig_SupTwgDtgs_Node_Expression_Function';
|
690 |
}
|
691 |
|
692 |
protected function getFilterNodeClass($name, $line)
|
693 |
{
|
694 |
if (false === $filter = $this->env->getFilter($name)) {
|
695 |
+
$e = new Twig_SupTwgDtgs_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_SupTwgDtgs_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());
|
709 |
$src = $this->parser->getStream()->getSourceContext();
|
710 |
$message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
711 |
|
712 |
+
//@trigger_error($message, E_USER_DEPRECATED);
|
713 |
}
|
714 |
|
715 |
+
if ($filter instanceof Twig_SupTwgDtgs_SimpleFilter) {
|
716 |
return $filter->getNodeClass();
|
717 |
}
|
718 |
|
719 |
+
return $filter instanceof Twig_SupTwgDtgs_Filter_Node ? $filter->getClass() : 'Twig_SupTwgDtgs_Node_Expression_Filter';
|
720 |
}
|
721 |
|
722 |
// checks that the node only contains "constant" elements
|
723 |
+
protected function checkConstantExpression(Twig_SupTwgDtgs_NodeInterface $node)
|
724 |
{
|
725 |
+
if (!($node instanceof Twig_SupTwgDtgs_Node_Expression_Constant || $node instanceof Twig_SupTwgDtgs_Node_Expression_Array
|
726 |
+
|| $node instanceof Twig_SupTwgDtgs_Node_Expression_Unary_Neg || $node instanceof Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
/**
|
14 |
-
* @deprecated since 1.23 (to be removed in 2.0), implement
|
15 |
*/
|
16 |
-
public function initRuntime(
|
17 |
{
|
18 |
}
|
19 |
|
@@ -48,7 +48,7 @@ abstract class Twig_SupTwg_Extension implements Twig_SupTwg_ExtensionInterface
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
-
* @deprecated since 1.23 (to be removed in 2.0), implement
|
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_SupTwgDtgs_Extension implements Twig_SupTwgDtgs_ExtensionInterface
|
12 |
{
|
13 |
/**
|
14 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwgDtgs_Extension_InitRuntimeInterface instead
|
15 |
*/
|
16 |
+
public function initRuntime(Twig_SupTwgDtgs_Environment $environment)
|
17 |
{
|
18 |
}
|
19 |
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement Twig_SupTwgDtgs_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
|
21 |
{
|
22 |
protected $dateFormats = array('F j, Y H:i', '%d days');
|
23 |
protected $numberFormat = array(0, '.', ',');
|
@@ -121,22 +121,22 @@ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
|
|
121 |
public function getTokenParsers()
|
122 |
{
|
123 |
return array(
|
124 |
-
new
|
125 |
-
new
|
126 |
-
new
|
127 |
-
new
|
128 |
-
new
|
129 |
-
new
|
130 |
-
new
|
131 |
-
new
|
132 |
-
new
|
133 |
-
new
|
134 |
-
new
|
135 |
-
new
|
136 |
-
new
|
137 |
-
new
|
138 |
-
new
|
139 |
-
new
|
140 |
);
|
141 |
}
|
142 |
|
@@ -144,54 +144,54 @@ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
|
|
144 |
{
|
145 |
$filters = array(
|
146 |
// formatting filters
|
147 |
-
new
|
148 |
-
new
|
149 |
-
new
|
150 |
-
new
|
151 |
-
new
|
152 |
-
new
|
153 |
-
new
|
154 |
|
155 |
// encoding
|
156 |
-
new
|
157 |
-
new
|
158 |
-
new
|
159 |
|
160 |
// string filters
|
161 |
-
new
|
162 |
-
new
|
163 |
-
new
|
164 |
-
new
|
165 |
-
new
|
166 |
-
new
|
167 |
-
new
|
168 |
|
169 |
// array helpers
|
170 |
-
new
|
171 |
-
new
|
172 |
-
new
|
173 |
-
new
|
174 |
-
new
|
175 |
|
176 |
// string/array filters
|
177 |
-
new
|
178 |
-
new
|
179 |
-
new
|
180 |
-
new
|
181 |
-
new
|
182 |
|
183 |
// iteration and runtime
|
184 |
-
new
|
185 |
-
new
|
186 |
|
187 |
// escaping
|
188 |
-
new
|
189 |
-
new
|
190 |
);
|
191 |
|
192 |
if (function_exists('mb_get_info')) {
|
193 |
-
$filters[] = new
|
194 |
-
$filters[] = new
|
195 |
}
|
196 |
|
197 |
return $filters;
|
@@ -200,33 +200,33 @@ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
|
|
200 |
public function getFunctions()
|
201 |
{
|
202 |
return array(
|
203 |
-
new
|
204 |
-
new
|
205 |
-
new
|
206 |
-
new
|
207 |
-
new
|
208 |
-
new
|
209 |
-
new
|
210 |
-
new
|
211 |
-
new
|
212 |
);
|
213 |
}
|
214 |
|
215 |
public function getTests()
|
216 |
{
|
217 |
return array(
|
218 |
-
new
|
219 |
-
new
|
220 |
-
new
|
221 |
-
new
|
222 |
-
new
|
223 |
-
new
|
224 |
-
new
|
225 |
-
new
|
226 |
-
new
|
227 |
-
new
|
228 |
-
new
|
229 |
-
new
|
230 |
);
|
231 |
}
|
232 |
|
@@ -234,39 +234,39 @@ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
|
|
234 |
{
|
235 |
return array(
|
236 |
array(
|
237 |
-
'not' => array('precedence' => 50, 'class' => '
|
238 |
-
'-' => array('precedence' => 500, 'class' => '
|
239 |
-
'+' => array('precedence' => 500, 'class' => '
|
240 |
),
|
241 |
array(
|
242 |
-
'or' => array('precedence' => 10, 'class' => '
|
243 |
-
'and' => array('precedence' => 15, 'class' => '
|
244 |
-
'b-or' => array('precedence' => 16, 'class' => '
|
245 |
-
'b-xor' => array('precedence' => 17, 'class' => '
|
246 |
-
'b-and' => array('precedence' => 18, 'class' => '
|
247 |
-
'==' => array('precedence' => 20, 'class' => '
|
248 |
-
'!=' => array('precedence' => 20, 'class' => '
|
249 |
-
'<' => array('precedence' => 20, 'class' => '
|
250 |
-
'>' => array('precedence' => 20, 'class' => '
|
251 |
-
'>=' => array('precedence' => 20, 'class' => '
|
252 |
-
'<=' => array('precedence' => 20, 'class' => '
|
253 |
-
'not in' => array('precedence' => 20, 'class' => '
|
254 |
-
'in' => array('precedence' => 20, 'class' => '
|
255 |
-
'matches' => array('precedence' => 20, 'class' => '
|
256 |
-
'starts with' => array('precedence' => 20, 'class' => '
|
257 |
-
'ends with' => array('precedence' => 20, 'class' => '
|
258 |
-
'..' => array('precedence' => 25, 'class' => '
|
259 |
-
'+' => array('precedence' => 30, 'class' => '
|
260 |
-
'-' => array('precedence' => 30, 'class' => '
|
261 |
-
'~' => array('precedence' => 40, 'class' => '
|
262 |
-
'*' => array('precedence' => 60, 'class' => '
|
263 |
-
'/' => array('precedence' => 60, 'class' => '
|
264 |
-
'//' => array('precedence' => 60, 'class' => '
|
265 |
-
'%' => array('precedence' => 60, 'class' => '
|
266 |
-
'is' => array('precedence' => 100, 'associativity' =>
|
267 |
-
'is not' => array('precedence' => 100, 'associativity' =>
|
268 |
-
'**' => array('precedence' => 200, 'class' => '
|
269 |
-
'??' => array('precedence' => 300, 'class' => '
|
270 |
),
|
271 |
);
|
272 |
}
|
@@ -285,7 +285,7 @@ class Twig_SupTwg_Extension_Core extends Twig_SupTwg_Extension
|
|
285 |
*
|
286 |
* @return string The next value in the cycle
|
287 |
*/
|
288 |
-
function
|
289 |
{
|
290 |
if (!is_array($values) && !$values instanceof ArrayAccess) {
|
291 |
return $values;
|
@@ -300,14 +300,14 @@ function Twig_SupTwg_cycle($values, $position)
|
|
300 |
* - a random character from a string
|
301 |
* - a random integer between 0 and the integer parameter.
|
302 |
*
|
303 |
-
* @param
|
304 |
* @param Traversable|array|int|float|string $values The values to pick a random item from
|
305 |
*
|
306 |
-
* @throws
|
307 |
*
|
308 |
* @return mixed A random value from the given sequence
|
309 |
*/
|
310 |
-
function
|
311 |
{
|
312 |
if (null === $values) {
|
313 |
return mt_rand();
|
@@ -325,7 +325,7 @@ function Twig_SupTwg_random(Twig_SupTwg_Environment $env, $values = null)
|
|
325 |
}
|
326 |
if (null !== $charset = $env->getCharset()) {
|
327 |
if ('UTF-8' !== $charset) {
|
328 |
-
$values =
|
329 |
}
|
330 |
|
331 |
// unicode version of str_split()
|
@@ -334,7 +334,7 @@ function Twig_SupTwg_random(Twig_SupTwg_Environment $env, $values = null)
|
|
334 |
|
335 |
if ('UTF-8' !== $charset) {
|
336 |
foreach ($values as $i => $value) {
|
337 |
-
$values[$i] =
|
338 |
}
|
339 |
}
|
340 |
} else {
|
@@ -347,7 +347,7 @@ function Twig_SupTwg_random(Twig_SupTwg_Environment $env, $values = null)
|
|
347 |
}
|
348 |
|
349 |
if (0 === count($values)) {
|
350 |
-
throw new
|
351 |
}
|
352 |
|
353 |
return $values[array_rand($values, 1)];
|
@@ -360,17 +360,17 @@ function Twig_SupTwg_random(Twig_SupTwg_Environment $env, $values = null)
|
|
360 |
* {{ post.published_at|date("m/d/Y") }}
|
361 |
* </pre>
|
362 |
*
|
363 |
-
* @param
|
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
|
371 |
{
|
372 |
if (null === $format) {
|
373 |
-
$formats = $env->getExtension('
|
374 |
$format = $date instanceof DateInterval ? $formats[1] : $formats[0];
|
375 |
}
|
376 |
|
@@ -378,7 +378,7 @@ function Twig_SupTwg_date_format_filter(Twig_SupTwg_Environment $env, $date, $fo
|
|
378 |
return $date->format($format);
|
379 |
}
|
380 |
|
381 |
-
return
|
382 |
}
|
383 |
|
384 |
/**
|
@@ -388,15 +388,15 @@ function Twig_SupTwg_date_format_filter(Twig_SupTwg_Environment $env, $date, $fo
|
|
388 |
* {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
|
389 |
* </pre>
|
390 |
*
|
391 |
-
* @param
|
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
|
398 |
{
|
399 |
-
$date =
|
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_SupTwg_date_modify_filter(Twig_SupTwg_Environment $env, $date, $mo
|
|
414 |
* {% endif %}
|
415 |
* </pre>
|
416 |
*
|
417 |
-
* @param
|
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
|
424 |
{
|
425 |
// determine the timezone
|
426 |
if (false !== $timezone) {
|
427 |
if (null === $timezone) {
|
428 |
-
$timezone = $env->getExtension('
|
429 |
} elseif (!$timezone instanceof DateTimeZone) {
|
430 |
$timezone = new DateTimeZone($timezone);
|
431 |
}
|
@@ -446,14 +446,14 @@ function Twig_SupTwg_date_converter(Twig_SupTwg_Environment $env, $date = null,
|
|
446 |
}
|
447 |
|
448 |
if (null === $date || 'now' === $date) {
|
449 |
-
return new DateTime($date, false !== $timezone ? $timezone : $env->getExtension('
|
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('
|
457 |
}
|
458 |
|
459 |
if (false !== $timezone) {
|
@@ -472,16 +472,16 @@ function Twig_SupTwg_date_converter(Twig_SupTwg_Environment $env, $date = null,
|
|
472 |
*
|
473 |
* @return string
|
474 |
*/
|
475 |
-
function
|
476 |
{
|
477 |
if ($from instanceof Traversable) {
|
478 |
$from = iterator_to_array($from);
|
479 |
} elseif (is_string($from) && is_string($to)) {
|
480 |
-
|
481 |
|
482 |
return strtr($str, $from, $to);
|
483 |
} elseif (!is_array($from)) {
|
484 |
-
throw new
|
485 |
}
|
486 |
|
487 |
return strtr($str, $from);
|
@@ -496,14 +496,14 @@ function Twig_SupTwg_replace_filter($str, $from, $to = null)
|
|
496 |
*
|
497 |
* @return int|float The rounded number
|
498 |
*/
|
499 |
-
function
|
500 |
{
|
501 |
if ('common' == $method) {
|
502 |
return round($value, $precision);
|
503 |
}
|
504 |
|
505 |
if ('ceil' != $method && 'floor' != $method) {
|
506 |
-
throw new
|
507 |
}
|
508 |
|
509 |
return $method($value * pow(10, $precision)) / pow(10, $precision);
|
@@ -516,7 +516,7 @@ function Twig_SupTwg_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
|
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_SupTwg_round($value, $precision = 0, $method = 'common')
|
|
524 |
*
|
525 |
* @return string The formatted number
|
526 |
*/
|
527 |
-
function
|
528 |
{
|
529 |
-
$defaults = $env->getExtension('
|
530 |
if (null === $decimal) {
|
531 |
$decimal = $defaults[0];
|
532 |
}
|
@@ -549,7 +549,7 @@ function Twig_SupTwg_number_format_filter(Twig_SupTwg_Environment $env, $number,
|
|
549 |
*
|
550 |
* @return string The URL encoded value
|
551 |
*/
|
552 |
-
function
|
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
|
575 |
{
|
576 |
-
if ($value instanceof
|
577 |
$value = (string) $value;
|
578 |
} elseif (is_array($value)) {
|
579 |
-
array_walk_recursive($value, '
|
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
|
594 |
{
|
595 |
-
if ($value instanceof
|
596 |
$value = (string) $value;
|
597 |
} elseif (is_array($value)) {
|
598 |
-
array_walk_recursive($value, '
|
599 |
}
|
600 |
|
601 |
return json_encode($value, $options);
|
602 |
}
|
603 |
}
|
604 |
|
605 |
-
function
|
606 |
{
|
607 |
-
if ($value instanceof
|
608 |
$value = (string) $value;
|
609 |
}
|
610 |
}
|
@@ -625,18 +625,18 @@ function _Twig_SupTwg_markup2string(&$value)
|
|
625 |
*
|
626 |
* @return array The merged array
|
627 |
*/
|
628 |
-
function
|
629 |
{
|
630 |
if ($arr1 instanceof Traversable) {
|
631 |
$arr1 = iterator_to_array($arr1);
|
632 |
} elseif (!is_array($arr1)) {
|
633 |
-
throw new
|
634 |
}
|
635 |
|
636 |
if ($arr2 instanceof Traversable) {
|
637 |
$arr2 = iterator_to_array($arr2);
|
638 |
} elseif (!is_array($arr2)) {
|
639 |
-
throw new
|
640 |
}
|
641 |
|
642 |
return array_merge($arr1, $arr2);
|
@@ -645,7 +645,7 @@ function Twig_SupTwg_array_merge($arr1, $arr2)
|
|
645 |
/**
|
646 |
* Slices a variable.
|
647 |
*
|
648 |
-
* @param
|
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_SupTwg_array_merge($arr1, $arr2)
|
|
653 |
*
|
654 |
* @return mixed The sliced variable
|
655 |
*/
|
656 |
-
function
|
657 |
{
|
658 |
if ($item instanceof Traversable) {
|
659 |
while ($item instanceof IteratorAggregate) {
|
@@ -687,14 +687,14 @@ function Twig_SupTwg_slice(Twig_SupTwg_Environment $env, $item, $start, $length
|
|
687 |
/**
|
688 |
* Returns the first element of the item.
|
689 |
*
|
690 |
-
* @param
|
691 |
* @param mixed $item A variable
|
692 |
*
|
693 |
* @return mixed The first element of the item
|
694 |
*/
|
695 |
-
function
|
696 |
{
|
697 |
-
$elements =
|
698 |
|
699 |
return is_string($elements) ? $elements : current($elements);
|
700 |
}
|
@@ -702,14 +702,14 @@ function Twig_SupTwg_first(Twig_SupTwg_Environment $env, $item)
|
|
702 |
/**
|
703 |
* Returns the last element of the item.
|
704 |
*
|
705 |
-
* @param
|
706 |
* @param mixed $item A variable
|
707 |
*
|
708 |
* @return mixed The last element of the item
|
709 |
*/
|
710 |
-
function
|
711 |
{
|
712 |
-
$elements =
|
713 |
|
714 |
return is_string($elements) ? $elements : current($elements);
|
715 |
}
|
@@ -732,7 +732,7 @@ function Twig_SupTwg_last(Twig_SupTwg_Environment $env, $item)
|
|
732 |
*
|
733 |
* @return string The concatenated string
|
734 |
*/
|
735 |
-
function
|
736 |
{
|
737 |
if ($value instanceof Traversable) {
|
738 |
$value = iterator_to_array($value, false);
|
@@ -758,14 +758,14 @@ function Twig_SupTwg_join_filter($value, $glue = '')
|
|
758 |
* {# returns [aa, bb, cc] #}
|
759 |
* </pre>
|
760 |
*
|
761 |
-
* @param
|
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
|
769 |
{
|
770 |
if (!empty($delimiter)) {
|
771 |
return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
|
@@ -798,9 +798,9 @@ function Twig_SupTwg_split_filter(Twig_SupTwg_Environment $env, $value, $delimit
|
|
798 |
/**
|
799 |
* @internal
|
800 |
*/
|
801 |
-
function
|
802 |
{
|
803 |
-
if (
|
804 |
return $default;
|
805 |
}
|
806 |
|
@@ -822,7 +822,7 @@ function _Twig_SupTwg_default_filter($value, $default = '')
|
|
822 |
*
|
823 |
* @return array The keys
|
824 |
*/
|
825 |
-
function
|
826 |
{
|
827 |
if ($array instanceof Traversable) {
|
828 |
while ($array instanceof IteratorAggregate) {
|
@@ -858,13 +858,13 @@ function Twig_SupTwg_get_array_keys_filter($array)
|
|
858 |
/**
|
859 |
* Reverses a variable.
|
860 |
*
|
861 |
-
* @param
|
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
|
868 |
{
|
869 |
if ($item instanceof Traversable) {
|
870 |
return array_reverse(iterator_to_array($item), $preserveKeys);
|
@@ -878,7 +878,7 @@ function Twig_SupTwg_reverse_filter(Twig_SupTwg_Environment $env, $item, $preser
|
|
878 |
$string = (string) $item;
|
879 |
|
880 |
if ('UTF-8' !== $charset) {
|
881 |
-
$item =
|
882 |
}
|
883 |
|
884 |
preg_match_all('/./us', $item, $matches);
|
@@ -886,7 +886,7 @@ function Twig_SupTwg_reverse_filter(Twig_SupTwg_Environment $env, $item, $preser
|
|
886 |
$string = implode('', array_reverse($matches[0]));
|
887 |
|
888 |
if ('UTF-8' !== $charset) {
|
889 |
-
$string =
|
890 |
}
|
891 |
|
892 |
return $string;
|
@@ -902,12 +902,12 @@ function Twig_SupTwg_reverse_filter(Twig_SupTwg_Environment $env, $item, $preser
|
|
902 |
*
|
903 |
* @return array
|
904 |
*/
|
905 |
-
function
|
906 |
{
|
907 |
if ($array instanceof Traversable) {
|
908 |
$array = iterator_to_array($array);
|
909 |
} elseif (!is_array($array)) {
|
910 |
-
throw new
|
911 |
}
|
912 |
|
913 |
asort($array);
|
@@ -918,7 +918,7 @@ function Twig_SupTwg_sort_filter($array)
|
|
918 |
/**
|
919 |
* @internal
|
920 |
*/
|
921 |
-
function
|
922 |
{
|
923 |
if (is_array($compare)) {
|
924 |
return in_array($value, $compare, is_object($value) || is_resource($value));
|
@@ -950,9 +950,9 @@ function Twig_SupTwg_in_filter($value, $compare)
|
|
950 |
*
|
951 |
* @return string
|
952 |
*
|
953 |
-
* @throws
|
954 |
*/
|
955 |
-
function
|
956 |
{
|
957 |
if (null === $characterMask) {
|
958 |
$characterMask = " \t\n\r\0\x0B";
|
@@ -966,14 +966,14 @@ function Twig_SupTwg_trim_filter($string, $characterMask = null, $side = 'both')
|
|
966 |
case 'right':
|
967 |
return rtrim($string, $characterMask);
|
968 |
default:
|
969 |
-
throw new
|
970 |
}
|
971 |
}
|
972 |
|
973 |
/**
|
974 |
* Escapes a string.
|
975 |
*
|
976 |
-
* @param
|
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_SupTwg_trim_filter($string, $characterMask = null, $side = 'both')
|
|
981 |
*
|
982 |
* @return string
|
983 |
*/
|
984 |
-
function
|
985 |
{
|
986 |
-
if ($autoescape && $string instanceof
|
987 |
return $string;
|
988 |
}
|
989 |
|
@@ -1042,60 +1042,60 @@ function Twig_SupTwg_escape_filter(Twig_SupTwg_Environment $env, $string, $strat
|
|
1042 |
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
|
1043 |
}
|
1044 |
|
1045 |
-
$string =
|
1046 |
$string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
1047 |
|
1048 |
-
return
|
1049 |
|
1050 |
case 'js':
|
1051 |
// escape all non-alphanumeric characters
|
1052 |
// into their \xHH or \uHHHH representations
|
1053 |
if ('UTF-8' !== $charset) {
|
1054 |
-
$string =
|
1055 |
}
|
1056 |
|
1057 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1058 |
-
throw new
|
1059 |
}
|
1060 |
|
1061 |
-
$string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '
|
1062 |
|
1063 |
if ('UTF-8' !== $charset) {
|
1064 |
-
$string =
|
1065 |
}
|
1066 |
|
1067 |
return $string;
|
1068 |
|
1069 |
case 'css':
|
1070 |
if ('UTF-8' !== $charset) {
|
1071 |
-
$string =
|
1072 |
}
|
1073 |
|
1074 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1075 |
-
throw new
|
1076 |
}
|
1077 |
|
1078 |
-
$string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '
|
1079 |
|
1080 |
if ('UTF-8' !== $charset) {
|
1081 |
-
$string =
|
1082 |
}
|
1083 |
|
1084 |
return $string;
|
1085 |
|
1086 |
case 'html_attr':
|
1087 |
if ('UTF-8' !== $charset) {
|
1088 |
-
$string =
|
1089 |
}
|
1090 |
|
1091 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1092 |
-
throw new
|
1093 |
}
|
1094 |
|
1095 |
-
$string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '
|
1096 |
|
1097 |
if ('UTF-8' !== $charset) {
|
1098 |
-
$string =
|
1099 |
}
|
1100 |
|
1101 |
return $string;
|
@@ -1111,7 +1111,7 @@ function Twig_SupTwg_escape_filter(Twig_SupTwg_Environment $env, $string, $strat
|
|
1111 |
static $escapers;
|
1112 |
|
1113 |
if (null === $escapers) {
|
1114 |
-
$escapers = $env->getExtension('
|
1115 |
}
|
1116 |
|
1117 |
if (isset($escapers[$strategy])) {
|
@@ -1120,17 +1120,17 @@ function Twig_SupTwg_escape_filter(Twig_SupTwg_Environment $env, $string, $strat
|
|
1120 |
|
1121 |
$validStrategies = implode(', ', array_merge(array('html', 'js', 'url', 'css', 'html_attr'), array_keys($escapers)));
|
1122 |
|
1123 |
-
throw new
|
1124 |
}
|
1125 |
}
|
1126 |
|
1127 |
/**
|
1128 |
* @internal
|
1129 |
*/
|
1130 |
-
function
|
1131 |
{
|
1132 |
foreach ($filterArgs as $arg) {
|
1133 |
-
if ($arg instanceof
|
1134 |
return array($arg->getAttribute('value'));
|
1135 |
}
|
1136 |
|
@@ -1141,23 +1141,23 @@ function Twig_SupTwg_escape_filter_is_safe(Twig_SupTwg_Node $filterArgs)
|
|
1141 |
}
|
1142 |
|
1143 |
if (function_exists('mb_convert_encoding')) {
|
1144 |
-
function
|
1145 |
{
|
1146 |
return mb_convert_encoding($string, $to, $from);
|
1147 |
}
|
1148 |
} elseif (function_exists('iconv')) {
|
1149 |
-
function
|
1150 |
{
|
1151 |
return iconv($from, $to, $string);
|
1152 |
}
|
1153 |
} else {
|
1154 |
-
function
|
1155 |
{
|
1156 |
-
throw new
|
1157 |
}
|
1158 |
}
|
1159 |
|
1160 |
-
function
|
1161 |
{
|
1162 |
$char = $matches[0];
|
1163 |
|
@@ -1167,7 +1167,7 @@ function _Twig_SupTwg_escape_js_callback($matches)
|
|
1167 |
}
|
1168 |
|
1169 |
// \uHHHH
|
1170 |
-
$char =
|
1171 |
$char = strtoupper(bin2hex($char));
|
1172 |
|
1173 |
if (4 >= strlen($char)) {
|
@@ -1177,7 +1177,7 @@ function _Twig_SupTwg_escape_js_callback($matches)
|
|
1177 |
return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4));
|
1178 |
}
|
1179 |
|
1180 |
-
function
|
1181 |
{
|
1182 |
$char = $matches[0];
|
1183 |
|
@@ -1192,7 +1192,7 @@ function _Twig_SupTwg_escape_css_callback($matches)
|
|
1192 |
}
|
1193 |
|
1194 |
// \uHHHH
|
1195 |
-
$char =
|
1196 |
|
1197 |
return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' ';
|
1198 |
}
|
@@ -1203,7 +1203,7 @@ function _Twig_SupTwg_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
|
1207 |
{
|
1208 |
/*
|
1209 |
* While HTML supports far more named entities, the lowest common denominator
|
@@ -1236,7 +1236,7 @@ function _Twig_SupTwg_escape_html_attr_callback($matches)
|
|
1236 |
if (strlen($chr) == 1) {
|
1237 |
$hex = strtoupper(substr('00'.bin2hex($chr), -2));
|
1238 |
} else {
|
1239 |
-
$chr =
|
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
|
1261 |
* @param mixed $thing A variable
|
1262 |
*
|
1263 |
* @return int The length of the value
|
1264 |
*/
|
1265 |
-
function
|
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
|
1288 |
* @param string $string A string
|
1289 |
*
|
1290 |
* @return string The uppercased string
|
1291 |
*/
|
1292 |
-
function
|
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
|
1305 |
* @param string $string A string
|
1306 |
*
|
1307 |
* @return string The lowercased string
|
1308 |
*/
|
1309 |
-
function
|
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
|
1322 |
* @param string $string A string
|
1323 |
*
|
1324 |
* @return string The titlecased string
|
1325 |
*/
|
1326 |
-
function
|
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
|
1339 |
* @param string $string A string
|
1340 |
*
|
1341 |
* @return string The capitalized string
|
1342 |
*/
|
1343 |
-
function
|
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
|
1358 |
* @param mixed $thing A variable
|
1359 |
*
|
1360 |
* @return int The length of the value
|
1361 |
*/
|
1362 |
-
function
|
1363 |
{
|
1364 |
if (is_scalar($thing)) {
|
1365 |
return strlen($thing);
|
@@ -1375,12 +1375,12 @@ else {
|
|
1375 |
/**
|
1376 |
* Returns a titlecased string.
|
1377 |
*
|
1378 |
-
* @param
|
1379 |
* @param string $string A string
|
1380 |
*
|
1381 |
* @return string The titlecased string
|
1382 |
*/
|
1383 |
-
function
|
1384 |
{
|
1385 |
return ucwords(strtolower($string));
|
1386 |
}
|
@@ -1388,12 +1388,12 @@ else {
|
|
1388 |
/**
|
1389 |
* Returns a capitalized string.
|
1390 |
*
|
1391 |
-
* @param
|
1392 |
* @param string $string A string
|
1393 |
*
|
1394 |
* @return string The capitalized string
|
1395 |
*/
|
1396 |
-
function
|
1397 |
{
|
1398 |
return ucfirst(strtolower($string));
|
1399 |
}
|
@@ -1402,7 +1402,7 @@ else {
|
|
1402 |
/**
|
1403 |
* @internal
|
1404 |
*/
|
1405 |
-
function
|
1406 |
{
|
1407 |
if ($seq instanceof Traversable || is_array($seq)) {
|
1408 |
return $seq;
|
@@ -1425,7 +1425,7 @@ function Twig_SupTwg_ensure_traversable($seq)
|
|
1425 |
*
|
1426 |
* @return bool true if the value is empty, false otherwise
|
1427 |
*/
|
1428 |
-
function
|
1429 |
{
|
1430 |
if ($value instanceof Countable) {
|
1431 |
return 0 == count($value);
|
@@ -1452,7 +1452,7 @@ function Twig_SupTwg_test_empty($value)
|
|
1452 |
*
|
1453 |
* @return bool true if the value is traversable
|
1454 |
*/
|
1455 |
-
function
|
1456 |
{
|
1457 |
return $value instanceof Traversable || is_array($value);
|
1458 |
}
|
@@ -1460,7 +1460,7 @@ function Twig_SupTwg_test_iterable($value)
|
|
1460 |
/**
|
1461 |
* Renders a template.
|
1462 |
*
|
1463 |
-
* @param
|
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_SupTwg_test_iterable($value)
|
|
1470 |
*
|
1471 |
* @return string The rendered template
|
1472 |
*/
|
1473 |
-
function
|
1474 |
{
|
1475 |
$alreadySandboxed = false;
|
1476 |
$sandbox = null;
|
@@ -1478,8 +1478,8 @@ function Twig_SupTwg_include(Twig_SupTwg_Environment $env, $context, $template,
|
|
1478 |
$variables = array_merge($context, $variables);
|
1479 |
}
|
1480 |
|
1481 |
-
if ($isSandboxed = $sandboxed && $env->hasExtension('
|
1482 |
-
$sandbox = $env->getExtension('
|
1483 |
if (!$alreadySandboxed = $sandbox->isSandboxed()) {
|
1484 |
$sandbox->enableSandbox();
|
1485 |
}
|
@@ -1488,7 +1488,7 @@ function Twig_SupTwg_include(Twig_SupTwg_Environment $env, $context, $template,
|
|
1488 |
$result = null;
|
1489 |
try {
|
1490 |
$result = $env->resolveTemplate($template)->render($variables);
|
1491 |
-
} catch (
|
1492 |
if (!$ignoreMissing) {
|
1493 |
if ($isSandboxed && !$alreadySandboxed) {
|
1494 |
$sandbox->disableSandbox();
|
@@ -1520,22 +1520,22 @@ function Twig_SupTwg_include(Twig_SupTwg_Environment $env, $context, $template,
|
|
1520 |
/**
|
1521 |
* Returns a template content without rendering it.
|
1522 |
*
|
1523 |
-
* @param
|
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
|
1530 |
{
|
1531 |
$loader = $env->getLoader();
|
1532 |
try {
|
1533 |
-
if (!$loader instanceof
|
1534 |
return $loader->getSource($name);
|
1535 |
} else {
|
1536 |
return $loader->getSourceContext($name)->getCode();
|
1537 |
}
|
1538 |
-
} catch (
|
1539 |
if (!$ignoreMissing) {
|
1540 |
throw $e;
|
1541 |
}
|
@@ -1550,7 +1550,7 @@ function Twig_SupTwg_source(Twig_SupTwg_Environment $env, $name, $ignoreMissing
|
|
1550 |
*
|
1551 |
* @return string
|
1552 |
*/
|
1553 |
-
function
|
1554 |
{
|
1555 |
if (null !== $object) {
|
1556 |
$constant = get_class($object).'::'.$constant;
|
@@ -1567,7 +1567,7 @@ function Twig_SupTwg_constant($constant, $object = null)
|
|
1567 |
*
|
1568 |
* @return bool
|
1569 |
*/
|
1570 |
-
function
|
1571 |
{
|
1572 |
if (null !== $object) {
|
1573 |
$constant = get_class($object).'::'.$constant;
|
@@ -1585,7 +1585,7 @@ function Twig_SupTwg_constant_is_defined($constant, $object = null)
|
|
1585 |
*
|
1586 |
* @return array
|
1587 |
*/
|
1588 |
-
function
|
1589 |
{
|
1590 |
if ($items instanceof Traversable) {
|
1591 |
$items = iterator_to_array($items, false);
|
17 |
/**
|
18 |
* @final
|
19 |
*/
|
20 |
+
class Twig_SupTwgDtgs_Extension_Core extends Twig_SupTwgDtgs_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_SupTwgDtgs_TokenParser_For(),
|
125 |
+
new Twig_SupTwgDtgs_TokenParser_If(),
|
126 |
+
new Twig_SupTwgDtgs_TokenParser_Extends(),
|
127 |
+
new Twig_SupTwgDtgs_TokenParser_Include(),
|
128 |
+
new Twig_SupTwgDtgs_TokenParser_Block(),
|
129 |
+
new Twig_SupTwgDtgs_TokenParser_Use(),
|
130 |
+
new Twig_SupTwgDtgs_TokenParser_Filter(),
|
131 |
+
new Twig_SupTwgDtgs_TokenParser_Macro(),
|
132 |
+
new Twig_SupTwgDtgs_TokenParser_Import(),
|
133 |
+
new Twig_SupTwgDtgs_TokenParser_From(),
|
134 |
+
new Twig_SupTwgDtgs_TokenParser_Set(),
|
135 |
+
new Twig_SupTwgDtgs_TokenParser_Spaceless(),
|
136 |
+
new Twig_SupTwgDtgs_TokenParser_Flush(),
|
137 |
+
new Twig_SupTwgDtgs_TokenParser_Do(),
|
138 |
+
new Twig_SupTwgDtgs_TokenParser_Embed(),
|
139 |
+
new Twig_SupTwgDtgs_TokenParser_With(),
|
140 |
);
|
141 |
}
|
142 |
|
144 |
{
|
145 |
$filters = array(
|
146 |
// formatting filters
|
147 |
+
new Twig_SupTwgDtgs_SimpleFilter('date', 'Twig_SupTwgDtgs_date_format_filter', array('needs_environment' => true)),
|
148 |
+
new Twig_SupTwgDtgs_SimpleFilter('date_modify', 'Twig_SupTwgDtgs_date_modify_filter', array('needs_environment' => true)),
|
149 |
+
new Twig_SupTwgDtgs_SimpleFilter('format', 'sprintf'),
|
150 |
+
new Twig_SupTwgDtgs_SimpleFilter('replace', 'Twig_SupTwgDtgs_replace_filter'),
|
151 |
+
new Twig_SupTwgDtgs_SimpleFilter('number_format', 'Twig_SupTwgDtgs_number_format_filter', array('needs_environment' => true)),
|
152 |
+
new Twig_SupTwgDtgs_SimpleFilter('abs', 'abs'),
|
153 |
+
new Twig_SupTwgDtgs_SimpleFilter('round', 'Twig_SupTwgDtgs_round'),
|
154 |
|
155 |
// encoding
|
156 |
+
new Twig_SupTwgDtgs_SimpleFilter('url_encode', 'Twig_SupTwgDtgs_urlencode_filter'),
|
157 |
+
new Twig_SupTwgDtgs_SimpleFilter('json_encode', 'Twig_SupTwgDtgs_jsonencode_filter'),
|
158 |
+
new Twig_SupTwgDtgs_SimpleFilter('convert_encoding', 'Twig_SupTwgDtgs_convert_encoding'),
|
159 |
|
160 |
// string filters
|
161 |
+
new Twig_SupTwgDtgs_SimpleFilter('title', 'Twig_SupTwgDtgs_title_string_filter', array('needs_environment' => true)),
|
162 |
+
new Twig_SupTwgDtgs_SimpleFilter('capitalize', 'Twig_SupTwgDtgs_capitalize_string_filter', array('needs_environment' => true)),
|
163 |
+
new Twig_SupTwgDtgs_SimpleFilter('upper', 'strtoupper'),
|
164 |
+
new Twig_SupTwgDtgs_SimpleFilter('lower', 'strtolower'),
|
165 |
+
new Twig_SupTwgDtgs_SimpleFilter('striptags', 'strip_tags'),
|
166 |
+
new Twig_SupTwgDtgs_SimpleFilter('trim', 'Twig_SupTwgDtgs_trim_filter'),
|
167 |
+
new Twig_SupTwgDtgs_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))),
|
168 |
|
169 |
// array helpers
|
170 |
+
new Twig_SupTwgDtgs_SimpleFilter('join', 'Twig_SupTwgDtgs_join_filter'),
|
171 |
+
new Twig_SupTwgDtgs_SimpleFilter('split', 'Twig_SupTwgDtgs_split_filter', array('needs_environment' => true)),
|
172 |
+
new Twig_SupTwgDtgs_SimpleFilter('sort', 'Twig_SupTwgDtgs_sort_filter'),
|
173 |
+
new Twig_SupTwgDtgs_SimpleFilter('merge', 'Twig_SupTwgDtgs_array_merge'),
|
174 |
+
new Twig_SupTwgDtgs_SimpleFilter('batch', 'Twig_SupTwgDtgs_array_batch'),
|
175 |
|
176 |
// string/array filters
|
177 |
+
new Twig_SupTwgDtgs_SimpleFilter('reverse', 'Twig_SupTwgDtgs_reverse_filter', array('needs_environment' => true)),
|
178 |
+
new Twig_SupTwgDtgs_SimpleFilter('length', 'Twig_SupTwgDtgs_length_filter', array('needs_environment' => true)),
|
179 |
+
new Twig_SupTwgDtgs_SimpleFilter('slice', 'Twig_SupTwgDtgs_slice', array('needs_environment' => true)),
|
180 |
+
new Twig_SupTwgDtgs_SimpleFilter('first', 'Twig_SupTwgDtgs_first', array('needs_environment' => true)),
|
181 |
+
new Twig_SupTwgDtgs_SimpleFilter('last', 'Twig_SupTwgDtgs_last', array('needs_environment' => true)),
|
182 |
|
183 |
// iteration and runtime
|
184 |
+
new Twig_SupTwgDtgs_SimpleFilter('default', '_Twig_SupTwgDtgs_default_filter', array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Filter_Default')),
|
185 |
+
new Twig_SupTwgDtgs_SimpleFilter('keys', 'Twig_SupTwgDtgs_get_array_keys_filter'),
|
186 |
|
187 |
// escaping
|
188 |
+
new Twig_SupTwgDtgs_SimpleFilter('escape', 'Twig_SupTwgDtgs_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'Twig_SupTwgDtgs_escape_filter_is_safe')),
|
189 |
+
new Twig_SupTwgDtgs_SimpleFilter('e', 'Twig_SupTwgDtgs_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'Twig_SupTwgDtgs_escape_filter_is_safe')),
|
190 |
);
|
191 |
|
192 |
if (function_exists('mb_get_info')) {
|
193 |
+
$filters[] = new Twig_SupTwgDtgs_SimpleFilter('upper', 'Twig_SupTwgDtgs_upper_filter', array('needs_environment' => true));
|
194 |
+
$filters[] = new Twig_SupTwgDtgs_SimpleFilter('lower', 'Twig_SupTwgDtgs_lower_filter', array('needs_environment' => true));
|
195 |
}
|
196 |
|
197 |
return $filters;
|
200 |
public function getFunctions()
|
201 |
{
|
202 |
return array(
|
203 |
+
new Twig_SupTwgDtgs_SimpleFunction('max', 'max'),
|
204 |
+
new Twig_SupTwgDtgs_SimpleFunction('min', 'min'),
|
205 |
+
new Twig_SupTwgDtgs_SimpleFunction('range', 'range'),
|
206 |
+
new Twig_SupTwgDtgs_SimpleFunction('constant', 'Twig_SupTwgDtgs_constant'),
|
207 |
+
new Twig_SupTwgDtgs_SimpleFunction('cycle', 'Twig_SupTwgDtgs_cycle'),
|
208 |
+
new Twig_SupTwgDtgs_SimpleFunction('random', 'Twig_SupTwgDtgs_random', array('needs_environment' => true)),
|
209 |
+
new Twig_SupTwgDtgs_SimpleFunction('date', 'Twig_SupTwgDtgs_date_converter', array('needs_environment' => true)),
|
210 |
+
new Twig_SupTwgDtgs_SimpleFunction('include', 'Twig_SupTwgDtgs_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
|
211 |
+
new Twig_SupTwgDtgs_SimpleFunction('source', 'Twig_SupTwgDtgs_source', array('needs_environment' => true, 'is_safe' => array('all'))),
|
212 |
);
|
213 |
}
|
214 |
|
215 |
public function getTests()
|
216 |
{
|
217 |
return array(
|
218 |
+
new Twig_SupTwgDtgs_SimpleTest('even', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Even')),
|
219 |
+
new Twig_SupTwgDtgs_SimpleTest('odd', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Odd')),
|
220 |
+
new Twig_SupTwgDtgs_SimpleTest('defined', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Defined')),
|
221 |
+
new Twig_SupTwgDtgs_SimpleTest('sameas', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Sameas', 'deprecated' => '1.21', 'alternative' => 'same as')),
|
222 |
+
new Twig_SupTwgDtgs_SimpleTest('same as', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Sameas')),
|
223 |
+
new Twig_SupTwgDtgs_SimpleTest('none', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Null')),
|
224 |
+
new Twig_SupTwgDtgs_SimpleTest('null', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Null')),
|
225 |
+
new Twig_SupTwgDtgs_SimpleTest('divisibleby', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Divisibleby', 'deprecated' => '1.21', 'alternative' => 'divisible by')),
|
226 |
+
new Twig_SupTwgDtgs_SimpleTest('divisible by', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Divisibleby')),
|
227 |
+
new Twig_SupTwgDtgs_SimpleTest('constant', null, array('node_class' => 'Twig_SupTwgDtgs_Node_Expression_Test_Constant')),
|
228 |
+
new Twig_SupTwgDtgs_SimpleTest('empty', 'Twig_SupTwgDtgs_test_empty'),
|
229 |
+
new Twig_SupTwgDtgs_SimpleTest('iterable', 'Twig_SupTwgDtgs_test_iterable'),
|
230 |
);
|
231 |
}
|
232 |
|
234 |
{
|
235 |
return array(
|
236 |
array(
|
237 |
+
'not' => array('precedence' => 50, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Unary_Not'),
|
238 |
+
'-' => array('precedence' => 500, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Unary_Neg'),
|
239 |
+
'+' => array('precedence' => 500, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Unary_Pos'),
|
240 |
),
|
241 |
array(
|
242 |
+
'or' => array('precedence' => 10, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Or', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
243 |
+
'and' => array('precedence' => 15, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_And', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
244 |
+
'b-or' => array('precedence' => 16, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
245 |
+
'b-xor' => array('precedence' => 17, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
246 |
+
'b-and' => array('precedence' => 18, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
247 |
+
'==' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Equal', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
248 |
+
'!=' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_NotEqual', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
249 |
+
'<' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Less', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
250 |
+
'>' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Greater', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
251 |
+
'>=' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
252 |
+
'<=' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_LessEqual', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
253 |
+
'not in' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_NotIn', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
254 |
+
'in' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_In', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
255 |
+
'matches' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Matches', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
256 |
+
'starts with' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_StartsWith', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
257 |
+
'ends with' => array('precedence' => 20, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_EndsWith', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
258 |
+
'..' => array('precedence' => 25, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Range', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
259 |
+
'+' => array('precedence' => 30, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Add', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
260 |
+
'-' => array('precedence' => 30, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Sub', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
261 |
+
'~' => array('precedence' => 40, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Concat', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
262 |
+
'*' => array('precedence' => 60, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Mul', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
263 |
+
'/' => array('precedence' => 60, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Div', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
264 |
+
'//' => array('precedence' => 60, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
265 |
+
'%' => array('precedence' => 60, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Mod', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
266 |
+
'is' => array('precedence' => 100, 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
267 |
+
'is not' => array('precedence' => 100, 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_LEFT),
|
268 |
+
'**' => array('precedence' => 200, 'class' => 'Twig_SupTwgDtgs_Node_Expression_Binary_Power', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_RIGHT),
|
269 |
+
'??' => array('precedence' => 300, 'class' => 'Twig_SupTwgDtgs_Node_Expression_NullCoalesce', 'associativity' => Twig_SupTwgDtgs_ExpressionParser::OPERATOR_RIGHT),
|
270 |
),
|
271 |
);
|
272 |
}
|
285 |
*
|
286 |
* @return string The next value in the cycle
|
287 |
*/
|
288 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
304 |
* @param Traversable|array|int|float|string $values The values to pick a random item from
|
305 |
*
|
306 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_random(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_convert_encoding($value, $charset, 'UTF-8');
|
338 |
}
|
339 |
}
|
340 |
} else {
|
347 |
}
|
348 |
|
349 |
if (0 === count($values)) {
|
350 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_date_format_filter(Twig_SupTwgDtgs_Environment $env, $date, $format = null, $timezone = null)
|
371 |
{
|
372 |
if (null === $format) {
|
373 |
+
$formats = $env->getExtension('Twig_SupTwgDtgs_Extension_Core')->getDateFormat();
|
374 |
$format = $date instanceof DateInterval ? $formats[1] : $formats[0];
|
375 |
}
|
376 |
|
378 |
return $date->format($format);
|
379 |
}
|
380 |
|
381 |
+
return Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_date_modify_filter(Twig_SupTwgDtgs_Environment $env, $date, $modifier)
|
398 |
{
|
399 |
+
$date = Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_date_converter(Twig_SupTwgDtgs_Environment $env, $date = null, $timezone = null)
|
424 |
{
|
425 |
// determine the timezone
|
426 |
if (false !== $timezone) {
|
427 |
if (null === $timezone) {
|
428 |
+
$timezone = $env->getExtension('Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Extension_Core')->getTimezone());
|
457 |
}
|
458 |
|
459 |
if (false !== $timezone) {
|
472 |
*
|
473 |
* @return string
|
474 |
*/
|
475 |
+
function Twig_SupTwgDtgs_replace_filter($str, $from, $to = null)
|
476 |
{
|
477 |
if ($from instanceof Traversable) {
|
478 |
$from = iterator_to_array($from);
|
479 |
} elseif (is_string($from) && is_string($to)) {
|
480 |
+
//@trigger_error('Using "replace" with character by character replacement is deprecated since version 1.22 and will be removed in Twig 2.0', E_USER_DEPRECATED);
|
481 |
|
482 |
return strtr($str, $from, $to);
|
483 |
} elseif (!is_array($from)) {
|
484 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_number_format_filter(Twig_SupTwgDtgs_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null)
|
528 |
{
|
529 |
+
$defaults = $env->getExtension('Twig_SupTwgDtgs_Extension_Core')->getNumberFormat();
|
530 |
if (null === $decimal) {
|
531 |
$decimal = $defaults[0];
|
532 |
}
|
549 |
*
|
550 |
* @return string The URL encoded value
|
551 |
*/
|
552 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_jsonencode_filter($value, $options = 0)
|
575 |
{
|
576 |
+
if ($value instanceof Twig_SupTwgDtgs_Markup) {
|
577 |
$value = (string) $value;
|
578 |
} elseif (is_array($value)) {
|
579 |
+
array_walk_recursive($value, '_Twig_SupTwgDtgs_markup2string');
|
580 |
}
|
581 |
|
582 |
return json_encode($value);
|
590 |
*
|
591 |
* @return mixed The JSON encoded value
|
592 |
*/
|
593 |
+
function Twig_SupTwgDtgs_jsonencode_filter($value, $options = 0)
|
594 |
{
|
595 |
+
if ($value instanceof Twig_SupTwgDtgs_Markup) {
|
596 |
$value = (string) $value;
|
597 |
} elseif (is_array($value)) {
|
598 |
+
array_walk_recursive($value, '_Twig_SupTwgDtgs_markup2string');
|
599 |
}
|
600 |
|
601 |
return json_encode($value, $options);
|
602 |
}
|
603 |
}
|
604 |
|
605 |
+
function _Twig_SupTwgDtgs_markup2string(&$value)
|
606 |
{
|
607 |
+
if ($value instanceof Twig_SupTwgDtgs_Markup) {
|
608 |
$value = (string) $value;
|
609 |
}
|
610 |
}
|
625 |
*
|
626 |
* @return array The merged array
|
627 |
*/
|
628 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_slice(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
691 |
* @param mixed $item A variable
|
692 |
*
|
693 |
* @return mixed The first element of the item
|
694 |
*/
|
695 |
+
function Twig_SupTwgDtgs_first(Twig_SupTwgDtgs_Environment $env, $item)
|
696 |
{
|
697 |
+
$elements = Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
706 |
* @param mixed $item A variable
|
707 |
*
|
708 |
* @return mixed The last element of the item
|
709 |
*/
|
710 |
+
function Twig_SupTwgDtgs_last(Twig_SupTwgDtgs_Environment $env, $item)
|
711 |
{
|
712 |
+
$elements = Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_split_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_default_filter($value, $default = '')
|
802 |
{
|
803 |
+
if (Twig_SupTwgDtgs_test_empty($value)) {
|
804 |
return $default;
|
805 |
}
|
806 |
|
822 |
*
|
823 |
* @return array The keys
|
824 |
*/
|
825 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_reverse_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_convert_encoding($string, $charset, 'UTF-8');
|
890 |
}
|
891 |
|
892 |
return $string;
|
902 |
*
|
903 |
* @return array
|
904 |
*/
|
905 |
+
function Twig_SupTwgDtgs_sort_filter($array)
|
906 |
{
|
907 |
if ($array instanceof Traversable) {
|
908 |
$array = iterator_to_array($array);
|
909 |
} elseif (!is_array($array)) {
|
910 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error_Runtime When an invalid trimming side is used (not a string or not 'left', 'right', or 'both')
|
954 |
*/
|
955 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Runtime('Trimming side must be "left", "right" or "both".');
|
970 |
}
|
971 |
}
|
972 |
|
973 |
/**
|
974 |
* Escapes a string.
|
975 |
*
|
976 |
+
* @param Twig_SupTwgDtgs_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_SupTwgDtgs_escape_filter(Twig_SupTwgDtgs_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
|
985 |
{
|
986 |
+
if ($autoescape && $string instanceof Twig_SupTwgDtgs_Markup) {
|
987 |
return $string;
|
988 |
}
|
989 |
|
1042 |
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
|
1043 |
}
|
1044 |
|
1045 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, 'UTF-8', $charset);
|
1046 |
$string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
1047 |
|
1048 |
+
return Twig_SupTwgDtgs_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_SupTwgDtgs_convert_encoding($string, 'UTF-8', $charset);
|
1055 |
}
|
1056 |
|
1057 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1058 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_escape_js_callback', $string);
|
1062 |
|
1063 |
if ('UTF-8' !== $charset) {
|
1064 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, $charset, 'UTF-8');
|
1065 |
}
|
1066 |
|
1067 |
return $string;
|
1068 |
|
1069 |
case 'css':
|
1070 |
if ('UTF-8' !== $charset) {
|
1071 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, 'UTF-8', $charset);
|
1072 |
}
|
1073 |
|
1074 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1075 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_escape_css_callback', $string);
|
1079 |
|
1080 |
if ('UTF-8' !== $charset) {
|
1081 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, $charset, 'UTF-8');
|
1082 |
}
|
1083 |
|
1084 |
return $string;
|
1085 |
|
1086 |
case 'html_attr':
|
1087 |
if ('UTF-8' !== $charset) {
|
1088 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, 'UTF-8', $charset);
|
1089 |
}
|
1090 |
|
1091 |
if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
|
1092 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_escape_html_attr_callback', $string);
|
1096 |
|
1097 |
if ('UTF-8' !== $charset) {
|
1098 |
+
$string = Twig_SupTwgDtgs_convert_encoding($string, $charset, 'UTF-8');
|
1099 |
}
|
1100 |
|
1101 |
return $string;
|
1111 |
static $escapers;
|
1112 |
|
1113 |
if (null === $escapers) {
|
1114 |
+
$escapers = $env->getExtension('Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies));
|
1124 |
}
|
1125 |
}
|
1126 |
|
1127 |
/**
|
1128 |
* @internal
|
1129 |
*/
|
1130 |
+
function Twig_SupTwgDtgs_escape_filter_is_safe(Twig_SupTwgDtgs_Node $filterArgs)
|
1131 |
{
|
1132 |
foreach ($filterArgs as $arg) {
|
1133 |
+
if ($arg instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
1134 |
return array($arg->getAttribute('value'));
|
1135 |
}
|
1136 |
|
1141 |
}
|
1142 |
|
1143 |
if (function_exists('mb_convert_encoding')) {
|
1144 |
+
function Twig_SupTwgDtgs_convert_encoding($string, $to, $from)
|
1145 |
{
|
1146 |
return mb_convert_encoding($string, $to, $from);
|
1147 |
}
|
1148 |
} elseif (function_exists('iconv')) {
|
1149 |
+
function Twig_SupTwgDtgs_convert_encoding($string, $to, $from)
|
1150 |
{
|
1151 |
return iconv($from, $to, $string);
|
1152 |
}
|
1153 |
} else {
|
1154 |
+
function Twig_SupTwgDtgs_convert_encoding($string, $to, $from)
|
1155 |
{
|
1156 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_escape_js_callback($matches)
|
1161 |
{
|
1162 |
$char = $matches[0];
|
1163 |
|
1167 |
}
|
1168 |
|
1169 |
// \uHHHH
|
1170 |
+
$char = Twig_SupTwgDtgs_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_SupTwgDtgs_escape_css_callback($matches)
|
1181 |
{
|
1182 |
$char = $matches[0];
|
1183 |
|
1192 |
}
|
1193 |
|
1194 |
// \uHHHH
|
1195 |
+
$char = Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1261 |
* @param mixed $thing A variable
|
1262 |
*
|
1263 |
* @return int The length of the value
|
1264 |
*/
|
1265 |
+
function Twig_SupTwgDtgs_length_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1288 |
* @param string $string A string
|
1289 |
*
|
1290 |
* @return string The uppercased string
|
1291 |
*/
|
1292 |
+
function Twig_SupTwgDtgs_upper_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1305 |
* @param string $string A string
|
1306 |
*
|
1307 |
* @return string The lowercased string
|
1308 |
*/
|
1309 |
+
function Twig_SupTwgDtgs_lower_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1322 |
* @param string $string A string
|
1323 |
*
|
1324 |
* @return string The titlecased string
|
1325 |
*/
|
1326 |
+
function Twig_SupTwgDtgs_title_string_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1339 |
* @param string $string A string
|
1340 |
*
|
1341 |
* @return string The capitalized string
|
1342 |
*/
|
1343 |
+
function Twig_SupTwgDtgs_capitalize_string_filter(Twig_SupTwgDtgs_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_SupTwgDtgs_Environment $env
|
1358 |
* @param mixed $thing A variable
|
1359 |
*
|
1360 |
* @return int The length of the value
|
1361 |
*/
|
1362 |
+
function Twig_SupTwgDtgs_length_filter(Twig_SupTwgDtgs_Environment $env, $thing)
|
1363 |
{
|
1364 |
if (is_scalar($thing)) {
|
1365 |
return strlen($thing);
|
1375 |
/**
|
1376 |
* Returns a titlecased string.
|
1377 |
*
|
1378 |
+
* @param Twig_SupTwgDtgs_Environment $env
|
1379 |
* @param string $string A string
|
1380 |
*
|
1381 |
* @return string The titlecased string
|
1382 |
*/
|
1383 |
+
function Twig_SupTwgDtgs_title_string_filter(Twig_SupTwgDtgs_Environment $env, $string)
|
1384 |
{
|
1385 |
return ucwords(strtolower($string));
|
1386 |
}
|
1388 |
/**
|
1389 |
* Returns a capitalized string.
|
1390 |
*
|
1391 |
+
* @param Twig_SupTwgDtgs_Environment $env
|
1392 |
* @param string $string A string
|
1393 |
*
|
1394 |
* @return string The capitalized string
|
1395 |
*/
|
1396 |
+
function Twig_SupTwgDtgs_capitalize_string_filter(Twig_SupTwgDtgs_Environment $env, $string)
|
1397 |
{
|
1398 |
return ucfirst(strtolower($string));
|
1399 |
}
|
1402 |
/**
|
1403 |
* @internal
|
1404 |
*/
|
1405 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_test_iterable($value)
|
1456 |
{
|
1457 |
return $value instanceof Traversable || is_array($value);
|
1458 |
}
|
1460 |
/**
|
1461 |
* Renders a template.
|
1462 |
*
|
1463 |
+
* @param Twig_SupTwgDtgs_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_SupTwgDtgs_include(Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Sandbox')) {
|
1482 |
+
$sandbox = $env->getExtension('Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_source(Twig_SupTwgDtgs_Environment $env, $name, $ignoreMissing = false)
|
1530 |
{
|
1531 |
$loader = $env->getLoader();
|
1532 |
try {
|
1533 |
+
if (!$loader instanceof Twig_SupTwgDtgs_SourceContextLoaderInterface) {
|
1534 |
return $loader->getSource($name);
|
1535 |
} else {
|
1536 |
return $loader->getSourceContext($name)->getCode();
|
1537 |
}
|
1538 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
1539 |
if (!$ignoreMissing) {
|
1540 |
throw $e;
|
1541 |
}
|
1550 |
*
|
1551 |
* @return string
|
1552 |
*/
|
1553 |
+
function Twig_SupTwgDtgs_constant($constant, $object = null)
|
1554 |
{
|
1555 |
if (null !== $object) {
|
1556 |
$constant = get_class($object).'::'.$constant;
|
1567 |
*
|
1568 |
* @return bool
|
1569 |
*/
|
1570 |
+
function Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
16 |
{
|
17 |
public function getFunctions()
|
18 |
{
|
@@ -27,7 +27,7 @@ class Twig_SupTwg_Extension_Debug extends Twig_SupTwg_Extension
|
|
27 |
;
|
28 |
|
29 |
return array(
|
30 |
-
new
|
31 |
);
|
32 |
}
|
33 |
|
@@ -37,7 +37,7 @@ class Twig_SupTwg_Extension_Debug extends Twig_SupTwg_Extension
|
|
37 |
}
|
38 |
}
|
39 |
|
40 |
-
function
|
41 |
{
|
42 |
if (!$env->isDebug()) {
|
43 |
return;
|
@@ -49,7 +49,7 @@ function Twig_SupTwg_var_dump(Twig_SupTwg_Environment $env, $context)
|
|
49 |
if (2 === $count) {
|
50 |
$vars = array();
|
51 |
foreach ($context as $key => $value) {
|
52 |
-
if (!$value instanceof
|
53 |
$vars[$key] = $value;
|
54 |
}
|
55 |
}
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Extension_Debug extends Twig_SupTwgDtgs_Extension
|
16 |
{
|
17 |
public function getFunctions()
|
18 |
{
|
27 |
;
|
28 |
|
29 |
return array(
|
30 |
+
new Twig_SupTwgDtgs_SimpleFunction('dump', 'Twig_SupTwgDtgs_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)),
|
31 |
);
|
32 |
}
|
33 |
|
37 |
}
|
38 |
}
|
39 |
|
40 |
+
function Twig_SupTwgDtgs_var_dump(Twig_SupTwgDtgs_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_SupTwgDtgs_Template) {
|
53 |
$vars[$key] = $value;
|
54 |
}
|
55 |
}
|
vendor/Twig/Extension/Escaper.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
-
class
|
16 |
{
|
17 |
protected $defaultStrategy;
|
18 |
|
@@ -28,18 +28,18 @@ class Twig_SupTwg_Extension_Escaper extends Twig_SupTwg_Extension
|
|
28 |
|
29 |
public function getTokenParsers()
|
30 |
{
|
31 |
-
return array(new
|
32 |
}
|
33 |
|
34 |
public function getNodeVisitors()
|
35 |
{
|
36 |
-
return array(new
|
37 |
}
|
38 |
|
39 |
public function getFilters()
|
40 |
{
|
41 |
return array(
|
42 |
-
new
|
43 |
);
|
44 |
}
|
45 |
|
@@ -55,19 +55,19 @@ class Twig_SupTwg_Extension_Escaper extends Twig_SupTwg_Extension
|
|
55 |
{
|
56 |
// for BC
|
57 |
if (true === $defaultStrategy) {
|
58 |
-
|
59 |
|
60 |
$defaultStrategy = 'html';
|
61 |
}
|
62 |
|
63 |
if ('filename' === $defaultStrategy) {
|
64 |
-
|
65 |
|
66 |
$defaultStrategy = 'name';
|
67 |
}
|
68 |
|
69 |
if ('name' === $defaultStrategy) {
|
70 |
-
$defaultStrategy = array('
|
71 |
}
|
72 |
|
73 |
$this->defaultStrategy = $defaultStrategy;
|
@@ -104,7 +104,7 @@ class Twig_SupTwg_Extension_Escaper extends Twig_SupTwg_Extension
|
|
104 |
*
|
105 |
* @return string
|
106 |
*/
|
107 |
-
function
|
108 |
{
|
109 |
return $string;
|
110 |
}
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Extension_Escaper extends Twig_SupTwgDtgs_Extension
|
16 |
{
|
17 |
protected $defaultStrategy;
|
18 |
|
28 |
|
29 |
public function getTokenParsers()
|
30 |
{
|
31 |
+
return array(new Twig_SupTwgDtgs_TokenParser_AutoEscape());
|
32 |
}
|
33 |
|
34 |
public function getNodeVisitors()
|
35 |
{
|
36 |
+
return array(new Twig_SupTwgDtgs_NodeVisitor_Escaper());
|
37 |
}
|
38 |
|
39 |
public function getFilters()
|
40 |
{
|
41 |
return array(
|
42 |
+
new Twig_SupTwgDtgs_SimpleFilter('raw', 'Twig_SupTwgDtgs_raw_filter', array('is_safe' => array('all'))),
|
43 |
);
|
44 |
}
|
45 |
|
55 |
{
|
56 |
// for BC
|
57 |
if (true === $defaultStrategy) {
|
58 |
+
//@trigger_error('Using "true" as the default strategy is deprecated since version 1.21. Use "html" instead.', E_USER_DEPRECATED);
|
59 |
|
60 |
$defaultStrategy = 'html';
|
61 |
}
|
62 |
|
63 |
if ('filename' === $defaultStrategy) {
|
64 |
+
//@trigger_error('Using "filename" as the default strategy is deprecated since version 1.27. Use "name" instead.', E_USER_DEPRECATED);
|
65 |
|
66 |
$defaultStrategy = 'name';
|
67 |
}
|
68 |
|
69 |
if ('name' === $defaultStrategy) {
|
70 |
+
$defaultStrategy = array('Twig_SupTwgDtgs_FileExtensionEscapingStrategy', 'guess');
|
71 |
}
|
72 |
|
73 |
$this->defaultStrategy = $defaultStrategy;
|
104 |
*
|
105 |
* @return string
|
106 |
*/
|
107 |
+
function Twig_SupTwgDtgs_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
|
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
|
21 |
{
|
22 |
}
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Enables usage of the deprecated Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_GlobalsInterface
|
21 |
{
|
22 |
}
|
vendor/Twig/Extension/InitRuntimeInterface.php
CHANGED
@@ -10,13 +10,13 @@
|
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
-
* Enables usage of the deprecated
|
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
|
21 |
{
|
22 |
}
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Enables usage of the deprecated Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_InitRuntimeInterface
|
21 |
{
|
22 |
}
|
vendor/Twig/Extension/Optimizer.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
-
class
|
16 |
{
|
17 |
protected $optimizers;
|
18 |
|
@@ -23,7 +23,7 @@ class Twig_SupTwg_Extension_Optimizer extends Twig_SupTwg_Extension
|
|
23 |
|
24 |
public function getNodeVisitors()
|
25 |
{
|
26 |
-
return array(new
|
27 |
}
|
28 |
|
29 |
public function getName()
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Extension_Optimizer extends Twig_SupTwgDtgs_Extension
|
16 |
{
|
17 |
protected $optimizers;
|
18 |
|
23 |
|
24 |
public function getNodeVisitors()
|
25 |
{
|
26 |
+
return array(new Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
private $actives = array();
|
15 |
|
16 |
-
public function __construct(
|
17 |
{
|
18 |
$this->actives[] = $profile;
|
19 |
}
|
20 |
|
21 |
-
public function enter(
|
22 |
{
|
23 |
$this->actives[0]->addProfile($profile);
|
24 |
array_unshift($this->actives, $profile);
|
25 |
}
|
26 |
|
27 |
-
public function leave(
|
28 |
{
|
29 |
$profile->leave();
|
30 |
array_shift($this->actives);
|
@@ -36,7 +36,7 @@ class Twig_SupTwg_Extension_Profiler extends Twig_SupTwg_Extension
|
|
36 |
|
37 |
public function getNodeVisitors()
|
38 |
{
|
39 |
-
return array(new
|
40 |
}
|
41 |
|
42 |
public function getName()
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_SupTwgDtgs_Extension_Profiler extends Twig_SupTwgDtgs_Extension
|
13 |
{
|
14 |
private $actives = array();
|
15 |
|
16 |
+
public function __construct(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
17 |
{
|
18 |
$this->actives[] = $profile;
|
19 |
}
|
20 |
|
21 |
+
public function enter(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
22 |
{
|
23 |
$this->actives[0]->addProfile($profile);
|
24 |
array_unshift($this->actives, $profile);
|
25 |
}
|
26 |
|
27 |
+
public function leave(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
28 |
{
|
29 |
$profile->leave();
|
30 |
array_shift($this->actives);
|
36 |
|
37 |
public function getNodeVisitors()
|
38 |
{
|
39 |
+
return array(new Twig_SupTwgDtgs_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
|
16 |
{
|
17 |
protected $sandboxedGlobally;
|
18 |
protected $sandboxed;
|
19 |
protected $policy;
|
20 |
|
21 |
-
public function __construct(
|
22 |
{
|
23 |
$this->policy = $policy;
|
24 |
$this->sandboxedGlobally = $sandboxed;
|
@@ -26,12 +26,12 @@ class Twig_SupTwg_Extension_Sandbox extends Twig_SupTwg_Extension
|
|
26 |
|
27 |
public function getTokenParsers()
|
28 |
{
|
29 |
-
return array(new
|
30 |
}
|
31 |
|
32 |
public function getNodeVisitors()
|
33 |
{
|
34 |
-
return array(new
|
35 |
}
|
36 |
|
37 |
public function enableSandbox()
|
@@ -54,7 +54,7 @@ class Twig_SupTwg_Extension_Sandbox extends Twig_SupTwg_Extension
|
|
54 |
return $this->sandboxedGlobally;
|
55 |
}
|
56 |
|
57 |
-
public function setSecurityPolicy(
|
58 |
{
|
59 |
$this->policy = $policy;
|
60 |
}
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Extension_Sandbox extends Twig_SupTwgDtgs_Extension
|
16 |
{
|
17 |
protected $sandboxedGlobally;
|
18 |
protected $sandboxed;
|
19 |
protected $policy;
|
20 |
|
21 |
+
public function __construct(Twig_SupTwgDtgs_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_SupTwgDtgs_TokenParser_Sandbox());
|
30 |
}
|
31 |
|
32 |
public function getNodeVisitors()
|
33 |
{
|
34 |
+
return array(new Twig_SupTwgDtgs_NodeVisitor_Sandbox());
|
35 |
}
|
36 |
|
37 |
public function enableSandbox()
|
54 |
return $this->sandboxedGlobally;
|
55 |
}
|
56 |
|
57 |
+
public function setSecurityPolicy(Twig_SupTwgDtgs_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
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*
|
19 |
* @internal
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
protected $functions = array();
|
24 |
protected $filters = array();
|
@@ -30,7 +30,7 @@ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
|
|
30 |
public function addFunction($name, $function)
|
31 |
{
|
32 |
if (isset($this->functions[$name])) {
|
33 |
-
|
34 |
}
|
35 |
|
36 |
$this->functions[$name] = $function;
|
@@ -44,7 +44,7 @@ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
|
|
44 |
public function addFilter($name, $filter)
|
45 |
{
|
46 |
if (isset($this->filters[$name])) {
|
47 |
-
|
48 |
}
|
49 |
|
50 |
$this->filters[$name] = $filter;
|
@@ -55,7 +55,7 @@ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
|
|
55 |
return $this->filters;
|
56 |
}
|
57 |
|
58 |
-
public function addNodeVisitor(
|
59 |
{
|
60 |
$this->visitors[] = $visitor;
|
61 |
}
|
@@ -65,10 +65,10 @@ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
|
|
65 |
return $this->visitors;
|
66 |
}
|
67 |
|
68 |
-
public function addTokenParser(
|
69 |
{
|
70 |
if (isset($this->tokenParsers[$parser->getTag()])) {
|
71 |
-
|
72 |
}
|
73 |
|
74 |
$this->tokenParsers[$parser->getTag()] = $parser;
|
@@ -92,7 +92,7 @@ class Twig_SupTwg_Extension_Staging extends Twig_SupTwg_Extension
|
|
92 |
public function addTest($name, $test)
|
93 |
{
|
94 |
if (isset($this->tests[$name])) {
|
95 |
-
|
96 |
}
|
97 |
|
98 |
$this->tests[$name] = $test;
|
12 |
/**
|
13 |
* Internal class.
|
14 |
*
|
15 |
+
* This class is used by Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Staging extends Twig_SupTwgDtgs_Extension
|
22 |
{
|
23 |
protected $functions = array();
|
24 |
protected $filters = array();
|
30 |
public function addFunction($name, $function)
|
31 |
{
|
32 |
if (isset($this->functions[$name])) {
|
33 |
+
//@trigger_error(sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
|
34 |
}
|
35 |
|
36 |
$this->functions[$name] = $function;
|
44 |
public function addFilter($name, $filter)
|
45 |
{
|
46 |
if (isset($this->filters[$name])) {
|
47 |
+
//@trigger_error(sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
|
48 |
}
|
49 |
|
50 |
$this->filters[$name] = $filter;
|
55 |
return $this->filters;
|
56 |
}
|
57 |
|
58 |
+
public function addNodeVisitor(Twig_SupTwgDtgs_NodeVisitorInterface $visitor)
|
59 |
{
|
60 |
$this->visitors[] = $visitor;
|
61 |
}
|
65 |
return $this->visitors;
|
66 |
}
|
67 |
|
68 |
+
public function addTokenParser(Twig_SupTwgDtgs_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);
|
72 |
}
|
73 |
|
74 |
$this->tokenParsers[$parser->getTag()] = $parser;
|
92 |
public function addTest($name, $test)
|
93 |
{
|
94 |
if (isset($this->tests[$name])) {
|
95 |
+
//@trigger_error(sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
|
96 |
}
|
97 |
|
98 |
$this->tests[$name] = $test;
|
vendor/Twig/Extension/StringLoader.php
CHANGED
@@ -12,12 +12,12 @@
|
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
-
class
|
16 |
{
|
17 |
public function getFunctions()
|
18 |
{
|
19 |
return array(
|
20 |
-
new
|
21 |
);
|
22 |
}
|
23 |
|
@@ -34,12 +34,12 @@ class Twig_SupTwg_Extension_StringLoader extends Twig_SupTwg_Extension
|
|
34 |
* {{ include(template_from_string("Hello {{ name }}")) }}
|
35 |
* </pre>
|
36 |
*
|
37 |
-
* @param
|
38 |
* @param string $template A template as a string or object implementing __toString()
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
-
function
|
43 |
{
|
44 |
return $env->createTemplate((string) $template);
|
45 |
}
|
12 |
/**
|
13 |
* @final
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Extension_StringLoader extends Twig_SupTwgDtgs_Extension
|
16 |
{
|
17 |
public function getFunctions()
|
18 |
{
|
19 |
return array(
|
20 |
+
new Twig_SupTwgDtgs_SimpleFunction('template_from_string', 'Twig_SupTwgDtgs_template_from_string', array('needs_environment' => true)),
|
21 |
);
|
22 |
}
|
23 |
|
34 |
* {{ include(template_from_string("Hello {{ name }}")) }}
|
35 |
* </pre>
|
36 |
*
|
37 |
+
* @param Twig_SupTwgDtgs_Environment $env A Twig_SupTwgDtgs_Environment instance
|
38 |
* @param string $template A template as a string or object implementing __toString()
|
39 |
*
|
40 |
+
* @return Twig_SupTwgDtgs_Template
|
41 |
*/
|
42 |
+
function Twig_SupTwgDtgs_template_from_string(Twig_SupTwgDtgs_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
|
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
|
25 |
*/
|
26 |
-
public function initRuntime(
|
27 |
|
28 |
/**
|
29 |
* Returns the token parser instances to add to the existing list.
|
30 |
*
|
31 |
-
* @return
|
32 |
*/
|
33 |
public function getTokenParsers();
|
34 |
|
35 |
/**
|
36 |
* Returns the node visitor instances to add to the existing list.
|
37 |
*
|
38 |
-
* @return
|
39 |
*/
|
40 |
public function getNodeVisitors();
|
41 |
|
42 |
/**
|
43 |
* Returns a list of filters to add to the existing list.
|
44 |
*
|
45 |
-
* @return
|
46 |
*/
|
47 |
public function getFilters();
|
48 |
|
49 |
/**
|
50 |
* Returns a list of tests to add to the existing list.
|
51 |
*
|
52 |
-
* @return
|
53 |
*/
|
54 |
public function getTests();
|
55 |
|
56 |
/**
|
57 |
* Returns a list of functions to add to the existing list.
|
58 |
*
|
59 |
-
* @return
|
60 |
*/
|
61 |
public function getFunctions();
|
62 |
|
@@ -72,7 +72,7 @@ interface Twig_SupTwg_ExtensionInterface
|
|
72 |
*
|
73 |
* @return array An array of global variables
|
74 |
*
|
75 |
-
* @deprecated since 1.23 (to be removed in 2.0), implement
|
76 |
*/
|
77 |
public function getGlobals();
|
78 |
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_InitRuntimeInterface instead
|
25 |
*/
|
26 |
+
public function initRuntime(Twig_SupTwgDtgs_Environment $environment);
|
27 |
|
28 |
/**
|
29 |
* Returns the token parser instances to add to the existing list.
|
30 |
*
|
31 |
+
* @return Twig_SupTwgDtgs_TokenParserInterface[]
|
32 |
*/
|
33 |
public function getTokenParsers();
|
34 |
|
35 |
/**
|
36 |
* Returns the node visitor instances to add to the existing list.
|
37 |
*
|
38 |
+
* @return Twig_SupTwgDtgs_NodeVisitorInterface[]
|
39 |
*/
|
40 |
public function getNodeVisitors();
|
41 |
|
42 |
/**
|
43 |
* Returns a list of filters to add to the existing list.
|
44 |
*
|
45 |
+
* @return Twig_SupTwgDtgs_SimpleFilter[]
|
46 |
*/
|
47 |
public function getFilters();
|
48 |
|
49 |
/**
|
50 |
* Returns a list of tests to add to the existing list.
|
51 |
*
|
52 |
+
* @return Twig_SupTwgDtgs_SimpleTest[]
|
53 |
*/
|
54 |
public function getTests();
|
55 |
|
56 |
/**
|
57 |
* Returns a list of functions to add to the existing list.
|
58 |
*
|
59 |
+
* @return Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
private $map;
|
20 |
|
14 |
*
|
15 |
* @author Robin Chalas <robin.chalas@gmail.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_FactoryRuntimeLoader implements Twig_SupTwgDtgs_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
|
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_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a template filter.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
abstract class
|
24 |
{
|
25 |
protected $options;
|
26 |
protected $arguments = array();
|
@@ -56,7 +56,7 @@ abstract class Twig_SupTwg_Filter implements Twig_SupTwg_FilterInterface, Twig_S
|
|
56 |
return $this->options['needs_context'];
|
57 |
}
|
58 |
|
59 |
-
public function getSafe(
|
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_SupTwgDtgs_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFilter instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a template filter.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Filter implements Twig_SupTwgDtgs_FilterInterface, Twig_SupTwgDtgs_FilterCallableInterface
|
24 |
{
|
25 |
protected $options;
|
26 |
protected $arguments = array();
|
56 |
return $this->options['needs_context'];
|
57 |
}
|
58 |
|
59 |
+
public function getSafe(Twig_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a function template filter.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
protected $function;
|
26 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFilter instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a function template filter.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Filter_Function extends Twig_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a method template filter.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
protected $extension;
|
26 |
protected $method;
|
27 |
|
28 |
-
public function __construct(
|
29 |
{
|
30 |
$options['callable'] = array($extension, $method);
|
31 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFilter instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a method template filter.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Filter_Method extends Twig_SupTwgDtgs_Filter
|
24 |
{
|
25 |
protected $extension;
|
26 |
protected $method;
|
27 |
|
28 |
+
public function __construct(Twig_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a template filter as a node.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
protected $class;
|
26 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFilter instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a template filter as a node.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Filter_Node extends Twig_SupTwgDtgs_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
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*
|
19 |
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
*/
|
21 |
-
interface
|
22 |
{
|
23 |
public function getCallable();
|
24 |
}
|
12 |
/**
|
13 |
* Represents a callable template filter.
|
14 |
*
|
15 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*
|
19 |
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
*/
|
21 |
-
interface
|
22 |
{
|
23 |
/**
|
24 |
* Compiles a filter.
|
@@ -31,7 +31,7 @@ interface Twig_SupTwg_FilterInterface
|
|
31 |
|
32 |
public function needsContext();
|
33 |
|
34 |
-
public function getSafe(
|
35 |
|
36 |
public function getPreservesSafety();
|
37 |
|
12 |
/**
|
13 |
* Represents a template filter.
|
14 |
*
|
15 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_FilterInterface
|
22 |
{
|
23 |
/**
|
24 |
* Compiles a filter.
|
31 |
|
32 |
public function needsContext();
|
33 |
|
34 |
+
public function getSafe(Twig_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a template function.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
abstract class
|
24 |
{
|
25 |
protected $options;
|
26 |
protected $arguments = array();
|
@@ -54,7 +54,7 @@ abstract class Twig_SupTwg_Function implements Twig_SupTwg_FunctionInterface, Tw
|
|
54 |
return $this->options['needs_context'];
|
55 |
}
|
56 |
|
57 |
-
public function getSafe(
|
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_SupTwgDtgs_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFunction instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a template function.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Function implements Twig_SupTwgDtgs_FunctionInterface, Twig_SupTwgDtgs_FunctionCallableInterface
|
24 |
{
|
25 |
protected $options;
|
26 |
protected $arguments = array();
|
54 |
return $this->options['needs_context'];
|
55 |
}
|
56 |
|
57 |
+
public function getSafe(Twig_SupTwgDtgs_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 |
-
|
14 |
|
15 |
/**
|
16 |
* Represents a function template function.
|
17 |
*
|
18 |
-
* Use
|
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
|
25 |
{
|
26 |
protected $function;
|
27 |
|
10 |
* file that was distributed with this source code.
|
11 |
*/
|
12 |
|
13 |
+
//@trigger_error('The Twig_SupTwgDtgs_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFunction instead.', E_USER_DEPRECATED);
|
14 |
|
15 |
/**
|
16 |
* Represents a function template function.
|
17 |
*
|
18 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Function_Function extends Twig_SupTwgDtgs_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 |
-
|
14 |
|
15 |
/**
|
16 |
* Represents a method template function.
|
17 |
*
|
18 |
-
* Use
|
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
|
25 |
{
|
26 |
protected $extension;
|
27 |
protected $method;
|
28 |
|
29 |
-
public function __construct(
|
30 |
{
|
31 |
$options['callable'] = array($extension, $method);
|
32 |
|
10 |
* file that was distributed with this source code.
|
11 |
*/
|
12 |
|
13 |
+
//@trigger_error('The Twig_SupTwgDtgs_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFunction instead.', E_USER_DEPRECATED);
|
14 |
|
15 |
/**
|
16 |
* Represents a method template function.
|
17 |
*
|
18 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Function_Method extends Twig_SupTwgDtgs_Function
|
25 |
{
|
26 |
protected $extension;
|
27 |
protected $method;
|
28 |
|
29 |
+
public function __construct(Twig_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Represents a template function as a node.
|
16 |
*
|
17 |
-
* Use
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*
|
21 |
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
protected $class;
|
26 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_SimpleFunction instead.', E_USER_DEPRECATED);
|
13 |
|
14 |
/**
|
15 |
* Represents a template function as a node.
|
16 |
*
|
17 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_Function_Node extends Twig_SupTwgDtgs_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
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*
|
19 |
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
*/
|
21 |
-
interface
|
22 |
{
|
23 |
public function getCallable();
|
24 |
}
|
12 |
/**
|
13 |
* Represents a callable template function.
|
14 |
*
|
15 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
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
|
23 |
{
|
24 |
/**
|
25 |
* Compiles a function.
|
@@ -32,7 +32,7 @@ interface Twig_SupTwg_FunctionInterface
|
|
32 |
|
33 |
public function needsContext();
|
34 |
|
35 |
-
public function getSafe(
|
36 |
|
37 |
public function setArguments($arguments);
|
38 |
|
13 |
/**
|
14 |
* Represents a template function.
|
15 |
*
|
16 |
+
* Use Twig_SupTwgDtgs_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_SupTwgDtgs_FunctionInterface
|
23 |
{
|
24 |
/**
|
25 |
* Compiles a function.
|
32 |
|
33 |
public function needsContext();
|
34 |
|
35 |
+
public function getSafe(Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
protected $tokens;
|
21 |
protected $code;
|
@@ -49,7 +49,7 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
49 |
const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
|
50 |
const PUNCTUATION = '()[]{}?:.,|';
|
51 |
|
52 |
-
public function __construct(
|
53 |
{
|
54 |
$this->env = $env;
|
55 |
|
@@ -77,15 +77,15 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
77 |
|
78 |
public function tokenize($code, $name = null)
|
79 |
{
|
80 |
-
if (!$code instanceof
|
81 |
-
|
82 |
-
$this->source = new
|
83 |
} else {
|
84 |
$this->source = $code;
|
85 |
}
|
86 |
|
87 |
if (((int) ini_get('mbstring.func_overload')) & 2) {
|
88 |
-
|
89 |
}
|
90 |
|
91 |
if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
|
@@ -136,25 +136,25 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
136 |
}
|
137 |
}
|
138 |
|
139 |
-
$this->pushToken(
|
140 |
|
141 |
if (!empty($this->brackets)) {
|
142 |
list($expect, $lineno) = array_pop($this->brackets);
|
143 |
-
throw new
|
144 |
}
|
145 |
|
146 |
if ($mbEncoding) {
|
147 |
mb_internal_encoding($mbEncoding);
|
148 |
}
|
149 |
|
150 |
-
return new
|
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(
|
158 |
$this->cursor = $this->end;
|
159 |
|
160 |
return;
|
@@ -174,7 +174,7 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
174 |
if (isset($this->positions[2][$this->position][0])) {
|
175 |
$text = rtrim($text);
|
176 |
}
|
177 |
-
$this->pushToken(
|
178 |
$this->moveCursor($textContent.$position[0]);
|
179 |
|
180 |
switch ($this->positions[1][$this->position][0]) {
|
@@ -184,22 +184,22 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
184 |
|
185 |
case $this->options['tag_block'][0]:
|
186 |
// raw data?
|
187 |
-
if (preg_match($this->regexes['lex_block_raw'], $this->code, $match,
|
188 |
$this->moveCursor($match[0]);
|
189 |
$this->lexRawData($match[1]);
|
190 |
// {% line \d+ %}
|
191 |
-
|
192 |
$this->moveCursor($match[0]);
|
193 |
$this->lineno = (int) $match[1];
|
194 |
} else {
|
195 |
-
$this->pushToken(
|
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(
|
203 |
$this->pushState(self::STATE_VAR);
|
204 |
$this->currentVarBlockLine = $this->lineno;
|
205 |
break;
|
@@ -208,8 +208,8 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
208 |
|
209 |
protected function lexBlock()
|
210 |
{
|
211 |
-
if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match,
|
212 |
-
$this->pushToken(
|
213 |
$this->moveCursor($match[0]);
|
214 |
$this->popState();
|
215 |
} else {
|
@@ -219,8 +219,8 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
219 |
|
220 |
protected function lexVar()
|
221 |
{
|
222 |
-
if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match,
|
223 |
-
$this->pushToken(
|
224 |
$this->moveCursor($match[0]);
|
225 |
$this->popState();
|
226 |
} else {
|
@@ -231,31 +231,31 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
231 |
protected function lexExpression()
|
232 |
{
|
233 |
// whitespace
|
234 |
-
if (preg_match('/\s+/A', $this->code, $match,
|
235 |
$this->moveCursor($match[0]);
|
236 |
|
237 |
if ($this->cursor >= $this->end) {
|
238 |
-
throw new
|
239 |
}
|
240 |
}
|
241 |
|
242 |
// operators
|
243 |
-
if (preg_match($this->regexes['operator'], $this->code, $match,
|
244 |
-
$this->pushToken(
|
245 |
$this->moveCursor($match[0]);
|
246 |
}
|
247 |
// names
|
248 |
-
elseif (preg_match(self::REGEX_NAME, $this->code, $match,
|
249 |
-
$this->pushToken(
|
250 |
$this->moveCursor($match[0]);
|
251 |
}
|
252 |
// numbers
|
253 |
-
elseif (preg_match(self::REGEX_NUMBER, $this->code, $match,
|
254 |
$number = (float) $match[0]; // floats
|
255 |
if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) {
|
256 |
$number = (int) $match[0]; // integers lower than the maximum
|
257 |
}
|
258 |
-
$this->pushToken(
|
259 |
$this->moveCursor($match[0]);
|
260 |
}
|
261 |
// punctuation
|
@@ -267,43 +267,43 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
267 |
// closing bracket
|
268 |
elseif (false !== strpos(')]}', $this->code[$this->cursor])) {
|
269 |
if (empty($this->brackets)) {
|
270 |
-
throw new
|
271 |
}
|
272 |
|
273 |
list($expect, $lineno) = array_pop($this->brackets);
|
274 |
if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) {
|
275 |
-
throw new
|
276 |
}
|
277 |
}
|
278 |
|
279 |
-
$this->pushToken(
|
280 |
++$this->cursor;
|
281 |
}
|
282 |
// strings
|
283 |
-
elseif (preg_match(self::REGEX_STRING, $this->code, $match,
|
284 |
-
$this->pushToken(
|
285 |
$this->moveCursor($match[0]);
|
286 |
}
|
287 |
// opening double quoted string
|
288 |
-
elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match,
|
289 |
$this->brackets[] = array('"', $this->lineno);
|
290 |
$this->pushState(self::STATE_STRING);
|
291 |
$this->moveCursor($match[0]);
|
292 |
}
|
293 |
// unlexable
|
294 |
else {
|
295 |
-
throw new
|
296 |
}
|
297 |
}
|
298 |
|
299 |
protected function lexRawData($tag)
|
300 |
{
|
301 |
if ('raw' === $tag) {
|
302 |
-
|
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
|
307 |
}
|
308 |
|
309 |
$text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
|
@@ -313,13 +313,13 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
313 |
$text = rtrim($text);
|
314 |
}
|
315 |
|
316 |
-
$this->pushToken(
|
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
|
323 |
}
|
324 |
|
325 |
$this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]);
|
@@ -327,18 +327,18 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
327 |
|
328 |
protected function lexString()
|
329 |
{
|
330 |
-
if (preg_match($this->regexes['interpolation_start'], $this->code, $match,
|
331 |
$this->brackets[] = array($this->options['interpolation'][0], $this->lineno);
|
332 |
-
$this->pushToken(
|
333 |
$this->moveCursor($match[0]);
|
334 |
$this->pushState(self::STATE_INTERPOLATION);
|
335 |
-
} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match,
|
336 |
-
$this->pushToken(
|
337 |
$this->moveCursor($match[0]);
|
338 |
-
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match,
|
339 |
list($expect, $lineno) = array_pop($this->brackets);
|
340 |
if ($this->code[$this->cursor] != '"') {
|
341 |
-
throw new
|
342 |
}
|
343 |
|
344 |
$this->popState();
|
@@ -349,9 +349,9 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
349 |
protected function lexInterpolation()
|
350 |
{
|
351 |
$bracket = end($this->brackets);
|
352 |
-
if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match,
|
353 |
array_pop($this->brackets);
|
354 |
-
$this->pushToken(
|
355 |
$this->moveCursor($match[0]);
|
356 |
$this->popState();
|
357 |
} else {
|
@@ -362,11 +362,11 @@ class Twig_SupTwg_Lexer implements Twig_SupTwg_LexerInterface
|
|
362 |
protected function pushToken($type, $value = '')
|
363 |
{
|
364 |
// do not push empty text tokens
|
365 |
-
if (
|
366 |
return;
|
367 |
}
|
368 |
|
369 |
-
$this->tokens[] = new
|
370 |
}
|
371 |
|
372 |
protected function moveCursor($text)
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Lexer implements Twig_SupTwgDtgs_LexerInterface
|
19 |
{
|
20 |
protected $tokens;
|
21 |
protected $code;
|
49 |
const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
|
50 |
const PUNCTUATION = '()[]{}?:.,|';
|
51 |
|
52 |
+
public function __construct(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
82 |
+
$this->source = new Twig_SupTwgDtgs_Source($code, $name);
|
83 |
} else {
|
84 |
$this->source = $code;
|
85 |
}
|
86 |
|
87 |
if (((int) ini_get('mbstring.func_overload')) & 2) {
|
88 |
+
//@trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED);
|
89 |
}
|
90 |
|
91 |
if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
|
136 |
}
|
137 |
}
|
138 |
|
139 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::EOF_TYPE);
|
140 |
|
141 |
if (!empty($this->brackets)) {
|
142 |
list($expect, $lineno) = array_pop($this->brackets);
|
143 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::TEXT_TYPE, $text);
|
178 |
$this->moveCursor($textContent.$position[0]);
|
179 |
|
180 |
switch ($this->positions[1][$this->position][0]) {
|
184 |
|
185 |
case $this->options['tag_block'][0]:
|
186 |
// raw data?
|
187 |
+
if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) {
|
188 |
$this->moveCursor($match[0]);
|
189 |
$this->lexRawData($match[1]);
|
190 |
// {% line \d+ %}
|
191 |
+
} elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) {
|
192 |
$this->moveCursor($match[0]);
|
193 |
$this->lineno = (int) $match[1];
|
194 |
} else {
|
195 |
+
$this->pushToken(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::VAR_START_TYPE);
|
203 |
$this->pushState(self::STATE_VAR);
|
204 |
$this->currentVarBlockLine = $this->lineno;
|
205 |
break;
|
208 |
|
209 |
protected function lexBlock()
|
210 |
{
|
211 |
+
if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) {
|
212 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
213 |
$this->moveCursor($match[0]);
|
214 |
$this->popState();
|
215 |
} else {
|
219 |
|
220 |
protected function lexVar()
|
221 |
{
|
222 |
+
if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) {
|
223 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::VAR_END_TYPE);
|
224 |
$this->moveCursor($match[0]);
|
225 |
$this->popState();
|
226 |
} else {
|
231 |
protected function lexExpression()
|
232 |
{
|
233 |
// whitespace
|
234 |
+
if (preg_match('/\s+/A', $this->code, $match, 0, $this->cursor)) {
|
235 |
$this->moveCursor($match[0]);
|
236 |
|
237 |
if ($this->cursor >= $this->end) {
|
238 |
+
throw new Twig_SupTwgDtgs_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, 0, $this->cursor)) {
|
244 |
+
$this->pushToken(Twig_SupTwgDtgs_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, 0, $this->cursor)) {
|
249 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::NAME_TYPE, $match[0]);
|
250 |
$this->moveCursor($match[0]);
|
251 |
}
|
252 |
// numbers
|
253 |
+
elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) {
|
254 |
$number = (float) $match[0]; // floats
|
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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
276 |
}
|
277 |
}
|
278 |
|
279 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]);
|
280 |
++$this->cursor;
|
281 |
}
|
282 |
// strings
|
283 |
+
elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) {
|
284 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)));
|
285 |
$this->moveCursor($match[0]);
|
286 |
}
|
287 |
// opening double quoted string
|
288 |
+
elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
|
289 |
$this->brackets[] = array('"', $this->lineno);
|
290 |
$this->pushState(self::STATE_STRING);
|
291 |
$this->moveCursor($match[0]);
|
292 |
}
|
293 |
// unlexable
|
294 |
else {
|
295 |
+
throw new Twig_SupTwgDtgs_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
|
296 |
}
|
297 |
}
|
298 |
|
299 |
protected function lexRawData($tag)
|
300 |
{
|
301 |
if ('raw' === $tag) {
|
302 |
+
//@trigger_error(sprintf('Twig Tag "raw" is deprecated since version 1.21. Use "verbatim" instead in %s at line %d.', $this->filename, $this->lineno), E_USER_DEPRECATED);
|
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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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]);
|
327 |
|
328 |
protected function lexString()
|
329 |
{
|
330 |
+
if (preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) {
|
331 |
$this->brackets[] = array($this->options['interpolation'][0], $this->lineno);
|
332 |
+
$this->pushToken(Twig_SupTwgDtgs_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, 0, $this->cursor) && strlen($match[0]) > 0) {
|
336 |
+
$this->pushToken(Twig_SupTwgDtgs_Token::STRING_TYPE, stripcslashes($match[0]));
|
337 |
$this->moveCursor($match[0]);
|
338 |
+
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
|
339 |
list($expect, $lineno) = array_pop($this->brackets);
|
340 |
if ($this->code[$this->cursor] != '"') {
|
341 |
+
throw new Twig_SupTwgDtgs_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
342 |
}
|
343 |
|
344 |
$this->popState();
|
349 |
protected function lexInterpolation()
|
350 |
{
|
351 |
$bracket = end($this->brackets);
|
352 |
+
if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) {
|
353 |
array_pop($this->brackets);
|
354 |
+
$this->pushToken(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::TEXT_TYPE === $type && '' === $value) {
|
366 |
return;
|
367 |
}
|
368 |
|
369 |
+
$this->tokens[] = new Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
/**
|
22 |
* Tokenizes a source code.
|
23 |
*
|
24 |
-
* @param string|
|
25 |
* @param string $name A unique identifier for the source code
|
26 |
*
|
27 |
-
* @return
|
28 |
*
|
29 |
-
* @throws
|
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_SupTwgDtgs_LexerInterface
|
20 |
{
|
21 |
/**
|
22 |
* Tokenizes a source code.
|
23 |
*
|
24 |
+
* @param string|Twig_SupTwgDtgs_Source $code The source code
|
25 |
* @param string $name A unique identifier for the source code
|
26 |
*
|
27 |
+
* @return Twig_SupTwgDtgs_TokenStream
|
28 |
*
|
29 |
+
* @throws Twig_SupTwgDtgs_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
|
27 |
{
|
28 |
protected $templates = array();
|
29 |
|
@@ -48,11 +48,11 @@ class Twig_SupTwg_Loader_Array implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
48 |
|
49 |
public function getSource($name)
|
50 |
{
|
51 |
-
|
52 |
|
53 |
$name = (string) $name;
|
54 |
if (!isset($this->templates[$name])) {
|
55 |
-
throw new
|
56 |
}
|
57 |
|
58 |
return $this->templates[$name];
|
@@ -62,10 +62,10 @@ class Twig_SupTwg_Loader_Array implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
62 |
{
|
63 |
$name = (string) $name;
|
64 |
if (!isset($this->templates[$name])) {
|
65 |
-
throw new
|
66 |
}
|
67 |
|
68 |
-
return new
|
69 |
}
|
70 |
|
71 |
public function exists($name)
|
@@ -77,7 +77,7 @@ class Twig_SupTwg_Loader_Array implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
77 |
{
|
78 |
$name = (string) $name;
|
79 |
if (!isset($this->templates[$name])) {
|
80 |
-
throw new
|
81 |
}
|
82 |
|
83 |
return $name.':'.$this->templates[$name];
|
@@ -87,7 +87,7 @@ class Twig_SupTwg_Loader_Array implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
87 |
{
|
88 |
$name = (string) $name;
|
89 |
if (!isset($this->templates[$name])) {
|
90 |
-
throw new
|
91 |
}
|
92 |
|
93 |
return true;
|
23 |
*
|
24 |
* @author Fabien Potencier <fabien@symfony.com>
|
25 |
*/
|
26 |
+
class Twig_SupTwgDtgs_Loader_Array implements Twig_SupTwgDtgs_LoaderInterface, Twig_SupTwgDtgs_ExistsLoaderInterface, Twig_SupTwgDtgs_SourceContextLoaderInterface
|
27 |
{
|
28 |
protected $templates = array();
|
29 |
|
48 |
|
49 |
public function getSource($name)
|
50 |
{
|
51 |
+
//@trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
|
52 |
|
53 |
$name = (string) $name;
|
54 |
if (!isset($this->templates[$name])) {
|
55 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Loader(sprintf('Template "%s" is not defined.', $name));
|
66 |
}
|
67 |
|
68 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
20 |
{
|
21 |
private $hasSourceCache = array();
|
22 |
protected $loaders = array();
|
23 |
|
24 |
/**
|
25 |
-
* @param
|
26 |
*/
|
27 |
public function __construct(array $loaders = array())
|
28 |
{
|
@@ -31,7 +31,7 @@ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
public function addLoader(
|
35 |
{
|
36 |
$this->loaders[] = $loader;
|
37 |
$this->hasSourceCache = array();
|
@@ -39,44 +39,44 @@ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
39 |
|
40 |
public function getSource($name)
|
41 |
{
|
42 |
-
|
43 |
|
44 |
$exceptions = array();
|
45 |
foreach ($this->loaders as $loader) {
|
46 |
-
if ($loader instanceof
|
47 |
continue;
|
48 |
}
|
49 |
|
50 |
try {
|
51 |
return $loader->getSource($name);
|
52 |
-
} catch (
|
53 |
$exceptions[] = $e->getMessage();
|
54 |
}
|
55 |
}
|
56 |
|
57 |
-
throw new
|
58 |
}
|
59 |
|
60 |
public function getSourceContext($name)
|
61 |
{
|
62 |
$exceptions = array();
|
63 |
foreach ($this->loaders as $loader) {
|
64 |
-
if ($loader instanceof
|
65 |
continue;
|
66 |
}
|
67 |
|
68 |
try {
|
69 |
-
if ($loader instanceof
|
70 |
return $loader->getSourceContext($name);
|
71 |
}
|
72 |
|
73 |
-
return new
|
74 |
-
} catch (
|
75 |
$exceptions[] = $e->getMessage();
|
76 |
}
|
77 |
}
|
78 |
|
79 |
-
throw new
|
80 |
}
|
81 |
|
82 |
public function exists($name)
|
@@ -88,7 +88,7 @@ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
88 |
}
|
89 |
|
90 |
foreach ($this->loaders as $loader) {
|
91 |
-
if ($loader instanceof
|
92 |
if ($loader->exists($name)) {
|
93 |
return $this->hasSourceCache[$name] = true;
|
94 |
}
|
@@ -97,14 +97,14 @@ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
97 |
}
|
98 |
|
99 |
try {
|
100 |
-
if ($loader instanceof
|
101 |
$loader->getSourceContext($name);
|
102 |
} else {
|
103 |
$loader->getSource($name);
|
104 |
}
|
105 |
|
106 |
return $this->hasSourceCache[$name] = true;
|
107 |
-
} catch (
|
108 |
}
|
109 |
}
|
110 |
|
@@ -115,35 +115,35 @@ class Twig_SupTwg_Loader_Chain implements Twig_SupTwg_LoaderInterface, Twig_SupT
|
|
115 |
{
|
116 |
$exceptions = array();
|
117 |
foreach ($this->loaders as $loader) {
|
118 |
-
if ($loader instanceof
|
119 |
continue;
|
120 |
}
|
121 |
|
122 |
try {
|
123 |
return $loader->getCacheKey($name);
|
124 |
-
} catch (
|
125 |
$exceptions[] = get_class($loader).': '.$e->getMessage();
|
126 |
}
|
127 |
}
|
128 |
|
129 |
-
throw new
|
130 |
}
|
131 |
|
132 |
public function isFresh($name, $time)
|
133 |
{
|
134 |
$exceptions = array();
|
135 |
foreach ($this->loaders as $loader) {
|
136 |
-
if ($loader instanceof
|
137 |
continue;
|
138 |
}
|
139 |
|
140 |
try {
|
141 |
return $loader->isFresh($name, $time);
|
142 |
-
} catch (
|
143 |
$exceptions[] = get_class($loader).': '.$e->getMessage();
|
144 |
}
|
145 |
}
|
146 |
|
147 |
-
throw new
|
148 |
}
|
149 |
}
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_Loader_Chain implements Twig_SupTwgDtgs_LoaderInterface, Twig_SupTwgDtgs_ExistsLoaderInterface, Twig_SupTwgDtgs_SourceContextLoaderInterface
|
20 |
{
|
21 |
private $hasSourceCache = array();
|
22 |
protected $loaders = array();
|
23 |
|
24 |
/**
|
25 |
+
* @param Twig_SupTwgDtgs_LoaderInterface[] $loaders
|
26 |
*/
|
27 |
public function __construct(array $loaders = array())
|
28 |
{
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
public function addLoader(Twig_SupTwgDtgs_LoaderInterface $loader)
|
35 |
{
|
36 |
$this->loaders[] = $loader;
|
37 |
$this->hasSourceCache = array();
|
39 |
|
40 |
public function getSource($name)
|
41 |
{
|
42 |
+
//@trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
|
43 |
|
44 |
$exceptions = array();
|
45 |
foreach ($this->loaders as $loader) {
|
46 |
+
if ($loader instanceof Twig_SupTwgDtgs_ExistsLoaderInterface && !$loader->exists($name)) {
|
47 |
continue;
|
48 |
}
|
49 |
|
50 |
try {
|
51 |
return $loader->getSource($name);
|
52 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
53 |
$exceptions[] = $e->getMessage();
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_ExistsLoaderInterface && !$loader->exists($name)) {
|
65 |
continue;
|
66 |
}
|
67 |
|
68 |
try {
|
69 |
+
if ($loader instanceof Twig_SupTwgDtgs_SourceContextLoaderInterface) {
|
70 |
return $loader->getSourceContext($name);
|
71 |
}
|
72 |
|
73 |
+
return new Twig_SupTwgDtgs_Source($loader->getSource($name), $name);
|
74 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
75 |
$exceptions[] = $e->getMessage();
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_ExistsLoaderInterface) {
|
92 |
if ($loader->exists($name)) {
|
93 |
return $this->hasSourceCache[$name] = true;
|
94 |
}
|
97 |
}
|
98 |
|
99 |
try {
|
100 |
+
if ($loader instanceof Twig_SupTwgDtgs_SourceContextLoaderInterface) {
|
101 |
$loader->getSourceContext($name);
|
102 |
} else {
|
103 |
$loader->getSource($name);
|
104 |
}
|
105 |
|
106 |
return $this->hasSourceCache[$name] = true;
|
107 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
108 |
}
|
109 |
}
|
110 |
|
115 |
{
|
116 |
$exceptions = array();
|
117 |
foreach ($this->loaders as $loader) {
|
118 |
+
if ($loader instanceof Twig_SupTwgDtgs_ExistsLoaderInterface && !$loader->exists($name)) {
|
119 |
continue;
|
120 |
}
|
121 |
|
122 |
try {
|
123 |
return $loader->getCacheKey($name);
|
124 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
125 |
$exceptions[] = get_class($loader).': '.$e->getMessage();
|
126 |
}
|
127 |
}
|
128 |
|
129 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_ExistsLoaderInterface && !$loader->exists($name)) {
|
137 |
continue;
|
138 |
}
|
139 |
|
140 |
try {
|
141 |
return $loader->isFresh($name, $time);
|
142 |
+
} catch (Twig_SupTwgDtgs_Error_Loader $e) {
|
143 |
$exceptions[] = get_class($loader).': '.$e->getMessage();
|
144 |
}
|
145 |
}
|
146 |
|
147 |
+
throw new Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
/** Identifier of the main namespace. */
|
20 |
const MAIN_NAMESPACE = '__main__';
|
@@ -29,9 +29,9 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
29 |
* @param string|array $paths A path or an array of paths where to look for templates
|
30 |
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
|
31 |
*/
|
32 |
-
public function __construct($paths = array(), $rootPath =
|
33 |
{
|
34 |
-
$this->rootPath = (
|
35 |
if (false !== $realPath = realpath($rootPath)) {
|
36 |
$this->rootPath = $realPath.DIRECTORY_SEPARATOR;
|
37 |
}
|
@@ -89,7 +89,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
89 |
* @param string $path A path where to look for templates
|
90 |
* @param string $namespace A path namespace
|
91 |
*
|
92 |
-
* @throws
|
93 |
*/
|
94 |
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
|
95 |
{
|
@@ -98,7 +98,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
98 |
|
99 |
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
|
100 |
if (!is_dir($checkPath)) {
|
101 |
-
throw new
|
102 |
}
|
103 |
|
104 |
$this->paths[$namespace][] = rtrim($path, '/\\');
|
@@ -110,7 +110,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
110 |
* @param string $path A path where to look for templates
|
111 |
* @param string $namespace A path namespace
|
112 |
*
|
113 |
-
* @throws
|
114 |
*/
|
115 |
public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
|
116 |
{
|
@@ -119,7 +119,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
119 |
|
120 |
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
|
121 |
if (!is_dir($checkPath)) {
|
122 |
-
throw new
|
123 |
}
|
124 |
|
125 |
$path = rtrim($path, '/\\');
|
@@ -133,7 +133,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
133 |
|
134 |
public function getSource($name)
|
135 |
{
|
136 |
-
|
137 |
|
138 |
return file_get_contents($this->findTemplate($name));
|
139 |
}
|
@@ -142,7 +142,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
142 |
{
|
143 |
$path = $this->findTemplate($name);
|
144 |
|
145 |
-
return new
|
146 |
}
|
147 |
|
148 |
public function getCacheKey($name)
|
@@ -166,8 +166,8 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
166 |
|
167 |
try {
|
168 |
return false !== $this->findTemplate($name, false);
|
169 |
-
} catch (
|
170 |
-
|
171 |
|
172 |
return false;
|
173 |
}
|
@@ -192,7 +192,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
192 |
return false;
|
193 |
}
|
194 |
|
195 |
-
throw new
|
196 |
}
|
197 |
|
198 |
$this->validateName($name);
|
@@ -206,7 +206,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
206 |
return false;
|
207 |
}
|
208 |
|
209 |
-
throw new
|
210 |
}
|
211 |
|
212 |
foreach ($this->paths[$namespace] as $path) {
|
@@ -229,14 +229,14 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
229 |
return false;
|
230 |
}
|
231 |
|
232 |
-
throw new
|
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
|
240 |
}
|
241 |
|
242 |
$namespace = substr($name, 1, $pos - 1);
|
@@ -256,7 +256,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
256 |
protected function validateName($name)
|
257 |
{
|
258 |
if (false !== strpos($name, "\0")) {
|
259 |
-
throw new
|
260 |
}
|
261 |
|
262 |
$name = ltrim($name, '/');
|
@@ -270,7 +270,7 @@ class Twig_SupTwg_Loader_Filesystem implements Twig_SupTwg_LoaderInterface, Twig
|
|
270 |
}
|
271 |
|
272 |
if ($level < 0) {
|
273 |
-
throw new
|
274 |
}
|
275 |
}
|
276 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Loader_Filesystem implements Twig_SupTwgDtgs_LoaderInterface, Twig_SupTwgDtgs_ExistsLoaderInterface, Twig_SupTwgDtgs_SourceContextLoaderInterface
|
18 |
{
|
19 |
/** Identifier of the main namespace. */
|
20 |
const MAIN_NAMESPACE = '__main__';
|
29 |
* @param string|array $paths A path or an array of paths where to look for templates
|
30 |
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
|
31 |
*/
|
32 |
+
public function __construct($paths = array(), $rootPath = '')
|
33 |
{
|
34 |
+
$this->rootPath = ('' === $rootPath ? getcwd() : $rootPath).DIRECTORY_SEPARATOR;
|
35 |
if (false !== $realPath = realpath($rootPath)) {
|
36 |
$this->rootPath = $realPath.DIRECTORY_SEPARATOR;
|
37 |
}
|
89 |
* @param string $path A path where to look for templates
|
90 |
* @param string $namespace A path namespace
|
91 |
*
|
92 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
|
123 |
}
|
124 |
|
125 |
$path = rtrim($path, '/\\');
|
133 |
|
134 |
public function getSource($name)
|
135 |
{
|
136 |
+
//@trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
|
137 |
|
138 |
return file_get_contents($this->findTemplate($name));
|
139 |
}
|
142 |
{
|
143 |
$path = $this->findTemplate($name);
|
144 |
|
145 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_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;
|
173 |
}
|
192 |
return false;
|
193 |
}
|
194 |
|
195 |
+
throw new Twig_SupTwgDtgs_Error_Loader($this->errorCache[$name]);
|
196 |
}
|
197 |
|
198 |
$this->validateName($name);
|
206 |
return false;
|
207 |
}
|
208 |
|
209 |
+
throw new Twig_SupTwgDtgs_Error_Loader($this->errorCache[$name]);
|
210 |
}
|
211 |
|
212 |
foreach ($this->paths[$namespace] as $path) {
|
229 |
return false;
|
230 |
}
|
231 |
|
232 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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 |
-
|
13 |
|
14 |
/**
|
15 |
* Loads a template from a string.
|
@@ -27,18 +27,18 @@
|
|
27 |
*
|
28 |
* @author Fabien Potencier <fabien@symfony.com>
|
29 |
*/
|
30 |
-
class
|
31 |
{
|
32 |
public function getSource($name)
|
33 |
{
|
34 |
-
|
35 |
|
36 |
return $name;
|
37 |
}
|
38 |
|
39 |
public function getSourceContext($name)
|
40 |
{
|
41 |
-
return new
|
42 |
}
|
43 |
|
44 |
public function exists($name)
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_SupTwgDtgs_Loader_Array instead or Twig_SupTwgDtgs_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_SupTwgDtgs_Loader_String implements Twig_SupTwgDtgs_LoaderInterface, Twig_SupTwgDtgs_ExistsLoaderInterface, Twig_SupTwgDtgs_SourceContextLoaderInterface
|
31 |
{
|
32 |
public function getSource($name)
|
33 |
{
|
34 |
+
//@trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
|
35 |
|
36 |
return $name;
|
37 |
}
|
38 |
|
39 |
public function getSourceContext($name)
|
40 |
{
|
41 |
+
return new Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
/**
|
20 |
* Gets the source code of a template, given its name.
|
@@ -23,9 +23,9 @@ interface Twig_SupTwg_LoaderInterface
|
|
23 |
*
|
24 |
* @return string The template source code
|
25 |
*
|
26 |
-
* @throws
|
27 |
*
|
28 |
-
* @deprecated since 1.27 (to be removed in 2.0), implement
|
29 |
*/
|
30 |
public function getSource($name);
|
31 |
|
@@ -36,7 +36,7 @@ interface Twig_SupTwg_LoaderInterface
|
|
36 |
*
|
37 |
* @return string The cache key
|
38 |
*
|
39 |
-
* @throws
|
40 |
*/
|
41 |
public function getCacheKey($name);
|
42 |
|
@@ -49,7 +49,7 @@ interface Twig_SupTwg_LoaderInterface
|
|
49 |
*
|
50 |
* @return bool true if the template is fresh, false otherwise
|
51 |
*
|
52 |
-
* @throws
|
53 |
*/
|
54 |
public function isFresh($name, $time);
|
55 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Loader When $name is not found
|
27 |
*
|
28 |
+
* @deprecated since 1.27 (to be removed in 2.0), implement Twig_SupTwgDtgs_SourceContextLoaderInterface
|
29 |
*/
|
30 |
public function getSource($name);
|
31 |
|
36 |
*
|
37 |
* @return string The cache key
|
38 |
*
|
39 |
+
* @throws Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
protected $content;
|
20 |
protected $charset;
|
@@ -29,7 +29,7 @@ class Twig_SupTwg_Markup implements Countable
|
|
29 |
{
|
30 |
return $this->content;
|
31 |
}
|
32 |
-
|
33 |
public function count()
|
34 |
{
|
35 |
return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content);
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Markup implements Countable
|
18 |
{
|
19 |
protected $content;
|
20 |
protected $charset;
|
29 |
{
|
30 |
return $this->content;
|
31 |
}
|
32 |
+
#[\ReturnTypeWillChange]
|
33 |
public function count()
|
34 |
{
|
35 |
return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content);
|
vendor/Twig/Node.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
-
class
|
19 |
{
|
20 |
protected $nodes;
|
21 |
protected $attributes;
|
@@ -38,8 +38,8 @@ class Twig_SupTwg_Node implements Twig_SupTwg_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
|
42 |
-
//
|
43 |
// }
|
44 |
}
|
45 |
$this->nodes = $nodes;
|
@@ -81,7 +81,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
81 |
*/
|
82 |
public function toXml($asDom = false)
|
83 |
{
|
84 |
-
|
85 |
|
86 |
$dom = new DOMDocument('1.0', 'UTF-8');
|
87 |
$dom->formatOutput = true;
|
@@ -111,7 +111,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
111 |
return $asDom ? $dom : $dom->saveXML();
|
112 |
}
|
113 |
|
114 |
-
public function compile(
|
115 |
{
|
116 |
foreach ($this->nodes as $node) {
|
117 |
$node->compile($compiler);
|
@@ -128,7 +128,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
128 |
*/
|
129 |
public function getLine()
|
130 |
{
|
131 |
-
|
132 |
|
133 |
return $this->lineno;
|
134 |
}
|
@@ -162,11 +162,12 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
162 |
* @param string $name
|
163 |
* @param mixed $value
|
164 |
*/
|
|
|
165 |
public function setAttribute($name, $value)
|
166 |
{
|
167 |
$this->attributes[$name] = $value;
|
168 |
}
|
169 |
-
|
170 |
public function removeAttribute($name)
|
171 |
{
|
172 |
unset($this->attributes[$name]);
|
@@ -175,14 +176,16 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
175 |
/**
|
176 |
* @return bool
|
177 |
*/
|
|
|
178 |
public function hasNode($name)
|
179 |
{
|
180 |
return array_key_exists($name, $this->nodes);
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
-
* @return
|
185 |
*/
|
|
|
186 |
public function getNode($name)
|
187 |
{
|
188 |
if (!array_key_exists($name, $this->nodes)) {
|
@@ -192,30 +195,31 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
192 |
return $this->nodes[$name];
|
193 |
}
|
194 |
|
|
|
195 |
public function setNode($name, $node = null)
|
196 |
{
|
197 |
-
// if (!$node instanceof
|
198 |
-
//
|
199 |
// }
|
200 |
|
201 |
$this->nodes[$name] = $node;
|
202 |
}
|
203 |
-
|
204 |
public function removeNode($name)
|
205 |
{
|
206 |
unset($this->nodes[$name]);
|
207 |
}
|
208 |
-
|
209 |
public function count()
|
210 |
{
|
211 |
return count($this->nodes);
|
212 |
}
|
213 |
-
|
214 |
public function getIterator()
|
215 |
{
|
216 |
return new ArrayIterator($this->nodes);
|
217 |
}
|
218 |
-
|
219 |
public function setTemplateName($name)
|
220 |
{
|
221 |
$this->name = $name;
|
@@ -225,7 +229,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
225 |
}
|
226 |
}
|
227 |
}
|
228 |
-
|
229 |
public function getTemplateName()
|
230 |
{
|
231 |
return $this->name;
|
@@ -236,7 +240,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
236 |
*/
|
237 |
public function setFilename($name)
|
238 |
{
|
239 |
-
|
240 |
|
241 |
$this->setTemplateName($name);
|
242 |
}
|
@@ -246,7 +250,7 @@ class Twig_SupTwg_Node implements Twig_SupTwg_NodeInterface
|
|
246 |
*/
|
247 |
public function getFilename()
|
248 |
{
|
249 |
-
|
250 |
|
251 |
return $this->name;
|
252 |
}
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_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_SupTwgDtgs_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;
|
81 |
*/
|
82 |
public function toXml($asDom = false)
|
83 |
{
|
84 |
+
//@trigger_error(sprintf('%s is deprecated since version 1.16.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);
|
85 |
|
86 |
$dom = new DOMDocument('1.0', 'UTF-8');
|
87 |
$dom->formatOutput = true;
|
111 |
return $asDom ? $dom : $dom->saveXML();
|
112 |
}
|
113 |
|
114 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
115 |
{
|
116 |
foreach ($this->nodes as $node) {
|
117 |
$node->compile($compiler);
|
128 |
*/
|
129 |
public function getLine()
|
130 |
{
|
131 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.', E_USER_DEPRECATED);
|
132 |
|
133 |
return $this->lineno;
|
134 |
}
|
162 |
* @param string $name
|
163 |
* @param mixed $value
|
164 |
*/
|
165 |
+
#[\ReturnTypeWillChange]
|
166 |
public function setAttribute($name, $value)
|
167 |
{
|
168 |
$this->attributes[$name] = $value;
|
169 |
}
|
170 |
+
#[\ReturnTypeWillChange]
|
171 |
public function removeAttribute($name)
|
172 |
{
|
173 |
unset($this->attributes[$name]);
|
176 |
/**
|
177 |
* @return bool
|
178 |
*/
|
179 |
+
#[\ReturnTypeWillChange]
|
180 |
public function hasNode($name)
|
181 |
{
|
182 |
return array_key_exists($name, $this->nodes);
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
+
* @return Twig_SupTwgDtgs_Node
|
187 |
*/
|
188 |
+
#[\ReturnTypeWillChange]
|
189 |
public function getNode($name)
|
190 |
{
|
191 |
if (!array_key_exists($name, $this->nodes)) {
|
195 |
return $this->nodes[$name];
|
196 |
}
|
197 |
|
198 |
+
#[\ReturnTypeWillChange]
|
199 |
public function setNode($name, $node = null)
|
200 |
{
|
201 |
+
// if (!$node instanceof Twig_SupTwgDtgs_NodeInterface) {
|
202 |
+
// //@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);
|
203 |
// }
|
204 |
|
205 |
$this->nodes[$name] = $node;
|
206 |
}
|
207 |
+
#[\ReturnTypeWillChange]
|
208 |
public function removeNode($name)
|
209 |
{
|
210 |
unset($this->nodes[$name]);
|
211 |
}
|
212 |
+
#[\ReturnTypeWillChange]
|
213 |
public function count()
|
214 |
{
|
215 |
return count($this->nodes);
|
216 |
}
|
217 |
+
#[\ReturnTypeWillChange]
|
218 |
public function getIterator()
|
219 |
{
|
220 |
return new ArrayIterator($this->nodes);
|
221 |
}
|
222 |
+
#[\ReturnTypeWillChange]
|
223 |
public function setTemplateName($name)
|
224 |
{
|
225 |
$this->name = $name;
|
229 |
}
|
230 |
}
|
231 |
}
|
232 |
+
#[\ReturnTypeWillChange]
|
233 |
public function getTemplateName()
|
234 |
{
|
235 |
return $this->name;
|
240 |
*/
|
241 |
public function setFilename($name)
|
242 |
{
|
243 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use setTemplateName() instead.', E_USER_DEPRECATED);
|
244 |
|
245 |
$this->setTemplateName($name);
|
246 |
}
|
250 |
*/
|
251 |
public function getFilename()
|
252 |
{
|
253 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateName() instead.', E_USER_DEPRECATED);
|
254 |
|
255 |
return $this->name;
|
256 |
}
|
vendor/Twig/Node/AutoEscape.php
CHANGED
@@ -20,14 +20,14 @@
|
|
20 |
*
|
21 |
* @author Fabien Potencier <fabien@symfony.com>
|
22 |
*/
|
23 |
-
class
|
24 |
{
|
25 |
-
public function __construct($value,
|
26 |
{
|
27 |
parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
|
28 |
}
|
29 |
|
30 |
-
public function compile(
|
31 |
{
|
32 |
$compiler->subcompile($this->getNode('body'));
|
33 |
}
|
20 |
*
|
21 |
* @author Fabien Potencier <fabien@symfony.com>
|
22 |
*/
|
23 |
+
class Twig_SupTwgDtgs_Node_AutoEscape extends Twig_SupTwgDtgs_Node
|
24 |
{
|
25 |
+
public function __construct($value, Twig_SupTwgDtgs_NodeInterface $body, $lineno, $tag = 'autoescape')
|
26 |
{
|
27 |
parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
|
28 |
}
|
29 |
|
30 |
+
public function compile(Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
-
public function __construct($name,
|
21 |
{
|
22 |
parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
|
23 |
}
|
24 |
|
25 |
-
public function compile(
|
26 |
{
|
27 |
$compiler
|
28 |
->addDebugInfo($this)
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_Block extends Twig_SupTwgDtgs_Node
|
19 |
{
|
20 |
+
public function __construct($name, Twig_SupTwgDtgs_NodeInterface $body, $lineno, $tag = null)
|
21 |
{
|
22 |
parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
|
23 |
}
|
24 |
|
25 |
+
public function compile(Twig_SupTwgDtgs_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
|
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(
|
26 |
{
|
27 |
$compiler
|
28 |
->addDebugInfo($this)
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_BlockReference extends Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Body extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
}
|
vendor/Twig/Node/CheckSecurity.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
/**
|
13 |
* @author Fabien Potencier <fabien@symfony.com>
|
14 |
*/
|
15 |
-
class
|
16 |
{
|
17 |
protected $usedFilters;
|
18 |
protected $usedTags;
|
@@ -27,12 +27,12 @@ class Twig_SupTwg_Node_CheckSecurity extends Twig_SupTwg_Node
|
|
27 |
parent::__construct();
|
28 |
}
|
29 |
|
30 |
-
public function compile(
|
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
|
36 |
${$type}[$name] = $node->getTemplateLine();
|
37 |
} else {
|
38 |
${$type}[$node] = null;
|
@@ -46,7 +46,7 @@ class Twig_SupTwg_Node_CheckSecurity extends Twig_SupTwg_Node
|
|
46 |
->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n")
|
47 |
->write("try {\n")
|
48 |
->indent()
|
49 |
-
->write("\$this->env->getExtension('
|
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_SupTwg_Node_CheckSecurity extends Twig_SupTwg_Node
|
|
54 |
->outdent()
|
55 |
->write(");\n")
|
56 |
->outdent()
|
57 |
-
->write("} catch (
|
58 |
->indent()
|
59 |
->write("\$e->setSourceContext(\$this->getSourceContext());\n\n")
|
60 |
-
->write("if (\$e instanceof
|
61 |
->indent()
|
62 |
->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")
|
63 |
->outdent()
|
64 |
-
->write("} elseif (\$e instanceof
|
65 |
->indent()
|
66 |
->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")
|
67 |
->outdent()
|
68 |
-
->write("} elseif (\$e instanceof
|
69 |
->indent()
|
70 |
->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")
|
71 |
->outdent()
|
12 |
/**
|
13 |
* @author Fabien Potencier <fabien@symfony.com>
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Node_CheckSecurity extends Twig_SupTwgDtgs_Node
|
16 |
{
|
17 |
protected $usedFilters;
|
18 |
protected $usedTags;
|
27 |
parent::__construct();
|
28 |
}
|
29 |
|
30 |
+
public function compile(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Sandbox_SecurityError \$e) {\n")
|
58 |
->indent()
|
59 |
->write("\$e->setSourceContext(\$this->getSourceContext());\n\n")
|
60 |
+
->write("if (\$e instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function __construct(
|
20 |
{
|
21 |
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Do extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $expr, $lineno, $tag = null)
|
20 |
{
|
21 |
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
+
public function compile(Twig_SupTwgDtgs_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
|
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,
|
21 |
{
|
22 |
-
parent::__construct(new
|
23 |
|
24 |
$this->setAttribute('name', $name);
|
25 |
// to be removed in 2.0, used name instead
|
@@ -27,7 +27,7 @@ class Twig_SupTwg_Node_Embed extends Twig_SupTwg_Node_Include
|
|
27 |
$this->setAttribute('index', $index);
|
28 |
}
|
29 |
|
30 |
-
protected function addGetTemplate(
|
31 |
{
|
32 |
$compiler
|
33 |
->write('$this->loadTemplate(')
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Embed extends Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno = null, $tag = null)
|
21 |
{
|
22 |
+
parent::__construct(new Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
19 |
{
|
20 |
}
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
abstract class Twig_SupTwgDtgs_Node_Expression extends Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
protected $index;
|
14 |
|
@@ -18,7 +18,7 @@ class Twig_SupTwg_Node_Expression_Array extends Twig_SupTwg_Node_Expression
|
|
18 |
|
19 |
$this->index = -1;
|
20 |
foreach ($this->getKeyValuePairs() as $pair) {
|
21 |
-
if ($pair['key'] instanceof
|
22 |
$this->index = $pair['key']->getAttribute('value');
|
23 |
}
|
24 |
}
|
@@ -38,7 +38,7 @@ class Twig_SupTwg_Node_Expression_Array extends Twig_SupTwg_Node_Expression
|
|
38 |
return $pairs;
|
39 |
}
|
40 |
|
41 |
-
public function hasElement(
|
42 |
{
|
43 |
foreach ($this->getKeyValuePairs() as $pair) {
|
44 |
// we compare the string representation of the keys
|
@@ -51,16 +51,16 @@ class Twig_SupTwg_Node_Expression_Array extends Twig_SupTwg_Node_Expression
|
|
51 |
return false;
|
52 |
}
|
53 |
|
54 |
-
public function addElement(
|
55 |
{
|
56 |
if (null === $key) {
|
57 |
-
$key = new
|
58 |
}
|
59 |
|
60 |
array_push($this->nodes, $key, $value);
|
61 |
}
|
62 |
|
63 |
-
public function compile(
|
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_SupTwgDtgs_Node_Expression_Array extends Twig_SupTwgDtgs_Node_Expression
|
12 |
{
|
13 |
protected $index;
|
14 |
|
18 |
|
19 |
$this->index = -1;
|
20 |
foreach ($this->getKeyValuePairs() as $pair) {
|
21 |
+
if ($pair['key'] instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression $value, Twig_SupTwgDtgs_Node_Expression $key = null)
|
55 |
{
|
56 |
if (null === $key) {
|
57 |
+
$key = new Twig_SupTwgDtgs_Node_Expression_Constant(++$this->index, $value->getTemplateLine());
|
58 |
}
|
59 |
|
60 |
array_push($this->nodes, $key, $value);
|
61 |
}
|
62 |
|
63 |
+
public function compile(Twig_SupTwgDtgs_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
|
14 |
{
|
15 |
-
public function compile(
|
16 |
{
|
17 |
$compiler
|
18 |
->raw('$context[')
|
10 |
* file that was distributed with this source code.
|
11 |
*/
|
12 |
|
13 |
+
class Twig_SupTwgDtgs_Node_Expression_AssignName extends Twig_SupTwgDtgs_Node_Expression_Name
|
14 |
{
|
15 |
+
public function compile(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
20 |
{
|
21 |
$compiler
|
22 |
->raw('(')
|
@@ -31,5 +31,5 @@ abstract class Twig_SupTwg_Node_Expression_Binary extends Twig_SupTwg_Node_Expre
|
|
31 |
;
|
32 |
}
|
33 |
|
34 |
-
abstract public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary extends Twig_SupTwgDtgs_Node_Expression
|
13 |
{
|
14 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $left, Twig_SupTwgDtgs_NodeInterface $right, $lineno)
|
15 |
{
|
16 |
parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
20 |
{
|
21 |
$compiler
|
22 |
->raw('(')
|
31 |
;
|
32 |
}
|
33 |
|
34 |
+
abstract public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Add extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_And extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_BitwiseAnd extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_BitwiseOr extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_BitwiseXor extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Concat extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Div extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$left = $compiler->getVarName();
|
16 |
$right = $compiler->getVarName();
|
@@ -23,7 +23,7 @@ class Twig_SupTwg_Node_Expression_Binary_EndsWith extends Twig_SupTwg_Node_Expre
|
|
23 |
;
|
24 |
}
|
25 |
|
26 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_EndsWith extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$left = $compiler->getVarName();
|
16 |
$right = $compiler->getVarName();
|
23 |
;
|
24 |
}
|
25 |
|
26 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Equal extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$compiler->raw('(int) floor(');
|
16 |
parent::compile($compiler);
|
17 |
$compiler->raw(')');
|
18 |
}
|
19 |
|
20 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_FloorDiv extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$compiler->raw('(int) floor(');
|
16 |
parent::compile($compiler);
|
17 |
$compiler->raw(')');
|
18 |
}
|
19 |
|
20 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Greater extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_GreaterEqual extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$compiler
|
16 |
-
->raw('
|
17 |
->subcompile($this->getNode('left'))
|
18 |
->raw(', ')
|
19 |
->subcompile($this->getNode('right'))
|
@@ -21,7 +21,7 @@ class Twig_SupTwg_Node_Expression_Binary_In extends Twig_SupTwg_Node_Expression_
|
|
21 |
;
|
22 |
}
|
23 |
|
24 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_In extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$compiler
|
16 |
+
->raw('Twig_SupTwgDtgs_in_filter(')
|
17 |
->subcompile($this->getNode('left'))
|
18 |
->raw(', ')
|
19 |
->subcompile($this->getNode('right'))
|
21 |
;
|
22 |
}
|
23 |
|
24 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Less extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_LessEqual extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$compiler
|
16 |
->raw('preg_match(')
|
@@ -21,7 +21,7 @@ class Twig_SupTwg_Node_Expression_Binary_Matches extends Twig_SupTwg_Node_Expres
|
|
21 |
;
|
22 |
}
|
23 |
|
24 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Matches extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$compiler
|
16 |
->raw('preg_match(')
|
21 |
;
|
22 |
}
|
23 |
|
24 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Mod extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Mul extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_NotEqual extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$compiler
|
16 |
-
->raw('!
|
17 |
->subcompile($this->getNode('left'))
|
18 |
->raw(', ')
|
19 |
->subcompile($this->getNode('right'))
|
@@ -21,7 +21,7 @@ class Twig_SupTwg_Node_Expression_Binary_NotIn extends Twig_SupTwg_Node_Expressi
|
|
21 |
;
|
22 |
}
|
23 |
|
24 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_NotIn extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$compiler
|
16 |
+
->raw('!Twig_SupTwgDtgs_in_filter(')
|
17 |
->subcompile($this->getNode('left'))
|
18 |
->raw(', ')
|
19 |
->subcompile($this->getNode('right'))
|
21 |
;
|
22 |
}
|
23 |
|
24 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Or extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
if (PHP_VERSION_ID >= 50600) {
|
16 |
return parent::compile($compiler);
|
@@ -25,7 +25,7 @@ class Twig_SupTwg_Node_Expression_Binary_Power extends Twig_SupTwg_Node_Expressi
|
|
25 |
;
|
26 |
}
|
27 |
|
28 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Power extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
if (PHP_VERSION_ID >= 50600) {
|
16 |
return parent::compile($compiler);
|
25 |
;
|
26 |
}
|
27 |
|
28 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$compiler
|
16 |
->raw('range(')
|
@@ -21,7 +21,7 @@ class Twig_SupTwg_Node_Expression_Binary_Range extends Twig_SupTwg_Node_Expressi
|
|
21 |
;
|
22 |
}
|
23 |
|
24 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Range extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$compiler
|
16 |
->raw('range(')
|
21 |
;
|
22 |
}
|
23 |
|
24 |
+
public function operator(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function compile(
|
14 |
{
|
15 |
$left = $compiler->getVarName();
|
16 |
$right = $compiler->getVarName();
|
@@ -23,7 +23,7 @@ class Twig_SupTwg_Node_Expression_Binary_StartsWith extends Twig_SupTwg_Node_Exp
|
|
23 |
;
|
24 |
}
|
25 |
|
26 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_StartsWith extends Twig_SupTwgDtgs_Node_Expression_Binary
|
12 |
{
|
13 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
14 |
{
|
15 |
$left = $compiler->getVarName();
|
16 |
$right = $compiler->getVarName();
|
23 |
;
|
24 |
}
|
25 |
|
26 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Binary_Sub extends Twig_SupTwgDtgs_Node_Expression_Binary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_Compiler $compiler)
|
15 |
{
|
16 |
return $compiler->raw('-');
|
17 |
}
|
vendor/Twig/Node/Expression/BlockReference.php
CHANGED
@@ -15,15 +15,15 @@
|
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
-
class
|
19 |
{
|
20 |
/**
|
21 |
-
* @param
|
22 |
*/
|
23 |
-
public function __construct(
|
24 |
{
|
25 |
if (is_bool($template)) {
|
26 |
-
|
27 |
|
28 |
$template = null;
|
29 |
}
|
@@ -36,7 +36,7 @@ class Twig_SupTwg_Node_Expression_BlockReference extends Twig_SupTwg_Node_Expres
|
|
36 |
parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
|
37 |
}
|
38 |
|
39 |
-
public function compile(
|
40 |
{
|
41 |
if ($this->getAttribute('is_defined_test')) {
|
42 |
$this->compileTemplateCall($compiler, 'hasBlock');
|
@@ -53,7 +53,7 @@ class Twig_SupTwg_Node_Expression_BlockReference extends Twig_SupTwg_Node_Expres
|
|
53 |
}
|
54 |
}
|
55 |
|
56 |
-
private function compileTemplateCall(
|
57 |
{
|
58 |
if (!$this->hasNode('template')) {
|
59 |
$compiler->write('$this');
|
@@ -75,7 +75,7 @@ class Twig_SupTwg_Node_Expression_BlockReference extends Twig_SupTwg_Node_Expres
|
|
75 |
return $compiler;
|
76 |
}
|
77 |
|
78 |
-
private function compileBlockArguments(
|
79 |
{
|
80 |
$compiler
|
81 |
->raw('(')
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_Expression_BlockReference extends Twig_SupTwgDtgs_Node_Expression
|
19 |
{
|
20 |
/**
|
21 |
+
* @param Twig_SupTwgDtgs_Node|null $template
|
22 |
*/
|
23 |
+
public function __construct(Twig_SupTwgDtgs_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);
|
27 |
|
28 |
$template = null;
|
29 |
}
|
36 |
parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
|
37 |
}
|
38 |
|
39 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
40 |
{
|
41 |
if ($this->getAttribute('is_defined_test')) {
|
42 |
$this->compileTemplateCall($compiler, 'hasBlock');
|
53 |
}
|
54 |
}
|
55 |
|
56 |
+
private function compileTemplateCall(Twig_SupTwgDtgs_Compiler $compiler, $method)
|
57 |
{
|
58 |
if (!$this->hasNode('template')) {
|
59 |
$compiler->write('$this');
|
75 |
return $compiler;
|
76 |
}
|
77 |
|
78 |
+
private function compileBlockArguments(Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
private $reflector;
|
14 |
|
15 |
-
protected function compileCallable(
|
16 |
{
|
17 |
$closingParenthesis = false;
|
18 |
if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) {
|
@@ -26,7 +26,7 @@ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
26 |
} else {
|
27 |
$compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
|
28 |
}
|
29 |
-
} elseif ($r instanceof ReflectionMethod && $callable[0] instanceof
|
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_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
protected function compileArguments(
|
49 |
{
|
50 |
$compiler->raw('(');
|
51 |
|
@@ -111,7 +111,7 @@ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
111 |
$named = true;
|
112 |
$name = $this->normalizeName($name);
|
113 |
} elseif ($named) {
|
114 |
-
throw new
|
115 |
}
|
116 |
|
117 |
$parameters[$name] = $node;
|
@@ -143,11 +143,11 @@ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
143 |
|
144 |
if (array_key_exists($name, $parameters)) {
|
145 |
if (array_key_exists($pos, $parameters)) {
|
146 |
-
throw new
|
147 |
}
|
148 |
|
149 |
if (count($missingArguments)) {
|
150 |
-
throw new
|
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_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
164 |
$optionalArguments = array();
|
165 |
++$pos;
|
166 |
} elseif ($callableParameter->isDefaultValueAvailable()) {
|
167 |
-
$optionalArguments[] = new
|
168 |
} elseif ($callableParameter->isOptional()) {
|
169 |
if (empty($parameters)) {
|
170 |
break;
|
@@ -172,17 +172,17 @@ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
172 |
$missingArguments[] = $name;
|
173 |
}
|
174 |
} else {
|
175 |
-
throw new
|
176 |
}
|
177 |
}
|
178 |
|
179 |
if ($isVariadic) {
|
180 |
-
$arbitraryArguments = new
|
181 |
foreach ($parameters as $key => $value) {
|
182 |
if (is_int($key)) {
|
183 |
$arbitraryArguments->addElement($value);
|
184 |
} else {
|
185 |
-
$arbitraryArguments->addElement($value, new
|
186 |
}
|
187 |
unset($parameters[$key]);
|
188 |
}
|
@@ -196,13 +196,13 @@ abstract class Twig_SupTwg_Node_Expression_Call extends Twig_SupTwg_Node_Express
|
|
196 |
if (!empty($parameters)) {
|
197 |
$unknownParameter = null;
|
198 |
foreach ($parameters as $parameter) {
|
199 |
-
if ($parameter instanceof
|
200 |
$unknownParameter = $parameter;
|
201 |
break;
|
202 |
}
|
203 |
}
|
204 |
|
205 |
-
throw new
|
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_SupTwgDtgs_Node_Expression_Call extends Twig_SupTwgDtgs_Node_Expression
|
12 |
{
|
13 |
private $reflector;
|
14 |
|
15 |
+
protected function compileCallable(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Compiler $compiler)
|
49 |
{
|
50 |
$compiler->raw('(');
|
51 |
|
111 |
$named = true;
|
112 |
$name = $this->normalizeName($name);
|
113 |
} elseif ($named) {
|
114 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
|
147 |
}
|
148 |
|
149 |
if (count($missingArguments)) {
|
150 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node) {
|
200 |
$unknownParameter = $parameter;
|
201 |
break;
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
throw new Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
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_SupTwgDtgs_Node_Expression_Conditional extends Twig_SupTwgDtgs_Node_Expression
|
13 |
{
|
14 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $expr1, Twig_SupTwgDtgs_Node_Expression $expr2, Twig_SupTwgDtgs_Node_Expression $expr3, $lineno)
|
15 |
{
|
16 |
parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
+
public function compile(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
public function __construct($value, $lineno)
|
15 |
{
|
16 |
parent::__construct(array(), array('value' => $value), $lineno);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
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_SupTwgDtgs_Node_Expression_Constant extends Twig_SupTwgDtgs_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_SupTwgDtgs_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 |
-
|
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
|
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(
|
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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_ExtensionReference extends Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
20 |
{
|
21 |
$name = $this->getNode('filter')->getAttribute('value');
|
22 |
$filter = $compiler->getEnvironment()->getFilter($name);
|
@@ -27,10 +27,10 @@ class Twig_SupTwg_Node_Expression_Filter extends Twig_SupTwg_Node_Expression_Cal
|
|
27 |
$this->setAttribute('needs_environment', $filter->needsEnvironment());
|
28 |
$this->setAttribute('needs_context', $filter->needsContext());
|
29 |
$this->setAttribute('arguments', $filter->getArguments());
|
30 |
-
if ($filter instanceof
|
31 |
$this->setAttribute('callable', $filter->getCallable());
|
32 |
}
|
33 |
-
if ($filter instanceof
|
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_SupTwgDtgs_Node_Expression_Filter extends Twig_SupTwgDtgs_Node_Expression_Call
|
13 |
{
|
14 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Node_Expression_Constant $filterName, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_FilterCallableInterface || $filter instanceof Twig_SupTwgDtgs_SimpleFilter) {
|
31 |
$this->setAttribute('callable', $filter->getCallable());
|
32 |
}
|
33 |
+
if ($filter instanceof Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function __construct(
|
24 |
{
|
25 |
-
$default = new
|
26 |
|
27 |
-
if ('default' === $filterName->getAttribute('value') && ($node instanceof
|
28 |
-
$test = new
|
29 |
-
$false = count($arguments) ? $arguments->getNode(0) : new
|
30 |
|
31 |
-
$node = new
|
32 |
} else {
|
33 |
$node = $default;
|
34 |
}
|
@@ -36,7 +36,7 @@ class Twig_SupTwg_Node_Expression_Filter_Default extends Twig_SupTwg_Node_Expres
|
|
36 |
parent::__construct($node, $filterName, $arguments, $lineno, $tag);
|
37 |
}
|
38 |
|
39 |
-
public function compile(
|
40 |
{
|
41 |
$compiler->subcompile($this->getNode('node'));
|
42 |
}
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_Node_Expression_Filter_Default extends Twig_SupTwgDtgs_Node_Expression_Filter
|
22 |
{
|
23 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Node_Expression_Constant $filterName, Twig_SupTwgDtgs_NodeInterface $arguments, $lineno, $tag = null)
|
24 |
{
|
25 |
+
$default = new Twig_SupTwgDtgs_Node_Expression_Filter($node, new Twig_SupTwgDtgs_Node_Expression_Constant('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine());
|
26 |
|
27 |
+
if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_SupTwgDtgs_Node_Expression_Name || $node instanceof Twig_SupTwgDtgs_Node_Expression_GetAttr)) {
|
28 |
+
$test = new Twig_SupTwgDtgs_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_SupTwgDtgs_Node(), $node->getTemplateLine());
|
29 |
+
$false = count($arguments) ? $arguments->getNode(0) : new Twig_SupTwgDtgs_Node_Expression_Constant('', $node->getTemplateLine());
|
30 |
|
31 |
+
$node = new Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function __construct($name,
|
14 |
{
|
15 |
parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno);
|
16 |
}
|
17 |
|
18 |
-
public function compile(
|
19 |
{
|
20 |
$name = $this->getAttribute('name');
|
21 |
$function = $compiler->getEnvironment()->getFunction($name);
|
@@ -26,15 +26,15 @@ class Twig_SupTwg_Node_Expression_Function extends Twig_SupTwg_Node_Expression_C
|
|
26 |
$this->setAttribute('needs_environment', $function->needsEnvironment());
|
27 |
$this->setAttribute('needs_context', $function->needsContext());
|
28 |
$this->setAttribute('arguments', $function->getArguments());
|
29 |
-
if ($function instanceof
|
30 |
$callable = $function->getCallable();
|
31 |
if ('constant' === $name && $this->getAttribute('is_defined_test')) {
|
32 |
-
$callable = '
|
33 |
}
|
34 |
|
35 |
$this->setAttribute('callable', $callable);
|
36 |
}
|
37 |
-
if ($function instanceof
|
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_SupTwgDtgs_Node_Expression_Function extends Twig_SupTwgDtgs_Node_Expression_Call
|
12 |
{
|
13 |
+
public function __construct($name, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_FunctionCallableInterface || $function instanceof Twig_SupTwgDtgs_SimpleFunction) {
|
30 |
$callable = $function->getCallable();
|
31 |
if ('constant' === $name && $this->getAttribute('is_defined_test')) {
|
32 |
+
$callable = 'Twig_SupTwgDtgs_constant_is_defined';
|
33 |
}
|
34 |
|
35 |
$this->setAttribute('callable', $callable);
|
36 |
}
|
37 |
+
if ($function instanceof Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
$nodes = array('node' => $node, 'attribute' => $attribute);
|
17 |
if (null !== $arguments) {
|
@@ -21,14 +21,14 @@ class Twig_SupTwg_Node_Expression_GetAttr extends Twig_SupTwg_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(
|
25 |
{
|
26 |
if ($this->getAttribute('disable_c_ext')) {
|
27 |
-
|
28 |
}
|
29 |
|
30 |
-
if (function_exists('
|
31 |
-
$compiler->raw('
|
32 |
} else {
|
33 |
$compiler->raw('$this->getAttribute(');
|
34 |
}
|
@@ -44,7 +44,7 @@ class Twig_SupTwg_Node_Expression_GetAttr extends Twig_SupTwg_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 ||
|
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_SupTwgDtgs_Node_Expression_GetAttr extends Twig_SupTwgDtgs_Node_Expression
|
13 |
{
|
14 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $node, Twig_SupTwgDtgs_Node_Expression $attribute, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_template_get_attributes') && !$this->getAttribute('disable_c_ext')) {
|
31 |
+
$compiler->raw('Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function __construct(
|
14 |
{
|
15 |
parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno);
|
16 |
|
17 |
-
if ($node instanceof
|
18 |
$node->setAttribute('always_defined', true);
|
19 |
}
|
20 |
}
|
21 |
|
22 |
-
public function compile(
|
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_SupTwgDtgs_Node_Expression_MethodCall extends Twig_SupTwgDtgs_Node_Expression
|
12 |
{
|
13 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $node, $method, Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Name) {
|
18 |
$node->setAttribute('always_defined', true);
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
public function compile(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
protected $specialVars = array(
|
15 |
'_self' => '$this',
|
@@ -22,7 +22,7 @@ class Twig_SupTwg_Node_Expression_Name extends Twig_SupTwg_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(
|
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_SupTwgDtgs_Node_Expression_Name extends Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function __construct(
|
14 |
{
|
15 |
-
$test = new
|
16 |
-
new
|
17 |
-
new
|
18 |
$left->getTemplateLine()
|
19 |
);
|
20 |
|
21 |
parent::__construct($test, $left, $right, $lineno);
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
/*
|
27 |
* This optimizes only one case. PHP 7 also supports more complex expressions
|
@@ -30,7 +30,7 @@ class Twig_SupTwg_Node_Expression_NullCoalesce extends Twig_SupTwg_Node_Expressi
|
|
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
|
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_SupTwgDtgs_Node_Expression_NullCoalesce extends Twig_SupTwgDtgs_Node_Expression_Conditional
|
12 |
{
|
13 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $left, Twig_SupTwgDtgs_NodeInterface $right, $lineno)
|
14 |
{
|
15 |
+
$test = new Twig_SupTwgDtgs_Node_Expression_Binary_And(
|
16 |
+
new Twig_SupTwgDtgs_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_SupTwgDtgs_Node(), $left->getTemplateLine()),
|
17 |
+
new Twig_SupTwgDtgs_Node_Expression_Unary_Not(new Twig_SupTwgDtgs_Node_Expression_Test_Null($left, 'null', new Twig_SupTwgDtgs_Node(), $left->getTemplateLine()), $left->getTemplateLine()),
|
18 |
$left->getTemplateLine()
|
19 |
);
|
20 |
|
21 |
parent::__construct($test, $left, $right, $lineno);
|
22 |
}
|
23 |
|
24 |
+
public function compile(Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
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(
|
26 |
{
|
27 |
if ($this->getAttribute('output')) {
|
28 |
$compiler
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_Expression_Parent extends Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
12 |
{
|
13 |
public function __construct($name, $lineno)
|
14 |
{
|
15 |
parent::__construct(array(), array('name' => $name), $lineno);
|
16 |
}
|
17 |
|
18 |
-
public function compile(
|
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_SupTwgDtgs_Node_Expression_TempName extends Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
12 |
{
|
13 |
-
public function __construct(
|
14 |
{
|
15 |
$nodes = array('node' => $node);
|
16 |
if (null !== $arguments) {
|
@@ -20,7 +20,7 @@ class Twig_SupTwg_Node_Expression_Test extends Twig_SupTwg_Node_Expression_Call
|
|
20 |
parent::__construct($nodes, array('name' => $name), $lineno);
|
21 |
}
|
22 |
|
23 |
-
public function compile(
|
24 |
{
|
25 |
$name = $this->getAttribute('name');
|
26 |
$test = $compiler->getEnvironment()->getTest($name);
|
@@ -28,10 +28,10 @@ class Twig_SupTwg_Node_Expression_Test extends Twig_SupTwg_Node_Expression_Call
|
|
28 |
$this->setAttribute('name', $name);
|
29 |
$this->setAttribute('type', 'test');
|
30 |
$this->setAttribute('thing', $test);
|
31 |
-
if ($test instanceof
|
32 |
$this->setAttribute('callable', $test->getCallable());
|
33 |
}
|
34 |
-
if ($test instanceof
|
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_SupTwgDtgs_Node_Expression_Test extends Twig_SupTwgDtgs_Node_Expression_Call
|
12 |
{
|
13 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $node, $name, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_TestCallableInterface || $test instanceof Twig_SupTwgDtgs_SimpleTest) {
|
32 |
$this->setAttribute('callable', $test->getCallable());
|
33 |
}
|
34 |
+
if ($test instanceof Twig_SupTwgDtgs_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
|
24 |
{
|
25 |
-
public function compile(
|
26 |
{
|
27 |
$compiler
|
28 |
->raw('(')
|
20 |
*
|
21 |
* @author Fabien Potencier <fabien@symfony.com>
|
22 |
*/
|
23 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Constant extends Twig_SupTwgDtgs_Node_Expression_Test
|
24 |
{
|
25 |
+
public function compile(Twig_SupTwgDtgs_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
|
25 |
{
|
26 |
-
public function __construct(
|
27 |
{
|
28 |
-
if ($node instanceof
|
29 |
$node->setAttribute('is_defined_test', true);
|
30 |
-
} elseif ($node instanceof
|
31 |
$node->setAttribute('is_defined_test', true);
|
32 |
$this->changeIgnoreStrictCheck($node);
|
33 |
-
} elseif ($node instanceof
|
34 |
$node->setAttribute('is_defined_test', true);
|
35 |
-
} elseif ($node instanceof
|
36 |
$node->setAttribute('is_defined_test', true);
|
37 |
-
} elseif ($node instanceof
|
38 |
-
$node = new
|
39 |
} else {
|
40 |
-
throw new
|
41 |
}
|
42 |
|
43 |
parent::__construct($node, $name, $arguments, $lineno);
|
44 |
}
|
45 |
|
46 |
-
protected function changeIgnoreStrictCheck(
|
47 |
{
|
48 |
$node->setAttribute('ignore_strict_check', true);
|
49 |
|
50 |
-
if ($node->getNode('node') instanceof
|
51 |
$this->changeIgnoreStrictCheck($node->getNode('node'));
|
52 |
}
|
53 |
}
|
54 |
|
55 |
-
public function compile(
|
56 |
{
|
57 |
$compiler->subcompile($this->getNode('node'));
|
58 |
}
|
21 |
*
|
22 |
* @author Fabien Potencier <fabien@symfony.com>
|
23 |
*/
|
24 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Defined extends Twig_SupTwgDtgs_Node_Expression_Test
|
25 |
{
|
26 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $node, $name, Twig_SupTwgDtgs_NodeInterface $arguments = null, $lineno)
|
27 |
{
|
28 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Expression_Name) {
|
29 |
$node->setAttribute('is_defined_test', true);
|
30 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_GetAttr) {
|
31 |
$node->setAttribute('is_defined_test', true);
|
32 |
$this->changeIgnoreStrictCheck($node);
|
33 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_BlockReference) {
|
34 |
$node->setAttribute('is_defined_test', true);
|
35 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_Function && 'constant' === $node->getAttribute('name')) {
|
36 |
$node->setAttribute('is_defined_test', true);
|
37 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_Constant || $node instanceof Twig_SupTwgDtgs_Node_Expression_Array) {
|
38 |
+
$node = new Twig_SupTwgDtgs_Node_Expression_Constant(true, $node->getTemplateLine());
|
39 |
} else {
|
40 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_GetAttr $node)
|
47 |
{
|
48 |
$node->setAttribute('ignore_strict_check', true);
|
49 |
|
50 |
+
if ($node->getNode('node') instanceof Twig_SupTwgDtgs_Node_Expression_GetAttr) {
|
51 |
$this->changeIgnoreStrictCheck($node->getNode('node'));
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
public function compile(Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function compile(
|
24 |
{
|
25 |
$compiler
|
26 |
->raw('(0 == ')
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Divisibleby extends Twig_SupTwgDtgs_Node_Expression_Test
|
22 |
{
|
23 |
+
public function compile(Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function compile(
|
24 |
{
|
25 |
$compiler
|
26 |
->raw('(')
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Even extends Twig_SupTwgDtgs_Node_Expression_Test
|
22 |
{
|
23 |
+
public function compile(Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function compile(
|
24 |
{
|
25 |
$compiler
|
26 |
->raw('(null === ')
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Null extends Twig_SupTwgDtgs_Node_Expression_Test
|
22 |
{
|
23 |
+
public function compile(Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function compile(
|
24 |
{
|
25 |
$compiler
|
26 |
->raw('(')
|
18 |
*
|
19 |
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Odd extends Twig_SupTwgDtgs_Node_Expression_Test
|
22 |
{
|
23 |
+
public function compile(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function compile(
|
20 |
{
|
21 |
$compiler
|
22 |
->raw('(')
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Expression_Test_Sameas extends Twig_SupTwgDtgs_Node_Expression_Test
|
18 |
{
|
19 |
+
public function compile(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function __construct(
|
15 |
{
|
16 |
parent::__construct(array('node' => $node), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
20 |
{
|
21 |
$compiler->raw(' ');
|
22 |
$this->operator($compiler);
|
23 |
$compiler->subcompile($this->getNode('node'));
|
24 |
}
|
25 |
|
26 |
-
abstract public function operator(
|
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_SupTwgDtgs_Node_Expression_Unary extends Twig_SupTwgDtgs_Node_Expression
|
13 |
{
|
14 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $node, $lineno)
|
15 |
{
|
16 |
parent::__construct(array('node' => $node), array(), $lineno);
|
17 |
}
|
18 |
|
19 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
20 |
{
|
21 |
$compiler->raw(' ');
|
22 |
$this->operator($compiler);
|
23 |
$compiler->subcompile($this->getNode('node'));
|
24 |
}
|
25 |
|
26 |
+
abstract public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Unary_Neg extends Twig_SupTwgDtgs_Node_Expression_Unary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Unary_Not extends Twig_SupTwgDtgs_Node_Expression_Unary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
-
public function operator(
|
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_SupTwgDtgs_Node_Expression_Unary_Pos extends Twig_SupTwgDtgs_Node_Expression_Unary
|
13 |
{
|
14 |
+
public function operator(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
public function __construct($lineno, $tag)
|
20 |
{
|
21 |
parent::__construct(array(), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Flush extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
public function __construct($lineno, $tag)
|
20 |
{
|
21 |
parent::__construct(array(), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
+
public function compile(Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
protected $loop;
|
21 |
|
22 |
-
public function __construct(
|
23 |
{
|
24 |
-
$body = new
|
25 |
|
26 |
if (null !== $ifexpr) {
|
27 |
-
$body = new
|
28 |
}
|
29 |
|
30 |
$nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body);
|
@@ -35,12 +35,12 @@ class Twig_SupTwg_Node_For extends Twig_SupTwg_Node
|
|
35 |
parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag);
|
36 |
}
|
37 |
|
38 |
-
public function compile(
|
39 |
{
|
40 |
$compiler
|
41 |
->addDebugInfo($this)
|
42 |
->write("\$context['_parent'] = \$context;\n")
|
43 |
-
->write("\$context['_seq'] =
|
44 |
->subcompile($this->getNode('seq'))
|
45 |
->raw(");\n")
|
46 |
;
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_For extends Twig_SupTwgDtgs_Node
|
19 |
{
|
20 |
protected $loop;
|
21 |
|
22 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression_AssignName $keyTarget, Twig_SupTwgDtgs_Node_Expression_AssignName $valueTarget, Twig_SupTwgDtgs_Node_Expression $seq, Twig_SupTwgDtgs_Node_Expression $ifexpr = null, Twig_SupTwgDtgs_NodeInterface $body, Twig_SupTwgDtgs_NodeInterface $else = null, $lineno, $tag = null)
|
23 |
{
|
24 |
+
$body = new Twig_SupTwgDtgs_Node(array($body, $this->loop = new Twig_SupTwgDtgs_Node_ForLoop($lineno, $tag)));
|
25 |
|
26 |
if (null !== $ifexpr) {
|
27 |
+
$body = new Twig_SupTwgDtgs_Node_If(new Twig_SupTwgDtgs_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_SupTwgDtgs_Compiler $compiler)
|
39 |
{
|
40 |
$compiler
|
41 |
->addDebugInfo($this)
|
42 |
->write("\$context['_parent'] = \$context;\n")
|
43 |
+
->write("\$context['_seq'] = Twig_SupTwgDtgs_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
|
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(
|
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_SupTwgDtgs_Node_ForLoop extends Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
19 |
{
|
20 |
-
public function __construct(
|
21 |
{
|
22 |
$nodes = array('tests' => $tests);
|
23 |
if (null !== $else) {
|
@@ -27,7 +27,7 @@ class Twig_SupTwg_Node_If extends Twig_SupTwg_Node
|
|
27 |
parent::__construct($nodes, array(), $lineno, $tag);
|
28 |
}
|
29 |
|
30 |
-
public function compile(
|
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_SupTwgDtgs_Node_If extends Twig_SupTwgDtgs_Node
|
19 |
{
|
20 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $tests, Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function __construct(
|
20 |
{
|
21 |
parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
@@ -30,7 +30,7 @@ class Twig_SupTwg_Node_Import extends Twig_SupTwg_Node
|
|
30 |
->raw(' = ')
|
31 |
;
|
32 |
|
33 |
-
if ($this->getNode('expr') instanceof
|
34 |
$compiler->raw('$this');
|
35 |
} else {
|
36 |
$compiler
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Import extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $expr, Twig_SupTwgDtgs_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_SupTwgDtgs_Compiler $compiler)
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
30 |
->raw(' = ')
|
31 |
;
|
32 |
|
33 |
+
if ($this->getNode('expr') instanceof Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
-
public function __construct(
|
21 |
{
|
22 |
$nodes = array('expr' => $expr);
|
23 |
if (null !== $variables) {
|
@@ -27,7 +27,7 @@ class Twig_SupTwg_Node_Include extends Twig_SupTwg_Node implements Twig_SupTwg_N
|
|
27 |
parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag);
|
28 |
}
|
29 |
|
30 |
-
public function compile(
|
31 |
{
|
32 |
$compiler->addDebugInfo($this);
|
33 |
|
@@ -49,7 +49,7 @@ class Twig_SupTwg_Node_Include extends Twig_SupTwg_Node implements Twig_SupTwg_N
|
|
49 |
if ($this->getAttribute('ignore_missing')) {
|
50 |
$compiler
|
51 |
->outdent()
|
52 |
-
->write("} catch (
|
53 |
->indent()
|
54 |
->write("// ignore missing template\n")
|
55 |
->outdent()
|
@@ -58,7 +58,7 @@ class Twig_SupTwg_Node_Include extends Twig_SupTwg_Node implements Twig_SupTwg_N
|
|
58 |
}
|
59 |
}
|
60 |
|
61 |
-
protected function addGetTemplate(
|
62 |
{
|
63 |
$compiler
|
64 |
->write('$this->loadTemplate(')
|
@@ -71,7 +71,7 @@ class Twig_SupTwg_Node_Include extends Twig_SupTwg_Node implements Twig_SupTwg_N
|
|
71 |
;
|
72 |
}
|
73 |
|
74 |
-
protected function addTemplateArguments(
|
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_SupTwgDtgs_Node_Include extends Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_NodeOutputInterface
|
19 |
{
|
20 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $expr, Twig_SupTwgDtgs_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno = null, $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_SupTwgDtgs_Compiler $compiler)
|
31 |
{
|
32 |
$compiler->addDebugInfo($this);
|
33 |
|
49 |
if ($this->getAttribute('ignore_missing')) {
|
50 |
$compiler
|
51 |
->outdent()
|
52 |
+
->write("} catch (Twig_SupTwgDtgs_Error_Loader \$e) {\n")
|
53 |
->indent()
|
54 |
->write("// ignore missing template\n")
|
55 |
->outdent()
|
58 |
}
|
59 |
}
|
60 |
|
61 |
+
protected function addGetTemplate(Twig_SupTwgDtgs_Compiler $compiler)
|
62 |
{
|
63 |
$compiler
|
64 |
->write('$this->loadTemplate(')
|
71 |
;
|
72 |
}
|
73 |
|
74 |
+
protected function addTemplateArguments(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
const VARARGS_NAME = 'varargs';
|
20 |
|
21 |
-
public function __construct($name,
|
22 |
{
|
23 |
foreach ($arguments as $argumentName => $argument) {
|
24 |
if (self::VARARGS_NAME === $argumentName) {
|
25 |
-
throw new
|
26 |
}
|
27 |
}
|
28 |
|
29 |
parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag);
|
30 |
}
|
31 |
|
32 |
-
public function compile(
|
33 |
{
|
34 |
$compiler
|
35 |
->addDebugInfo($this)
|
@@ -115,7 +115,7 @@ class Twig_SupTwg_Node_Macro extends Twig_SupTwg_Node
|
|
115 |
->write("throw \$e;\n")
|
116 |
->outdent()
|
117 |
->write("}\n\n")
|
118 |
-
->write("return ('' === \$tmp = ob_get_clean()) ? '' : new
|
119 |
->outdent()
|
120 |
->write("}\n\n")
|
121 |
;
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Macro extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
const VARARGS_NAME = 'varargs';
|
20 |
|
21 |
+
public function __construct($name, Twig_SupTwgDtgs_NodeInterface $body, Twig_SupTwgDtgs_NodeInterface $arguments, $lineno, $tag = null)
|
22 |
{
|
23 |
foreach ($arguments as $argumentName => $argument) {
|
24 |
if (self::VARARGS_NAME === $argumentName) {
|
25 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
23 |
{
|
24 |
private $source;
|
25 |
|
26 |
-
public function __construct(
|
27 |
{
|
28 |
-
if (!$name instanceof
|
29 |
-
|
30 |
-
$this->source = new
|
31 |
} else {
|
32 |
$this->source = $name;
|
33 |
}
|
@@ -37,11 +37,11 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
37 |
'blocks' => $blocks,
|
38 |
'macros' => $macros,
|
39 |
'traits' => $traits,
|
40 |
-
'display_start' => new
|
41 |
-
'display_end' => new
|
42 |
-
'constructor_start' => new
|
43 |
-
'constructor_end' => new
|
44 |
-
'class_end' => new
|
45 |
);
|
46 |
if (null !== $parent) {
|
47 |
$nodes['parent'] = $parent;
|
@@ -66,7 +66,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
66 |
$this->setAttribute('index', $index);
|
67 |
}
|
68 |
|
69 |
-
public function compile(
|
70 |
{
|
71 |
$this->compileTemplate($compiler);
|
72 |
|
@@ -75,7 +75,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
75 |
}
|
76 |
}
|
77 |
|
78 |
-
protected function compileTemplate(
|
79 |
{
|
80 |
if (!$this->getAttribute('index')) {
|
81 |
$compiler->write('<?php');
|
@@ -87,7 +87,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
87 |
count($this->getNode('blocks'))
|
88 |
|| count($this->getNode('traits'))
|
89 |
|| !$this->hasNode('parent')
|
90 |
-
|| $this->getNode('parent') instanceof
|
91 |
|| count($this->getNode('constructor_start'))
|
92 |
|| count($this->getNode('constructor_end'))
|
93 |
) {
|
@@ -115,7 +115,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
115 |
$this->compileClassFooter($compiler);
|
116 |
}
|
117 |
|
118 |
-
protected function compileGetParent(
|
119 |
{
|
120 |
if (!$this->hasNode('parent')) {
|
121 |
return;
|
@@ -129,7 +129,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
129 |
->write('return ')
|
130 |
;
|
131 |
|
132 |
-
if ($parent instanceof
|
133 |
$compiler->subcompile($parent);
|
134 |
} else {
|
135 |
$compiler
|
@@ -150,7 +150,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
150 |
;
|
151 |
}
|
152 |
|
153 |
-
protected function compileClassHeader(
|
154 |
{
|
155 |
$compiler
|
156 |
->write("\n\n")
|
@@ -163,10 +163,10 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
163 |
;
|
164 |
}
|
165 |
|
166 |
-
protected function compileConstructor(
|
167 |
{
|
168 |
$compiler
|
169 |
-
->write("public function __construct(
|
170 |
->indent()
|
171 |
->subcompile($this->getNode('constructor_start'))
|
172 |
->write("parent::__construct(\$env);\n\n")
|
@@ -175,7 +175,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
175 |
// parent
|
176 |
if (!$this->hasNode('parent')) {
|
177 |
$compiler->write("\$this->parent = false;\n\n");
|
178 |
-
} elseif (($parent = $this->getNode('parent')) && $parent instanceof
|
179 |
$compiler
|
180 |
->addDebugInfo($parent)
|
181 |
->write('$this->parent = $this->loadTemplate(')
|
@@ -198,7 +198,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
198 |
->addDebugInfo($trait->getNode('template'))
|
199 |
->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))
|
200 |
->indent()
|
201 |
-
->write("throw new
|
202 |
->subcompile($trait->getNode('template'))
|
203 |
->raw(".'\" cannot be used as a trait.');\n")
|
204 |
->outdent()
|
@@ -212,7 +212,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
212 |
->string($key)
|
213 |
->raw("])) {\n")
|
214 |
->indent()
|
215 |
-
->write("throw new
|
216 |
->string($key)
|
217 |
->raw(' is not defined in trait ')
|
218 |
->subcompile($trait->getNode('template'))
|
@@ -292,7 +292,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
292 |
;
|
293 |
}
|
294 |
|
295 |
-
protected function compileDisplay(
|
296 |
{
|
297 |
$compiler
|
298 |
->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
|
@@ -304,7 +304,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
304 |
if ($this->hasNode('parent')) {
|
305 |
$parent = $this->getNode('parent');
|
306 |
$compiler->addDebugInfo($parent);
|
307 |
-
if ($parent instanceof
|
308 |
$compiler->write('$this->parent');
|
309 |
} else {
|
310 |
$compiler->write('$this->getParent($context)');
|
@@ -319,7 +319,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
319 |
;
|
320 |
}
|
321 |
|
322 |
-
protected function compileClassFooter(
|
323 |
{
|
324 |
$compiler
|
325 |
->subcompile($this->getNode('class_end'))
|
@@ -328,12 +328,12 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
328 |
;
|
329 |
}
|
330 |
|
331 |
-
protected function compileMacros(
|
332 |
{
|
333 |
$compiler->subcompile($this->getNode('macros'));
|
334 |
}
|
335 |
|
336 |
-
protected function compileGetTemplateName(
|
337 |
{
|
338 |
$compiler
|
339 |
->write("public function getTemplateName()\n", "{\n")
|
@@ -346,7 +346,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
346 |
;
|
347 |
}
|
348 |
|
349 |
-
protected function compileIsTraitable(
|
350 |
{
|
351 |
// A template can be used as a trait if:
|
352 |
// * it has no parent
|
@@ -357,14 +357,14 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_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
|
361 |
$nodes = $this->getNode('body')->getNode(0);
|
362 |
} else {
|
363 |
$nodes = $this->getNode('body');
|
364 |
}
|
365 |
|
366 |
if (!count($nodes)) {
|
367 |
-
$nodes = new
|
368 |
}
|
369 |
|
370 |
foreach ($nodes as $node) {
|
@@ -372,11 +372,11 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
372 |
continue;
|
373 |
}
|
374 |
|
375 |
-
if ($node instanceof
|
376 |
continue;
|
377 |
}
|
378 |
|
379 |
-
if ($node instanceof
|
380 |
continue;
|
381 |
}
|
382 |
|
@@ -398,7 +398,7 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
398 |
;
|
399 |
}
|
400 |
|
401 |
-
protected function compileDebugInfo(
|
402 |
{
|
403 |
$compiler
|
404 |
->write("public function getDebugInfo()\n", "{\n")
|
@@ -409,13 +409,13 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
409 |
;
|
410 |
}
|
411 |
|
412 |
-
protected function compileGetSource(
|
413 |
{
|
414 |
$compiler
|
415 |
->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")
|
416 |
->write("public function getSource()\n", "{\n")
|
417 |
->indent()
|
418 |
-
->write("
|
419 |
->write('return $this->getSourceContext()->getCode();')
|
420 |
->raw("\n")
|
421 |
->outdent()
|
@@ -423,12 +423,12 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
423 |
;
|
424 |
}
|
425 |
|
426 |
-
protected function compileGetSourceContext(
|
427 |
{
|
428 |
$compiler
|
429 |
->write("public function getSourceContext()\n", "{\n")
|
430 |
->indent()
|
431 |
-
->write('return new
|
432 |
->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '')
|
433 |
->raw(', ')
|
434 |
->string($this->source->getName())
|
@@ -440,9 +440,9 @@ class Twig_SupTwg_Node_Module extends Twig_SupTwg_Node
|
|
440 |
;
|
441 |
}
|
442 |
|
443 |
-
protected function compileLoadTemplate(
|
444 |
{
|
445 |
-
if ($node instanceof
|
446 |
$compiler
|
447 |
->write(sprintf('%s = $this->loadTemplate(', $var))
|
448 |
->subcompile($node)
|
19 |
*
|
20 |
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
*/
|
22 |
+
class Twig_SupTwgDtgs_Node_Module extends Twig_SupTwgDtgs_Node
|
23 |
{
|
24 |
private $source;
|
25 |
|
26 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $body, Twig_SupTwgDtgs_Node_Expression $parent = null, Twig_SupTwgDtgs_NodeInterface $blocks, Twig_SupTwgDtgs_NodeInterface $macros, Twig_SupTwgDtgs_NodeInterface $traits, $embeddedTemplates, $name, $source = '')
|
27 |
{
|
28 |
+
if (!$name instanceof Twig_SupTwgDtgs_Source) {
|
29 |
+
//@trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_SupTwgDtgs_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
30 |
+
$this->source = new Twig_SupTwgDtgs_Source($source, $name);
|
31 |
} else {
|
32 |
$this->source = $name;
|
33 |
}
|
37 |
'blocks' => $blocks,
|
38 |
'macros' => $macros,
|
39 |
'traits' => $traits,
|
40 |
+
'display_start' => new Twig_SupTwgDtgs_Node(),
|
41 |
+
'display_end' => new Twig_SupTwgDtgs_Node(),
|
42 |
+
'constructor_start' => new Twig_SupTwgDtgs_Node(),
|
43 |
+
'constructor_end' => new Twig_SupTwgDtgs_Node(),
|
44 |
+
'class_end' => new Twig_SupTwgDtgs_Node(),
|
45 |
);
|
46 |
if (null !== $parent) {
|
47 |
$nodes['parent'] = $parent;
|
66 |
$this->setAttribute('index', $index);
|
67 |
}
|
68 |
|
69 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
70 |
{
|
71 |
$this->compileTemplate($compiler);
|
72 |
|
75 |
}
|
76 |
}
|
77 |
|
78 |
+
protected function compileTemplate(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Compiler $compiler)
|
119 |
{
|
120 |
if (!$this->hasNode('parent')) {
|
121 |
return;
|
129 |
->write('return ')
|
130 |
;
|
131 |
|
132 |
+
if ($parent instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
133 |
$compiler->subcompile($parent);
|
134 |
} else {
|
135 |
$compiler
|
150 |
;
|
151 |
}
|
152 |
|
153 |
+
protected function compileClassHeader(Twig_SupTwgDtgs_Compiler $compiler)
|
154 |
{
|
155 |
$compiler
|
156 |
->write("\n\n")
|
163 |
;
|
164 |
}
|
165 |
|
166 |
+
protected function compileConstructor(Twig_SupTwgDtgs_Compiler $compiler)
|
167 |
{
|
168 |
$compiler
|
169 |
+
->write("public function __construct(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Constant) {
|
308 |
$compiler->write('$this->parent');
|
309 |
} else {
|
310 |
$compiler->write('$this->getParent($context)');
|
319 |
;
|
320 |
}
|
321 |
|
322 |
+
protected function compileClassFooter(Twig_SupTwgDtgs_Compiler $compiler)
|
323 |
{
|
324 |
$compiler
|
325 |
->subcompile($this->getNode('class_end'))
|
328 |
;
|
329 |
}
|
330 |
|
331 |
+
protected function compileMacros(Twig_SupTwgDtgs_Compiler $compiler)
|
332 |
{
|
333 |
$compiler->subcompile($this->getNode('macros'));
|
334 |
}
|
335 |
|
336 |
+
protected function compileGetTemplateName(Twig_SupTwgDtgs_Compiler $compiler)
|
337 |
{
|
338 |
$compiler
|
339 |
->write("public function getTemplateName()\n", "{\n")
|
346 |
;
|
347 |
}
|
348 |
|
349 |
+
protected function compileIsTraitable(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node(array($nodes));
|
368 |
}
|
369 |
|
370 |
foreach ($nodes as $node) {
|
372 |
continue;
|
373 |
}
|
374 |
|
375 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Text && ctype_space($node->getAttribute('data'))) {
|
376 |
continue;
|
377 |
}
|
378 |
|
379 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_BlockReference) {
|
380 |
continue;
|
381 |
}
|
382 |
|
398 |
;
|
399 |
}
|
400 |
|
401 |
+
protected function compileDebugInfo(Twig_SupTwgDtgs_Compiler $compiler)
|
402 |
{
|
403 |
$compiler
|
404 |
->write("public function getDebugInfo()\n", "{\n")
|
409 |
;
|
410 |
}
|
411 |
|
412 |
+
protected function compileGetSource(Twig_SupTwgDtgs_Compiler $compiler)
|
413 |
{
|
414 |
$compiler
|
415 |
->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")
|
416 |
->write("public function getSource()\n", "{\n")
|
417 |
->indent()
|
418 |
+
->write("//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);\n\n")
|
419 |
->write('return $this->getSourceContext()->getCode();')
|
420 |
->raw("\n")
|
421 |
->outdent()
|
423 |
;
|
424 |
}
|
425 |
|
426 |
+
protected function compileGetSourceContext(Twig_SupTwgDtgs_Compiler $compiler)
|
427 |
{
|
428 |
$compiler
|
429 |
->write("public function getSourceContext()\n", "{\n")
|
430 |
->indent()
|
431 |
+
->write('return new Twig_SupTwgDtgs_Source(')
|
432 |
->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '')
|
433 |
->raw(', ')
|
434 |
->string($this->source->getName())
|
440 |
;
|
441 |
}
|
442 |
|
443 |
+
protected function compileLoadTemplate(Twig_SupTwgDtgs_Compiler $compiler, $node, $var)
|
444 |
{
|
445 |
+
if ($node instanceof Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
-
public function __construct(
|
21 |
{
|
22 |
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
23 |
}
|
24 |
|
25 |
-
public function compile(
|
26 |
{
|
27 |
$compiler
|
28 |
->addDebugInfo($this)
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_Print extends Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_NodeOutputInterface
|
19 |
{
|
20 |
+
public function __construct(Twig_SupTwgDtgs_Node_Expression $expr, $lineno, $tag = null)
|
21 |
{
|
22 |
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
23 |
}
|
24 |
|
25 |
+
public function compile(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function __construct(
|
20 |
{
|
21 |
parent::__construct(array('body' => $body), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
28 |
-
->write("\$sandbox = \$this->env->getExtension('
|
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_SupTwgDtgs_Node_Sandbox extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $body, $lineno, $tag = null)
|
20 |
{
|
21 |
parent::__construct(array('body' => $body), array(), $lineno, $tag);
|
22 |
}
|
23 |
|
24 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
28 |
+
->write("\$sandbox = \$this->env->getExtension('Twig_SupTwgDtgs_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 |
-
*
|
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
|
23 |
{
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
28 |
-
->write('echo $this->env->getExtension(\'
|
29 |
->subcompile($this->getNode('expr'))
|
30 |
->raw(");\n")
|
31 |
;
|
@@ -36,11 +36,11 @@ class Twig_SupTwg_Node_SandboxedPrint extends Twig_SupTwg_Node_Print
|
|
36 |
*
|
37 |
* This is mostly needed when another visitor adds filters (like the escaper one).
|
38 |
*
|
39 |
-
* @return
|
40 |
*/
|
41 |
-
protected function removeNodeFilter(
|
42 |
{
|
43 |
-
if ($node instanceof
|
44 |
return $this->removeNodeFilter($node->getNode('node'));
|
45 |
}
|
46 |
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_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_SupTwgDtgs_Node_SandboxedPrint extends Twig_SupTwgDtgs_Node_Print
|
23 |
{
|
24 |
+
public function compile(Twig_SupTwgDtgs_Compiler $compiler)
|
25 |
{
|
26 |
$compiler
|
27 |
->addDebugInfo($this)
|
28 |
+
->write('echo $this->env->getExtension(\'Twig_SupTwgDtgs_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_SupTwgDtgs_Node
|
40 |
*/
|
41 |
+
protected function removeNodeFilter(Twig_SupTwgDtgs_Node $node)
|
42 |
{
|
43 |
+
if ($node instanceof Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function __construct($capture,
|
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
|
27 |
*/
|
28 |
if ($this->getAttribute('capture')) {
|
29 |
$this->setAttribute('safe', true);
|
30 |
|
31 |
$values = $this->getNode('values');
|
32 |
-
if ($values instanceof
|
33 |
-
$this->setNode('values', new
|
34 |
$this->setAttribute('capture', false);
|
35 |
}
|
36 |
}
|
37 |
}
|
38 |
|
39 |
-
public function compile(
|
40 |
{
|
41 |
$compiler->addDebugInfo($this);
|
42 |
|
@@ -61,7 +61,7 @@ class Twig_SupTwg_Node_Set extends Twig_SupTwg_Node implements Twig_SupTwg_NodeC
|
|
61 |
$compiler->subcompile($this->getNode('names'), false);
|
62 |
|
63 |
if ($this->getAttribute('capture')) {
|
64 |
-
$compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new
|
65 |
}
|
66 |
}
|
67 |
|
@@ -83,7 +83,7 @@ class Twig_SupTwg_Node_Set extends Twig_SupTwg_Node implements Twig_SupTwg_NodeC
|
|
83 |
$compiler
|
84 |
->raw("('' === \$tmp = ")
|
85 |
->subcompile($this->getNode('values'))
|
86 |
-
->raw(") ? '' : new
|
87 |
;
|
88 |
} else {
|
89 |
$compiler->subcompile($this->getNode('values'));
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_Set extends Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_NodeCaptureInterface
|
18 |
{
|
19 |
+
public function __construct($capture, Twig_SupTwgDtgs_NodeInterface $names, Twig_SupTwgDtgs_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_SupTwgDtgs_Markup("foo");
|
27 |
*/
|
28 |
if ($this->getAttribute('capture')) {
|
29 |
$this->setAttribute('safe', true);
|
30 |
|
31 |
$values = $this->getNode('values');
|
32 |
+
if ($values instanceof Twig_SupTwgDtgs_Node_Text) {
|
33 |
+
$this->setNode('values', new Twig_SupTwgDtgs_Node_Expression_Constant($values->getAttribute('data'), $values->getTemplateLine()));
|
34 |
$this->setAttribute('capture', false);
|
35 |
}
|
36 |
}
|
37 |
}
|
38 |
|
39 |
+
public function compile(Twig_SupTwgDtgs_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_SupTwgDtgs_Markup(\$tmp, \$this->env->getCharset())");
|
65 |
}
|
66 |
}
|
67 |
|
83 |
$compiler
|
84 |
->raw("('' === \$tmp = ")
|
85 |
->subcompile($this->getNode('values'))
|
86 |
+
->raw(") ? '' : new Twig_SupTwgDtgs_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
|
13 |
{
|
14 |
public function __construct($name, $lineno)
|
15 |
{
|
16 |
parent::__construct(array(), array('name' => $name), $lineno);
|
17 |
}
|
18 |
|
19 |
-
public function compile(
|
20 |
{
|
21 |
$name = $this->getAttribute('name');
|
22 |
$compiler
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class Twig_SupTwgDtgs_Node_SetTemp extends Twig_SupTwgDtgs_Node
|
13 |
{
|
14 |
public function __construct($name, $lineno)
|
15 |
{
|
16 |
parent::__construct(array(), array('name' => $name), $lineno);
|
17 |
}
|
18 |
|
19 |
+
public function compile(Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
-
public function __construct(
|
22 |
{
|
23 |
parent::__construct(array('body' => $body), array(), $lineno, $tag);
|
24 |
}
|
25 |
|
26 |
-
public function compile(
|
27 |
{
|
28 |
$compiler
|
29 |
->addDebugInfo($this)
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_Node_Spaceless extends Twig_SupTwgDtgs_Node
|
20 |
{
|
21 |
+
public function __construct(Twig_SupTwgDtgs_NodeInterface $body, $lineno, $tag = 'spaceless')
|
22 |
{
|
23 |
parent::__construct(array('body' => $body), array(), $lineno, $tag);
|
24 |
}
|
25 |
|
26 |
+
public function compile(Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
public function __construct($data, $lineno)
|
21 |
{
|
22 |
parent::__construct(array(), array('data' => $data), $lineno);
|
23 |
}
|
24 |
|
25 |
-
public function compile(
|
26 |
{
|
27 |
$compiler
|
28 |
->addDebugInfo($this)
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Node_Text extends Twig_SupTwgDtgs_Node implements Twig_SupTwgDtgs_NodeOutputInterface
|
19 |
{
|
20 |
public function __construct($data, $lineno)
|
21 |
{
|
22 |
parent::__construct(array(), array('data' => $data), $lineno);
|
23 |
}
|
24 |
|
25 |
+
public function compile(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function __construct(
|
20 |
{
|
21 |
$nodes = array('body' => $body);
|
22 |
if (null !== $variables) {
|
@@ -26,7 +26,7 @@ class Twig_SupTwg_Node_With extends Twig_SupTwg_Node
|
|
26 |
parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag);
|
27 |
}
|
28 |
|
29 |
-
public function compile(
|
30 |
{
|
31 |
$compiler->addDebugInfo($this);
|
32 |
|
@@ -38,7 +38,7 @@ class Twig_SupTwg_Node_With extends Twig_SupTwg_Node
|
|
38 |
->raw(";\n")
|
39 |
->write(sprintf("if (!is_array(\$%s)) {\n", $varsName))
|
40 |
->indent()
|
41 |
-
->write("throw new
|
42 |
->outdent()
|
43 |
->write("}\n")
|
44 |
;
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Node_With extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
+
public function __construct(Twig_SupTwgDtgs_Node $body, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
/**
|
22 |
* Compiles the node to PHP.
|
23 |
*/
|
24 |
-
public function compile(
|
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_SupTwgDtgs_NodeInterface extends Countable, IteratorAggregate
|
20 |
{
|
21 |
/**
|
22 |
* Compiles the node to PHP.
|
23 |
*/
|
24 |
+
public function compile(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_NodeOutputInterface
|
18 |
{
|
19 |
}
|
vendor/Twig/NodeTraverser.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
-
*
|
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
|
22 |
{
|
23 |
protected $env;
|
24 |
protected $visitors = array();
|
25 |
|
26 |
/**
|
27 |
-
* @param
|
28 |
-
* @param
|
29 |
*/
|
30 |
-
public function __construct(
|
31 |
{
|
32 |
$this->env = $env;
|
33 |
foreach ($visitors as $visitor) {
|
@@ -35,7 +35,7 @@ class Twig_SupTwg_NodeTraverser
|
|
35 |
}
|
36 |
}
|
37 |
|
38 |
-
public function addVisitor(
|
39 |
{
|
40 |
if (!isset($this->visitors[$visitor->getPriority()])) {
|
41 |
$this->visitors[$visitor->getPriority()] = array();
|
@@ -47,9 +47,9 @@ class Twig_SupTwg_NodeTraverser
|
|
47 |
/**
|
48 |
* Traverses a node and calls the registered visitors.
|
49 |
*
|
50 |
-
* @return
|
51 |
*/
|
52 |
-
public function traverse(
|
53 |
{
|
54 |
ksort($this->visitors);
|
55 |
foreach ($this->visitors as $visitors) {
|
@@ -61,7 +61,7 @@ class Twig_SupTwg_NodeTraverser
|
|
61 |
return $node;
|
62 |
}
|
63 |
|
64 |
-
protected function traverseForVisitor(
|
65 |
{
|
66 |
if (null === $node) {
|
67 |
return;
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_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_SupTwgDtgs_NodeTraverser
|
22 |
{
|
23 |
protected $env;
|
24 |
protected $visitors = array();
|
25 |
|
26 |
/**
|
27 |
+
* @param Twig_SupTwgDtgs_Environment $env
|
28 |
+
* @param Twig_SupTwgDtgs_NodeVisitorInterface[] $visitors
|
29 |
*/
|
30 |
+
public function __construct(Twig_SupTwgDtgs_Environment $env, array $visitors = array())
|
31 |
{
|
32 |
$this->env = $env;
|
33 |
foreach ($visitors as $visitor) {
|
35 |
}
|
36 |
}
|
37 |
|
38 |
+
public function addVisitor(Twig_SupTwgDtgs_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_SupTwgDtgs_NodeInterface
|
51 |
*/
|
52 |
+
public function traverse(Twig_SupTwgDtgs_NodeInterface $node)
|
53 |
{
|
54 |
ksort($this->visitors);
|
55 |
foreach ($this->visitors as $visitors) {
|
61 |
return $node;
|
62 |
}
|
63 |
|
64 |
+
protected function traverseForVisitor(Twig_SupTwgDtgs_NodeVisitorInterface $visitor, Twig_SupTwgDtgs_NodeInterface $node = null)
|
65 |
{
|
66 |
if (null === $node) {
|
67 |
return;
|
vendor/Twig/NodeVisitor/Escaper.php
CHANGED
@@ -10,13 +10,13 @@
|
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
-
*
|
14 |
*
|
15 |
* @final
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
protected $statusStack = array();
|
22 |
protected $blocks = array();
|
@@ -27,50 +27,50 @@ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
|
|
27 |
|
28 |
public function __construct()
|
29 |
{
|
30 |
-
$this->safeAnalysis = new
|
31 |
}
|
32 |
|
33 |
-
protected function doEnterNode(
|
34 |
{
|
35 |
-
if ($node instanceof
|
36 |
-
if ($env->hasExtension('
|
37 |
$this->defaultStrategy = $defaultStrategy;
|
38 |
}
|
39 |
$this->safeVars = array();
|
40 |
$this->blocks = array();
|
41 |
-
} elseif ($node instanceof
|
42 |
$this->statusStack[] = $node->getAttribute('value');
|
43 |
-
} elseif ($node instanceof
|
44 |
$this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env);
|
45 |
-
} elseif ($node instanceof
|
46 |
$this->safeVars[] = $node->getNode('var')->getAttribute('name');
|
47 |
}
|
48 |
|
49 |
return $node;
|
50 |
}
|
51 |
|
52 |
-
protected function doLeaveNode(
|
53 |
{
|
54 |
-
if ($node instanceof
|
55 |
$this->defaultStrategy = false;
|
56 |
$this->safeVars = array();
|
57 |
$this->blocks = array();
|
58 |
-
} elseif ($node instanceof
|
59 |
return $this->preEscapeFilterNode($node, $env);
|
60 |
-
} elseif ($node instanceof
|
61 |
return $this->escapePrintNode($node, $env, $this->needEscaping($env));
|
62 |
}
|
63 |
|
64 |
-
if ($node instanceof
|
65 |
array_pop($this->statusStack);
|
66 |
-
} elseif ($node instanceof
|
67 |
$this->blocks[$node->getAttribute('name')] = $this->needEscaping($env);
|
68 |
}
|
69 |
|
70 |
return $node;
|
71 |
}
|
72 |
|
73 |
-
protected function escapePrintNode(
|
74 |
{
|
75 |
if (false === $type) {
|
76 |
return $node;
|
@@ -90,7 +90,7 @@ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
|
|
90 |
);
|
91 |
}
|
92 |
|
93 |
-
protected function preEscapeFilterNode(
|
94 |
{
|
95 |
$name = $filter->getNode('filter')->getAttribute('value');
|
96 |
|
@@ -109,13 +109,13 @@ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
|
|
109 |
return $filter;
|
110 |
}
|
111 |
|
112 |
-
protected function isSafeFor($type,
|
113 |
{
|
114 |
$safe = $this->safeAnalysis->getSafe($expression);
|
115 |
|
116 |
if (null === $safe) {
|
117 |
if (null === $this->traverser) {
|
118 |
-
$this->traverser = new
|
119 |
}
|
120 |
|
121 |
$this->safeAnalysis->setSafeVars($this->safeVars);
|
@@ -127,7 +127,7 @@ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
|
|
127 |
return in_array($type, $safe) || in_array('all', $safe);
|
128 |
}
|
129 |
|
130 |
-
protected function needEscaping(
|
131 |
{
|
132 |
if (count($this->statusStack)) {
|
133 |
return $this->statusStack[count($this->statusStack) - 1];
|
@@ -136,13 +136,13 @@ class Twig_SupTwg_NodeVisitor_Escaper extends Twig_SupTwg_BaseNodeVisitor
|
|
136 |
return $this->defaultStrategy ? $this->defaultStrategy : false;
|
137 |
}
|
138 |
|
139 |
-
protected function getEscaperFilter($type,
|
140 |
{
|
141 |
$line = $node->getTemplateLine();
|
142 |
-
$name = new
|
143 |
-
$args = new
|
144 |
|
145 |
-
return new
|
146 |
}
|
147 |
|
148 |
public function getPriority()
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_NodeVisitor_Escaper implements output escaping.
|
14 |
*
|
15 |
* @final
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_NodeVisitor_Escaper extends Twig_SupTwgDtgs_BaseNodeVisitor
|
20 |
{
|
21 |
protected $statusStack = array();
|
22 |
protected $blocks = array();
|
27 |
|
28 |
public function __construct()
|
29 |
{
|
30 |
+
$this->safeAnalysis = new Twig_SupTwgDtgs_NodeVisitor_SafeAnalysis();
|
31 |
}
|
32 |
|
33 |
+
protected function doEnterNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
34 |
{
|
35 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Module) {
|
36 |
+
if ($env->hasExtension('Twig_SupTwgDtgs_Extension_Escaper') && $defaultStrategy = $env->getExtension('Twig_SupTwgDtgs_Extension_Escaper')->getDefaultStrategy($node->getTemplateName())) {
|
37 |
$this->defaultStrategy = $defaultStrategy;
|
38 |
}
|
39 |
$this->safeVars = array();
|
40 |
$this->blocks = array();
|
41 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_AutoEscape) {
|
42 |
$this->statusStack[] = $node->getAttribute('value');
|
43 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Block) {
|
44 |
$this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env);
|
45 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Import) {
|
46 |
$this->safeVars[] = $node->getNode('var')->getAttribute('name');
|
47 |
}
|
48 |
|
49 |
return $node;
|
50 |
}
|
51 |
|
52 |
+
protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
53 |
{
|
54 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Module) {
|
55 |
$this->defaultStrategy = false;
|
56 |
$this->safeVars = array();
|
57 |
$this->blocks = array();
|
58 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_Filter) {
|
59 |
return $this->preEscapeFilterNode($node, $env);
|
60 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Print) {
|
61 |
return $this->escapePrintNode($node, $env, $this->needEscaping($env));
|
62 |
}
|
63 |
|
64 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_AutoEscape || $node instanceof Twig_SupTwgDtgs_Node_Block) {
|
65 |
array_pop($this->statusStack);
|
66 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_BlockReference) {
|
67 |
$this->blocks[$node->getAttribute('name')] = $this->needEscaping($env);
|
68 |
}
|
69 |
|
70 |
return $node;
|
71 |
}
|
72 |
|
73 |
+
protected function escapePrintNode(Twig_SupTwgDtgs_Node_Print $node, Twig_SupTwgDtgs_Environment $env, $type)
|
74 |
{
|
75 |
if (false === $type) {
|
76 |
return $node;
|
90 |
);
|
91 |
}
|
92 |
|
93 |
+
protected function preEscapeFilterNode(Twig_SupTwgDtgs_Node_Expression_Filter $filter, Twig_SupTwgDtgs_Environment $env)
|
94 |
{
|
95 |
$name = $filter->getNode('filter')->getAttribute('value');
|
96 |
|
109 |
return $filter;
|
110 |
}
|
111 |
|
112 |
+
protected function isSafeFor($type, Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_NodeInterface $node)
|
140 |
{
|
141 |
$line = $node->getTemplateLine();
|
142 |
+
$name = new Twig_SupTwgDtgs_Node_Expression_Constant('escape', $line);
|
143 |
+
$args = new Twig_SupTwgDtgs_Node(array(new Twig_SupTwgDtgs_Node_Expression_Constant((string) $type, $line), new Twig_SupTwgDtgs_Node_Expression_Constant(null, $line), new Twig_SupTwgDtgs_Node_Expression_Constant(true, $line)));
|
144 |
|
145 |
+
return new Twig_SupTwgDtgs_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 |
-
*
|
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
|
25 |
{
|
26 |
const OPTIMIZE_ALL = -1;
|
27 |
const OPTIMIZE_NONE = 0;
|
@@ -47,22 +47,22 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
47 |
$this->optimizers = $optimizers;
|
48 |
}
|
49 |
|
50 |
-
protected function doEnterNode(
|
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('
|
57 |
if ($this->inABody) {
|
58 |
-
if (!$node instanceof
|
59 |
-
if (get_class($node) !== '
|
60 |
array_unshift($this->prependedNodes, array());
|
61 |
}
|
62 |
} else {
|
63 |
$node = $this->optimizeVariables($node, $env);
|
64 |
}
|
65 |
-
} elseif ($node instanceof
|
66 |
$this->inABody = true;
|
67 |
}
|
68 |
}
|
@@ -70,9 +70,9 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
70 |
return $node;
|
71 |
}
|
72 |
|
73 |
-
protected function doLeaveNode(
|
74 |
{
|
75 |
-
$expression = $node instanceof
|
76 |
|
77 |
if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
|
78 |
$this->leaveOptimizeFor($node, $env);
|
@@ -84,18 +84,18 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_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('
|
88 |
-
if ($node instanceof
|
89 |
$this->inABody = false;
|
90 |
} elseif ($this->inABody) {
|
91 |
-
if (!$expression && get_class($node) !== '
|
92 |
$nodes = array();
|
93 |
foreach (array_unique($prependedNodes) as $name) {
|
94 |
-
$nodes[] = new
|
95 |
}
|
96 |
|
97 |
$nodes[] = $node;
|
98 |
-
$node = new
|
99 |
}
|
100 |
}
|
101 |
}
|
@@ -103,12 +103,12 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
103 |
return $node;
|
104 |
}
|
105 |
|
106 |
-
protected function optimizeVariables(
|
107 |
{
|
108 |
-
if ('
|
109 |
$this->prependedNodes[0][] = $node->getAttribute('name');
|
110 |
|
111 |
-
return new
|
112 |
}
|
113 |
|
114 |
return $node;
|
@@ -121,18 +121,18 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
121 |
*
|
122 |
* * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
|
123 |
*
|
124 |
-
* @return
|
125 |
*/
|
126 |
-
protected function optimizePrintNode(
|
127 |
{
|
128 |
-
if (!$node instanceof
|
129 |
return $node;
|
130 |
}
|
131 |
|
132 |
$exprNode = $node->getNode('expr');
|
133 |
if (
|
134 |
-
$exprNode instanceof
|
135 |
-
$exprNode instanceof
|
136 |
) {
|
137 |
$exprNode->setAttribute('output', true);
|
138 |
|
@@ -145,11 +145,11 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
145 |
/**
|
146 |
* Removes "raw" filters.
|
147 |
*
|
148 |
-
* @return
|
149 |
*/
|
150 |
-
protected function optimizeRawFilter(
|
151 |
{
|
152 |
-
if ($node instanceof
|
153 |
return $node->getNode('node');
|
154 |
}
|
155 |
|
@@ -159,9 +159,9 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
159 |
/**
|
160 |
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
|
161 |
*/
|
162 |
-
protected function enterOptimizeFor(
|
163 |
{
|
164 |
-
if ($node instanceof
|
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_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_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
|
179 |
$node->setAttribute('always_defined', true);
|
180 |
$this->addLoopToCurrent();
|
181 |
}
|
182 |
|
183 |
// optimize access to loop targets
|
184 |
-
elseif ($node instanceof
|
185 |
$node->setAttribute('always_defined', true);
|
186 |
}
|
187 |
|
188 |
// block reference
|
189 |
-
elseif ($node instanceof
|
190 |
$this->addLoopToCurrent();
|
191 |
}
|
192 |
|
193 |
// include without the only attribute
|
194 |
-
elseif ($node instanceof
|
195 |
$this->addLoopToAll();
|
196 |
}
|
197 |
|
198 |
// include function without the with_context=false parameter
|
199 |
-
elseif ($node instanceof
|
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_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
206 |
}
|
207 |
|
208 |
// the loop variable is referenced via an attribute
|
209 |
-
elseif ($node instanceof
|
210 |
-
&& (!$node->getNode('attribute') instanceof
|
211 |
|| 'parent' === $node->getNode('attribute')->getAttribute('value')
|
212 |
)
|
213 |
&& (true === $this->loops[0]->getAttribute('with_loop')
|
214 |
-
|| ($node->getNode('node') instanceof
|
215 |
&& 'loop' === $node->getNode('node')->getAttribute('name')
|
216 |
)
|
217 |
)
|
@@ -223,9 +223,9 @@ class Twig_SupTwg_NodeVisitor_Optimizer extends Twig_SupTwg_BaseNodeVisitor
|
|
223 |
/**
|
224 |
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
|
225 |
*/
|
226 |
-
protected function leaveOptimizeFor(
|
227 |
{
|
228 |
-
if ($node instanceof
|
229 |
array_shift($this->loops);
|
230 |
array_shift($this->loopsTargets);
|
231 |
array_shift($this->loopsTargets);
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_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_SupTwgDtgs_NodeVisitor_Optimizer extends Twig_SupTwgDtgs_BaseNodeVisitor
|
25 |
{
|
26 |
const OPTIMIZE_ALL = -1;
|
27 |
const OPTIMIZE_NONE = 0;
|
47 |
$this->optimizers = $optimizers;
|
48 |
}
|
49 |
|
50 |
+
protected function doEnterNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Sandbox')) {
|
57 |
if ($this->inABody) {
|
58 |
+
if (!$node instanceof Twig_SupTwgDtgs_Node_Expression) {
|
59 |
+
if (get_class($node) !== 'Twig_SupTwgDtgs_Node') {
|
60 |
array_unshift($this->prependedNodes, array());
|
61 |
}
|
62 |
} else {
|
63 |
$node = $this->optimizeVariables($node, $env);
|
64 |
}
|
65 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Body) {
|
66 |
$this->inABody = true;
|
67 |
}
|
68 |
}
|
70 |
return $node;
|
71 |
}
|
72 |
|
73 |
+
protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
74 |
{
|
75 |
+
$expression = $node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Sandbox')) {
|
88 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Body) {
|
89 |
$this->inABody = false;
|
90 |
} elseif ($this->inABody) {
|
91 |
+
if (!$expression && get_class($node) !== 'Twig_SupTwgDtgs_Node' && $prependedNodes = array_shift($this->prependedNodes)) {
|
92 |
$nodes = array();
|
93 |
foreach (array_unique($prependedNodes) as $name) {
|
94 |
+
$nodes[] = new Twig_SupTwgDtgs_Node_SetTemp($name, $node->getTemplateLine());
|
95 |
}
|
96 |
|
97 |
$nodes[] = $node;
|
98 |
+
$node = new Twig_SupTwgDtgs_Node($nodes);
|
99 |
}
|
100 |
}
|
101 |
}
|
103 |
return $node;
|
104 |
}
|
105 |
|
106 |
+
protected function optimizeVariables(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
107 |
{
|
108 |
+
if ('Twig_SupTwgDtgs_Node_Expression_Name' === get_class($node) && $node->isSimple()) {
|
109 |
$this->prependedNodes[0][] = $node->getAttribute('name');
|
110 |
|
111 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_NodeInterface
|
125 |
*/
|
126 |
+
protected function optimizePrintNode(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
127 |
{
|
128 |
+
if (!$node instanceof Twig_SupTwgDtgs_Node_Print) {
|
129 |
return $node;
|
130 |
}
|
131 |
|
132 |
$exprNode = $node->getNode('expr');
|
133 |
if (
|
134 |
+
$exprNode instanceof Twig_SupTwgDtgs_Node_Expression_BlockReference ||
|
135 |
+
$exprNode instanceof Twig_SupTwgDtgs_Node_Expression_Parent
|
136 |
) {
|
137 |
$exprNode->setAttribute('output', true);
|
138 |
|
145 |
/**
|
146 |
* Removes "raw" filters.
|
147 |
*
|
148 |
+
* @return Twig_SupTwgDtgs_NodeInterface
|
149 |
*/
|
150 |
+
protected function optimizeRawFilter(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
151 |
{
|
152 |
+
if ($node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
163 |
{
|
164 |
+
if ($node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_BlockReference || $node instanceof Twig_SupTwgDtgs_Node_Expression_BlockReference) {
|
190 |
$this->addLoopToCurrent();
|
191 |
}
|
192 |
|
193 |
// include without the only attribute
|
194 |
+
elseif ($node instanceof Twig_SupTwgDtgs_Node_Include && !$node->getAttribute('only')) {
|
195 |
$this->addLoopToAll();
|
196 |
}
|
197 |
|
198 |
// include function without the with_context=false parameter
|
199 |
+
elseif ($node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_GetAttr
|
210 |
+
&& (!$node->getNode('attribute') instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env)
|
227 |
{
|
228 |
+
if ($node instanceof Twig_SupTwgDtgs_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
|
16 |
{
|
17 |
protected $data = array();
|
18 |
protected $safeVars = array();
|
@@ -22,7 +22,7 @@ class Twig_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
|
|
22 |
$this->safeVars = $safeVars;
|
23 |
}
|
24 |
|
25 |
-
public function getSafe(
|
26 |
{
|
27 |
$hash = spl_object_hash($node);
|
28 |
if (!isset($this->data[$hash])) {
|
@@ -42,7 +42,7 @@ class Twig_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
|
|
42 |
}
|
43 |
}
|
44 |
|
45 |
-
protected function setSafe(
|
46 |
{
|
47 |
$hash = spl_object_hash($node);
|
48 |
if (isset($this->data[$hash])) {
|
@@ -60,27 +60,27 @@ class Twig_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
|
|
60 |
);
|
61 |
}
|
62 |
|
63 |
-
protected function doEnterNode(
|
64 |
{
|
65 |
return $node;
|
66 |
}
|
67 |
|
68 |
-
protected function doLeaveNode(
|
69 |
{
|
70 |
-
if ($node instanceof
|
71 |
// constants are marked safe for all
|
72 |
$this->setSafe($node, array('all'));
|
73 |
-
} elseif ($node instanceof
|
74 |
// blocks are safe by definition
|
75 |
$this->setSafe($node, array('all'));
|
76 |
-
} elseif ($node instanceof
|
77 |
// parent block is safe by definition
|
78 |
$this->setSafe($node, array('all'));
|
79 |
-
} elseif ($node instanceof
|
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
|
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_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
|
|
93 |
} else {
|
94 |
$this->setSafe($node, array());
|
95 |
}
|
96 |
-
} elseif ($node instanceof
|
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_SupTwg_NodeVisitor_SafeAnalysis extends Twig_SupTwg_BaseNodeVisitor
|
|
103 |
} else {
|
104 |
$this->setSafe($node, array());
|
105 |
}
|
106 |
-
} elseif ($node instanceof
|
107 |
if ($node->getAttribute('safe')) {
|
108 |
$this->setSafe($node, array('all'));
|
109 |
} else {
|
110 |
$this->setSafe($node, array());
|
111 |
}
|
112 |
-
} elseif ($node instanceof
|
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_SupTwgDtgs_NodeVisitor_SafeAnalysis extends Twig_SupTwgDtgs_BaseNodeVisitor
|
16 |
{
|
17 |
protected $data = array();
|
18 |
protected $safeVars = array();
|
22 |
$this->safeVars = $safeVars;
|
23 |
}
|
24 |
|
25 |
+
public function getSafe(Twig_SupTwgDtgs_NodeInterface $node)
|
26 |
{
|
27 |
$hash = spl_object_hash($node);
|
28 |
if (!isset($this->data[$hash])) {
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
protected function setSafe(Twig_SupTwgDtgs_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_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
64 |
{
|
65 |
return $node;
|
66 |
}
|
67 |
|
68 |
+
protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
69 |
{
|
70 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
71 |
// constants are marked safe for all
|
72 |
$this->setSafe($node, array('all'));
|
73 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_BlockReference) {
|
74 |
// blocks are safe by definition
|
75 |
$this->setSafe($node, array('all'));
|
76 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Expression_Parent) {
|
77 |
// parent block is safe by definition
|
78 |
$this->setSafe($node, array('all'));
|
79 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwgDtgs_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 |
-
*
|
14 |
*
|
15 |
* @final
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
protected $inAModule = false;
|
22 |
protected $tags;
|
23 |
protected $filters;
|
24 |
protected $functions;
|
25 |
|
26 |
-
protected function doEnterNode(
|
27 |
{
|
28 |
-
if ($node instanceof
|
29 |
$this->inAModule = true;
|
30 |
$this->tags = array();
|
31 |
$this->filters = array();
|
@@ -39,30 +39,30 @@ class Twig_SupTwg_NodeVisitor_Sandbox extends Twig_SupTwg_BaseNodeVisitor
|
|
39 |
}
|
40 |
|
41 |
// look for filters
|
42 |
-
if ($node instanceof
|
43 |
$this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
|
44 |
}
|
45 |
|
46 |
// look for functions
|
47 |
-
if ($node instanceof
|
48 |
$this->functions[$node->getAttribute('name')] = $node;
|
49 |
}
|
50 |
|
51 |
// wrap print to check __toString() calls
|
52 |
-
if ($node instanceof
|
53 |
-
return new
|
54 |
}
|
55 |
}
|
56 |
|
57 |
return $node;
|
58 |
}
|
59 |
|
60 |
-
protected function doLeaveNode(
|
61 |
{
|
62 |
-
if ($node instanceof
|
63 |
$this->inAModule = false;
|
64 |
|
65 |
-
$node->setNode('display_start', new
|
66 |
}
|
67 |
|
68 |
return $node;
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_NodeVisitor_Sandbox implements sandboxing.
|
14 |
*
|
15 |
* @final
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_NodeVisitor_Sandbox extends Twig_SupTwgDtgs_BaseNodeVisitor
|
20 |
{
|
21 |
protected $inAModule = false;
|
22 |
protected $tags;
|
23 |
protected $filters;
|
24 |
protected $functions;
|
25 |
|
26 |
+
protected function doEnterNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
27 |
{
|
28 |
+
if ($node instanceof Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Print) {
|
53 |
+
return new Twig_SupTwgDtgs_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag());
|
54 |
}
|
55 |
}
|
56 |
|
57 |
return $node;
|
58 |
}
|
59 |
|
60 |
+
protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
61 |
{
|
62 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Module) {
|
63 |
$this->inAModule = false;
|
64 |
|
65 |
+
$node->setNode('display_start', new Twig_SupTwgDtgs_Node(array(new Twig_SupTwgDtgs_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 |
-
*
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
-
interface
|
18 |
{
|
19 |
/**
|
20 |
* Called before child nodes are visited.
|
21 |
*
|
22 |
-
* @return
|
23 |
*/
|
24 |
-
public function enterNode(
|
25 |
|
26 |
/**
|
27 |
* Called after child nodes are visited.
|
28 |
*
|
29 |
-
* @return
|
30 |
*/
|
31 |
-
public function leaveNode(
|
32 |
|
33 |
/**
|
34 |
* Returns the priority for this visitor.
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
+
* Twig_SupTwgDtgs_NodeVisitorInterface is the interface the all node visitor classes must implement.
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_NodeVisitorInterface
|
18 |
{
|
19 |
/**
|
20 |
* Called before child nodes are visited.
|
21 |
*
|
22 |
+
* @return Twig_SupTwgDtgs_NodeInterface The modified node
|
23 |
*/
|
24 |
+
public function enterNode(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_Environment $env);
|
25 |
|
26 |
/**
|
27 |
* Called after child nodes are visited.
|
28 |
*
|
29 |
+
* @return Twig_SupTwgDtgs_NodeInterface|false The modified node or false if the node must be removed
|
30 |
*/
|
31 |
+
public function leaveNode(Twig_SupTwgDtgs_NodeInterface $node, Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
protected $stack = array();
|
21 |
protected $stream;
|
@@ -32,7 +32,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
32 |
protected $traits;
|
33 |
protected $embeddedTemplates = array();
|
34 |
|
35 |
-
public function __construct(
|
36 |
{
|
37 |
$this->env = $env;
|
38 |
}
|
@@ -42,7 +42,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
42 |
*/
|
43 |
public function getEnvironment()
|
44 |
{
|
45 |
-
|
46 |
|
47 |
return $this->env;
|
48 |
}
|
@@ -57,12 +57,12 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
57 |
*/
|
58 |
public function getFilename()
|
59 |
{
|
60 |
-
|
61 |
|
62 |
return $this->stream->getSourceContext()->getName();
|
63 |
}
|
64 |
|
65 |
-
public function parse(
|
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_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
87 |
}
|
88 |
|
89 |
if (null === $this->expressionParser) {
|
90 |
-
$this->expressionParser = new
|
91 |
}
|
92 |
|
93 |
$this->stream = $stream;
|
@@ -103,9 +103,9 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
103 |
$body = $this->subparse($test, $dropNeedle);
|
104 |
|
105 |
if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) {
|
106 |
-
$body = new
|
107 |
}
|
108 |
-
} catch (
|
109 |
if (!$e->getSourceContext()) {
|
110 |
$e->setSourceContext($this->stream->getSourceContext());
|
111 |
}
|
@@ -117,9 +117,9 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
117 |
throw $e;
|
118 |
}
|
119 |
|
120 |
-
$node = new
|
121 |
|
122 |
-
$traverser = new
|
123 |
|
124 |
$node = $traverser->traverse($node);
|
125 |
|
@@ -137,24 +137,24 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
137 |
$rv = array();
|
138 |
while (!$this->stream->isEOF()) {
|
139 |
switch ($this->getCurrentToken()->getType()) {
|
140 |
-
case
|
141 |
$token = $this->stream->next();
|
142 |
-
$rv[] = new
|
143 |
break;
|
144 |
|
145 |
-
case
|
146 |
$token = $this->stream->next();
|
147 |
$expr = $this->expressionParser->parseExpression();
|
148 |
-
$this->stream->expect(
|
149 |
-
$rv[] = new
|
150 |
break;
|
151 |
|
152 |
-
case
|
153 |
$this->stream->next();
|
154 |
$token = $this->getCurrentToken();
|
155 |
|
156 |
-
if ($token->getType() !==
|
157 |
-
throw new
|
158 |
}
|
159 |
|
160 |
if (null !== $test && call_user_func($test, $token)) {
|
@@ -166,19 +166,19 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
166 |
return $rv[0];
|
167 |
}
|
168 |
|
169 |
-
return new
|
170 |
}
|
171 |
|
172 |
$subparser = $this->handlers->getTokenParser($token->getValue());
|
173 |
if (null === $subparser) {
|
174 |
if (null !== $test) {
|
175 |
-
$e = new
|
176 |
|
177 |
-
if (is_array($test) && isset($test[0]) && $test[0] instanceof
|
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
|
182 |
$e->addSuggestions($token->getValue(), array_keys($this->env->getTags()));
|
183 |
}
|
184 |
|
@@ -194,7 +194,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
194 |
break;
|
195 |
|
196 |
default:
|
197 |
-
throw new
|
198 |
}
|
199 |
}
|
200 |
|
@@ -202,7 +202,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
202 |
return $rv[0];
|
203 |
}
|
204 |
|
205 |
-
return new
|
206 |
}
|
207 |
|
208 |
/**
|
@@ -210,7 +210,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
210 |
*/
|
211 |
public function addHandler($name, $class)
|
212 |
{
|
213 |
-
|
214 |
|
215 |
$this->handlers[$name] = $class;
|
216 |
}
|
@@ -218,9 +218,9 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
218 |
/**
|
219 |
* @deprecated since 1.27 (to be removed in 2.0)
|
220 |
*/
|
221 |
-
public function addNodeVisitor(
|
222 |
{
|
223 |
-
|
224 |
|
225 |
$this->visitors[] = $visitor;
|
226 |
}
|
@@ -255,9 +255,9 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
255 |
return $this->blocks[$name];
|
256 |
}
|
257 |
|
258 |
-
public function setBlock($name,
|
259 |
{
|
260 |
-
$this->blocks[$name] = new
|
261 |
}
|
262 |
|
263 |
public function hasMacro($name)
|
@@ -265,10 +265,10 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
265 |
return isset($this->macros[$name]);
|
266 |
}
|
267 |
|
268 |
-
public function setMacro($name,
|
269 |
{
|
270 |
if ($this->isReservedMacroName($name)) {
|
271 |
-
throw new
|
272 |
}
|
273 |
|
274 |
$this->macros[$name] = $node;
|
@@ -301,14 +301,14 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
301 |
return count($this->traits) > 0;
|
302 |
}
|
303 |
|
304 |
-
public function embedTemplate(
|
305 |
{
|
306 |
$template->setIndex(mt_rand());
|
307 |
|
308 |
$this->embeddedTemplates[] = $template;
|
309 |
}
|
310 |
|
311 |
-
public function addImportedSymbol($type, $alias, $name = null,
|
312 |
{
|
313 |
$this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node);
|
314 |
}
|
@@ -338,7 +338,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
338 |
}
|
339 |
|
340 |
/**
|
341 |
-
* @return
|
342 |
*/
|
343 |
public function getExpressionParser()
|
344 |
{
|
@@ -356,7 +356,7 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
356 |
}
|
357 |
|
358 |
/**
|
359 |
-
* @return
|
360 |
*/
|
361 |
public function getStream()
|
362 |
{
|
@@ -364,34 +364,34 @@ class Twig_SupTwg_Parser implements Twig_SupTwg_ParserInterface
|
|
364 |
}
|
365 |
|
366 |
/**
|
367 |
-
* @return
|
368 |
*/
|
369 |
public function getCurrentToken()
|
370 |
{
|
371 |
return $this->stream->getCurrent();
|
372 |
}
|
373 |
|
374 |
-
protected function filterBodyNodes(
|
375 |
{
|
376 |
// check that the body does not contain non-empty output nodes
|
377 |
if (
|
378 |
-
($node instanceof
|
379 |
||
|
380 |
-
(!$node instanceof
|
381 |
) {
|
382 |
if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) {
|
383 |
-
throw new
|
384 |
}
|
385 |
|
386 |
-
throw new
|
387 |
}
|
388 |
|
389 |
// bypass nodes that will "capture" the output
|
390 |
-
if ($node instanceof
|
391 |
return $node;
|
392 |
}
|
393 |
|
394 |
-
if ($node instanceof
|
395 |
return;
|
396 |
}
|
397 |
|
15 |
*
|
16 |
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
*/
|
18 |
+
class Twig_SupTwgDtgs_Parser implements Twig_SupTwgDtgs_ParserInterface
|
19 |
{
|
20 |
protected $stack = array();
|
21 |
protected $stream;
|
32 |
protected $traits;
|
33 |
protected $embeddedTemplates = array();
|
34 |
|
35 |
+
public function __construct(Twig_SupTwgDtgs_Environment $env)
|
36 |
{
|
37 |
$this->env = $env;
|
38 |
}
|
42 |
*/
|
43 |
public function getEnvironment()
|
44 |
{
|
45 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
|
46 |
|
47 |
return $this->env;
|
48 |
}
|
57 |
*/
|
58 |
public function getFilename()
|
59 |
{
|
60 |
+
//@trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use $parser->getStream()->getSourceContext()->getPath() instead.', __METHOD__), E_USER_DEPRECATED);
|
61 |
|
62 |
return $this->stream->getSourceContext()->getName();
|
63 |
}
|
64 |
|
65 |
+
public function parse(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node();
|
107 |
}
|
108 |
+
} catch (Twig_SupTwgDtgs_Error_Syntax $e) {
|
109 |
if (!$e->getSourceContext()) {
|
110 |
$e->setSourceContext($this->stream->getSourceContext());
|
111 |
}
|
117 |
throw $e;
|
118 |
}
|
119 |
|
120 |
+
$node = new Twig_SupTwgDtgs_Node_Module(new Twig_SupTwgDtgs_Node_Body(array($body)), $this->parent, new Twig_SupTwgDtgs_Node($this->blocks), new Twig_SupTwgDtgs_Node($this->macros), new Twig_SupTwgDtgs_Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext());
|
121 |
|
122 |
+
$traverser = new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::TEXT_TYPE:
|
141 |
$token = $this->stream->next();
|
142 |
+
$rv[] = new Twig_SupTwgDtgs_Node_Text($token->getValue(), $token->getLine());
|
143 |
break;
|
144 |
|
145 |
+
case Twig_SupTwgDtgs_Token::VAR_START_TYPE:
|
146 |
$token = $this->stream->next();
|
147 |
$expr = $this->expressionParser->parseExpression();
|
148 |
+
$this->stream->expect(Twig_SupTwgDtgs_Token::VAR_END_TYPE);
|
149 |
+
$rv[] = new Twig_SupTwgDtgs_Node_Print($expr, $token->getLine());
|
150 |
break;
|
151 |
|
152 |
+
case Twig_SupTwgDtgs_Token::BLOCK_START_TYPE:
|
153 |
$this->stream->next();
|
154 |
$token = $this->getCurrentToken();
|
155 |
|
156 |
+
if ($token->getType() !== Twig_SupTwgDtgs_Token::NAME_TYPE) {
|
157 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node($rv, array(), $lineno);
|
206 |
}
|
207 |
|
208 |
/**
|
210 |
*/
|
211 |
public function addHandler($name, $class)
|
212 |
{
|
213 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
|
214 |
|
215 |
$this->handlers[$name] = $class;
|
216 |
}
|
218 |
/**
|
219 |
* @deprecated since 1.27 (to be removed in 2.0)
|
220 |
*/
|
221 |
+
public function addNodeVisitor(Twig_SupTwgDtgs_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 |
|
225 |
$this->visitors[] = $visitor;
|
226 |
}
|
255 |
return $this->blocks[$name];
|
256 |
}
|
257 |
|
258 |
+
public function setBlock($name, Twig_SupTwgDtgs_Node_Block $value)
|
259 |
{
|
260 |
+
$this->blocks[$name] = new Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Macro $node)
|
269 |
{
|
270 |
if ($this->isReservedMacroName($name)) {
|
271 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression $node = null)
|
312 |
{
|
313 |
$this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node);
|
314 |
}
|
338 |
}
|
339 |
|
340 |
/**
|
341 |
+
* @return Twig_SupTwgDtgs_ExpressionParser
|
342 |
*/
|
343 |
public function getExpressionParser()
|
344 |
{
|
356 |
}
|
357 |
|
358 |
/**
|
359 |
+
* @return Twig_SupTwgDtgs_TokenStream
|
360 |
*/
|
361 |
public function getStream()
|
362 |
{
|
364 |
}
|
365 |
|
366 |
/**
|
367 |
+
* @return Twig_SupTwgDtgs_Token
|
368 |
*/
|
369 |
public function getCurrentToken()
|
370 |
{
|
371 |
return $this->stream->getCurrent();
|
372 |
}
|
373 |
|
374 |
+
protected function filterBodyNodes(Twig_SupTwgDtgs_NodeInterface $node)
|
375 |
{
|
376 |
// check that the body does not contain non-empty output nodes
|
377 |
if (
|
378 |
+
($node instanceof Twig_SupTwgDtgs_Node_Text && !ctype_space($node->getAttribute('data')))
|
379 |
||
|
380 |
+
(!$node instanceof Twig_SupTwgDtgs_Node_Text && !$node instanceof Twig_SupTwgDtgs_Node_BlockReference && $node instanceof Twig_SupTwgDtgs_NodeOutputInterface)
|
381 |
) {
|
382 |
if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) {
|
383 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_NodeCaptureInterface) {
|
391 |
return $node;
|
392 |
}
|
393 |
|
394 |
+
if ($node instanceof Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
/**
|
22 |
* Converts a token stream to a node tree.
|
23 |
*
|
24 |
-
* @return
|
25 |
*
|
26 |
-
* @throws
|
27 |
*/
|
28 |
-
public function parse(
|
29 |
}
|
16 |
*
|
17 |
* @deprecated since 1.12 (to be removed in 3.0)
|
18 |
*/
|
19 |
+
interface Twig_SupTwgDtgs_ParserInterface
|
20 |
{
|
21 |
/**
|
22 |
* Converts a token stream to a node tree.
|
23 |
*
|
24 |
+
* @return Twig_SupTwgDtgs_Node_Module
|
25 |
*
|
26 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax When the token stream is syntactically or semantically wrong
|
27 |
*/
|
28 |
+
public function parse(Twig_SupTwgDtgs_TokenStream $stream);
|
29 |
}
|
vendor/Twig/Profiler/Dumper/Blackfire.php
CHANGED
@@ -14,9 +14,9 @@
|
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
-
public function dump(
|
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,
|
42 |
{
|
43 |
foreach ($profile as $p) {
|
44 |
if ($p->isTemplate()) {
|
@@ -51,7 +51,7 @@ EOF;
|
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
private function dumpProfile($edge,
|
55 |
{
|
56 |
if (isset($data[$edge])) {
|
57 |
$data[$edge]['ct'] += 1;
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Profiler_Dumper_Blackfire
|
18 |
{
|
19 |
+
public function dump(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
20 |
{
|
21 |
$data = array();
|
22 |
$this->dumpProfile('main()', $profile, $data);
|
38 |
return $str;
|
39 |
}
|
40 |
|
41 |
+
private function dumpChildren($parent, Twig_SupTwgDtgs_Profiler_Profile $profile, &$data)
|
42 |
{
|
43 |
foreach ($profile as $p) {
|
44 |
if ($p->isTemplate()) {
|
51 |
}
|
52 |
}
|
53 |
|
54 |
+
private function dumpProfile($edge, Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private static $colors = array(
|
20 |
'block' => '#dfd',
|
@@ -23,22 +23,22 @@ class Twig_SupTwg_Profiler_Dumper_Html extends Twig_SupTwg_Profiler_Dumper_Text
|
|
23 |
'big' => '#d44',
|
24 |
);
|
25 |
|
26 |
-
public function dump(
|
27 |
{
|
28 |
return '<pre>'.parent::dump($profile).'</pre>';
|
29 |
}
|
30 |
|
31 |
-
protected function formatTemplate(
|
32 |
{
|
33 |
return sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());
|
34 |
}
|
35 |
|
36 |
-
protected function formatNonTemplate(
|
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(
|
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_SupTwgDtgs_Profiler_Dumper_Html extends Twig_SupTwgDtgs_Profiler_Dumper_Text
|
18 |
{
|
19 |
private static $colors = array(
|
20 |
'block' => '#dfd',
|
23 |
'big' => '#d44',
|
24 |
);
|
25 |
|
26 |
+
public function dump(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
27 |
{
|
28 |
return '<pre>'.parent::dump($profile).'</pre>';
|
29 |
}
|
30 |
|
31 |
+
protected function formatTemplate(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
private $root;
|
20 |
|
21 |
-
public function dump(
|
22 |
{
|
23 |
return $this->dumpProfile($profile);
|
24 |
}
|
25 |
|
26 |
-
protected function formatTemplate(
|
27 |
{
|
28 |
return sprintf('%s└ %s', $prefix, $profile->getTemplate());
|
29 |
}
|
30 |
|
31 |
-
protected function formatNonTemplate(
|
32 |
{
|
33 |
return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
|
34 |
}
|
35 |
|
36 |
-
protected function formatTime(
|
37 |
{
|
38 |
return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
|
39 |
}
|
40 |
|
41 |
-
private function dumpProfile(
|
42 |
{
|
43 |
if ($profile->isRoot()) {
|
44 |
$this->root = $profile->getDuration();
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Profiler_Dumper_Text
|
18 |
{
|
19 |
private $root;
|
20 |
|
21 |
+
public function dump(Twig_SupTwgDtgs_Profiler_Profile $profile)
|
22 |
{
|
23 |
return $this->dumpProfile($profile);
|
24 |
}
|
25 |
|
26 |
+
protected function formatTemplate(Twig_SupTwgDtgs_Profiler_Profile $profile, $prefix)
|
27 |
{
|
28 |
return sprintf('%s└ %s', $prefix, $profile->getTemplate());
|
29 |
}
|
30 |
|
31 |
+
protected function formatNonTemplate(Twig_SupTwgDtgs_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_SupTwgDtgs_Profiler_Profile $profile, $percent)
|
37 |
{
|
38 |
return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
|
39 |
}
|
40 |
|
41 |
+
private function dumpProfile(Twig_SupTwgDtgs_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
|
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(
|
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
|
31 |
->repr($this->getAttribute('type'))
|
32 |
->raw(', ')
|
33 |
->repr($this->getAttribute('name'))
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Profiler_Node_EnterProfile extends Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
public function __construct($varName)
|
20 |
{
|
21 |
parent::__construct(array(), array('var_name' => $varName));
|
22 |
}
|
23 |
|
24 |
-
public function compile(
|
25 |
{
|
26 |
$compiler
|
27 |
->write("\n")
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Profiler_Node_LeaveProfile extends Twig_SupTwgDtgs_Node
|
18 |
{
|
19 |
public function __construct($varName)
|
20 |
{
|
21 |
parent::__construct(array(), array('var_name' => $varName));
|
22 |
}
|
23 |
|
24 |
+
public function compile(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $extensionName;
|
20 |
|
@@ -23,30 +23,30 @@ class Twig_SupTwg_Profiler_NodeVisitor_Profiler extends Twig_SupTwg_BaseNodeVisi
|
|
23 |
$this->extensionName = $extensionName;
|
24 |
}
|
25 |
|
26 |
-
protected function doEnterNode(
|
27 |
{
|
28 |
return $node;
|
29 |
}
|
30 |
|
31 |
-
protected function doLeaveNode(
|
32 |
{
|
33 |
-
if ($node instanceof
|
34 |
$varName = $this->getVarName();
|
35 |
-
$node->setNode('display_start', new
|
36 |
-
$node->setNode('display_end', new
|
37 |
-
} elseif ($node instanceof
|
38 |
$varName = $this->getVarName();
|
39 |
-
$node->setNode('body', new
|
40 |
-
new
|
41 |
$node->getNode('body'),
|
42 |
-
new
|
43 |
)));
|
44 |
-
} elseif ($node instanceof
|
45 |
$varName = $this->getVarName();
|
46 |
-
$node->setNode('body', new
|
47 |
-
new
|
48 |
$node->getNode('body'),
|
49 |
-
new
|
50 |
)));
|
51 |
}
|
52 |
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Profiler_NodeVisitor_Profiler extends Twig_SupTwgDtgs_BaseNodeVisitor
|
18 |
{
|
19 |
private $extensionName;
|
20 |
|
23 |
$this->extensionName = $extensionName;
|
24 |
}
|
25 |
|
26 |
+
protected function doEnterNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
27 |
{
|
28 |
return $node;
|
29 |
}
|
30 |
|
31 |
+
protected function doLeaveNode(Twig_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $env)
|
32 |
{
|
33 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Module) {
|
34 |
$varName = $this->getVarName();
|
35 |
+
$node->setNode('display_start', new Twig_SupTwgDtgs_Node(array(new Twig_SupTwgDtgs_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwgDtgs_Profiler_Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start'))));
|
36 |
+
$node->setNode('display_end', new Twig_SupTwgDtgs_Node(array(new Twig_SupTwgDtgs_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end'))));
|
37 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Block) {
|
38 |
$varName = $this->getVarName();
|
39 |
+
$node->setNode('body', new Twig_SupTwgDtgs_Node_Body(array(
|
40 |
+
new Twig_SupTwgDtgs_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwgDtgs_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName),
|
41 |
$node->getNode('body'),
|
42 |
+
new Twig_SupTwgDtgs_Profiler_Node_LeaveProfile($varName),
|
43 |
)));
|
44 |
+
} elseif ($node instanceof Twig_SupTwgDtgs_Node_Macro) {
|
45 |
$varName = $this->getVarName();
|
46 |
+
$node->setNode('body', new Twig_SupTwgDtgs_Node_Body(array(
|
47 |
+
new Twig_SupTwgDtgs_Profiler_Node_EnterProfile($this->extensionName, Twig_SupTwgDtgs_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName),
|
48 |
$node->getNode('body'),
|
49 |
+
new Twig_SupTwgDtgs_Profiler_Node_LeaveProfile($varName),
|
50 |
)));
|
51 |
}
|
52 |
|
vendor/Twig/Profiler/Profile.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
const ROOT = 'ROOT';
|
20 |
const BLOCK = 'block';
|
@@ -76,7 +76,7 @@ class Twig_SupTwg_Profiler_Profile implements IteratorAggregate, Serializable
|
|
76 |
return $this->profiles;
|
77 |
}
|
78 |
|
79 |
-
public function addProfile(
|
80 |
{
|
81 |
$this->profiles[] = $profile;
|
82 |
}
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
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_SupTwgDtgs_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
|
18 |
{
|
19 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityError extends Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $filterName;
|
20 |
|
14 |
*
|
15 |
* @author Martin Hasoň <martin.hason@gmail.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityNotAllowedFilterError extends Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $functionName;
|
20 |
|
14 |
*
|
15 |
* @author Martin Hasoň <martin.hason@gmail.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityNotAllowedFunctionError extends Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $className;
|
20 |
private $methodName;
|
14 |
*
|
15 |
* @author Kit Burton-Senior <mail@kitbs.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityNotAllowedMethodError extends Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $className;
|
20 |
private $propertyName;
|
14 |
*
|
15 |
* @author Kit Burton-Senior <mail@kitbs.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityNotAllowedPropertyError extends Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
private $tagName;
|
20 |
|
14 |
*
|
15 |
* @author Martin Hasoň <martin.hason@gmail.com>
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityNotAllowedTagError extends Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
protected $allowedTags;
|
22 |
protected $allowedFilters;
|
@@ -65,26 +65,26 @@ class Twig_SupTwg_Sandbox_SecurityPolicy implements Twig_SupTwg_Sandbox_Security
|
|
65 |
{
|
66 |
foreach ($tags as $tag) {
|
67 |
if (!in_array($tag, $this->allowedTags)) {
|
68 |
-
throw new
|
69 |
}
|
70 |
}
|
71 |
|
72 |
foreach ($filters as $filter) {
|
73 |
if (!in_array($filter, $this->allowedFilters)) {
|
74 |
-
throw new
|
75 |
}
|
76 |
}
|
77 |
|
78 |
foreach ($functions as $function) {
|
79 |
if (!in_array($function, $this->allowedFunctions)) {
|
80 |
-
throw new
|
81 |
}
|
82 |
}
|
83 |
}
|
84 |
|
85 |
public function checkMethodAllowed($obj, $method)
|
86 |
{
|
87 |
-
if ($obj instanceof
|
88 |
return true;
|
89 |
}
|
90 |
|
@@ -100,7 +100,7 @@ class Twig_SupTwg_Sandbox_SecurityPolicy implements Twig_SupTwg_Sandbox_Security
|
|
100 |
|
101 |
if (!$allowed) {
|
102 |
$class = get_class($obj);
|
103 |
-
throw new
|
104 |
}
|
105 |
}
|
106 |
|
@@ -117,7 +117,7 @@ class Twig_SupTwg_Sandbox_SecurityPolicy implements Twig_SupTwg_Sandbox_Security
|
|
117 |
|
118 |
if (!$allowed) {
|
119 |
$class = get_class($obj);
|
120 |
-
throw new
|
121 |
}
|
122 |
}
|
123 |
}
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_Sandbox_SecurityPolicy implements Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_TemplateInterface || $obj instanceof Twig_SupTwgDtgs_Markup) {
|
88 |
return true;
|
89 |
}
|
90 |
|
100 |
|
101 |
if (!$allowed) {
|
102 |
$class = get_class($obj);
|
103 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
public function checkSecurity($tags, $filters, $functions);
|
20 |
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
protected $name;
|
22 |
protected $callable;
|
@@ -35,7 +35,7 @@ class Twig_SupTwg_SimpleFilter
|
|
35 |
'is_safe_callback' => null,
|
36 |
'pre_escape' => null,
|
37 |
'preserves_safety' => null,
|
38 |
-
'node_class' => '
|
39 |
'deprecated' => false,
|
40 |
'alternative' => null,
|
41 |
), $options);
|
@@ -76,7 +76,7 @@ class Twig_SupTwg_SimpleFilter
|
|
76 |
return $this->options['needs_context'];
|
77 |
}
|
78 |
|
79 |
-
public function getSafe(
|
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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Filter',
|
39 |
'deprecated' => false,
|
40 |
'alternative' => null,
|
41 |
), $options);
|
76 |
return $this->options['needs_context'];
|
77 |
}
|
78 |
|
79 |
+
public function getSafe(Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
protected $name;
|
22 |
protected $callable;
|
@@ -33,7 +33,7 @@ class Twig_SupTwg_SimpleFunction
|
|
33 |
'is_variadic' => false,
|
34 |
'is_safe' => null,
|
35 |
'is_safe_callback' => null,
|
36 |
-
'node_class' => '
|
37 |
'deprecated' => false,
|
38 |
'alternative' => null,
|
39 |
), $options);
|
@@ -74,7 +74,7 @@ class Twig_SupTwg_SimpleFunction
|
|
74 |
return $this->options['needs_context'];
|
75 |
}
|
76 |
|
77 |
-
public function getSafe(
|
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_SupTwgDtgs_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_SupTwgDtgs_Node_Expression_Function',
|
37 |
'deprecated' => false,
|
38 |
'alternative' => null,
|
39 |
), $options);
|
74 |
return $this->options['needs_context'];
|
75 |
}
|
76 |
|
77 |
+
public function getSafe(Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
protected $name;
|
22 |
protected $callable;
|
@@ -28,7 +28,7 @@ class Twig_SupTwg_SimpleTest
|
|
28 |
$this->callable = $callable;
|
29 |
$this->options = array_merge(array(
|
30 |
'is_variadic' => false,
|
31 |
-
'node_class' => '
|
32 |
'deprecated' => false,
|
33 |
'alternative' => null,
|
34 |
), $options);
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
20 |
{
|
21 |
private $code;
|
22 |
private $name;
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_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
|
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
|
27 |
*
|
28 |
-
* @throws
|
29 |
*/
|
30 |
public function getSourceContext($name);
|
31 |
}
|
16 |
*
|
17 |
* @deprecated since 1.27 (to be removed in 3.0)
|
18 |
*/
|
19 |
+
interface Twig_SupTwgDtgs_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_SupTwgDtgs_Source
|
27 |
*
|
28 |
+
* @throws Twig_SupTwgDtgs_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
|
19 |
*
|
20 |
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
*
|
22 |
* @internal
|
23 |
*/
|
24 |
-
abstract class
|
25 |
{
|
26 |
/**
|
27 |
* @internal
|
@@ -34,7 +34,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
34 |
protected $blocks = array();
|
35 |
protected $traits = array();
|
36 |
|
37 |
-
public function __construct(
|
38 |
{
|
39 |
$this->env = $env;
|
40 |
}
|
@@ -75,7 +75,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
75 |
*/
|
76 |
public function getSource()
|
77 |
{
|
78 |
-
|
79 |
|
80 |
return '';
|
81 |
}
|
@@ -83,11 +83,11 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
83 |
/**
|
84 |
* Returns information about the original template source code.
|
85 |
*
|
86 |
-
* @return
|
87 |
*/
|
88 |
public function getSourceContext()
|
89 |
{
|
90 |
-
return new
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -95,7 +95,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
95 |
*/
|
96 |
public function getEnvironment()
|
97 |
{
|
98 |
-
|
99 |
|
100 |
return $this->env;
|
101 |
}
|
@@ -108,7 +108,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
108 |
*
|
109 |
* @param array $context
|
110 |
*
|
111 |
-
* @return
|
112 |
*
|
113 |
* @internal
|
114 |
*/
|
@@ -132,7 +132,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
132 |
if (!isset($this->parents[$parent])) {
|
133 |
$this->parents[$parent] = $this->loadTemplate($parent);
|
134 |
}
|
135 |
-
} catch (
|
136 |
$e->setSourceContext(null);
|
137 |
$e->guess();
|
138 |
|
@@ -173,7 +173,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
173 |
} elseif (false !== $parent = $this->getParent($context)) {
|
174 |
$parent->displayBlock($name, $context, $blocks, false);
|
175 |
} else {
|
176 |
-
throw new
|
177 |
}
|
178 |
}
|
179 |
|
@@ -207,19 +207,19 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_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
|
211 |
}
|
212 |
|
213 |
if (null !== $template) {
|
214 |
try {
|
215 |
$template->$block($context, $blocks);
|
216 |
-
} catch (
|
217 |
if (!$e->getSourceContext()) {
|
218 |
$e->setSourceContext($template->getSourceContext());
|
219 |
}
|
220 |
|
221 |
-
// this is mostly useful for
|
222 |
-
// see
|
223 |
if (false === $e->getTemplateLine()) {
|
224 |
$e->setTemplateLine(-1);
|
225 |
$e->guess();
|
@@ -227,12 +227,12 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
227 |
|
228 |
throw $e;
|
229 |
} catch (Exception $e) {
|
230 |
-
throw new
|
231 |
}
|
232 |
} elseif (false !== $parent = $this->getParent($context)) {
|
233 |
$parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
|
234 |
} else {
|
235 |
-
|
236 |
}
|
237 |
}
|
238 |
|
@@ -298,7 +298,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
298 |
public function hasBlock($name, array $context = null, array $blocks = array())
|
299 |
{
|
300 |
if (null === $context) {
|
301 |
-
|
302 |
|
303 |
return isset($this->blocks[(string) $name]);
|
304 |
}
|
@@ -334,7 +334,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
334 |
public function getBlockNames(array $context = null, array $blocks = array())
|
335 |
{
|
336 |
if (null === $context) {
|
337 |
-
|
338 |
|
339 |
return array_keys($this->blocks);
|
340 |
}
|
@@ -359,14 +359,14 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
359 |
return $template;
|
360 |
}
|
361 |
|
362 |
-
if ($template instanceof
|
363 |
return $template;
|
364 |
}
|
365 |
|
366 |
return $this->env->loadTemplate($template, $index);
|
367 |
-
} catch (
|
368 |
if (!$e->getSourceContext()) {
|
369 |
-
$e->setSourceContext($templateName ? new
|
370 |
}
|
371 |
|
372 |
if ($e->getTemplateLine()) {
|
@@ -430,13 +430,13 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
430 |
{
|
431 |
try {
|
432 |
$this->doDisplay($context, $blocks);
|
433 |
-
} catch (
|
434 |
if (!$e->getSourceContext()) {
|
435 |
$e->setSourceContext($this->getSourceContext());
|
436 |
}
|
437 |
|
438 |
-
// this is mostly useful for
|
439 |
-
// see
|
440 |
if (false === $e->getTemplateLine()) {
|
441 |
$e->setTemplateLine(-1);
|
442 |
$e->guess();
|
@@ -444,7 +444,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
444 |
|
445 |
throw $e;
|
446 |
} catch (Exception $e) {
|
447 |
-
throw new
|
448 |
}
|
449 |
}
|
450 |
|
@@ -473,7 +473,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
473 |
*
|
474 |
* @return mixed The content of the context variable
|
475 |
*
|
476 |
-
* @throws
|
477 |
*
|
478 |
* @internal
|
479 |
*/
|
@@ -484,7 +484,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
484 |
return;
|
485 |
}
|
486 |
|
487 |
-
throw new
|
488 |
}
|
489 |
|
490 |
return $context[$item];
|
@@ -496,13 +496,13 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_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
|
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
|
506 |
*
|
507 |
* @internal
|
508 |
*/
|
@@ -553,7 +553,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
553 |
$message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
|
554 |
}
|
555 |
|
556 |
-
throw new
|
557 |
}
|
558 |
}
|
559 |
|
@@ -572,18 +572,18 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
572 |
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
|
573 |
}
|
574 |
|
575 |
-
throw new
|
576 |
}
|
577 |
|
578 |
// object property
|
579 |
-
if (self::METHOD_CALL !== $type && !$object instanceof self) { //
|
580 |
if (isset($object->$item) || !empty($object->$item)) {
|
581 |
if ($isDefinedTest) {
|
582 |
return true;
|
583 |
}
|
584 |
|
585 |
-
if ($this->env->hasExtension('
|
586 |
-
$this->env->getExtension('
|
587 |
}
|
588 |
|
589 |
return $object->$item;
|
@@ -657,15 +657,15 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
657 |
return;
|
658 |
}
|
659 |
|
660 |
-
throw new
|
661 |
}
|
662 |
|
663 |
if ($isDefinedTest) {
|
664 |
return true;
|
665 |
}
|
666 |
|
667 |
-
if ($this->env->hasExtension('
|
668 |
-
$this->env->getExtension('
|
669 |
}
|
670 |
|
671 |
// Some objects throw exceptions when they have __call, and the method we try
|
@@ -684,7 +684,7 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
684 |
}
|
685 |
|
686 |
// @deprecated in 1.28
|
687 |
-
if ($object instanceof
|
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) {
|
@@ -694,9 +694,9 @@ abstract class Twig_SupTwg_Template implements Twig_SupTwg_TemplateInterface
|
|
694 |
} elseif ('render' === $method || 'display' === $method) {
|
695 |
$message .= sprintf(' Use include("%s") instead).', $object->getTemplateName());
|
696 |
}
|
697 |
-
|
698 |
|
699 |
-
return $ret === '' ? '' : new
|
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_SupTwgDtgs_TemplateWrapper.
|
19 |
*
|
20 |
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
*
|
22 |
* @internal
|
23 |
*/
|
24 |
+
abstract class Twig_SupTwgDtgs_Template implements Twig_SupTwgDtgs_TemplateInterface
|
25 |
{
|
26 |
/**
|
27 |
* @internal
|
34 |
protected $blocks = array();
|
35 |
protected $traits = array();
|
36 |
|
37 |
+
public function __construct(Twig_SupTwgDtgs_Environment $env)
|
38 |
{
|
39 |
$this->env = $env;
|
40 |
}
|
75 |
*/
|
76 |
public function getSource()
|
77 |
{
|
78 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
|
79 |
|
80 |
return '';
|
81 |
}
|
83 |
/**
|
84 |
* Returns information about the original template source code.
|
85 |
*
|
86 |
+
* @return Twig_SupTwgDtgs_Source
|
87 |
*/
|
88 |
public function getSourceContext()
|
89 |
{
|
90 |
+
return new Twig_SupTwgDtgs_Source('', $this->getTemplateName());
|
91 |
}
|
92 |
|
93 |
/**
|
95 |
*/
|
96 |
public function getEnvironment()
|
97 |
{
|
98 |
+
//@trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED);
|
99 |
|
100 |
return $this->env;
|
101 |
}
|
108 |
*
|
109 |
* @param array $context
|
110 |
*
|
111 |
+
* @return Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Template instance.');
|
211 |
}
|
212 |
|
213 |
if (null !== $template) {
|
214 |
try {
|
215 |
$template->$block($context, $blocks);
|
216 |
+
} catch (Twig_SupTwgDtgs_Error $e) {
|
217 |
if (!$e->getSourceContext()) {
|
218 |
$e->setSourceContext($template->getSourceContext());
|
219 |
}
|
220 |
|
221 |
+
// this is mostly useful for Twig_SupTwgDtgs_Error_Loader exceptions
|
222 |
+
// see Twig_SupTwgDtgs_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_SupTwgDtgs_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);
|
234 |
} else {
|
235 |
+
//@trigger_error(sprintf('Silent display of undefined block "%s" in template "%s" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block(\'%s\') is defined" expression to test for block existence.', $name, $this->getTemplateName(), $name), E_USER_DEPRECATED);
|
236 |
}
|
237 |
}
|
238 |
|
298 |
public function hasBlock($name, array $context = null, array $blocks = array())
|
299 |
{
|
300 |
if (null === $context) {
|
301 |
+
//@trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
|
302 |
|
303 |
return isset($this->blocks[(string) $name]);
|
304 |
}
|
334 |
public function getBlockNames(array $context = null, array $blocks = array())
|
335 |
{
|
336 |
if (null === $context) {
|
337 |
+
//@trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
|
338 |
|
339 |
return array_keys($this->blocks);
|
340 |
}
|
359 |
return $template;
|
360 |
}
|
361 |
|
362 |
+
if ($template instanceof Twig_SupTwgDtgs_TemplateWrapper) {
|
363 |
return $template;
|
364 |
}
|
365 |
|
366 |
return $this->env->loadTemplate($template, $index);
|
367 |
+
} catch (Twig_SupTwgDtgs_Error $e) {
|
368 |
if (!$e->getSourceContext()) {
|
369 |
+
$e->setSourceContext($templateName ? new Twig_SupTwgDtgs_Source('', $templateName) : $this->getSourceContext());
|
370 |
}
|
371 |
|
372 |
if ($e->getTemplateLine()) {
|
430 |
{
|
431 |
try {
|
432 |
$this->doDisplay($context, $blocks);
|
433 |
+
} catch (Twig_SupTwgDtgs_Error $e) {
|
434 |
if (!$e->getSourceContext()) {
|
435 |
$e->setSourceContext($this->getSourceContext());
|
436 |
}
|
437 |
|
438 |
+
// this is mostly useful for Twig_SupTwgDtgs_Error_Loader exceptions
|
439 |
+
// see Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error_Runtime($message, -1, $this->getSourceContext());
|
576 |
}
|
577 |
|
578 |
// object property
|
579 |
+
if (self::METHOD_CALL !== $type && !$object instanceof self) { // Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Sandbox')) {
|
586 |
+
$this->env->getExtension('Twig_SupTwgDtgs_Extension_Sandbox')->checkPropertyAllowed($object, $item);
|
587 |
}
|
588 |
|
589 |
return $object->$item;
|
657 |
return;
|
658 |
}
|
659 |
|
660 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Extension_Sandbox')) {
|
668 |
+
$this->env->getExtension('Twig_SupTwgDtgs_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_SupTwgDtgs_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) {
|
694 |
} elseif ('render' === $method || 'display' === $method) {
|
695 |
$message .= sprintf(' Use include("%s") instead).', $object->getTemplateName());
|
696 |
}
|
697 |
+
//@trigger_error($message, E_USER_DEPRECATED);
|
698 |
|
699 |
+
return $ret === '' ? '' : new Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
const ANY_CALL = 'any';
|
22 |
const ARRAY_CALL = 'array';
|
@@ -42,7 +42,7 @@ interface Twig_SupTwg_TemplateInterface
|
|
42 |
/**
|
43 |
* Returns the bound environment for this template.
|
44 |
*
|
45 |
-
* @return
|
46 |
*/
|
47 |
public function getEnvironment();
|
48 |
}
|
16 |
*
|
17 |
* @deprecated since 1.12 (to be removed in 3.0)
|
18 |
*/
|
19 |
+
interface Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
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
|
25 |
*
|
26 |
* @internal
|
27 |
*/
|
28 |
-
public function __construct(
|
29 |
{
|
30 |
$this->env = $env;
|
31 |
$this->template = $template;
|
@@ -122,7 +122,7 @@ final class Twig_SupTwg_TemplateWrapper
|
|
122 |
}
|
123 |
|
124 |
/**
|
125 |
-
* @return
|
126 |
*/
|
127 |
public function getSourceContext()
|
128 |
{
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
final class Twig_SupTwgDtgs_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_SupTwgDtgs_Environment::load() instead).
|
25 |
*
|
26 |
* @internal
|
27 |
*/
|
28 |
+
public function __construct(Twig_SupTwgDtgs_Environment $env, Twig_SupTwgDtgs_Template $template)
|
29 |
{
|
30 |
$this->env = $env;
|
31 |
$this->template = $template;
|
122 |
}
|
123 |
|
124 |
/**
|
125 |
+
* @return Twig_SupTwgDtgs_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 |
-
|
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
|
22 |
{
|
23 |
protected $options;
|
24 |
protected $arguments = array();
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Test class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_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_SupTwgDtgs_Test implements Twig_SupTwgDtgs_TestInterface, Twig_SupTwgDtgs_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 |
-
|
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
|
22 |
{
|
23 |
protected $function;
|
24 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_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_SupTwgDtgs_Test_Function extends Twig_SupTwgDtgs_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
|
19 |
{
|
20 |
/**
|
21 |
* @return string
|
@@ -23,7 +23,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
23 |
abstract protected function getFixturesDir();
|
24 |
|
25 |
/**
|
26 |
-
* @return
|
27 |
*/
|
28 |
protected function getExtensions()
|
29 |
{
|
@@ -31,7 +31,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
-
* @return
|
35 |
*/
|
36 |
protected function getTwigFilters()
|
37 |
{
|
@@ -39,7 +39,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
* @return
|
43 |
*/
|
44 |
protected function getTwigFunctions()
|
45 |
{
|
@@ -47,7 +47,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
* @return
|
51 |
*/
|
52 |
protected function getTwigTests()
|
53 |
{
|
@@ -132,14 +132,14 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
132 |
}
|
133 |
}
|
134 |
|
135 |
-
$loader = new
|
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
|
143 |
$twig->addGlobal('global', 'global');
|
144 |
foreach ($this->getExtensions() as $extension) {
|
145 |
$twig->addExtension($extension);
|
@@ -177,7 +177,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
177 |
return;
|
178 |
}
|
179 |
|
180 |
-
throw new
|
181 |
}
|
182 |
|
183 |
try {
|
@@ -189,7 +189,7 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
189 |
return;
|
190 |
}
|
191 |
|
192 |
-
$e = new
|
193 |
|
194 |
$output = trim(sprintf('%s: %s', get_class($e), $e->getMessage()));
|
195 |
}
|
@@ -207,8 +207,8 @@ abstract class Twig_SupTwg_Test_IntegrationTestCase extends PHPUnit_Framework_Te
|
|
207 |
foreach (array_keys($templates) as $name) {
|
208 |
echo "Template: $name\n";
|
209 |
$loader = $twig->getLoader();
|
210 |
-
if (!$loader instanceof
|
211 |
-
$source = new
|
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_SupTwgDtgs_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
|
19 |
{
|
20 |
/**
|
21 |
* @return string
|
23 |
abstract protected function getFixturesDir();
|
24 |
|
25 |
/**
|
26 |
+
* @return Twig_SupTwgDtgs_ExtensionInterface[]
|
27 |
*/
|
28 |
protected function getExtensions()
|
29 |
{
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
+
* @return Twig_SupTwgDtgs_SimpleFilter[]
|
35 |
*/
|
36 |
protected function getTwigFilters()
|
37 |
{
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* @return Twig_SupTwgDtgs_SimpleFunction[]
|
43 |
*/
|
44 |
protected function getTwigFunctions()
|
45 |
{
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
+
* @return Twig_SupTwgDtgs_SimpleTest[]
|
51 |
*/
|
52 |
protected function getTwigTests()
|
53 |
{
|
132 |
}
|
133 |
}
|
134 |
|
135 |
+
$loader = new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e);
|
181 |
}
|
182 |
|
183 |
try {
|
189 |
return;
|
190 |
}
|
191 |
|
192 |
+
$e = new Twig_SupTwgDtgs_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_SupTwgDtgs_SourceContextLoaderInterface) {
|
211 |
+
$source = new Twig_SupTwgDtgs_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 |
-
|
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
|
22 |
{
|
23 |
protected $extension;
|
24 |
protected $method;
|
25 |
|
26 |
-
public function __construct(
|
27 |
{
|
28 |
$options['callable'] = array($extension, $method);
|
29 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SupTwgDtgs_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_SupTwgDtgs_Test_Method extends Twig_SupTwgDtgs_Test
|
22 |
{
|
23 |
protected $extension;
|
24 |
protected $method;
|
25 |
|
26 |
+
public function __construct(Twig_SupTwgDtgs_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 |
-
|
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
|
22 |
{
|
23 |
protected $class;
|
24 |
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
//@trigger_error('The Twig_SupTwgDtgs_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_SupTwgDtgs_Test_Node extends Twig_SupTwgDtgs_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
|
12 |
{
|
13 |
abstract public function getTests();
|
14 |
|
@@ -20,7 +20,7 @@ abstract class Twig_SupTwg_Test_NodeTestCase extends PHPUnit_Framework_TestCase
|
|
20 |
$this->assertNodeCompilation($source, $node, $environment, $isPattern);
|
21 |
}
|
22 |
|
23 |
-
public function assertNodeCompilation($source,
|
24 |
{
|
25 |
$compiler = $this->getCompiler($environment);
|
26 |
$compiler->compile($node);
|
@@ -32,14 +32,14 @@ abstract class Twig_SupTwg_Test_NodeTestCase extends PHPUnit_Framework_TestCase
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
protected function getCompiler(
|
36 |
{
|
37 |
-
return new
|
38 |
}
|
39 |
|
40 |
protected function getEnvironment()
|
41 |
{
|
42 |
-
return new
|
43 |
}
|
44 |
|
45 |
protected function getVariableGetter($name, $line = false)
|
@@ -59,8 +59,8 @@ abstract class Twig_SupTwg_Test_NodeTestCase extends PHPUnit_Framework_TestCase
|
|
59 |
|
60 |
protected function getAttributeGetter()
|
61 |
{
|
62 |
-
if (function_exists('
|
63 |
-
return '
|
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_SupTwgDtgs_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_SupTwgDtgs_Node $node, Twig_SupTwgDtgs_Environment $environment = null, $isPattern = false)
|
24 |
{
|
25 |
$compiler = $this->getCompiler($environment);
|
26 |
$compiler->compile($node);
|
32 |
}
|
33 |
}
|
34 |
|
35 |
+
protected function getCompiler(Twig_SupTwgDtgs_Environment $environment = null)
|
36 |
{
|
37 |
+
return new Twig_SupTwgDtgs_Compiler(null === $environment ? $this->getEnvironment() : $environment);
|
38 |
}
|
39 |
|
40 |
protected function getEnvironment()
|
41 |
{
|
42 |
+
return new Twig_SupTwgDtgs_Environment(new Twig_SupTwgDtgs_Loader_Array(array()));
|
43 |
}
|
44 |
|
45 |
protected function getVariableGetter($name, $line = false)
|
59 |
|
60 |
protected function getAttributeGetter()
|
61 |
{
|
62 |
+
if (function_exists('Twig_SupTwgDtgs_template_get_attributes')) {
|
63 |
+
return 'Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
public function getCallable();
|
22 |
}
|
16 |
*
|
17 |
* @deprecated since 1.12 (to be removed in 2.0)
|
18 |
*/
|
19 |
+
interface Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
/**
|
22 |
* Compiles a test.
|
16 |
*
|
17 |
* @deprecated since 1.12 (to be removed in 2.0)
|
18 |
*/
|
19 |
+
interface Twig_SupTwgDtgs_TestInterface
|
20 |
{
|
21 |
/**
|
22 |
* Compiles a test.
|
vendor/Twig/Token.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
*
|
18 |
* @final
|
19 |
*/
|
20 |
-
class
|
21 |
{
|
22 |
protected $value;
|
23 |
protected $type;
|
@@ -159,7 +159,7 @@ class Twig_SupTwg_Token
|
|
159 |
throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
|
160 |
}
|
161 |
|
162 |
-
return $short ? $name : '
|
163 |
}
|
164 |
|
165 |
/**
|
17 |
*
|
18 |
* @final
|
19 |
*/
|
20 |
+
class Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
18 |
{
|
19 |
/**
|
20 |
-
* @var
|
21 |
*/
|
22 |
protected $parser;
|
23 |
|
24 |
/**
|
25 |
* Sets the parser associated with this token parser.
|
26 |
*/
|
27 |
-
public function setParser(
|
28 |
{
|
29 |
$this->parser = $parser;
|
30 |
}
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
abstract class Twig_SupTwgDtgs_TokenParser implements Twig_SupTwgDtgs_TokenParserInterface
|
18 |
{
|
19 |
/**
|
20 |
+
* @var Twig_SupTwgDtgs_Parser
|
21 |
*/
|
22 |
protected $parser;
|
23 |
|
24 |
/**
|
25 |
* Sets the parser associated with this token parser.
|
26 |
*/
|
27 |
+
public function setParser(Twig_SupTwgDtgs_Parser $parser)
|
28 |
{
|
29 |
$this->parser = $parser;
|
30 |
}
|
vendor/Twig/TokenParser/AutoEscape.php
CHANGED
@@ -29,19 +29,19 @@
|
|
29 |
*
|
30 |
* @final
|
31 |
*/
|
32 |
-
class
|
33 |
{
|
34 |
-
public function parse(
|
35 |
{
|
36 |
$lineno = $token->getLine();
|
37 |
$stream = $this->parser->getStream();
|
38 |
|
39 |
-
if ($stream->test(
|
40 |
$value = 'html';
|
41 |
} else {
|
42 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
43 |
-
if (!$expr instanceof
|
44 |
-
throw new
|
45 |
}
|
46 |
$value = $expr->getAttribute('value');
|
47 |
|
@@ -51,25 +51,25 @@ class Twig_SupTwg_TokenParser_AutoEscape extends Twig_SupTwg_TokenParser
|
|
51 |
$value = 'html';
|
52 |
}
|
53 |
|
54 |
-
if ($compat && $stream->test(
|
55 |
-
|
56 |
|
57 |
if (false === $value) {
|
58 |
-
throw new
|
59 |
}
|
60 |
|
61 |
$value = $stream->next()->getValue();
|
62 |
}
|
63 |
}
|
64 |
|
65 |
-
$stream->expect(
|
66 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
67 |
-
$stream->expect(
|
68 |
|
69 |
-
return new
|
70 |
}
|
71 |
|
72 |
-
public function decideBlockEnd(
|
73 |
{
|
74 |
return $token->test('endautoescape');
|
75 |
}
|
29 |
*
|
30 |
* @final
|
31 |
*/
|
32 |
+
class Twig_SupTwgDtgs_TokenParser_AutoEscape extends Twig_SupTwgDtgs_TokenParser
|
33 |
{
|
34 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
35 |
{
|
36 |
$lineno = $token->getLine();
|
37 |
$stream = $this->parser->getStream();
|
38 |
|
39 |
+
if ($stream->test(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE)) {
|
40 |
$value = 'html';
|
41 |
} else {
|
42 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
43 |
+
if (!$expr instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
44 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
66 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
67 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
68 |
|
69 |
+
return new Twig_SupTwgDtgs_Node_AutoEscape($value, $body, $lineno, $this->getTag());
|
70 |
}
|
71 |
|
72 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
26 |
{
|
27 |
-
public function parse(
|
28 |
{
|
29 |
$lineno = $token->getLine();
|
30 |
$stream = $this->parser->getStream();
|
31 |
-
$name = $stream->expect(
|
32 |
if ($this->parser->hasBlock($name)) {
|
33 |
-
throw new
|
34 |
}
|
35 |
-
$this->parser->setBlock($name, $block = new
|
36 |
$this->parser->pushLocalScope();
|
37 |
$this->parser->pushBlockStack($name);
|
38 |
|
39 |
-
if ($stream->nextIf(
|
40 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
41 |
-
if ($token = $stream->nextIf(
|
42 |
$value = $token->getValue();
|
43 |
|
44 |
if ($value != $name) {
|
45 |
-
throw new
|
46 |
}
|
47 |
}
|
48 |
} else {
|
49 |
-
$body = new
|
50 |
-
new
|
51 |
));
|
52 |
}
|
53 |
-
$stream->expect(
|
54 |
|
55 |
$block->setNode('body', $body);
|
56 |
$this->parser->popBlockStack();
|
57 |
$this->parser->popLocalScope();
|
58 |
|
59 |
-
return new
|
60 |
}
|
61 |
|
62 |
-
public function decideBlockEnd(
|
63 |
{
|
64 |
return $token->test('endblock');
|
65 |
}
|
22 |
*
|
23 |
* @final
|
24 |
*/
|
25 |
+
class Twig_SupTwgDtgs_TokenParser_Block extends Twig_SupTwgDtgs_TokenParser
|
26 |
{
|
27 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
28 |
{
|
29 |
$lineno = $token->getLine();
|
30 |
$stream = $this->parser->getStream();
|
31 |
+
$name = $stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
32 |
if ($this->parser->hasBlock($name)) {
|
33 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Node_Block($name, new Twig_SupTwgDtgs_Node(array()), $lineno));
|
36 |
$this->parser->pushLocalScope();
|
37 |
$this->parser->pushBlockStack($name);
|
38 |
|
39 |
+
if ($stream->nextIf(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE)) {
|
40 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
41 |
+
if ($token = $stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE)) {
|
42 |
$value = $token->getValue();
|
43 |
|
44 |
if ($value != $name) {
|
45 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Node(array(
|
50 |
+
new Twig_SupTwgDtgs_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno),
|
51 |
));
|
52 |
}
|
53 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
54 |
|
55 |
$block->setNode('body', $body);
|
56 |
$this->parser->popBlockStack();
|
57 |
$this->parser->popLocalScope();
|
58 |
|
59 |
+
return new Twig_SupTwgDtgs_Node_BlockReference($name, $lineno, $this->getTag());
|
60 |
}
|
61 |
|
62 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function parse(
|
20 |
{
|
21 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
22 |
|
23 |
-
$this->parser->getStream()->expect(
|
24 |
|
25 |
-
return new
|
26 |
}
|
27 |
|
28 |
public function getTag()
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_TokenParser_Do extends Twig_SupTwgDtgs_TokenParser
|
18 |
{
|
19 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
20 |
{
|
21 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
22 |
|
23 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
24 |
|
25 |
+
return new Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
-
public function parse(
|
20 |
{
|
21 |
$stream = $this->parser->getStream();
|
22 |
|
@@ -24,19 +24,19 @@ class Twig_SupTwg_TokenParser_Embed extends Twig_SupTwg_TokenParser_Include
|
|
24 |
|
25 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
26 |
|
27 |
-
$parentToken = $fakeParentToken = new
|
28 |
-
if ($parent instanceof
|
29 |
-
$parentToken = new
|
30 |
-
} elseif ($parent instanceof
|
31 |
-
$parentToken = new
|
32 |
}
|
33 |
|
34 |
// inject a fake parent to make the parent() function work
|
35 |
$stream->injectTokens(array(
|
36 |
-
new
|
37 |
-
new
|
38 |
$parentToken,
|
39 |
-
new
|
40 |
));
|
41 |
|
42 |
$module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true);
|
@@ -48,12 +48,12 @@ class Twig_SupTwg_TokenParser_Embed extends Twig_SupTwg_TokenParser_Include
|
|
48 |
|
49 |
$this->parser->embedTemplate($module);
|
50 |
|
51 |
-
$stream->expect(
|
52 |
|
53 |
-
return new
|
54 |
}
|
55 |
|
56 |
-
public function decideBlockEnd(
|
57 |
{
|
58 |
return $token->test('endembed');
|
59 |
}
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_TokenParser_Embed extends Twig_SupTwgDtgs_TokenParser_Include
|
18 |
{
|
19 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
20 |
{
|
21 |
$stream = $this->parser->getStream();
|
22 |
|
24 |
|
25 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
26 |
|
27 |
+
$parentToken = $fakeParentToken = new Twig_SupTwgDtgs_Token(Twig_SupTwgDtgs_Token::STRING_TYPE, '__parent__', $token->getLine());
|
28 |
+
if ($parent instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
29 |
+
$parentToken = new Twig_SupTwgDtgs_Token(Twig_SupTwgDtgs_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine());
|
30 |
+
} elseif ($parent instanceof Twig_SupTwgDtgs_Node_Expression_Name) {
|
31 |
+
$parentToken = new Twig_SupTwgDtgs_Token(Twig_SupTwgDtgs_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_SupTwgDtgs_Token(Twig_SupTwgDtgs_Token::BLOCK_START_TYPE, '', $token->getLine()),
|
37 |
+
new Twig_SupTwgDtgs_Token(Twig_SupTwgDtgs_Token::NAME_TYPE, 'extends', $token->getLine()),
|
38 |
$parentToken,
|
39 |
+
new Twig_SupTwgDtgs_Token(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
52 |
|
53 |
+
return new Twig_SupTwgDtgs_Node_Embed($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
|
54 |
}
|
55 |
|
56 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
23 |
{
|
24 |
-
public function parse(
|
25 |
{
|
26 |
$stream = $this->parser->getStream();
|
27 |
|
28 |
if (!$this->parser->isMainScope()) {
|
29 |
-
throw new
|
30 |
}
|
31 |
|
32 |
if (null !== $this->parser->getParent()) {
|
33 |
-
throw new
|
34 |
}
|
35 |
$this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
|
36 |
|
37 |
-
$stream->expect(
|
38 |
}
|
39 |
|
40 |
public function getTag()
|
19 |
*
|
20 |
* @final
|
21 |
*/
|
22 |
+
class Twig_SupTwgDtgs_TokenParser_Extends extends Twig_SupTwgDtgs_TokenParser
|
23 |
{
|
24 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
25 |
{
|
26 |
$stream = $this->parser->getStream();
|
27 |
|
28 |
if (!$this->parser->isMainScope()) {
|
29 |
+
throw new Twig_SupTwgDtgs_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext());
|
30 |
}
|
31 |
|
32 |
if (null !== $this->parser->getParent()) {
|
33 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
24 |
{
|
25 |
-
public function parse(
|
26 |
{
|
27 |
$name = $this->parser->getVarName();
|
28 |
-
$ref = new
|
29 |
|
30 |
$filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
|
31 |
-
$this->parser->getStream()->expect(
|
32 |
|
33 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
34 |
-
$this->parser->getStream()->expect(
|
35 |
|
36 |
-
$block = new
|
37 |
$this->parser->setBlock($name, $block);
|
38 |
|
39 |
-
return new
|
40 |
}
|
41 |
|
42 |
-
public function decideBlockEnd(
|
43 |
{
|
44 |
return $token->test('endfilter');
|
45 |
}
|
20 |
*
|
21 |
* @final
|
22 |
*/
|
23 |
+
class Twig_SupTwgDtgs_TokenParser_Filter extends Twig_SupTwgDtgs_TokenParser
|
24 |
{
|
25 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
26 |
{
|
27 |
$name = $this->parser->getVarName();
|
28 |
+
$ref = new Twig_SupTwgDtgs_Node_Expression_BlockReference(new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
32 |
|
33 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
34 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
35 |
|
36 |
+
$block = new Twig_SupTwgDtgs_Node_Block($name, $body, $token->getLine());
|
37 |
$this->parser->setBlock($name, $block);
|
38 |
|
39 |
+
return new Twig_SupTwgDtgs_Node_Print($filter, $token->getLine(), $this->getTag());
|
40 |
}
|
41 |
|
42 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
20 |
{
|
21 |
-
public function parse(
|
22 |
{
|
23 |
-
$this->parser->getStream()->expect(
|
24 |
|
25 |
-
return new
|
26 |
}
|
27 |
|
28 |
public function getTag()
|
16 |
*
|
17 |
* @final
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_TokenParser_Flush extends Twig_SupTwgDtgs_TokenParser
|
20 |
{
|
21 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
22 |
{
|
23 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
24 |
|
25 |
+
return new Twig_SupTwgDtgs_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
|
27 |
{
|
28 |
-
public function parse(
|
29 |
{
|
30 |
$lineno = $token->getLine();
|
31 |
$stream = $this->parser->getStream();
|
32 |
$targets = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
33 |
-
$stream->expect(
|
34 |
$seq = $this->parser->getExpressionParser()->parseExpression();
|
35 |
|
36 |
$ifexpr = null;
|
37 |
-
if ($stream->nextIf(
|
38 |
$ifexpr = $this->parser->getExpressionParser()->parseExpression();
|
39 |
}
|
40 |
|
41 |
-
$stream->expect(
|
42 |
$body = $this->parser->subparse(array($this, 'decideForFork'));
|
43 |
if ($stream->next()->getValue() == 'else') {
|
44 |
-
$stream->expect(
|
45 |
$else = $this->parser->subparse(array($this, 'decideForEnd'), true);
|
46 |
} else {
|
47 |
$else = null;
|
48 |
}
|
49 |
-
$stream->expect(
|
50 |
|
51 |
if (count($targets) > 1) {
|
52 |
$keyTarget = $targets->getNode(0);
|
53 |
-
$keyTarget = new
|
54 |
$valueTarget = $targets->getNode(1);
|
55 |
-
$valueTarget = new
|
56 |
} else {
|
57 |
-
$keyTarget = new
|
58 |
$valueTarget = $targets->getNode(0);
|
59 |
-
$valueTarget = new
|
60 |
}
|
61 |
|
62 |
if ($ifexpr) {
|
@@ -64,24 +64,24 @@ class Twig_SupTwg_TokenParser_For extends Twig_SupTwg_TokenParser
|
|
64 |
$this->checkLoopUsageBody($stream, $body);
|
65 |
}
|
66 |
|
67 |
-
return new
|
68 |
}
|
69 |
|
70 |
-
public function decideForFork(
|
71 |
{
|
72 |
return $token->test(array('else', 'endfor'));
|
73 |
}
|
74 |
|
75 |
-
public function decideForEnd(
|
76 |
{
|
77 |
return $token->test('endfor');
|
78 |
}
|
79 |
|
80 |
// the loop variable cannot be used in the condition
|
81 |
-
protected function checkLoopUsageCondition(
|
82 |
{
|
83 |
-
if ($node instanceof
|
84 |
-
throw new
|
85 |
}
|
86 |
|
87 |
foreach ($node as $n) {
|
@@ -95,17 +95,17 @@ class Twig_SupTwg_TokenParser_For extends Twig_SupTwg_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(
|
99 |
{
|
100 |
-
if ($node instanceof
|
101 |
$attribute = $node->getNode('attribute');
|
102 |
-
if ($attribute instanceof
|
103 |
-
throw new
|
104 |
}
|
105 |
}
|
106 |
|
107 |
// should check for parent.loop.XXX usage
|
108 |
-
if ($node instanceof
|
109 |
return;
|
110 |
}
|
111 |
|
23 |
*
|
24 |
* @final
|
25 |
*/
|
26 |
+
class Twig_SupTwgDtgs_TokenParser_For extends Twig_SupTwgDtgs_TokenParser
|
27 |
{
|
28 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
29 |
{
|
30 |
$lineno = $token->getLine();
|
31 |
$stream = $this->parser->getStream();
|
32 |
$targets = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
33 |
+
$stream->expect(Twig_SupTwgDtgs_Token::OPERATOR_TYPE, 'in');
|
34 |
$seq = $this->parser->getExpressionParser()->parseExpression();
|
35 |
|
36 |
$ifexpr = null;
|
37 |
+
if ($stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE, 'if')) {
|
38 |
$ifexpr = $this->parser->getExpressionParser()->parseExpression();
|
39 |
}
|
40 |
|
41 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
42 |
$body = $this->parser->subparse(array($this, 'decideForFork'));
|
43 |
if ($stream->next()->getValue() == 'else') {
|
44 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
45 |
$else = $this->parser->subparse(array($this, 'decideForEnd'), true);
|
46 |
} else {
|
47 |
$else = null;
|
48 |
}
|
49 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
50 |
|
51 |
if (count($targets) > 1) {
|
52 |
$keyTarget = $targets->getNode(0);
|
53 |
+
$keyTarget = new Twig_SupTwgDtgs_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine());
|
54 |
$valueTarget = $targets->getNode(1);
|
55 |
+
$valueTarget = new Twig_SupTwgDtgs_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
|
56 |
} else {
|
57 |
+
$keyTarget = new Twig_SupTwgDtgs_Node_Expression_AssignName('_key', $lineno);
|
58 |
$valueTarget = $targets->getNode(0);
|
59 |
+
$valueTarget = new Twig_SupTwgDtgs_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
|
60 |
}
|
61 |
|
62 |
if ($ifexpr) {
|
64 |
$this->checkLoopUsageBody($stream, $body);
|
65 |
}
|
66 |
|
67 |
+
return new Twig_SupTwgDtgs_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag());
|
68 |
}
|
69 |
|
70 |
+
public function decideForFork(Twig_SupTwgDtgs_Token $token)
|
71 |
{
|
72 |
return $token->test(array('else', 'endfor'));
|
73 |
}
|
74 |
|
75 |
+
public function decideForEnd(Twig_SupTwgDtgs_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_SupTwgDtgs_TokenStream $stream, Twig_SupTwgDtgs_NodeInterface $node)
|
82 |
{
|
83 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwgDtgs_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
|
84 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_TokenStream $stream, Twig_SupTwgDtgs_NodeInterface $node)
|
99 |
{
|
100 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_SupTwgDtgs_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) {
|
101 |
$attribute = $node->getNode('attribute');
|
102 |
+
if ($attribute instanceof Twig_SupTwgDtgs_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) {
|
103 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Node_For) {
|
109 |
return;
|
110 |
}
|
111 |
|
vendor/Twig/TokenParser/From.php
CHANGED
@@ -18,9 +18,9 @@
|
|
18 |
*
|
19 |
* @final
|
20 |
*/
|
21 |
-
class
|
22 |
{
|
23 |
-
public function parse(
|
24 |
{
|
25 |
$macro = $this->parser->getExpressionParser()->parseExpression();
|
26 |
$stream = $this->parser->getStream();
|
@@ -28,27 +28,27 @@ class Twig_SupTwg_TokenParser_From extends Twig_SupTwg_TokenParser
|
|
28 |
|
29 |
$targets = array();
|
30 |
do {
|
31 |
-
$name = $stream->expect(
|
32 |
|
33 |
$alias = $name;
|
34 |
if ($stream->nextIf('as')) {
|
35 |
-
$alias = $stream->expect(
|
36 |
}
|
37 |
|
38 |
$targets[$name] = $alias;
|
39 |
|
40 |
-
if (!$stream->nextIf(
|
41 |
break;
|
42 |
}
|
43 |
} while (true);
|
44 |
|
45 |
-
$stream->expect(
|
46 |
|
47 |
-
$node = new
|
48 |
|
49 |
foreach ($targets as $name => $alias) {
|
50 |
if ($this->parser->isReservedMacroName($name)) {
|
51 |
-
throw new
|
52 |
}
|
53 |
|
54 |
$this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var'));
|
18 |
*
|
19 |
* @final
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_TokenParser_From extends Twig_SupTwgDtgs_TokenParser
|
22 |
{
|
23 |
+
public function parse(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
32 |
|
33 |
$alias = $name;
|
34 |
if ($stream->nextIf('as')) {
|
35 |
+
$alias = $stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
36 |
}
|
37 |
|
38 |
$targets[$name] = $alias;
|
39 |
|
40 |
+
if (!$stream->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',')) {
|
41 |
break;
|
42 |
}
|
43 |
} while (true);
|
44 |
|
45 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
46 |
|
47 |
+
$node = new Twig_SupTwgDtgs_Node_Import($macro, new Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
29 |
{
|
30 |
-
public function parse(
|
31 |
{
|
32 |
$lineno = $token->getLine();
|
33 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
34 |
$stream = $this->parser->getStream();
|
35 |
-
$stream->expect(
|
36 |
$body = $this->parser->subparse(array($this, 'decideIfFork'));
|
37 |
$tests = array($expr, $body);
|
38 |
$else = null;
|
@@ -41,13 +41,13 @@ class Twig_SupTwg_TokenParser_If extends Twig_SupTwg_TokenParser
|
|
41 |
while (!$end) {
|
42 |
switch ($stream->next()->getValue()) {
|
43 |
case 'else':
|
44 |
-
$stream->expect(
|
45 |
$else = $this->parser->subparse(array($this, 'decideIfEnd'));
|
46 |
break;
|
47 |
|
48 |
case 'elseif':
|
49 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
50 |
-
$stream->expect(
|
51 |
$body = $this->parser->subparse(array($this, 'decideIfFork'));
|
52 |
$tests[] = $expr;
|
53 |
$tests[] = $body;
|
@@ -58,21 +58,21 @@ class Twig_SupTwg_TokenParser_If extends Twig_SupTwg_TokenParser
|
|
58 |
break;
|
59 |
|
60 |
default:
|
61 |
-
throw new
|
62 |
}
|
63 |
}
|
64 |
|
65 |
-
$stream->expect(
|
66 |
|
67 |
-
return new
|
68 |
}
|
69 |
|
70 |
-
public function decideIfFork(
|
71 |
{
|
72 |
return $token->test(array('elseif', 'else', 'endif'));
|
73 |
}
|
74 |
|
75 |
-
public function decideIfEnd(
|
76 |
{
|
77 |
return $token->test(array('endif'));
|
78 |
}
|
25 |
*
|
26 |
* @final
|
27 |
*/
|
28 |
+
class Twig_SupTwgDtgs_TokenParser_If extends Twig_SupTwgDtgs_TokenParser
|
29 |
{
|
30 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
31 |
{
|
32 |
$lineno = $token->getLine();
|
33 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
34 |
$stream = $this->parser->getStream();
|
35 |
+
$stream->expect(Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
66 |
|
67 |
+
return new Twig_SupTwgDtgs_Node_If(new Twig_SupTwgDtgs_Node($tests), $else, $lineno, $this->getTag());
|
68 |
}
|
69 |
|
70 |
+
public function decideIfFork(Twig_SupTwgDtgs_Token $token)
|
71 |
{
|
72 |
return $token->test(array('elseif', 'else', 'endif'));
|
73 |
}
|
74 |
|
75 |
+
public function decideIfEnd(Twig_SupTwgDtgs_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
|
22 |
{
|
23 |
-
public function parse(
|
24 |
{
|
25 |
$macro = $this->parser->getExpressionParser()->parseExpression();
|
26 |
$this->parser->getStream()->expect('as');
|
27 |
-
$var = new
|
28 |
-
$this->parser->getStream()->expect(
|
29 |
|
30 |
$this->parser->addImportedSymbol('template', $var->getAttribute('name'));
|
31 |
|
32 |
-
return new
|
33 |
}
|
34 |
|
35 |
public function getTag()
|
18 |
*
|
19 |
* @final
|
20 |
*/
|
21 |
+
class Twig_SupTwgDtgs_TokenParser_Import extends Twig_SupTwgDtgs_TokenParser
|
22 |
{
|
23 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
24 |
{
|
25 |
$macro = $this->parser->getExpressionParser()->parseExpression();
|
26 |
$this->parser->getStream()->expect('as');
|
27 |
+
$var = new Twig_SupTwgDtgs_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::NAME_TYPE)->getValue(), $token->getLine());
|
28 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
29 |
|
30 |
$this->parser->addImportedSymbol('template', $var->getAttribute('name'));
|
31 |
|
32 |
+
return new Twig_SupTwgDtgs_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
|
25 |
{
|
26 |
-
public function parse(
|
27 |
{
|
28 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
29 |
|
30 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
31 |
|
32 |
-
return new
|
33 |
}
|
34 |
|
35 |
protected function parseArguments()
|
@@ -37,23 +37,23 @@ class Twig_SupTwg_TokenParser_Include extends Twig_SupTwg_TokenParser
|
|
37 |
$stream = $this->parser->getStream();
|
38 |
|
39 |
$ignoreMissing = false;
|
40 |
-
if ($stream->nextIf(
|
41 |
-
$stream->expect(
|
42 |
|
43 |
$ignoreMissing = true;
|
44 |
}
|
45 |
|
46 |
$variables = null;
|
47 |
-
if ($stream->nextIf(
|
48 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
49 |
}
|
50 |
|
51 |
$only = false;
|
52 |
-
if ($stream->nextIf(
|
53 |
$only = true;
|
54 |
}
|
55 |
|
56 |
-
$stream->expect(
|
57 |
|
58 |
return array($variables, $only, $ignoreMissing);
|
59 |
}
|
21 |
*
|
22 |
* @final
|
23 |
*/
|
24 |
+
class Twig_SupTwgDtgs_TokenParser_Include extends Twig_SupTwgDtgs_TokenParser
|
25 |
{
|
26 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
27 |
{
|
28 |
$expr = $this->parser->getExpressionParser()->parseExpression();
|
29 |
|
30 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
31 |
|
32 |
+
return new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE, 'ignore')) {
|
41 |
+
$stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE, 'missing');
|
42 |
|
43 |
$ignoreMissing = true;
|
44 |
}
|
45 |
|
46 |
$variables = null;
|
47 |
+
if ($stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE, 'with')) {
|
48 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
49 |
}
|
50 |
|
51 |
$only = false;
|
52 |
+
if ($stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE, 'only')) {
|
53 |
$only = true;
|
54 |
}
|
55 |
|
56 |
+
$stream->expect(Twig_SupTwgDtgs_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
|
24 |
{
|
25 |
-
public function parse(
|
26 |
{
|
27 |
$lineno = $token->getLine();
|
28 |
$stream = $this->parser->getStream();
|
29 |
-
$name = $stream->expect(
|
30 |
|
31 |
$arguments = $this->parser->getExpressionParser()->parseArguments(true, true);
|
32 |
|
33 |
-
$stream->expect(
|
34 |
$this->parser->pushLocalScope();
|
35 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
36 |
-
if ($token = $stream->nextIf(
|
37 |
$value = $token->getValue();
|
38 |
|
39 |
if ($value != $name) {
|
40 |
-
throw new
|
41 |
}
|
42 |
}
|
43 |
$this->parser->popLocalScope();
|
44 |
-
$stream->expect(
|
45 |
|
46 |
-
$this->parser->setMacro($name, new
|
47 |
}
|
48 |
|
49 |
-
public function decideBlockEnd(
|
50 |
{
|
51 |
return $token->test('endmacro');
|
52 |
}
|
20 |
*
|
21 |
* @final
|
22 |
*/
|
23 |
+
class Twig_SupTwgDtgs_TokenParser_Macro extends Twig_SupTwgDtgs_TokenParser
|
24 |
{
|
25 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
26 |
{
|
27 |
$lineno = $token->getLine();
|
28 |
$stream = $this->parser->getStream();
|
29 |
+
$name = $stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
30 |
|
31 |
$arguments = $this->parser->getExpressionParser()->parseArguments(true, true);
|
32 |
|
33 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
34 |
$this->parser->pushLocalScope();
|
35 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
36 |
+
if ($token = $stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE)) {
|
37 |
$value = $token->getValue();
|
38 |
|
39 |
if ($value != $name) {
|
40 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
45 |
|
46 |
+
$this->parser->setMacro($name, new Twig_SupTwgDtgs_Node_Macro($name, new Twig_SupTwgDtgs_Node_Body(array($body)), $arguments, $lineno, $this->getTag()));
|
47 |
}
|
48 |
|
49 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
26 |
{
|
27 |
-
public function parse(
|
28 |
{
|
29 |
$stream = $this->parser->getStream();
|
30 |
-
$stream->expect(
|
31 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
32 |
-
$stream->expect(
|
33 |
|
34 |
// in a sandbox tag, only include tags are allowed
|
35 |
-
if (!$body instanceof
|
36 |
foreach ($body as $node) {
|
37 |
-
if ($node instanceof
|
38 |
continue;
|
39 |
}
|
40 |
|
41 |
-
if (!$node instanceof
|
42 |
-
throw new
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
|
47 |
-
return new
|
48 |
}
|
49 |
|
50 |
-
public function decideBlockEnd(
|
51 |
{
|
52 |
return $token->test('endsandbox');
|
53 |
}
|
22 |
*
|
23 |
* @final
|
24 |
*/
|
25 |
+
class Twig_SupTwgDtgs_TokenParser_Sandbox extends Twig_SupTwgDtgs_TokenParser
|
26 |
{
|
27 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
28 |
{
|
29 |
$stream = $this->parser->getStream();
|
30 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
31 |
$body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
32 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
33 |
|
34 |
// in a sandbox tag, only include tags are allowed
|
35 |
+
if (!$body instanceof Twig_SupTwgDtgs_Node_Include) {
|
36 |
foreach ($body as $node) {
|
37 |
+
if ($node instanceof Twig_SupTwgDtgs_Node_Text && ctype_space($node->getAttribute('data'))) {
|
38 |
continue;
|
39 |
}
|
40 |
|
41 |
+
if (!$node instanceof Twig_SupTwgDtgs_Node_Include) {
|
42 |
+
throw new Twig_SupTwgDtgs_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext());
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
return new Twig_SupTwgDtgs_Node_Sandbox($body, $token->getLine(), $this->getTag());
|
48 |
}
|
49 |
|
50 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
32 |
{
|
33 |
-
public function parse(
|
34 |
{
|
35 |
$lineno = $token->getLine();
|
36 |
$stream = $this->parser->getStream();
|
37 |
$names = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
38 |
|
39 |
$capture = false;
|
40 |
-
if ($stream->nextIf(
|
41 |
$values = $this->parser->getExpressionParser()->parseMultitargetExpression();
|
42 |
|
43 |
-
$stream->expect(
|
44 |
|
45 |
if (count($names) !== count($values)) {
|
46 |
-
throw new
|
47 |
}
|
48 |
} else {
|
49 |
$capture = true;
|
50 |
|
51 |
if (count($names) > 1) {
|
52 |
-
throw new
|
53 |
}
|
54 |
|
55 |
-
$stream->expect(
|
56 |
|
57 |
$values = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
58 |
-
$stream->expect(
|
59 |
}
|
60 |
|
61 |
-
return new
|
62 |
}
|
63 |
|
64 |
-
public function decideBlockEnd(
|
65 |
{
|
66 |
return $token->test('endset');
|
67 |
}
|
28 |
*
|
29 |
* @final
|
30 |
*/
|
31 |
+
class Twig_SupTwgDtgs_TokenParser_Set extends Twig_SupTwgDtgs_TokenParser
|
32 |
{
|
33 |
+
public function parse(Twig_SupTwgDtgs_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_SupTwgDtgs_Token::OPERATOR_TYPE, '=')) {
|
41 |
$values = $this->parser->getExpressionParser()->parseMultitargetExpression();
|
42 |
|
43 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
44 |
|
45 |
if (count($names) !== count($values)) {
|
46 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
56 |
|
57 |
$values = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
|
58 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
59 |
}
|
60 |
|
61 |
+
return new Twig_SupTwgDtgs_Node_Set($capture, $names, $values, $lineno, $this->getTag());
|
62 |
}
|
63 |
|
64 |
+
public function decideBlockEnd(Twig_SupTwgDtgs_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
|
28 |
{
|
29 |
-
public function parse(
|
30 |
{
|
31 |
$lineno = $token->getLine();
|
32 |
|
33 |
-
$this->parser->getStream()->expect(
|
34 |
$body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
|
35 |
-
$this->parser->getStream()->expect(
|
36 |
|
37 |
-
return new
|
38 |
}
|
39 |
|
40 |
-
public function decideSpacelessEnd(
|
41 |
{
|
42 |
return $token->test('endspaceless');
|
43 |
}
|
24 |
*
|
25 |
* @final
|
26 |
*/
|
27 |
+
class Twig_SupTwgDtgs_TokenParser_Spaceless extends Twig_SupTwgDtgs_TokenParser
|
28 |
{
|
29 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
30 |
{
|
31 |
$lineno = $token->getLine();
|
32 |
|
33 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
34 |
$body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
|
35 |
+
$this->parser->getStream()->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
36 |
|
37 |
+
return new Twig_SupTwgDtgs_Node_Spaceless($body, $lineno, $this->getTag());
|
38 |
}
|
39 |
|
40 |
+
public function decideSpacelessEnd(Twig_SupTwgDtgs_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
|
29 |
{
|
30 |
-
public function parse(
|
31 |
{
|
32 |
$template = $this->parser->getExpressionParser()->parseExpression();
|
33 |
$stream = $this->parser->getStream();
|
34 |
|
35 |
-
if (!$template instanceof
|
36 |
-
throw new
|
37 |
}
|
38 |
|
39 |
$targets = array();
|
40 |
if ($stream->nextIf('with')) {
|
41 |
do {
|
42 |
-
$name = $stream->expect(
|
43 |
|
44 |
$alias = $name;
|
45 |
if ($stream->nextIf('as')) {
|
46 |
-
$alias = $stream->expect(
|
47 |
}
|
48 |
|
49 |
-
$targets[$name] = new
|
50 |
|
51 |
-
if (!$stream->nextIf(
|
52 |
break;
|
53 |
}
|
54 |
} while (true);
|
55 |
}
|
56 |
|
57 |
-
$stream->expect(
|
58 |
|
59 |
-
$this->parser->addTrait(new
|
60 |
}
|
61 |
|
62 |
public function getTag()
|
25 |
*
|
26 |
* @final
|
27 |
*/
|
28 |
+
class Twig_SupTwgDtgs_TokenParser_Use extends Twig_SupTwgDtgs_TokenParser
|
29 |
{
|
30 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
31 |
{
|
32 |
$template = $this->parser->getExpressionParser()->parseExpression();
|
33 |
$stream = $this->parser->getStream();
|
34 |
|
35 |
+
if (!$template instanceof Twig_SupTwgDtgs_Node_Expression_Constant) {
|
36 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
43 |
|
44 |
$alias = $name;
|
45 |
if ($stream->nextIf('as')) {
|
46 |
+
$alias = $stream->expect(Twig_SupTwgDtgs_Token::NAME_TYPE)->getValue();
|
47 |
}
|
48 |
|
49 |
+
$targets[$name] = new Twig_SupTwgDtgs_Node_Expression_Constant($alias, -1);
|
50 |
|
51 |
+
if (!$stream->nextIf(Twig_SupTwgDtgs_Token::PUNCTUATION_TYPE, ',')) {
|
52 |
break;
|
53 |
}
|
54 |
} while (true);
|
55 |
}
|
56 |
|
57 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
58 |
|
59 |
+
$this->parser->addTrait(new Twig_SupTwgDtgs_Node(array('template' => $template, 'targets' => new Twig_SupTwgDtgs_Node($targets))));
|
60 |
}
|
61 |
|
62 |
public function getTag()
|
vendor/Twig/TokenParser/With.php
CHANGED
@@ -16,29 +16,29 @@
|
|
16 |
*
|
17 |
* @final
|
18 |
*/
|
19 |
-
class
|
20 |
{
|
21 |
-
public function parse(
|
22 |
{
|
23 |
$stream = $this->parser->getStream();
|
24 |
|
25 |
$variables = null;
|
26 |
$only = false;
|
27 |
-
if (!$stream->test(
|
28 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
29 |
-
$only = $stream->nextIf(
|
30 |
}
|
31 |
|
32 |
-
$stream->expect(
|
33 |
|
34 |
$body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
|
35 |
|
36 |
-
$stream->expect(
|
37 |
|
38 |
-
return new
|
39 |
}
|
40 |
|
41 |
-
public function decideWithEnd(
|
42 |
{
|
43 |
return $token->test('endwith');
|
44 |
}
|
16 |
*
|
17 |
* @final
|
18 |
*/
|
19 |
+
class Twig_SupTwgDtgs_TokenParser_With extends Twig_SupTwgDtgs_TokenParser
|
20 |
{
|
21 |
+
public function parse(Twig_SupTwgDtgs_Token $token)
|
22 |
{
|
23 |
$stream = $this->parser->getStream();
|
24 |
|
25 |
$variables = null;
|
26 |
$only = false;
|
27 |
+
if (!$stream->test(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE)) {
|
28 |
$variables = $this->parser->getExpressionParser()->parseExpression();
|
29 |
+
$only = $stream->nextIf(Twig_SupTwgDtgs_Token::NAME_TYPE, 'only');
|
30 |
}
|
31 |
|
32 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
33 |
|
34 |
$body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
|
35 |
|
36 |
+
$stream->expect(Twig_SupTwgDtgs_Token::BLOCK_END_TYPE);
|
37 |
|
38 |
+
return new Twig_SupTwgDtgs_Node_With($body, $variables, $only, $token->getLine(), $this->getTag());
|
39 |
}
|
40 |
|
41 |
+
public function decideWithEnd(Twig_SupTwgDtgs_Token $token)
|
42 |
{
|
43 |
return $token->test('endwith');
|
44 |
}
|
vendor/Twig/TokenParserBroker.php
CHANGED
@@ -17,43 +17,43 @@
|
|
17 |
*
|
18 |
* @deprecated since 1.12 (to be removed in 2.0)
|
19 |
*/
|
20 |
-
class
|
21 |
{
|
22 |
protected $parser;
|
23 |
protected $parsers = array();
|
24 |
protected $brokers = array();
|
25 |
|
26 |
/**
|
27 |
-
* @param array|Traversable $parsers A Traversable of
|
28 |
-
* @param array|Traversable $brokers A Traversable of
|
29 |
* @param bool $triggerDeprecationError
|
30 |
*/
|
31 |
public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true)
|
32 |
{
|
33 |
if ($triggerDeprecationError) {
|
34 |
-
|
35 |
}
|
36 |
|
37 |
foreach ($parsers as $parser) {
|
38 |
-
if (!$parser instanceof
|
39 |
-
throw new LogicException('$parsers must a an array of
|
40 |
}
|
41 |
$this->parsers[$parser->getTag()] = $parser;
|
42 |
}
|
43 |
foreach ($brokers as $broker) {
|
44 |
-
if (!$broker instanceof
|
45 |
-
throw new LogicException('$brokers must a an array of
|
46 |
}
|
47 |
$this->brokers[] = $broker;
|
48 |
}
|
49 |
}
|
50 |
|
51 |
-
public function addTokenParser(
|
52 |
{
|
53 |
$this->parsers[$parser->getTag()] = $parser;
|
54 |
}
|
55 |
|
56 |
-
public function removeTokenParser(
|
57 |
{
|
58 |
$name = $parser->getTag();
|
59 |
if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) {
|
@@ -61,12 +61,12 @@ class Twig_SupTwg_TokenParserBroker implements Twig_SupTwg_TokenParserBrokerInte
|
|
61 |
}
|
62 |
}
|
63 |
|
64 |
-
public function addTokenParserBroker(
|
65 |
{
|
66 |
$this->brokers[] = $broker;
|
67 |
}
|
68 |
|
69 |
-
public function removeTokenParserBroker(
|
70 |
{
|
71 |
if (false !== $pos = array_search($broker, $this->brokers)) {
|
72 |
unset($this->brokers[$pos]);
|
@@ -80,7 +80,7 @@ class Twig_SupTwg_TokenParserBroker implements Twig_SupTwg_TokenParserBrokerInte
|
|
80 |
*
|
81 |
* @param string $tag A tag name
|
82 |
*
|
83 |
-
* @return null|
|
84 |
*/
|
85 |
public function getTokenParser($tag)
|
86 |
{
|
@@ -107,7 +107,7 @@ class Twig_SupTwg_TokenParserBroker implements Twig_SupTwg_TokenParserBrokerInte
|
|
107 |
return $this->parser;
|
108 |
}
|
109 |
|
110 |
-
public function setParser(
|
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_SupTwgDtgs_TokenParserBroker implements Twig_SupTwgDtgs_TokenParserBrokerInterface
|
21 |
{
|
22 |
protected $parser;
|
23 |
protected $parsers = array();
|
24 |
protected $brokers = array();
|
25 |
|
26 |
/**
|
27 |
+
* @param array|Traversable $parsers A Traversable of Twig_SupTwgDtgs_TokenParserInterface instances
|
28 |
+
* @param array|Traversable $brokers A Traversable of Twig_SupTwgDtgs_TokenParserBrokerInterface instances
|
29 |
* @param bool $triggerDeprecationError
|
30 |
*/
|
31 |
public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true)
|
32 |
{
|
33 |
if ($triggerDeprecationError) {
|
34 |
+
//@trigger_error('The '.__CLASS__.' class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
|
35 |
}
|
36 |
|
37 |
foreach ($parsers as $parser) {
|
38 |
+
if (!$parser instanceof Twig_SupTwgDtgs_TokenParserInterface) {
|
39 |
+
throw new LogicException('$parsers must a an array of Twig_SupTwgDtgs_TokenParserInterface.');
|
40 |
}
|
41 |
$this->parsers[$parser->getTag()] = $parser;
|
42 |
}
|
43 |
foreach ($brokers as $broker) {
|
44 |
+
if (!$broker instanceof Twig_SupTwgDtgs_TokenParserBrokerInterface) {
|
45 |
+
throw new LogicException('$brokers must a an array of Twig_SupTwgDtgs_TokenParserBrokerInterface.');
|
46 |
}
|
47 |
$this->brokers[] = $broker;
|
48 |
}
|
49 |
}
|
50 |
|
51 |
+
public function addTokenParser(Twig_SupTwgDtgs_TokenParserInterface $parser)
|
52 |
{
|
53 |
$this->parsers[$parser->getTag()] = $parser;
|
54 |
}
|
55 |
|
56 |
+
public function removeTokenParser(Twig_SupTwgDtgs_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_SupTwgDtgs_TokenParserBroker $broker)
|
65 |
{
|
66 |
$this->brokers[] = $broker;
|
67 |
}
|
68 |
|
69 |
+
public function removeTokenParserBroker(Twig_SupTwgDtgs_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_SupTwgDtgs_TokenParserInterface A Twig_SupTwgDtgs_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_SupTwgDtgs_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
|
23 |
{
|
24 |
/**
|
25 |
* Gets a TokenParser suitable for a tag.
|
26 |
*
|
27 |
* @param string $tag A tag name
|
28 |
*
|
29 |
-
* @return
|
30 |
*/
|
31 |
public function getTokenParser($tag);
|
32 |
|
33 |
/**
|
34 |
-
* Calls
|
35 |
*/
|
36 |
-
public function setParser(
|
37 |
|
38 |
/**
|
39 |
-
* Gets the
|
40 |
*
|
41 |
-
* @return null|
|
42 |
*/
|
43 |
public function getParser();
|
44 |
}
|
19 |
*
|
20 |
* @deprecated since 1.12 (to be removed in 2.0)
|
21 |
*/
|
22 |
+
interface Twig_SupTwgDtgs_TokenParserBrokerInterface
|
23 |
{
|
24 |
/**
|
25 |
* Gets a TokenParser suitable for a tag.
|
26 |
*
|
27 |
* @param string $tag A tag name
|
28 |
*
|
29 |
+
* @return Twig_SupTwgDtgs_TokenParserInterface|null A Twig_SupTwgDtgs_TokenParserInterface or null if no suitable TokenParser was found
|
30 |
*/
|
31 |
public function getTokenParser($tag);
|
32 |
|
33 |
/**
|
34 |
+
* Calls Twig_SupTwgDtgs_TokenParserInterface::setParser on all parsers the implementation knows of.
|
35 |
*/
|
36 |
+
public function setParser(Twig_SupTwgDtgs_ParserInterface $parser);
|
37 |
|
38 |
/**
|
39 |
+
* Gets the Twig_SupTwgDtgs_ParserInterface.
|
40 |
*
|
41 |
+
* @return null|Twig_SupTwgDtgs_ParserInterface A Twig_SupTwgDtgs_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
|
18 |
{
|
19 |
/**
|
20 |
* Sets the parser associated with this token parser.
|
21 |
*/
|
22 |
-
public function setParser(
|
23 |
|
24 |
/**
|
25 |
* Parses a token and returns a node.
|
26 |
*
|
27 |
-
* @return
|
28 |
*
|
29 |
-
* @throws
|
30 |
*/
|
31 |
-
public function parse(
|
32 |
|
33 |
/**
|
34 |
* Gets the tag name associated with this token parser.
|
14 |
*
|
15 |
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
*/
|
17 |
+
interface Twig_SupTwgDtgs_TokenParserInterface
|
18 |
{
|
19 |
/**
|
20 |
* Sets the parser associated with this token parser.
|
21 |
*/
|
22 |
+
public function setParser(Twig_SupTwgDtgs_Parser $parser);
|
23 |
|
24 |
/**
|
25 |
* Parses a token and returns a node.
|
26 |
*
|
27 |
+
* @return Twig_SupTwgDtgs_NodeInterface
|
28 |
*
|
29 |
+
* @throws Twig_SupTwgDtgs_Error_Syntax
|
30 |
*/
|
31 |
+
public function parse(Twig_SupTwgDtgs_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
|
21 |
{
|
22 |
protected $tokens;
|
23 |
protected $current = 0;
|
@@ -32,11 +32,11 @@ class Twig_SupTwg_TokenStream
|
|
32 |
*/
|
33 |
public function __construct(array $tokens, $name = null, $source = null)
|
34 |
{
|
35 |
-
if (!$name instanceof
|
36 |
if (null !== $name || null !== $source) {
|
37 |
-
|
38 |
}
|
39 |
-
$this->source = new
|
40 |
} else {
|
41 |
$this->source = $name;
|
42 |
}
|
@@ -60,12 +60,12 @@ class Twig_SupTwg_TokenStream
|
|
60 |
/**
|
61 |
* Sets the pointer to the next token and returns the old one.
|
62 |
*
|
63 |
-
* @return
|
64 |
*/
|
65 |
public function next()
|
66 |
{
|
67 |
if (!isset($this->tokens[++$this->current])) {
|
68 |
-
throw new
|
69 |
}
|
70 |
|
71 |
return $this->tokens[$this->current - 1];
|
@@ -74,7 +74,7 @@ class Twig_SupTwg_TokenStream
|
|
74 |
/**
|
75 |
* Tests a token, sets the pointer to the next one and returns it or throws a syntax error.
|
76 |
*
|
77 |
-
* @return
|
78 |
*/
|
79 |
public function nextIf($primary, $secondary = null)
|
80 |
{
|
@@ -86,17 +86,17 @@ class Twig_SupTwg_TokenStream
|
|
86 |
/**
|
87 |
* Tests a token and returns it or throws a syntax error.
|
88 |
*
|
89 |
-
* @return
|
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
|
97 |
$message ? $message.'. ' : '',
|
98 |
-
|
99 |
-
|
100 |
$line,
|
101 |
$this->source
|
102 |
);
|
@@ -111,12 +111,12 @@ class Twig_SupTwg_TokenStream
|
|
111 |
*
|
112 |
* @param int $number
|
113 |
*
|
114 |
-
* @return
|
115 |
*/
|
116 |
public function look($number = 1)
|
117 |
{
|
118 |
if (!isset($this->tokens[$this->current + $number])) {
|
119 |
-
throw new
|
120 |
}
|
121 |
|
122 |
return $this->tokens[$this->current + $number];
|
@@ -139,11 +139,11 @@ class Twig_SupTwg_TokenStream
|
|
139 |
*/
|
140 |
public function isEOF()
|
141 |
{
|
142 |
-
return $this->tokens[$this->current]->getType() ===
|
143 |
}
|
144 |
|
145 |
/**
|
146 |
-
* @return
|
147 |
*/
|
148 |
public function getCurrent()
|
149 |
{
|
@@ -159,7 +159,7 @@ class Twig_SupTwg_TokenStream
|
|
159 |
*/
|
160 |
public function getFilename()
|
161 |
{
|
162 |
-
|
163 |
|
164 |
return $this->source->getName();
|
165 |
}
|
@@ -175,7 +175,7 @@ class Twig_SupTwg_TokenStream
|
|
175 |
*/
|
176 |
public function getSource()
|
177 |
{
|
178 |
-
|
179 |
|
180 |
return $this->source->getCode();
|
181 |
}
|
@@ -183,7 +183,7 @@ class Twig_SupTwg_TokenStream
|
|
183 |
/**
|
184 |
* Gets the source associated with this stream.
|
185 |
*
|
186 |
-
* @return
|
187 |
*
|
188 |
* @internal
|
189 |
*/
|
17 |
*
|
18 |
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
*/
|
20 |
+
class Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
38 |
}
|
39 |
+
$this->source = new Twig_SupTwgDtgs_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_SupTwgDtgs_Token
|
64 |
*/
|
65 |
public function next()
|
66 |
{
|
67 |
if (!isset($this->tokens[++$this->current])) {
|
68 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_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_SupTwgDtgs_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).',
|
97 |
$message ? $message.'. ' : '',
|
98 |
+
Twig_SupTwgDtgs_Token::typeToEnglish($token->getType()), $token->getValue(),
|
99 |
+
Twig_SupTwgDtgs_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''),
|
100 |
$line,
|
101 |
$this->source
|
102 |
);
|
111 |
*
|
112 |
* @param int $number
|
113 |
*
|
114 |
+
* @return Twig_SupTwgDtgs_Token
|
115 |
*/
|
116 |
public function look($number = 1)
|
117 |
{
|
118 |
if (!isset($this->tokens[$this->current + $number])) {
|
119 |
+
throw new Twig_SupTwgDtgs_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_SupTwgDtgs_Token::EOF_TYPE;
|
143 |
}
|
144 |
|
145 |
/**
|
146 |
+
* @return Twig_SupTwgDtgs_Token
|
147 |
*/
|
148 |
public function getCurrent()
|
149 |
{
|
159 |
*/
|
160 |
public function getFilename()
|
161 |
{
|
162 |
+
//@trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
163 |
|
164 |
return $this->source->getName();
|
165 |
}
|
175 |
*/
|
176 |
public function getSource()
|
177 |
{
|
178 |
+
//@trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED);
|
179 |
|
180 |
return $this->source->getCode();
|
181 |
}
|
183 |
/**
|
184 |
* Gets the source associated with this stream.
|
185 |
*
|
186 |
+
* @return Twig_SupTwgDtgs_Source
|
187 |
*
|
188 |
* @internal
|
189 |
*/
|
vendor/Twig/Util/DeprecationCollector.php
CHANGED
@@ -14,12 +14,12 @@
|
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
private $twig;
|
20 |
private $deprecations;
|
21 |
|
22 |
-
public function __construct(
|
23 |
{
|
24 |
$this->twig = $twig;
|
25 |
}
|
@@ -40,7 +40,7 @@ class Twig_SupTwg_Util_DeprecationCollector
|
|
40 |
), '{'.preg_quote($ext).'$}'
|
41 |
);
|
42 |
|
43 |
-
return $this->collect(new
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -58,8 +58,8 @@ class Twig_SupTwg_Util_DeprecationCollector
|
|
58 |
|
59 |
foreach ($iterator as $name => $contents) {
|
60 |
try {
|
61 |
-
$this->twig->parse($this->twig->tokenize(new
|
62 |
-
} catch (
|
63 |
// ignore templates containing syntax errors
|
64 |
}
|
65 |
}
|
14 |
*
|
15 |
* @final
|
16 |
*/
|
17 |
+
class Twig_SupTwgDtgs_Util_DeprecationCollector
|
18 |
{
|
19 |
private $twig;
|
20 |
private $deprecations;
|
21 |
|
22 |
+
public function __construct(Twig_SupTwgDtgs_Environment $twig)
|
23 |
{
|
24 |
$this->twig = $twig;
|
25 |
}
|
40 |
), '{'.preg_quote($ext).'$}'
|
41 |
);
|
42 |
|
43 |
+
return $this->collect(new Twig_SupTwgDtgs_Util_TemplateDirIterator($iterator));
|
44 |
}
|
45 |
|
46 |
/**
|
58 |
|
59 |
foreach ($iterator as $name => $contents) {
|
60 |
try {
|
61 |
+
$this->twig->parse($this->twig->tokenize(new Twig_SupTwgDtgs_Source($contents, $name)));
|
62 |
+
} catch (Twig_SupTwgDtgs_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
|
16 |
{
|
17 |
public function current()
|
18 |
{
|
12 |
/**
|
13 |
* @author Fabien Potencier <fabien@symfony.com>
|
14 |
*/
|
15 |
+
class Twig_SupTwgDtgs_Util_TemplateDirIterator extends IteratorIterator
|
16 |
{
|
17 |
public function current()
|
18 |
{
|