From 204cef2fa32b8badbdb605785e12b061d2ed5908 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Sun, 10 Apr 2022 19:44:00 -0300 Subject: [PATCH] Replace somes trigger_error for throw Exception and remove Twig 2 Now old PHP versions (< 7.2.5) uses Twig 1 and new PHP uses Twig 3. The Twig 2 is only selected by composer if developer need. --- system/config/autoload.php | 3 +- system/database/databases/mssql.php | 3 +- system/database/databases/mysql_legacy.php | 3 +- system/database/databases/mysql_pdo.php | 2 +- system/database/databases/oracle.php | 4 +- system/database/databases/sqlsrv.php | 3 +- system/engine/exception.php | 17 +- system/engine/loader.php | 15 +- system/language/autoload.php | 3 +- system/mail/mail.php | 54 +- system/system.php | 3 + .../templateEngines/Twig/Twig1x/autoload.php | 7 - .../templateEngines/Twig/Twig1x/composer.json | 8 + .../templateEngines/Twig/Twig1x/composer.lock | 168 ++ .../Twig/Twig1x/composer/ClassLoader.php | 445 ----- .../Twig1x/composer/autoload_classmap.php | 9 - .../Twig/Twig1x/composer/autoload_real.php | 70 - .../Twig/Twig1x/composer/autoload_static.php | 54 - .../Twig/Twig1x/composer/installed.json | 128 -- .../symfony/polyfill-ctype/bootstrap.php | 26 - .../symfony/polyfill-ctype/composer.json | 34 - .../Twig/Twig1x/twig/twig/.gitattributes | 2 - .../Twig/Twig1x/twig/twig/.gitignore | 6 - .../Twig/Twig1x/twig/twig/.php_cs.dist | 20 - .../Twig/Twig1x/twig/twig/.travis.yml | 46 - .../Twig/Twig1x/twig/twig/LICENSE | 29 - .../Twig/Twig1x/twig/twig/README.rst | 24 - .../twig/twig/src/Cache/FilesystemCache.php | 93 - .../Twig/Twig1x/twig/twig/src/Environment.php | 1638 ---------------- .../Twig1x/twig/twig/src/ExpressionParser.php | 834 -------- .../twig/twig/src/Extension/CoreExtension.php | 1728 ----------------- .../twig/src/Extension/DebugExtension.php | 76 - .../Twig/Twig1x/twig/twig/src/Lexer.php | 534 ----- .../twig/twig/src/Loader/FilesystemLoader.php | 323 --- .../Expression/NullCoalesceExpression.php | 62 - .../Twig1x/twig/twig/src/Node/MacroNode.php | 136 -- .../Twig1x/twig/twig/src/Node/SetNode.php | 107 - .../twig/twig/src/Node/SpacelessNode.php | 47 - .../src/NodeVisitor/SandboxNodeVisitor.php | 137 -- .../Twig/Twig1x/twig/twig/src/Parser.php | 439 ----- .../twig/twig/src/Sandbox/SecurityPolicy.php | 129 -- .../Twig/Twig1x/twig/twig/src/Template.php | 733 ------- .../Twig1x/twig/twig/src/TemplateWrapper.php | 161 -- .../src/TokenParser/ExtendsTokenParser.php | 54 - .../twig/src/TokenParser/FromTokenParser.php | 72 - .../src/TokenParser/ImportTokenParser.php | 45 - .../Twig/Twig1x/twig/twig/src/TokenStream.php | 201 -- .../Twig/Twig1x/vendor/autoload.php | 7 + .../Twig1x/vendor/composer/ClassLoader.php | 572 ++++++ .../vendor/composer/InstalledVersions.php | 350 ++++ .../Twig/Twig1x/{ => vendor}/composer/LICENSE | 0 .../vendor/composer/autoload_classmap.php | 10 + .../{ => vendor}/composer/autoload_files.php | 0 .../composer/autoload_namespaces.php | 0 .../{ => vendor}/composer/autoload_psr4.php | 0 .../Twig1x/vendor/composer/autoload_real.php | 78 + .../vendor/composer/autoload_static.php | 59 + .../Twig1x/vendor/composer/installed.json | 161 ++ .../Twig/Twig1x/vendor/composer/installed.php | 41 + .../symfony/polyfill-ctype/Ctype.php | 0 .../symfony/polyfill-ctype/LICENSE | 0 .../symfony/polyfill-ctype/README.md | 0 .../symfony/polyfill-ctype/bootstrap.php | 46 + .../symfony/polyfill-ctype/composer.json | 38 + .../{ => vendor}/twig/twig/.editorconfig | 0 .../Twig/Twig1x/vendor/twig/twig/.gitignore | 5 + .../Twig/Twig1x/vendor/twig/twig/.php_cs.dist | 18 + .../Twig/Twig1x/vendor/twig/twig/.travis.yml | 44 + .../Twig/Twig1x/vendor/twig/twig/CHANGELOG | 1105 +++++++++++ .../Twig/Twig1x/vendor/twig/twig/LICENSE | 31 + .../Twig/Twig1x/vendor/twig/twig/README.rst | 15 + .../Twig1x/vendor/twig/twig/composer.json | 48 + .../Twig1x/vendor/twig/twig/doc/advanced.rst | 1005 ++++++++++ .../vendor/twig/twig/doc/advanced_legacy.rst | 883 +++++++++ .../Twig/Twig1x/vendor/twig/twig/doc/api.rst | 596 ++++++ .../vendor/twig/twig/doc/coding_standards.rst | 101 + .../vendor/twig/twig/doc/deprecated.rst | 224 +++ .../vendor/twig/twig/doc/filters/abs.rst | 18 + .../vendor/twig/twig/doc/filters/batch.rst | 51 + .../twig/twig/doc/filters/capitalize.rst | 11 + .../twig/doc/filters/convert_encoding.rst | 28 + .../vendor/twig/twig/doc/filters/date.rst | 100 + .../twig/twig/doc/filters/date_modify.rst | 23 + .../vendor/twig/twig/doc/filters/default.rst | 33 + .../vendor/twig/twig/doc/filters/escape.rst | 129 ++ .../vendor/twig/twig/doc/filters/filter.rst | 47 + .../vendor/twig/twig/doc/filters/first.rst | 25 + .../vendor/twig/twig/doc/filters/format.rst | 16 + .../vendor/twig/twig/doc/filters/index.rst | 41 + .../vendor/twig/twig/doc/filters/join.rst | 35 + .../twig/twig/doc/filters/json_encode.rst | 23 + .../vendor/twig/twig/doc/filters/keys.rst | 11 + .../vendor/twig/twig/doc/filters/last.rst | 25 + .../vendor/twig/twig/doc/filters/length.rst | 23 + .../vendor/twig/twig/doc/filters/lower.rst | 10 + .../vendor/twig/twig/doc/filters/map.rst | 38 + .../vendor/twig/twig/doc/filters/merge.rst | 48 + .../vendor/twig/twig/doc/filters/nl2br.rst | 22 + .../twig/twig/doc/filters/number_format.rst | 56 + .../vendor/twig/twig/doc/filters/raw.rst | 38 + .../vendor/twig/twig/doc/filters/reduce.rst | 33 + .../vendor/twig/twig/doc/filters/replace.rst | 25 + .../vendor/twig/twig/doc/filters/reverse.rst | 47 + .../vendor/twig/twig/doc/filters/round.rst | 37 + .../vendor/twig/twig/doc/filters/slice.rst | 71 + .../vendor/twig/twig/doc/filters/sort.rst | 18 + .../twig/twig/doc/filters/spaceless.rst | 65 + .../vendor/twig/twig/doc/filters/split.rst | 53 + .../twig/twig/doc/filters/striptags.rst | 29 + .../vendor/twig/twig/doc/filters/title.rst | 11 + .../vendor/twig/twig/doc/filters/trim.rst | 45 + .../vendor/twig/twig/doc/filters/upper.rst | 10 + .../twig/twig/doc/filters/url_encode.rst | 34 + .../twig/twig/doc/functions/attribute.rst | 26 + .../vendor/twig/twig/doc/functions/block.rst | 41 + .../twig/twig/doc/functions/constant.rst | 29 + .../vendor/twig/twig/doc/functions/cycle.rst | 28 + .../vendor/twig/twig/doc/functions/date.rst | 55 + .../vendor/twig/twig/doc/functions/dump.rst | 69 + .../twig/twig/doc/functions/include.rst | 84 + .../vendor/twig/twig/doc/functions/index.rst | 20 + .../vendor/twig/twig/doc/functions/max.rst | 20 + .../vendor/twig/twig/doc/functions/min.rst | 20 + .../vendor/twig/twig/doc/functions/parent.rst | 20 + .../vendor/twig/twig/doc/functions/random.rst | 36 + .../vendor/twig/twig/doc/functions/range.rst | 58 + .../vendor/twig/twig/doc/functions/source.rst | 32 + .../doc/functions/template_from_string.rst | 43 + .../Twig1x/vendor/twig/twig/doc/index.rst | 19 + .../vendor/twig/twig/doc/installation.rst | 73 + .../Twig1x/vendor/twig/twig/doc/internals.rst | 144 ++ .../Twig1x/vendor/twig/twig/doc/intro.rst | 76 + .../Twig1x/vendor/twig/twig/doc/recipes.rst | 568 ++++++ .../vendor/twig/twig/doc/tags/apply.rst | 23 + .../vendor/twig/twig/doc/tags/autoescape.rst | 81 + .../vendor/twig/twig/doc/tags/block.rst | 11 + .../vendor/twig/twig/doc/tags/deprecated.rst | 30 + .../Twig1x/vendor/twig/twig/doc/tags/do.rst | 12 + .../vendor/twig/twig/doc/tags/embed.rst | 178 ++ .../vendor/twig/twig/doc/tags/extends.rst | 272 +++ .../vendor/twig/twig/doc/tags/filter.rst | 26 + .../vendor/twig/twig/doc/tags/flush.rst | 17 + .../Twig1x/vendor/twig/twig/doc/tags/for.rst | 172 ++ .../Twig1x/vendor/twig/twig/doc/tags/from.rst | 8 + .../Twig1x/vendor/twig/twig/doc/tags/if.rst | 79 + .../vendor/twig/twig/doc/tags/import.rst | 65 + .../vendor/twig/twig/doc/tags/include.rst | 114 ++ .../vendor/twig/twig/doc/tags/index.rst | 27 + .../vendor/twig/twig/doc/tags/macro.rst | 119 ++ .../vendor/twig/twig/doc/tags/sandbox.rst | 30 + .../Twig1x/vendor/twig/twig/doc/tags/set.rst | 78 + .../vendor/twig/twig/doc/tags/spaceless.rst | 41 + .../Twig1x/vendor/twig/twig/doc/tags/use.rst | 124 ++ .../vendor/twig/twig/doc/tags/verbatim.rst | 24 + .../Twig1x/vendor/twig/twig/doc/tags/with.rst | 44 + .../Twig1x/vendor/twig/twig/doc/templates.rst | 931 +++++++++ .../vendor/twig/twig/doc/tests/constant.rst | 22 + .../vendor/twig/twig/doc/tests/defined.rst | 30 + .../twig/twig/doc/tests/divisibleby.rst | 14 + .../vendor/twig/twig/doc/tests/empty.rst | 22 + .../vendor/twig/twig/doc/tests/even.rst | 10 + .../vendor/twig/twig/doc/tests/index.rst | 15 + .../vendor/twig/twig/doc/tests/iterable.rst | 19 + .../vendor/twig/twig/doc/tests/null.rst | 12 + .../Twig1x/vendor/twig/twig/doc/tests/odd.rst | 10 + .../vendor/twig/twig/doc/tests/sameas.rst | 14 + .../Twig1x/vendor/twig/twig/drupal_test.sh | 51 + .../vendor/twig/twig/ext/twig/.gitignore | 30 + .../vendor/twig/twig/ext/twig/config.m4 | 8 + .../vendor/twig/twig/ext/twig/config.w32 | 8 + .../vendor/twig/twig/ext/twig/php_twig.h | 35 + .../Twig1x/vendor/twig/twig/ext/twig/twig.c | 1217 ++++++++++++ .../twig/twig/lib/Twig/Autoloader.php | 0 .../twig/twig/lib/Twig/BaseNodeVisitor.php | 0 .../twig/twig/lib/Twig/Cache/Filesystem.php | 0 .../twig/twig/lib/Twig/Cache/Null.php | 0 .../twig/twig/lib/Twig/CacheInterface.php | 0 .../twig/twig/lib/Twig/Compiler.php | 0 .../twig/twig/lib/Twig/CompilerInterface.php | 0 .../twig/lib/Twig/ContainerRuntimeLoader.php | 0 .../twig/twig/lib/Twig/Environment.php | 0 .../{ => vendor}/twig/twig/lib/Twig/Error.php | 0 .../twig/twig/lib/Twig/Error/Loader.php | 0 .../twig/twig/lib/Twig/Error/Runtime.php | 0 .../twig/twig/lib/Twig/Error/Syntax.php | 0 .../twig/lib/Twig/ExistsLoaderInterface.php | 0 .../twig/twig/lib/Twig/ExpressionParser.php | 0 .../twig/twig/lib/Twig/Extension.php | 0 .../twig/twig/lib/Twig/Extension/Core.php | 0 .../twig/twig/lib/Twig/Extension/Debug.php | 0 .../twig/twig/lib/Twig/Extension/Escaper.php | 0 .../lib/Twig/Extension/GlobalsInterface.php | 0 .../Twig/Extension/InitRuntimeInterface.php | 0 .../twig/lib/Twig/Extension/Optimizer.php | 0 .../twig/twig/lib/Twig/Extension/Profiler.php | 0 .../twig/twig/lib/Twig/Extension/Sandbox.php | 0 .../twig/twig/lib/Twig/Extension/Staging.php | 0 .../twig/lib/Twig/Extension/StringLoader.php | 0 .../twig/twig/lib/Twig/ExtensionInterface.php | 0 .../twig/lib/Twig/FactoryRuntimeLoader.php | 0 .../Twig/FileExtensionEscapingStrategy.php | 0 .../twig/twig/lib/Twig/Filter.php | 0 .../twig/twig/lib/Twig/Filter/Function.php | 0 .../twig/twig/lib/Twig/Filter/Method.php | 0 .../twig/twig/lib/Twig/Filter/Node.php | 0 .../twig/lib/Twig/FilterCallableInterface.php | 0 .../twig/twig/lib/Twig/FilterInterface.php | 0 .../twig/twig/lib/Twig/Function.php | 0 .../twig/twig/lib/Twig/Function/Function.php | 0 .../twig/twig/lib/Twig/Function/Method.php | 0 .../twig/twig/lib/Twig/Function/Node.php | 0 .../lib/Twig/FunctionCallableInterface.php | 0 .../twig/twig/lib/Twig/FunctionInterface.php | 0 .../{ => vendor}/twig/twig/lib/Twig/Lexer.php | 0 .../twig/twig/lib/Twig/LexerInterface.php | 0 .../twig/twig/lib/Twig/Loader/Array.php | 0 .../twig/twig/lib/Twig/Loader/Chain.php | 0 .../twig/twig/lib/Twig/Loader/Filesystem.php | 0 .../twig/twig/lib/Twig/Loader/String.php | 0 .../twig/twig/lib/Twig/LoaderInterface.php | 0 .../twig/twig/lib/Twig/Markup.php | 0 .../{ => vendor}/twig/twig/lib/Twig/Node.php | 0 .../twig/twig/lib/Twig/Node/AutoEscape.php | 0 .../twig/twig/lib/Twig/Node/Block.php | 0 .../twig/lib/Twig/Node/BlockReference.php | 0 .../twig/twig/lib/Twig/Node/Body.php | 0 .../twig/twig/lib/Twig/Node/CheckSecurity.php | 0 .../twig/twig/lib/Twig/Node/Deprecated.php | 0 .../twig/twig/lib/Twig/Node/Do.php | 0 .../twig/twig/lib/Twig/Node/Embed.php | 0 .../twig/twig/lib/Twig/Node/Expression.php | 0 .../twig/lib/Twig/Node/Expression/Array.php | 0 .../lib/Twig/Node/Expression/AssignName.php | 0 .../twig/lib/Twig/Node/Expression/Binary.php | 0 .../lib/Twig/Node/Expression/Binary/Add.php | 0 .../lib/Twig/Node/Expression/Binary/And.php | 0 .../Node/Expression/Binary/BitwiseAnd.php | 0 .../Twig/Node/Expression/Binary/BitwiseOr.php | 0 .../Node/Expression/Binary/BitwiseXor.php | 0 .../Twig/Node/Expression/Binary/Concat.php | 0 .../lib/Twig/Node/Expression/Binary/Div.php | 0 .../Twig/Node/Expression/Binary/EndsWith.php | 0 .../lib/Twig/Node/Expression/Binary/Equal.php | 0 .../Twig/Node/Expression/Binary/FloorDiv.php | 0 .../Twig/Node/Expression/Binary/Greater.php | 0 .../Node/Expression/Binary/GreaterEqual.php | 0 .../lib/Twig/Node/Expression/Binary/In.php | 0 .../lib/Twig/Node/Expression/Binary/Less.php | 0 .../Twig/Node/Expression/Binary/LessEqual.php | 0 .../Twig/Node/Expression/Binary/Matches.php | 0 .../lib/Twig/Node/Expression/Binary/Mod.php | 0 .../lib/Twig/Node/Expression/Binary/Mul.php | 0 .../Twig/Node/Expression/Binary/NotEqual.php | 0 .../lib/Twig/Node/Expression/Binary/NotIn.php | 0 .../lib/Twig/Node/Expression/Binary/Or.php | 0 .../lib/Twig/Node/Expression/Binary/Power.php | 0 .../lib/Twig/Node/Expression/Binary/Range.php | 0 .../Node/Expression/Binary/StartsWith.php | 0 .../lib/Twig/Node/Expression/Binary/Sub.php | 0 .../Twig/Node/Expression/BlockReference.php | 0 .../twig/lib/Twig/Node/Expression/Call.php | 0 .../lib/Twig/Node/Expression/Conditional.php | 0 .../lib/Twig/Node/Expression/Constant.php | 0 .../Node/Expression/ExtensionReference.php | 0 .../twig/lib/Twig/Node/Expression/Filter.php | 0 .../Twig/Node/Expression/Filter/Default.php | 0 .../lib/Twig/Node/Expression/Function.php | 0 .../twig/lib/Twig/Node/Expression/GetAttr.php | 0 .../lib/Twig/Node/Expression/MethodCall.php | 0 .../twig/lib/Twig/Node/Expression/Name.php | 0 .../lib/Twig/Node/Expression/NullCoalesce.php | 0 .../twig/lib/Twig/Node/Expression/Parent.php | 0 .../lib/Twig/Node/Expression/TempName.php | 0 .../twig/lib/Twig/Node/Expression/Test.php | 0 .../Twig/Node/Expression/Test/Constant.php | 0 .../lib/Twig/Node/Expression/Test/Defined.php | 0 .../Twig/Node/Expression/Test/Divisibleby.php | 0 .../lib/Twig/Node/Expression/Test/Even.php | 0 .../lib/Twig/Node/Expression/Test/Null.php | 0 .../lib/Twig/Node/Expression/Test/Odd.php | 0 .../lib/Twig/Node/Expression/Test/Sameas.php | 0 .../twig/lib/Twig/Node/Expression/Unary.php | 0 .../lib/Twig/Node/Expression/Unary/Neg.php | 0 .../lib/Twig/Node/Expression/Unary/Not.php | 0 .../lib/Twig/Node/Expression/Unary/Pos.php | 0 .../twig/twig/lib/Twig/Node/Flush.php | 0 .../twig/twig/lib/Twig/Node/For.php | 0 .../twig/twig/lib/Twig/Node/ForLoop.php | 0 .../twig/twig/lib/Twig/Node/If.php | 0 .../twig/twig/lib/Twig/Node/Import.php | 0 .../twig/twig/lib/Twig/Node/Include.php | 0 .../twig/twig/lib/Twig/Node/Macro.php | 0 .../twig/twig/lib/Twig/Node/Module.php | 0 .../twig/twig/lib/Twig/Node/Print.php | 0 .../twig/twig/lib/Twig/Node/Sandbox.php | 0 .../twig/lib/Twig/Node/SandboxedPrint.php | 0 .../twig/twig/lib/Twig/Node/Set.php | 0 .../twig/twig/lib/Twig/Node/SetTemp.php | 0 .../twig/twig/lib/Twig/Node/Spaceless.php | 0 .../twig/twig/lib/Twig/Node/Text.php | 0 .../twig/twig/lib/Twig/Node/With.php | 0 .../twig/lib/Twig/NodeCaptureInterface.php | 0 .../twig/twig/lib/Twig/NodeInterface.php | 0 .../twig/lib/Twig/NodeOutputInterface.php | 0 .../twig/twig/lib/Twig/NodeTraverser.php | 0 .../twig/lib/Twig/NodeVisitor/Escaper.php | 0 .../twig/lib/Twig/NodeVisitor/Optimizer.php | 0 .../lib/Twig/NodeVisitor/SafeAnalysis.php | 0 .../twig/lib/Twig/NodeVisitor/Sandbox.php | 0 .../twig/lib/Twig/NodeVisitorInterface.php | 0 .../twig/twig/lib/Twig/Parser.php | 0 .../twig/twig/lib/Twig/ParserInterface.php | 0 .../twig/lib/Twig/Profiler/Dumper/Base.php | 0 .../lib/Twig/Profiler/Dumper/Blackfire.php | 0 .../twig/lib/Twig/Profiler/Dumper/Html.php | 0 .../twig/lib/Twig/Profiler/Dumper/Text.php | 0 .../lib/Twig/Profiler/Node/EnterProfile.php | 0 .../lib/Twig/Profiler/Node/LeaveProfile.php | 0 .../Twig/Profiler/NodeVisitor/Profiler.php | 0 .../twig/twig/lib/Twig/Profiler/Profile.php | 0 .../twig/lib/Twig/RuntimeLoaderInterface.php | 0 .../twig/lib/Twig/Sandbox/SecurityError.php | 0 .../Sandbox/SecurityNotAllowedFilterError.php | 0 .../SecurityNotAllowedFunctionError.php | 0 .../Sandbox/SecurityNotAllowedMethodError.php | 0 .../SecurityNotAllowedPropertyError.php | 0 .../Sandbox/SecurityNotAllowedTagError.php | 0 .../twig/lib/Twig/Sandbox/SecurityPolicy.php | 0 .../Twig/Sandbox/SecurityPolicyInterface.php | 0 .../twig/twig/lib/Twig/SimpleFilter.php | 0 .../twig/twig/lib/Twig/SimpleFunction.php | 0 .../twig/twig/lib/Twig/SimpleTest.php | 0 .../twig/twig/lib/Twig/Source.php | 0 .../lib/Twig/SourceContextLoaderInterface.php | 0 .../twig/twig/lib/Twig/Template.php | 0 .../twig/twig/lib/Twig/TemplateInterface.php | 0 .../twig/twig/lib/Twig/TemplateWrapper.php | 0 .../{ => vendor}/twig/twig/lib/Twig/Test.php | 0 .../twig/twig/lib/Twig/Test/Function.php | 0 .../lib/Twig/Test/IntegrationTestCase.php | 0 .../twig/twig/lib/Twig/Test/Method.php | 0 .../twig/twig/lib/Twig/Test/Node.php | 0 .../twig/twig/lib/Twig/Test/NodeTestCase.php | 0 .../twig/lib/Twig/TestCallableInterface.php | 0 .../twig/twig/lib/Twig/TestInterface.php | 0 .../{ => vendor}/twig/twig/lib/Twig/Token.php | 0 .../twig/twig/lib/Twig/TokenParser.php | 0 .../twig/lib/Twig/TokenParser/AutoEscape.php | 0 .../twig/twig/lib/Twig/TokenParser/Block.php | 0 .../twig/lib/Twig/TokenParser/Deprecated.php | 0 .../twig/twig/lib/Twig/TokenParser/Do.php | 0 .../twig/twig/lib/Twig/TokenParser/Embed.php | 0 .../twig/lib/Twig/TokenParser/Extends.php | 0 .../twig/twig/lib/Twig/TokenParser/Filter.php | 0 .../twig/twig/lib/Twig/TokenParser/Flush.php | 0 .../twig/twig/lib/Twig/TokenParser/For.php | 0 .../twig/twig/lib/Twig/TokenParser/From.php | 0 .../twig/twig/lib/Twig/TokenParser/If.php | 0 .../twig/twig/lib/Twig/TokenParser/Import.php | 0 .../twig/lib/Twig/TokenParser/Include.php | 0 .../twig/twig/lib/Twig/TokenParser/Macro.php | 0 .../twig/lib/Twig/TokenParser/Sandbox.php | 0 .../twig/twig/lib/Twig/TokenParser/Set.php | 0 .../twig/lib/Twig/TokenParser/Spaceless.php | 0 .../twig/twig/lib/Twig/TokenParser/Use.php | 0 .../twig/twig/lib/Twig/TokenParser/With.php | 0 .../twig/twig/lib/Twig/TokenParserBroker.php | 0 .../lib/Twig/TokenParserBrokerInterface.php | 0 .../twig/lib/Twig/TokenParserInterface.php | 0 .../twig/twig/lib/Twig/TokenStream.php | 0 .../lib/Twig/Util/DeprecationCollector.php | 0 .../lib/Twig/Util/TemplateDirIterator.php | 0 .../Twig1x/vendor/twig/twig/phpunit.xml.dist | 33 + .../twig/twig/src/Cache/CacheInterface.php | 0 .../twig/twig/src/Cache/FilesystemCache.php | 93 + .../twig/twig/src/Cache/NullCache.php | 0 .../{ => vendor}/twig/twig/src/Compiler.php | 0 .../vendor/twig/twig/src/Environment.php | 1638 ++++++++++++++++ .../twig/twig/src/Error/Error.php | 0 .../twig/twig/src/Error/LoaderError.php | 0 .../twig/twig/src/Error/RuntimeError.php | 0 .../twig/twig/src/Error/SyntaxError.php | 0 .../vendor/twig/twig/src/ExpressionParser.php | 828 ++++++++ .../twig/src/Extension/AbstractExtension.php | 0 .../twig/twig/src/Extension/CoreExtension.php | 1724 ++++++++++++++++ .../twig/src/Extension/DebugExtension.php | 76 + .../twig/src/Extension/EscaperExtension.php | 0 .../twig/src/Extension/ExtensionInterface.php | 0 .../twig/src/Extension/GlobalsInterface.php | 0 .../src/Extension/InitRuntimeInterface.php | 0 .../twig/src/Extension/OptimizerExtension.php | 0 .../twig/src/Extension/ProfilerExtension.php | 0 .../Extension/RuntimeExtensionInterface.php | 0 .../twig/src/Extension/SandboxExtension.php | 0 .../twig/src/Extension/StagingExtension.php | 0 .../src/Extension/StringLoaderExtension.php | 0 .../src/FileExtensionEscapingStrategy.php | 0 .../Twig1x/vendor/twig/twig/src/Lexer.php | 534 +++++ .../twig/twig/src/Loader/ArrayLoader.php | 0 .../twig/twig/src/Loader/ChainLoader.php | 0 .../twig/src/Loader/ExistsLoaderInterface.php | 0 .../twig/twig/src/Loader/FilesystemLoader.php | 324 ++++ .../twig/twig/src/Loader/LoaderInterface.php | 0 .../Loader/SourceContextLoaderInterface.php | 0 .../{ => vendor}/twig/twig/src/Markup.php | 0 .../twig/twig/src/Node/AutoEscapeNode.php | 0 .../twig/twig/src/Node/BlockNode.php | 0 .../twig/twig/src/Node/BlockReferenceNode.php | 0 .../twig/twig/src/Node/BodyNode.php | 0 .../twig/twig/src/Node/CheckSecurityNode.php | 0 .../twig/twig/src/Node/CheckToStringNode.php | 0 .../twig/twig/src/Node/DeprecatedNode.php | 0 .../twig/twig/src/Node/DoNode.php | 0 .../twig/twig/src/Node/EmbedNode.php | 0 .../Node/Expression/AbstractExpression.php | 0 .../src/Node/Expression/ArrayExpression.php | 0 .../Expression/ArrowFunctionExpression.php | 0 .../Node/Expression/AssignNameExpression.php | 0 .../Node/Expression/Binary/AbstractBinary.php | 0 .../src/Node/Expression/Binary/AddBinary.php | 0 .../src/Node/Expression/Binary/AndBinary.php | 0 .../Expression/Binary/BitwiseAndBinary.php | 0 .../Expression/Binary/BitwiseOrBinary.php | 0 .../Expression/Binary/BitwiseXorBinary.php | 0 .../Node/Expression/Binary/ConcatBinary.php | 0 .../src/Node/Expression/Binary/DivBinary.php | 0 .../Node/Expression/Binary/EndsWithBinary.php | 0 .../Node/Expression/Binary/EqualBinary.php | 0 .../Node/Expression/Binary/FloorDivBinary.php | 0 .../Node/Expression/Binary/GreaterBinary.php | 0 .../Expression/Binary/GreaterEqualBinary.php | 0 .../src/Node/Expression/Binary/InBinary.php | 0 .../src/Node/Expression/Binary/LessBinary.php | 0 .../Expression/Binary/LessEqualBinary.php | 0 .../Node/Expression/Binary/MatchesBinary.php | 0 .../src/Node/Expression/Binary/ModBinary.php | 0 .../src/Node/Expression/Binary/MulBinary.php | 0 .../Node/Expression/Binary/NotEqualBinary.php | 0 .../Node/Expression/Binary/NotInBinary.php | 0 .../src/Node/Expression/Binary/OrBinary.php | 0 .../Node/Expression/Binary/PowerBinary.php | 0 .../Node/Expression/Binary/RangeBinary.php | 0 .../Expression/Binary/StartsWithBinary.php | 0 .../src/Node/Expression/Binary/SubBinary.php | 0 .../Expression/BlockReferenceExpression.php | 0 .../src/Node/Expression/CallExpression.php | 0 .../Node/Expression/ConditionalExpression.php | 0 .../Node/Expression/ConstantExpression.php | 0 .../Node/Expression/Filter/DefaultFilter.php | 0 .../src/Node/Expression/FilterExpression.php | 0 .../Node/Expression/FunctionExpression.php | 0 .../src/Node/Expression/GetAttrExpression.php | 0 .../twig/src/Node/Expression/InlinePrint.php | 0 .../Node/Expression/MethodCallExpression.php | 0 .../src/Node/Expression/NameExpression.php | 0 .../Expression/NullCoalesceExpression.php | 58 + .../src/Node/Expression/ParentExpression.php | 0 .../Node/Expression/TempNameExpression.php | 0 .../src/Node/Expression/Test/ConstantTest.php | 0 .../src/Node/Expression/Test/DefinedTest.php | 0 .../Node/Expression/Test/DivisiblebyTest.php | 0 .../src/Node/Expression/Test/EvenTest.php | 0 .../src/Node/Expression/Test/NullTest.php | 0 .../twig/src/Node/Expression/Test/OddTest.php | 0 .../src/Node/Expression/Test/SameasTest.php | 0 .../src/Node/Expression/TestExpression.php | 0 .../Node/Expression/Unary/AbstractUnary.php | 0 .../src/Node/Expression/Unary/NegUnary.php | 0 .../src/Node/Expression/Unary/NotUnary.php | 0 .../src/Node/Expression/Unary/PosUnary.php | 0 .../twig/twig/src/Node/FlushNode.php | 0 .../twig/twig/src/Node/ForLoopNode.php | 0 .../twig/twig/src/Node/ForNode.php | 0 .../twig/twig/src/Node/IfNode.php | 0 .../twig/twig/src/Node/ImportNode.php | 0 .../twig/twig/src/Node/IncludeNode.php | 0 .../vendor/twig/twig/src/Node/MacroNode.php | 130 ++ .../twig/twig/src/Node/ModuleNode.php | 0 .../{ => vendor}/twig/twig/src/Node/Node.php | 0 .../twig/src/Node/NodeCaptureInterface.php | 0 .../twig/src/Node/NodeOutputInterface.php | 0 .../twig/twig/src/Node/PrintNode.php | 0 .../twig/twig/src/Node/SandboxNode.php | 0 .../twig/twig/src/Node/SandboxedPrintNode.php | 0 .../vendor/twig/twig/src/Node/SetNode.php | 103 + .../twig/twig/src/Node/SetTempNode.php | 0 .../twig/twig/src/Node/SpacelessNode.php | 41 + .../twig/twig/src/Node/TextNode.php | 0 .../twig/twig/src/Node/WithNode.php | 0 .../twig/twig/src/NodeTraverser.php | 0 .../src/NodeVisitor/AbstractNodeVisitor.php | 0 .../src/NodeVisitor/EscaperNodeVisitor.php | 0 .../src/NodeVisitor/NodeVisitorInterface.php | 0 .../src/NodeVisitor/OptimizerNodeVisitor.php | 0 .../NodeVisitor/SafeAnalysisNodeVisitor.php | 0 .../src/NodeVisitor/SandboxNodeVisitor.php | 137 ++ .../Twig1x/vendor/twig/twig/src/Parser.php | 431 ++++ .../twig/src/Profiler/Dumper/BaseDumper.php | 0 .../src/Profiler/Dumper/BlackfireDumper.php | 0 .../twig/src/Profiler/Dumper/HtmlDumper.php | 0 .../twig/src/Profiler/Dumper/TextDumper.php | 0 .../src/Profiler/Node/EnterProfileNode.php | 0 .../src/Profiler/Node/LeaveProfileNode.php | 0 .../NodeVisitor/ProfilerNodeVisitor.php | 0 .../twig/twig/src/Profiler/Profile.php | 0 .../RuntimeLoader/ContainerRuntimeLoader.php | 0 .../RuntimeLoader/FactoryRuntimeLoader.php | 0 .../RuntimeLoader/RuntimeLoaderInterface.php | 0 .../twig/twig/src/Sandbox/SecurityError.php | 0 .../Sandbox/SecurityNotAllowedFilterError.php | 0 .../SecurityNotAllowedFunctionError.php | 0 .../Sandbox/SecurityNotAllowedMethodError.php | 0 .../SecurityNotAllowedPropertyError.php | 0 .../Sandbox/SecurityNotAllowedTagError.php | 0 .../twig/twig/src/Sandbox/SecurityPolicy.php | 129 ++ .../src/Sandbox/SecurityPolicyInterface.php | 0 .../{ => vendor}/twig/twig/src/Source.php | 0 .../Twig1x/vendor/twig/twig/src/Template.php | 721 +++++++ .../vendor/twig/twig/src/TemplateWrapper.php | 157 ++ .../twig/src/Test/IntegrationTestCase.php | 0 .../twig/twig/src/Test/NodeTestCase.php | 0 .../{ => vendor}/twig/twig/src/Token.php | 0 .../src/TokenParser/AbstractTokenParser.php | 0 .../twig/src/TokenParser/ApplyTokenParser.php | 0 .../src/TokenParser/AutoEscapeTokenParser.php | 0 .../twig/src/TokenParser/BlockTokenParser.php | 0 .../src/TokenParser/DeprecatedTokenParser.php | 0 .../twig/src/TokenParser/DoTokenParser.php | 0 .../twig/src/TokenParser/EmbedTokenParser.php | 0 .../src/TokenParser/ExtendsTokenParser.php | 52 + .../src/TokenParser/FilterTokenParser.php | 0 .../twig/src/TokenParser/FlushTokenParser.php | 0 .../twig/src/TokenParser/ForTokenParser.php | 0 .../twig/src/TokenParser/FromTokenParser.php | 71 + .../twig/src/TokenParser/IfTokenParser.php | 0 .../src/TokenParser/ImportTokenParser.php | 45 + .../src/TokenParser/IncludeTokenParser.php | 0 .../twig/src/TokenParser/MacroTokenParser.php | 0 .../src/TokenParser/SandboxTokenParser.php | 0 .../twig/src/TokenParser/SetTokenParser.php | 0 .../src/TokenParser/SpacelessTokenParser.php | 0 .../src/TokenParser/TokenParserInterface.php | 0 .../twig/src/TokenParser/UseTokenParser.php | 0 .../twig/src/TokenParser/WithTokenParser.php | 0 .../vendor/twig/twig/src/TokenStream.php | 200 ++ .../{ => vendor}/twig/twig/src/TwigFilter.php | 0 .../twig/twig/src/TwigFunction.php | 0 .../{ => vendor}/twig/twig/src/TwigTest.php | 0 .../twig/src/Util/DeprecationCollector.php | 0 .../twig/src/Util/TemplateDirIterator.php | 0 .../twig/test/Twig/Tests/AutoloaderTest.php | 24 + .../test/Twig/Tests/Cache/FilesystemTest.php | 195 ++ .../twig/test/Twig/Tests/CompilerTest.php | 36 + .../Twig/Tests/ContainerRuntimeLoaderTest.php | 42 + .../test/Twig/Tests/CustomExtensionTest.php | 96 + .../twig/test/Twig/Tests/EnvironmentTest.php | 677 +++++++ .../twig/twig/test/Twig/Tests/ErrorTest.php | 218 +++ .../test/Twig/Tests/ExpressionParserTest.php | 387 ++++ .../test/Twig/Tests/Extension/CoreTest.php | 371 ++++ .../test/Twig/Tests/Extension/SandboxTest.php | 364 ++++ .../Twig/Tests/FactoryRuntimeLoaderTest.php | 34 + .../twig/test/Twig/Tests/FileCachingTest.php | 66 + .../FileExtensionEscapingStrategyTest.php | 53 + .../twig/test/Twig/Tests/FilesystemHelper.php | 30 + .../Twig/Tests/Fixtures/autoescape/block.test | 21 + .../Twig/Tests/Fixtures/autoescape/name.test | 22 + .../test/Twig/Tests/Fixtures/errors/base.html | 1 + .../Twig/Tests/Fixtures/errors/index.html | 7 + .../child_contents_outside_blocks.test | 15 + .../exception_in_extension_extends.test | 12 + .../exception_in_extension_include.test | 12 + ...ltiline_array_with_undefined_variable.test | 18 + ...e_array_with_undefined_variable_again.test | 18 + ...line_function_with_undefined_variable.test | 12 + ...tiline_function_with_unknown_argument.test | 9 + ...multiline_tag_with_undefined_variable.test | 12 + .../strict_comparison_operator.test | 6 + .../syntax_error_in_reused_template.test | 10 + .../Fixtures/exceptions/unclosed_tag.test | 20 + .../Fixtures/exceptions/undefined_parent.test | 10 + .../undefined_template_in_child_template.test | 15 + .../Fixtures/exceptions/undefined_trait.test | 9 + .../Tests/Fixtures/expressions/_self.test | 8 + .../Tests/Fixtures/expressions/array.test | 61 + .../Fixtures/expressions/array_call.test | 14 + .../Tests/Fixtures/expressions/binary.test | 46 + .../Tests/Fixtures/expressions/bitwise.test | 14 + .../call_argument_defined_twice.test | 8 + .../call_positional_arg_after_named_arg.test | 8 + .../Fixtures/expressions/comparison.test | 14 + .../Fixtures/expressions/divisibleby.test | 17 + .../Tests/Fixtures/expressions/dotdot.test | 20 + .../Tests/Fixtures/expressions/ends_with.test | 26 + .../Tests/Fixtures/expressions/floats.test | 16 + .../Tests/Fixtures/expressions/grouping.test | 8 + .../Tests/Fixtures/expressions/literals.test | 22 + .../Fixtures/expressions/magic_call.test | 27 + .../Tests/Fixtures/expressions/matches.test | 12 + .../Fixtures/expressions/method_call.test | 28 + .../expressions/negative_numbers.test | 18 + .../Fixtures/expressions/not_arrow_fn.test | 8 + .../expressions/operators_as_variables.test | 16 + .../Tests/Fixtures/expressions/postfix.test | 22 + .../Tests/Fixtures/expressions/power.test | 20 + .../Tests/Fixtures/expressions/sameas.test | 21 + .../Fixtures/expressions/starts_with.test | 27 + .../Tests/Fixtures/expressions/strings.test | 10 + .../expressions/ternary_operator.test | 18 + .../expressions/ternary_operator_noelse.test | 10 + .../expressions/ternary_operator_nothen.test | 10 + .../two_word_operators_as_variables.test | 8 + .../Tests/Fixtures/expressions/unary.test | 12 + .../expressions/unary_macro_arguments.test | 22 + .../expressions/unary_precedence.test | 14 + .../test/Twig/Tests/Fixtures/filters/abs.test | 30 + .../Twig/Tests/Fixtures/filters/batch.test | 31 + .../Tests/Fixtures/filters/batch_float.test | 29 + .../filters/batch_with_empty_fill.test | 37 + .../filters/batch_with_exact_elements.test | 33 + .../Fixtures/filters/batch_with_fill.test | 37 + .../Fixtures/filters/batch_with_keys.test | 10 + .../filters/batch_with_more_elements.test | 23 + .../filters/batch_with_zero_elements.test | 10 + .../Fixtures/filters/convert_encoding.test | 10 + .../Twig/Tests/Fixtures/filters/date.test | 90 + .../Fixtures/filters/date_default_format.test | 14 + .../filters/date_default_format_interval.test | 16 + .../Fixtures/filters/date_immutable.test | 37 + .../Tests/Fixtures/filters/date_interval.test | 19 + .../Tests/Fixtures/filters/date_modify.test | 14 + .../Fixtures/filters/date_namedargs.test | 13 + .../Twig/Tests/Fixtures/filters/default.test | 150 ++ .../Fixtures/filters/dynamic_filter.test | 10 + .../Twig/Tests/Fixtures/filters/escape.test | 8 + .../Fixtures/filters/escape_html_attr.test | 8 + .../Fixtures/filters/escape_javascript.test | 8 + .../filters/escape_non_supported_charset.test | 8 + .../Twig/Tests/Fixtures/filters/filter.test | 46 + .../Tests/Fixtures/filters/filter_php_56.test | 20 + .../Twig/Tests/Fixtures/filters/first.test | 17 + .../Tests/Fixtures/filters/force_escape.test | 18 + .../Twig/Tests/Fixtures/filters/format.test | 8 + .../Twig/Tests/Fixtures/filters/join.test | 38 + .../Tests/Fixtures/filters/json_encode.test | 12 + .../Twig/Tests/Fixtures/filters/last.test | 17 + .../Twig/Tests/Fixtures/filters/length.test | 40 + .../Tests/Fixtures/filters/length_utf8.test | 12 + .../test/Twig/Tests/Fixtures/filters/map.test | 41 + .../Twig/Tests/Fixtures/filters/merge.test | 25 + .../Twig/Tests/Fixtures/filters/nl2br.test | 14 + .../Tests/Fixtures/filters/number_format.test | 18 + .../filters/number_format_default.test | 21 + .../Twig/Tests/Fixtures/filters/reduce.test | 14 + .../Twig/Tests/Fixtures/filters/replace.test | 12 + .../Fixtures/filters/replace_invalid_arg.test | 8 + .../Twig/Tests/Fixtures/filters/reverse.test | 18 + .../Twig/Tests/Fixtures/filters/round.test | 22 + .../Twig/Tests/Fixtures/filters/slice.test | 54 + .../Twig/Tests/Fixtures/filters/sort.test | 12 + .../Tests/Fixtures/filters/spaceless.test | 8 + .../Tests/Fixtures/filters/special_chars.test | 8 + .../Twig/Tests/Fixtures/filters/split.test | 20 + .../Tests/Fixtures/filters/split_utf8.test | 24 + .../Tests/Fixtures/filters/static_calls.test | 10 + .../Twig/Tests/Fixtures/filters/trim.test | 24 + .../Tests/Fixtures/filters/urlencode.test | 16 + .../filters/urlencode_deprecated.test | 16 + .../Tests/Fixtures/functions/attribute.test | 18 + .../Twig/Tests/Fixtures/functions/block.test | 12 + .../functions/block_with_template.test | 22 + .../functions/block_without_name.test | 12 + .../Tests/Fixtures/functions/constant.test | 10 + .../Twig/Tests/Fixtures/functions/cycle.test | 16 + .../Twig/Tests/Fixtures/functions/date.test | 27 + .../Fixtures/functions/date_namedargs.test | 11 + .../Twig/Tests/Fixtures/functions/dump.test | 16 + .../Tests/Fixtures/functions/dump_array.test | 19 + .../Fixtures/functions/dynamic_function.test | 10 + .../functions/include/assignment.test | 13 + .../functions/include/autoescaping.test | 10 + .../Fixtures/functions/include/basic.test | 17 + .../functions/include/expression.test | 17 + .../functions/include/ignore_missing.test | 10 + .../include/ignore_missing_exists.test | 11 + .../include/include_missing_extends.test | 13 + .../Fixtures/functions/include/missing.test | 8 + .../functions/include/missing_nested.test | 16 + .../Fixtures/functions/include/sandbox.test | 13 + .../functions/include/sandbox_disabling.test | 16 + .../sandbox_disabling_ignore_missing.test | 13 + .../functions/include/template_instance.test | 10 + .../functions/include/templates_as_array.test | 12 + .../functions/include/with_context.test | 16 + .../functions/include/with_variables.test | 12 + .../include_template_from_string.test | 11 + .../Tests/Fixtures/functions/magic_call.test | 8 + .../Fixtures/functions/magic_call53.test | 12 + .../Twig/Tests/Fixtures/functions/max.test | 12 + .../Twig/Tests/Fixtures/functions/min.test | 12 + .../Twig/Tests/Fixtures/functions/range.test | 8 + .../recursive_block_with_inheritance.test | 21 + .../Twig/Tests/Fixtures/functions/source.test | 17 + .../Fixtures/functions/special_chars.test | 8 + .../Fixtures/functions/static_calls.test | 10 + .../functions/template_from_string.test | 15 + .../functions/template_from_string_error.test | 8 + .../Tests/Fixtures/macros/default_values.test | 16 + .../Tests/Fixtures/macros/nested_calls.test | 18 + .../Fixtures/macros/reserved_variables.test | 14 + .../Twig/Tests/Fixtures/macros/simple.test | 22 + .../Twig/Tests/Fixtures/macros/varargs.test | 21 + .../Fixtures/macros/varargs_argument.test | 7 + .../Tests/Fixtures/macros/with_filters.test | 14 + .../regression/block_names_unicity.test | 19 + .../regression/combined_debug_info.test | 15 + .../Fixtures/regression/empty_token.test | 8 + .../Tests/Fixtures/regression/issue_1143.test | 23 + .../Fixtures/regression/multi_word_tests.test | 10 + .../regression/simple_xml_element.test | 19 + .../regression/strings_like_numbers.test | 8 + .../Twig/Tests/Fixtures/tags/apply/basic.test | 10 + .../Fixtures/tags/apply/json_encode.test | 8 + .../Tests/Fixtures/tags/apply/multiple.test | 10 + .../Tests/Fixtures/tags/apply/nested.test | 16 + .../Twig/Tests/Fixtures/tags/apply/scope.test | 15 + .../Fixtures/tags/apply/with_for_tag.test | 13 + .../Fixtures/tags/apply/with_if_tag.test | 29 + .../Tests/Fixtures/tags/autoescape/basic.test | 26 + .../Fixtures/tags/autoescape/blocks.test | 12 + .../tags/autoescape/double_escaping.test | 10 + .../Fixtures/tags/autoescape/functions.test | 83 + .../Fixtures/tags/autoescape/literal.test | 87 + .../Fixtures/tags/autoescape/nested.test | 26 + .../Fixtures/tags/autoescape/objects.test | 26 + .../Tests/Fixtures/tags/autoescape/raw.test | 10 + .../tags/autoescape/strategy.legacy.test | 11 + .../Fixtures/tags/autoescape/strategy.test | 11 + .../Tests/Fixtures/tags/autoescape/type.test | 69 + .../tags/autoescape/with_filters.test | 131 ++ .../autoescape/with_filters_arguments.test | 23 + .../autoescape/with_pre_escape_filters.test | 68 + .../with_preserves_safety_filters.test | 50 + .../Twig/Tests/Fixtures/tags/block/basic.test | 11 + .../tags/block/block_unique_name.test | 11 + .../Fixtures/tags/block/special_chars.test | 10 + .../tags/deprecated/block.legacy.test | 20 + .../tags/deprecated/macro.legacy.test | 21 + .../tags/deprecated/template.legacy.test | 12 + .../Twig/Tests/Fixtures/tags/embed/basic.test | 35 + .../tags/embed/complex_dynamic_parent.test | 35 + .../Fixtures/tags/embed/dynamic_parent.test | 35 + .../Tests/Fixtures/tags/embed/error_line.test | 16 + .../Tests/Fixtures/tags/embed/multiple.test | 50 + .../Tests/Fixtures/tags/embed/nested.test | 42 + .../Fixtures/tags/embed/with_extends.test | 60 + .../Tests/Fixtures/tags/filter/basic.test | 10 + .../Fixtures/tags/filter/json_encode.test | 8 + .../Tests/Fixtures/tags/filter/multiple.test | 10 + .../Tests/Fixtures/tags/filter/nested.test | 16 + .../Tests/Fixtures/tags/filter/scope.test | 11 + .../Fixtures/tags/filter/with_for_tag.test | 13 + .../Fixtures/tags/filter/with_if_tag.test | 29 + .../Tests/Fixtures/tags/for/condition.test | 14 + .../Twig/Tests/Fixtures/tags/for/context.test | 18 + .../Twig/Tests/Fixtures/tags/for/else.test | 23 + .../Fixtures/tags/for/inner_variables.test | 17 + .../Twig/Tests/Fixtures/tags/for/keys.test | 11 + .../Fixtures/tags/for/keys_and_values.test | 11 + .../Tests/Fixtures/tags/for/loop_context.test | 19 + .../Fixtures/tags/for/loop_context_local.test | 10 + .../Fixtures/tags/for/loop_not_defined.test | 10 + .../tags/for/loop_not_defined_cond.test | 9 + .../Tests/Fixtures/tags/for/nested_else.test | 17 + .../Twig/Tests/Fixtures/tags/for/objects.test | 43 + .../Fixtures/tags/for/objects_countable.test | 47 + .../Tests/Fixtures/tags/for/recursive.test | 18 + .../Twig/Tests/Fixtures/tags/for/values.test | 11 + .../test/Twig/Tests/Fixtures/tags/from.test | 14 + .../Twig/Tests/Fixtures/tags/if/basic.test | 22 + .../Tests/Fixtures/tags/if/expression.test | 22 + .../Tests/Fixtures/tags/include/basic.test | 16 + .../Fixtures/tags/include/expression.test | 16 + .../Fixtures/tags/include/ignore_missing.test | 10 + .../tags/include/ignore_missing_exists.test | 11 + .../tags/include/include_missing_extends.test | 13 + .../Tests/Fixtures/tags/include/missing.test | 8 + .../Fixtures/tags/include/missing_nested.test | 16 + .../Tests/Fixtures/tags/include/only.test | 20 + .../tags/include/template_instance.test | 10 + .../tags/include/templates_as_array.test | 12 + .../Fixtures/tags/include/with_variables.test | 14 + .../Fixtures/tags/inheritance/basic.test | 14 + .../Fixtures/tags/inheritance/block_expr.test | 30 + .../tags/inheritance/block_expr2.test | 32 + .../tags/inheritance/conditional.test | 14 + .../Fixtures/tags/inheritance/dynamic.test | 14 + .../Fixtures/tags/inheritance/empty.test | 10 + .../tags/inheritance/extends_as_array.test | 12 + .../extends_as_array_with_empty_name.test | 12 + .../extends_as_array_with_null_name.test | 12 + .../Fixtures/tags/inheritance/multiple.test | 12 + .../tags/inheritance/multiple_dynamic.test | 22 + .../tags/inheritance/nested_blocks.test | 22 + .../nested_blocks_parent_only.test | 15 + .../tags/inheritance/nested_inheritance.test | 16 + .../Fixtures/tags/inheritance/parent.test | 12 + .../parent_as_template_wrapper.test | 12 + .../tags/inheritance/parent_change.test | 16 + .../tags/inheritance/parent_in_a_block.test | 8 + .../tags/inheritance/parent_isolation.test | 20 + .../tags/inheritance/parent_nested.test | 28 + .../inheritance/parent_without_extends.test | 8 + .../parent_without_extends_but_traits.test | 14 + .../tags/inheritance/template_instance.test | 14 + .../Tests/Fixtures/tags/inheritance/use.test | 44 + .../Twig/Tests/Fixtures/tags/macro/basic.test | 17 + .../Fixtures/tags/macro/endmacro_name.test | 16 + .../Tests/Fixtures/tags/macro/external.test | 17 + .../Twig/Tests/Fixtures/tags/macro/from.test | 18 + .../tags/macro/from_with_reserved_name.test | 9 + .../Tests/Fixtures/tags/macro/global.test | 14 + .../macro/import_from_string_template.test | 10 + .../tags/macro/import_with_reserved_nam.test | 11 + .../Fixtures/tags/macro/reserved_name.test | 10 + .../Fixtures/tags/macro/self_import.test | 17 + .../Fixtures/tags/macro/special_chars.test | 14 + .../Fixtures/tags/macro/super_globals.test | 14 + .../Tests/Fixtures/tags/raw/basic.legacy.test | 10 + .../tags/raw/mixed_usage_with_raw.legacy.test | 10 + .../tags/raw/whitespace_control.legacy.test | 56 + .../Tests/Fixtures/tags/sandbox/array.test | 16 + .../Fixtures/tags/sandbox/not_valid1.test | 11 + .../Fixtures/tags/sandbox/not_valid2.test | 14 + .../Tests/Fixtures/tags/sandbox/simple.test | 22 + .../Twig/Tests/Fixtures/tags/set/basic.test | 20 + .../Fixtures/tags/set/capture-empty.test | 9 + .../Twig/Tests/Fixtures/tags/set/capture.test | 10 + .../Fixtures/tags/set/capture_scope.test | 10 + .../Tests/Fixtures/tags/set/expression.test | 12 + .../Tests/Fixtures/tags/set/inheritance.test | 24 + .../tags/set/inheritance_overriding.test | 24 + .../Tests/Fixtures/tags/set/mutating.test | 17 + .../Tests/Fixtures/tags/spaceless/simple.test | 12 + .../Tests/Fixtures/tags/special_chars.test | 8 + .../Twig/Tests/Fixtures/tags/use/aliases.test | 12 + .../Twig/Tests/Fixtures/tags/use/basic.test | 12 + .../Twig/Tests/Fixtures/tags/use/deep.test | 22 + .../Tests/Fixtures/tags/use/deep_empty.test | 10 + .../Tests/Fixtures/tags/use/inheritance.test | 25 + .../Tests/Fixtures/tags/use/inheritance2.test | 24 + .../Tests/Fixtures/tags/use/multiple.test | 21 + .../Fixtures/tags/use/multiple_aliases.test | 23 + .../Tests/Fixtures/tags/use/parent_block.test | 24 + .../Fixtures/tags/use/parent_block2.test | 24 + .../Fixtures/tags/use/parent_block3.test | 38 + .../Fixtures/tags/use/use_with_parent.test | 24 + .../Tests/Fixtures/tags/verbatim/basic.test | 10 + .../tags/verbatim/mixed_usage_with_raw.test | 10 + .../tags/verbatim/whitespace_control.test | 56 + .../Twig/Tests/Fixtures/tags/with/basic.test | 13 + .../Tests/Fixtures/tags/with/expression.test | 10 + .../Tests/Fixtures/tags/with/globals.test | 10 + .../Tests/Fixtures/tags/with/iterable.test | 10 + .../Twig/Tests/Fixtures/tags/with/nested.test | 15 + .../Fixtures/tags/with/with_no_hash.test | 10 + .../Tests/Fixtures/tags/with/with_only.test | 10 + .../test/Twig/Tests/Fixtures/tests/array.test | 24 + .../Twig/Tests/Fixtures/tests/constant.test | 14 + .../Twig/Tests/Fixtures/tests/defined.test | 129 ++ .../Fixtures/tests/defined_for_attribute.test | 35 + .../Fixtures/tests/defined_for_blocks.test | 38 + .../defined_for_blocks_with_template.test | 17 + .../Fixtures/tests/defined_for_constants.test | 14 + .../tests/defined_on_complex_expr.test | 8 + .../Tests/Fixtures/tests/dynamic_test.test | 14 + .../test/Twig/Tests/Fixtures/tests/empty.test | 42 + .../test/Twig/Tests/Fixtures/tests/even.test | 14 + .../test/Twig/Tests/Fixtures/tests/in.test | 116 ++ .../Tests/Fixtures/tests/in_with_objects.test | 19 + .../Twig/Tests/Fixtures/tests/iterable.test | 19 + .../Tests/Fixtures/tests/null_coalesce.test | 30 + .../test/Twig/Tests/Fixtures/tests/odd.test | 10 + .../Tests/Fixtures/whitespace/trim_block.test | 68 + .../whitespace/trim_delimiter_as_strings.test | 10 + .../Tests/Fixtures/whitespace/trim_left.test | 32 + .../Fixtures/whitespace/trim_line_left.test | 33 + .../Fixtures/whitespace/trim_line_right.test | 32 + .../Tests/Fixtures/whitespace/trim_right.test | 28 + .../twig/test/Twig/Tests/IntegrationTest.php | 384 ++++ .../autoescape/filename.legacy.test | 18 + .../functions/undefined_block.legacy.test | 12 + .../Tests/LegacyFixtures/test.legacy.test | 8 + .../test/Twig/Tests/LegacyIntegrationTest.php | 57 + .../twig/twig/test/Twig/Tests/LexerTest.php | 379 ++++ .../twig/test/Twig/Tests/Loader/ArrayTest.php | 139 ++ .../twig/test/Twig/Tests/Loader/ChainTest.php | 132 ++ .../test/Twig/Tests/Loader/FilesystemTest.php | 245 +++ .../array_inheritance_empty_parent.html.twig | 3 + ...y_inheritance_nonexistent_parent.html.twig | 3 + .../array_inheritance_null_parent.html.twig | 3 + .../array_inheritance_valid_parent.html.twig | 3 + .../Fixtures/inheritance/parent.html.twig | 1 + .../inheritance/spare_parent.html.twig | 1 + .../Tests/Loader/Fixtures/named/index.html | 1 + .../Loader/Fixtures/named_bis/index.html | 1 + .../Loader/Fixtures/named_final/index.html | 1 + .../Fixtures/named_quater/named_absolute.html | 1 + .../Loader/Fixtures/named_ter/index.html | 1 + .../Tests/Loader/Fixtures/normal/index.html | 1 + .../Loader/Fixtures/normal_bis/index.html | 1 + .../Loader/Fixtures/normal_final/index.html | 1 + .../Loader/Fixtures/normal_ter/index.html | 1 + .../Loader/Fixtures/phar/phar-sample.phar | Bin 0 -> 6786 bytes .../Fixtures/themes/theme1/blocks.html.twig | 3 + .../Fixtures/themes/theme2/blocks.html.twig | 3 + .../test/Twig/Tests/NativeExtensionTest.php | 39 + .../test/Twig/Tests/Node/AutoEscapeTest.php | 37 + .../Twig/Tests/Node/BlockReferenceTest.php | 34 + .../twig/test/Twig/Tests/Node/BlockTest.php | 43 + .../test/Twig/Tests/Node/DeprecatedTest.php | 80 + .../twig/twig/test/Twig/Tests/Node/DoTest.php | 36 + .../Twig/Tests/Node/Expression/ArrayTest.php | 41 + .../Tests/Node/Expression/AssignNameTest.php | 32 + .../Tests/Node/Expression/Binary/AddTest.php | 38 + .../Tests/Node/Expression/Binary/AndTest.php | 38 + .../Node/Expression/Binary/ConcatTest.php | 38 + .../Tests/Node/Expression/Binary/DivTest.php | 38 + .../Node/Expression/Binary/FloorDivTest.php | 38 + .../Tests/Node/Expression/Binary/ModTest.php | 38 + .../Tests/Node/Expression/Binary/MulTest.php | 38 + .../Tests/Node/Expression/Binary/OrTest.php | 38 + .../Tests/Node/Expression/Binary/SubTest.php | 38 + .../Twig/Tests/Node/Expression/CallTest.php | 145 ++ .../Tests/Node/Expression/ConditionalTest.php | 42 + .../Tests/Node/Expression/ConstantTest.php | 33 + .../Twig/Tests/Node/Expression/FilterTest.php | 161 ++ .../Tests/Node/Expression/FunctionTest.php | 117 ++ .../Tests/Node/Expression/GetAttrTest.php | 57 + .../Twig/Tests/Node/Expression/NameTest.php | 47 + .../Node/Expression/NullCoalesceTest.php | 36 + .../Node/Expression/PHP53/FilterInclude.php | 6 + .../Node/Expression/PHP53/FunctionInclude.php | 6 + .../Node/Expression/PHP53/TestInclude.php | 6 + .../Twig/Tests/Node/Expression/ParentTest.php | 31 + .../Twig/Tests/Node/Expression/TestTest.php | 90 + .../Tests/Node/Expression/Unary/NegTest.php | 36 + .../Tests/Node/Expression/Unary/NotTest.php | 35 + .../Tests/Node/Expression/Unary/PosTest.php | 35 + .../twig/test/Twig/Tests/Node/ForTest.php | 199 ++ .../twig/twig/test/Twig/Tests/Node/IfTest.php | 95 + .../twig/test/Twig/Tests/Node/ImportTest.php | 45 + .../twig/test/Twig/Tests/Node/IncludeTest.php | 93 + .../twig/test/Twig/Tests/Node/MacroTest.php | 81 + .../twig/test/Twig/Tests/Node/ModuleTest.php | 268 +++ .../twig/test/Twig/Tests/Node/PrintTest.php | 33 + .../twig/test/Twig/Tests/Node/SandboxTest.php | 47 + .../twig/test/Twig/Tests/Node/SetTest.php | 78 + .../test/Twig/Tests/Node/SpacelessTest.php | 42 + .../twig/test/Twig/Tests/Node/TextTest.php | 31 + .../test/Twig/Tests/NodeTraverserTest.php | 47 + .../Twig/Tests/NodeVisitor/OptimizerTest.php | 129 ++ .../twig/twig/test/Twig/Tests/ParserTest.php | 217 +++ .../Tests/Profiler/Dumper/AbstractTest.php | 105 + .../Tests/Profiler/Dumper/BlackfireTest.php | 34 + .../Twig/Tests/Profiler/Dumper/HtmlTest.php | 32 + .../Twig/Tests/Profiler/Dumper/TextTest.php | 32 + .../test/Twig/Tests/Profiler/ProfileTest.php | 112 ++ .../twig/test/Twig/Tests/TemplateTest.php | 812 ++++++++ .../test/Twig/Tests/TemplateWrapperTest.php | 68 + .../twig/test/Twig/Tests/TokenStreamTest.php | 85 + .../Tests/Util/DeprecationCollectorTest.php | 46 + .../twig/test/Twig/Tests/escapingTest.php | 325 ++++ .../templateEngines/Twig/Twig2x/autoload.php | 7 - .../Twig/Twig2x/composer/ClassLoader.php | 445 ----- .../Twig/Twig2x/composer/LICENSE | 21 - .../Twig2x/composer/autoload_classmap.php | 9 - .../Twig/Twig2x/composer/autoload_files.php | 11 - .../Twig2x/composer/autoload_namespaces.php | 10 - .../Twig/Twig2x/composer/autoload_psr4.php | 12 - .../Twig/Twig2x/composer/autoload_real.php | 70 - .../Twig/Twig2x/composer/autoload_static.php | 60 - .../Twig/Twig2x/composer/installed.json | 190 -- .../Twig2x/symfony/polyfill-ctype/Ctype.php | 227 --- .../Twig2x/symfony/polyfill-ctype/LICENSE | 19 - .../Twig2x/symfony/polyfill-ctype/README.md | 12 - .../symfony/polyfill-ctype/bootstrap.php | 26 - .../symfony/polyfill-ctype/composer.json | 34 - .../Twig2x/symfony/polyfill-mbstring/LICENSE | 19 - .../symfony/polyfill-mbstring/Mbstring.php | 847 -------- .../symfony/polyfill-mbstring/README.md | 13 - .../Resources/unidata/lowerCase.php | 1096 ----------- .../Resources/unidata/titleCaseRegexp.php | 5 - .../Resources/unidata/upperCase.php | 1104 ----------- .../symfony/polyfill-mbstring/bootstrap.php | 62 - .../symfony/polyfill-mbstring/composer.json | 34 - .../Twig/Twig2x/twig/twig/LICENSE | 29 - .../Twig/Twig2x/twig/twig/README.rst | 24 - .../twig/twig/lib/Twig/BaseNodeVisitor.php | 14 - .../twig/twig/lib/Twig/Cache/Filesystem.php | 14 - .../Twig2x/twig/twig/lib/Twig/Cache/Null.php | 14 - .../twig/twig/lib/Twig/CacheInterface.php | 14 - .../Twig2x/twig/twig/lib/Twig/Compiler.php | 14 - .../twig/lib/Twig/ContainerRuntimeLoader.php | 14 - .../Twig2x/twig/twig/lib/Twig/Environment.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Error.php | 14 - .../twig/twig/lib/Twig/Error/Loader.php | 14 - .../twig/twig/lib/Twig/Error/Runtime.php | 14 - .../twig/twig/lib/Twig/Error/Syntax.php | 14 - .../twig/lib/Twig/ExistsLoaderInterface.php | 14 - .../twig/twig/lib/Twig/ExpressionParser.php | 14 - .../Twig2x/twig/twig/lib/Twig/Extension.php | 14 - .../twig/twig/lib/Twig/Extension/Core.php | 14 - .../twig/twig/lib/Twig/Extension/Debug.php | 14 - .../twig/twig/lib/Twig/Extension/Escaper.php | 14 - .../lib/Twig/Extension/GlobalsInterface.php | 14 - .../Twig/Extension/InitRuntimeInterface.php | 14 - .../twig/lib/Twig/Extension/Optimizer.php | 14 - .../twig/twig/lib/Twig/Extension/Profiler.php | 14 - .../twig/twig/lib/Twig/Extension/Sandbox.php | 14 - .../twig/twig/lib/Twig/Extension/Staging.php | 14 - .../twig/lib/Twig/Extension/StringLoader.php | 14 - .../twig/twig/lib/Twig/ExtensionInterface.php | 14 - .../twig/twig/lib/Twig/ExtensionSet.php | 14 - .../twig/lib/Twig/FactoryRuntimeLoader.php | 14 - .../Twig/FileExtensionEscapingStrategy.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Filter.php | 14 - .../Twig2x/twig/twig/lib/Twig/Function.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Lexer.php | 14 - .../twig/twig/lib/Twig/Loader/Array.php | 14 - .../twig/twig/lib/Twig/Loader/Chain.php | 14 - .../twig/twig/lib/Twig/Loader/Filesystem.php | 14 - .../twig/twig/lib/Twig/LoaderInterface.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Markup.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Node.php | 14 - .../twig/twig/lib/Twig/Node/AutoEscape.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Block.php | 14 - .../twig/lib/Twig/Node/BlockReference.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Body.php | 14 - .../twig/twig/lib/Twig/Node/CheckSecurity.php | 14 - .../twig/twig/lib/Twig/Node/Deprecated.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Do.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Embed.php | 14 - .../twig/twig/lib/Twig/Node/Expression.php | 14 - .../twig/lib/Twig/Node/Expression/Array.php | 14 - .../lib/Twig/Node/Expression/AssignName.php | 14 - .../twig/lib/Twig/Node/Expression/Binary.php | 14 - .../lib/Twig/Node/Expression/Binary/Add.php | 14 - .../lib/Twig/Node/Expression/Binary/And.php | 14 - .../Node/Expression/Binary/BitwiseAnd.php | 14 - .../Twig/Node/Expression/Binary/BitwiseOr.php | 14 - .../Node/Expression/Binary/BitwiseXor.php | 14 - .../Twig/Node/Expression/Binary/Concat.php | 14 - .../lib/Twig/Node/Expression/Binary/Div.php | 14 - .../Twig/Node/Expression/Binary/EndsWith.php | 14 - .../lib/Twig/Node/Expression/Binary/Equal.php | 14 - .../Twig/Node/Expression/Binary/FloorDiv.php | 14 - .../Twig/Node/Expression/Binary/Greater.php | 14 - .../Node/Expression/Binary/GreaterEqual.php | 14 - .../lib/Twig/Node/Expression/Binary/In.php | 14 - .../lib/Twig/Node/Expression/Binary/Less.php | 14 - .../Twig/Node/Expression/Binary/LessEqual.php | 14 - .../Twig/Node/Expression/Binary/Matches.php | 14 - .../lib/Twig/Node/Expression/Binary/Mod.php | 14 - .../lib/Twig/Node/Expression/Binary/Mul.php | 14 - .../Twig/Node/Expression/Binary/NotEqual.php | 14 - .../lib/Twig/Node/Expression/Binary/NotIn.php | 14 - .../lib/Twig/Node/Expression/Binary/Or.php | 14 - .../lib/Twig/Node/Expression/Binary/Power.php | 14 - .../lib/Twig/Node/Expression/Binary/Range.php | 14 - .../Node/Expression/Binary/StartsWith.php | 14 - .../lib/Twig/Node/Expression/Binary/Sub.php | 14 - .../Twig/Node/Expression/BlockReference.php | 14 - .../twig/lib/Twig/Node/Expression/Call.php | 14 - .../lib/Twig/Node/Expression/Conditional.php | 14 - .../lib/Twig/Node/Expression/Constant.php | 14 - .../twig/lib/Twig/Node/Expression/Filter.php | 14 - .../Twig/Node/Expression/Filter/Default.php | 14 - .../lib/Twig/Node/Expression/Function.php | 14 - .../twig/lib/Twig/Node/Expression/GetAttr.php | 14 - .../lib/Twig/Node/Expression/MethodCall.php | 14 - .../twig/lib/Twig/Node/Expression/Name.php | 14 - .../lib/Twig/Node/Expression/NullCoalesce.php | 14 - .../twig/lib/Twig/Node/Expression/Parent.php | 14 - .../lib/Twig/Node/Expression/TempName.php | 14 - .../twig/lib/Twig/Node/Expression/Test.php | 14 - .../Twig/Node/Expression/Test/Constant.php | 14 - .../lib/Twig/Node/Expression/Test/Defined.php | 14 - .../Twig/Node/Expression/Test/Divisibleby.php | 14 - .../lib/Twig/Node/Expression/Test/Even.php | 14 - .../lib/Twig/Node/Expression/Test/Null.php | 14 - .../lib/Twig/Node/Expression/Test/Odd.php | 14 - .../lib/Twig/Node/Expression/Test/Sameas.php | 14 - .../twig/lib/Twig/Node/Expression/Unary.php | 14 - .../lib/Twig/Node/Expression/Unary/Neg.php | 14 - .../lib/Twig/Node/Expression/Unary/Not.php | 14 - .../lib/Twig/Node/Expression/Unary/Pos.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Flush.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/For.php | 14 - .../twig/twig/lib/Twig/Node/ForLoop.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/If.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Import.php | 14 - .../twig/twig/lib/Twig/Node/Include.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Macro.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Module.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Print.php | 14 - .../twig/twig/lib/Twig/Node/Sandbox.php | 14 - .../twig/lib/Twig/Node/SandboxedPrint.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Set.php | 14 - .../twig/twig/lib/Twig/Node/Spaceless.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/Text.php | 14 - .../Twig2x/twig/twig/lib/Twig/Node/With.php | 14 - .../twig/lib/Twig/NodeCaptureInterface.php | 14 - .../twig/lib/Twig/NodeOutputInterface.php | 14 - .../twig/twig/lib/Twig/NodeTraverser.php | 14 - .../twig/lib/Twig/NodeVisitor/Escaper.php | 14 - .../twig/lib/Twig/NodeVisitor/Optimizer.php | 14 - .../lib/Twig/NodeVisitor/SafeAnalysis.php | 14 - .../twig/lib/Twig/NodeVisitor/Sandbox.php | 14 - .../twig/lib/Twig/NodeVisitorInterface.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Parser.php | 14 - .../twig/lib/Twig/Profiler/Dumper/Base.php | 14 - .../lib/Twig/Profiler/Dumper/Blackfire.php | 14 - .../twig/lib/Twig/Profiler/Dumper/Html.php | 14 - .../twig/lib/Twig/Profiler/Dumper/Text.php | 14 - .../lib/Twig/Profiler/Node/EnterProfile.php | 14 - .../lib/Twig/Profiler/Node/LeaveProfile.php | 14 - .../Twig/Profiler/NodeVisitor/Profiler.php | 14 - .../twig/twig/lib/Twig/Profiler/Profile.php | 14 - .../twig/lib/Twig/RuntimeLoaderInterface.php | 14 - .../twig/lib/Twig/Sandbox/SecurityError.php | 14 - .../Sandbox/SecurityNotAllowedFilterError.php | 14 - .../SecurityNotAllowedFunctionError.php | 14 - .../Sandbox/SecurityNotAllowedMethodError.php | 14 - .../SecurityNotAllowedPropertyError.php | 14 - .../Sandbox/SecurityNotAllowedTagError.php | 14 - .../twig/lib/Twig/Sandbox/SecurityPolicy.php | 14 - .../Twig/Sandbox/SecurityPolicyInterface.php | 14 - .../twig/twig/lib/Twig/SimpleFilter.php | 26 - .../twig/twig/lib/Twig/SimpleFunction.php | 26 - .../Twig2x/twig/twig/lib/Twig/SimpleTest.php | 26 - .../Twig/Twig2x/twig/twig/lib/Twig/Source.php | 14 - .../lib/Twig/SourceContextLoaderInterface.php | 14 - .../Twig2x/twig/twig/lib/Twig/Template.php | 14 - .../twig/twig/lib/Twig/TemplateWrapper.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Test.php | 14 - .../lib/Twig/Test/IntegrationTestCase.php | 14 - .../twig/twig/lib/Twig/Test/NodeTestCase.php | 14 - .../Twig/Twig2x/twig/twig/lib/Twig/Token.php | 14 - .../Twig2x/twig/twig/lib/Twig/TokenParser.php | 14 - .../twig/lib/Twig/TokenParser/AutoEscape.php | 14 - .../twig/twig/lib/Twig/TokenParser/Block.php | 14 - .../twig/lib/Twig/TokenParser/Deprecated.php | 14 - .../twig/twig/lib/Twig/TokenParser/Do.php | 14 - .../twig/twig/lib/Twig/TokenParser/Embed.php | 14 - .../twig/lib/Twig/TokenParser/Extends.php | 14 - .../twig/twig/lib/Twig/TokenParser/Filter.php | 14 - .../twig/twig/lib/Twig/TokenParser/Flush.php | 14 - .../twig/twig/lib/Twig/TokenParser/For.php | 14 - .../twig/twig/lib/Twig/TokenParser/From.php | 14 - .../twig/twig/lib/Twig/TokenParser/If.php | 14 - .../twig/twig/lib/Twig/TokenParser/Import.php | 14 - .../twig/lib/Twig/TokenParser/Include.php | 14 - .../twig/twig/lib/Twig/TokenParser/Macro.php | 14 - .../twig/lib/Twig/TokenParser/Sandbox.php | 14 - .../twig/twig/lib/Twig/TokenParser/Set.php | 14 - .../twig/lib/Twig/TokenParser/Spaceless.php | 14 - .../twig/twig/lib/Twig/TokenParser/Use.php | 14 - .../twig/twig/lib/Twig/TokenParser/With.php | 14 - .../twig/lib/Twig/TokenParserInterface.php | 14 - .../Twig2x/twig/twig/lib/Twig/TokenStream.php | 14 - .../lib/Twig/Util/DeprecationCollector.php | 14 - .../lib/Twig/Util/TemplateDirIterator.php | 14 - .../twig/twig/src/Cache/CacheInterface.php | 60 - .../twig/twig/src/Cache/FilesystemCache.php | 93 - .../Twig2x/twig/twig/src/Cache/NullCache.php | 40 - .../Twig/Twig2x/twig/twig/src/Compiler.php | 245 --- .../Twig/Twig2x/twig/twig/src/Environment.php | 995 ---------- .../Twig/Twig2x/twig/twig/src/Error/Error.php | 257 --- .../twig/twig/src/Error/LoaderError.php | 23 - .../twig/twig/src/Error/RuntimeError.php | 24 - .../twig/twig/src/Error/SyntaxError.php | 48 - .../Twig2x/twig/twig/src/ExpressionParser.php | 814 -------- .../twig/src/Extension/AbstractExtension.php | 47 - .../twig/twig/src/Extension/CoreExtension.php | 1566 --------------- .../twig/src/Extension/DebugExtension.php | 66 - .../twig/src/Extension/EscaperExtension.php | 427 ---- .../twig/src/Extension/ExtensionInterface.php | 73 - .../twig/src/Extension/GlobalsInterface.php | 32 - .../src/Extension/InitRuntimeInterface.php | 36 - .../twig/src/Extension/OptimizerExtension.php | 31 - .../twig/src/Extension/ProfilerExtension.php | 48 - .../Extension/RuntimeExtensionInterface.php | 19 - .../twig/src/Extension/SandboxExtension.php | 125 -- .../twig/src/Extension/StagingExtension.php | 102 - .../src/Extension/StringLoaderExtension.php | 46 - .../Twig2x/twig/twig/src/ExtensionSet.php | 477 ----- .../src/FileExtensionEscapingStrategy.php | 62 - .../Twig/Twig2x/twig/twig/src/Lexer.php | 501 ----- .../twig/twig/src/Loader/ArrayLoader.php | 86 - .../twig/twig/src/Loader/ChainLoader.php | 120 -- .../twig/src/Loader/ExistsLoaderInterface.php | 23 - .../twig/twig/src/Loader/FilesystemLoader.php | 308 --- .../twig/twig/src/Loader/LoaderInterface.php | 69 - .../Loader/SourceContextLoaderInterface.php | 21 - .../Twig/Twig2x/twig/twig/src/Markup.php | 46 - .../twig/twig/src/Node/AutoEscapeNode.php | 40 - .../Twig2x/twig/twig/src/Node/BlockNode.php | 46 - .../twig/twig/src/Node/BlockReferenceNode.php | 38 - .../Twig2x/twig/twig/src/Node/BodyNode.php | 23 - .../twig/twig/src/Node/CheckSecurityNode.php | 85 - .../twig/twig/src/Node/CheckToStringNode.php | 45 - .../twig/twig/src/Node/DeprecatedNode.php | 55 - .../Twig/Twig2x/twig/twig/src/Node/DoNode.php | 40 - .../Twig2x/twig/twig/src/Node/EmbedNode.php | 50 - .../Node/Expression/AbstractExpression.php | 26 - .../src/Node/Expression/ArrayExpression.php | 88 - .../Expression/ArrowFunctionExpression.php | 64 - .../Node/Expression/AssignNameExpression.php | 29 - .../Node/Expression/Binary/AbstractBinary.php | 44 - .../src/Node/Expression/Binary/AddBinary.php | 25 - .../src/Node/Expression/Binary/AndBinary.php | 25 - .../Expression/Binary/BitwiseAndBinary.php | 25 - .../Expression/Binary/BitwiseOrBinary.php | 25 - .../Expression/Binary/BitwiseXorBinary.php | 25 - .../Node/Expression/Binary/ConcatBinary.php | 25 - .../src/Node/Expression/Binary/DivBinary.php | 25 - .../Node/Expression/Binary/EndsWithBinary.php | 37 - .../Node/Expression/Binary/EqualBinary.php | 24 - .../Node/Expression/Binary/FloorDivBinary.php | 31 - .../Node/Expression/Binary/GreaterBinary.php | 24 - .../Expression/Binary/GreaterEqualBinary.php | 24 - .../src/Node/Expression/Binary/InBinary.php | 35 - .../src/Node/Expression/Binary/LessBinary.php | 24 - .../Expression/Binary/LessEqualBinary.php | 24 - .../Node/Expression/Binary/MatchesBinary.php | 35 - .../src/Node/Expression/Binary/ModBinary.php | 25 - .../src/Node/Expression/Binary/MulBinary.php | 25 - .../Node/Expression/Binary/NotEqualBinary.php | 24 - .../Node/Expression/Binary/NotInBinary.php | 35 - .../src/Node/Expression/Binary/OrBinary.php | 25 - .../Node/Expression/Binary/PowerBinary.php | 24 - .../Node/Expression/Binary/RangeBinary.php | 35 - .../Expression/Binary/SpaceshipBinary.php | 22 - .../Expression/Binary/StartsWithBinary.php | 37 - .../src/Node/Expression/Binary/SubBinary.php | 25 - .../Expression/BlockReferenceExpression.php | 88 - .../src/Node/Expression/CallExpression.php | 313 --- .../Node/Expression/ConditionalExpression.php | 38 - .../Node/Expression/ConstantExpression.php | 30 - .../Node/Expression/Filter/DefaultFilter.php | 54 - .../src/Node/Expression/FilterExpression.php | 42 - .../Node/Expression/FunctionExpression.php | 45 - .../src/Node/Expression/GetAttrExpression.php | 89 - .../twig/src/Node/Expression/InlinePrint.php | 35 - .../Node/Expression/MethodCallExpression.php | 64 - .../src/Node/Expression/NameExpression.php | 99 - .../Expression/NullCoalesceExpression.php | 62 - .../src/Node/Expression/ParentExpression.php | 48 - .../Node/Expression/TempNameExpression.php | 33 - .../src/Node/Expression/Test/ConstantTest.php | 51 - .../src/Node/Expression/Test/DefinedTest.php | 76 - .../Node/Expression/Test/DivisiblebyTest.php | 38 - .../src/Node/Expression/Test/EvenTest.php | 37 - .../src/Node/Expression/Test/NullTest.php | 36 - .../twig/src/Node/Expression/Test/OddTest.php | 37 - .../src/Node/Expression/Test/SameasTest.php | 36 - .../src/Node/Expression/TestExpression.php | 44 - .../Node/Expression/Unary/AbstractUnary.php | 36 - .../src/Node/Expression/Unary/NegUnary.php | 25 - .../src/Node/Expression/Unary/NotUnary.php | 25 - .../src/Node/Expression/Unary/PosUnary.php | 25 - .../Node/Expression/VariadicExpression.php | 24 - .../Twig2x/twig/twig/src/Node/FlushNode.php | 37 - .../Twig2x/twig/twig/src/Node/ForLoopNode.php | 56 - .../Twig2x/twig/twig/src/Node/ForNode.php | 119 -- .../Twig/Twig2x/twig/twig/src/Node/IfNode.php | 72 - .../Twig2x/twig/twig/src/Node/ImportNode.php | 65 - .../Twig2x/twig/twig/src/Node/IncludeNode.php | 108 -- .../Twig2x/twig/twig/src/Node/MacroNode.php | 115 -- .../Twig2x/twig/twig/src/Node/ModuleNode.php | 472 ----- .../Twig/Twig2x/twig/twig/src/Node/Node.php | 211 -- .../twig/src/Node/NodeCaptureInterface.php | 23 - .../twig/src/Node/NodeOutputInterface.php | 23 - .../Twig2x/twig/twig/src/Node/PrintNode.php | 41 - .../Twig2x/twig/twig/src/Node/SandboxNode.php | 47 - .../twig/twig/src/Node/SandboxedPrintNode.php | 54 - .../Twig2x/twig/twig/src/Node/SetNode.php | 107 - .../twig/twig/src/Node/SpacelessNode.php | 49 - .../Twig2x/twig/twig/src/Node/TextNode.php | 40 - .../Twig2x/twig/twig/src/Node/WithNode.php | 72 - .../Twig2x/twig/twig/src/NodeTraverser.php | 85 - .../src/NodeVisitor/AbstractNodeVisitor.php | 51 - .../src/NodeVisitor/EscaperNodeVisitor.php | 208 -- .../MacroAutoImportNodeVisitor.php | 72 - .../src/NodeVisitor/NodeVisitorInterface.php | 51 - .../src/NodeVisitor/OptimizerNodeVisitor.php | 219 --- .../NodeVisitor/SafeAnalysisNodeVisitor.php | 160 -- .../src/NodeVisitor/SandboxNodeVisitor.php | 135 -- .../Twig/Twig2x/twig/twig/src/Parser.php | 394 ---- .../twig/src/Profiler/Dumper/BaseDumper.php | 65 - .../src/Profiler/Dumper/BlackfireDumper.php | 74 - .../twig/src/Profiler/Dumper/HtmlDumper.php | 49 - .../twig/src/Profiler/Dumper/TextDumper.php | 37 - .../src/Profiler/Node/EnterProfileNode.php | 44 - .../src/Profiler/Node/LeaveProfileNode.php | 38 - .../NodeVisitor/ProfilerNodeVisitor.php | 78 - .../Twig2x/twig/twig/src/Profiler/Profile.php | 192 -- .../RuntimeLoader/ContainerRuntimeLoader.php | 41 - .../RuntimeLoader/FactoryRuntimeLoader.php | 41 - .../RuntimeLoader/RuntimeLoaderInterface.php | 31 - .../twig/twig/src/Sandbox/SecurityError.php | 25 - .../Sandbox/SecurityNotAllowedFilterError.php | 46 - .../SecurityNotAllowedFunctionError.php | 46 - .../Sandbox/SecurityNotAllowedMethodError.php | 53 - .../SecurityNotAllowedPropertyError.php | 53 - .../Sandbox/SecurityNotAllowedTagError.php | 46 - .../twig/twig/src/Sandbox/SecurityPolicy.php | 128 -- .../src/Sandbox/SecurityPolicyInterface.php | 37 - .../Twig/Twig2x/twig/twig/src/Source.php | 53 - .../Twig/Twig2x/twig/twig/src/Template.php | 437 ----- .../Twig2x/twig/twig/src/TemplateWrapper.php | 145 -- .../twig/src/Test/IntegrationTestCase.php | 267 --- .../twig/twig/src/Test/NodeTestCase.php | 67 - .../Twig/Twig2x/twig/twig/src/Token.php | 213 -- .../src/TokenParser/AbstractTokenParser.php | 34 - .../twig/src/TokenParser/ApplyTokenParser.php | 58 - .../src/TokenParser/AutoEscapeTokenParser.php | 57 - .../twig/src/TokenParser/BlockTokenParser.php | 78 - .../src/TokenParser/DeprecatedTokenParser.php | 44 - .../twig/src/TokenParser/DoTokenParser.php | 37 - .../twig/src/TokenParser/EmbedTokenParser.php | 72 - .../src/TokenParser/ExtendsTokenParser.php | 52 - .../src/TokenParser/FilterTokenParser.php | 64 - .../twig/src/TokenParser/FlushTokenParser.php | 37 - .../twig/src/TokenParser/ForTokenParser.php | 137 -- .../twig/src/TokenParser/FromTokenParser.php | 65 - .../twig/src/TokenParser/IfTokenParser.php | 89 - .../src/TokenParser/ImportTokenParser.php | 43 - .../src/TokenParser/IncludeTokenParser.php | 68 - .../twig/src/TokenParser/MacroTokenParser.php | 66 - .../src/TokenParser/SandboxTokenParser.php | 65 - .../twig/src/TokenParser/SetTokenParser.php | 72 - .../src/TokenParser/SpacelessTokenParser.php | 56 - .../src/TokenParser/TokenParserInterface.php | 52 - .../twig/src/TokenParser/UseTokenParser.php | 73 - .../twig/src/TokenParser/WithTokenParser.php | 55 - .../Twig/Twig2x/twig/twig/src/TokenStream.php | 134 -- .../Twig/Twig2x/twig/twig/src/TwigFilter.php | 150 -- .../Twig2x/twig/twig/src/TwigFunction.php | 140 -- .../Twig/Twig2x/twig/twig/src/TwigTest.php | 109 -- .../twig/src/Util/DeprecationCollector.php | 79 - .../twig/src/Util/TemplateDirIterator.php | 30 - system/templateEngines/Twig/autoload.php | 10 +- system/url/seo_url.php | 2 +- 1354 files changed, 35137 insertions(+), 32640 deletions(-) delete mode 100644 system/templateEngines/Twig/Twig1x/autoload.php create mode 100644 system/templateEngines/Twig/Twig1x/composer.json create mode 100644 system/templateEngines/Twig/Twig1x/composer.lock delete mode 100644 system/templateEngines/Twig/Twig1x/composer/ClassLoader.php delete mode 100644 system/templateEngines/Twig/Twig1x/composer/autoload_classmap.php delete mode 100644 system/templateEngines/Twig/Twig1x/composer/autoload_real.php delete mode 100644 system/templateEngines/Twig/Twig1x/composer/autoload_static.php delete mode 100644 system/templateEngines/Twig/Twig1x/composer/installed.json delete mode 100644 system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/bootstrap.php delete mode 100644 system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/composer.json delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/.gitattributes delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/.gitignore delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/.php_cs.dist delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/.travis.yml delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/LICENSE delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/README.rst delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/FilesystemCache.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Environment.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/ExpressionParser.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/CoreExtension.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/DebugExtension.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Lexer.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/FilesystemLoader.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NullCoalesceExpression.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Node/MacroNode.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetNode.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SpacelessNode.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Parser.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicy.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/Template.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/TemplateWrapper.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ExtendsTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FromTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ImportTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig1x/twig/twig/src/TokenStream.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/autoload.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/ClassLoader.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/InstalledVersions.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/composer/LICENSE (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/autoload_classmap.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/composer/autoload_files.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/composer/autoload_namespaces.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/composer/autoload_psr4.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/autoload_real.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/autoload_static.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/installed.json create mode 100644 system/templateEngines/Twig/Twig1x/vendor/composer/installed.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/symfony/polyfill-ctype/Ctype.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/symfony/polyfill-ctype/LICENSE (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/symfony/polyfill-ctype/README.md (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/bootstrap.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/composer.json rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/.editorconfig (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/.gitignore create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/.php_cs.dist create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/.travis.yml create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/CHANGELOG create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/LICENSE create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/README.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/composer.json create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced_legacy.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/api.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/coding_standards.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/deprecated.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/abs.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/batch.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/capitalize.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/convert_encoding.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date_modify.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/default.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/escape.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/filter.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/first.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/format.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/index.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/join.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/json_encode.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/keys.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/last.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/length.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/lower.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/map.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/merge.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/nl2br.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/number_format.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/raw.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reduce.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/replace.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reverse.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/round.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/slice.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/sort.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/spaceless.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/split.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/striptags.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/title.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/trim.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/upper.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/url_encode.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/attribute.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/block.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/constant.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/cycle.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/date.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/dump.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/include.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/index.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/max.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/min.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/parent.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/random.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/range.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/source.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/template_from_string.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/index.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/installation.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/internals.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/intro.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/recipes.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/apply.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/autoescape.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/block.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/deprecated.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/do.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/embed.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/extends.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/filter.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/flush.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/for.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/from.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/if.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/import.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/include.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/index.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/macro.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/sandbox.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/set.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/spaceless.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/use.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/verbatim.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/with.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/templates.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/constant.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/defined.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/divisibleby.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/empty.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/even.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/index.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/iterable.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/null.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/odd.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/sameas.rst create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/drupal_test.sh create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/.gitignore create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/config.m4 create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/config.w32 create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/php_twig.h create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/twig.c rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Autoloader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/BaseNodeVisitor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Cache/Filesystem.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Cache/Null.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/CacheInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Compiler.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/CompilerInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/ContainerRuntimeLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Environment.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Error.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Error/Loader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Error/Runtime.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Error/Syntax.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/ExistsLoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/ExpressionParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Core.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Debug.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Escaper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/GlobalsInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Optimizer.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Profiler.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Sandbox.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/Staging.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Extension/StringLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/ExtensionInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FactoryRuntimeLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Filter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Filter/Function.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Filter/Method.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Filter/Node.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FilterCallableInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FilterInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Function.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Function/Function.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Function/Method.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Function/Node.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FunctionCallableInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/FunctionInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Lexer.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/LexerInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Loader/Array.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Loader/Chain.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Loader/Filesystem.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Loader/String.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/LoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Markup.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/AutoEscape.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Block.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/BlockReference.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Body.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/CheckSecurity.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Deprecated.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Do.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Embed.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Array.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/AssignName.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Add.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/And.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Div.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/In.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Less.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Or.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Power.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Range.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/BlockReference.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Call.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Conditional.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Constant.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Filter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Filter/Default.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Function.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/GetAttr.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/MethodCall.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Name.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Parent.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/TempName.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Constant.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Defined.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Even.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Null.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Odd.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Unary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Unary/Not.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Flush.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/For.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/ForLoop.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/If.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Import.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Include.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Macro.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Module.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Print.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Sandbox.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/SandboxedPrint.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Set.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/SetTemp.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Spaceless.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/Text.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Node/With.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeCaptureInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeOutputInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeTraverser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeVisitor/Escaper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeVisitor/Optimizer.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeVisitor/Sandbox.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/NodeVisitorInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Parser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/ParserInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Dumper/Base.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Dumper/Html.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Dumper/Text.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Profiler/Profile.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/RuntimeLoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/SimpleFilter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/SimpleFunction.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/SimpleTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Source.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/SourceContextLoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Template.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TemplateInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TemplateWrapper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test/Function.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test/IntegrationTestCase.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test/Method.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test/Node.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Test/NodeTestCase.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TestCallableInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TestInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Token.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/AutoEscape.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Block.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Deprecated.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Do.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Embed.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Extends.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Filter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Flush.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/For.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/From.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/If.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Import.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Include.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Macro.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Sandbox.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Set.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Spaceless.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/Use.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParser/With.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParserBroker.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParserBrokerInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenParserInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/TokenStream.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Util/DeprecationCollector.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/lib/Twig/Util/TemplateDirIterator.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/phpunit.xml.dist rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Cache/CacheInterface.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/FilesystemCache.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Cache/NullCache.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Compiler.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Environment.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Error/Error.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Error/LoaderError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Error/RuntimeError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Error/SyntaxError.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/ExpressionParser.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/AbstractExtension.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/CoreExtension.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/DebugExtension.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/EscaperExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/ExtensionInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/GlobalsInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/InitRuntimeInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/OptimizerExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/ProfilerExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/RuntimeExtensionInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/SandboxExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/StagingExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Extension/StringLoaderExtension.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/FileExtensionEscapingStrategy.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Lexer.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Loader/ArrayLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Loader/ChainLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Loader/ExistsLoaderInterface.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/FilesystemLoader.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Loader/LoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Loader/SourceContextLoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Markup.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/AutoEscapeNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/BlockNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/BlockReferenceNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/BodyNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/CheckSecurityNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/CheckToStringNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/DeprecatedNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/DoNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/EmbedNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/AbstractExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/ArrayExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/ArrowFunctionExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/AssignNameExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/AbstractBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/AddBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/AndBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/ConcatBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/DivBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/EqualBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/GreaterBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/InBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/LessBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/MatchesBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/ModBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/MulBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/NotInBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/OrBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/PowerBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/RangeBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Binary/SubBinary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/BlockReferenceExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/CallExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/ConditionalExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/ConstantExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Filter/DefaultFilter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/FilterExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/FunctionExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/GetAttrExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/InlinePrint.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/MethodCallExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/NameExpression.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/ParentExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/TempNameExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/ConstantTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/DefinedTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/EvenTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/NullTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/OddTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Test/SameasTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/TestExpression.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Unary/AbstractUnary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Unary/NegUnary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Unary/NotUnary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Expression/Unary/PosUnary.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/FlushNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/ForLoopNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/ForNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/IfNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/ImportNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/IncludeNode.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/MacroNode.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/ModuleNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/Node.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/NodeCaptureInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/NodeOutputInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/PrintNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/SandboxNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/SandboxedPrintNode.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetNode.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/SetTempNode.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SpacelessNode.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/TextNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Node/WithNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeTraverser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeVisitor/NodeVisitorInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Parser.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Dumper/BaseDumper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Dumper/BlackfireDumper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Dumper/HtmlDumper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Dumper/TextDumper.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Node/EnterProfileNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Node/LeaveProfileNode.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Profiler/Profile.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicy.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Sandbox/SecurityPolicyInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Source.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Template.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TemplateWrapper.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Test/IntegrationTestCase.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Test/NodeTestCase.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Token.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/AbstractTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/ApplyTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/AutoEscapeTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/BlockTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/DeprecatedTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/DoTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/EmbedTokenParser.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/FilterTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/FlushTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/ForTokenParser.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FromTokenParser.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/IfTokenParser.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ImportTokenParser.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/IncludeTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/MacroTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/SandboxTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/SetTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/SpacelessTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/TokenParserInterface.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/UseTokenParser.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TokenParser/WithTokenParser.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenStream.php rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TwigFilter.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TwigFunction.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/TwigTest.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Util/DeprecationCollector.php (100%) rename system/templateEngines/Twig/Twig1x/{ => vendor}/twig/twig/src/Util/TemplateDirIterator.php (100%) create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CompilerTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ErrorTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_argument_defined_twice.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_positional_arg_after_named_arg.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/not_arrow_fn.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter_php_56.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/map.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reduce.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing_exists.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/include_missing_extends.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string_error.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing_exists.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/include_missing_extends.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture_scope.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance_overriding.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/mutating.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/globals.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/iterable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_on_complex_expr.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_block.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_delimiter_as_strings.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_left.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_left.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_right.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_right.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LexerTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ParserTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php create mode 100644 system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/escapingTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/autoload.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/ClassLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/LICENSE delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_classmap.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_files.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_namespaces.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_psr4.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_real.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/autoload_static.php delete mode 100644 system/templateEngines/Twig/Twig2x/composer/installed.json delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/Ctype.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/LICENSE delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/README.md delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/bootstrap.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/composer.json delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/LICENSE delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Mbstring.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/README.md delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/upperCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/bootstrap.php delete mode 100644 system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/composer.json delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/LICENSE delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/README.rst delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/BaseNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Cache/Filesystem.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Cache/Null.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/CacheInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Compiler.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/ContainerRuntimeLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Environment.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Error.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Error/Loader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Error/Runtime.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Error/Syntax.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/ExistsLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/ExpressionParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Core.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Debug.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Escaper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/GlobalsInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Optimizer.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Profiler.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Sandbox.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/Staging.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Extension/StringLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/ExtensionInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/ExtensionSet.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/FactoryRuntimeLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Filter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Function.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Lexer.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Loader/Array.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Loader/Chain.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Loader/Filesystem.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/LoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Markup.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/AutoEscape.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Block.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/BlockReference.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Body.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/CheckSecurity.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Deprecated.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Do.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Embed.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Array.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/AssignName.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Add.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/And.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Div.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/In.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Less.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Or.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Power.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Range.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/BlockReference.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Call.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Conditional.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Constant.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Filter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Filter/Default.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Function.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/GetAttr.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/MethodCall.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Name.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Parent.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/TempName.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Constant.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Defined.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Even.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Null.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Odd.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Unary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Unary/Not.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Flush.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/For.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/ForLoop.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/If.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Import.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Include.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Macro.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Module.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Print.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Sandbox.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/SandboxedPrint.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Set.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Spaceless.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/Text.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Node/With.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeCaptureInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeOutputInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeTraverser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeVisitor/Escaper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeVisitor/Optimizer.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeVisitor/Sandbox.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/NodeVisitorInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Parser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Dumper/Base.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Dumper/Html.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Dumper/Text.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Profiler/Profile.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/RuntimeLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/SimpleFilter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/SimpleFunction.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/SimpleTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Source.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/SourceContextLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Template.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TemplateWrapper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Test.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Test/IntegrationTestCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Test/NodeTestCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Token.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/AutoEscape.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Block.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Deprecated.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Do.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Embed.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Extends.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Filter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Flush.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/For.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/From.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/If.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Import.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Include.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Macro.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Sandbox.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Set.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Spaceless.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/Use.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParser/With.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenParserInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/TokenStream.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Util/DeprecationCollector.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/Util/TemplateDirIterator.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/CacheInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/FilesystemCache.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/NullCache.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Compiler.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Environment.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Error/Error.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Error/LoaderError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Error/RuntimeError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Error/SyntaxError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/ExpressionParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/AbstractExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/CoreExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/DebugExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/EscaperExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ExtensionInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/GlobalsInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/InitRuntimeInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/OptimizerExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ProfilerExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/RuntimeExtensionInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/SandboxExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StagingExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StringLoaderExtension.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/ExtensionSet.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/FileExtensionEscapingStrategy.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Lexer.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ArrayLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ChainLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ExistsLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/FilesystemLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/LoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/SourceContextLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Markup.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/AutoEscapeNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockReferenceNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BodyNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckSecurityNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckToStringNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DeprecatedNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DoNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/EmbedNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AbstractExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrayExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AssignNameExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AddBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AndBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/DivBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EqualBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/InBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ModBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MulBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotInBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/OrBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/PowerBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/RangeBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SubBinary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/BlockReferenceExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/CallExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConditionalExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConstantExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FilterExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FunctionExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/GetAttrExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/InlinePrint.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/MethodCallExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NameExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NullCoalesceExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ParentExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TempNameExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/ConstantTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DefinedTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/EvenTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/NullTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/OddTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/SameasTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TestExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NegUnary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NotUnary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/PosUnary.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/VariadicExpression.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/FlushNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForLoopNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IfNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ImportNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IncludeNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/MacroNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ModuleNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Node.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeCaptureInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeOutputInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/PrintNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxedPrintNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SetNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SpacelessNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/TextNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Node/WithNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeTraverser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Parser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BaseDumper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/HtmlDumper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/TextDumper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/EnterProfileNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/LeaveProfileNode.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Profile.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicy.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicyInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Source.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Template.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TemplateWrapper.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Test/IntegrationTestCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Test/NodeTestCase.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Token.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AbstractTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ApplyTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/BlockTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DeprecatedTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DoTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/EmbedTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ExtendsTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FilterTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FlushTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ForTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FromTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IfTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ImportTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IncludeTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/MacroTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SandboxTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SetTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SpacelessTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/TokenParserInterface.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/UseTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/WithTokenParser.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TokenStream.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFilter.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFunction.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/TwigTest.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Util/DeprecationCollector.php delete mode 100644 system/templateEngines/Twig/Twig2x/twig/twig/src/Util/TemplateDirIterator.php diff --git a/system/config/autoload.php b/system/config/autoload.php index ef32444..81c30ee 100644 --- a/system/config/autoload.php +++ b/system/config/autoload.php @@ -86,8 +86,7 @@ final class Config { $this->data = array_merge($this->data, $cfg); } else { - trigger_error('Error: Could not load config ' . $filename . '!'); - exit(); + throw new \Phacil\Framework\Exception('Could not load config ' . $filename. '!'); } } } diff --git a/system/database/databases/mssql.php b/system/database/databases/mssql.php index f0c8083..aafe7b6 100644 --- a/system/database/databases/mssql.php +++ b/system/database/databases/mssql.php @@ -62,8 +62,7 @@ final class MSSQL implements \Phacil\Framework\Interfaces\Databases return true; } } else { - trigger_error('Error: ' . mssql_get_last_message($this->connection) . '
' . $sql); - exit(); + throw new \Phacil\Framework\Exception('Error: ' . mssql_get_last_message($this->connection) . '
' . $sql); } } diff --git a/system/database/databases/mysql_legacy.php b/system/database/databases/mysql_legacy.php index 12504f6..70c4d67 100644 --- a/system/database/databases/mysql_legacy.php +++ b/system/database/databases/mysql_legacy.php @@ -63,8 +63,7 @@ final class MySQL_legacy implements \Phacil\Framework\Interfaces\Databases { return true; } } else { - trigger_error('Error: ' . mysql_error($this->connection) . '
Error No: ' . mysql_errno($this->connection) . '
' . $sql); - exit(); + throw new \Phacil\Framework\Exception('Error: ' . mysql_error($this->connection) . '
Error No: ' . mysql_errno($this->connection) . '
' . $sql); } } diff --git a/system/database/databases/mysql_pdo.php b/system/database/databases/mysql_pdo.php index 0b3e2d4..da970e1 100644 --- a/system/database/databases/mysql_pdo.php +++ b/system/database/databases/mysql_pdo.php @@ -80,7 +80,7 @@ final class MYSQL_PDO implements Databases $this->dbh->exec($this->options['PDO::MYSQL_ATTR_INIT_COMMAND']); } } catch (\PDOException $exception) { - trigger_error($exception->getMessage()); + throw new \Phacil\Framework\Exception($exception->getMessage()); } } /** diff --git a/system/database/databases/oracle.php b/system/database/databases/oracle.php index ac657bf..2f725b0 100644 --- a/system/database/databases/oracle.php +++ b/system/database/databases/oracle.php @@ -38,7 +38,7 @@ final class Oracle implements Databases { if (!$this->connection) { $e = oci_error(); $this->error = $e; - throw new \Exception(trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR)); + throw new \Phacil\Framework\Exception((htmlentities($e['message'], ENT_QUOTES))); } oci_set_client_info($this->connection, "Administrator"); //oci_set_module_name($this->connection, $module); @@ -66,7 +66,7 @@ final class Oracle implements Databases { } else { - throw new \Exception('Error: ' . oci_error() . '
' . $sql); + throw new \Phacil\Framework\Exception('Error: ' . oci_error() . '
' . $sql); } } diff --git a/system/database/databases/sqlsrv.php b/system/database/databases/sqlsrv.php index 09141ee..bfeecfb 100644 --- a/system/database/databases/sqlsrv.php +++ b/system/database/databases/sqlsrv.php @@ -88,8 +88,7 @@ final class SQLSRV implements Databases { return true; } } else { - trigger_error('Error:
' . $sql); - exit(); + throw new \Phacil\Framework\Exception('Error:
' . $sql); } } diff --git a/system/engine/exception.php b/system/engine/exception.php index a1cdf3e..fd969c5 100644 --- a/system/engine/exception.php +++ b/system/engine/exception.php @@ -20,6 +20,21 @@ class Exception extends \Exception { public $errorFormat = 'text'; + protected $heritageTrace = false; + + /** + * + * @param \Exception $object + * @return $this + */ + public function setObject(\Exception $object){ + $this->message = $object->getMessage(); + $this->line = $object->getLine(); + $this->heritageTrace = $object->getTrace(); + $this->file = $object->getFile(); + return $this; + } + /** * Save the exceptions in the exceptions log file * @return void @@ -35,7 +50,7 @@ class Exception extends \Exception 'error' => $this->getMessage(), 'line' => $this->getLine(), 'file' => $this->getFile(), - 'trace' => ($debugging) ? (($this->errorFormat == 'json') ? $this->getTrace() : Debug::trace($this->getTrace())) : null + 'trace' => ($debugging) ? (($this->errorFormat == 'json') ? ($this->heritageTrace ?: $this->getTrace()) : Debug::trace(($this->heritageTrace ?: $this->getTrace()))) : null ]; $log->write(($this->errorFormat == 'json') ? json_encode($errorStamp) : implode(PHP_EOL, array_map( ['self','convertArray'], diff --git a/system/engine/loader.php b/system/engine/loader.php index e710453..920a5fd 100644 --- a/system/engine/loader.php +++ b/system/engine/loader.php @@ -40,8 +40,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { if (file_exists($file)) { return include_once($file); } else { - return trigger_error('Error: Could not load library ' . $library . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load library ' . $library . '!'); } } @@ -74,8 +73,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { $this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry)); } else { - trigger_error('Error: Could not load model ' . $model . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load model ' . $model . '!'); } } @@ -101,8 +99,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { $this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry)); */ } else { - trigger_error('Error: Could not load Helper ' . $helper . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load Helper ' . $helper . '!'); } } @@ -132,8 +129,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { $this->registry->set('controller_' . str_replace('/', '_', $control), new $class($this->registry)); } else { - trigger_error('Error: Could not load model ' . $control . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load model ' . $control . '!'); } } @@ -166,8 +162,7 @@ final class Loader implements \Phacil\Framework\Interfaces\Loader { return $database_name; } else { - trigger_error('Error: Could not load database ' . $driver . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load database ' . $driver . '!'); } } diff --git a/system/language/autoload.php b/system/language/autoload.php index f6e2ddc..b33c74a 100644 --- a/system/language/autoload.php +++ b/system/language/autoload.php @@ -35,8 +35,7 @@ final class Language return $this->data; } else { - trigger_error('Error: Could not load language ' . $filename . '!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Could not load language ' . $filename . '!'); } } } diff --git a/system/mail/mail.php b/system/mail/mail.php index 8f7a646..688a7f0 100644 --- a/system/mail/mail.php +++ b/system/mail/mail.php @@ -182,28 +182,23 @@ final class Mail { /** @return void */ public function send() { if (!$this->to) { - trigger_error('Error: E-Mail to required!'); - exit(); + throw new \Phacil\Framework\Exception('Error: E-Mail to required!'); } if (!$this->from) { - trigger_error('Error: E-Mail from required!'); - exit(); + throw new \Phacil\Framework\Exception('Error: E-Mail from required!'); } if (!$this->sender) { - trigger_error('Error: E-Mail sender required!'); - exit(); + throw new \Phacil\Framework\Exception('Error: E-Mail sender required!'); } if (!$this->subject) { - trigger_error('Error: E-Mail subject required!'); - exit(); + throw new \Phacil\Framework\Exception('Error: E-Mail subject required!'); } if ((!$this->text) && (!$this->html)) { - trigger_error('Error: E-Mail message required!'); - exit(); + throw new \Phacil\Framework\Exception('Error: E-Mail message required!'); } if (is_array($this->to)) { @@ -288,8 +283,7 @@ final class Mail { $handle = fsockopen($this->hostname, $this->port, $errno, $errstr, $this->timeout); if (!$handle) { - trigger_error('Error: ' . $errstr . ' (' . $errno . ')'); - exit(); + throw new \Phacil\Framework\Exception('Error: ' . $errstr . ' (' . $errno . ')'); } else { if (substr(PHP_OS, 0, 3) != 'WIN') { socket_set_timeout($handle, $this->timeout, 0); @@ -313,8 +307,7 @@ final class Mail { } if (substr($reply, 0, 3) != 220) { - trigger_error('Error: STARTTLS not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: STARTTLS not accepted from server!'); } } @@ -332,8 +325,7 @@ final class Mail { } if (substr($reply, 0, 3) != 250) { - trigger_error('Error: EHLO not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: EHLO not accepted from server!'); } fputs($handle, 'AUTH LOGIN' . $this->crlf); @@ -349,8 +341,7 @@ final class Mail { } if (substr($reply, 0, 3) != 334) { - trigger_error('Error: AUTH LOGIN not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: AUTH LOGIN not accepted from server!'); } fputs($handle, base64_encode($this->username) . $this->crlf); @@ -366,8 +357,7 @@ final class Mail { } if (substr($reply, 0, 3) != 334) { - trigger_error('Error: Username not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Username not accepted from server!'); } fputs($handle, base64_encode($this->password) . $this->crlf); @@ -383,8 +373,7 @@ final class Mail { } if (substr($reply, 0, 3) != 235) { - trigger_error('Error: Password not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: Password not accepted from server!'); } } else { fputs($handle, 'HELO ' . getenv('SERVER_NAME') . $this->crlf); @@ -400,8 +389,7 @@ final class Mail { } if (substr($reply, 0, 3) != 250) { - trigger_error('Error: HELO not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: HELO not accepted from server!'); } } @@ -422,8 +410,7 @@ final class Mail { } if (substr($reply, 0, 3) != 250) { - trigger_error('Error: MAIL FROM not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: MAIL FROM not accepted from server!'); } if (!is_array($this->to)) { @@ -440,8 +427,7 @@ final class Mail { } if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) { - trigger_error('Error: RCPT TO not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: RCPT TO not accepted from server!'); } } else { foreach ($this->to as $recipient) { @@ -458,8 +444,7 @@ final class Mail { } if ((substr($reply, 0, 3) != 250) && (substr($reply, 0, 3) != 251)) { - trigger_error('Error: RCPT TO not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: RCPT TO not accepted from server!'); } } } @@ -477,8 +462,7 @@ final class Mail { } if (substr($reply, 0, 3) != 354) { - trigger_error('Error: DATA not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: DATA not accepted from server!'); } // According to rfc 821 we should not send more than 1000 including the CRLF @@ -512,8 +496,7 @@ final class Mail { } if (substr($reply, 0, 3) != 250) { - trigger_error('Error: DATA not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: DATA not accepted from server!'); } fputs($handle, 'QUIT' . $this->crlf); @@ -529,8 +512,7 @@ final class Mail { } if (substr($reply, 0, 3) != 221) { - trigger_error('Error: QUIT not accepted from server!'); - exit(); + throw new \Phacil\Framework\Exception('Error: QUIT not accepted from server!'); } fclose($handle); diff --git a/system/system.php b/system/system.php index ca79ea1..7fc2e44 100644 --- a/system/system.php +++ b/system/system.php @@ -437,6 +437,9 @@ set_exception_handler(function($e) use ($engine) { echo '' . get_class($e) . ': ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . ''; } + $exception = new \Phacil\Framework\Exception(); + $exception->setObject($e); + if ($engine->config->get('config_error_log')) { $engine->log->write(get_class($e) . ': ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine()); } diff --git a/system/templateEngines/Twig/Twig1x/autoload.php b/system/templateEngines/Twig/Twig1x/autoload.php deleted file mode 100644 index 3f98022..0000000 --- a/system/templateEngines/Twig/Twig1x/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ -=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "twig/twig", + "version": "v1.41.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "575cd5028362da591facde1ef5d7b94553c375c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/575cd5028362da591facde1ef5d7b94553c375c9", + "reference": "575cd5028362da591facde1ef5d7b94553c375c9", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.41-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/1.x" + }, + "time": "2019-05-14T11:59:08+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.2.0" +} diff --git a/system/templateEngines/Twig/Twig1x/composer/ClassLoader.php b/system/templateEngines/Twig/Twig1x/composer/ClassLoader.php deleted file mode 100644 index fce8549..0000000 --- a/system/templateEngines/Twig/Twig1x/composer/ClassLoader.php +++ /dev/null @@ -1,445 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/system/templateEngines/Twig/Twig1x/composer/autoload_classmap.php b/system/templateEngines/Twig/Twig1x/composer/autoload_classmap.php deleted file mode 100644 index 7a91153..0000000 --- a/system/templateEngines/Twig/Twig1x/composer/autoload_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit09a276ab747dde32eaeb090fed801b7d::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit09a276ab747dde32eaeb090fed801b7d::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire09a276ab747dde32eaeb090fed801b7d($fileIdentifier, $file); - } - - return $loader; - } -} - -function composerRequire09a276ab747dde32eaeb090fed801b7d($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/system/templateEngines/Twig/Twig1x/composer/autoload_static.php b/system/templateEngines/Twig/Twig1x/composer/autoload_static.php deleted file mode 100644 index e84611e..0000000 --- a/system/templateEngines/Twig/Twig1x/composer/autoload_static.php +++ /dev/null @@ -1,54 +0,0 @@ - __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'T' => - array ( - 'Twig\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Ctype\\' => 23, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/src', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - ); - - public static $prefixesPsr0 = array ( - 'T' => - array ( - 'Twig_' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/lib', - ), - ), - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit09a276ab747dde32eaeb090fed801b7d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit09a276ab747dde32eaeb090fed801b7d::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit09a276ab747dde32eaeb090fed801b7d::$prefixesPsr0; - - }, null, ClassLoader::class); - } -} diff --git a/system/templateEngines/Twig/Twig1x/composer/installed.json b/system/templateEngines/Twig/Twig1x/composer/installed.json deleted file mode 100644 index cadff09..0000000 --- a/system/templateEngines/Twig/Twig1x/composer/installed.json +++ /dev/null @@ -1,128 +0,0 @@ -[ - { - "name": "symfony/polyfill-ctype", - "version": "v1.14.0", - "version_normalized": "1.14.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2020-01-13T11:15:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ] - }, - { - "name": "twig/twig", - "version": "v1.42.5", - "version_normalized": "1.42.5.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", - "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", - "shasum": "" - }, - "require": { - "php": ">=5.5.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.0" - }, - "time": "2020-02-11T05:59:23+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.42-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "https://twig.symfony.com", - "keywords": [ - "templating" - ] - } -] diff --git a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/bootstrap.php b/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/bootstrap.php deleted file mode 100644 index 14d1d0f..0000000 --- a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/bootstrap.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (!function_exists('ctype_alnum')) { - function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } - function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } - function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } - function ctype_digit($text) { return p\Ctype::ctype_digit($text); } - function ctype_graph($text) { return p\Ctype::ctype_graph($text); } - function ctype_lower($text) { return p\Ctype::ctype_lower($text); } - function ctype_print($text) { return p\Ctype::ctype_print($text); } - function ctype_punct($text) { return p\Ctype::ctype_punct($text); } - function ctype_space($text) { return p\Ctype::ctype_space($text); } - function ctype_upper($text) { return p\Ctype::ctype_upper($text); } - function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } -} diff --git a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/composer.json b/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/composer.json deleted file mode 100644 index 2596c74..0000000 --- a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/polyfill-ctype", - "type": "library", - "description": "Symfony polyfill for ctype functions", - "keywords": ["polyfill", "compatibility", "portable", "ctype"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - } -} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/.gitattributes b/system/templateEngines/Twig/Twig1x/twig/twig/.gitattributes deleted file mode 100644 index 3a3ce6e..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/tests export-ignore -/phpunit.xml.dist export-ignore diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/.gitignore b/system/templateEngines/Twig/Twig1x/twig/twig/.gitignore deleted file mode 100644 index 8a29959..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/build -/composer.lock -/ext/twig/autom4te.cache/ -/phpunit.xml -/vendor -.phpunit.result.cache diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/.php_cs.dist b/system/templateEngines/Twig/Twig1x/twig/twig/.php_cs.dist deleted file mode 100644 index b81882f..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/.php_cs.dist +++ /dev/null @@ -1,20 +0,0 @@ -setRules([ - '@Symfony' => true, - '@Symfony:risky' => true, - '@PHPUnit75Migration:risky' => true, - 'php_unit_dedicate_assert' => ['target' => '5.6'], - 'array_syntax' => ['syntax' => 'short'], - 'php_unit_fqcn_annotation' => true, - 'no_unreachable_default_argument_value' => false, - 'braces' => ['allow_single_line_closure' => true], - 'heredoc_to_nowdoc' => false, - 'ordered_imports' => true, - 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'], - ]) - ->setRiskyAllowed(true) - ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) -; diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/.travis.yml b/system/templateEngines/Twig/Twig1x/twig/twig/.travis.yml deleted file mode 100644 index ff6132b..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: php - -dist: trusty - -sudo: false - -cache: - directories: - - vendor - - $HOME/.composer/cache/files - - -env: - global: - - TWIG_EXT=no - - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 - -before_install: - - phpenv config-rm xdebug.ini || return 0 - -install: - - travis_retry composer install - -before_script: - - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi - - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi - -script: ./vendor/bin/simple-phpunit - -jobs: - fast_finish: true - include: - - php: 5.5 - - php: 5.5 - env: TWIG_EXT=yes - - php: 5.6 - - php: 5.6 - env: TWIG_EXT=yes - - php: 7.0 - - php: 7.1 - - php: 7.2 - - php: 7.3 - - php: 7.4snapshot - - stage: integration tests - php: 7.3 - script: ./drupal_test.sh diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/LICENSE b/system/templateEngines/Twig/Twig1x/twig/twig/LICENSE deleted file mode 100644 index 5e8a0b8..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2009-2020 by the Twig Team. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/README.rst b/system/templateEngines/Twig/Twig1x/twig/twig/README.rst deleted file mode 100644 index d896ff5..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/README.rst +++ /dev/null @@ -1,24 +0,0 @@ -Twig, the flexible, fast, and secure template language for PHP -============================================================== - -Twig is a template language for PHP, released under the new BSD license (code -and documentation). - -Twig uses a syntax similar to the Django and Jinja template languages which -inspired the Twig runtime environment. - -Sponsors --------- - -.. raw:: html - - - Blackfire.io - - -More Information ----------------- - -Read the `documentation`_ for more information. - -.. _documentation: https://twig.symfony.com/documentation diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/FilesystemCache.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/FilesystemCache.php deleted file mode 100644 index b7c1e43..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/FilesystemCache.php +++ /dev/null @@ -1,93 +0,0 @@ - - */ -class FilesystemCache implements CacheInterface -{ - const FORCE_BYTECODE_INVALIDATION = 1; - - private $directory; - private $options; - - /** - * @param string $directory The root cache directory - * @param int $options A set of options - */ - public function __construct($directory, $options = 0) - { - $this->directory = rtrim($directory, '\/').'/'; - $this->options = $options; - } - - public function generateKey($name, $className) - { - $hash = hash('sha256', $className); - - return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; - } - - public function load($key) - { - if (file_exists($key)) { - @include_once $key; - } - } - - public function write($key, $content) - { - $dir = \dirname($key); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - clearstatcache(true, $dir); - if (!is_dir($dir)) { - throw new \RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); - } - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); - } - - $tmpFile = tempnam($dir, basename($key)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { - @chmod($key, 0666 & ~umask()); - - if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { - // Compile cached file into bytecode cache - if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { - @opcache_invalidate($key, true); - } elseif (\function_exists('apc_compile_file')) { - apc_compile_file($key); - } - } - - return; - } - - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $key)); - } - - public function getTimestamp($key) - { - if (!file_exists($key)) { - return 0; - } - - return (int) @filemtime($key); - } -} - -class_alias('Twig\Cache\FilesystemCache', 'Twig_Cache_Filesystem'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Environment.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Environment.php deleted file mode 100644 index 97fa4c4..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Environment.php +++ /dev/null @@ -1,1638 +0,0 @@ - - */ -class Environment -{ - const VERSION = '1.42.5'; - const VERSION_ID = 14205; - const MAJOR_VERSION = 1; - const MINOR_VERSION = 42; - const RELEASE_VERSION = 5; - const EXTRA_VERSION = ''; - - protected $charset; - protected $loader; - protected $debug; - protected $autoReload; - protected $cache; - protected $lexer; - protected $parser; - protected $compiler; - protected $baseTemplateClass; - protected $extensions; - protected $parsers; - protected $visitors; - protected $filters; - protected $tests; - protected $functions; - protected $globals; - protected $runtimeInitialized = false; - protected $extensionInitialized = false; - protected $loadedTemplates; - protected $strictVariables; - protected $unaryOperators; - protected $binaryOperators; - protected $templateClassPrefix = '__TwigTemplate_'; - protected $functionCallbacks = []; - protected $filterCallbacks = []; - protected $staging; - - private $originalCache; - private $bcWriteCacheFile = false; - private $bcGetCacheFilename = false; - private $lastModifiedExtension = 0; - private $extensionsByClass = []; - private $runtimeLoaders = []; - private $runtimes = []; - private $optionsHash; - - /** - * Constructor. - * - * Available options: - * - * * debug: When set to true, it automatically set "auto_reload" to true as - * well (default to false). - * - * * charset: The charset used by the templates (default to UTF-8). - * - * * base_template_class: The base template class to use for generated - * templates (default to \Twig\Template). - * - * * cache: An absolute path where to store the compiled templates, - * a \Twig\Cache\CacheInterface implementation, - * or false to disable compilation cache (default). - * - * * auto_reload: Whether to reload the template if the original source changed. - * If you don't provide the auto_reload option, it will be - * determined automatically based on the debug value. - * - * * strict_variables: Whether to ignore invalid variables in templates - * (default to false). - * - * * autoescape: Whether to enable auto-escaping (default to html): - * * false: disable auto-escaping - * * true: equivalent to html - * * html, js: set the autoescaping to one of the supported strategies - * * name: set the autoescaping strategy based on the template name extension - * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" - * - * * optimizations: A flag that indicates which optimizations to apply - * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable). - */ - public function __construct(LoaderInterface $loader = null, $options = []) - { - if (null !== $loader) { - $this->setLoader($loader); - } else { - @trigger_error('Not passing a "Twig\Lodaer\LoaderInterface" as the first constructor argument of "Twig\Environment" is deprecated since version 1.21.', E_USER_DEPRECATED); - } - - $options = array_merge([ - 'debug' => false, - 'charset' => 'UTF-8', - 'base_template_class' => '\Twig\Template', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - ], $options); - - $this->debug = (bool) $options['debug']; - $this->charset = strtoupper($options['charset']); - $this->baseTemplateClass = $options['base_template_class']; - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; - $this->setCache($options['cache']); - - $this->addExtension(new CoreExtension()); - $this->addExtension(new EscaperExtension($options['autoescape'])); - $this->addExtension(new OptimizerExtension($options['optimizations'])); - $this->staging = new StagingExtension(); - - // For BC - if (\is_string($this->originalCache)) { - $r = new \ReflectionMethod($this, 'writeCacheFile'); - if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error('The Twig\Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); - - $this->bcWriteCacheFile = true; - } - - $r = new \ReflectionMethod($this, 'getCacheFilename'); - if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error('The Twig\Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); - - $this->bcGetCacheFilename = true; - } - } - } - - /** - * Gets the base template class for compiled templates. - * - * @return string The base template class name - */ - public function getBaseTemplateClass() - { - return $this->baseTemplateClass; - } - - /** - * Sets the base template class for compiled templates. - * - * @param string $class The base template class name - */ - public function setBaseTemplateClass($class) - { - $this->baseTemplateClass = $class; - $this->updateOptionsHash(); - } - - /** - * Enables debugging mode. - */ - public function enableDebug() - { - $this->debug = true; - $this->updateOptionsHash(); - } - - /** - * Disables debugging mode. - */ - public function disableDebug() - { - $this->debug = false; - $this->updateOptionsHash(); - } - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Enables the auto_reload option. - */ - public function enableAutoReload() - { - $this->autoReload = true; - } - - /** - * Disables the auto_reload option. - */ - public function disableAutoReload() - { - $this->autoReload = false; - } - - /** - * Checks if the auto_reload option is enabled. - * - * @return bool true if auto_reload is enabled, false otherwise - */ - public function isAutoReload() - { - return $this->autoReload; - } - - /** - * Enables the strict_variables option. - */ - public function enableStrictVariables() - { - $this->strictVariables = true; - $this->updateOptionsHash(); - } - - /** - * Disables the strict_variables option. - */ - public function disableStrictVariables() - { - $this->strictVariables = false; - $this->updateOptionsHash(); - } - - /** - * Checks if the strict_variables option is enabled. - * - * @return bool true if strict_variables is enabled, false otherwise - */ - public function isStrictVariables() - { - return $this->strictVariables; - } - - /** - * Gets the current cache implementation. - * - * @param bool $original Whether to return the original cache option or the real cache instance - * - * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function getCache($original = true) - { - return $original ? $this->originalCache : $this->cache; - } - - /** - * Sets the current cache implementation. - * - * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function setCache($cache) - { - if (\is_string($cache)) { - $this->originalCache = $cache; - $this->cache = new FilesystemCache($cache); - } elseif (false === $cache) { - $this->originalCache = $cache; - $this->cache = new NullCache(); - } elseif (null === $cache) { - @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); - $this->originalCache = false; - $this->cache = new NullCache(); - } elseif ($cache instanceof CacheInterface) { - $this->originalCache = $this->cache = $cache; - } else { - throw new \LogicException(sprintf('Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation.')); - } - } - - /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * - * @return string|false The cache file name or false when caching is disabled - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function getCacheFilename($name) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - $key = $this->cache->generateKey($name, $this->getTemplateClass($name)); - - return !$key ? false : $key; - } - - /** - * Gets the template class associated with the given string. - * - * The generated template class is based on the following parameters: - * - * * The cache key for the given template; - * * The currently enabled extensions; - * * Whether the Twig C extension is available or not; - * * PHP version; - * * Twig version; - * * Options with what environment was created. - * - * @param string $name The name for which to calculate the template class name - * @param int|null $index The index if it is an embedded template - * - * @return string The template class name - */ - public function getTemplateClass($name, $index = null) - { - $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; - - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index); - } - - /** - * Gets the template class prefix. - * - * @return string The template class prefix - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function getTemplateClassPrefix() - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - return $this->templateClassPrefix; - } - - /** - * Renders a template. - * - * @param string|TemplateWrapper $name The template name - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - * @throws RuntimeError When an error occurred during rendering - */ - public function render($name, array $context = []) - { - return $this->load($name)->render($context); - } - - /** - * Displays a template. - * - * @param string|TemplateWrapper $name The template name - * @param array $context An array of parameters to pass to the template - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - * @throws RuntimeError When an error occurred during rendering - */ - public function display($name, array $context = []) - { - $this->load($name)->display($context); - } - - /** - * Loads a template. - * - * @param string|TemplateWrapper|\Twig\Template $name The template name - * - * @throws LoaderError When the template cannot be found - * @throws RuntimeError When a previously generated cache is corrupted - * @throws SyntaxError When an error occurred during compilation - * - * @return TemplateWrapper - */ - public function load($name) - { - if ($name instanceof TemplateWrapper) { - return $name; - } - - if ($name instanceof Template) { - return new TemplateWrapper($this, $name); - } - - return new TemplateWrapper($this, $this->loadTemplate($name)); - } - - /** - * Loads a template internal representation. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The template name - * @param int $index The index if it is an embedded template - * - * @return \Twig_TemplateInterface A template instance representing the given template name - * - * @throws LoaderError When the template cannot be found - * @throws RuntimeError When a previously generated cache is corrupted - * @throws SyntaxError When an error occurred during compilation - * - * @internal - */ - public function loadTemplate($name, $index = null) - { - return $this->loadClass($this->getTemplateClass($name), $name, $index); - } - - /** - * @internal - */ - public function loadClass($cls, $name, $index = null) - { - $mainCls = $cls; - if (null !== $index) { - $cls .= '___'.$index; - } - - if (isset($this->loadedTemplates[$cls])) { - return $this->loadedTemplates[$cls]; - } - - if (!class_exists($cls, false)) { - if ($this->bcGetCacheFilename) { - $key = $this->getCacheFilename($name); - } else { - $key = $this->cache->generateKey($name, $mainCls); - } - - if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { - $this->cache->load($key); - } - - $source = null; - if (!class_exists($cls, false)) { - $loader = $this->getLoader(); - if (!$loader instanceof SourceContextLoaderInterface) { - $source = new Source($loader->getSource($name), $name); - } else { - $source = $loader->getSourceContext($name); - } - - $content = $this->compileSource($source); - - if ($this->bcWriteCacheFile) { - $this->writeCacheFile($key, $content); - } else { - $this->cache->write($key, $content); - $this->cache->load($key); - } - - if (!class_exists($mainCls, false)) { - /* Last line of defense if either $this->bcWriteCacheFile was used, - * $this->cache is implemented as a no-op or we have a race condition - * where the cache was cleared between the above calls to write to and load from - * the cache. - */ - eval('?>'.$content); - } - } - - if (!class_exists($cls, false)) { - throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); - } - } - - if (!$this->runtimeInitialized) { - $this->initRuntime(); - } - - return $this->loadedTemplates[$cls] = new $cls($this); - } - - /** - * Creates a template from source. - * - * This method should not be used as a generic way to load templates. - * - * @param string $template The template source - * @param string $name An optional name of the template to be used in error messages - * - * @return TemplateWrapper A template instance representing the given template name - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - */ - public function createTemplate($template, $name = null) - { - $hash = hash('sha256', $template, false); - if (null !== $name) { - $name = sprintf('%s (string template %s)', $name, $hash); - } else { - $name = sprintf('__string_template__%s', $hash); - } - - $loader = new ChainLoader([ - new ArrayLoader([$name => $template]), - $current = $this->getLoader(), - ]); - - $this->setLoader($loader); - try { - $template = new TemplateWrapper($this, $this->loadTemplate($name)); - } catch (\Exception $e) { - $this->setLoader($current); - - throw $e; - } catch (\Throwable $e) { - $this->setLoader($current); - - throw $e; - } - $this->setLoader($current); - - return $template; - } - - /** - * Returns true if the template is still fresh. - * - * Besides checking the loader for freshness information, - * this method also checks if the enabled extensions have - * not changed. - * - * @param string $name The template name - * @param int $time The last modification time of the cached template - * - * @return bool true if the template is fresh, false otherwise - */ - public function isTemplateFresh($name, $time) - { - if (0 === $this->lastModifiedExtension) { - foreach ($this->extensions as $extension) { - $r = new \ReflectionObject($extension); - if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) { - $this->lastModifiedExtension = $extensionTime; - } - } - } - - return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time); - } - - /** - * Tries to load a template consecutively from an array. - * - * Similar to load() but it also accepts instances of \Twig\Template and - * \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded. - * - * @param string|Template|\Twig\TemplateWrapper|array $names A template or an array of templates to try consecutively - * - * @return TemplateWrapper|Template - * - * @throws LoaderError When none of the templates can be found - * @throws SyntaxError When an error occurred during compilation - */ - public function resolveTemplate($names) - { - if (!\is_array($names)) { - $names = [$names]; - } - - foreach ($names as $name) { - if ($name instanceof Template) { - return $name; - } - if ($name instanceof TemplateWrapper) { - return $name; - } - - try { - return $this->loadTemplate($name); - } catch (LoaderError $e) { - if (1 === \count($names)) { - throw $e; - } - } - } - - throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); - } - - /** - * Clears the internal template cache. - * - * @deprecated since 1.18.3 (to be removed in 2.0) - */ - public function clearTemplateCache() - { - @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); - - $this->loadedTemplates = []; - } - - /** - * Clears the template cache files on the filesystem. - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function clearCacheFiles() - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - if (\is_string($this->originalCache)) { - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->originalCache), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($file->isFile()) { - @unlink($file->getPathname()); - } - } - } - } - - /** - * Gets the Lexer instance. - * - * @return \Twig_LexerInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getLexer() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->lexer) { - $this->lexer = new Lexer($this); - } - - return $this->lexer; - } - - public function setLexer(\Twig_LexerInterface $lexer) - { - $this->lexer = $lexer; - } - - /** - * Tokenizes a source code. - * - * @param string|Source $source The template source code - * @param string $name The template name (deprecated) - * - * @return TokenStream - * - * @throws SyntaxError When the code is syntactically wrong - */ - public function tokenize($source, $name = null) - { - if (!$source instanceof Source) { - @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $source = new Source($source, $name); - } - - if (null === $this->lexer) { - $this->lexer = new Lexer($this); - } - - return $this->lexer->tokenize($source); - } - - /** - * Gets the Parser instance. - * - * @return \Twig_ParserInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getParser() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->parser) { - $this->parser = new Parser($this); - } - - return $this->parser; - } - - public function setParser(\Twig_ParserInterface $parser) - { - $this->parser = $parser; - } - - /** - * Converts a token stream to a node tree. - * - * @return ModuleNode - * - * @throws SyntaxError When the token stream is syntactically or semantically wrong - */ - public function parse(TokenStream $stream) - { - if (null === $this->parser) { - $this->parser = new Parser($this); - } - - return $this->parser->parse($stream); - } - - /** - * Gets the Compiler instance. - * - * @return \Twig_CompilerInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getCompiler() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->compiler) { - $this->compiler = new Compiler($this); - } - - return $this->compiler; - } - - public function setCompiler(\Twig_CompilerInterface $compiler) - { - $this->compiler = $compiler; - } - - /** - * Compiles a node and returns the PHP code. - * - * @return string The compiled PHP source code - */ - public function compile(\Twig_NodeInterface $node) - { - if (null === $this->compiler) { - $this->compiler = new Compiler($this); - } - - return $this->compiler->compile($node)->getSource(); - } - - /** - * Compiles a template source code. - * - * @param string|Source $source The template source code - * @param string $name The template name (deprecated) - * - * @return string The compiled PHP source code - * - * @throws SyntaxError When there was an error during tokenizing, parsing or compiling - */ - public function compileSource($source, $name = null) - { - if (!$source instanceof Source) { - @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $source = new Source($source, $name); - } - - try { - return $this->compile($this->parse($this->tokenize($source))); - } catch (Error $e) { - $e->setSourceContext($source); - throw $e; - } catch (\Exception $e) { - throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); - } - } - - public function setLoader(LoaderInterface $loader) - { - if (!$loader instanceof SourceContextLoaderInterface && 0 !== strpos(\get_class($loader), 'Mock_')) { - @trigger_error(sprintf('Twig loader "%s" should implement Twig\Loader\SourceContextLoaderInterface since version 1.27.', \get_class($loader)), E_USER_DEPRECATED); - } - - $this->loader = $loader; - } - - /** - * Gets the Loader instance. - * - * @return LoaderInterface - */ - public function getLoader() - { - if (null === $this->loader) { - throw new \LogicException('You must set a loader first.'); - } - - return $this->loader; - } - - /** - * Sets the default template charset. - * - * @param string $charset The default charset - */ - public function setCharset($charset) - { - $this->charset = strtoupper($charset); - } - - /** - * Gets the default template charset. - * - * @return string The default charset - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Initializes the runtime environment. - * - * @deprecated since 1.23 (to be removed in 2.0) - */ - public function initRuntime() - { - $this->runtimeInitialized = true; - - foreach ($this->getExtensions() as $name => $extension) { - if (!$extension instanceof InitRuntimeInterface) { - $m = new \ReflectionMethod($extension, 'initRuntime'); - - $parentClass = $m->getDeclaringClass()->getName(); - if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { - @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the \Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig\Extension\InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED); - } - } - - $extension->initRuntime($this); - } - } - - /** - * Returns true if the given extension is registered. - * - * @param string $class The extension class name - * - * @return bool Whether the extension is registered or not - */ - public function hasExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new \ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== \get_class($this->extensions[$class])) { - @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); - } - - return true; - } - - return isset($this->extensionsByClass[$class]); - } - - /** - * Adds a runtime loader. - */ - public function addRuntimeLoader(RuntimeLoaderInterface $loader) - { - $this->runtimeLoaders[] = $loader; - } - - /** - * Gets an extension by class name. - * - * @param string $class The extension class name - * - * @return ExtensionInterface - */ - public function getExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new \ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== \get_class($this->extensions[$class])) { - @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); - } - - return $this->extensions[$class]; - } - - if (!isset($this->extensionsByClass[$class])) { - throw new RuntimeError(sprintf('The "%s" extension is not enabled.', $class)); - } - - return $this->extensionsByClass[$class]; - } - - /** - * Returns the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class name - * - * @return object The runtime implementation - * - * @throws RuntimeError When the template cannot be found - */ - public function getRuntime($class) - { - if (isset($this->runtimes[$class])) { - return $this->runtimes[$class]; - } - - foreach ($this->runtimeLoaders as $loader) { - if (null !== $runtime = $loader->load($class)) { - return $this->runtimes[$class] = $runtime; - } - } - - throw new RuntimeError(sprintf('Unable to load the "%s" runtime.', $class)); - } - - public function addExtension(ExtensionInterface $extension) - { - if ($this->extensionInitialized) { - throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); - } - - $class = \get_class($extension); - if ($class !== $extension->getName()) { - if (isset($this->extensions[$extension->getName()])) { - unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]); - @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); - } - } - - $this->lastModifiedExtension = 0; - $this->extensionsByClass[$class] = $extension; - $this->extensions[$extension->getName()] = $extension; - $this->updateOptionsHash(); - } - - /** - * Removes an extension by name. - * - * This method is deprecated and you should not use it. - * - * @param string $name The extension name - * - * @deprecated since 1.12 (to be removed in 2.0) - */ - public function removeExtension($name) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - if ($this->extensionInitialized) { - throw new \LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); - } - - $class = ltrim($name, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new \ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== \get_class($this->extensions[$class])) { - @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); - } - - unset($this->extensions[$class]); - } - - unset($this->extensions[$class]); - $this->updateOptionsHash(); - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - foreach ($extensions as $extension) { - $this->addExtension($extension); - } - } - - /** - * Returns all registered extensions. - * - * @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) - */ - public function getExtensions() - { - return $this->extensions; - } - - public function addTokenParser(TokenParserInterface $parser) - { - if ($this->extensionInitialized) { - throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); - } - - $this->staging->addTokenParser($parser); - } - - /** - * Gets the registered Token Parsers. - * - * @return \Twig_TokenParserBrokerInterface - * - * @internal - */ - public function getTokenParsers() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->parsers; - } - - /** - * Gets registered tags. - * - * Be warned that this method cannot return tags defined by \Twig_TokenParserBrokerInterface classes. - * - * @return TokenParserInterface[] - * - * @internal - */ - public function getTags() - { - $tags = []; - foreach ($this->getTokenParsers()->getParsers() as $parser) { - if ($parser instanceof TokenParserInterface) { - $tags[$parser->getTag()] = $parser; - } - } - - return $tags; - } - - public function addNodeVisitor(NodeVisitorInterface $visitor) - { - if ($this->extensionInitialized) { - throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); - } - - $this->staging->addNodeVisitor($visitor); - } - - /** - * Gets the registered Node Visitors. - * - * @return NodeVisitorInterface[] - * - * @internal - */ - public function getNodeVisitors() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->visitors; - } - - /** - * Registers a Filter. - * - * @param string|TwigFilter $name The filter name or a \Twig_SimpleFilter instance - * @param \Twig_FilterInterface|TwigFilter $filter - */ - public function addFilter($name, $filter = null) - { - if (!$name instanceof TwigFilter && !($filter instanceof TwigFilter || $filter instanceof \Twig_FilterInterface)) { - throw new \LogicException('A filter must be an instance of \Twig_FilterInterface or \Twig_SimpleFilter.'); - } - - if ($name instanceof TwigFilter) { - $filter = $name; - $name = $filter->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new \LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addFilter($name, $filter); - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return \Twig_Filter|false - * - * @internal - */ - public function getFilter($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->filters[$name])) { - return $this->filters[$name]; - } - - foreach ($this->filters as $pattern => $filter) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $filter->setArguments($matches); - - return $filter; - } - } - } - - foreach ($this->filterCallbacks as $callback) { - if (false !== $filter = \call_user_func($callback, $name)) { - return $filter; - } - } - - return false; - } - - public function registerUndefinedFilterCallback($callable) - { - $this->filterCallbacks[] = $callable; - } - - /** - * Gets the registered Filters. - * - * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. - * - * @return \Twig_FilterInterface[] - * - * @see registerUndefinedFilterCallback - * - * @internal - */ - public function getFilters() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->filters; - } - - /** - * Registers a Test. - * - * @param string|TwigTest $name The test name or a \Twig_SimpleTest instance - * @param \Twig_TestInterface|TwigTest $test A \Twig_TestInterface instance or a \Twig_SimpleTest instance - */ - public function addTest($name, $test = null) - { - if (!$name instanceof TwigTest && !($test instanceof TwigTest || $test instanceof \Twig_TestInterface)) { - throw new \LogicException('A test must be an instance of \Twig_TestInterface or \Twig_SimpleTest.'); - } - - if ($name instanceof TwigTest) { - $test = $name; - $name = $test->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new \LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addTest($name, $test); - } - - /** - * Gets the registered Tests. - * - * @return \Twig_TestInterface[] - * - * @internal - */ - public function getTests() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->tests; - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return \Twig_Test|false - * - * @internal - */ - public function getTest($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->tests[$name])) { - return $this->tests[$name]; - } - - foreach ($this->tests as $pattern => $test) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $test->setArguments($matches); - - return $test; - } - } - } - - return false; - } - - /** - * Registers a Function. - * - * @param string|TwigFunction $name The function name or a \Twig_SimpleFunction instance - * @param \Twig_FunctionInterface|TwigFunction $function - */ - public function addFunction($name, $function = null) - { - if (!$name instanceof TwigFunction && !($function instanceof TwigFunction || $function instanceof \Twig_FunctionInterface)) { - throw new \LogicException('A function must be an instance of \Twig_FunctionInterface or \Twig_SimpleFunction.'); - } - - if ($name instanceof TwigFunction) { - $function = $name; - $name = $function->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new \LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addFunction($name, $function); - } - - /** - * Get a function by name. - * - * Subclasses may override this method and load functions differently; - * so no list of functions is available. - * - * @param string $name function name - * - * @return \Twig_Function|false - * - * @internal - */ - public function getFunction($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->functions[$name])) { - return $this->functions[$name]; - } - - foreach ($this->functions as $pattern => $function) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $function->setArguments($matches); - - return $function; - } - } - } - - foreach ($this->functionCallbacks as $callback) { - if (false !== $function = \call_user_func($callback, $name)) { - return $function; - } - } - - return false; - } - - public function registerUndefinedFunctionCallback($callable) - { - $this->functionCallbacks[] = $callable; - } - - /** - * Gets registered functions. - * - * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. - * - * @return \Twig_FunctionInterface[] - * - * @see registerUndefinedFunctionCallback - * - * @internal - */ - public function getFunctions() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->functions; - } - - /** - * Registers a Global. - * - * New globals can be added before compiling or rendering a template; - * but after, you can only update existing globals. - * - * @param string $name The global name - * @param mixed $value The global value - */ - public function addGlobal($name, $value) - { - if ($this->extensionInitialized || $this->runtimeInitialized) { - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - if (!\array_key_exists($name, $this->globals)) { - // The deprecation notice must be turned into the following exception in Twig 2.0 - @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); - //throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); - } - } - - if ($this->extensionInitialized || $this->runtimeInitialized) { - // update the value - $this->globals[$name] = $value; - } else { - $this->staging->addGlobal($name, $value); - } - } - - /** - * Gets the registered Globals. - * - * @return array An array of globals - * - * @internal - */ - public function getGlobals() - { - if (!$this->runtimeInitialized && !$this->extensionInitialized) { - return $this->initGlobals(); - } - - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - return $this->globals; - } - - /** - * Merges a context with the defined globals. - * - * @param array $context An array representing the context - * - * @return array The context merged with the globals - */ - public function mergeGlobals(array $context) - { - // we don't use array_merge as the context being generally - // bigger than globals, this code is faster. - foreach ($this->getGlobals() as $key => $value) { - if (!\array_key_exists($key, $context)) { - $context[$key] = $value; - } - } - - return $context; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - * - * @internal - */ - public function getUnaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - * - * @internal - */ - public function getBinaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->binaryOperators; - } - - /** - * @deprecated since 1.23 (to be removed in 2.0) - */ - public function computeAlternatives($name, $items) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - return SyntaxError::computeAlternatives($name, $items); - } - - /** - * @internal - */ - protected function initGlobals() - { - $globals = []; - foreach ($this->extensions as $name => $extension) { - if (!$extension instanceof GlobalsInterface) { - $m = new \ReflectionMethod($extension, 'getGlobals'); - - $parentClass = $m->getDeclaringClass()->getName(); - if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { - @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig\Extension\GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED); - } - } - - $extGlob = $extension->getGlobals(); - if (!\is_array($extGlob)) { - throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); - } - - $globals[] = $extGlob; - } - - $globals[] = $this->staging->getGlobals(); - - return \call_user_func_array('array_merge', $globals); - } - - /** - * @internal - */ - protected function initExtensions() - { - if ($this->extensionInitialized) { - return; - } - - $this->parsers = new \Twig_TokenParserBroker([], [], false); - $this->filters = []; - $this->functions = []; - $this->tests = []; - $this->visitors = []; - $this->unaryOperators = []; - $this->binaryOperators = []; - - foreach ($this->extensions as $extension) { - $this->initExtension($extension); - } - $this->initExtension($this->staging); - // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception - $this->extensionInitialized = true; - } - - /** - * @internal - */ - protected function initExtension(ExtensionInterface $extension) - { - // filters - foreach ($extension->getFilters() as $name => $filter) { - if ($filter instanceof TwigFilter) { - $name = $filter->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use \Twig_SimpleFilter instead.', \get_class($filter), $name), E_USER_DEPRECATED); - } - - $this->filters[$name] = $filter; - } - - // functions - foreach ($extension->getFunctions() as $name => $function) { - if ($function instanceof TwigFunction) { - $name = $function->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use \Twig_SimpleFunction instead.', \get_class($function), $name), E_USER_DEPRECATED); - } - - $this->functions[$name] = $function; - } - - // tests - foreach ($extension->getTests() as $name => $test) { - if ($test instanceof TwigTest) { - $name = $test->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use \Twig_SimpleTest instead.', \get_class($test), $name), E_USER_DEPRECATED); - } - - $this->tests[$name] = $test; - } - - // token parsers - foreach ($extension->getTokenParsers() as $parser) { - if ($parser instanceof TokenParserInterface) { - $this->parsers->addTokenParser($parser); - } elseif ($parser instanceof \Twig_TokenParserBrokerInterface) { - @trigger_error('Registering a \Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED); - - $this->parsers->addTokenParserBroker($parser); - } else { - throw new \LogicException('getTokenParsers() must return an array of \Twig_TokenParserInterface or \Twig_TokenParserBrokerInterface instances.'); - } - } - - // node visitors - foreach ($extension->getNodeVisitors() as $visitor) { - $this->visitors[] = $visitor; - } - - // operators - if ($operators = $extension->getOperators()) { - if (!\is_array($operators)) { - throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators))); - } - - if (2 !== \count($operators)) { - throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); - } - - $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); - $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); - } - } - - /** - * @deprecated since 1.22 (to be removed in 2.0) - */ - protected function writeCacheFile($file, $content) - { - $this->cache->write($file, $content); - } - - private function updateOptionsHash() - { - $hashParts = array_merge( - array_keys($this->extensions), - [ - (int) \function_exists('twig_template_get_attributes'), - PHP_MAJOR_VERSION, - PHP_MINOR_VERSION, - self::VERSION, - (int) $this->debug, - $this->baseTemplateClass, - (int) $this->strictVariables, - ] - ); - $this->optionsHash = implode(':', $hashParts); - } -} - -class_alias('Twig\Environment', 'Twig_Environment'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/ExpressionParser.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/ExpressionParser.php deleted file mode 100644 index a3ff725..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/ExpressionParser.php +++ /dev/null @@ -1,834 +0,0 @@ - - * - * @internal - */ -class ExpressionParser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; - - protected $parser; - protected $unaryOperators; - protected $binaryOperators; - - private $env; - - public function __construct(Parser $parser, $env = null) - { - $this->parser = $parser; - - if ($env instanceof Environment) { - $this->env = $env; - $this->unaryOperators = $env->getUnaryOperators(); - $this->binaryOperators = $env->getBinaryOperators(); - } else { - @trigger_error('Passing the operators as constructor arguments to '.__METHOD__.' is deprecated since version 1.27. Pass the environment instead.', E_USER_DEPRECATED); - - $this->env = $parser->getEnvironment(); - $this->unaryOperators = func_get_arg(1); - $this->binaryOperators = func_get_arg(2); - } - } - - public function parseExpression($precedence = 0, $allowArrow = false) - { - if ($allowArrow && $arrow = $this->parseArrow()) { - return $arrow; - } - - $expr = $this->getPrimary(); - $token = $this->parser->getCurrentToken(); - while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - - if ('is not' === $token->getValue()) { - $expr = $this->parseNotTestExpression($expr); - } elseif ('is' === $token->getValue()) { - $expr = $this->parseTestExpression($expr); - } elseif (isset($op['callable'])) { - $expr = \call_user_func($op['callable'], $this->parser, $expr); - } else { - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $class = $op['class']; - $expr = new $class($expr, $expr1, $token->getLine()); - } - - $token = $this->parser->getCurrentToken(); - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - /** - * @return ArrowFunctionExpression|null - */ - private function parseArrow() - { - $stream = $this->parser->getStream(); - - // short array syntax (one argument, no parentheses)? - if ($stream->look(1)->test(Token::ARROW_TYPE)) { - $line = $stream->getCurrent()->getLine(); - $token = $stream->expect(Token::NAME_TYPE); - $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; - $stream->expect(Token::ARROW_TYPE); - - return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); - } - - // first, determine if we are parsing an arrow function by finding => (long form) - $i = 0; - if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, '(')) { - return null; - } - ++$i; - while (true) { - // variable name - ++$i; - if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ',')) { - break; - } - ++$i; - } - if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ')')) { - return null; - } - ++$i; - if (!$stream->look($i)->test(Token::ARROW_TYPE)) { - return null; - } - - // yes, let's parse it properly - $token = $stream->expect(Token::PUNCTUATION_TYPE, '('); - $line = $token->getLine(); - - $names = []; - while (true) { - $token = $stream->expect(Token::NAME_TYPE); - $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - $stream->expect(Token::PUNCTUATION_TYPE, ')'); - $stream->expect(Token::ARROW_TYPE); - - return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); - } - - protected function getPrimary() - { - $token = $this->parser->getCurrentToken(); - - if ($this->isUnary($token)) { - $operator = $this->unaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - $expr = $this->parseExpression($operator['precedence']); - $class = $operator['class']; - - return $this->parsePostfixExpression(new $class($expr, $token->getLine())); - } elseif ($token->test(Token::PUNCTUATION_TYPE, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - protected function parseConditionalExpression($expr) - { - while ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, '?')) { - if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { - $expr3 = $this->parseExpression(); - } else { - $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); - } - } else { - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); - } - - return $expr; - } - - protected function isUnary(Token $token) - { - return $token->test(Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); - } - - protected function isBinary(Token $token) - { - return $token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case Token::NAME_TYPE: - $this->parser->getStream()->next(); - switch ($token->getValue()) { - case 'true': - case 'TRUE': - $node = new ConstantExpression(true, $token->getLine()); - break; - - case 'false': - case 'FALSE': - $node = new ConstantExpression(false, $token->getLine()); - break; - - case 'none': - case 'NONE': - case 'null': - case 'NULL': - $node = new ConstantExpression(null, $token->getLine()); - break; - - default: - if ('(' === $this->parser->getCurrentToken()->getValue()) { - $node = $this->getFunctionNode($token->getValue(), $token->getLine()); - } else { - $node = new NameExpression($token->getValue(), $token->getLine()); - } - } - break; - - case Token::NUMBER_TYPE: - $this->parser->getStream()->next(); - $node = new ConstantExpression($token->getValue(), $token->getLine()); - break; - - case Token::STRING_TYPE: - case Token::INTERPOLATION_START_TYPE: - $node = $this->parseStringExpression(); - break; - - case Token::OPERATOR_TYPE: - if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - $node = new NameExpression($token->getValue(), $token->getLine()); - break; - } elseif (isset($this->unaryOperators[$token->getValue()])) { - $class = $this->unaryOperators[$token->getValue()]['class']; - - $ref = new \ReflectionClass($class); - $negClass = 'Twig\Node\Expression\Unary\NegUnary'; - $posClass = 'Twig\Node\Expression\Unary\PosUnary'; - if (!(\in_array($ref->getName(), [$negClass, $posClass, 'Twig_Node_Expression_Unary_Neg', 'Twig_Node_Expression_Unary_Pos']) - || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass) - || $ref->isSubclassOf('Twig_Node_Expression_Unary_Neg') || $ref->isSubclassOf('Twig_Node_Expression_Unary_Pos')) - ) { - throw new SyntaxError(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - - $this->parser->getStream()->next(); - $expr = $this->parsePrimaryExpression(); - - $node = new $class($expr, $token->getLine()); - break; - } - - // no break - default: - if ($token->test(Token::PUNCTUATION_TYPE, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseHashExpression(); - } elseif ($token->test(Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { - throw new SyntaxError(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } else { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseStringExpression() - { - $stream = $this->parser->getStream(); - - $nodes = []; - // a string cannot be followed by another string in a single expression - $nextCanBeString = true; - while (true) { - if ($nextCanBeString && $token = $stream->nextIf(Token::STRING_TYPE)) { - $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->nextIf(Token::INTERPOLATION_START_TYPE)) { - $nodes[] = $this->parseExpression(); - $stream->expect(Token::INTERPOLATION_END_TYPE); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); - } - - return $expr; - } - - public function parseArrayExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if (($token = $stream->nextIf(Token::STRING_TYPE)) || ($token = $stream->nextIf(Token::NAME_TYPE)) || $token = $stream->nextIf(Token::NUMBER_TYPE)) { - $key = new ConstantExpression($token->getValue(), $token->getLine()); - } elseif ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new SyntaxError(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".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); - } - - $stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - while (true) { - $token = $this->parser->getCurrentToken(); - if (Token::PUNCTUATION_TYPE == $token->getType()) { - if ('.' == $token->getValue() || '[' == $token->getValue()) { - $node = $this->parseSubscriptExpression($node); - } elseif ('|' == $token->getValue()) { - $node = $this->parseFilterExpression($node); - } else { - break; - } - } else { - break; - } - } - - return $node; - } - - public function getFunctionNode($name, $line) - { - switch ($name) { - case 'parent': - $this->parseArguments(); - if (!\count($this->parser->getBlockStack())) { - throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - return new ParentExpression($this->parser->peekBlockStack(), $line); - case 'block': - $args = $this->parseArguments(); - if (\count($args) < 1) { - throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); - case 'attribute': - $args = $this->parseArguments(); - if (\count($args) < 2) { - throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, Template::ANY_CALL, $line); - default: - if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { - $arguments = new ArrayExpression([], $line); - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - - $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); - $node->setAttribute('safe', true); - - return $node; - } - - $args = $this->parseArguments(true); - $class = $this->getFunctionNodeClass($name, $line); - - return new $class($name, $args, $line); - } - } - - public function parseSubscriptExpression($node) - { - $stream = $this->parser->getStream(); - $token = $stream->next(); - $lineno = $token->getLine(); - $arguments = new ArrayExpression([], $lineno); - $type = Template::ANY_CALL; - if ('.' == $token->getValue()) { - $token = $stream->next(); - if ( - Token::NAME_TYPE == $token->getType() - || - Token::NUMBER_TYPE == $token->getType() - || - (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new ConstantExpression($token->getValue(), $lineno); - - if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $type = Template::METHOD_CALL; - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - } - } else { - throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); - } - - if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { - if (!$arg instanceof ConstantExpression) { - throw new SyntaxError(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); - } - - $name = $arg->getAttribute('value'); - - if ($this->parser->isReservedMacroName($name)) { - throw new SyntaxError(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); - } - - $node = new MethodCallExpression($node, 'get'.$name, $arguments, $lineno); - $node->setAttribute('safe', true); - - return $node; - } - } else { - $type = Template::ARRAY_CALL; - - // slice? - $slice = false; - if ($stream->test(Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - $arg = new ConstantExpression(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - } - - if ($slice) { - if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { - $length = new ConstantExpression(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $class = $this->getFilterNodeClass('slice', $token->getLine()); - $arguments = new Node([$arg, $length]); - $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); - - $stream->expect(Token::PUNCTUATION_TYPE, ']'); - - return $filter; - } - - $stream->expect(Token::PUNCTUATION_TYPE, ']'); - } - - return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node, $tag = null) - { - while (true) { - $token = $this->parser->getStream()->expect(Token::NAME_TYPE); - - $name = new ConstantExpression($token->getValue(), $token->getLine()); - if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '(')) { - $arguments = new Node(); - } else { - $arguments = $this->parseArguments(true, false, true); - } - - $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); - - $node = new $class($node, $name, $arguments, $token->getLine(), $tag); - - if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '|')) { - break; - } - - $this->parser->getStream()->next(); - } - - return $node; - } - - /** - * Parses arguments. - * - * @param bool $namedArguments Whether to allow named arguments or not - * @param bool $definition Whether we are parsing arguments for a function definition - * - * @return Node - * - * @throws SyntaxError - */ - public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) - { - $args = []; - $stream = $this->parser->getStream(); - - $stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); - } - - if ($definition) { - $token = $stream->expect(Token::NAME_TYPE, null, 'An argument must be a name'); - $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); - } else { - $value = $this->parseExpression(0, $allowArrow); - } - - $name = null; - if ($namedArguments && $token = $stream->nextIf(Token::OPERATOR_TYPE, '=')) { - if (!$value instanceof NameExpression) { - throw new SyntaxError(sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); - } - $name = $value->getAttribute('name'); - - if ($definition) { - $value = $this->parsePrimaryExpression(); - - if (!$this->checkConstantExpression($value)) { - throw new SyntaxError(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); - } - } else { - $value = $this->parseExpression(0, $allowArrow); - } - } - - if ($definition) { - if (null === $name) { - $name = $value->getAttribute('name'); - $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Node($args); - } - - public function parseAssignmentExpression() - { - $stream = $this->parser->getStream(); - $targets = []; - while (true) { - $token = $this->parser->getCurrentToken(); - if ($stream->test(Token::OPERATOR_TYPE) && preg_match(Lexer::REGEX_NAME, $token->getValue())) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - } else { - $stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to'); - } - $value = $token->getValue(); - if (\in_array(strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) { - throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); - } - $targets[] = new AssignNameExpression($value, $token->getLine()); - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = []; - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Node($targets); - } - - private function parseNotTestExpression(\Twig_NodeInterface $node) - { - return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); - } - - private function parseTestExpression(\Twig_NodeInterface $node) - { - $stream = $this->parser->getStream(); - list($name, $test) = $this->getTest($node->getTemplateLine()); - - $class = $this->getTestNodeClass($test); - $arguments = null; - if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $arguments = $this->parseArguments(true); - } - - return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); - } - - private function getTest($line) - { - $stream = $this->parser->getStream(); - $name = $stream->expect(Token::NAME_TYPE)->getValue(); - - if ($test = $this->env->getTest($name)) { - return [$name, $test]; - } - - if ($stream->test(Token::NAME_TYPE)) { - // try 2-words tests - $name = $name.' '.$this->parser->getCurrentToken()->getValue(); - - if ($test = $this->env->getTest($name)) { - $stream->next(); - - return [$name, $test]; - } - } - - $e = new SyntaxError(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getTests())); - - throw $e; - } - - private function getTestNodeClass($test) - { - if ($test instanceof TwigTest && $test->isDeprecated()) { - $stream = $this->parser->getStream(); - $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); - if (!\is_bool($test->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); - } - if ($test->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $test->getAlternative()); - } - $src = $stream->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine()); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($test instanceof TwigTest) { - return $test->getNodeClass(); - } - - return $test instanceof \Twig_Test_Node ? $test->getClass() : 'Twig\Node\Expression\TestExpression'; - } - - protected function getFunctionNodeClass($name, $line) - { - if (false === $function = $this->env->getFunction($name)) { - $e = new SyntaxError(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFunctions())); - - throw $e; - } - - if ($function instanceof TwigFunction && $function->isDeprecated()) { - $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); - if (!\is_bool($function->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); - } - if ($function->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $function->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($function instanceof TwigFunction) { - return $function->getNodeClass(); - } - - return $function instanceof \Twig_Function_Node ? $function->getClass() : 'Twig\Node\Expression\FunctionExpression'; - } - - protected function getFilterNodeClass($name, $line) - { - if (false === $filter = $this->env->getFilter($name)) { - $e = new SyntaxError(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFilters())); - - throw $e; - } - - if ($filter instanceof TwigFilter && $filter->isDeprecated()) { - $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); - if (!\is_bool($filter->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); - } - if ($filter->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($filter instanceof TwigFilter) { - return $filter->getNodeClass(); - } - - return $filter instanceof \Twig_Filter_Node ? $filter->getClass() : 'Twig\Node\Expression\FilterExpression'; - } - - // checks that the node only contains "constant" elements - protected function checkConstantExpression(\Twig_NodeInterface $node) - { - if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression - || $node instanceof NegUnary || $node instanceof PosUnary - )) { - return false; - } - - foreach ($node as $n) { - if (!$this->checkConstantExpression($n)) { - return false; - } - } - - return true; - } -} - -class_alias('Twig\ExpressionParser', 'Twig_ExpressionParser'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/CoreExtension.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/CoreExtension.php deleted file mode 100644 index 5ff1e39..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/CoreExtension.php +++ /dev/null @@ -1,1728 +0,0 @@ -escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return array An array of escapers - */ - public function getEscapers() - { - return $this->escapers; - } - - /** - * Sets the default format to be used by the date filter. - * - * @param string $format The default date format string - * @param string $dateIntervalFormat The default date interval format string - */ - public function setDateFormat($format = null, $dateIntervalFormat = null) - { - if (null !== $format) { - $this->dateFormats[0] = $format; - } - - if (null !== $dateIntervalFormat) { - $this->dateFormats[1] = $dateIntervalFormat; - } - } - - /** - * Gets the default format to be used by the date filter. - * - * @return array The default date format string and the default date interval format string - */ - public function getDateFormat() - { - return $this->dateFormats; - } - - /** - * Sets the default timezone to be used by the date filter. - * - * @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object - */ - public function setTimezone($timezone) - { - $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); - } - - /** - * Gets the default timezone to be used by the date filter. - * - * @return \DateTimeZone The default timezone currently in use - */ - public function getTimezone() - { - if (null === $this->timezone) { - $this->timezone = new \DateTimeZone(date_default_timezone_get()); - } - - return $this->timezone; - } - - /** - * Sets the default format to be used by the number_format filter. - * - * @param int $decimal the number of decimal places to use - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - */ - public function setNumberFormat($decimal, $decimalPoint, $thousandSep) - { - $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; - } - - /** - * Get the default format used by the number_format filter. - * - * @return array The arguments for number_format() - */ - public function getNumberFormat() - { - return $this->numberFormat; - } - - public function getTokenParsers() - { - return [ - new ApplyTokenParser(), - new ForTokenParser(), - new IfTokenParser(), - new ExtendsTokenParser(), - new IncludeTokenParser(), - new BlockTokenParser(), - new UseTokenParser(), - new FilterTokenParser(), - new MacroTokenParser(), - new ImportTokenParser(), - new FromTokenParser(), - new SetTokenParser(), - new SpacelessTokenParser(), - new FlushTokenParser(), - new DoTokenParser(), - new EmbedTokenParser(), - new WithTokenParser(), - new DeprecatedTokenParser(), - ]; - } - - public function getFilters() - { - $filters = [ - // formatting filters - new TwigFilter('date', 'twig_date_format_filter', ['needs_environment' => true]), - new TwigFilter('date_modify', 'twig_date_modify_filter', ['needs_environment' => true]), - new TwigFilter('format', 'sprintf'), - new TwigFilter('replace', 'twig_replace_filter'), - new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), - new TwigFilter('abs', 'abs'), - new TwigFilter('round', 'twig_round'), - - // encoding - new TwigFilter('url_encode', 'twig_urlencode_filter'), - new TwigFilter('json_encode', 'twig_jsonencode_filter'), - new TwigFilter('convert_encoding', 'twig_convert_encoding'), - - // string filters - new TwigFilter('title', 'twig_title_string_filter', ['needs_environment' => true]), - new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), - new TwigFilter('upper', 'strtoupper'), - new TwigFilter('lower', 'strtolower'), - new TwigFilter('striptags', 'strip_tags'), - new TwigFilter('trim', 'twig_trim_filter'), - new TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), - new TwigFilter('spaceless', 'twig_spaceless', ['is_safe' => ['html']]), - - // array helpers - new TwigFilter('join', 'twig_join_filter'), - new TwigFilter('split', 'twig_split_filter', ['needs_environment' => true]), - new TwigFilter('sort', 'twig_sort_filter'), - new TwigFilter('merge', 'twig_array_merge'), - new TwigFilter('batch', 'twig_array_batch'), - new TwigFilter('filter', 'twig_array_filter'), - new TwigFilter('map', 'twig_array_map'), - new TwigFilter('reduce', 'twig_array_reduce'), - - // string/array filters - new TwigFilter('reverse', 'twig_reverse_filter', ['needs_environment' => true]), - new TwigFilter('length', 'twig_length_filter', ['needs_environment' => true]), - new TwigFilter('slice', 'twig_slice', ['needs_environment' => true]), - new TwigFilter('first', 'twig_first', ['needs_environment' => true]), - new TwigFilter('last', 'twig_last', ['needs_environment' => true]), - - // iteration and runtime - new TwigFilter('default', '_twig_default_filter', ['node_class' => '\Twig\Node\Expression\Filter\DefaultFilter']), - new TwigFilter('keys', 'twig_get_array_keys_filter'), - - // escaping - new TwigFilter('escape', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), - new TwigFilter('e', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), - ]; - - if (\function_exists('mb_get_info')) { - $filters[] = new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]); - $filters[] = new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]); - } - - return $filters; - } - - public function getFunctions() - { - return [ - new TwigFunction('max', 'max'), - new TwigFunction('min', 'min'), - new TwigFunction('range', 'range'), - new TwigFunction('constant', 'twig_constant'), - new TwigFunction('cycle', 'twig_cycle'), - new TwigFunction('random', 'twig_random', ['needs_environment' => true]), - new TwigFunction('date', 'twig_date_converter', ['needs_environment' => true]), - new TwigFunction('include', 'twig_include', ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), - new TwigFunction('source', 'twig_source', ['needs_environment' => true, 'is_safe' => ['all']]), - ]; - } - - public function getTests() - { - return [ - new TwigTest('even', null, ['node_class' => '\Twig\Node\Expression\Test\EvenTest']), - new TwigTest('odd', null, ['node_class' => '\Twig\Node\Expression\Test\OddTest']), - new TwigTest('defined', null, ['node_class' => '\Twig\Node\Expression\Test\DefinedTest']), - new TwigTest('sameas', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest', 'deprecated' => '1.21', 'alternative' => 'same as']), - new TwigTest('same as', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest']), - new TwigTest('none', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), - new TwigTest('null', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), - new TwigTest('divisibleby', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest', 'deprecated' => '1.21', 'alternative' => 'divisible by']), - new TwigTest('divisible by', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest']), - new TwigTest('constant', null, ['node_class' => '\Twig\Node\Expression\Test\ConstantTest']), - new TwigTest('empty', 'twig_test_empty'), - new TwigTest('iterable', 'twig_test_iterable'), - ]; - } - - public function getOperators() - { - return [ - [ - 'not' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], - '-' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\NegUnary'], - '+' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\PosUnary'], - ], - [ - 'or' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'and' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-or' => ['precedence' => 16, 'class' => '\Twig\Node\Expression\Binary\BitwiseOrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-xor' => ['precedence' => 17, 'class' => '\Twig\Node\Expression\Binary\BitwiseXorBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-and' => ['precedence' => 18, 'class' => '\Twig\Node\Expression\Binary\BitwiseAndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '==' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '!=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '<' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '>' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '>=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '<=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'not in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotInBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\InBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'matches' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\MatchesBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'starts with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\StartsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'ends with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EndsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '..' => ['precedence' => 25, 'class' => '\Twig\Node\Expression\Binary\RangeBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '+' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\AddBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '-' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\SubBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '~' => ['precedence' => 40, 'class' => '\Twig\Node\Expression\Binary\ConcatBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '*' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\MulBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '/' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\DivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '//' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\FloorDivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - '%' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\ModBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '**' => ['precedence' => 200, 'class' => '\Twig\Node\Expression\Binary\PowerBinary', 'associativity' => ExpressionParser::OPERATOR_RIGHT], - '??' => ['precedence' => 300, 'class' => '\Twig\Node\Expression\NullCoalesceExpression', 'associativity' => ExpressionParser::OPERATOR_RIGHT], - ], - ]; - } - - public function getName() - { - return 'core'; - } -} - -class_alias('Twig\Extension\CoreExtension', 'Twig_Extension_Core'); -} - -namespace { -use Twig\Environment; -use Twig\Error\LoaderError; -use Twig\Error\RuntimeError; -use Twig\Loader\SourceContextLoaderInterface; -use Twig\Markup; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Node; - -/** - * Cycles over a value. - * - * @param \ArrayAccess|array $values - * @param int $position The cycle position - * - * @return string The next value in the cycle - */ -function twig_cycle($values, $position) -{ - if (!\is_array($values) && !$values instanceof \ArrayAccess) { - return $values; - } - - return $values[$position % \count($values)]; -} - -/** - * Returns a random value depending on the supplied parameter type: - * - a random item from a \Traversable or array - * - a random character from a string - * - a random integer between 0 and the integer parameter. - * - * @param \Traversable|array|int|float|string $values The values to pick a random item from - * @param int|null $max Maximum value used when $values is an int - * - * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) - * - * @return mixed A random value from the given sequence - */ -function twig_random(Environment $env, $values = null, $max = null) -{ - if (null === $values) { - return null === $max ? mt_rand() : mt_rand(0, $max); - } - - if (\is_int($values) || \is_float($values)) { - if (null === $max) { - if ($values < 0) { - $max = 0; - $min = $values; - } else { - $max = $values; - $min = 0; - } - } else { - $min = $values; - $max = $max; - } - - return mt_rand($min, $max); - } - - if (\is_string($values)) { - if ('' === $values) { - return ''; - } - if (null !== $charset = $env->getCharset()) { - if ('UTF-8' !== $charset) { - $values = twig_convert_encoding($values, 'UTF-8', $charset); - } - - // unicode version of str_split() - // split at all positions, but not after the start and not before the end - $values = preg_split('/(? $value) { - $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); - } - } - } else { - return $values[mt_rand(0, \strlen($values) - 1)]; - } - } - - if (!twig_test_iterable($values)) { - return $values; - } - - $values = twig_to_array($values); - - if (0 === \count($values)) { - throw new RuntimeError('The random function cannot pick from an empty array.'); - } - - return $values[array_rand($values, 1)]; -} - -/** - * Converts a date to the given format. - * - * {{ post.published_at|date("m/d/Y") }} - * - * @param \DateTime|\DateTimeInterface|\DateInterval|string $date A date - * @param string|null $format The target format, null to use the default - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return string The formatted date - */ -function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) -{ - if (null === $format) { - $formats = $env->getExtension('\Twig\Extension\CoreExtension')->getDateFormat(); - $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof \DateInterval) { - return $date->format($format); - } - - return twig_date_converter($env, $date, $timezone)->format($format); -} - -/** - * Returns a new date object modified. - * - * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} - * - * @param \DateTime|string $date A date - * @param string $modifier A modifier string - * - * @return \DateTime - */ -function twig_date_modify_filter(Environment $env, $date, $modifier) -{ - $date = twig_date_converter($env, $date, false); - $resultDate = $date->modify($modifier); - - // This is a hack to ensure PHP 5.2 support and support for \DateTimeImmutable - // \DateTime::modify does not return the modified \DateTime object < 5.3.0 - // and \DateTimeImmutable does not modify $date. - return null === $resultDate ? $date : $resultDate; -} - -/** - * Converts an input to a \DateTime instance. - * - * {% if date(user.created_at) < date('+2days') %} - * {# do something #} - * {% endif %} - * - * @param \DateTime|\DateTimeInterface|string|null $date A date - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return \DateTimeInterface - */ -function twig_date_converter(Environment $env, $date = null, $timezone = null) -{ - // determine the timezone - if (false !== $timezone) { - if (null === $timezone) { - $timezone = $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone(); - } elseif (!$timezone instanceof \DateTimeZone) { - $timezone = new \DateTimeZone($timezone); - } - } - - // immutable dates - if ($date instanceof \DateTimeImmutable) { - return false !== $timezone ? $date->setTimezone($timezone) : $date; - } - - if ($date instanceof \DateTime || $date instanceof \DateTimeInterface) { - $date = clone $date; - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; - } - - if (null === $date || 'now' === $date) { - return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); - } - - $asString = (string) $date; - if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { - $date = new \DateTime('@'.$date); - } else { - $date = new \DateTime($date, $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); - } - - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; -} - -/** - * Replaces strings within a string. - * - * @param string $str String to replace in - * @param array|\Traversable $from Replace values - * @param string|null $to Replace to, deprecated (@see https://secure.php.net/manual/en/function.strtr.php) - * - * @return string - */ -function twig_replace_filter($str, $from, $to = null) -{ - if (\is_string($from) && \is_string($to)) { - @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); - - return strtr($str, $from, $to); - } - - if (!twig_test_iterable($from)) { - throw new RuntimeError(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); - } - - return strtr($str, twig_to_array($from)); -} - -/** - * Rounds a number. - * - * @param int|float $value The value to round - * @param int|float $precision The rounding precision - * @param string $method The method to use for rounding - * - * @return int|float The rounded number - */ -function twig_round($value, $precision = 0, $method = 'common') -{ - if ('common' == $method) { - return round($value, $precision); - } - - if ('ceil' != $method && 'floor' != $method) { - throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); - } - - return $method($value * pow(10, $precision)) / pow(10, $precision); -} - -/** - * Number format filter. - * - * All of the formatting options can be left null, in that case the defaults will - * be used. Supplying any of the parameters will override the defaults set in the - * environment object. - * - * @param mixed $number A float/int/string of the number to format - * @param int $decimal the number of decimal points to display - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - * - * @return string The formatted number - */ -function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - $defaults = $env->getExtension('\Twig\Extension\CoreExtension')->getNumberFormat(); - if (null === $decimal) { - $decimal = $defaults[0]; - } - - if (null === $decimalPoint) { - $decimalPoint = $defaults[1]; - } - - if (null === $thousandSep) { - $thousandSep = $defaults[2]; - } - - return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * URL encodes (RFC 3986) a string as a path segment or an array as a query string. - * - * @param string|array $url A URL or an array of query parameters - * - * @return string The URL encoded value - */ -function twig_urlencode_filter($url) -{ - if (\is_array($url)) { - if (\defined('PHP_QUERY_RFC3986')) { - return http_build_query($url, '', '&', PHP_QUERY_RFC3986); - } - - return http_build_query($url, '', '&'); - } - - return rawurlencode($url); -} - -/** - * JSON encodes a variable. - * - * @param mixed $value the value to encode - * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT - * - * @return mixed The JSON encoded value - */ -function twig_jsonencode_filter($value, $options = 0) -{ - if ($value instanceof Markup) { - $value = (string) $value; - } elseif (\is_array($value)) { - array_walk_recursive($value, '_twig_markup2string'); - } - - return json_encode($value, $options); -} - -function _twig_markup2string(&$value) -{ - if ($value instanceof Markup) { - $value = (string) $value; - } -} - -/** - * Merges an array with another one. - * - * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - * - * {% set items = items|merge({ 'peugeot': 'car' }) %} - * - * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} - * - * @param array|\Traversable $arr1 An array - * @param array|\Traversable $arr2 An array - * - * @return array The merged array - */ -function twig_array_merge($arr1, $arr2) -{ - if (!twig_test_iterable($arr1)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); - } - - if (!twig_test_iterable($arr2)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); - } - - return array_merge(twig_to_array($arr1), twig_to_array($arr2)); -} - -/** - * Slices a variable. - * - * @param mixed $item A variable - * @param int $start Start of the slice - * @param int $length Size of the slice - * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) - * - * @return mixed The sliced variable - */ -function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - if ($item instanceof \Traversable) { - while ($item instanceof \IteratorAggregate) { - $item = $item->getIterator(); - } - - if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { - try { - return iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); - } catch (\OutOfBoundsException $e) { - return []; - } - } - - $item = iterator_to_array($item, $preserveKeys); - } - - if (\is_array($item)) { - return \array_slice($item, $start, $length, $preserveKeys); - } - - $item = (string) $item; - - if (\function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { - return (string) mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); - } - - return (string) (null === $length ? substr($item, $start) : substr($item, $start, $length)); -} - -/** - * Returns the first element of the item. - * - * @param mixed $item A variable - * - * @return mixed The first element of the item - */ -function twig_first(Environment $env, $item) -{ - $elements = twig_slice($env, $item, 0, 1, false); - - return \is_string($elements) ? $elements : current($elements); -} - -/** - * Returns the last element of the item. - * - * @param mixed $item A variable - * - * @return mixed The last element of the item - */ -function twig_last(Environment $env, $item) -{ - $elements = twig_slice($env, $item, -1, 1, false); - - return \is_string($elements) ? $elements : current($elements); -} - -/** - * Joins the values to a string. - * - * The separators between elements are empty strings per default, you can define them with the optional parameters. - * - * {{ [1, 2, 3]|join(', ', ' and ') }} - * {# returns 1, 2 and 3 #} - * - * {{ [1, 2, 3]|join('|') }} - * {# returns 1|2|3 #} - * - * {{ [1, 2, 3]|join }} - * {# returns 123 #} - * - * @param array $value An array - * @param string $glue The separator - * @param string|null $and The separator for the last pair - * - * @return string The concatenated string - */ -function twig_join_filter($value, $glue = '', $and = null) -{ - if (!twig_test_iterable($value)) { - $value = (array) $value; - } - - $value = twig_to_array($value, false); - - if (0 === \count($value)) { - return ''; - } - - if (null === $and || $and === $glue) { - return implode($glue, $value); - } - - if (1 === \count($value)) { - return $value[0]; - } - - return implode($glue, \array_slice($value, 0, -1)).$and.$value[\count($value) - 1]; -} - -/** - * Splits the string into an array. - * - * {{ "one,two,three"|split(',') }} - * {# returns [one, two, three] #} - * - * {{ "one,two,three,four,five"|split(',', 3) }} - * {# returns [one, two, "three,four,five"] #} - * - * {{ "123"|split('') }} - * {# returns [1, 2, 3] #} - * - * {{ "aabbcc"|split('', 2) }} - * {# returns [aa, bb, cc] #} - * - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit - * - * @return array The split string as an array - */ -function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) -{ - if (\strlen($delimiter) > 0) { - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); - } - - if (!\function_exists('mb_get_info') || null === $charset = $env->getCharset()) { - return str_split($value, null === $limit ? 1 : $limit); - } - - if ($limit <= 1) { - return preg_split('/(?getIterator(); - } - - if ($array instanceof \Iterator) { - $keys = []; - $array->rewind(); - while ($array->valid()) { - $keys[] = $array->key(); - $array->next(); - } - - return $keys; - } - - $keys = []; - foreach ($array as $key => $item) { - $keys[] = $key; - } - - return $keys; - } - - if (!\is_array($array)) { - return []; - } - - return array_keys($array); -} - -/** - * Reverses a variable. - * - * @param array|\Traversable|string $item An array, a \Traversable instance, or a string - * @param bool $preserveKeys Whether to preserve key or not - * - * @return mixed The reversed input - */ -function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) -{ - if ($item instanceof \Traversable) { - return array_reverse(iterator_to_array($item), $preserveKeys); - } - - if (\is_array($item)) { - return array_reverse($item, $preserveKeys); - } - - if (null !== $charset = $env->getCharset()) { - $string = (string) $item; - - if ('UTF-8' !== $charset) { - $item = twig_convert_encoding($string, 'UTF-8', $charset); - } - - preg_match_all('/./us', $item, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - } - - return strrev((string) $item); -} - -/** - * Sorts an array. - * - * @param array|\Traversable $array - * - * @return array - */ -function twig_sort_filter($array) -{ - if ($array instanceof \Traversable) { - $array = iterator_to_array($array); - } elseif (!\is_array($array)) { - throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); - } - - asort($array); - - return $array; -} - -/** - * @internal - */ -function twig_in_filter($value, $compare) -{ - if ($value instanceof Markup) { - $value = (string) $value; - } - if ($compare instanceof Markup) { - $compare = (string) $compare; - } - - if (\is_array($compare)) { - return \in_array($value, $compare, \is_object($value) || \is_resource($value)); - } elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) { - return '' === $value || false !== strpos($compare, (string) $value); - } elseif ($compare instanceof \Traversable) { - if (\is_object($value) || \is_resource($value)) { - foreach ($compare as $item) { - if ($item === $value) { - return true; - } - } - } else { - foreach ($compare as $item) { - if ($item == $value) { - return true; - } - } - } - - return false; - } - - return false; -} - -/** - * Returns a trimmed string. - * - * @return string - * - * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') - */ -function twig_trim_filter($string, $characterMask = null, $side = 'both') -{ - if (null === $characterMask) { - $characterMask = " \t\n\r\0\x0B"; - } - - switch ($side) { - case 'both': - return trim($string, $characterMask); - case 'left': - return ltrim($string, $characterMask); - case 'right': - return rtrim($string, $characterMask); - default: - throw new RuntimeError('Trimming side must be "left", "right" or "both".'); - } -} - -/** - * Removes whitespaces between HTML tags. - * - * @return string - */ -function twig_spaceless($content) -{ - return trim(preg_replace('/>\s+<', $content)); -} - -/** - * Escapes a string. - * - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - * - * @return string - */ -function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) -{ - if ($autoescape && $string instanceof Markup) { - return $string; - } - - if (!\is_string($string)) { - if (\is_object($string) && method_exists($string, '__toString')) { - $string = (string) $string; - } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { - return $string; - } - } - - if ('' === $string) { - return ''; - } - - if (null === $charset) { - $charset = $env->getCharset(); - } - - switch ($strategy) { - case 'html': - // see https://secure.php.net/htmlspecialchars - - // Using a static variable to avoid initializing the array - // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping strategies. - static $htmlspecialcharsCharsets = [ - 'ISO-8859-1' => true, 'ISO8859-1' => true, - 'ISO-8859-15' => true, 'ISO8859-15' => true, - 'utf-8' => true, 'UTF-8' => true, - 'CP866' => true, 'IBM866' => true, '866' => true, - 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, - '1251' => true, - 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, - 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, - 'BIG5' => true, '950' => true, - 'GB2312' => true, '936' => true, - 'BIG5-HKSCS' => true, - 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, - 'EUC-JP' => true, 'EUCJP' => true, - 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, - ]; - - if (isset($htmlspecialcharsCharsets[$charset])) { - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { - // cache the lowercase variant for future iterations - $htmlspecialcharsCharsets[$charset] = true; - - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - $string = twig_convert_encoding($string, 'UTF-8', $charset); - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); - - return twig_convert_encoding($string, $charset, 'UTF-8'); - - case 'js': - // escape all non-alphanumeric characters - // into their \x or \uHHHH representations - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'css': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'html_attr': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'url': - return rawurlencode($string); - - default: - static $escapers; - - if (null === $escapers) { - $escapers = $env->getExtension('\Twig\Extension\CoreExtension')->getEscapers(); - } - - if (isset($escapers[$strategy])) { - return \call_user_func($escapers[$strategy], $env, $string, $charset); - } - - $validStrategies = implode(', ', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($escapers))); - - throw new RuntimeError(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); - } -} - -/** - * @internal - */ -function twig_escape_filter_is_safe(Node $filterArgs) -{ - foreach ($filterArgs as $arg) { - if ($arg instanceof ConstantExpression) { - return [$arg->getAttribute('value')]; - } - - return []; - } - - return ['html']; -} - -if (\function_exists('mb_convert_encoding')) { - function twig_convert_encoding($string, $to, $from) - { - return mb_convert_encoding($string, $to, $from); - } -} elseif (\function_exists('iconv')) { - function twig_convert_encoding($string, $to, $from) - { - return iconv($from, $to, $string); - } -} else { - function twig_convert_encoding($string, $to, $from) - { - throw new RuntimeError('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); - } -} - -if (\function_exists('mb_ord')) { - function twig_ord($string) - { - return mb_ord($string, 'UTF-8'); - } -} else { - function twig_ord($string) - { - $code = ($string = unpack('C*', substr($string, 0, 4))) ? $string[1] : 0; - if (0xF0 <= $code) { - return (($code - 0xF0) << 18) + (($string[2] - 0x80) << 12) + (($string[3] - 0x80) << 6) + $string[4] - 0x80; - } - if (0xE0 <= $code) { - return (($code - 0xE0) << 12) + (($string[2] - 0x80) << 6) + $string[3] - 0x80; - } - if (0xC0 <= $code) { - return (($code - 0xC0) << 6) + $string[2] - 0x80; - } - - return $code; - } -} - -function _twig_escape_js_callback($matches) -{ - $char = $matches[0]; - - /* - * A few characters have short escape sequences in JSON and JavaScript. - * Escape sequences supported only by JavaScript, not JSON, are ommitted. - * \" is also supported but omitted, because the resulting string is not HTML safe. - */ - static $shortMap = [ - '\\' => '\\\\', - '/' => '\\/', - "\x08" => '\b', - "\x0C" => '\f', - "\x0A" => '\n', - "\x0D" => '\r', - "\x09" => '\t', - ]; - - if (isset($shortMap[$char])) { - return $shortMap[$char]; - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - $char = strtoupper(bin2hex($char)); - - if (4 >= \strlen($char)) { - return sprintf('\u%04s', $char); - } - - return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); -} - -function _twig_escape_css_callback($matches) -{ - $char = $matches[0]; - - return sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : twig_ord($char)); -} - -/** - * This function is adapted from code coming from Zend Framework. - * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) - * @license https://framework.zend.com/license/new-bsd New BSD License - */ -function _twig_escape_html_attr_callback($matches) -{ - $chr = $matches[0]; - $ord = \ord($chr); - - /* - * The following replaces characters undefined in HTML with the - * hex entity for the Unicode replacement character. - */ - if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { - return '�'; - } - - /* - * Check if the current character to escape has a name entity we should - * replace it with while grabbing the hex value of the character. - */ - if (1 == \strlen($chr)) { - /* - * While HTML supports far more named entities, the lowest common denominator - * has become HTML5's XML Serialisation which is restricted to the those named - * entities that XML supports. Using HTML entities would result in this error: - * XML Parsing Error: undefined entity - */ - static $entityMap = [ - 34 => '"', /* quotation mark */ - 38 => '&', /* ampersand */ - 60 => '<', /* less-than sign */ - 62 => '>', /* greater-than sign */ - ]; - - if (isset($entityMap[$ord])) { - return $entityMap[$ord]; - } - - return sprintf('&#x%02X;', $ord); - } - - /* - * Per OWASP recommendations, we'll use hex entities for any other - * characters where a named entity does not exist. - */ - return sprintf('&#x%04X;', twig_ord($chr)); -} - -// add multibyte extensions if possible -if (\function_exists('mb_get_info')) { - /** - * Returns the length of a variable. - * - * @param mixed $thing A variable - * - * @return int The length of the value - */ - function twig_length_filter(Environment $env, $thing) - { - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return mb_strlen($thing, $env->getCharset()); - } - - if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { - return \count($thing); - } - - if ($thing instanceof \Traversable) { - return iterator_count($thing); - } - - if (\is_object($thing) && method_exists($thing, '__toString')) { - return mb_strlen((string) $thing, $env->getCharset()); - } - - return 1; - } - - /** - * Converts a string to uppercase. - * - * @param string $string A string - * - * @return string The uppercased string - */ - function twig_upper_filter(Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtoupper($string, $charset); - } - - return strtoupper($string); - } - - /** - * Converts a string to lowercase. - * - * @param string $string A string - * - * @return string The lowercased string - */ - function twig_lower_filter(Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtolower($string, $charset); - } - - return strtolower($string); - } - - /** - * Returns a titlecased string. - * - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_convert_case($string, MB_CASE_TITLE, $charset); - } - - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset); - } - - return ucfirst(strtolower($string)); - } -} -// and byte fallback -else { - /** - * Returns the length of a variable. - * - * @param mixed $thing A variable - * - * @return int The length of the value - */ - function twig_length_filter(Environment $env, $thing) - { - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return \strlen($thing); - } - - if ($thing instanceof \SimpleXMLElement) { - return \count($thing); - } - - if (\is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { - return \strlen((string) $thing); - } - - if ($thing instanceof \Countable || \is_array($thing)) { - return \count($thing); - } - - if ($thing instanceof \IteratorAggregate) { - return iterator_count($thing); - } - - return 1; - } - - /** - * Returns a titlecased string. - * - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Environment $env, $string) - { - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Environment $env, $string) - { - return ucfirst(strtolower($string)); - } -} - -/** - * @internal - */ -function twig_ensure_traversable($seq) -{ - if ($seq instanceof \Traversable || \is_array($seq)) { - return $seq; - } - - return []; -} - -/** - * @internal - */ -function twig_to_array($seq, $preserveKeys = true) -{ - if ($seq instanceof \Traversable) { - return iterator_to_array($seq, $preserveKeys); - } - - if (!\is_array($seq)) { - return $seq; - } - - return $preserveKeys ? $seq : array_values($seq); -} - -/** - * Checks if a variable is empty. - * - * {# evaluates to true if the foo variable is null, false, or the empty string #} - * {% if foo is empty %} - * {# ... #} - * {% endif %} - * - * @param mixed $value A variable - * - * @return bool true if the value is empty, false otherwise - */ -function twig_test_empty($value) -{ - if ($value instanceof \Countable) { - return 0 == \count($value); - } - - if ($value instanceof \Traversable) { - return !iterator_count($value); - } - - if (\is_object($value) && method_exists($value, '__toString')) { - return '' === (string) $value; - } - - return '' === $value || false === $value || null === $value || [] === $value; -} - -/** - * Checks if a variable is traversable. - * - * {# evaluates to true if the foo variable is an array or a traversable object #} - * {% if foo is iterable %} - * {# ... #} - * {% endif %} - * - * @param mixed $value A variable - * - * @return bool true if the value is traversable - */ -function twig_test_iterable($value) -{ - return $value instanceof \Traversable || \is_array($value); -} - -/** - * Renders a template. - * - * @param array $context - * @param string|array $template The template to render or an array of templates to try consecutively - * @param array $variables The variables to pass to the template - * @param bool $withContext - * @param bool $ignoreMissing Whether to ignore missing templates or not - * @param bool $sandboxed Whether to sandbox the template or not - * - * @return string The rendered template - */ -function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - $alreadySandboxed = false; - $sandbox = null; - if ($withContext) { - $variables = array_merge($context, $variables); - } - - if ($isSandboxed = $sandboxed && $env->hasExtension('\Twig\Extension\SandboxExtension')) { - $sandbox = $env->getExtension('\Twig\Extension\SandboxExtension'); - if (!$alreadySandboxed = $sandbox->isSandboxed()) { - $sandbox->enableSandbox(); - } - } - - $loaded = null; - try { - $loaded = $env->resolveTemplate($template); - } catch (LoaderError $e) { - if (!$ignoreMissing) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - } catch (\Throwable $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } catch (\Exception $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - - try { - $ret = $loaded ? $loaded->render($variables) : ''; - } catch (\Exception $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - return $ret; -} - -/** - * Returns a template content without rendering it. - * - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not - * - * @return string The template source - */ -function twig_source(Environment $env, $name, $ignoreMissing = false) -{ - $loader = $env->getLoader(); - try { - if (!$loader instanceof SourceContextLoaderInterface) { - return $loader->getSource($name); - } else { - return $loader->getSourceContext($name)->getCode(); - } - } catch (LoaderError $e) { - if (!$ignoreMissing) { - throw $e; - } - } -} - -/** - * Provides the ability to get constants from instances as well as class/global constants. - * - * @param string $constant The name of the constant - * @param object|null $object The object to get the constant from - * - * @return string - */ -function twig_constant($constant, $object = null) -{ - if (null !== $object) { - $constant = \get_class($object).'::'.$constant; - } - - return \constant($constant); -} - -/** - * Checks if a constant exists. - * - * @param string $constant The name of the constant - * @param object|null $object The object to get the constant from - * - * @return bool - */ -function twig_constant_is_defined($constant, $object = null) -{ - if (null !== $object) { - $constant = \get_class($object).'::'.$constant; - } - - return \defined($constant); -} - -/** - * Batches item. - * - * @param array $items An array of items - * @param int $size The size of the batch - * @param mixed $fill A value used to fill missing items - * - * @return array - */ -function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) -{ - if (!twig_test_iterable($items)) { - throw new RuntimeError(sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); - } - - $size = ceil($size); - - $result = array_chunk(twig_to_array($items, $preserveKeys), $size, $preserveKeys); - - if (null !== $fill && $result) { - $last = \count($result) - 1; - if ($fillCount = $size - \count($result[$last])) { - for ($i = 0; $i < $fillCount; ++$i) { - $result[$last][] = $fill; - } - } - } - - return $result; -} - -function twig_array_filter($array, $arrow) -{ - if (\is_array($array)) { - if (\PHP_VERSION_ID >= 50600) { - return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); - } - - return array_filter($array, $arrow); - } - - // the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator - return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow); -} - -function twig_array_map($array, $arrow) -{ - $r = []; - foreach ($array as $k => $v) { - $r[$k] = $arrow($v, $k); - } - - return $r; -} - -function twig_array_reduce($array, $arrow, $initial = null) -{ - if (!\is_array($array)) { - $array = iterator_to_array($array); - } - - return array_reduce($array, $arrow, $initial); -} -} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/DebugExtension.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/DebugExtension.php deleted file mode 100644 index 09b0223..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/DebugExtension.php +++ /dev/null @@ -1,76 +0,0 @@ - $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), - ]; - } - - public function getName() - { - return 'debug'; - } -} - -class_alias('Twig\Extension\DebugExtension', 'Twig_Extension_Debug'); -} - -namespace { -use Twig\Environment; -use Twig\Template; -use Twig\TemplateWrapper; - -function twig_var_dump(Environment $env, $context, array $vars = []) -{ - if (!$env->isDebug()) { - return; - } - - ob_start(); - - if (!$vars) { - $vars = []; - foreach ($context as $key => $value) { - if (!$value instanceof Template && !$value instanceof TemplateWrapper) { - $vars[$key] = $value; - } - } - - var_dump($vars); - } else { - foreach ($vars as $var) { - var_dump($var); - } - } - - return ob_get_clean(); -} -} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Lexer.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Lexer.php deleted file mode 100644 index 697a6cf..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Lexer.php +++ /dev/null @@ -1,534 +0,0 @@ - - */ -class Lexer implements \Twig_LexerInterface -{ - protected $tokens; - protected $code; - protected $cursor; - protected $lineno; - protected $end; - protected $state; - protected $states; - protected $brackets; - protected $env; - // to be renamed to $name in 2.0 (where it is private) - protected $filename; - protected $options; - protected $regexes; - protected $position; - protected $positions; - protected $currentVarBlockLine; - - private $source; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - const STATE_STRING = 3; - const STATE_INTERPOLATION = 4; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A'; - const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const REGEX_DQ_STRING_DELIM = '/"/A'; - const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; - const PUNCTUATION = '()[]{}?:.,|'; - - public function __construct(Environment $env, array $options = []) - { - $this->env = $env; - - $this->options = array_merge([ - 'tag_comment' => ['{#', '#}'], - 'tag_block' => ['{%', '%}'], - 'tag_variable' => ['{{', '}}'], - 'whitespace_trim' => '-', - 'whitespace_line_trim' => '~', - 'whitespace_line_chars' => ' \t\0\x0B', - 'interpolation' => ['#{', '}'], - ], $options); - - // when PHP 7.3 is the min version, we will be able to remove the '#' part in preg_quote as it's part of the default - $this->regexes = [ - // }} - 'lex_var' => '{ - \s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '#').'\s*'. // -}}\s* - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_variable'][1], '#'). // }} - ') - }Ax', - - // %} - 'lex_block' => '{ - \s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*\n?'. // -%}\s*\n? - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#').'\n?'. // %}\n? - ') - }Ax', - - // {% endverbatim %} - 'lex_raw_data' => '{'. - preg_quote($this->options['tag_block'][0], '#'). // {% - '('. - $this->options['whitespace_trim']. // - - '|'. - $this->options['whitespace_line_trim']. // ~ - ')?\s*'. - '(?:end%s)'. // endraw or endverbatim - '\s*'. - '(?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%} - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#'). // %} - ') - }sx', - - 'operator' => $this->getOperatorRegex(), - - // #} - 'lex_comment' => '{ - (?:'. - preg_quote($this->options['whitespace_trim']).preg_quote($this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n? - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_comment'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~#}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_comment'][1], '#').'\n?'. // #}\n? - ') - }sx', - - // verbatim %} - 'lex_block_raw' => '{ - \s* - (raw|verbatim) - \s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%}\s* - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#'). // %} - ') - }Asx', - - 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '#').'}As', - - // {{ or {% or {# - 'lex_tokens_start' => '{ - ('. - preg_quote($this->options['tag_variable'][0], '#'). // {{ - '|'. - preg_quote($this->options['tag_block'][0], '#'). // {% - '|'. - preg_quote($this->options['tag_comment'][0], '#'). // {# - ')('. - preg_quote($this->options['whitespace_trim'], '#'). // - - '|'. - preg_quote($this->options['whitespace_line_trim'], '#'). // ~ - ')? - }sx', - 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0], '#').'\s*}A', - 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1], '#').'}A', - ]; - } - - public function tokenize($code, $name = null) - { - if (!$code instanceof Source) { - @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $this->source = new Source($code, $name); - } else { - $this->source = $code; - } - - if (((int) ini_get('mbstring.func_overload')) & 2) { - @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); - } - - if (\function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } else { - $mbEncoding = null; - } - - $this->code = str_replace(["\r\n", "\r"], "\n", $this->source->getCode()); - $this->filename = $this->source->getName(); - $this->cursor = 0; - $this->lineno = 1; - $this->end = \strlen($this->code); - $this->tokens = []; - $this->state = self::STATE_DATA; - $this->states = []; - $this->brackets = []; - $this->position = -1; - - // find all token starts in one go - preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); - $this->positions = $matches; - - while ($this->cursor < $this->end) { - // dispatch to the lexing functions depending - // on the current state - switch ($this->state) { - case self::STATE_DATA: - $this->lexData(); - break; - - case self::STATE_BLOCK: - $this->lexBlock(); - break; - - case self::STATE_VAR: - $this->lexVar(); - break; - - case self::STATE_STRING: - $this->lexString(); - break; - - case self::STATE_INTERPOLATION: - $this->lexInterpolation(); - break; - } - } - - $this->pushToken(Token::EOF_TYPE); - - if (!empty($this->brackets)) { - list($expect, $lineno) = array_pop($this->brackets); - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - if ($mbEncoding) { - mb_internal_encoding($mbEncoding); - } - - return new TokenStream($this->tokens, $this->source); - } - - protected function lexData() - { - // if no matches are left we return the rest of the template as simple text token - if ($this->position == \count($this->positions[0]) - 1) { - $this->pushToken(Token::TEXT_TYPE, substr($this->code, $this->cursor)); - $this->cursor = $this->end; - - return; - } - - // Find the first token after the current cursor - $position = $this->positions[0][++$this->position]; - while ($position[1] < $this->cursor) { - if ($this->position == \count($this->positions[0]) - 1) { - return; - } - $position = $this->positions[0][++$this->position]; - } - - // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); - - // trim? - if (isset($this->positions[2][$this->position][0])) { - if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { - // whitespace_trim detected ({%-, {{- or {#-) - $text = rtrim($text); - } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { - // whitespace_line_trim detected ({%~, {{~ or {#~) - // don't trim \r and \n - $text = rtrim($text, " \t\0\x0B"); - } - } - $this->pushToken(Token::TEXT_TYPE, $text); - $this->moveCursor($textContent.$position[0]); - - switch ($this->positions[1][$this->position][0]) { - case $this->options['tag_comment'][0]: - $this->lexComment(); - break; - - case $this->options['tag_block'][0]: - // raw data? - if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lexRawData($match[1]); - // {% line \d+ %} - } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lineno = (int) $match[1]; - } else { - $this->pushToken(Token::BLOCK_START_TYPE); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(Token::VAR_START_TYPE); - $this->pushState(self::STATE_VAR); - $this->currentVarBlockLine = $this->lineno; - break; - } - } - - protected function lexBlock() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::BLOCK_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexVar() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::VAR_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexExpression() - { - // whitespace - if (preg_match('/\s+/A', $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - - if ($this->cursor >= $this->end) { - throw new SyntaxError(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); - } - } - - // arrow function - if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { - $this->pushToken(Token::ARROW_TYPE, '=>'); - $this->moveCursor('=>'); - } - // operators - elseif (preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0])); - $this->moveCursor($match[0]); - } - // names - elseif (preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::NAME_TYPE, $match[0]); - $this->moveCursor($match[0]); - } - // numbers - elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) { - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $this->pushToken(Token::NUMBER_TYPE, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (false !== strpos('([{', $this->code[$this->cursor])) { - $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; - } - // closing bracket - elseif (false !== strpos(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - } - - $this->pushToken(Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); - $this->moveCursor($match[0]); - } - // opening double quoted string - elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { - $this->brackets[] = ['"', $this->lineno]; - $this->pushState(self::STATE_STRING); - $this->moveCursor($match[0]); - } - // unlexable - else { - throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - protected function lexRawData($tag) - { - if ('raw' === $tag) { - @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); - } - - if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new SyntaxError(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source); - } - - $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->moveCursor($text.$match[0][0]); - - // trim? - if (isset($match[1][0])) { - if ($this->options['whitespace_trim'] === $match[1][0]) { - // whitespace_trim detected ({%-, {{- or {#-) - $text = rtrim($text); - } else { - // whitespace_line_trim detected ({%~, {{~ or {#~) - // don't trim \r and \n - $text = rtrim($text, " \t\0\x0B"); - } - } - - $this->pushToken(Token::TEXT_TYPE, $text); - } - - protected function lexComment() - { - if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new SyntaxError('Unclosed comment.', $this->lineno, $this->source); - } - - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); - } - - protected function lexString() - { - if (preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) { - $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; - $this->pushToken(Token::INTERPOLATION_START_TYPE); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) { - $this->pushToken(Token::STRING_TYPE, stripcslashes($match[0])); - $this->moveCursor($match[0]); - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { - list($expect, $lineno) = array_pop($this->brackets); - if ('"' != $this->code[$this->cursor]) { - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - $this->popState(); - ++$this->cursor; - } else { - // unlexable - throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - protected function lexInterpolation() - { - $bracket = end($this->brackets); - if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) { - array_pop($this->brackets); - $this->pushToken(Token::INTERPOLATION_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function pushToken($type, $value = '') - { - // do not push empty text tokens - if (Token::TEXT_TYPE === $type && '' === $value) { - return; - } - - $this->tokens[] = new Token($type, $value, $this->lineno); - } - - protected function moveCursor($text) - { - $this->cursor += \strlen($text); - $this->lineno += substr_count($text, "\n"); - } - - protected function getOperatorRegex() - { - $operators = array_merge( - ['='], - array_keys($this->env->getUnaryOperators()), - array_keys($this->env->getBinaryOperators()) - ); - - $operators = array_combine($operators, array_map('strlen', $operators)); - arsort($operators); - - $regex = []; - foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - if (ctype_alpha($operator[$length - 1])) { - $r = preg_quote($operator, '/').'(?=[\s()])'; - } else { - $r = preg_quote($operator, '/'); - } - - // an operator with a space can be any amount of whitespaces - $r = preg_replace('/\s+/', '\s+', $r); - - $regex[] = $r; - } - - return '/'.implode('|', $regex).'/A'; - } - - protected function pushState($state) - { - $this->states[] = $this->state; - $this->state = $state; - } - - protected function popState() - { - if (0 === \count($this->states)) { - throw new \LogicException('Cannot pop state without a previous state.'); - } - - $this->state = array_pop($this->states); - } -} - -class_alias('Twig\Lexer', 'Twig_Lexer'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/FilesystemLoader.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/FilesystemLoader.php deleted file mode 100644 index 19b43a2..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/FilesystemLoader.php +++ /dev/null @@ -1,323 +0,0 @@ - - */ -class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface -{ - /** Identifier of the main namespace. */ - const MAIN_NAMESPACE = '__main__'; - - protected $paths = []; - protected $cache = []; - protected $errorCache = []; - - private $rootPath; - - /** - * @param string|array $paths A path or an array of paths where to look for templates - * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) - */ - public function __construct($paths = [], $rootPath = null) - { - $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR; - if (false !== $realPath = realpath($rootPath)) { - $this->rootPath = $realPath.\DIRECTORY_SEPARATOR; - } - - if ($paths) { - $this->setPaths($paths); - } - } - - /** - * Returns the paths to the templates. - * - * @param string $namespace A path namespace - * - * @return array The array of paths where to look for templates - */ - public function getPaths($namespace = self::MAIN_NAMESPACE) - { - return isset($this->paths[$namespace]) ? $this->paths[$namespace] : []; - } - - /** - * Returns the path namespaces. - * - * The main namespace is always defined. - * - * @return array The array of defined namespaces - */ - public function getNamespaces() - { - return array_keys($this->paths); - } - - /** - * Sets the paths where templates are stored. - * - * @param string|array $paths A path or an array of paths where to look for templates - * @param string $namespace A path namespace - */ - public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) - { - if (!\is_array($paths)) { - $paths = [$paths]; - } - - $this->paths[$namespace] = []; - foreach ($paths as $path) { - $this->addPath($path, $namespace); - } - } - - /** - * Adds a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws LoaderError - */ - public function addPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = []; - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $this->paths[$namespace][] = rtrim($path, '/\\'); - } - - /** - * Prepends a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws LoaderError - */ - public function prependPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = []; - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $path = rtrim($path, '/\\'); - - if (!isset($this->paths[$namespace])) { - $this->paths[$namespace][] = $path; - } else { - array_unshift($this->paths[$namespace], $path); - } - } - - public function getSource($name) - { - @trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), E_USER_DEPRECATED); - - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return ''; - } - - return file_get_contents($path); - } - - public function getSourceContext($name) - { - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return new Source('', $name, ''); - } - - return new Source(file_get_contents($path), $name, $path); - } - - public function getCacheKey($name) - { - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return ''; - } - $len = \strlen($this->rootPath); - if (0 === strncmp($this->rootPath, $path, $len)) { - return substr($path, $len); - } - - return $path; - } - - public function exists($name) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return true; - } - - try { - return null !== ($path = $this->findTemplate($name, false)) && false !== $path; - } catch (LoaderError $e) { - @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); - - return false; - } - } - - public function isFresh($name, $time) - { - // false support to be removed in 3.0 - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return false; - } - - return filemtime($path) < $time; - } - - /** - * Checks if the template can be found. - * - * @param string $name The template name - * - * @return string|false|null The template name or false/null - */ - protected function findTemplate($name) - { - $throw = \func_num_args() > 1 ? func_get_arg(1) : true; - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - - if (isset($this->errorCache[$name])) { - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - try { - $this->validateName($name); - - list($namespace, $shortname) = $this->parseName($name); - } catch (LoaderError $e) { - if (!$throw) { - return false; - } - - throw $e; - } - - if (!isset($this->paths[$namespace])) { - $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); - - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - foreach ($this->paths[$namespace] as $path) { - if (!$this->isAbsolutePath($path)) { - $path = $this->rootPath.$path; - } - - if (is_file($path.'/'.$shortname)) { - if (false !== $realpath = realpath($path.'/'.$shortname)) { - return $this->cache[$name] = $realpath; - } - - return $this->cache[$name] = $path.'/'.$shortname; - } - } - - $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); - - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - protected function parseName($name, $default = self::MAIN_NAMESPACE) - { - if (isset($name[0]) && '@' == $name[0]) { - if (false === $pos = strpos($name, '/')) { - throw new LoaderError(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); - } - - $namespace = substr($name, 1, $pos - 1); - $shortname = substr($name, $pos + 1); - - return [$namespace, $shortname]; - } - - return [$default, $name]; - } - - protected function normalizeName($name) - { - return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name)); - } - - protected function validateName($name) - { - if (false !== strpos($name, "\0")) { - throw new LoaderError('A template name cannot contain NUL bytes.'); - } - - $name = ltrim($name, '/'); - $parts = explode('/', $name); - $level = 0; - foreach ($parts as $part) { - if ('..' === $part) { - --$level; - } elseif ('.' !== $part) { - ++$level; - } - - if ($level < 0) { - throw new LoaderError(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); - } - } - } - - private function isAbsolutePath($file) - { - return strspn($file, '/\\', 0, 1) - || (\strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === substr($file, 1, 1) - && strspn($file, '/\\', 2, 1) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ; - } -} - -class_alias('Twig\Loader\FilesystemLoader', 'Twig_Loader_Filesystem'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NullCoalesceExpression.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NullCoalesceExpression.php deleted file mode 100644 index 917d31a..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NullCoalesceExpression.php +++ /dev/null @@ -1,62 +0,0 @@ -getTemplateLine()); - // for "block()", we don't need the null test as the return value is always a string - if (!$left instanceof BlockReferenceExpression) { - $test = new AndBinary( - $test, - new NotUnary(new NullTest($left, 'null', new Node(), $left->getTemplateLine()), $left->getTemplateLine()), - $left->getTemplateLine() - ); - } - - parent::__construct($test, $left, $right, $lineno); - } - - public function compile(Compiler $compiler) - { - /* - * This optimizes only one case. PHP 7 also supports more complex expressions - * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, - * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced - * cases might be implemented as an optimizer node visitor, but has not been done - * as benefits are probably not worth the added complexity. - */ - if (\PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof NameExpression) { - $this->getNode('expr2')->setAttribute('always_defined', true); - $compiler - ->raw('((') - ->subcompile($this->getNode('expr2')) - ->raw(') ?? (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } else { - parent::compile($compiler); - } - } -} - -class_alias('Twig\Node\Expression\NullCoalesceExpression', 'Twig_Node_Expression_NullCoalesce'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/MacroNode.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/MacroNode.php deleted file mode 100644 index 6eb6795..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/MacroNode.php +++ /dev/null @@ -1,136 +0,0 @@ - - */ -class MacroNode extends Node -{ - const VARARGS_NAME = 'varargs'; - - public function __construct($name, \Twig_NodeInterface $body, \Twig_NodeInterface $arguments, $lineno, $tag = null) - { - foreach ($arguments as $argumentName => $argument) { - if (self::VARARGS_NAME === $argumentName) { - throw new SyntaxError(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(), $argument->getSourceContext()); - } - } - - parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf('public function get%s(', $this->getAttribute('name'))) - ; - - $count = \count($this->getNode('arguments')); - $pos = 0; - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->raw('$__'.$name.'__ = ') - ->subcompile($default) - ; - - if (++$pos < $count) { - $compiler->raw(', '); - } - } - - if (\PHP_VERSION_ID >= 50600) { - if ($count) { - $compiler->raw(', '); - } - - $compiler->raw('...$__varargs__'); - } - - $compiler - ->raw(")\n") - ->write("{\n") - ->indent() - ; - - $compiler - ->write("\$context = \$this->env->mergeGlobals([\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $__'.$name.'__') - ->raw(",\n") - ; - } - - $compiler - ->write('') - ->string(self::VARARGS_NAME) - ->raw(' => ') - ; - - if (\PHP_VERSION_ID >= 50600) { - $compiler->raw("\$__varargs__,\n"); - } else { - $compiler - ->raw('func_num_args() > ') - ->repr($count) - ->raw(' ? array_slice(func_get_args(), ') - ->repr($count) - ->raw(") : [],\n") - ; - } - - $compiler - ->outdent() - ->write("]);\n\n") - ->write("\$blocks = [];\n\n") - ; - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->write("try {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("} catch (\Exception \$e) {\n") - ->indent() - ->write("ob_end_clean();\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("} catch (\Throwable \$e) {\n") - ->indent() - ->write("ob_end_clean();\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n") - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig\Node\MacroNode', 'Twig_Node_Macro'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetNode.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetNode.php deleted file mode 100644 index 656103b..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetNode.php +++ /dev/null @@ -1,107 +0,0 @@ - - */ -class SetNode extends Node implements NodeCaptureInterface -{ - public function __construct($capture, \Twig_NodeInterface $names, \Twig_NodeInterface $values, $lineno, $tag = null) - { - parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => false], $lineno, $tag); - - /* - * Optimizes the node when capture is used for a large block of text. - * - * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo"); - */ - if ($this->getAttribute('capture')) { - $this->setAttribute('safe', true); - - $values = $this->getNode('values'); - if ($values instanceof TextNode) { - $this->setNode('values', new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); - $this->setAttribute('capture', false); - } - } - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if (\count($this->getNode('names')) > 1) { - $compiler->write('list('); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('capture')) { - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->subcompile($this->getNode('values')) - ; - } - - $compiler->subcompile($this->getNode('names'), false); - - if ($this->getAttribute('capture')) { - $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); - } - } - - if (!$this->getAttribute('capture')) { - $compiler->raw(' = '); - - if (\count($this->getNode('names')) > 1) { - $compiler->write('['); - foreach ($this->getNode('values') as $idx => $value) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($value); - } - $compiler->raw(']'); - } else { - if ($this->getAttribute('safe')) { - $compiler - ->raw("('' === \$tmp = ") - ->subcompile($this->getNode('values')) - ->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())") - ; - } else { - $compiler->subcompile($this->getNode('values')); - } - } - } - - $compiler->raw(";\n"); - } -} - -class_alias('Twig\Node\SetNode', 'Twig_Node_Set'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SpacelessNode.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SpacelessNode.php deleted file mode 100644 index c8d32da..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SpacelessNode.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class SpacelessNode extends Node -{ - public function __construct(\Twig_NodeInterface $body, $lineno, $tag = 'spaceless') - { - parent::__construct(['body' => $body], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ; - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->subcompile($this->getNode('body')) - ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") - ; - } -} - -class_alias('Twig\Node\SpacelessNode', 'Twig_Node_Spaceless'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php deleted file mode 100644 index c940339..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php +++ /dev/null @@ -1,137 +0,0 @@ - - */ -class SandboxNodeVisitor extends AbstractNodeVisitor -{ - protected $inAModule = false; - protected $tags; - protected $filters; - protected $functions; - - private $needsToStringWrap = false; - - protected function doEnterNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = true; - $this->tags = []; - $this->filters = []; - $this->functions = []; - - return $node; - } elseif ($this->inAModule) { - // look for tags - if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { - $this->tags[$node->getNodeTag()] = $node; - } - - // look for filters - if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { - $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; - } - - // look for functions - if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { - $this->functions[$node->getAttribute('name')] = $node; - } - - // the .. operator is equivalent to the range() function - if ($node instanceof RangeBinary && !isset($this->functions['range'])) { - $this->functions['range'] = $node; - } - - if ($node instanceof PrintNode) { - $this->needsToStringWrap = true; - $this->wrapNode($node, 'expr'); - } - - if ($node instanceof SetNode && !$node->getAttribute('capture')) { - $this->needsToStringWrap = true; - } - - // wrap outer nodes that can implicitly call __toString() - if ($this->needsToStringWrap) { - if ($node instanceof ConcatBinary) { - $this->wrapNode($node, 'left'); - $this->wrapNode($node, 'right'); - } - if ($node instanceof FilterExpression) { - $this->wrapNode($node, 'node'); - $this->wrapArrayNode($node, 'arguments'); - } - if ($node instanceof FunctionExpression) { - $this->wrapArrayNode($node, 'arguments'); - } - } - } - - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = false; - - $node->getNode('constructor_end')->setNode('_security_check', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')])); - } elseif ($this->inAModule) { - if ($node instanceof PrintNode || $node instanceof SetNode) { - $this->needsToStringWrap = false; - } - } - - return $node; - } - - private function wrapNode(Node $node, $name) - { - $expr = $node->getNode($name); - if ($expr instanceof NameExpression || $expr instanceof GetAttrExpression) { - $node->setNode($name, new CheckToStringNode($expr)); - } - } - - private function wrapArrayNode(Node $node, $name) - { - $args = $node->getNode($name); - foreach ($args as $name => $_) { - $this->wrapNode($args, $name); - } - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig\NodeVisitor\SandboxNodeVisitor', 'Twig_NodeVisitor_Sandbox'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Parser.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Parser.php deleted file mode 100644 index 9fb6a83..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Parser.php +++ /dev/null @@ -1,439 +0,0 @@ - - */ -class Parser implements \Twig_ParserInterface -{ - protected $stack = []; - protected $stream; - protected $parent; - protected $handlers; - protected $visitors; - protected $expressionParser; - protected $blocks; - protected $blockStack; - protected $macros; - protected $env; - protected $reservedMacroNames; - protected $importedSymbols; - protected $traits; - protected $embeddedTemplates = []; - private $varNameSalt = 0; - - public function __construct(Environment $env) - { - $this->env = $env; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getEnvironment() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - return $this->env; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); - } - - /** - * @deprecated since 1.27 (to be removed in 2.0). Use $parser->getStream()->getSourceContext()->getPath() instead. - */ - public function getFilename() - { - @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); - - return $this->stream->getSourceContext()->getName(); - } - - public function parse(TokenStream $stream, $test = null, $dropNeedle = false) - { - // push all variables into the stack to keep the current state of the parser - // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336 - // This hack can be removed when min version if PHP 7.0 - $vars = []; - foreach ($this as $k => $v) { - $vars[$k] = $v; - } - - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); - $this->stack[] = $vars; - - // tag handlers - if (null === $this->handlers) { - $this->handlers = $this->env->getTokenParsers(); - $this->handlers->setParser($this); - } - - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); - } - - if (null === $this->expressionParser) { - $this->expressionParser = new ExpressionParser($this, $this->env); - } - - $this->stream = $stream; - $this->parent = null; - $this->blocks = []; - $this->macros = []; - $this->traits = []; - $this->blockStack = []; - $this->importedSymbols = [[]]; - $this->embeddedTemplates = []; - $this->varNameSalt = 0; - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { - $body = new Node(); - } - } catch (SyntaxError $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->stream->getSourceContext()); - } - - if (!$e->getTemplateLine()) { - $e->setTemplateLine($this->stream->getCurrent()->getLine()); - } - - throw $e; - } - - $node = new ModuleNode(new BodyNode([$body]), $this->parent, new Node($this->blocks), new Node($this->macros), new Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); - - $traverser = new NodeTraverser($this->env, $this->visitors); - - $node = $traverser->traverse($node); - - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } - - return $node; - } - - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = []; - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case Token::TEXT_TYPE: - $token = $this->stream->next(); - $rv[] = new TextNode($token->getValue(), $token->getLine()); - break; - - case Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Token::VAR_END_TYPE); - $rv[] = new PrintNode($expr, $token->getLine()); - break; - - case Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if (Token::NAME_TYPE !== $token->getType()) { - throw new SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); - } - - if (null !== $test && \call_user_func($test, $token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === \count($rv)) { - return $rv[0]; - } - - return new Node($rv, [], $lineno); - } - - $subparser = $this->handlers->getTokenParser($token->getValue()); - if (null === $subparser) { - if (null !== $test) { - $e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - - if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) { - $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); - } - } else { - $e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); - } - - throw $e; - } - - $this->stream->next(); - - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); - } - } - - if (1 === \count($rv)) { - return $rv[0]; - } - - return new Node($rv, [], $lineno); - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function addHandler($name, $class) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - $this->handlers[$name] = $class; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function addNodeVisitor(NodeVisitorInterface $visitor) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - $this->visitors[] = $visitor; - } - - public function getBlockStack() - { - return $this->blockStack; - } - - public function peekBlockStack() - { - return isset($this->blockStack[\count($this->blockStack) - 1]) ? $this->blockStack[\count($this->blockStack) - 1] : null; - } - - public function popBlockStack() - { - array_pop($this->blockStack); - } - - public function pushBlockStack($name) - { - $this->blockStack[] = $name; - } - - public function hasBlock($name) - { - return isset($this->blocks[$name]); - } - - public function getBlock($name) - { - return $this->blocks[$name]; - } - - public function setBlock($name, BlockNode $value) - { - $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); - } - - public function hasMacro($name) - { - return isset($this->macros[$name]); - } - - public function setMacro($name, MacroNode $node) - { - if ($this->isReservedMacroName($name)) { - throw new SyntaxError(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - $this->macros[$name] = $node; - } - - public function isReservedMacroName($name) - { - if (null === $this->reservedMacroNames) { - $this->reservedMacroNames = []; - $r = new \ReflectionClass($this->env->getBaseTemplateClass()); - foreach ($r->getMethods() as $method) { - $methodName = strtr($method->getName(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); - - if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) { - $this->reservedMacroNames[] = substr($methodName, 3); - } - } - } - - return \in_array(strtr($name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $this->reservedMacroNames); - } - - public function addTrait($trait) - { - $this->traits[] = $trait; - } - - public function hasTraits() - { - return \count($this->traits) > 0; - } - - public function embedTemplate(ModuleNode $template) - { - $template->setIndex(mt_rand()); - - $this->embeddedTemplates[] = $template; - } - - public function addImportedSymbol($type, $alias, $name = null, AbstractExpression $node = null) - { - $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; - } - - public function getImportedSymbol($type, $alias) - { - if (null !== $this->peekBlockStack()) { - foreach ($this->importedSymbols as $functions) { - if (isset($functions[$type][$alias])) { - if (\count($this->blockStack) > 1) { - return null; - } - - return $functions[$type][$alias]; - } - } - } else { - return isset($this->importedSymbols[0][$type][$alias]) ? $this->importedSymbols[0][$type][$alias] : null; - } - } - - public function isMainScope() - { - return 1 === \count($this->importedSymbols); - } - - public function pushLocalScope() - { - array_unshift($this->importedSymbols, []); - } - - public function popLocalScope() - { - array_shift($this->importedSymbols); - } - - /** - * @return ExpressionParser - */ - public function getExpressionParser() - { - return $this->expressionParser; - } - - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return TokenStream - */ - public function getStream() - { - return $this->stream; - } - - /** - * @return Token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); - } - - protected function filterBodyNodes(\Twig_NodeInterface $node) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof TextNode && !ctype_space($node->getAttribute('data'))) - || - (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface) - ) { - if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) { - $t = substr($node->getAttribute('data'), 3); - if ('' === $t || ctype_space($t)) { - // bypass empty nodes starting with a BOM - return; - } - } - - throw new SyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - // bypass nodes that will "capture" the output - if ($node instanceof NodeCaptureInterface) { - return $node; - } - - if ($node instanceof NodeOutputInterface) { - return; - } - - foreach ($node as $k => $n) { - if (null !== $n && null === $this->filterBodyNodes($n)) { - $node->removeNode($k); - } - } - - return $node; - } -} - -class_alias('Twig\Parser', 'Twig_Parser'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicy.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicy.php deleted file mode 100644 index 6038435..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicy.php +++ /dev/null @@ -1,129 +0,0 @@ - - */ -class SecurityPolicy implements SecurityPolicyInterface -{ - protected $allowedTags; - protected $allowedFilters; - protected $allowedMethods; - protected $allowedProperties; - protected $allowedFunctions; - - public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) - { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; - $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; - } - - public function setAllowedTags(array $tags) - { - $this->allowedTags = $tags; - } - - public function setAllowedFilters(array $filters) - { - $this->allowedFilters = $filters; - } - - public function setAllowedMethods(array $methods) - { - $this->allowedMethods = []; - foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); - } - } - - public function setAllowedProperties(array $properties) - { - $this->allowedProperties = $properties; - } - - public function setAllowedFunctions(array $functions) - { - $this->allowedFunctions = $functions; - } - - public function checkSecurity($tags, $filters, $functions) - { - foreach ($tags as $tag) { - if (!\in_array($tag, $this->allowedTags)) { - throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); - } - } - - foreach ($filters as $filter) { - if (!\in_array($filter, $this->allowedFilters)) { - throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); - } - } - - foreach ($functions as $function) { - if (!\in_array($function, $this->allowedFunctions)) { - throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); - } - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($obj instanceof \Twig_TemplateInterface || $obj instanceof Markup) { - return; - } - - $allowed = false; - $method = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); - foreach ($this->allowedMethods as $class => $methods) { - if ($obj instanceof $class) { - $allowed = \in_array($method, $methods); - - break; - } - } - - if (!$allowed) { - $class = \get_class($obj); - throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); - } - } - - public function checkPropertyAllowed($obj, $property) - { - $allowed = false; - foreach ($this->allowedProperties as $class => $properties) { - if ($obj instanceof $class) { - $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); - - break; - } - } - - if (!$allowed) { - $class = \get_class($obj); - throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); - } - } -} - -class_alias('Twig\Sandbox\SecurityPolicy', 'Twig_Sandbox_SecurityPolicy'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Template.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/Template.php deleted file mode 100644 index 704125e..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/Template.php +++ /dev/null @@ -1,733 +0,0 @@ -load() - * instead, which returns an instance of \Twig\TemplateWrapper. - * - * @author Fabien Potencier - * - * @internal - */ -abstract class Template implements \Twig_TemplateInterface -{ - /** - * @internal - */ - protected static $cache = []; - - protected $parent; - protected $parents = []; - protected $env; - protected $blocks = []; - protected $traits = []; - protected $sandbox; - - public function __construct(Environment $env) - { - $this->env = $env; - } - - /** - * @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0 - */ - public function __toString() - { - return $this->getTemplateName(); - } - - /** - * Returns the template name. - * - * @return string The template name - */ - abstract public function getTemplateName(); - - /** - * Returns debug information about the template. - * - * @return array Debug information - */ - public function getDebugInfo() - { - return []; - } - - /** - * Returns the template source code. - * - * @return string The template source code - * - * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead - */ - public function getSource() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); - - return ''; - } - - /** - * Returns information about the original template source code. - * - * @return Source - */ - public function getSourceContext() - { - return new Source('', $this->getTemplateName()); - } - - /** - * @deprecated since 1.20 (to be removed in 2.0) - */ - public function getEnvironment() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED); - - return $this->env; - } - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @param array $context - * - * @return \Twig_TemplateInterface|TemplateWrapper|false The parent template or false if there is no parent - * - * @internal - */ - public function getParent(array $context) - { - if (null !== $this->parent) { - return $this->parent; - } - - try { - $parent = $this->doGetParent($context); - - if (false === $parent) { - return false; - } - - if ($parent instanceof self || $parent instanceof TemplateWrapper) { - return $this->parents[$parent->getSourceContext()->getName()] = $parent; - } - - if (!isset($this->parents[$parent])) { - $this->parents[$parent] = $this->loadTemplate($parent); - } - } catch (LoaderError $e) { - $e->setSourceContext(null); - $e->guess(); - - throw $e; - } - - return $this->parents[$parent]; - } - - protected function doGetParent(array $context) - { - return false; - } - - public function isTraitable() - { - return true; - } - - /** - * Displays a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - */ - public function displayParentBlock($name, array $context, array $blocks = []) - { - $name = (string) $name; - - if (isset($this->traits[$name])) { - $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, $blocks, false); - } else { - throw new RuntimeError(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); - } - } - - /** - * Displays a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - */ - public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true) - { - $name = (string) $name; - - if ($useBlocks && isset($blocks[$name])) { - $template = $blocks[$name][0]; - $block = $blocks[$name][1]; - } elseif (isset($this->blocks[$name])) { - $template = $this->blocks[$name][0]; - $block = $this->blocks[$name][1]; - } else { - $template = null; - $block = null; - } - - // avoid RCEs when sandbox is enabled - if (null !== $template && !$template instanceof self) { - throw new \LogicException('A block must be a method on a \Twig\Template instance.'); - } - - if (null !== $template) { - try { - $template->$block($context, $blocks); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($template->getSourceContext()); - } - - // this is mostly useful for \Twig\Error\LoaderError exceptions - // see \Twig\Error\LoaderError - if (-1 === $e->getTemplateLine()) { - $e->guess(); - } - - throw $e; - } catch (\Exception $e) { - $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); - $e->guess(); - - throw $e; - } - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false); - } else { - @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); - } - } - - /** - * Renders a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - */ - public function renderParentBlock($name, array $context, array $blocks = []) - { - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Renders a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @return string The rendered block - */ - public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true) - { - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - $this->displayBlock($name, $context, $blocks, $useBlocks); - - return ob_get_clean(); - } - - /** - * Returns whether a block exists or not in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param string $name The block name - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return bool true if the block exists, false otherwise - */ - public function hasBlock($name, array $context = null, array $blocks = []) - { - if (null === $context) { - @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); - - return isset($this->blocks[(string) $name]); - } - - if (isset($blocks[$name])) { - return $blocks[$name][0] instanceof self; - } - - if (isset($this->blocks[$name])) { - return true; - } - - if (false !== $parent = $this->getParent($context)) { - return $parent->hasBlock($name, $context); - } - - return false; - } - - /** - * Returns all block names in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return array An array of block names - */ - public function getBlockNames(array $context = null, array $blocks = []) - { - if (null === $context) { - @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); - - return array_keys($this->blocks); - } - - $names = array_merge(array_keys($blocks), array_keys($this->blocks)); - - if (false !== $parent = $this->getParent($context)) { - $names = array_merge($names, $parent->getBlockNames($context)); - } - - return array_unique($names); - } - - /** - * @return Template|TemplateWrapper - */ - protected function loadTemplate($template, $templateName = null, $line = null, $index = null) - { - try { - if (\is_array($template)) { - return $this->env->resolveTemplate($template); - } - - if ($template instanceof self || $template instanceof TemplateWrapper) { - return $template; - } - - if ($template === $this->getTemplateName()) { - $class = \get_class($this); - if (false !== $pos = strrpos($class, '___', -1)) { - $class = substr($class, 0, $pos); - } - - return $this->env->loadClass($class, $template, $index); - } - - return $this->env->loadTemplate($template, $index); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); - } - - if ($e->getTemplateLine() > 0) { - throw $e; - } - - if (!$line) { - $e->guess(); - } else { - $e->setTemplateLine($line); - } - - throw $e; - } - } - - /** - * @internal - * - * @return Template - */ - protected function unwrap() - { - return $this; - } - - /** - * Returns all blocks. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of blocks - */ - public function getBlocks() - { - return $this->blocks; - } - - public function display(array $context, array $blocks = []) - { - $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); - } - - public function render(array $context) - { - $level = ob_get_level(); - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - try { - $this->display($context); - } catch (\Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - protected function displayWithErrorHandling(array $context, array $blocks = []) - { - try { - $this->doDisplay($context, $blocks); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->getSourceContext()); - } - - // this is mostly useful for \Twig\Error\LoaderError exceptions - // see \Twig\Error\LoaderError - if (-1 === $e->getTemplateLine()) { - $e->guess(); - } - - throw $e; - } catch (\Exception $e) { - $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); - $e->guess(); - - throw $e; - } - } - - /** - * Auto-generated method to display the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - abstract protected function doDisplay(array $context, array $blocks = []); - - /** - * Returns a variable from the context. - * - * This method is for internal use only and should never be called - * directly. - * - * This method should not be overridden in a sub-class as this is an - * implementation detail that has been introduced to optimize variable - * access for versions of PHP before 5.4. This is not a way to override - * the way to get a variable value. - * - * @param array $context The context - * @param string $item The variable to return from the context - * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not - * - * @return mixed The content of the context variable - * - * @throws RuntimeError if the variable does not exist and Twig is running in strict mode - * - * @internal - */ - final protected function getContext($context, $item, $ignoreStrictCheck = false) - { - if (!\array_key_exists($item, $context)) { - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - throw new RuntimeError(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext()); - } - - return $context[$item]; - } - - /** - * Returns the attribute value for a given array/object. - * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see \Twig\Template constants) - * @param bool $isDefinedTest Whether this is only a defined check - * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not - * - * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true - * - * @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false - * - * @internal - */ - protected function getAttribute($object, $item, array $arguments = [], $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) - { - // array - if (self::METHOD_CALL !== $type) { - $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; - - if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object))) - || ($object instanceof \ArrayAccess && isset($object[$arrayItem])) - ) { - if ($isDefinedTest) { - return true; - } - - return $object[$arrayItem]; - } - - if (self::ARRAY_CALL === $type || !\is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - if ($object instanceof \ArrayAccess) { - $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); - } elseif (\is_object($object)) { - $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); - } elseif (\is_array($object)) { - if (empty($object)) { - $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); - } else { - $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); - } - } elseif (self::ARRAY_CALL === $type) { - if (null === $object) { - $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - } elseif (null === $object) { - $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - - throw new RuntimeError($message, -1, $this->getSourceContext()); - } - } - - if (!\is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - if (null === $object) { - $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); - } elseif (\is_array($object)) { - $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); - } else { - $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - - throw new RuntimeError($message, -1, $this->getSourceContext()); - } - - // object property - if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones - if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) { - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { - $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkPropertyAllowed($object, $item); - } - - return $object->$item; - } - } - - $class = \get_class($object); - - // object method - if (!isset(self::$cache[$class])) { - // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates - if ($object instanceof self) { - $ref = new \ReflectionClass($class); - $methods = []; - - foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) { - // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment - if ('getenvironment' !== strtr($refMethod->name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) { - $methods[] = $refMethod->name; - } - } - } else { - $methods = get_class_methods($object); - } - // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods - sort($methods); - - $cache = []; - - foreach ($methods as $method) { - $cache[$method] = $method; - $cache[$lcName = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')] = $method; - - if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { - $name = substr($method, 2); - $lcName = substr($lcName, 2); - } else { - continue; - } - - // skip get() and is() methods (in which case, $name is empty) - if ($name) { - if (!isset($cache[$name])) { - $cache[$name] = $method; - } - if (!isset($cache[$lcName])) { - $cache[$lcName] = $method; - } - } - } - self::$cache[$class] = $cache; - } - - $call = false; - if (isset(self::$cache[$class][$item])) { - $method = self::$cache[$class][$item]; - } elseif (isset(self::$cache[$class][$lcItem = strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) { - $method = self::$cache[$class][$lcItem]; - } elseif (isset(self::$cache[$class]['__call'])) { - $method = $item; - $call = true; - } else { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - throw new RuntimeError(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()); - } - - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { - $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method); - } - - // Some objects throw exceptions when they have __call, and the method we try - // to call is not supported. If ignoreStrictCheck is true, we should return null. - try { - if (!$arguments) { - $ret = $object->$method(); - } else { - $ret = \call_user_func_array([$object, $method], $arguments); - } - } catch (\BadMethodCallException $e) { - if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { - return; - } - throw $e; - } - - // @deprecated in 1.28 - if ($object instanceof \Twig_TemplateInterface) { - $self = $object->getTemplateName() === $this->getTemplateName(); - $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()); - if ('renderBlock' === $method || 'displayBlock' === $method) { - $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template'); - } elseif ('hasBlock' === $method) { - $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template'); - } elseif ('render' === $method || 'display' === $method) { - $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName()); - } - @trigger_error($message, E_USER_DEPRECATED); - - return '' === $ret ? '' : new Markup($ret, $this->env->getCharset()); - } - - return $ret; - } -} - -class_alias('Twig\Template', 'Twig_Template'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TemplateWrapper.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/TemplateWrapper.php deleted file mode 100644 index e265409..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/TemplateWrapper.php +++ /dev/null @@ -1,161 +0,0 @@ - - */ -final class TemplateWrapper -{ - private $env; - private $template; - - /** - * This method is for internal use only and should never be called - * directly (use Twig\Environment::load() instead). - * - * @internal - */ - public function __construct(Environment $env, Template $template) - { - $this->env = $env; - $this->template = $template; - } - - /** - * Renders the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - */ - public function render($context = []) - { - // using func_get_args() allows to not expose the blocks argument - // as it should only be used by internal code - return $this->template->render($context, \func_num_args() > 1 ? func_get_arg(1) : []); - } - - /** - * Displays the template. - * - * @param array $context An array of parameters to pass to the template - */ - public function display($context = []) - { - // using func_get_args() allows to not expose the blocks argument - // as it should only be used by internal code - $this->template->display($context, \func_num_args() > 1 ? func_get_arg(1) : []); - } - - /** - * Checks if a block is defined. - * - * @param string $name The block name - * @param array $context An array of parameters to pass to the template - * - * @return bool - */ - public function hasBlock($name, $context = []) - { - return $this->template->hasBlock($name, $context); - } - - /** - * Returns defined block names in the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string[] An array of defined template block names - */ - public function getBlockNames($context = []) - { - return $this->template->getBlockNames($context); - } - - /** - * Renders a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered block - */ - public function renderBlock($name, $context = []) - { - $context = $this->env->mergeGlobals($context); - $level = ob_get_level(); - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - try { - $this->template->displayBlock($name, $context); - } catch (\Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - /** - * Displays a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - */ - public function displayBlock($name, $context = []) - { - $this->template->displayBlock($name, $this->env->mergeGlobals($context)); - } - - /** - * @return Source - */ - public function getSourceContext() - { - return $this->template->getSourceContext(); - } - - /** - * @return string - */ - public function getTemplateName() - { - return $this->template->getTemplateName(); - } - - /** - * @internal - * - * @return Template - */ - public function unwrap() - { - return $this->template; - } -} - -class_alias('Twig\TemplateWrapper', 'Twig_TemplateWrapper'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ExtendsTokenParser.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ExtendsTokenParser.php deleted file mode 100644 index e66789a..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ExtendsTokenParser.php +++ /dev/null @@ -1,54 +0,0 @@ -parser->getStream(); - - if ($this->parser->peekBlockStack()) { - throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); - } elseif (!$this->parser->isMainScope()) { - throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); - } - - if (null !== $this->parser->getParent()) { - throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); - } - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); - - $stream->expect(Token::BLOCK_END_TYPE); - - return new Node(); - } - - public function getTag() - { - return 'extends'; - } -} - -class_alias('Twig\TokenParser\ExtendsTokenParser', 'Twig_TokenParser_Extends'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FromTokenParser.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FromTokenParser.php deleted file mode 100644 index 4cce650..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FromTokenParser.php +++ /dev/null @@ -1,72 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Token::NAME_TYPE, 'import'); - - $targets = []; - do { - $name = $stream->expect(Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } while (true); - - $stream->expect(Token::BLOCK_END_TYPE); - - $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine()); - $node = new ImportNode($macro, $var, $token->getLine(), $this->getTag()); - - foreach ($targets as $name => $alias) { - if ($this->parser->isReservedMacroName($name)) { - throw new SyntaxError(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); - } - - $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $var); - } - - return $node; - } - - public function getTag() - { - return 'from'; - } -} - -class_alias('Twig\TokenParser\FromTokenParser', 'Twig_TokenParser_From'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ImportTokenParser.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ImportTokenParser.php deleted file mode 100644 index 88395b9..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ImportTokenParser.php +++ /dev/null @@ -1,45 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(Token::NAME_TYPE, 'as'); - $var = new AssignNameExpression($this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); - - return new ImportNode($macro, $var, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'import'; - } -} - -class_alias('Twig\TokenParser\ImportTokenParser', 'Twig_TokenParser_Import'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenStream.php b/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenStream.php deleted file mode 100644 index 4597816..0000000 --- a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenStream.php +++ /dev/null @@ -1,201 +0,0 @@ - - */ -class TokenStream -{ - protected $tokens; - protected $current = 0; - protected $filename; - - private $source; - - /** - * @param array $tokens An array of tokens - * @param string|null $name The name of the template which tokens are associated with - * @param string|null $source The source code associated with the tokens - */ - public function __construct(array $tokens, $name = null, $source = null) - { - if (!$name instanceof Source) { - if (null !== $name || null !== $source) { - @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); - } - $this->source = new Source($source, $name); - } else { - $this->source = $name; - } - - $this->tokens = $tokens; - - // deprecated, not used anymore, to be removed in 2.0 - $this->filename = $this->source->getName(); - } - - public function __toString() - { - return implode("\n", $this->tokens); - } - - public function injectTokens(array $tokens) - { - $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); - } - - /** - * Sets the pointer to the next token and returns the old one. - * - * @return Token - */ - public function next() - { - if (!isset($this->tokens[++$this->current])) { - throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current - 1]; - } - - /** - * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. - * - * @return Token|null The next token if the condition is true, null otherwise - */ - public function nextIf($primary, $secondary = null) - { - if ($this->tokens[$this->current]->test($primary, $secondary)) { - return $this->next(); - } - } - - /** - * Tests a token and returns it or throws a syntax error. - * - * @return Token - */ - public function expect($type, $value = null, $message = null) - { - $token = $this->tokens[$this->current]; - if (!$token->test($type, $value)) { - $line = $token->getLine(); - throw new SyntaxError(sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', - $message ? $message.'. ' : '', - Token::typeToEnglish($token->getType()), - $token->getValue() ? sprintf(' of value "%s"', $token->getValue()) : '', - Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), - $line, - $this->source - ); - } - $this->next(); - - return $token; - } - - /** - * Looks at the next token. - * - * @param int $number - * - * @return Token - */ - public function look($number = 1) - { - if (!isset($this->tokens[$this->current + $number])) { - throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current + $number]; - } - - /** - * Tests the current token. - * - * @return bool - */ - public function test($primary, $secondary = null) - { - return $this->tokens[$this->current]->test($primary, $secondary); - } - - /** - * Checks if end of stream was reached. - * - * @return bool - */ - public function isEOF() - { - return Token::EOF_TYPE === $this->tokens[$this->current]->getType(); - } - - /** - * @return Token - */ - public function getCurrent() - { - return $this->tokens[$this->current]; - } - - /** - * Gets the name associated with this stream (null if not defined). - * - * @return string|null - * - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getFilename() - { - @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); - - return $this->source->getName(); - } - - /** - * Gets the source code associated with this stream. - * - * @return string - * - * @internal Don't use this as it might be empty depending on the environment configuration - * - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getSource() - { - @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); - - return $this->source->getCode(); - } - - /** - * Gets the source associated with this stream. - * - * @return Source - * - * @internal - */ - public function getSourceContext() - { - return $this->source; - } -} - -class_alias('Twig\TokenStream', 'Twig_TokenStream'); diff --git a/system/templateEngines/Twig/Twig1x/vendor/autoload.php b/system/templateEngines/Twig/Twig1x/vendor/autoload.php new file mode 100644 index 0000000..ba87517 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/InstalledVersions.php b/system/templateEngines/Twig/Twig1x/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..d50e0c9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/InstalledVersions.php @@ -0,0 +1,350 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/system/templateEngines/Twig/Twig1x/composer/LICENSE b/system/templateEngines/Twig/Twig1x/vendor/composer/LICENSE similarity index 100% rename from system/templateEngines/Twig/Twig1x/composer/LICENSE rename to system/templateEngines/Twig/Twig1x/vendor/composer/LICENSE diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_classmap.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..b26f1b1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/system/templateEngines/Twig/Twig1x/composer/autoload_files.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_files.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/composer/autoload_files.php rename to system/templateEngines/Twig/Twig1x/vendor/composer/autoload_files.php diff --git a/system/templateEngines/Twig/Twig1x/composer/autoload_namespaces.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_namespaces.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/composer/autoload_namespaces.php rename to system/templateEngines/Twig/Twig1x/vendor/composer/autoload_namespaces.php diff --git a/system/templateEngines/Twig/Twig1x/composer/autoload_psr4.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_psr4.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/composer/autoload_psr4.php rename to system/templateEngines/Twig/Twig1x/vendor/composer/autoload_psr4.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_real.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_real.php new file mode 100644 index 0000000..3c8f095 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_real.php @@ -0,0 +1,78 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequired25cb76cddd6d156bbe462150d7e99ae($fileIdentifier, $file); + } + + return $loader; + } +} + +/** + * @param string $fileIdentifier + * @param string $file + * @return void + */ +function composerRequired25cb76cddd6d156bbe462150d7e99ae($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_static.php b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_static.php new file mode 100644 index 0000000..b279c1d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/autoload_static.php @@ -0,0 +1,59 @@ + __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'T' => + array ( + 'Twig\\' => 5, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Ctype\\' => 23, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + ); + + public static $prefixesPsr0 = array ( + 'T' => + array ( + 'Twig_' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/lib', + ), + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::$prefixesPsr0; + $loader->classMap = ComposerStaticInitd25cb76cddd6d156bbe462150d7e99ae::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/installed.json b/system/templateEngines/Twig/Twig1x/vendor/composer/installed.json new file mode 100644 index 0000000..dc33600 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/installed.json @@ -0,0 +1,161 @@ +{ + "packages": [ + { + "name": "symfony/polyfill-ctype", + "version": "v1.19.0", + "version_normalized": "1.19.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2020-10-23T09:01:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-ctype" + }, + { + "name": "twig/twig", + "version": "v1.41.0", + "version_normalized": "1.41.0.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "575cd5028362da591facde1ef5d7b94553c375c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/575cd5028362da591facde1ef5d7b94553c375c9", + "reference": "575cd5028362da591facde1ef5d7b94553c375c9", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + }, + "time": "2019-05-14T11:59:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.41-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/1.x" + }, + "install-path": "../twig/twig" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/composer/installed.php b/system/templateEngines/Twig/Twig1x/vendor/composer/installed.php new file mode 100644 index 0000000..25dc620 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/composer/installed.php @@ -0,0 +1,41 @@ + array( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => '5f95caecf5ad6c259def076c6ebaa5a42461206e', + 'name' => '__root__', + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => '5f95caecf5ad6c259def076c6ebaa5a42461206e', + 'dev_requirement' => false, + ), + 'symfony/polyfill-ctype' => array( + 'pretty_version' => 'v1.19.0', + 'version' => '1.19.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', + 'aliases' => array(), + 'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b', + 'dev_requirement' => false, + ), + 'twig/twig' => array( + 'pretty_version' => 'v1.41.0', + 'version' => '1.41.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../twig/twig', + 'aliases' => array(), + 'reference' => '575cd5028362da591facde1ef5d7b94553c375c9', + 'dev_requirement' => false, + ), + ), +); diff --git a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/Ctype.php b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/Ctype.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/Ctype.php rename to system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/Ctype.php diff --git a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/LICENSE b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/LICENSE similarity index 100% rename from system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/LICENSE rename to system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/LICENSE diff --git a/system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/README.md b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/README.md similarity index 100% rename from system/templateEngines/Twig/Twig1x/symfony/polyfill-ctype/README.md rename to system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/README.md diff --git a/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/bootstrap.php b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/bootstrap.php new file mode 100644 index 0000000..0bc45cf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/bootstrap.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Ctype as p; + +if (!function_exists('ctype_alnum')) { + function ctype_alnum($input) { return p\Ctype::ctype_alnum($input); } +} +if (!function_exists('ctype_alpha')) { + function ctype_alpha($input) { return p\Ctype::ctype_alpha($input); } +} +if (!function_exists('ctype_cntrl')) { + function ctype_cntrl($input) { return p\Ctype::ctype_cntrl($input); } +} +if (!function_exists('ctype_digit')) { + function ctype_digit($input) { return p\Ctype::ctype_digit($input); } +} +if (!function_exists('ctype_graph')) { + function ctype_graph($input) { return p\Ctype::ctype_graph($input); } +} +if (!function_exists('ctype_lower')) { + function ctype_lower($input) { return p\Ctype::ctype_lower($input); } +} +if (!function_exists('ctype_print')) { + function ctype_print($input) { return p\Ctype::ctype_print($input); } +} +if (!function_exists('ctype_punct')) { + function ctype_punct($input) { return p\Ctype::ctype_punct($input); } +} +if (!function_exists('ctype_space')) { + function ctype_space($input) { return p\Ctype::ctype_space($input); } +} +if (!function_exists('ctype_upper')) { + function ctype_upper($input) { return p\Ctype::ctype_upper($input); } +} +if (!function_exists('ctype_xdigit')) { + function ctype_xdigit($input) { return p\Ctype::ctype_xdigit($input); } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/composer.json b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/composer.json new file mode 100644 index 0000000..d7c9abb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/symfony/polyfill-ctype/composer.json @@ -0,0 +1,38 @@ +{ + "name": "symfony/polyfill-ctype", + "type": "library", + "description": "Symfony polyfill for ctype functions", + "keywords": ["polyfill", "compatibility", "portable", "ctype"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, + "files": [ "bootstrap.php" ] + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/.editorconfig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.editorconfig similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/.editorconfig rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/.editorconfig diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.gitignore b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.gitignore new file mode 100644 index 0000000..3110362 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.gitignore @@ -0,0 +1,5 @@ +/build +/composer.lock +/ext/twig/autom4te.cache/ +/phpunit.xml +/vendor diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.php_cs.dist b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.php_cs.dist new file mode 100644 index 0000000..1b31c0a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.php_cs.dist @@ -0,0 +1,18 @@ +setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => ['syntax' => 'short'], + 'php_unit_fqcn_annotation' => true, + 'no_unreachable_default_argument_value' => false, + 'braces' => ['allow_single_line_closure' => true], + 'heredoc_to_nowdoc' => false, + 'ordered_imports' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'], + ]) + ->setRiskyAllowed(true) + ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) +; diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.travis.yml b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.travis.yml new file mode 100644 index 0000000..291b4a9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/.travis.yml @@ -0,0 +1,44 @@ +language: php + +sudo: false + +cache: + directories: + - vendor + - $HOME/.composer/cache/files + +env: + - TWIG_EXT=no + +before_install: + - phpenv config-rm xdebug.ini || return 0 + +install: + - travis_retry composer install + +before_script: + - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi + - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi + +script: ./vendor/bin/simple-phpunit + +jobs: + fast_finish: true + include: + - php: 5.4 + - php: 5.4 + env: TWIG_EXT=yes + - php: 5.5 + - php: 5.5 + env: TWIG_EXT=yes + - php: 5.6 + - php: 5.6 + env: TWIG_EXT=yes + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4snapshot + - stage: integration tests + php: 7.3 + script: ./drupal_test.sh diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/CHANGELOG b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/CHANGELOG new file mode 100644 index 0000000..72948e5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/CHANGELOG @@ -0,0 +1,1105 @@ +* 1.41.0 (2019-05-14) + + * fixed support for PHP 7.4 + * added "filter", "map", and "reduce" filters (and support for arrow functions) + * fixed partial output leak when a PHP fatal error occurs + * optimized context access on PHP 7.4 + +* 1.40.1 (2019-04-29) + +* fixed regression in NodeTraverser + +* 1.40.0 (2019-04-28) + + * allowed Twig\NodeVisitor\NodeVisitorInterface::leaveNode() to return "null" instead of "false" (same meaning) + * added the "apply" tag as a replacement for the "filter" tag + * allowed Twig\Loader\FilesystemLoader::findTemplate() to return "null" instead of "false" (same meaning) + * added support for "Twig\Markup" instances in the "in" test + * fixed Lexer when using custom options containing the # char + * fixed "import" when macros are stored in a template string + +* 1.39.1 (2019-04-16) + + * fixed EscaperNodeVisitor + +* 1.39.0 (2019-04-16) + + * added Traversable support for the length filter + * fixed some wrong location in error messages + * made exception creation faster + * made escaping on ternary expressions (?: and ??) more fine-grained + * added the possibility to give a nice name to string templates (template_from_string function) + * fixed the "with" behavior to always include the globals (for consistency with the "include" and "embed" tags) + * fixed "include" with "ignore missing" when an error loading occurs in the included template + * added support for a new whitespace trimming option ({%~ ~%}, {{~ ~}}, {#~ ~#}) + +* 1.38.4 (2019-03-23) + + * fixed CheckToStringNode implementation (broken when a function/filter is variadic) + +* 1.38.3 (2019-03-21) + + * fixed the spaceless filter so that it behaves like the spaceless tag + * fixed BC break on Environment::resolveTemplate() + * fixed the bundled Autoloader to also load namespaced classes + * allowed Traversable objects to be used in the "with" tag + * allowed Traversable objects to be used in the "with" argument of the "include" and "embed" tags + +* 1.38.2 (2019-03-12) + + * added TemplateWrapper::getTemplateName() + +* 1.38.1 (2019-03-12) + + * fixed class aliases + +* 1.38.0 (2019-03-12) + + * fixed sandbox security issue (under some circumstances, calling the + __toString() method on an object was possible even if not allowed by the + security policy) + * fixed batch filter clobbers array keys when fill parameter is used + * added preserveKeys support for the batch filter + * fixed "embed" support when used from "template_from_string" + * added the possibility to pass a TemplateWrapper to Twig\Environment::load() + * improved the performance of the sandbox + * added a spaceless filter + * added max value to the "random" function + * made namespace classes the default classes (PSR-0 ones are aliases now) + * removed duplicated directory separator in FilesystemLoader + * added Twig\Loader\ChainLoader::getLoaders() + * changed internal code to use the namespaced classes as much as possible + +* 1.37.1 (2019-01-14) + + * fixed regression (key exists check for non ArrayObject objects) + * fixed logic in TemplateWrapper + +* 1.37.0 (2019-01-14) + + * fixed ArrayObject access with a null value + * fixed embedded templates starting with a BOM + * fixed using a Twig_TemplateWrapper instance as an argument to extends + * switched generated code to use the PHP short array notation + * dropped PHP 5.3 support + * fixed float representation in compiled templates + * added a second argument to the join filter (last separator configuration) + +* 1.36.0 (2018-12-16) + + * made sure twig_include returns a string + * fixed multi-byte UFT-8 in escape('html_attr') + * added the "deprecated" tag + * added support for dynamically named tests + * fixed GlobalsInterface extended class + * fixed filesystem loader throwing an exception instead of returning false + +* 1.35.4 (2018-07-13) + + * ensured that syntax errors are triggered with the right line + * added the Symfony ctype polyfill as a dependency + * "js" filter now produces valid JSON + +* 1.35.3 (2018-03-20) + + * fixed block names unicity + * fixed counting children of SimpleXMLElement objects + * added missing else clause to avoid infinite loops + * fixed .. (range operator) in sandbox policy + +* 1.35.2 (2018-03-03) + + * fixed a regression in the way the profiler is registered in templates + +* 1.35.1 (2018-03-02) + + * added an exception when using "===" instead of "same as" + * fixed possible array to string conversion concealing actual error + * made variable names deterministic in compiled templates + * fixed length filter when passing an instance of IteratorAggregate + * fixed Environment::resolveTemplate to accept instances of TemplateWrapper + +* 1.35.0 (2017-09-27) + + * added Twig_Profiler_Profile::reset() + * fixed use TokenParser to return an empty Node + * added RuntimeExtensionInterface + * added circular reference detection when loading templates + +* 1.34.4 (2017-07-04) + + * added support for runtime loaders in IntegrationTestCase + * fixed deprecation when using Twig_Profiler_Dumper_Html + +* 1.34.3 (2017-06-07) + + * fixed namespaces introduction + +* 1.34.2 (2017-06-05) + + * fixed namespaces introduction + +* 1.34.1 (2017-06-05) + + * fixed namespaces introduction + +* 1.34.0 (2017-06-05) + + * added support for PHPUnit 6 when testing extensions + * fixed PHP 7.2 compatibility + * fixed template name generation in Twig_Environment::createTemplate() + * removed final tag on Twig_TokenParser_Include + * added namespaced aliases for all (non-deprecated) classes and interfaces + * dropped HHVM support + * dropped PHP 5.2 support + +* 1.33.2 (2017-04-20) + + * fixed edge case in the method cache for Twig attributes + +* 1.33.1 (2017-04-18) + + * fixed the empty() test + +* 1.33.0 (2017-03-22) + + * fixed a race condition handling when writing cache files + * "length" filter now returns string length when applied to an object that does + not implement \Countable but provides __toString() + * "empty" test will now consider the return value of the __toString() method for + objects implement __toString() but not \Countable + * fixed JS escaping for unicode characters with higher code points + +* 1.32.0 (2017-02-26) + + * fixed deprecation notice in Twig_Util_DeprecationCollector + * added a PSR-11 compatible runtime loader + * added `side` argument to `trim` to allow left or right trimming only. + +* 1.31.0 (2017-01-11) + + * added Twig_NodeCaptureInterface for nodes that capture all output + * fixed marking the environment as initialized too early + * fixed C89 compat for the C extension + * turned fatal error into exception when a previously generated cache is corrupted + * fixed offline cache warm-ups for embedded templates + +* 1.30.0 (2016-12-23) + + * added Twig_FactoryRuntimeLoader + * deprecated function/test/filter/tag overriding + * deprecated the "disable_c_ext" attribute on Twig_Node_Expression_GetAttr + +* 1.29.0 (2016-12-13) + + * fixed sandbox being left enabled if an exception is thrown while rendering + * marked some classes as being final (via @final) + * made Twig_Error report real source path when possible + * added support for {{ _self }} to provide an upgrade path from 1.x to 2.0 (replaces {{ _self.templateName }}) + * deprecated silent display of undefined blocks + * deprecated support for mbstring.func_overload != 0 + +* 1.28.2 (2016-11-23) + + * fixed precedence between getFoo() and isFoo() in Twig_Template::getAttribute() + * improved a deprecation message + +* 1.28.1 (2016-11-18) + + * fixed block() function when used with a template argument + +* 1.28.0 (2016-11-17) + + * added support for the PHP 7 null coalescing operator for the ?? Twig implementation + * exposed a way to access template data and methods in a portable way + * changed context access to use the PHP 7 null coalescing operator when available + * added the "with" tag + * added support for a custom template on the block() function + * added "is defined" support for block() and constant() + * optimized the way attributes are fetched + +* 1.27.0 (2016-10-25) + + * deprecated Twig_Parser::getEnvironment() + * deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor() + * deprecated Twig_Compiler::addIndentation() + * fixed regression when registering two extensions having the same class name + * deprecated Twig_LoaderInterface::getSource() (implement Twig_SourceContextLoaderInterface instead) + * fixed the filesystem loader with relative paths + * deprecated Twig_Node::getLine() in favor of Twig_Node::getTemplateLine() + * deprecated Twig_Template::getSource() in favor of Twig_Template::getSourceContext() + * deprecated Twig_Node::getFilename() in favor of Twig_Node::getTemplateName() + * deprecated the "filename" escaping strategy (use "name" instead) + * added Twig_Source to hold information about the original template + * deprecated Twig_Error::getTemplateFile() and Twig_Error::setTemplateFile() in favor of Twig_Error::getTemplateName() and Twig_Error::setTemplateName() + * deprecated Parser::getFilename() + * fixed template paths when a template name contains a protocol like vfs:// + * improved debugging with Twig_Sandbox_SecurityError exceptions for disallowed methods and properties + +* 1.26.1 (2016-10-05) + + * removed template source code from generated template classes when debug is disabled + * fixed default implementation of Twig_Template::getDebugInfo() for better BC + * fixed regression on static calls for functions/filters/tests + +* 1.26.0 (2016-10-02) + + * added template cache invalidation based on more environment options + * added a missing deprecation notice + * fixed template paths when a template is stored in a PHAR file + * allowed filters/functions/tests implementation to use a different class than the extension they belong to + * deprecated Twig_ExtensionInterface::getName() + +* 1.25.0 (2016-09-21) + + * changed the way we store template source in template classes + * removed usage of realpath in cache keys + * fixed Twig cache sharing when used with different versions of PHP + * removed embed parent workaround for simple use cases + * deprecated the ability to store non Node instances in Node::$nodes + * deprecated Twig_Environment::getLexer(), Twig_Environment::getParser(), Twig_Environment::getCompiler() + * deprecated Twig_Compiler::getFilename() + +* 1.24.2 (2016-09-01) + + * fixed static callables + * fixed a potential PHP warning when loading the cache + * fixed a case where the autoescaping does not work as expected + +* 1.24.1 (2016-05-30) + + * fixed reserved keywords (forbids true, false, null and none keywords for variables names) + * fixed support for PHP7 (Throwable support) + * marked the following methods as being internals on Twig_Environment: + getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(), + getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(), + getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension() + +* 1.24.0 (2016-01-25) + + * adding support for the ?? operator + * fixed the defined test when used on a constant, a map, or a sequence + * undeprecated _self (should only be used to get the template name, not the template instance) + * fixed parsing on PHP7 + +* 1.23.3 (2016-01-11) + + * fixed typo + +* 1.23.2 (2015-01-11) + + * added versions in deprecated messages + * made file cache tolerant for trailing (back)slashes on directory configuration + * deprecated unused Twig_Node_Expression_ExtensionReference class + +* 1.23.1 (2015-11-05) + + * fixed some exception messages which triggered PHP warnings + * fixed BC on Twig_Test_NodeTestCase + +* 1.23.0 (2015-10-29) + + * deprecated the possibility to override an extension by registering another one with the same name + * deprecated Twig_ExtensionInterface::getGlobals() (added Twig_Extension_GlobalsInterface for BC) + * deprecated Twig_ExtensionInterface::initRuntime() (added Twig_Extension_InitRuntimeInterface for BC) + * deprecated Twig_Environment::computeAlternatives() + +* 1.22.3 (2015-10-13) + + * fixed regression when using null as a cache strategy + * improved performance when checking template freshness + * fixed warnings when loaded templates do not exist + * fixed template class name generation to prevent possible collisions + * fixed logic for custom escapers to call them even on integers and null values + * changed template cache names to take into account the Twig C extension + +* 1.22.2 (2015-09-22) + + * fixed a race condition in template loading + +* 1.22.1 (2015-09-15) + + * fixed regression in template_from_string + +* 1.22.0 (2015-09-13) + + * made Twig_Test_IntegrationTestCase more flexible + * added an option to force PHP bytecode invalidation when writing a compiled template into the cache + * fixed the profiler duration for the root node + * changed template cache names to take into account enabled extensions + * deprecated Twig_Environment::clearCacheFiles(), Twig_Environment::getCacheFilename(), + Twig_Environment::writeCacheFile(), and Twig_Environment::getTemplateClassPrefix() + * added a way to override the filesystem template cache system + * added a way to get the original template source from Twig_Template + +* 1.21.2 (2015-09-09) + + * fixed variable names for the deprecation triggering code + * fixed escaping strategy detection based on filename + * added Traversable support for replace, merge, and sort + * deprecated support for character by character replacement for the "replace" filter + +* 1.21.1 (2015-08-26) + + * fixed regression when using the deprecated Twig_Test_* classes + +* 1.21.0 (2015-08-24) + + * added deprecation notices for deprecated features + * added a deprecation "framework" for filters/functions/tests and test fixtures + +* 1.20.0 (2015-08-12) + + * forbid access to the Twig environment from templates and internal parts of Twig_Template + * fixed limited RCEs when in sandbox mode + * deprecated Twig_Template::getEnvironment() + * deprecated the _self variable for usage outside of the from and import tags + * added Twig_BaseNodeVisitor to ease the compatibility of node visitors + between 1.x and 2.x + +* 1.19.0 (2015-07-31) + + * fixed wrong error message when including an undefined template in a child template + * added support for variadic filters, functions, and tests + * added support for extra positional arguments in macros + * added ignore_missing flag to the source function + * fixed batch filter with zero items + * deprecated Twig_Environment::clearTemplateCache() + * fixed sandbox disabling when using the include function + +* 1.18.2 (2015-06-06) + + * fixed template/line guessing in exceptions for nested templates + * optimized the number of inodes and the size of realpath cache when using the cache + +* 1.18.1 (2015-04-19) + + * fixed memory leaks in the C extension + * deprecated Twig_Loader_String + * fixed the slice filter when used with a SimpleXMLElement object + * fixed filesystem loader when trying to load non-files (like directories) + +* 1.18.0 (2015-01-25) + + * fixed some error messages where the line was wrong (unknown variables or argument names) + * added a new way to customize the main Module node (via empty nodes) + * added Twig_Environment::createTemplate() to create a template from a string + * added a profiler + * fixed filesystem loader cache when different file paths are used for the same template + +* 1.17.0 (2015-01-14) + + * added a 'filename' autoescaping strategy, which dynamically chooses the + autoescaping strategy for a template based on template file extension. + +* 1.16.3 (2014-12-25) + + * fixed regression for dynamic parent templates + * fixed cache management with statcache + * fixed a regression in the slice filter + +* 1.16.2 (2014-10-17) + + * fixed timezone on dates as strings + * fixed 2-words test names when a custom node class is not used + * fixed macros when using an argument named like a PHP super global (like GET or POST) + * fixed date_modify when working with DateTimeImmutable + * optimized for loops + * fixed multi-byte characters handling in the split filter + * fixed a regression in the in operator + * fixed a regression in the slice filter + +* 1.16.1 (2014-10-10) + + * improved error reporting in a sandboxed template + * fixed missing error file/line information under certain circumstances + * fixed wrong error line number in some error messages + * fixed the in operator to use strict comparisons + * sped up the slice filter + * fixed for mb function overload mb_substr acting different + * fixed the attribute() function when passing a variable for the arguments + +* 1.16.0 (2014-07-05) + + * changed url_encode to always encode according to RFC 3986 + * fixed inheritance in a 'use'-hierarchy + * removed the __toString policy check when the sandbox is disabled + * fixed recursively calling blocks in templates with inheritance + +* 1.15.1 (2014-02-13) + + * fixed the conversion of the special '0000-00-00 00:00' date + * added an error message when trying to import an undefined block from a trait + * fixed a C extension crash when accessing defined but uninitialized property. + +* 1.15.0 (2013-12-06) + + * made ignoreStrictCheck in Template::getAttribute() works with __call() methods throwing BadMethodCallException + * added min and max functions + * added the round filter + * fixed a bug that prevented the optimizers to be enabled/disabled selectively + * fixed first and last filters for UTF-8 strings + * added a source function to include the content of a template without rendering it + * fixed the C extension sandbox behavior when get or set is prepend to method name + +* 1.14.2 (2013-10-30) + + * fixed error filename/line when an error occurs in an included file + * allowed operators that contain whitespaces to have more than one whitespace + * allowed tests to be made of 1 or 2 words (like "same as" or "divisible by") + +* 1.14.1 (2013-10-15) + + * made it possible to use named operators as variables + * fixed the possibility to have a variable named 'matches' + * added support for PHP 5.5 DateTimeInterface + +* 1.14.0 (2013-10-03) + + * fixed usage of the html_attr escaping strategy to avoid double-escaping with the html strategy + * added new operators: ends with, starts with, and matches + * fixed some compatibility issues with HHVM + * added a way to add custom escaping strategies + * fixed the C extension compilation on Windows + * fixed the batch filter when using a fill argument with an exact match of elements to batch + * fixed the filesystem loader cache when a template name exists in several namespaces + * fixed template_from_string when the template includes or extends other ones + * fixed a crash of the C extension on an edge case + +* 1.13.2 (2013-08-03) + + * fixed the error line number for an error occurs in and embedded template + * fixed crashes of the C extension on some edge cases + +* 1.13.1 (2013-06-06) + + * added the possibility to ignore the filesystem constructor argument in Twig_Loader_Filesystem + * fixed Twig_Loader_Chain::exists() for a loader which implements Twig_ExistsLoaderInterface + * adjusted backtrace call to reduce memory usage when an error occurs + * added support for object instances as the second argument of the constant test + * fixed the include function when used in an assignment + +* 1.13.0 (2013-05-10) + + * fixed getting a numeric-like item on a variable ('09' for instance) + * fixed getting a boolean or float key on an array, so it is consistent with PHP's array access: + `{{ array[false] }}` behaves the same as `echo $array[false];` (equals `$array[0]`) + * made the escape filter 20% faster for happy path (escaping string for html with UTF-8) + * changed ☃ to § in tests + * enforced usage of named arguments after positional ones + +* 1.12.3 (2013-04-08) + + * fixed a security issue in the filesystem loader where it was possible to include a template one + level above the configured path + * fixed fatal error that should be an exception when adding a filter/function/test too late + * added a batch filter + * added support for encoding an array as query string in the url_encode filter + +* 1.12.2 (2013-02-09) + + * fixed the timezone used by the date filter and function when the given date contains a timezone (like 2010-01-28T15:00:00+02:00) + * fixed globals when getGlobals is called early on + * added the first and last filter + +* 1.12.1 (2013-01-15) + + * added support for object instances as the second argument of the constant function + * relaxed globals management to avoid a BC break + * added support for {{ some_string[:2] }} + +* 1.12.0 (2013-01-08) + + * added verbatim as an alias for the raw tag to avoid confusion with the raw filter + * fixed registration of tests and functions as anonymous functions + * fixed globals management + +* 1.12.0-RC1 (2012-12-29) + + * added an include function (does the same as the include tag but in a more flexible way) + * added the ability to use any PHP callable to define filters, functions, and tests + * added a syntax error when using a loop variable that is not defined + * added the ability to set default values for macro arguments + * added support for named arguments for filters, tests, and functions + * moved filters/functions/tests syntax errors to the parser + * added support for extended ternary operator syntaxes + +* 1.11.1 (2012-11-11) + + * fixed debug info line numbering (was off by 2) + * fixed escaping when calling a macro inside another one (regression introduced in 1.9.1) + * optimized variable access on PHP 5.4 + * fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX) + +* 1.11.0 (2012-11-07) + + * fixed macro compilation when a variable name is a PHP reserved keyword + * changed the date filter behavior to always apply the default timezone, except if false is passed as the timezone + * fixed bitwise operator precedences + * added the template_from_string function + * fixed default timezone usage for the date function + * optimized the way Twig exceptions are managed (to make them faster) + * added Twig_ExistsLoaderInterface (implementing this interface in your loader make the chain loader much faster) + +* 1.10.3 (2012-10-19) + + * fixed wrong template location in some error messages + * reverted a BC break introduced in 1.10.2 + * added a split filter + +* 1.10.2 (2012-10-15) + + * fixed macro calls on PHP 5.4 + +* 1.10.1 (2012-10-15) + + * made a speed optimization to macro calls when imported via the "import" tag + * fixed C extension compilation on Windows + * fixed a segfault in the C extension when using DateTime objects + +* 1.10.0 (2012-09-28) + + * extracted functional tests framework to make it reusable for third-party extensions + * added namespaced templates support in Twig_Loader_Filesystem + * added Twig_Loader_Filesystem::prependPath() + * fixed an error when a token parser pass a closure as a test to the subparse() method + +* 1.9.2 (2012-08-25) + + * fixed the in operator for objects that contain circular references + * fixed the C extension when accessing a public property of an object implementing the \ArrayAccess interface + +* 1.9.1 (2012-07-22) + + * optimized macro calls when auto-escaping is on + * fixed wrong parent class for Twig_Function_Node + * made Twig_Loader_Chain more explicit about problems + +* 1.9.0 (2012-07-13) + + * made the parsing independent of the template loaders + * fixed exception trace when an error occurs when rendering a child template + * added escaping strategies for CSS, URL, and HTML attributes + * fixed nested embed tag calls + * added the date_modify filter + +* 1.8.3 (2012-06-17) + + * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash + * fixed escaping when a project defines a function named html or js + * fixed chmod mode to apply the umask correctly + +* 1.8.2 (2012-05-30) + + * added the abs filter + * fixed a regression when using a number in template attributes + * fixed compiler when mbstring.func_overload is set to 2 + * fixed DateTimeZone support in date filter + +* 1.8.1 (2012-05-17) + + * fixed a regression when dealing with SimpleXMLElement instances in templates + * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini + * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) + +* 1.8.0 (2012-05-08) + + * enforced interface when adding tests, filters, functions, and node visitors from extensions + * fixed a side-effect of the date filter where the timezone might be changed + * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) + * added a way to dynamically change the auto-escaping strategy according to the template "filename" + * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) + * added an embed tag + +* 1.7.0 (2012-04-24) + + * fixed a PHP warning when using CIFS + * fixed template line number in some exceptions + * added an iterable test + * added an error when defining two blocks with the same name in a template + * added the preserves_safety option for filters + * fixed a PHP notice when trying to access a key on a non-object/array variable + * enhanced error reporting when the template file is an instance of SplFileInfo + * added Twig_Environment::mergeGlobals() + * added compilation checks to avoid misuses of the sandbox tag + * fixed filesystem loader freshness logic for high traffic websites + * fixed random function when charset is null + +* 1.6.5 (2012-04-11) + + * fixed a regression when a template only extends another one without defining any blocks + +* 1.6.4 (2012-04-02) + + * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 + * fixed performance when compiling large files + * optimized parent template creation when the template does not use dynamic inheritance + +* 1.6.3 (2012-03-22) + + * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension + * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot + * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate + +* 1.6.2 (2012-03-18) + + * fixed sandbox mode when used with inheritance + * added preserveKeys support for the slice filter + * fixed the date filter when a DateTime instance is passed with a specific timezone + * added a trim filter + +* 1.6.1 (2012-02-29) + + * fixed Twig C extension + * removed the creation of Twig_Markup instances when not needed + * added a way to set the default global timezone for dates + * fixed the slice filter on strings when the length is not specified + * fixed the creation of the cache directory in case of a race condition + +* 1.6.0 (2012-02-04) + + * fixed raw blocks when used with the whitespace trim option + * made a speed optimization to macro calls when imported via the "from" tag + * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added + * fixed the attribute function when passing arguments + * added slice notation support for the [] operator (syntactic sugar for the slice operator) + * added a slice filter + * added string support for the reverse filter + * fixed the empty test and the length filter for Twig_Markup instances + * added a date function to ease date comparison + * fixed unary operators precedence + * added recursive parsing support in the parser + * added string and integer handling for the random function + +* 1.5.1 (2012-01-05) + + * fixed a regression when parsing strings + +* 1.5.0 (2012-01-04) + + * added Traversable objects support for the join filter + +* 1.5.0-RC2 (2011-12-30) + + * added a way to set the default global date interval format + * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) + * refactored Twig_Template::display() to ease its extension + * added a number_format filter + +* 1.5.0-RC1 (2011-12-26) + + * removed the need to quote hash keys + * allowed hash keys to be any expression + * added a do tag + * added a flush tag + * added support for dynamically named filters and functions + * added a dump function to help debugging templates + * added a nl2br filter + * added a random function + * added a way to change the default format for the date filter + * fixed the lexer when an operator ending with a letter ends a line + * added string interpolation support + * enhanced exceptions for unknown filters, functions, tests, and tags + +* 1.4.0 (2011-12-07) + + * fixed lexer when using big numbers (> PHP_INT_MAX) + * added missing preserveKeys argument to the reverse filter + * fixed macros containing filter tag calls + +* 1.4.0-RC2 (2011-11-27) + + * removed usage of Reflection in Twig_Template::getAttribute() + * added a C extension that can optionally replace Twig_Template::getAttribute() + * added negative timestamp support to the date filter + +* 1.4.0-RC1 (2011-11-20) + + * optimized variable access when using PHP 5.4 + * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby + * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders + * added Twig_Function_Node to allow more complex functions to have their own Node class + * added Twig_Filter_Node to allow more complex filters to have their own Node class + * added Twig_Test_Node to allow more complex tests to have their own Node class + * added a better error message when a template is empty but contain a BOM + * fixed "in" operator for empty strings + * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) + * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) + * added Twig_Environment::display() + * made the escape filter smarter when the encoding is not supported by PHP + * added a convert_encoding filter + * moved all node manipulations outside the compile() Node method + * made several speed optimizations + +* 1.3.0 (2011-10-08) + +no changes + +* 1.3.0-RC1 (2011-10-04) + + * added an optimization for the parent() function + * added cache reloading when auto_reload is true and an extension has been modified + * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) + * allowed empty templates to be used as traits + * added traits support for the "parent" function + +* 1.2.0 (2011-09-13) + +no changes + +* 1.2.0-RC1 (2011-09-10) + + * enhanced the exception when a tag remains unclosed + * added support for empty Countable objects for the "empty" test + * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) + * added better support for encoding problems when escaping a string (available as of PHP 5.4) + * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) + * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) + * added support for bitwise operators in expressions + * added the "attribute" function to allow getting dynamic attributes on variables + * added Twig_Loader_Chain + * added Twig_Loader_Array::setTemplate() + * added an optimization for the set tag when used to capture a large chunk of static text + * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) + * removed the possibility to use the "extends" tag from a block + * added "if" modifier support to "for" loops + +* 1.1.2 (2011-07-30) + + * fixed json_encode filter on PHP 5.2 + * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) + * fixed inheritance when using conditional parents + * fixed compilation of templates when the body of a child template is not empty + * fixed output when a macro throws an exception + * fixed a parsing problem when a large chunk of text is enclosed in a comment tag + * added PHPDoc for all Token parsers and Core extension functions + +* 1.1.1 (2011-07-17) + + * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) + * made some performance improvement for some edge cases + +* 1.1.0 (2011-06-28) + + * fixed json_encode filter + +* 1.1.0-RC3 (2011-06-24) + + * fixed method case-sensitivity when using the sandbox mode + * added timezone support for the date filter + * fixed possible security problems with NUL bytes + +* 1.1.0-RC2 (2011-06-16) + + * added an exception when the template passed to "use" is not a string + * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) + * added {% line \d+ %} directive + +* 1.1.0-RC1 (2011-05-28) + +Flush your cache after upgrading. + + * fixed date filter when using a timestamp + * fixed the defined test for some cases + * fixed a parsing problem when a large chunk of text is enclosed in a raw tag + * added support for horizontal reuse of template blocks (see docs for more information) + * added whitespace control modifier to all tags (see docs for more information) + * added null as an alias for none (the null test is also an alias for the none test now) + * made TRUE, FALSE, NONE equivalent to their lowercase counterparts + * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line + * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) + +* 1.0.0 (2011-03-27) + + * fixed output when using mbstring + * fixed duplicate call of methods when using the sandbox + * made the charset configurable for the escape filter + +* 1.0.0-RC2 (2011-02-21) + + * changed the way {% set %} works when capturing (the content is now marked as safe) + * added support for macro name in the endmacro tag + * make Twig_Error compatible with PHP 5.3.0 > + * fixed an infinite loop on some Windows configurations + * fixed the "length" filter for numbers + * fixed Template::getAttribute() as properties in PHP are case sensitive + * removed coupling between Twig_Node and Twig_Template + * fixed the ternary operator precedence rule + +* 1.0.0-RC1 (2011-01-09) + +Backward incompatibilities: + + * the "items" filter, which has been deprecated for quite a long time now, has been removed + * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) + * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} + * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} + * the "for" tag does not support "joined by" anymore + * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") + * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) + * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) + * removed the grammar and simple token parser (moved to the Twig Extensions repository) + +Changes: + + * added "needs_context" option for filters and functions (the context is then passed as a first argument) + * added global variables support + * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) + * added the "from" tag to import macros as functions + * added support for functions (a function is just syntactic sugar for a getAttribute() call) + * made macros callable when sandbox mode is enabled + * added an exception when a macro uses a reserved name + * the "default" filter now uses the "empty" test instead of just checking for null + * added the "empty" test + +* 0.9.10 (2010-12-16) + +Backward incompatibilities: + + * The Escaper extension is enabled by default, which means that all displayed + variables are now automatically escaped. You can revert to the previous + behavior by removing the extension via $env->removeExtension('escaper') + or just set the 'autoescape' option to 'false'. + * removed the "without loop" attribute for the "for" tag (not needed anymore + as the Optimizer take care of that for most cases) + * arrays and hashes have now a different syntax + * arrays keep the same syntax with square brackets: [1, 2] + * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) + * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) + * the i18n extension is now part of the Twig Extensions repository + +Changes: + + * added the merge filter + * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead + * fixed usage of operators as method names (like is, in, and not) + * changed the order of execution for node visitors + * fixed default() filter behavior when used with strict_variables set to on + * fixed filesystem loader compatibility with PHAR files + * enhanced error messages when an unexpected token is parsed in an expression + * fixed filename not being added to syntax error messages + * added the autoescape option to enable/disable autoescaping + * removed the newline after a comment (mimics PHP behavior) + * added a syntax error exception when parent block is used on a template that does not extend another one + * made the Escaper extension enabled by default + * fixed sandbox extension when used with auto output escaping + * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) + * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) + * added priority to node visitors + +* 0.9.9 (2010-11-28) + +Backward incompatibilities: + * the self special variable has been renamed to _self + * the odd and even filters are now tests: + {{ foo|odd }} must now be written {{ foo is odd }} + * the "safe" filter has been renamed to "raw" + * in Node classes, + sub-nodes are now accessed via getNode() (instead of property access) + attributes via getAttribute() (instead of array access) + * the urlencode filter had been renamed to url_encode + * the include tag now merges the passed variables with the current context by default + (the old behavior is still possible by adding the "only" keyword) + * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) + * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) + * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) + +Changes: + * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template + * changed trans tag to accept any variable for the plural count + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) + * added the ** (power) operator + * changed the algorithm used for parsing expressions + * added the spaceless tag + * removed trim_blocks option + * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) + * changed all exceptions to extend Twig_Error + * fixed unary expressions ({{ not(1 or 0) }}) + * fixed child templates (with an extend tag) that uses one or more imports + * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) + * escaping has been rewritten + * the implementation of template inheritance has been rewritten + (blocks can now be called individually and still work with inheritance) + * fixed error handling for if tag when a syntax error occurs within a subparse process + * added a way to implement custom logic for resolving token parsers given a tag name + * fixed js escaper to be stricter (now uses a whilelist-based js escaper) + * added the following filers: "constant", "trans", "replace", "json_encode" + * added a "constant" test + * fixed objects with __toString() not being autoescaped + * fixed subscript expressions when calling __call() (methods now keep the case) + * added "test" feature (accessible via the "is" operator) + * removed the debug tag (should be done in an extension) + * fixed trans tag when no vars are used in plural form + * fixed race condition when writing template cache + * added the special _charset variable to reference the current charset + * added the special _context variable to reference the current context + * renamed self to _self (to avoid conflict) + * fixed Twig_Template::getAttribute() for protected properties + +* 0.9.8 (2010-06-28) + +Backward incompatibilities: + * the trans tag plural count is now attached to the plural tag: + old: `{% trans count %}...{% plural %}...{% endtrans %}` + new: `{% trans %}...{% plural count %}...{% endtrans %}` + + * added a way to translate strings coming from a variable ({% trans var %}) + * fixed trans tag when used with the Escaper extension + * fixed default cache umask + * removed Twig_Template instances from the debug tag output + * fixed objects with __isset() defined + * fixed set tag when used with a capture + * fixed type hinting for Twig_Environment::addFilter() method + +* 0.9.7 (2010-06-12) + +Backward incompatibilities: + * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) + * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) + * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) + + * added self as a special variable that refers to the current template (useful for importing macros from the current template) + * added Twig_Template instance support to the include tag + * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) + * added a grammar sub-framework to ease the creation of custom tags + * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) + * removed the Twig_Resource::resolveMissingFilter() method + * fixed the filter tag which did not apply filtering to included files + * added a bunch of unit tests + * added a bunch of phpdoc + * added a sandbox tag in the sandbox extension + * changed the date filter to support any date format supported by DateTime + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) + * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor + * changed the cache option to only accepts an explicit path to a cache directory or false + * added a way to add token parsers, filters, and visitors without creating an extension + * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface + * changed the generated code to match the new coding standards + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) + * added an exception when a child template has a non-empty body (as it is always ignored when rendering) + +* 0.9.6 (2010-05-12) + + * fixed variables defined outside a loop and for which the value changes in a for loop + * fixed the test suite for PHP 5.2 and older versions of PHPUnit + * added support for __call() in expression resolution + * fixed node visiting for macros (macros are now visited by visitors as any other node) + * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) + * added the cycle filter + * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII + * added a long-syntax for the set tag ({% set foo %}...{% endset %}) + * unit tests are now powered by PHPUnit + * added support for gettext via the `i18n` extension + * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values + * added a more useful exception if an if tag is not closed properly + * added support for escaping strategy in the autoescape tag + * fixed lexer when a template has a big chunk of text between/in a block + +* 0.9.5 (2010-01-20) + +As for any new release, don't forget to remove all cached templates after +upgrading. + +If you have defined custom filters, you MUST upgrade them for this release. To +upgrade, replace "array" with "new Twig_Filter_Function", and replace the +environment constant by the "needs_environment" option: + + // before + 'even' => array('twig_is_even_filter', false), + 'escape' => array('twig_escape_filter', true), + + // after + 'even' => new Twig_Filter_Function('twig_is_even_filter'), + 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), + +If you have created NodeTransformer classes, you will need to upgrade them to +the new interface (please note that the interface is not yet considered +stable). + + * fixed list nodes that did not extend the Twig_NodeListInterface + * added the "without loop" option to the for tag (it disables the generation of the loop variable) + * refactored node transformers to node visitors + * fixed automatic-escaping for blocks + * added a way to specify variables to pass to an included template + * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) + * improved the filter system to allow object methods to be used as filters + * changed the Array and String loaders to actually make use of the cache mechanism + * included the default filter function definitions in the extension class files directly (Core, Escaper) + * added the // operator (like the floor() PHP function) + * added the .. operator (as a syntactic sugar for the range filter when the step is 1) + * added the in operator (as a syntactic sugar for the in filter) + * added the following filters in the Core extension: in, range + * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) + * enhanced some error messages to provide better feedback in case of parsing errors + +* 0.9.4 (2009-12-02) + +If you have custom loaders, you MUST upgrade them for this release: The +Twig_Loader base class has been removed, and the Twig_LoaderInterface has also +been changed (see the source code for more information or the documentation). + + * added support for DateTime instances for the date filter + * fixed loop.last when the array only has one item + * made it possible to insert newlines in tag and variable blocks + * fixed a bug when a literal '\n' were present in a template text + * fixed bug when the filename of a template contains */ + * refactored loaders + +* 0.9.3 (2009-11-11) + +This release is NOT backward compatible with the previous releases. + + The loaders do not take the cache and autoReload arguments anymore. Instead, + the Twig_Environment class has two new options: cache and auto_reload. + Upgrading your code means changing this kind of code: + + $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); + $twig = new Twig_Environment($loader); + + to something like this: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + 'auto_reload' => true, + )); + + * deprecated the "items" filter as it is not needed anymore + * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader + * optimized template loading speed + * removed output when an error occurs in a template and render() is used + * made major speed improvements for loops (up to 300% on even the smallest loops) + * added properties as part of the sandbox mode + * added public properties support (obj.item can now be the item property on the obj object) + * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) + * fixed bug when \ was used in HTML + +* 0.9.2 (2009-10-29) + + * made some speed optimizations + * changed the cache extension to .php + * added a js escaping strategy + * added support for short block tag + * changed the filter tag to allow chained filters + * made lexer more flexible as you can now change the default delimiters + * added set tag + * changed default directory permission when cache dir does not exist (more secure) + * added macro support + * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance + * made Twig_Autoloader::autoload() a static method + * avoid writing template file if an error occurs + * added $ escaping when outputting raw strings + * enhanced some error messages to ease debugging + * fixed empty cache files when the template contains an error + +* 0.9.1 (2009-10-14) + + * fixed a bug in PHP 5.2.6 + * fixed numbers with one than one decimal + * added support for method calls with arguments ({{ foo.bar('a', 43) }}) + * made small speed optimizations + * made minor tweaks to allow better extensibility and flexibility + +* 0.9.0 (2009-10-12) + + * Initial release diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/LICENSE b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/LICENSE new file mode 100644 index 0000000..d06ced2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2009-2019 by the Twig Team. + +Some rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/README.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/README.rst new file mode 100644 index 0000000..f33ea33 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/README.rst @@ -0,0 +1,15 @@ +Twig, the flexible, fast, and secure template language for PHP +============================================================== + +Twig is a template language for PHP, released under the new BSD license (code +and documentation). + +Twig uses a syntax similar to the Django and Jinja template languages which +inspired the Twig runtime environment. + +More Information +---------------- + +Read the `documentation`_ for more information. + +.. _documentation: https://twig.symfony.com/documentation diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/composer.json b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/composer.json new file mode 100644 index 0000000..4b99372 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/composer.json @@ -0,0 +1,48 @@ +{ + "name": "twig/twig", + "type": "library", + "description": "Twig, the flexible, fast, and secure template language for PHP", + "keywords": ["templating"], + "homepage": "https://twig.symfony.com", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "require": { + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4.19|^4.1.8", + "symfony/debug": "^2.7", + "psr/container": "^1.0" + }, + "autoload": { + "psr-0" : { + "Twig_" : "lib/" + }, + "psr-4" : { + "Twig\\" : "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.41-dev" + } + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced.rst new file mode 100644 index 0000000..fd95883 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced.rst @@ -0,0 +1,1005 @@ +Extending Twig +============== + +.. caution:: + + This section describes how to extend Twig as of **Twig 1.12**. If you are + using an older version, read the :doc:`legacy` chapter + instead. + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig. If you want + to reuse your changes in different projects or if you want to share them + with others, you should then create an extension as described in the + following section. + +.. caution:: + + When extending Twig without creating an extension, Twig won't be able to + recompile your templates when the PHP code is updated. To see your changes + in real-time, either disable template caching or package your code into an + extension (see the next section of this chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: twig + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: twig + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: twig + + {{ 40|lipsum }} + +Again, it works. But a filter should transform the passed value to something +else. Here, we use the value to indicate the number of words to generate (so, +``40`` is an argument of the filter, not the value we want to transform). + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: twig + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: twig + + {{ 'some text' ~ lipsum(40) ~ 'some more text' }} + + {% set lipsum = lipsum(40) %} + +Lastly, you can also use a *global* object with a method able to generate lorem +ipsum text: + +.. code-block:: twig + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* simple frequent Content generation +*global* simple frequent Helper object +*function* simple frequent Content generation +*filter* simple frequent Value transformation +*tag* complex rare DSL language construct +*test* simple rare Boolean decision +*operator* simple rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new \Twig\Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: twig + + {{ text.lipsum(40) }} + +Filters +------- + +Creating a filter consists of associating a name with a PHP callable:: + + // an anonymous function + $filter = new \Twig\TwigFilter('rot13', function ($string) { + return str_rot13($string); + }); + + // or a simple PHP function + $filter = new \Twig\TwigFilter('rot13', 'str_rot13'); + + // or a class static method + $filter = new \Twig\TwigFilter('rot13', ['SomeClass', 'rot13Filter']); + $filter = new \Twig\TwigFilter('rot13', 'SomeClass::rot13Filter'); + + // or a class method + $filter = new \Twig\TwigFilter('rot13', [$this, 'rot13Filter']); + // the one below needs a runtime implementation (see below for more information) + $filter = new \Twig\TwigFilter('rot13', ['SomeClass', 'rot13Filter']); + +The first argument passed to the ``\Twig\TwigFilter`` constructor is the name +of the filter you will use in templates and the second one is the PHP callable +to associate with it. + +Then, add the filter to the Twig environment:: + + $twig = new \Twig\Environment($loader); + $twig->addFilter($filter); + +And here is how to use it in a template: + +.. code-block:: twig + + {{ 'Twig'|rot13 }} + + {# will output Gjvt #} + +When called by Twig, the PHP callable receives the left side of the filter +(before the pipe ``|``) as the first argument and the extra arguments passed +to the filter (within parentheses ``()``) as extra arguments. + +For instance, the following code: + +.. code-block:: twig + + {{ 'TWIG'|lower }} + {{ now|date('d/m/Y') }} + +is compiled to something like the following:: + + + + +The ``\Twig\TwigFilter`` class takes an array of options as its last +argument:: + + $filter = new \Twig\TwigFilter('rot13', 'str_rot13', $options); + +Environment-aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want to access the current environment instance in your filter, set the +``needs_environment`` option to ``true``; Twig will pass the current +environment as the first argument to the filter call:: + + $filter = new \Twig\TwigFilter('rot13', function (Twig_Environment $env, $string) { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + }, ['needs_environment' => true]); + +Context-aware Filters +~~~~~~~~~~~~~~~~~~~~~ + +If you want to access the current context in your filter, set the +``needs_context`` option to ``true``; Twig will pass the current context as +the first argument to the filter call (or the second one if +``needs_environment`` is also set to ``true``):: + + $filter = new \Twig\TwigFilter('rot13', function ($context, $string) { + // ... + }, ['needs_context' => true]); + + $filter = new \Twig\TwigFilter('rot13', function (Twig_Environment $env, $context, $string) { + // ... + }, ['needs_context' => true, 'needs_environment' => true]); + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs HTML +or JavaScript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new \Twig\TwigFilter('nl2br', 'nl2br', ['is_safe' => ['html']]); + +Some filters may need to work on input that is already escaped or safe, for +example when adding (safe) HTML tags to originally unsafe output. In such a +case, set the ``pre_escape`` option to escape the input data before it is run +through your filter:: + + $filter = new \Twig\TwigFilter('somefilter', 'somefilter', ['pre_escape' => 'html', 'is_safe' => ['html']]); + +Variadic Filters +~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.19 + Support for variadic filters was added in Twig 1.19. + +When a filter should accept an arbitrary number of arguments, set the +``is_variadic`` option to ``true``; Twig will pass the extra arguments as the +last argument to the filter call as an array:: + + $filter = new \Twig\TwigFilter('thumbnail', function ($file, array $options = []) { + // ... + }, ['is_variadic' => true]); + +Be warned that :ref:`named arguments ` passed to a variadic +filter cannot be checked for validity as they will automatically end up in the +option array. + +Dynamic Filters +~~~~~~~~~~~~~~~ + +A filter name containing the special ``*`` character is a dynamic filter and +the ``*`` part will match any string:: + + $filter = new \Twig\TwigFilter('*_path', function ($name, $arguments) { + // ... + }); + +The following filters are matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $filter = new \Twig\TwigFilter('*_path_*', function ($name, $suffix, $arguments) { + // ... + }); + +The filter receives all dynamic part values before the normal filter arguments, +but after the environment and the context. For instance, a call to +``'foo'|a_path_b()`` will result in the following arguments to be passed to the +filter: ``('a', 'b', 'foo')``. + +Deprecated Filters +~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.21 + Support for deprecated filters was added in Twig 1.21. + +You can mark a filter as being deprecated by setting the ``deprecated`` option +to ``true``. You can also give an alternative filter that replaces the +deprecated one when that makes sense:: + + $filter = new \Twig\TwigFilter('obsolete', function () { + // ... + }, ['deprecated' => true, 'alternative' => 'new_one']); + +When a filter is deprecated, Twig emits a deprecation notice when compiling a +template using it. See :ref:`deprecation-notices` for more information. + +Functions +--------- + +Functions are defined in the exact same way as filters, but you need to create +an instance of ``\Twig\TwigFunction``:: + + $twig = new \Twig\Environment($loader); + $function = new \Twig\TwigFunction('function_name', function () { + // ... + }); + $twig->addFunction($function); + +Functions support the same features as filters, except for the ``pre_escape`` +and ``preserves_safety`` options. + +Tests +----- + +Tests are defined in the exact same way as filters and functions, but you need +to create an instance of ``\Twig\TwigTest``:: + + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest('test_name', function () { + // ... + }); + $twig->addTest($test); + +Tests allow you to create custom application specific logic for evaluating +boolean conditions. As a simple example, let's create a Twig test that checks if +objects are 'red':: + + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest('red', function ($value) { + if (isset($value->color) && $value->color == 'red') { + return true; + } + if (isset($value->paint) && $value->paint == 'red') { + return true; + } + return false; + }); + $twig->addTest($test); + +Test functions must always return ``true``/``false``. + +When creating tests you can use the ``node_class`` option to provide custom test +compilation. This is useful if your test can be compiled into PHP primitives. +This is used by many of the tests built into Twig:: + + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest( + 'odd', + null, + ['node_class' => '\Twig\Node\Expression\Test\OddTest']); + $twig->addTest($test); + + class Twig_Node_Expression_Test_Odd extends \Twig\Node\Expression\TestExpression + { + public function compile(\Twig\Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 1') + ->raw(')') + ; + } + } + +The above example shows how you can create tests that use a node class. The node +class has access to one sub-node called ``node``. This sub-node contains the +value that is being tested. When the ``odd`` filter is used in code such as: + +.. code-block:: twig + + {% if my_value is odd %} + +The ``node`` sub-node will contain an expression of ``my_value``. Node-based +tests also have access to the ``arguments`` node. This node will contain the +various other arguments that have been provided to your test. + +.. versionadded:: 1.36 + Dynamic tests support was added in Twig 1.36. + +If you want to pass a variable number of positional or named arguments to the +test, set the ``is_variadic`` option to ``true``. Tests support dynamic +names (see dynamic filters for the syntax). + +Tags +---- + +One of the most exciting features of a template engine like Twig is the +possibility to define new **language constructs**. This is also the most complex +feature as you need to understand how Twig's internals work. + +Most of the time though, a tag is not needed: + +* If your tag generates some output, use a **function** instead. + +* If your tag modifies some content and returns it, use a **filter** instead. + + For instance, if you want to create a tag that converts a Markdown formatted + text to HTML, create a ``markdown`` filter instead: + + .. code-block:: twig + + {{ '**markdown** text'|markdown }} + + If you want use this filter on large amounts of text, wrap it with the + :doc:`apply ` tag: + + .. code-block:: twig + + {% apply markdown %} + Title + ===== + + Much better than creating a tag as you can **compose** filters. + {% endapply %} + + .. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + +* If your tag does not output anything, but only exists because of a side + effect, create a **function** that returns nothing and call it via the + :doc:`filter ` tag. + + For instance, if you want to create a tag that logs text, create a ``log`` + function instead and call it via the :doc:`do ` tag: + + .. code-block:: twig + + {% do log('Log some things') %} + +If you still want to create a tag for a new language construct, great! + +Let's create a ``set`` tag that allows the definition of simple variables from +within a template. The tag can be used like follows: + +.. code-block:: twig + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default. + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Add a tag by calling the ``addTokenParser`` method on the ``\Twig\Environment`` +instance:: + + $twig = new \Twig\Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends \Twig\TokenParser\AbstractTokenParser + { + public function parse(\Twig\Token $token) + { + $parser = $this->parser; + $stream = $parser->getStream(); + + $name = $stream->expect(\Twig\Token::NAME_TYPE)->getValue(); + $stream->expect(\Twig\Token::OPERATOR_TYPE, '='); + $value = $parser->getExpressionParser()->parseExpression(); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``\Twig\Node\Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks at the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is quite short:: + + class Project_Set_Node extends \Twig\Node\Node + { + public function __construct($name, \Twig\Node\Expression\AbstractExpression $value, $line, $tag = null) + { + parent::__construct(['value' => $value], ['name' => $name], $line, $tag); + } + + public function compile(\Twig\Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``\Twig\Node\ForNode`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``\Twig\Node\BlockNode`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``\Twig\Node\BlockNode`` for a + usage example). + +.. _creating_extensions: + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, functions, and node visitors. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: https://github.com/twigphp/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig\Extension\InitRuntimeInterface instead + */ + function initRuntime(\Twig\Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[] + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return \Twig\NodeVisitor\NodeVisitorInterface[] + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return \Twig\TwigFilter[] + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return \Twig\TwigTest[] + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return \Twig\TwigFunction[] + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array First array of unary operators, second array of binary operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + * + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig\Extension\GlobalsInterface instead + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + * + * @deprecated since 1.26 (to be removed in 2.0), not used anymore internally + */ + function getName(); + } + +To keep your extension class clean and lean, inherit from the built-in +``\Twig\Extension\AbstractExtension`` class instead of implementing the interface as it provides +empty implementations for all methods: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + } + +This extension does nothing for now. We will customize it in the next sections. + +.. note:: + + Prior to Twig 1.26, you must implement the ``getName()`` method which must + return a unique identifier for the extension. + +You can save your extension anywhere on the filesystem, as all extensions must +be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new \Twig\Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +.. tip:: + + The Twig core extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension implements \Twig\Extension\GlobalsInterface + { + public function getGlobals() + { + return [ + 'text' => new Text(), + ]; + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFunctions() + { + return [ + new \Twig\TwigFunction('lipsum', 'generate_lipsum'), + ]; + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFilters() + { + return [ + new \Twig\TwigFilter('rot13', 'str_rot13'), + ]; + } + + // ... + } + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getTokenParsers() + { + return [new Project_Set_TokenParser()]; + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods lets you add new operators. Here is how to add +the ``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getOperators() + { + return [ + [ + '!' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], + ], + [ + '||' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + '&&' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + ], + ]; + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` method lets you add new test functions:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getTests() + { + return [ + new \Twig\TwigTest('even', 'twig_test_even'), + ]; + } + + // ... + } + +Definition vs Runtime +~~~~~~~~~~~~~~~~~~~~~ + +Twig filters, functions, and tests runtime implementations can be defined as +any valid PHP callable: + +* **functions/static methods**: Simple to implement and fast (used by all Twig + core extensions); but it is hard for the runtime to depend on external + objects; + +* **closures**: Simple to implement; + +* **object methods**: More flexible and required if your runtime code depends + on external objects. + +The simplest way to use methods is to define them on the extension itself:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + private $rot13Provider; + + public function __construct($rot13Provider) + { + $this->rot13Provider = $rot13Provider; + } + + public function getFunctions() + { + return [ + new \Twig\TwigFunction('rot13', [$this, 'rot13']), + ]; + } + + public function rot13($value) + { + return $this->rot13Provider->rot13($value); + } + } + +This is very convenient but not recommended as it makes template compilation +depend on runtime dependencies even if they are not needed (think for instance +as a dependency that connects to a database engine). + +As of Twig 1.26, you can easily decouple the extension definitions from their +runtime implementations by registering a ``\Twig\RuntimeLoader\RuntimeLoaderInterface`` +instance on the environment that knows how to instantiate such runtime classes +(runtime classes must be autoload-able):: + + class RuntimeLoader implements \Twig\RuntimeLoader\RuntimeLoaderInterface + { + public function load($class) + { + // implement the logic to create an instance of $class + // and inject its dependencies + // most of the time, it means using your dependency injection container + if ('Project_Twig_RuntimeExtension' === $class) { + return new $class(new Rot13Provider()); + } else { + // ... + } + } + } + + $twig->addRuntimeLoader(new RuntimeLoader()); + +.. note:: + + As of Twig 1.32, Twig comes with a PSR-11 compatible runtime loader + (``\Twig\RuntimeLoader\ContainerRuntimeLoader``). + +It is now possible to move the runtime logic to a new +``Project_Twig_RuntimeExtension`` class and use it directly in the extension:: + + class Project_Twig_RuntimeExtension + { + private $rot13Provider; + + public function __construct($rot13Provider) + { + $this->rot13Provider = $rot13Provider; + } + + public function rot13($value) + { + return $this->rot13Provider->rot13($value); + } + } + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFunctions() + { + return [ + new \Twig\TwigFunction('rot13', ['Project_Twig_RuntimeExtension', 'rot13']), + // or + new \Twig\TwigFunction('rot13', 'Project_Twig_RuntimeExtension::rot13'), + ]; + } + } + +Overloading +----------- + +To overload an already defined filter, test, operator, global variable, or +function, re-define it in an extension and register it **as late as +possible** (order matters):: + + class MyCoreExtension extends \Twig\Extension\AbstractExtension + { + public function getFilters() + { + return [ + new \Twig\TwigFilter('date', [$this, 'dateFilter']), + ]; + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + // do something different from the built-in date filter + } + } + + $twig = new \Twig\Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +Here, we have overloaded the built-in ``date`` filter with a custom one. + +If you do the same on the ``\Twig\Environment`` itself, beware that it takes +precedence over any other registered extensions:: + + $twig = new \Twig\Environment($loader); + $twig->addFilter(new \Twig\TwigFilter('date', function ($timestamp, $format = 'F j, Y H:i') { + // do something different from the built-in date filter + })); + // the date filter will come from the above registration, not + // from the registered extension below + $twig->addExtension(new MyCoreExtension()); + +.. caution:: + + Note that overloading the built-in Twig elements is not recommended as it + might be confusing. + +Testing an Extension +-------------------- + +Functional Tests +~~~~~~~~~~~~~~~~ + +You can create functional tests for extensions by creating the following file +structure in your test directory:: + + Fixtures/ + filters/ + foo.test + bar.test + functions/ + foo.test + bar.test + tags/ + foo.test + bar.test + IntegrationTest.php + +The ``IntegrationTest.php`` file should look like this:: + + class Project_Tests_IntegrationTest extends \Twig\Test\IntegrationTestCase + { + public function getExtensions() + { + return [ + new Project_Twig_Extension1(), + new Project_Twig_Extension2(), + ]; + } + + public function getFixturesDir() + { + return dirname(__FILE__).'/Fixtures/'; + } + } + +Fixtures examples can be found within the Twig repository +`tests/Twig/Fixtures`_ directory. + +Node Tests +~~~~~~~~~~ + +Testing the node visitors can be complex, so extend your test cases from +``\Twig\Test\NodeTestCase``. Examples can be found in the Twig repository +`tests/Twig/Node`_ directory. + +.. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php +.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures +.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced_legacy.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced_legacy.rst new file mode 100644 index 0000000..9abfee0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/advanced_legacy.rst @@ -0,0 +1,883 @@ +Extending Twig +============== + +.. caution:: + + This section describes how to extends Twig for versions **older than + 1.12**. If you are using a newer version, read the :doc:`newer` + chapter instead. + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig easily. If + you want to reuse your changes in different projects or if you want to + share them with others, you should then create an extension as described + in the following section. + +.. caution:: + + When extending Twig by calling methods on the Twig environment instance, + Twig won't be able to recompile your templates when the PHP code is + updated. To see your changes in real-time, either disable template caching + or package your code into an extension (see the next section of this + chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: twig + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: twig + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point of Twig. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: twig + + {{ 40|lipsum }} + +Again, it works, but it looks weird. A filter transforms the passed value to +something else but here we use the value to indicate the number of words to +generate (so, ``40`` is an argument of the filter, not the value we want to +transform). + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: twig + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: twig + + {{ 'some text' ~ ipsum(40) ~ 'some more text' }} + + {% set ipsum = ipsum(40) %} + +Last but not the least, you can also use a *global* object with a method able +to generate lorem ipsum text: + +.. code-block:: twig + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* trivial frequent Content generation +*global* trivial frequent Helper object +*function* trivial frequent Content generation +*filter* trivial frequent Value transformation +*tag* complex rare DSL language construct +*test* trivial rare Boolean decision +*operator* trivial rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new \Twig\Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: twig + + {{ text.lipsum(40) }} + +Filters +------- + +A filter is a regular PHP function or an object method that takes the left +side of the filter (before the pipe ``|``) as first argument and the extra +arguments passed to the filter (within parentheses ``()``) as extra arguments. + +Defining a filter is as easy as associating the filter name with a PHP +callable. For instance, let's say you have the following code in a template: + +.. code-block:: twig + + {{ 'TWIG'|lower }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig +filter, and it is simply mapped to the PHP ``strtolower()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +As you can see, the ``'TWIG'`` string is passed as a first argument to the PHP +function. + +A filter can also take extra arguments like in the following example: + +.. code-block:: twig + + {{ now|date('d/m/Y') }} + +In this case, the extra arguments are passed to the function after the main +argument, and the compiled code is equivalent to: + +.. code-block:: html+php + + + +Let's see how to create a new filter. + +In this section, we will create a ``rot13`` filter, which should return the +`rot13`_ transformation of a string. Here is an example of its usage and the +expected output: + +.. code-block:: twig + + {{ "Twig"|rot13 }} + + {# should displays Gjvt #} + +Adding a filter is as simple as calling the ``addFilter()`` method on the +``\Twig\Environment`` instance:: + + $twig = new \Twig\Environment($loader); + $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); + +The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. +Here, we use ``Twig_Filter_Function`` as the filter is a PHP function. The +first argument passed to the ``Twig_Filter_Function`` constructor is the name +of the PHP function to call, here ``str_rot13``, a native PHP function. + +Let's say I now want to be able to add a prefix before the converted string: + +.. code-block:: twig + + {{ "Twig"|rot13('prefix_') }} + + {# should displays prefix_Gjvt #} + +As the PHP ``str_rot13()`` function does not support this requirement, let's +create a new PHP function:: + + function project_compute_rot13($string, $prefix = '') + { + return $prefix.str_rot13($string); + } + +As you can see, the ``prefix`` argument of the filter is passed as an extra +argument to the ``project_compute_rot13()`` function. + +Adding this filter is as easy as before:: + + $twig->addFilter('rot13', new Twig_Filter_Function('project_compute_rot13')); + +For better encapsulation, a filter can also be defined as a static method of a +class. The ``Twig_Filter_Function`` class can also be used to register such +static methods as filters:: + + $twig->addFilter('rot13', new Twig_Filter_Function('SomeClass::rot13Filter')); + +.. tip:: + + In an extension, you can also define a filter as a static method of the + extension class. + +Environment aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Twig_Filter`` classes take options as their last argument. For instance, +if you want access to the current environment instance in your filter, set the +``needs_environment`` option to ``true``:: + + $filter = new Twig_Filter_Function('str_rot13', ['needs_environment' => true]); + +Twig will then pass the current environment as the first argument to the +filter call:: + + function twig_compute_rot13(\Twig\Environment $env, $string) + { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + } + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs HTML +or JavaScript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new Twig_Filter_Function('nl2br', ['is_safe' => ['html']]); + +Some filters may need to work on input that is already escaped or safe, for +example when adding (safe) HTML tags to originally unsafe output. In such a +case, set the ``pre_escape`` option to escape the input data before it is run +through your filter:: + + $filter = new Twig_Filter_Function('somefilter', ['pre_escape' => 'html', 'is_safe' => ['html']]); + +Dynamic Filters +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic filters support was added in Twig 1.5. + +A filter name containing the special ``*`` character is a dynamic filter as +the ``*`` can be any string:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following filters will be matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The filter will receive all dynamic part values before the normal filters +arguments. For instance, a call to ``'foo'|a_path_b()`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Functions +--------- + +A function is a regular PHP function or an object method that can be called from +templates. + +.. code-block:: twig + + {{ constant("DATE_W3C") }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``constant`` function. The ``constant`` function is a built-in Twig +function, and it is simply mapped to the PHP ``constant()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +Adding a function is similar to adding a filter. This can be done by calling the +``addFunction()`` method on the ``\Twig\Environment`` instance:: + + $twig = new \Twig\Environment($loader); + $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); + +You can also expose extension methods as functions in your templates:: + + // $this is an object that implements \Twig\Extension\ExtensionInterface. + $twig = new \Twig\Environment($loader); + $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); + +Functions also support ``needs_environment`` and ``is_safe`` parameters. + +Dynamic Functions +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic functions support was added in Twig 1.5. + +A function name containing the special ``*`` character is a dynamic function +as the ``*`` can be any string:: + + $twig->addFunction('*_path', new Twig_Function_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following functions will be matched by the above defined dynamic function: + +* ``product_path`` +* ``category_path`` + +A dynamic function can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The function will receive all dynamic part values before the normal functions +arguments. For instance, a call to ``a_path_b('foo')`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Tags +---- + +One of the most exciting feature of a template engine like Twig is the +possibility to define new language constructs. This is also the most complex +feature as you need to understand how Twig's internals work. + +Let's create a simple ``set`` tag that allows the definition of simple +variables from within a template. The tag can be used like follows: + +.. code-block:: twig + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default (cf. the template designers chapter for + more information). + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Adding a tag is as simple as calling the ``addTokenParser`` method on the +``\Twig\Environment`` instance:: + + $twig = new \Twig\Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends \Twig\TokenParser\AbstractTokenParser + { + public function parse(\Twig\Token $token) + { + $lineno = $token->getLine(); + $name = $this->parser->getStream()->expect(\Twig\Token::NAME_TYPE)->getValue(); + $this->parser->getStream()->expect(\Twig\Token::OPERATOR_TYPE, '='); + $value = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(\Twig\Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $lineno, $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``\Twig\Node\Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks a the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is rather simple:: + + class Project_Set_Node extends \Twig\Node\Node + { + public function __construct($name, \Twig\Node\Expression\AbstractExpression $value, $lineno, $tag = null) + { + parent::__construct(['value' => $value], ['name' => $name], $lineno, $tag); + } + + public function compile(\Twig\Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``\Twig\Node\ForNode`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``\Twig\Node\BlockNode`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``\Twig\Node\BlockNode`` for a + usage example). + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, global variables, functions, and node +visitors. + +Creating an extension also makes for a better separation of code that is +executed at compilation time and code needed at runtime. As such, it makes +your code faster. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when the + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: https://github.com/twigphp/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + */ + function initRuntime(\Twig\Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[] + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return \Twig\NodeVisitor\NodeVisitorInterface[] + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return \Twig\TwigFilter[] + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return \Twig\TwigTest[] + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return \Twig\TwigFunction[] + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array First array of unary operators, second array of binary operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + function getName(); + } + +To keep your extension class clean and lean, it can inherit from the built-in +``\Twig\Extension\AbstractExtension`` class instead of implementing the whole interface. That +way, you just need to implement the ``getName()`` method as the +``\Twig\Extension\AbstractExtension`` provides empty implementations for all other methods. + +The ``getName()`` method must return a unique identifier for your extension. + +Now, with this information in mind, let's create the most basic extension +possible:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getName() + { + return 'project'; + } + } + +.. note:: + + Of course, this extension does nothing for now. We will customize it in + the next sections. + +Twig does not care where you save your extension on the filesystem, as all +extensions must be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new \Twig\Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +Of course, you need to first load the extension file by either using +``require_once()`` or by using an autoloader (see `spl_autoload_register()`_). + +.. tip:: + + The bundled extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getGlobals() + { + return [ + 'text' => new Text(), + ]; + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFunctions() + { + return [ + 'lipsum' => new Twig_Function_Function('generate_lipsum'), + ]; + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFilters() + { + return [ + 'rot13' => new Twig_Filter_Function('str_rot13'), + ]; + } + + // ... + } + +As you can see in the above code, the ``getFilters()`` method returns an array +where keys are the name of the filters (``rot13``) and the values the +definition of the filter (``new Twig_Filter_Function('str_rot13')``). + +As seen in the previous chapter, you can also define filters as static methods +on the extension class:: + +$twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot13Filter')); + +You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` +when defining a filter to use a method:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getFilters() + { + return [ + 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), + ]; + } + + public function rot13Filter($string) + { + return str_rot13($string); + } + + // ... + } + +The first argument of the ``Twig_Filter_Method`` constructor is always +``$this``, the current extension object. The second one is the name of the +method to call. + +Using methods for filters is a great way to package your filter without +polluting the global namespace. This also gives the developer more flexibility +at the cost of a small overhead. + +Overriding default Filters +.......................... + +If some default core filters do not suit your needs, you can easily override +them by creating your own extension. Just use the same names as the one you +want to override:: + + class MyCoreExtension extends \Twig\Extension\AbstractExtension + { + public function getFilters() + { + return [ + 'date' => new Twig_Filter_Method($this, 'dateFilter'), + // ... + ]; + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + return '...'.twig_date_format_filter($timestamp, $format); + } + + public function getName() + { + return 'project'; + } + } + +Here, we override the ``date`` filter with a custom one. Using this extension +is as simple as registering the ``MyCoreExtension`` extension by calling the +``addExtension()`` method on the environment instance:: + + $twig = new \Twig\Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getTokenParsers() + { + return [new Project_Set_TokenParser()]; + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods allows to add new operators. Here is how to add +``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getOperators() + { + return [ + [ + '!' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], + ), + [ + '||' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + '&&' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + ], + ]; + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` methods allows to add new test functions:: + + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension + { + public function getTests() + { + return [ + 'even' => new Twig_Test_Function('twig_test_even'), + ]; + } + + // ... + } + +Testing an Extension +-------------------- + +.. versionadded:: 1.10 + Support for functional tests was added in Twig 1.10. + +Functional Tests +~~~~~~~~~~~~~~~~ + +You can create functional tests for extensions simply by creating the +following file structure in your test directory:: + + Fixtures/ + filters/ + foo.test + bar.test + functions/ + foo.test + bar.test + tags/ + foo.test + bar.test + IntegrationTest.php + +The ``IntegrationTest.php`` file should look like this:: + + class Project_Tests_IntegrationTest extends \Twig\Test\IntegrationTestCase + { + public function getExtensions() + { + return [ + new Project_Twig_Extension1(), + new Project_Twig_Extension2(), + ]; + } + + public function getFixturesDir() + { + return dirname(__FILE__).'/Fixtures/'; + } + } + +Fixtures examples can be found within the Twig repository +`tests/Twig/Fixtures`_ directory. + +Node Tests +~~~~~~~~~~ + +Testing the node visitors can be complex, so extend your test cases from +``\Twig\Test\NodeTestCase``. Examples can be found in the Twig repository +`tests/Twig/Node`_ directory. + +.. _`spl_autoload_register()`: https://secure.php.net/spl_autoload_register +.. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php +.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures +.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/api.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/api.rst new file mode 100644 index 0000000..b96b0d4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/api.rst @@ -0,0 +1,596 @@ +Twig for Developers +=================== + +This chapter describes the API to Twig and not the template language. It will +be most useful as reference to those implementing the template interface to +the application and not those who are creating Twig templates. + +Basics +------ + +Twig uses a central object called the **environment** (of class +``\Twig\Environment``). Instances of this class are used to store the +configuration and extensions, and are used to load templates. + +Most applications create one ``\Twig\Environment`` object on application +initialization and use that to load templates. In some cases, it might be useful +to have multiple environments side by side, with different configurations. + +The typical way to configure Twig to load templates for an application looks +roughly like this:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + + $loader = new \Twig\Loader\FilesystemLoader('/path/to/templates'); + $twig = new \Twig\Environment($loader, [ + 'cache' => '/path/to/compilation_cache', + ]); + +This creates a template environment with a default configuration and a loader +that looks up templates in the ``/path/to/templates/`` directory. Different +loaders are available and you can also write your own if you want to load +templates from a database or other resources. + +.. note:: + + Notice that the second argument of the environment is an array of options. + The ``cache`` option is a compilation cache directory, where Twig caches + the compiled templates to avoid the parsing phase for sub-sequent + requests. It is very different from the cache you might want to add for + the evaluated templates. For such a need, you can use any available PHP + cache library. + +Rendering Templates +------------------- + +To load a template from a Twig environment, call the ``load()`` method which +returns a ``\Twig\TemplateWrapper`` instance:: + + $template = $twig->load('index.html'); + +.. note:: + + Before Twig 1.28, use ``loadTemplate()`` instead which returns a + ``\Twig\Template`` instance. + +To render the template with some variables, call the ``render()`` method:: + + echo $template->render(['the' => 'variables', 'go' => 'here']); + +.. note:: + + The ``display()`` method is a shortcut to output the rendered template. + +You can also load and render the template in one fell swoop:: + + echo $twig->render('index.html', ['the' => 'variables', 'go' => 'here']); + +.. versionadded:: 1.28 + The possibility to render blocks from the API was added in Twig 1.28. + +If a template defines blocks, they can be rendered individually via the +``renderBlock()`` call:: + + echo $template->renderBlock('block_name', ['the' => 'variables', 'go' => 'here']); + +.. _environment_options: + +Environment Options +------------------- + +When creating a new ``\Twig\Environment`` instance, you can pass an array of +options as the constructor second argument:: + + $twig = new \Twig\Environment($loader, ['debug' => true]); + +The following options are available: + +* ``debug`` *boolean* + + When set to ``true``, the generated templates have a + ``__toString()`` method that you can use to display the generated nodes + (default to ``false``). + +* ``charset`` *string* (defaults to ``utf-8``) + + The charset used by the templates. + +* ``base_template_class`` *string* (defaults to ``\Twig\Template``) + + The base template class to use for generated + templates. + +* ``cache`` *string* or ``false`` + + An absolute path where to store the compiled templates, or + ``false`` to disable caching (which is the default). + +* ``auto_reload`` *boolean* + + When developing with Twig, it's useful to recompile the + template whenever the source code changes. If you don't provide a value for + the ``auto_reload`` option, it will be determined automatically based on the + ``debug`` value. + +* ``strict_variables`` *boolean* + + If set to ``false``, Twig will silently ignore invalid + variables (variables and or attributes/methods that do not exist) and + replace them with a ``null`` value. When set to ``true``, Twig throws an + exception instead (default to ``false``). + +* ``autoescape`` *string* or *boolean* + + If set to ``true``, HTML auto-escaping will be enabled by + default for all templates (default to ``true``). + + As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``, + ``false`` to disable). + + As of Twig 1.9, you can set the escaping strategy to use (``css``, ``url``, + ``html_attr``, or a PHP callback that takes the template name and must + return the escaping strategy to use -- the callback cannot be a function name + to avoid collision with built-in escaping strategies). + + As of Twig 1.17, the ``filename`` escaping strategy (renamed to ``name`` as + of Twig 1.27) determines the escaping strategy to use for a template based on + the template filename extension (this strategy does not incur any overhead at + runtime as auto-escaping is done at compilation time.) + +* ``optimizations`` *integer* + + A flag that indicates which optimizations to apply + (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to + disable). + +Loaders +------- + +Loaders are responsible for loading templates from a resource such as the file +system. + +Compilation Cache +~~~~~~~~~~~~~~~~~ + +All template loaders can cache the compiled templates on the filesystem for +future reuse. It speeds up Twig a lot as templates are only compiled once; and +the performance boost is even larger if you use a PHP accelerator such as +OPCache. See the ``cache`` and ``auto_reload`` options of ``\Twig\Environment`` +above for more information. + +Built-in Loaders +~~~~~~~~~~~~~~~~ + +Here is a list of the built-in loaders: + +``\Twig\Loader\FilesystemLoader`` +................................. + +.. versionadded:: 1.10 + The ``prependPath()`` and support for namespaces were added in Twig 1.10. + +.. versionadded:: 1.27 + Relative paths support was added in Twig 1.27. + +``\Twig\Loader\FilesystemLoader`` loads templates from the file system. This loader +can find templates in folders on the file system and is the preferred way to +load them:: + + $loader = new \Twig\Loader\FilesystemLoader($templateDir); + +It can also look for templates in an array of directories:: + + $loader = new \Twig\Loader\FilesystemLoader([$templateDir1, $templateDir2]); + +With such a configuration, Twig will first look for templates in +``$templateDir1`` and if they do not exist, it will fallback to look for them +in the ``$templateDir2``. + +You can add or prepend paths via the ``addPath()`` and ``prependPath()`` +methods:: + + $loader->addPath($templateDir3); + $loader->prependPath($templateDir4); + +The filesystem loader also supports namespaced templates. This allows to group +your templates under different namespaces which have their own template paths. + +When using the ``setPaths()``, ``addPath()``, and ``prependPath()`` methods, +specify the namespace as the second argument (when not specified, these +methods act on the "main" namespace):: + + $loader->addPath($templateDir, 'admin'); + +Namespaced templates can be accessed via the special +``@namespace_name/template_path`` notation:: + + $twig->render('@admin/index.html', []); + +``\Twig\Loader\FilesystemLoader`` support absolute and relative paths. Using relative +paths is preferred as it makes the cache keys independent of the project root +directory (for instance, it allows warming the cache from a build server where +the directory might be different from the one used on production servers):: + + $loader = new \Twig\Loader\FilesystemLoader('templates', getcwd().'/..'); + +.. note:: + + When not passing the root path as a second argument, Twig uses ``getcwd()`` + for relative paths. + +``\Twig\Loader\ArrayLoader`` +............................ + +``\Twig\Loader\ArrayLoader`` loads a template from a PHP array. It is passed an +array of strings bound to template names:: + + $loader = new \Twig\Loader\ArrayLoader([ + 'index.html' => 'Hello {{ name }}!', + ]); + $twig = new \Twig\Environment($loader); + + echo $twig->render('index.html', ['name' => 'Fabien']); + +This loader is very useful for unit testing. It can also be used for small +projects where storing all templates in a single PHP file might make sense. + +.. tip:: + + When using the ``Array`` loaders with a cache mechanism, you should know + that a new cache key is generated each time a template content "changes" + (the cache key being the source code of the template). If you don't want to + see your cache grows out of control, you need to take care of clearing the + old cache file by yourself. + +``\Twig\Loader\ChainLoader`` +............................ + +``\Twig\Loader\ChainLoader`` delegates the loading of templates to other loaders:: + + $loader1 = new \Twig\Loader\ArrayLoader([ + 'base.html' => '{% block content %}{% endblock %}', + ]); + $loader2 = new \Twig\Loader\ArrayLoader([ + 'index.html' => '{% extends "base.html" %}{% block content %}Hello {{ name }}{% endblock %}', + 'base.html' => 'Will never be loaded', + ]); + + $loader = new \Twig\Loader\ChainLoader([$loader1, $loader2]); + + $twig = new \Twig\Environment($loader); + +When looking for a template, Twig tries each loader in turn and returns as soon +as the template is found. When rendering the ``index.html`` template from the +above example, Twig will load it with ``$loader2`` but the ``base.html`` +template will be loaded from ``$loader1``. + +.. note:: + + You can also add loaders via the ``addLoader()`` method. + +Create your own Loader +~~~~~~~~~~~~~~~~~~~~~~ + +All loaders implement the ``\Twig\Loader\LoaderInterface``:: + + interface Twig_LoaderInterface + { + /** + * Gets the source code of a template, given its name. + * + * @param string $name string The name of the template to load + * + * @return string The template source code + * + * @deprecated since 1.27 (to be removed in 2.0), implement \Twig\Loader\SourceContextLoaderInterface + */ + function getSource($name); + + /** + * Gets the cache key to use for the cache for a given template name. + * + * @param string $name string The name of the template to load + * + * @return string The cache key + */ + function getCacheKey($name); + + /** + * Returns true if the template is still fresh. + * + * @param string $name The template name + * @param timestamp $time The last modification time of the cached template + */ + function isFresh($name, $time); + } + +The ``isFresh()`` method must return ``true`` if the current cached template +is still fresh, given the last modification time, or ``false`` otherwise. + +.. note:: + + As of Twig 1.27, you should also implement + ``\Twig\Loader\SourceContextLoaderInterface`` to avoid deprecation notices. + +.. tip:: + + As of Twig 1.11.0, you can also implement ``\Twig\Loader\ExistsLoaderInterface`` + to make your loader faster when used with the chain loader. + +Using Extensions +---------------- + +Twig extensions are packages that add new features to Twig. Register an +extension via the ``addExtension()`` method:: + + $twig->addExtension(new \Twig\Extension\SandboxExtension()); + +Twig comes bundled with the following extensions: + +* *Twig\Extension\CoreExtension*: Defines all the core features of Twig. + +* *Twig\Extension\DebugExtension*: Defines the ``dump`` function to help debug + template variables. + +* *Twig\Extension\EscaperExtension*: Adds automatic output-escaping and the + possibility to escape/unescape blocks of code. + +* *Twig\Extension\SandboxExtension*: Adds a sandbox mode to the default Twig + environment, making it safe to evaluate untrusted code. + +* *Twig\Extension\ProfilerExtension*: Enabled the built-in Twig profiler (as of + Twig 1.18). + +* *Twig\Extension\OptimizerExtension*: Optimizes the node tree before + compilation. + +* *Twig\Extension\StringLoaderExtension*: Defined the ``template_from_string`` + function to allow loading templates from string in a template. + +The Core, Escaper, and Optimizer extensions are registered by default. + +Built-in Extensions +------------------- + +This section describes the features added by the built-in extensions. + +.. tip:: + + Read the chapter about extending Twig to learn how to create your own + extensions. + +Core Extension +~~~~~~~~~~~~~~ + +The ``core`` extension defines all the core features of Twig: + +* :doc:`Tags `; +* :doc:`Filters `; +* :doc:`Functions `; +* :doc:`Tests `. + +Escaper Extension +~~~~~~~~~~~~~~~~~ + +The ``escaper`` extension adds automatic output escaping to Twig. It defines a +tag, ``autoescape``, and a filter, ``raw``. + +When creating the escaper extension, you can switch on or off the global +output escaping strategy:: + + $escaper = new \Twig\Extension\EscaperExtension('html'); + $twig->addExtension($escaper); + +If set to ``html``, all variables in templates are escaped (using the ``html`` +escaping strategy), except those using the ``raw`` filter: + +.. code-block:: twig + + {{ article.to_html|raw }} + +You can also change the escaping mode locally by using the ``autoescape`` tag +(see the :doc:`autoescape` doc for the syntax used before +Twig 1.8): + +.. code-block:: twig + + {% autoescape 'html' %} + {{ var }} + {{ var|raw }} {# var won't be escaped #} + {{ var|escape }} {# var won't be double-escaped #} + {% endautoescape %} + +.. warning:: + + The ``autoescape`` tag has no effect on included files. + +The escaping rules are implemented as follows: + +* Literals (integers, booleans, arrays, ...) used in the template directly as + variables or filter arguments are never automatically escaped: + + .. code-block:: twig + + {{ "Twig
" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ text }} {# will be escaped #} + +* Expressions which the result is always a literal or a variable marked safe + are never automatically escaped: + + .. code-block:: twig + + {{ foo ? "Twig
" : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text : "
Twig" }} {# will be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|raw : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|escape : "
Twig" }} {# the result of the expression won't be escaped #} + +* Escaping is applied before printing, after any other filter is applied: + + .. code-block:: twig + + {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} + +* The `raw` filter should only be used at the end of the filter chain: + + .. code-block:: twig + + {{ var|raw|upper }} {# will be escaped #} + + {{ var|upper|raw }} {# won't be escaped #} + +* Automatic escaping is not applied if the last filter in the chain is marked + safe for the current context (e.g. ``html`` or ``js``). ``escape`` and + ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked + safe for JavaScript, ``raw`` is marked safe for everything. + + .. code-block:: twig + + {% autoescape 'js' %} + {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #} + {{ var }} {# will be escaped for JavaScript #} + {{ var|escape('js') }} {# won't be double-escaped #} + {% endautoescape %} + +.. note:: + + Note that autoescaping has some limitations as escaping is applied on + expressions after evaluation. For instance, when working with + concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as + escaping is applied on the result of the concatenation, not on the + individual variables (so, the ``raw`` filter won't have any effect here). + +Sandbox Extension +~~~~~~~~~~~~~~~~~ + +The ``sandbox`` extension can be used to evaluate untrusted code. Access to +unsafe attributes and methods is prohibited. The sandbox security is managed +by a policy instance. By default, Twig comes with one policy class: +``\Twig\Sandbox\SecurityPolicy``. This class allows you to white-list some +tags, filters, properties, and methods:: + + $tags = ['if']; + $filters = ['upper']; + $methods = [ + 'Article' => ['getTitle', 'getBody'], + ]; + $properties = [ + 'Article' => ['title', 'body'], + ]; + $functions = ['range']; + $policy = new \Twig\Sandbox\SecurityPolicy($tags, $filters, $methods, $properties, $functions); + +With the previous configuration, the security policy will only allow usage of +the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be +able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` +objects, and the ``title`` and ``body`` public properties. Everything else +won't be allowed and will generate a ``\Twig\Sandbox\SecurityError`` exception. + +The policy object is the first argument of the sandbox constructor:: + + $sandbox = new \Twig\Extension\SandboxExtension($policy); + $twig->addExtension($sandbox); + +By default, the sandbox mode is disabled and should be enabled when including +untrusted template code by using the ``sandbox`` tag: + +.. code-block:: twig + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +You can sandbox all templates by passing ``true`` as the second argument of +the extension constructor:: + + $sandbox = new \Twig\Extension\SandboxExtension($policy, true); + +Profiler Extension +~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.18 + The Profile extension was added in Twig 1.18. + +The ``profiler`` extension enables a profiler for Twig templates; it should +only be used on your development machines as it adds some overhead:: + + $profile = new \Twig\Profiler\Profile(); + $twig->addExtension(new \Twig\Extension\ProfilerExtension($profile)); + + $dumper = new \Twig\Profiler\Dumper\TextDumper(); + echo $dumper->dump($profile); + +A profile contains information about time and memory consumption for template, +block, and macro executions. + +You can also dump the data in a `Blackfire.io `_ +compatible format:: + + $dumper = new \Twig\Profiler\Dumper\BlackfireDumper(); + file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); + +Upload the profile to visualize it (create a `free account +`_ +first): + +.. code-block:: sh + + blackfire --slot=7 upload /path/to/profile.prof + +Optimizer Extension +~~~~~~~~~~~~~~~~~~~ + +The ``optimizer`` extension optimizes the node tree before compilation:: + + $twig->addExtension(new \Twig\Extension\OptimizerExtension()); + +By default, all optimizations are turned on. You can select the ones you want +to enable by passing them to the constructor:: + + $optimizer = new \Twig\Extension\OptimizerExtension(\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_FOR); + + $twig->addExtension($optimizer); + +Twig supports the following optimizations: + +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_ALL``, enables all optimizations + (this is the default value). + +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_NONE``, disables all optimizations. + This reduces the compilation time, but it can increase the execution time + and the consumed memory. + +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_FOR``, optimizes the ``for`` tag by + removing the ``loop`` variable creation whenever possible. + +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER``, removes the ``raw`` + filter whenever possible. + +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_VAR_ACCESS``, simplifies the creation + and access of variables in the compiled templates whenever possible. + +Exceptions +---------- + +Twig can throw exceptions: + +* ``\Twig\Error\Error``: The base exception for all errors. + +* ``\Twig\Error\SyntaxError``: Thrown to tell the user that there is a problem with + the template syntax. + +* ``\Twig\Error\RuntimeError``: Thrown when an error occurs at runtime (when a filter + does not exist for instance). + +* ``\Twig\Error\LoaderError``: Thrown when an error occurs during template loading. + +* ``\Twig\Sandbox\SecurityError``: Thrown when an unallowed tag, filter, or + method is called in a sandboxed template. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/coding_standards.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/coding_standards.rst new file mode 100644 index 0000000..721b0f1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/coding_standards.rst @@ -0,0 +1,101 @@ +Coding Standards +================ + +When writing Twig templates, we recommend you to follow these official coding +standards: + +* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, + and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): + + .. code-block:: twig + + {{ foo }} + {# comment #} + {% if foo %}{% endif %} + + When using the whitespace control character, do not put any spaces between + it and the delimiter: + + .. code-block:: twig + + {{- foo -}} + {#- comment -#} + {%- if foo -%}{%- endif -%} + +* Put one (and only one) space before and after the following operators: + comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math + operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic + operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary + operator (``?:``): + + .. code-block:: twig + + {{ 1 + 2 }} + {{ foo ~ bar }} + {{ true ? true : false }} + +* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in + arrays and hashes: + + .. code-block:: twig + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Do not put any spaces after an opening parenthesis and before a closing + parenthesis in expressions: + + .. code-block:: twig + + {{ 1 + (2 * 3) }} + +* Do not put any spaces before and after string delimiters: + + .. code-block:: twig + + {{ 'foo' }} + {{ "foo" }} + +* Do not put any spaces before and after the following operators: ``|``, + ``.``, ``..``, ``[]``: + + .. code-block:: twig + + {{ foo|upper|lower }} + {{ user.name }} + {{ user[name] }} + {% for i in 1..12 %}{% endfor %} + +* Do not put any spaces before and after the parenthesis used for filter and + function calls: + + .. code-block:: twig + + {{ foo|default('foo') }} + {{ range(1..10) }} + +* Do not put any spaces before and after the opening and the closing of arrays + and hashes: + + .. code-block:: twig + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Use lower cased and underscored variable names: + + .. code-block:: twig + + {% set foo = 'foo' %} + {% set foo_bar = 'foo' %} + +* Indent your code inside tags (use the same indentation as the one used for + the target language of the rendered template): + + .. code-block:: twig + + {% block foo %} + {% if true %} + true + {% endif %} + {% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/deprecated.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/deprecated.rst new file mode 100644 index 0000000..1d01fcc --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/deprecated.rst @@ -0,0 +1,224 @@ +Deprecated Features +=================== + +This document lists all deprecated features in Twig. Deprecated features are +kept for backward compatibility and removed in the next major release (a +feature that was deprecated in Twig 1.x is removed in Twig 2.0). + +Deprecation Notices +------------------- + +As of Twig 1.21, Twig generates deprecation notices when a template uses +deprecated features. See :ref:`deprecation-notices` for more information. + +Macros +------ + +As of Twig 2.0, macros imported in a file are not available in child templates +anymore (via an ``include`` call for instance). You need to import macros +explicitly in each file where you are using them. + +Token Parsers +------------- + +* As of Twig 1.x, the token parser broker sub-system is deprecated. The + following class and interface will be removed in 2.0: + + * ``Twig_TokenParserBrokerInterface`` + * ``Twig_TokenParserBroker`` + +* As of Twig 1.27, ``\Twig\Parser::getFilename()`` is deprecated. From a token + parser, use ``$this->parser->getStream()->getSourceContext()->getPath()`` instead. + +* As of Twig 1.27, ``\Twig\Parser::getEnvironment()`` is deprecated. + +Extensions +---------- + +* As of Twig 1.x, the ability to remove an extension is deprecated and the + ``\Twig\Environment::removeExtension()`` method will be removed in 2.0. + +* As of Twig 1.23, the ``\Twig\Extension\ExtensionInterface::initRuntime()`` method is + deprecated. You have two options to avoid the deprecation notice: if you + implement this method to store the environment for your custom filters, + functions, or tests, use the ``needs_environment`` option instead; if you + have more complex needs, explicitly implement + ``\Twig\Extension\InitRuntimeInterface`` (not recommended). + +* As of Twig 1.23, the ``\Twig\Extension\ExtensionInterface::getGlobals()`` method is + deprecated. Implement ``\Twig\Extension\GlobalsInterface`` to avoid + deprecation notices. + +* As of Twig 1.26, the ``\Twig\Extension\ExtensionInterface::getName()`` method is + deprecated and it is not used internally anymore. + +PEAR +---- + +PEAR support has been discontinued in Twig 1.15.1, and no PEAR packages are +provided anymore. Use Composer instead. + +Filters +------- + +* As of Twig 1.x, use ``\Twig\TwigFilter`` to add a filter. The following + classes and interfaces will be removed in 2.0: + + * ``Twig_FilterInterface`` + * ``Twig_FilterCallableInterface`` + * ``Twig_Filter`` + * ``Twig_Filter_Function`` + * ``Twig_Filter_Method`` + * ``Twig_Filter_Node`` + +* As of Twig 2.x, the ``Twig_SimpleFilter`` class is deprecated and will be + removed in Twig 3.x (use ``\Twig\TwigFilter`` instead). In Twig 2.x, + ``Twig_SimpleFilter`` is just an alias for ``\Twig\TwigFilter``. + +Functions +--------- + +* As of Twig 1.x, use ``\Twig\TwigFunction`` to add a function. The following + classes and interfaces will be removed in 2.0: + + * ``Twig_FunctionInterface`` + * ``Twig_FunctionCallableInterface`` + * ``Twig_Function`` + * ``Twig_Function_Function`` + * ``Twig_Function_Method`` + * ``Twig_Function_Node`` + +* As of Twig 2.x, the ``Twig_SimpleFunction`` class is deprecated and will be + removed in Twig 3.x (use ``\Twig\TwigFunction`` instead). In Twig 2.x, + ``Twig_SimpleFunction`` is just an alias for ``\Twig\TwigFunction``. + +Tests +----- + +* As of Twig 1.x, use ``\Twig\TwigTest`` to add a test. The following classes + and interfaces will be removed in 2.0: + + * ``Twig_TestInterface`` + * ``Twig_TestCallableInterface`` + * ``Twig_Test`` + * ``Twig_Test_Function`` + * ``Twig_Test_Method`` + * ``Twig_Test_Node`` + +* As of Twig 2.x, the ``Twig_SimpleTest`` class is deprecated and will be + removed in Twig 3.x (use ``\Twig\TwigTest`` instead). In Twig 2.x, + ``Twig_SimpleTest`` is just an alias for ``\Twig\TwigTest``. + +* The ``sameas`` and ``divisibleby`` tests are deprecated in favor of ``same + as`` and ``divisible by`` respectively. + +Tags +---- + +* As of Twig 1.x, the ``raw`` tag is deprecated. You should use ``verbatim`` + instead. + +Nodes +----- + +* As of Twig 1.x, ``Node::toXml()`` is deprecated and will be removed in Twig + 2.0. + +* As of Twig 1.26, ``Node::$nodes`` should only contains ``\Twig\Node\Node`` + instances, storing a ``null`` value is deprecated and won't be possible in + Twig 2.x. + +* As of Twig 1.27, the ``filename`` attribute on ``\Twig\Node\ModuleNode`` is + deprecated. Use ``getName()`` instead. + +* As of Twig 1.27, the ``\Twig\Node\Node::getFilename()/\Twig\Node\Node::getLine()`` + methods are deprecated, use + ``\Twig\Node\Node::getTemplateName()/\Twig\Node\Node::getTemplateLine()`` instead. + +Interfaces +---------- + +* As of Twig 2.x, the following interfaces are deprecated and empty (they will + be removed in Twig 3.0): + +* ``Twig_CompilerInterface`` (use ``\Twig\Compiler`` instead) +* ``Twig_LexerInterface`` (use ``\Twig\Lexer`` instead) +* ``Twig_NodeInterface`` (use ``\Twig\Node\Node`` instead) +* ``Twig_ParserInterface`` (use ``\Twig\Parser`` instead) +* ``\Twig\Loader\ExistsLoaderInterface`` (merged with ``\Twig\Loader\LoaderInterface``) +* ``\Twig\Loader\SourceContextLoaderInterface`` (merged with ``\Twig\Loader\LoaderInterface``) +* ``Twig_TemplateInterface`` (use ``\Twig\Template`` instead, and use + those constants \Twig\Template::ANY_CALL, \Twig\Template::ARRAY_CALL, + \Twig\Template::METHOD_CALL) + +Compiler +-------- + +* As of Twig 1.26, the ``\Twig\Compiler::getFilename()`` has been deprecated. + You should not use it anyway as its values is not reliable. + +* As of Twig 1.27, the ``\Twig\Compiler::addIndentation()`` has been deprecated. + Use ``\Twig\Compiler::write('')`` instead. + +Loaders +------- + +* As of Twig 1.x, ``Twig_Loader_String`` is deprecated and will be removed in + 2.0. You can render a string via ``\Twig\Environment::createTemplate()``. + +* As of Twig 1.27, ``\Twig\Loader\LoaderInterface::getSource()`` is deprecated. + Implement ``\Twig\Loader\SourceContextLoaderInterface`` instead and use + ``getSourceContext()``. + +Node Visitors +------------- + +* Because of the removal of ``Twig_NodeInterface`` in 2.0, you need to extend + ``\Twig\NodeVisitor\AbstractNodeVisitor`` instead of implementing ``\Twig\NodeVisitor\NodeVisitorInterface`` + directly to make your node visitors compatible with both Twig 1.x and 2.x. + +Globals +------- + +* As of Twig 2.x, the ability to register a global variable after the runtime + or the extensions have been initialized is not possible anymore (but + changing the value of an already registered global is possible). + +* As of Twig 1.x, using the ``_self`` global variable to get access to the + current ``\Twig\Template`` instance is deprecated; most usages only need the + current template name, which will continue to work in Twig 2.0. In Twig 2.0, + ``_self`` returns the current template name instead of the current + ``\Twig\Template`` instance. If you are using ``{{ _self.templateName }}``, + just replace it with ``{{ _self }}``. + +Miscellaneous +------------- + +* As of Twig 1.x, ``\Twig\Environment::clearTemplateCache()``, + ``\Twig\Environment::writeCacheFile()``, + ``\Twig\Environment::clearCacheFiles()``, + ``\Twig\Environment::getCacheFilename()``, + ``\Twig\Environment::getTemplateClassPrefix()``, + ``\Twig\Environment::getLexer()``, ``\Twig\Environment::getParser()``, and + ``\Twig\Environment::getCompiler()`` are deprecated and will be removed in 2.0. + +* As of Twig 1.x, ``\Twig\Template::getEnvironment()`` and + ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be + removed in 2.0. + +* As of Twig 1.21, setting the environment option ``autoescape`` to ``true`` is + deprecated and will be removed in 2.0. Use ``"html"`` instead. + +* As of Twig 1.27, ``\Twig\Error\Error::getTemplateFile()`` and + ``\Twig\Error\Error::setTemplateFile()`` are deprecated. Use + ``\Twig\Error\Error::getTemplateName()`` and ``\Twig\Error\Error::setTemplateName()`` + instead. + +* As of Twig 1.27, ``\Twig\Template::getSource()`` is deprecated. Use + ``\Twig\Template::getSourceContext()`` instead. + +* As of Twig 1.27, ``\Twig\Parser::addHandler()`` and + ``\Twig\Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0. + +* As of Twig 1.29, some classes are marked as being final via the `@final` + annotation. Those classes will be marked as final in 2.0. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/abs.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/abs.rst new file mode 100644 index 0000000..77d5cf0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/abs.rst @@ -0,0 +1,18 @@ +``abs`` +======= + +The ``abs`` filter returns the absolute value. + +.. code-block:: twig + + {# number = -5 #} + + {{ number|abs }} + + {# outputs 5 #} + +.. note:: + + Internally, Twig uses the PHP `abs`_ function. + +.. _`abs`: https://secure.php.net/abs diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/batch.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/batch.rst new file mode 100644 index 0000000..cc50ec8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/batch.rst @@ -0,0 +1,51 @@ +``batch`` +========= + +.. versionadded:: 1.12.3 + The ``batch`` filter was added in Twig 1.12.3. + +The ``batch`` filter "batches" items by returning a list of lists with the +given number of items. A second parameter can be provided and used to fill in +missing items: + +.. code-block:: twig + + {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} + + + {% for row in items|batch(3, 'No item') %} + + {% for column in row %} + + {% endfor %} + + {% endfor %} +
{{ column }}
+ +The above example will be rendered as: + +.. code-block:: twig + + + + + + + + + + + + + + + + + +
abc
def
gNo itemNo item
+ +Arguments +--------- + +* ``size``: The size of the batch; fractional numbers will be rounded up +* ``fill``: Used to fill in missing items diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/capitalize.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/capitalize.rst new file mode 100644 index 0000000..2353658 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/capitalize.rst @@ -0,0 +1,11 @@ +``capitalize`` +============== + +The ``capitalize`` filter capitalizes a value. The first character will be +uppercase, all others lowercase: + +.. code-block:: twig + + {{ 'my first car'|capitalize }} + + {# outputs 'My first car' #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/convert_encoding.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/convert_encoding.rst new file mode 100644 index 0000000..28fde82 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -0,0 +1,28 @@ +``convert_encoding`` +==================== + +.. versionadded:: 1.4 + The ``convert_encoding`` filter was added in Twig 1.4. + +The ``convert_encoding`` filter converts a string from one encoding to +another. The first argument is the expected output charset and the second one +is the input charset: + +.. code-block:: twig + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + +.. note:: + + This filter relies on the `iconv`_ or `mbstring`_ extension, so one of + them must be installed. In case both are installed, `mbstring`_ is used by + default (Twig before 1.8.1 uses `iconv`_ by default). + +Arguments +--------- + +* ``to``: The output charset +* ``from``: The input charset + +.. _`iconv`: https://secure.php.net/iconv +.. _`mbstring`: https://secure.php.net/mbstring diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date.rst new file mode 100644 index 0000000..b8f00bf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date.rst @@ -0,0 +1,100 @@ +``date`` +======== + +.. versionadded:: 1.1 + The timezone support has been added in Twig 1.1. + +.. versionadded:: 1.5 + The default date format support has been added in Twig 1.5. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +.. versionadded:: 1.11.0 + The introduction of the false value for the timezone was introduced in Twig 1.11.0 + +The ``date`` filter formats a date to a given format: + +.. code-block:: twig + + {{ post.published_at|date("m/d/Y") }} + +The format specifier is the same as supported by `date`_, +except when the filtered data is of type `DateInterval`_, when the format must conform to +`DateInterval::format`_ instead. + +The ``date`` filter accepts strings (it must be in a format supported by the +`strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For +instance, to display the current date, filter the word "now": + +.. code-block:: twig + + {{ "now"|date("m/d/Y") }} + +To escape words and characters in the date format use ``\\`` in front of each +character: + +.. code-block:: twig + + {{ post.published_at|date("F jS \\a\\t g:ia") }} + +If the value passed to the ``date`` filter is ``null``, it will return the +current date by default. If an empty string is desired instead of the current +date, use a ternary operator: + +.. code-block:: twig + + {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} + +If no format is provided, Twig will use the default one: ``F j, Y H:i``. This +default can be easily changed by calling the ``setDateFormat()`` method on the +``core`` extension instance. The first argument is the default format for +dates and the second one is the default format for date intervals: + +.. code-block:: php + + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('d/m/Y', '%d days'); + + // before Twig 1.26 + $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); + +Timezone +-------- + +By default, the date is displayed by applying the default timezone (the one +specified in php.ini or declared in Twig -- see below), but you can override +it by explicitly specifying a timezone: + +.. code-block:: twig + + {{ post.published_at|date("m/d/Y", "Europe/Paris") }} + +If the date is already a DateTime object, and if you want to keep its current +timezone, pass ``false`` as the timezone value: + +.. code-block:: twig + + {{ post.published_at|date("m/d/Y", false) }} + +The default timezone can also be set globally by calling ``setTimezone()``: + +.. code-block:: php + + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setTimezone('Europe/Paris'); + + // before Twig 1.26 + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +Arguments +--------- + +* ``format``: The date format +* ``timezone``: The date timezone + +.. _`strtotime`: https://secure.php.net/strtotime +.. _`DateTime`: https://secure.php.net/DateTime +.. _`DateInterval`: https://secure.php.net/DateInterval +.. _`date`: https://secure.php.net/date +.. _`DateInterval::format`: https://secure.php.net/DateInterval.format diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date_modify.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date_modify.rst new file mode 100644 index 0000000..562cb63 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/date_modify.rst @@ -0,0 +1,23 @@ +``date_modify`` +=============== + +.. versionadded:: 1.9.0 + The date_modify filter has been added in Twig 1.9.0. + +The ``date_modify`` filter modifies a date with a given modifier string: + +.. code-block:: twig + + {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} + +The ``date_modify`` filter accepts strings (it must be in a format supported +by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine +it with the :doc:`date` filter for formatting. + +Arguments +--------- + +* ``modifier``: The modifier + +.. _`strtotime`: https://secure.php.net/strtotime +.. _`DateTime`: https://secure.php.net/DateTime diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/default.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/default.rst new file mode 100644 index 0000000..c4ccb56 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/default.rst @@ -0,0 +1,33 @@ +``default`` +=========== + +The ``default`` filter returns the passed default value if the value is +undefined or empty, otherwise the value of the variable: + +.. code-block:: twig + + {{ var|default('var is not defined') }} + + {{ var.foo|default('foo item on var is not defined') }} + + {{ var['foo']|default('foo item on var is not defined') }} + + {{ ''|default('passed var is empty') }} + +When using the ``default`` filter on an expression that uses variables in some +method calls, be sure to use the ``default`` filter whenever a variable can be +undefined: + +.. code-block:: twig + + {{ var.method(foo|default('foo'))|default('foo') }} + +.. note:: + + Read the documentation for the :doc:`defined<../tests/defined>` and + :doc:`empty<../tests/empty>` tests to learn more about their semantics. + +Arguments +--------- + +* ``default``: The default value diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/escape.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/escape.rst new file mode 100644 index 0000000..8ae95b9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/escape.rst @@ -0,0 +1,129 @@ +``escape`` +========== + +.. versionadded:: 1.9.0 + The ``css``, ``url``, and ``html_attr`` strategies were added in Twig + 1.9.0. + +.. versionadded:: 1.14.0 + The ability to define custom escapers was added in Twig 1.14.0. + +The ``escape`` filter escapes a string using strategies that depend on the +context. + +By default, it uses the HTML escaping strategy: + +.. code-block:: html+twig + +

+ {{ user.username|escape }} +

+ +For convenience, the ``e`` filter is defined as an alias: + +.. code-block:: html+twig + +

+ {{ user.username|e }} +

+ +The ``escape`` filter can also be used in other contexts than HTML thanks to +an optional argument which defines the escaping strategy to use: + +.. code-block:: twig + + {{ user.username|e }} + {# is equivalent to #} + {{ user.username|e('html') }} + +And here is how to escape variables included in JavaScript code: + +.. code-block:: twig + + {{ user.username|escape('js') }} + {{ user.username|e('js') }} + +The ``escape`` filter supports the following escaping strategies for HTML +documents: + +* ``html``: escapes a string for the **HTML body** context. + +* ``js``: escapes a string for the **JavaScript** context. + +* ``css``: escapes a string for the **CSS** context. CSS escaping can be + applied to any string being inserted into CSS and escapes everything except + alphanumerics. + +* ``url``: escapes a string for the **URI or parameter** contexts. This should + not be used to escape an entire URI; only a subcomponent being inserted. + +* ``html_attr``: escapes a string for the **HTML attribute** context. + +Note that doing contextual escaping in HTML documents is hard and choosing the +right escaping strategy depends on a lot of factors. Please, read related +documentation like `the OWASP prevention cheat sheet +`_ +to learn more about this topic. + +.. note:: + + Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function + for the HTML escaping strategy. + +.. caution:: + + When using automatic escaping, Twig tries to not double-escape a variable + when the automatic escaping strategy is the same as the one applied by the + escape filter; but that does not work when using a variable as the + escaping strategy: + + .. code-block:: twig + + {% set strategy = 'html' %} + + {% autoescape 'html' %} + {{ var|escape('html') }} {# won't be double-escaped #} + {{ var|escape(strategy) }} {# will be double-escaped #} + {% endautoescape %} + + When using a variable as the escaping strategy, you should disable + automatic escaping: + + .. code-block:: twig + + {% set strategy = 'html' %} + + {% autoescape 'html' %} + {{ var|escape(strategy)|raw }} {# won't be double-escaped #} + {% endautoescape %} + +Custom Escapers +--------------- + +You can define custom escapers by calling the ``setEscaper()`` method on the +``core`` extension instance. The first argument is the escaper name (to be +used in the ``escape`` call) and the second one must be a valid PHP callable: + +.. code-block:: php + + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('csv', 'csv_escaper'); + + // before Twig 1.26 + $twig->getExtension('core')->setEscaper('csv', 'csv_escaper'); + +When called by Twig, the callable receives the Twig environment instance, the +string to escape, and the charset. + +.. note:: + + Built-in escapers cannot be overridden mainly because they should be + considered as the final implementation and also for better performance. + +Arguments +--------- + +* ``strategy``: The escaping strategy +* ``charset``: The string charset + +.. _`htmlspecialchars`: https://secure.php.net/htmlspecialchars diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/filter.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/filter.rst new file mode 100644 index 0000000..a6c1c13 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/filter.rst @@ -0,0 +1,47 @@ +``filter`` +========= + +.. versionadded:: 1.41 + The ``filter`` filter was added in Twig 1.41. + +The ``filter`` filter filters elements of a sequence or a mapping using an arrow +function. The arrow function receives the value of the sequence or mapping: + +.. code-block:: twig + + {% set sizes = [34, 36, 38, 40, 42] %} + + {% for v in sizes|filter(v => v > 38) -%} + {{ v }} + {% endfor %} + {# output 40 42 #} + + {% set sizes = { + xs: 34, + s: 36, + m: 38, + l: 40, + xl: 42, + } %} + + {% for k, v in sizes|filter(v => v > 38) -%} + {{ k }} = {{ v }} + {% endfor %} + {# output l = 40 xl = 42 #} + +The arrow function also receives the key as a second argument: + +.. code-block:: twig + + {% for k, v in sizes|filter((v, k) => v > 38 and k != "xl") -%} + {{ k }} = {{ v }} + {% endfor %} + {# output l = 40 #} + +Note that the arrow function has access to the current context. + +Arguments +--------- + +* ``array``: The sequence or mapping +* ``arrow``: The arrow function diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/first.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/first.rst new file mode 100644 index 0000000..f87fe59 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/first.rst @@ -0,0 +1,25 @@ +``first`` +========= + +.. versionadded:: 1.12.2 + The ``first`` filter was added in Twig 1.12.2. + +The ``first`` filter returns the first "element" of a sequence, a mapping, or +a string: + +.. code-block:: twig + + {{ [1, 2, 3, 4]|first }} + {# outputs 1 #} + + {{ { a: 1, b: 2, c: 3, d: 4 }|first }} + {# outputs 1 #} + + {{ '1234'|first }} + {# outputs 1 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/format.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/format.rst new file mode 100644 index 0000000..c0c96ee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/format.rst @@ -0,0 +1,16 @@ +``format`` +========== + +The ``format`` filter formats a given string by replacing the placeholders +(placeholders follows the `sprintf`_ notation): + +.. code-block:: twig + + {{ "I like %s and %s."|format(foo, "bar") }} + + {# outputs I like foo and bar + if the foo parameter equals to the foo string. #} + +.. _`sprintf`: https://secure.php.net/sprintf + +.. seealso:: :doc:`replace` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/index.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/index.rst new file mode 100644 index 0000000..8524fc0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/index.rst @@ -0,0 +1,41 @@ +Filters +======= + +.. toctree:: + :maxdepth: 1 + + abs + batch + capitalize + convert_encoding + date + date_modify + default + escape + filter + first + format + join + json_encode + keys + last + length + lower + map + merge + nl2br + number_format + raw + reduce + replace + reverse + round + slice + sort + spaceless + split + striptags + title + trim + upper + url_encode diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/join.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/join.rst new file mode 100644 index 0000000..3f9079e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/join.rst @@ -0,0 +1,35 @@ +``join`` +======== + +.. versionadded:: 1.37 and 2.6.1 + The ``and`` argument was added in Twig 1.37 and 2.6.1. + +The ``join`` filter returns a string which is the concatenation of the items +of a sequence: + +.. code-block:: twig + + {{ [1, 2, 3]|join }} + {# returns 123 #} + +The separator between elements is an empty string per default, but you can +define it with the optional first parameter: + +.. code-block:: twig + + {{ [1, 2, 3]|join('|') }} + {# outputs 1|2|3 #} + +A second parameter can also be provided that will be the separator used between +the last two items of the sequence: + +.. code-block:: twig + + {{ [1, 2, 3]|join(', ', ' and ') }} + {# outputs 1, 2 and 3 #} + +Arguments +--------- + +* ``glue``: The separator +* ``and``: The separator for the last pair of input items diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/json_encode.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/json_encode.rst new file mode 100644 index 0000000..434e2f1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/json_encode.rst @@ -0,0 +1,23 @@ +``json_encode`` +=============== + +The ``json_encode`` filter returns the JSON representation of a value: + +.. code-block:: twig + + {{ data|json_encode() }} + +.. note:: + + Internally, Twig uses the PHP `json_encode`_ function. + +Arguments +--------- + +* ``options``: A bitmask of `json_encode options`_: ``{{ + data|json_encode(constant('JSON_PRETTY_PRINT')) }}``. + Combine constants using :ref:`bitwise operators`: + ``{{ data|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_HEX_QUOT')) }}`` + +.. _`json_encode`: https://secure.php.net/json_encode +.. _`json_encode options`: https://secure.php.net/manual/en/json.constants.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/keys.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/keys.rst new file mode 100644 index 0000000..5860947 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/keys.rst @@ -0,0 +1,11 @@ +``keys`` +======== + +The ``keys`` filter returns the keys of an array. It is useful when you want to +iterate over the keys of an array: + +.. code-block:: twig + + {% for key in array|keys %} + ... + {% endfor %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/last.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/last.rst new file mode 100644 index 0000000..0eb2b84 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/last.rst @@ -0,0 +1,25 @@ +``last`` +======== + +.. versionadded:: 1.12.2 + The ``last`` filter was added in Twig 1.12.2. + +The ``last`` filter returns the last "element" of a sequence, a mapping, or +a string: + +.. code-block:: twig + + {{ [1, 2, 3, 4]|last }} + {# outputs 4 #} + + {{ { a: 1, b: 2, c: 3, d: 4 }|last }} + {# outputs 4 #} + + {{ '1234'|last }} + {# outputs 4 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/length.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/length.rst new file mode 100644 index 0000000..8b504ed --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/length.rst @@ -0,0 +1,23 @@ +``length`` +========== + +.. versionadded:: 1.33 + + Support for the ``__toString()`` magic method has been added in Twig 1.33. + +The ``length`` filter returns the number of items of a sequence or mapping, or +the length of a string. + +For objects that implement the ``Countable`` interface, ``length`` will use the +return value of the ``count()`` method. + +For objects that implement the ``__toString()`` magic method (and not ``Countable``), +it will return the length of the string provided by that method. + +For objects that implement the ``IteratorAggregate`` interface, ``length`` will use the return value of the ``iterator_count()`` method. + +.. code-block:: twig + + {% if users|length > 10 %} + ... + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/lower.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/lower.rst new file mode 100644 index 0000000..c0a0e0c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/lower.rst @@ -0,0 +1,10 @@ +``lower`` +========= + +The ``lower`` filter converts a value to lowercase: + +.. code-block:: twig + + {{ 'WELCOME'|lower }} + + {# outputs 'welcome' #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/map.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/map.rst new file mode 100644 index 0000000..b4849a6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/map.rst @@ -0,0 +1,38 @@ +``map`` +======= + +.. versionadded:: 1.41 + The ``map`` filter was added in Twig 1.41. + +The ``map`` filter applies an arrow function to the elements of a sequence or a +mapping. The arrow function receives the value of the sequence or mapping: + +.. code-block:: twig + + {% set people = [ + {first: "Bob", last: "Smith"}, + {first: "Alice", last: "Dupond"}, + ] %} + + {{ people|map(p => "#{p.first} #{p.last}")|join(', ') }} + {# outputs Bob Smith, Alice Dupond #} + +The arrow function also receives the key as a second argument: + +.. code-block:: twig + + {% set people = { + "Bob": "Smith", + "Alice": "Dupond", + } %} + + {{ people|map((first, last) => "#{first} #{last}")|join(', ') }} + {# outputs Bob Smith, Alice Dupond #} + +Note that the arrow function has access to the current context. + +Arguments +--------- + +* ``array``: The sequence or mapping +* ``arrow``: The arrow function diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/merge.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/merge.rst new file mode 100644 index 0000000..e26e51c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/merge.rst @@ -0,0 +1,48 @@ +``merge`` +========= + +The ``merge`` filter merges an array with another array: + +.. code-block:: twig + + {% set values = [1, 2] %} + + {% set values = values|merge(['apple', 'orange']) %} + + {# values now contains [1, 2, 'apple', 'orange'] #} + +New values are added at the end of the existing ones. + +The ``merge`` filter also works on hashes: + +.. code-block:: twig + + {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} + + {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} + +For hashes, the merging process occurs on the keys: if the key does not +already exist, it is added but if the key already exists, its value is +overridden. + +.. tip:: + + If you want to ensure that some values are defined in an array (by given + default values), reverse the two elements in the call: + + .. code-block:: twig + + {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + + {% set items = { 'apple': 'unknown' }|merge(items) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} + +.. note:: + + Internally, Twig uses the PHP `array_merge`_ function. It supports + Traversable objects by transforming those to arrays. + +.. _`array_merge`: https://secure.php.net/array_merge diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/nl2br.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/nl2br.rst new file mode 100644 index 0000000..3ad8d85 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/nl2br.rst @@ -0,0 +1,22 @@ +``nl2br`` +========= + +.. versionadded:: 1.5 + The ``nl2br`` filter was added in Twig 1.5. + +The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: + +.. code-block:: twig + + {{ "I like Twig.\nYou will like it too."|nl2br }} + {# outputs + + I like Twig.
+ You will like it too. + + #} + +.. note:: + + The ``nl2br`` filter pre-escapes the input before applying the + transformation. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/number_format.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/number_format.rst new file mode 100644 index 0000000..59335e3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/number_format.rst @@ -0,0 +1,56 @@ +``number_format`` +================= + +.. versionadded:: 1.5 + The ``number_format`` filter was added in Twig 1.5 + +The ``number_format`` filter formats numbers. It is a wrapper around PHP's +`number_format`_ function: + +.. code-block:: twig + + {{ 200.35|number_format }} + +You can control the number of decimal places, decimal point, and thousands +separator using the additional arguments: + +.. code-block:: twig + + {{ 9800.333|number_format(2, '.', ',') }} + +To format negative numbers, wrap the number with parentheses (needed because of +Twig's :ref:`precedence of operators `: + +.. code-block:: twig + + {{ -9800.333|number_format(2, '.', ',') }} {# outputs : -9 #} + {{ (-9800.333)|number_format(2, '.', ',') }} {# outputs : -9,800.33 #} + +If no formatting options are provided then Twig will use the default formatting +options of: + +* 0 decimal places. +* ``.`` as the decimal point. +* ``,`` as the thousands separator. + +These defaults can be easily changed through the core extension: + +.. code-block:: php + + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setNumberFormat(3, '.', ','); + + // before Twig 1.26 + $twig->getExtension('core')->setNumberFormat(3, '.', ','); + +The defaults set for ``number_format`` can be over-ridden upon each call using the +additional parameters. + +Arguments +--------- + +* ``decimal``: The number of decimal points to display +* ``decimal_point``: The character(s) to use for the decimal point +* ``thousand_sep``: The character(s) to use for the thousands separator + +.. _`number_format`: https://secure.php.net/number_format diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/raw.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/raw.rst new file mode 100644 index 0000000..ad74a52 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/raw.rst @@ -0,0 +1,38 @@ +``raw`` +======= + +The ``raw`` filter marks the value as being "safe", which means that in an +environment with automatic escaping enabled this variable will not be escaped +if ``raw`` is the last filter applied to it: + +.. code-block:: twig + + {% autoescape %} + {{ var|raw }} {# var won't be escaped #} + {% endautoescape %} + +.. note:: + + **This note only applies to Twig before versions 1.39 and 2.8**. + + Be careful when using the ``raw`` filter inside expressions: + + .. code-block:: twig + + {% autoescape %} + {% set hello = 'Hello' %} + {% set hola = 'Hola' %} + + {{ false ? 'Hola' : hello|raw }} + does not render the same as + {{ false ? hola : hello|raw }} + but renders the same as + {{ (false ? hola : hello)|raw }} + {% endautoescape %} + + The first ternary statement is not escaped: ``hello`` is marked as being + safe and Twig does not escape static values (see + :doc:`escape<../tags/autoescape>`). In the second ternary statement, even + if ``hello`` is marked as safe, ``hola`` remains unsafe and so is the whole + expression. The third ternary statement is marked as safe and the result is + not escaped. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reduce.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reduce.rst new file mode 100644 index 0000000..10a0d5a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reduce.rst @@ -0,0 +1,33 @@ +``reduce`` +========= + +.. versionadded:: 1.41 + The ``reduce`` filter was added in Twig 1.41. + +The ``reduce`` filter iteratively reduces a sequence or a mapping to a single +value using an arrow function, so as to reduce it to a single value. The arrow +function receives the return value of the previous iteration and the current +value of the sequence or mapping: + +.. code-block:: twig + + {% set numbers = [1, 2, 3] %} + + {{ numbers|reduce((carry, v) => carry + v) }} + {# output 6 #} + +The ``reduce`` filter takes an ``initial`` value as a second argument: + +.. code-block:: twig + + {{ numbers|reduce((carry, v) => carry + v, 10) }} + {# output 16 #} + +Note that the arrow function has access to the current context. + +Arguments +--------- + +* ``array``: The sequence or mapping +* ``arrow``: The arrow function +* ``initial``: The initial value diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/replace.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/replace.rst new file mode 100644 index 0000000..ceb6c00 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/replace.rst @@ -0,0 +1,25 @@ +``replace`` +=========== + +The ``replace`` filter formats a given string by replacing the placeholders +(placeholders are free-form): + +.. code-block:: twig + + {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} + + {# outputs I like foo and bar + if the foo parameter equals to the foo string. #} + + {# using % as a delimiter is purely conventional and optional #} + + {{ "I like this and --that--."|replace({'this': foo, '--that--': "bar"}) }} + + {# outputs I like foo and bar #} + +Arguments +--------- + +* ``from``: The placeholder values + +.. seealso:: :doc:`format` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reverse.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reverse.rst new file mode 100644 index 0000000..b2218c9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/reverse.rst @@ -0,0 +1,47 @@ +``reverse`` +=========== + +.. versionadded:: 1.6 + Support for strings has been added in Twig 1.6. + +The ``reverse`` filter reverses a sequence, a mapping, or a string: + +.. code-block:: twig + + {% for user in users|reverse %} + ... + {% endfor %} + + {{ '1234'|reverse }} + + {# outputs 4321 #} + +.. tip:: + + For sequences and mappings, numeric keys are not preserved. To reverse + them as well, pass ``true`` as an argument to the ``reverse`` filter: + + .. code-block:: twig + + {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse %} + {{ key }}: {{ value }} + {%- endfor %} + + {# output: 0: c 1: b 2: a #} + + {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse(true) %} + {{ key }}: {{ value }} + {%- endfor %} + + {# output: 3: c 2: b 1: a #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +Arguments +--------- + +* ``preserve_keys``: Preserve keys when reversing a mapping or a sequence. + +.. _`Traversable`: https://secure.php.net/Traversable diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/round.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/round.rst new file mode 100644 index 0000000..590c71f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/round.rst @@ -0,0 +1,37 @@ +``round`` +========= + +.. versionadded:: 1.15.0 + The ``round`` filter was added in Twig 1.15.0. + +The ``round`` filter rounds a number to a given precision: + +.. code-block:: twig + + {{ 42.55|round }} + {# outputs 43 #} + + {{ 42.55|round(1, 'floor') }} + {# outputs 42.5 #} + +The ``round`` filter takes two optional arguments; the first one specifies the +precision (default is ``0``) and the second the rounding method (default is +``common``): + +* ``common`` rounds either up or down (rounds the value up to precision decimal + places away from zero, when it is half way there -- making 1.5 into 2 and + -1.5 into -2); + +* ``ceil`` always rounds up; + +* ``floor`` always rounds down. + +.. note:: + + The ``//`` operator is equivalent to ``|round(0, 'floor')``. + +Arguments +--------- + +* ``precision``: The rounding precision +* ``method``: The rounding method diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/slice.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/slice.rst new file mode 100644 index 0000000..9a3ca36 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/slice.rst @@ -0,0 +1,71 @@ +``slice`` +=========== + +.. versionadded:: 1.6 + The ``slice`` filter was added in Twig 1.6. + +The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: + +.. code-block:: twig + + {% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} + {# will iterate over 2 and 3 #} + {% endfor %} + + {{ '12345'|slice(1, 2) }} + + {# outputs 23 #} + +You can use any valid expression for both the start and the length: + +.. code-block:: twig + + {% for i in [1, 2, 3, 4, 5]|slice(start, length) %} + {# ... #} + {% endfor %} + +As syntactic sugar, you can also use the ``[]`` notation: + +.. code-block:: twig + + {% for i in [1, 2, 3, 4, 5][start:length] %} + {# ... #} + {% endfor %} + + {{ '12345'[1:2] }} {# will display "23" #} + + {# you can omit the first argument -- which is the same as 0 #} + {{ '12345'[:2] }} {# will display "12" #} + + {# you can omit the last argument -- which will select everything till the end #} + {{ '12345'[2:] }} {# will display "345" #} + +The ``slice`` filter works as the `array_slice`_ PHP function for arrays and +`mb_substr`_ for strings with a fallback to `substr`_. + +If the start is non-negative, the sequence will start at that start in the +variable. If start is negative, the sequence will start that far from the end +of the variable. + +If length is given and is positive, then the sequence will have up to that +many elements in it. If the variable is shorter than the length, then only the +available variable elements will be present. If length is given and is +negative then the sequence will stop that many elements from the end of the +variable. If it is omitted, then the sequence will have everything from offset +up until the end of the variable. + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +Arguments +--------- + +* ``start``: The start of the slice +* ``length``: The size of the slice +* ``preserve_keys``: Whether to preserve key or not (when the input is an array) + +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php +.. _`array_slice`: https://secure.php.net/array_slice +.. _`mb_substr` : https://secure.php.net/mb-substr +.. _`substr`: https://secure.php.net/substr diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/sort.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/sort.rst new file mode 100644 index 0000000..f7c0329 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/sort.rst @@ -0,0 +1,18 @@ +``sort`` +======== + +The ``sort`` filter sorts an array: + +.. code-block:: twig + + {% for user in users|sort %} + ... + {% endfor %} + +.. note:: + + Internally, Twig uses the PHP `asort`_ function to maintain index + association. It supports Traversable objects by transforming + those to arrays. + +.. _`asort`: https://secure.php.net/asort diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/spaceless.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/spaceless.rst new file mode 100644 index 0000000..bfc547e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/spaceless.rst @@ -0,0 +1,65 @@ +``spaceless`` +============= + +.. versionadded:: 1.38 + + The ``spaceless`` filter was added in Twig 1.38. + +Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: twig + + {{ + "
+ foo +
+ "|spaceless }} + + {# output will be
foo
#} + +You can combine ``spaceless`` with the ``apply`` tag to apply the transformation +on large amounts of HTML: + +.. code-block:: twig + + {% apply spaceless %} +
+ foo +
+ {% endapply %} + + {# output will be
foo
#} + +.. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + +This tag is not meant to "optimize" the size of the generated HTML content but +merely to avoid extra whitespace between HTML tags to avoid browser rendering +quirks under some circumstances. + +.. caution:: + + As the filter uses a regular expression behind the scenes, its performance + is directly related to the text size you are working on (remember that + filters are executed at runtime). + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :ref:`dedicated section ` of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/split.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/split.rst new file mode 100644 index 0000000..92eedff --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/split.rst @@ -0,0 +1,53 @@ +``split`` +========= + +.. versionadded:: 1.10.3 + The ``split`` filter was added in Twig 1.10.3. + +The ``split`` filter splits a string by the given delimiter and returns a list +of strings: + +.. code-block:: twig + + {% set foo = "one,two,three"|split(',') %} + {# foo contains ['one', 'two', 'three'] #} + +You can also pass a ``limit`` argument: + +* If ``limit`` is positive, the returned array will contain a maximum of + limit elements with the last element containing the rest of string; + +* If ``limit`` is negative, all components except the last -limit are + returned; + +* If ``limit`` is zero, then this is treated as 1. + +.. code-block:: twig + + {% set foo = "one,two,three,four,five"|split(',', 3) %} + {# foo contains ['one', 'two', 'three,four,five'] #} + +If the ``delimiter`` is an empty string, then value will be split by equal +chunks. Length is set by the ``limit`` argument (one character by default). + +.. code-block:: twig + + {% set foo = "123"|split('') %} + {# foo contains ['1', '2', '3'] #} + + {% set bar = "aabbcc"|split('', 2) %} + {# bar contains ['aa', 'bb', 'cc'] #} + +.. note:: + + Internally, Twig uses the PHP `explode`_ or `str_split`_ (if delimiter is + empty) functions for string splitting. + +Arguments +--------- + +* ``delimiter``: The delimiter +* ``limit``: The limit argument + +.. _`explode`: https://secure.php.net/explode +.. _`str_split`: https://secure.php.net/str_split diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/striptags.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/striptags.rst new file mode 100644 index 0000000..62b2a7b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/striptags.rst @@ -0,0 +1,29 @@ +``striptags`` +============= + +The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace +by one space: + +.. code-block:: twig + + {{ some_html|striptags }} + +You can also provide tags which should not be stripped: + +.. code-block:: twig + + {{ some_html|striptags('

') }} + +In this example, the ``
``, ``
``, ``

``, and ``

`` tags won't be +removed from the string. + +.. note:: + + Internally, Twig uses the PHP `strip_tags`_ function. + +Arguments +--------- + +* ``allowable_tags``: Tags which should not be stripped + +.. _`strip_tags`: https://secure.php.net/strip_tags diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/title.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/title.rst new file mode 100644 index 0000000..dd0311c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/title.rst @@ -0,0 +1,11 @@ +``title`` +========= + +The ``title`` filter returns a titlecased version of the value. Words will +start with uppercase letters, all remaining characters are lowercase: + +.. code-block:: twig + + {{ 'my first car'|title }} + + {# outputs 'My First Car' #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/trim.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/trim.rst new file mode 100644 index 0000000..96ce403 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/trim.rst @@ -0,0 +1,45 @@ +``trim`` +======== + +.. versionadded:: 1.32 + The ``side`` argument was added in Twig 1.32. + +.. versionadded:: 1.6.2 + The ``trim`` filter was added in Twig 1.6.2. + +The ``trim`` filter strips whitespace (or other characters) from the beginning +and end of a string: + +.. code-block:: twig + + {{ ' I like Twig. '|trim }} + + {# outputs 'I like Twig.' #} + + {{ ' I like Twig.'|trim('.') }} + + {# outputs ' I like Twig' #} + + {{ ' I like Twig. '|trim(side='left') }} + + {# outputs 'I like Twig. ' #} + + {{ ' I like Twig. '|trim(' ', 'right') }} + + {# outputs ' I like Twig.' #} + +.. note:: + + Internally, Twig uses the PHP `trim`_, `ltrim`_, and `rtrim`_ functions. + +Arguments +--------- + +* ``character_mask``: The characters to strip + +* ``side``: The default is to strip from the left and the right (`both`) sides, but `left` + and `right` will strip from either the left side or right side only + +.. _`trim`: https://secure.php.net/trim +.. _`ltrim`: https://secure.php.net/ltrim +.. _`rtrim`: https://secure.php.net/rtrim diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/upper.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/upper.rst new file mode 100644 index 0000000..01c9fbb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/upper.rst @@ -0,0 +1,10 @@ +``upper`` +========= + +The ``upper`` filter converts a value to uppercase: + +.. code-block:: twig + + {{ 'welcome'|upper }} + + {# outputs 'WELCOME' #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/url_encode.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/url_encode.rst new file mode 100644 index 0000000..df2c1f0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/filters/url_encode.rst @@ -0,0 +1,34 @@ +``url_encode`` +============== + +.. versionadded:: 1.12.3 + Support for encoding an array as query string was added in Twig 1.12.3. + +.. versionadded:: 1.16.0 + The ``raw`` argument was removed in Twig 1.16.0. Twig now always encodes + according to RFC 3986. + +The ``url_encode`` filter percent encodes a given string as URL segment +or an array as query string: + +.. code-block:: twig + + {{ "path-seg*ment"|url_encode }} + {# outputs "path-seg%2Ament" #} + + {{ "string with spaces"|url_encode }} + {# outputs "string%20with%20spaces" #} + + {{ {'param': 'value', 'foo': 'bar'}|url_encode }} + {# outputs "param=value&foo=bar" #} + +.. note:: + + Internally, Twig uses the PHP `urlencode`_ (or `rawurlencode`_ if you pass + ``true`` as the first parameter) or the `http_build_query`_ function. Note + that as of Twig 1.16.0, ``urlencode`` **always** uses ``rawurlencode`` (the + ``raw`` argument was removed.) + +.. _`urlencode`: https://secure.php.net/urlencode +.. _`rawurlencode`: https://secure.php.net/rawurlencode +.. _`http_build_query`: https://secure.php.net/http_build_query diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/attribute.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/attribute.rst new file mode 100644 index 0000000..99c08d8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/attribute.rst @@ -0,0 +1,26 @@ +``attribute`` +============= + +.. versionadded:: 1.2 + The ``attribute`` function was added in Twig 1.2. + +The ``attribute`` function can be used to access a "dynamic" attribute of a +variable: + +.. code-block:: twig + + {{ attribute(object, method) }} + {{ attribute(object, method, arguments) }} + {{ attribute(array, item) }} + +In addition, the ``defined`` test can check for the existence of a dynamic +attribute: + +.. code-block:: twig + + {{ attribute(object, method) is defined ? 'Method exists' : 'Method does not exist' }} + +.. note:: + + The resolution algorithm is the same as the one used for the ``.`` + notation, except that the item can be any valid expression. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/block.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/block.rst new file mode 100644 index 0000000..c626148 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/block.rst @@ -0,0 +1,41 @@ +``block`` +========= + +.. versionadded: 1.28 + Using ``block`` with the ``defined`` test was added in Twig 1.28. + +.. versionadded: 1.28 + Support for the template argument was added in Twig 1.28. + +When a template uses inheritance and if you want to print a block multiple +times, use the ``block`` function: + +.. code-block:: twig + + {% block title %}{% endblock %} + +

{{ block('title') }}

+ + {% block body %}{% endblock %} + +The ``block`` function can also be used to display one block from another +template: + +.. code-block:: twig + + {{ block("title", "common_blocks.twig") }} + +Use the ``defined`` test to check if a block exists in the context of the +current template: + +.. code-block:: twig + + {% if block("footer") is defined %} + ... + {% endif %} + + {% if block("footer", "common_blocks.twig") is defined %} + ... + {% endif %} + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/constant.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/constant.rst new file mode 100644 index 0000000..f9d836c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/constant.rst @@ -0,0 +1,29 @@ +``constant`` +============ + +.. versionadded: 1.12.1 + constant now accepts object instances as the second argument. + +.. versionadded: 1.28 + Using ``constant`` with the ``defined`` test was added in Twig 1.28. + +``constant`` returns the constant value for a given string: + +.. code-block:: twig + + {{ some_date|date(constant('DATE_W3C')) }} + {{ constant('Namespace\\Classname::CONSTANT_NAME') }} + +As of 1.12.1 you can read constants from object instances as well: + +.. code-block:: twig + + {{ constant('RSS', date) }} + +Use the ``defined`` test to check if a constant is defined: + +.. code-block:: twig + + {% if constant('SOME_CONST') is defined %} + ... + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/cycle.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/cycle.rst new file mode 100644 index 0000000..84cff6a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/cycle.rst @@ -0,0 +1,28 @@ +``cycle`` +========= + +The ``cycle`` function cycles on an array of values: + +.. code-block:: twig + + {% set start_year = date() | date('Y') %} + {% set end_year = start_year + 5 %} + + {% for year in start_year..end_year %} + {{ cycle(['odd', 'even'], loop.index0) }} + {% endfor %} + +The array can contain any number of values: + +.. code-block:: twig + + {% set fruits = ['apple', 'orange', 'citrus'] %} + + {% for i in 0..10 %} + {{ cycle(fruits, i) }} + {% endfor %} + +Arguments +--------- + +* ``position``: The cycle position diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/date.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/date.rst new file mode 100644 index 0000000..b88f669 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/date.rst @@ -0,0 +1,55 @@ +``date`` +======== + +.. versionadded:: 1.6 + The date function has been added in Twig 1.6. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +Converts an argument to a date to allow date comparison: + +.. code-block:: twig + + {% if date(user.created_at) < date('-2days') %} + {# do something #} + {% endif %} + +The argument must be in one of PHP’s supported `date and time formats`_. + +You can pass a timezone as the second argument: + +.. code-block:: twig + + {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} + {# do something #} + {% endif %} + +If no argument is passed, the function returns the current date: + +.. code-block:: twig + + {% if date(user.created_at) < date() %} + {# always! #} + {% endif %} + +.. note:: + + You can set the default timezone globally by calling ``setTimezone()`` on + the ``core`` extension instance: + + .. code-block:: php + + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setTimezone('Europe/Paris'); + + // before Twig 1.26 + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +Arguments +--------- + +* ``date``: The date +* ``timezone``: The timezone + +.. _`date and time formats`: https://secure.php.net/manual/en/datetime.formats.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/dump.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/dump.rst new file mode 100644 index 0000000..b7c01e7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/dump.rst @@ -0,0 +1,69 @@ +``dump`` +======== + +.. versionadded:: 1.5 + The ``dump`` function was added in Twig 1.5. + +The ``dump`` function dumps information about a template variable. This is +mostly useful to debug a template that does not behave as expected by +introspecting its variables: + +.. code-block:: twig + + {{ dump(user) }} + +.. note:: + + The ``dump`` function is not available by default. You must add the + ``\Twig\Extension\DebugExtension`` extension explicitly when creating your Twig + environment:: + + $twig = new \Twig\Environment($loader, [ + 'debug' => true, + // ... + ]); + $twig->addExtension(new \Twig\Extension\DebugExtension()); + + Even when enabled, the ``dump`` function won't display anything if the + ``debug`` option on the environment is not enabled (to avoid leaking debug + information on a production server). + +In an HTML context, wrap the output with a ``pre`` tag to make it easier to +read: + +.. code-block:: twig + +
+        {{ dump(user) }}
+    
+ +.. tip:: + + Using a ``pre`` tag is not needed when `XDebug`_ is enabled and + ``html_errors`` is ``on``; as a bonus, the output is also nicer with + XDebug enabled. + +You can debug several variables by passing them as additional arguments: + +.. code-block:: twig + + {{ dump(user, categories) }} + +If you don't pass any value, all variables from the current context are +dumped: + +.. code-block:: twig + + {{ dump() }} + +.. note:: + + Internally, Twig uses the PHP `var_dump`_ function. + +Arguments +--------- + +* ``context``: The context to dump + +.. _`XDebug`: https://xdebug.org/docs/display +.. _`var_dump`: https://secure.php.net/var_dump diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/include.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/include.rst new file mode 100644 index 0000000..8af4790 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/include.rst @@ -0,0 +1,84 @@ +``include`` +=========== + +.. versionadded:: 1.12 + The ``include`` function was added in Twig 1.12. + +The ``include`` function returns the rendered content of a template: + +.. code-block:: twig + + {{ include('template.html') }} + {{ include(some_var) }} + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +The context is passed by default to the template but you can also pass +additional variables: + +.. code-block:: twig + + {# template.html will have access to the variables from the current context and the additional ones provided #} + {{ include('template.html', {foo: 'bar'}) }} + +You can disable access to the context by setting ``with_context`` to +``false``: + +.. code-block:: twig + + {# only the foo variable will be accessible #} + {{ include('template.html', {foo: 'bar'}, with_context = false) }} + +.. code-block:: twig + + {# no variables will be accessible #} + {{ include('template.html', with_context = false) }} + +And if the expression evaluates to a ``\Twig\Template`` or a +``\Twig\TemplateWrapper`` instance, Twig will use it directly:: + + // {{ include(template) }} + + // deprecated as of Twig 1.28 + $template = $twig->loadTemplate('some_template.twig'); + + // as of Twig 1.28 + $template = $twig->load('some_template.twig'); + + $twig->display('template.twig', ['template' => $template]); + +When you set the ``ignore_missing`` flag, Twig will return an empty string if +the template does not exist: + +.. code-block:: twig + + {{ include('sidebar.html', ignore_missing = true) }} + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be rendered: + +.. code-block:: twig + + {{ include(['page_detailed.html', 'page.html']) }} + +If ``ignore_missing`` is set, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. + +When including a template created by an end user, you should consider +sandboxing it: + +.. code-block:: twig + + {{ include('page.html', sandboxed = true) }} + +Arguments +--------- + +* ``template``: The template to render +* ``variables``: The variables to pass to the template +* ``with_context``: Whether to pass the current context variables or not +* ``ignore_missing``: Whether to ignore missing templates or not +* ``sandboxed``: Whether to sandbox the template or not diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/index.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/index.rst new file mode 100644 index 0000000..07214a7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/index.rst @@ -0,0 +1,20 @@ +Functions +========= + +.. toctree:: + :maxdepth: 1 + + attribute + block + constant + cycle + date + dump + include + max + min + parent + random + range + source + template_from_string diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/max.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/max.rst new file mode 100644 index 0000000..f271e66 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/max.rst @@ -0,0 +1,20 @@ +``max`` +======= + +.. versionadded:: 1.15 + The ``max`` function was added in Twig 1.15. + +``max`` returns the biggest value of a sequence or a set of values: + +.. code-block:: twig + + {{ max(1, 3, 2) }} + {{ max([1, 3, 2]) }} + +When called with a mapping, max ignores keys and only compares values: + +.. code-block:: twig + + {{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }} + {# returns "e" #} + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/min.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/min.rst new file mode 100644 index 0000000..362b0f9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/min.rst @@ -0,0 +1,20 @@ +``min`` +======= + +.. versionadded:: 1.15 + The ``min`` function was added in Twig 1.15. + +``min`` returns the lowest value of a sequence or a set of values: + +.. code-block:: twig + + {{ min(1, 3, 2) }} + {{ min([1, 3, 2]) }} + +When called with a mapping, min ignores keys and only compares values: + +.. code-block:: twig + + {{ min({2: "e", 3: "a", 1: "b", 5: "d", 4: "c"}) }} + {# returns "a" #} + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/parent.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/parent.rst new file mode 100644 index 0000000..9beb5d2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/parent.rst @@ -0,0 +1,20 @@ +``parent`` +========== + +When a template uses inheritance, it's possible to render the contents of the +parent block when overriding a block by using the ``parent`` function: + +.. code-block:: twig + + {% extends "base.html" %} + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +The ``parent()`` call will return the content of the ``sidebar`` block as +defined in the ``base.html`` template. + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/random.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/random.rst new file mode 100644 index 0000000..45e6fa7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/random.rst @@ -0,0 +1,36 @@ +``random`` +========== + +.. versionadded:: 1.5 + The ``random`` function was added in Twig 1.5. + +.. versionadded:: 1.6 + String and integer handling was added in Twig 1.6. + +.. versionadded:: 1.38 + The "max" argument was added in Twig 1.38. + +The ``random`` function returns a random value depending on the supplied +parameter type: + +* a random item from a sequence; +* a random character from a string; +* a random integer between 0 and the integer parameter (inclusive). +* a random integer between the integer parameter (when negative) and 0 (inclusive). +* a random integer between the first integer and the second integer parameter (inclusive). + +.. code-block:: twig + + {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} + {{ random('ABC') }} {# example output: C #} + {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} + {{ random(5) }} {# example output: 3 #} + {{ random(50, 100) }} {# example output: 63 #} + +Arguments +--------- + +* ``values``: The values +* ``max``: The max value when values is an integer + +.. _`mt_rand`: https://secure.php.net/mt_rand diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/range.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/range.rst new file mode 100644 index 0000000..a1f0e7c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/range.rst @@ -0,0 +1,58 @@ +``range`` +========= + +Returns a list containing an arithmetic progression of integers: + +.. code-block:: twig + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + + {# outputs 0, 1, 2, 3, #} + +When step is given (as the third parameter), it specifies the increment (or +decrement for negative values): + +.. code-block:: twig + + {% for i in range(0, 6, 2) %} + {{ i }}, + {% endfor %} + + {# outputs 0, 2, 4, 6, #} + +.. note:: + + Note that if the start is greater than the end, ``range`` assumes a step of + ``-1``: + + .. code-block:: twig + + {% for i in range(3, 0) %} + {{ i }}, + {% endfor %} + + {# outputs 3, 2, 1, 0, #} + +The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` +function (with a step of ``1``, or ``-1`` if the start is greater than the end): + +.. code-block:: twig + + {% for i in 0..3 %} + {{ i }}, + {% endfor %} + +.. tip:: + + The ``range`` function works as the native PHP `range`_ function. + +Arguments +--------- + +* ``low``: The first value of the sequence. +* ``high``: The highest possible value of the sequence. +* ``step``: The increment between elements of the sequence. + +.. _`range`: https://secure.php.net/range diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/source.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/source.rst new file mode 100644 index 0000000..571fea2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/source.rst @@ -0,0 +1,32 @@ +``source`` +========== + +.. versionadded:: 1.15 + The ``source`` function was added in Twig 1.15. + +.. versionadded:: 1.18.3 + The ``ignore_missing`` flag was added in Twig 1.18.3. + +The ``source`` function returns the content of a template without rendering it: + +.. code-block:: twig + + {{ source('template.html') }} + {{ source(some_var) }} + +When you set the ``ignore_missing`` flag, Twig will return an empty string if +the template does not exist: + +.. code-block:: twig + + {{ source('template.html', ignore_missing = true) }} + +The function uses the same template loaders as the ones used to include +templates. So, if you are using the filesystem loader, the templates are looked +for in the paths defined by it. + +Arguments +--------- + +* ``name``: The name of the template to read +* ``ignore_missing``: Whether to ignore missing templates or not diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/template_from_string.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/template_from_string.rst new file mode 100644 index 0000000..b26f566 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/functions/template_from_string.rst @@ -0,0 +1,43 @@ +``template_from_string`` +======================== + +.. versionadded:: 1.11 + The ``template_from_string`` function was added in Twig 1.11. + +.. versionadded:: 1.39 + The name argument was added in Twig 1.39. + +The ``template_from_string`` function loads a template from a string: + +.. code-block:: twig + + {{ include(template_from_string("Hello {{ name }}")) }} + {{ include(template_from_string(page.template)) }} + +To ease debugging, you can also give the template a name that will be part of +any related error message: + +.. code-block:: twig + + {{ include(template_from_string(page.template, "template for page " ~ page.name)) }} + +.. note:: + + The ``template_from_string`` function is not available by default. You + must add the ``\Twig\Extension\StringLoaderExtension`` extension explicitly when + creating your Twig environment:: + + $twig = new \Twig\Environment(...); + $twig->addExtension(new \Twig\Extension\StringLoaderExtension()); + +.. note:: + + Even if you will probably always use the ``template_from_string`` function + with the ``include`` function, you can use it with any tag or function that + takes a template as an argument (like the ``embed`` or ``extends`` tags). + +Arguments +--------- + +* ``template``: The template +* ``name``: A name for the template diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/index.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/index.rst new file mode 100644 index 0000000..358bd73 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/index.rst @@ -0,0 +1,19 @@ +Twig +==== + +.. toctree:: + :maxdepth: 2 + + intro + installation + templates + api + advanced + internals + deprecated + recipes + coding_standards + tags/index + filters/index + functions/index + tests/index diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/installation.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/installation.rst new file mode 100644 index 0000000..362d317 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/installation.rst @@ -0,0 +1,73 @@ +Installation +============ + +You have multiple ways to install Twig. + +Installing the Twig PHP package +------------------------------- + +Install `Composer`_ and run the following command: + +.. code-block:: bash + + composer require "twig/twig:^1.0" + +Installing the C extension +-------------------------- + +.. versionadded:: 1.4 + The C extension was added in Twig 1.4. + +Twig comes with an **optional** C extension that improves the performance of the +Twig runtime engine. + +Note that this extension does not replace the PHP code but only provides an +optimized version of the ``\Twig\Template::getAttribute()`` method; you must +still install the regular PHP code + +The C extension is only compatible and useful for **PHP5**. + +Install it like any other PHP extensions: + +.. code-block:: bash + + cd ext/twig + phpize + ./configure + make + make install + +For Windows: + +1. Setup the build environment following the `PHP documentation`_ +2. Put Twig's C extension source code into ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\ext\twig`` +3. Use the ``configure --disable-all --enable-cli --enable-twig=shared`` command instead of step 14 +4. ``nmake`` +5. Copy the ``C:\php-sdk\phpdev\vcXX\x86\php-source-directory\Release_TS\php_twig.dll`` file to your PHP setup. + +.. tip:: + + For Windows ZendServer, ZTS is not enabled as mentioned in `Zend Server + FAQ`_. + + You have to use ``configure --disable-all --disable-zts --enable-cli + --enable-twig=shared`` to be able to build the twig C extension for + ZendServer. + + The built DLL will be available in + ``C:\\php-sdk\\phpdev\\vcXX\\x86\\php-source-directory\\Release`` + +Finally, enable the extension in your ``php.ini`` configuration file: + +.. code-block:: ini + + extension=twig.so # For Unix systems + extension=php_twig.dll # For Windows systems + +And from now on, Twig will automatically compile your templates to take +advantage of the C extension. + +.. _`download page`: https://github.com/twigphp/Twig/tags +.. _`Composer`: https://getcomposer.org/download/ +.. _`PHP documentation`: https://wiki.php.net/internals/windows/stepbystepbuild +.. _`Zend Server FAQ`: https://www.zend.com/en/products/server/faq#faqD6 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/internals.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/internals.rst new file mode 100644 index 0000000..4b1a1ab --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/internals.rst @@ -0,0 +1,144 @@ +Twig Internals +============== + +Twig is very extensible and you can easily hack it. Keep in mind that you +should probably try to create an extension before hacking the core, as most +features and enhancements can be handled with extensions. This chapter is also +useful for people who want to understand how Twig works under the hood. + +How does Twig work? +------------------- + +The rendering of a Twig template can be summarized into four key steps: + +* **Load** the template: If the template is already compiled, load it and go + to the *evaluation* step, otherwise: + + * First, the **lexer** tokenizes the template source code into small pieces + for easier processing; + + * Then, the **parser** converts the token stream into a meaningful tree + of nodes (the Abstract Syntax Tree); + + * Finally, the *compiler* transforms the AST into PHP code. + +* **Evaluate** the template: It means calling the ``display()`` + method of the compiled template and passing it the context. + +The Lexer +--------- + +The lexer tokenizes a template source code into a token stream (each token is +an instance of ``\Twig\Token``, and the stream is an instance of +``\Twig\TokenStream``). The default lexer recognizes 13 different token types: + +* ``\Twig\Token::BLOCK_START_TYPE``, ``\Twig\Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) +* ``\Twig\Token::VAR_START_TYPE``, ``\Twig\Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) +* ``\Twig\Token::TEXT_TYPE``: A text outside an expression; +* ``\Twig\Token::NAME_TYPE``: A name in an expression; +* ``\Twig\Token::NUMBER_TYPE``: A number in an expression; +* ``\Twig\Token::STRING_TYPE``: A string in an expression; +* ``\Twig\Token::OPERATOR_TYPE``: An operator; +* ``\Twig\Token::PUNCTUATION_TYPE``: A punctuation sign; +* ``\Twig\Token::INTERPOLATION_START_TYPE``, ``\Twig\Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; +* ``\Twig\Token::EOF_TYPE``: Ends of template. + +You can manually convert a source code into a token stream by calling the +``tokenize()`` method of an environment:: + + $stream = $twig->tokenize(new \Twig\Source($source, $identifier)); + +.. versionadded:: 1.27 + ``\Twig\Source`` was introduced in version 1.27, pass the source and the + identifier directly on previous versions. + +As the stream has a ``__toString()`` method, you can have a textual +representation of it by echoing the object:: + + echo $stream."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + TEXT_TYPE(Hello ) + VAR_START_TYPE() + NAME_TYPE(name) + VAR_END_TYPE() + EOF_TYPE() + +.. note:: + + The default lexer (``\Twig\Lexer``) can be changed by calling + the ``setLexer()`` method:: + + $twig->setLexer($lexer); + +The Parser +---------- + +The parser converts the token stream into an AST (Abstract Syntax Tree), or a +node tree (an instance of ``\Twig\Node\ModuleNode``). The core extension defines +the basic nodes like: ``for``, ``if``, ... and the expression nodes. + +You can manually convert a token stream into a node tree by calling the +``parse()`` method of an environment:: + + $nodes = $twig->parse($stream); + +Echoing the node object gives you a nice representation of the tree:: + + echo $nodes."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + \Twig\Node\ModuleNode( + \Twig\Node\TextNode(Hello ) + \Twig\Node\PrintNode( + \Twig\Node\Expression\NameExpression(name) + ) + ) + +.. note:: + + The default parser (``\Twig\TokenParser\AbstractTokenParser``) can be changed by calling the + ``setParser()`` method:: + + $twig->setParser($parser); + +The Compiler +------------ + +The last step is done by the compiler. It takes a node tree as an input and +generates PHP code usable for runtime execution of the template. + +You can manually compile a node tree to PHP code with the ``compile()`` method +of an environment:: + + $php = $twig->compile($nodes); + +The generated template for a ``Hello {{ name }}`` template reads as follows +(the actual output can differ depending on the version of Twig you are +using):: + + /* Hello {{ name }} */ + class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends \Twig\Template + { + protected function doDisplay(array $context, array $blocks = []) + { + // line 1 + echo "Hello "; + echo twig_escape_filter($this->env, (isset($context["name"]) ? $context["name"] : null), "html", null, true); + } + + // some more code + } + +.. note:: + + The default compiler (``\Twig\Compiler``) can be changed by calling the + ``setCompiler()`` method:: + + $twig->setCompiler($compiler); diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/intro.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/intro.rst new file mode 100644 index 0000000..d1f9c59 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/intro.rst @@ -0,0 +1,76 @@ +Introduction +============ + +Welcome to the documentation for Twig, the flexible, fast, and secure template +engine for PHP. + +Twig is both designer and developer friendly by sticking to PHP's principles and +adding functionality useful for templating environments. + +The key-features are... + +* *Fast*: Twig compiles templates down to plain optimized PHP code. The + overhead compared to regular PHP code was reduced to the very minimum. + +* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This + allows Twig to be used as a template language for applications where users + may modify the template design. + +* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the + developer to define their own custom tags and filters, and to create their own DSL. + +Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, +phpBB, Matomo, OroCRM; and many frameworks have support for it as well like +Slim, Yii, Laravel, and Codeigniter — just to name a few. + +Prerequisites +------------- + +Twig needs at least **PHP 5.4.0** to run. + +Installation +------------ + +The recommended way to install Twig is via Composer: + +.. code-block:: bash + + composer require "twig/twig:^1.0" + +.. note:: + + To learn more about the other installation methods, read the + :doc:`installation` chapter; it also explains how to install + the Twig C extension. + +Basic API Usage +--------------- + +This section gives you a brief introduction to the PHP API for Twig. + +.. code-block:: php + + require_once '/path/to/vendor/autoload.php'; + + $loader = new \Twig\Loader\ArrayLoader([ + 'index' => 'Hello {{ name }}!', + ]); + $twig = new \Twig\Environment($loader); + + echo $twig->render('index', ['name' => 'Fabien']); + +Twig uses a loader (``\Twig\Loader\ArrayLoader``) to locate templates, and an +environment (``\Twig\Environment``) to store its configuration. + +The ``render()`` method loads the template passed as a first argument and +renders it with the variables passed as a second argument. + +As templates are generally stored on the filesystem, Twig also comes with a +filesystem loader:: + + $loader = new \Twig\Loader\FilesystemLoader('/path/to/templates'); + $twig = new \Twig\Environment($loader, [ + 'cache' => '/path/to/compilation_cache', + ]); + + echo $twig->render('index.html', ['name' => 'Fabien']); diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/recipes.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/recipes.rst new file mode 100644 index 0000000..a8238b5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/recipes.rst @@ -0,0 +1,568 @@ +Recipes +======= + +.. _deprecation-notices: + +Displaying Deprecation Notices +------------------------------ + +.. versionadded:: 1.21 + This works as of Twig 1.21. + +Deprecated features generate deprecation notices (via a call to the +``trigger_error()`` PHP function). By default, they are silenced and never +displayed nor logged. + +To remove all deprecated feature usages from your templates, write and run a +script along the lines of the following:: + + require_once __DIR__.'/vendor/autoload.php'; + + $twig = create_your_twig_env(); + + $deprecations = new \Twig\Util\DeprecationCollector($twig); + + print_r($deprecations->collectDir(__DIR__.'/templates')); + +The ``collectDir()`` method compiles all templates found in a directory, +catches deprecation notices, and return them. + +.. tip:: + + If your templates are not stored on the filesystem, use the ``collect()`` + method instead. ``collect()`` takes a ``Traversable`` which must return + template names as keys and template contents as values (as done by + ``\Twig\Util\TemplateDirIterator``). + +However, this code won't find all deprecations (like using deprecated some Twig +classes). To catch all notices, register a custom error handler like the one +below:: + + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { + if (E_USER_DEPRECATED === $type) { + $deprecations[] = $msg; + } + }); + + // run your application + + print_r($deprecations); + +Note that most deprecation notices are triggered during **compilation**, so +they won't be generated when templates are already cached. + +.. tip:: + + If you want to manage the deprecation notices from your PHPUnit tests, have + a look at the `symfony/phpunit-bridge + `_ package, which eases the + process. + +Making a Layout conditional +--------------------------- + +Working with Ajax means that the same content is sometimes displayed as is, +and sometimes decorated with a layout. As Twig layout template names can be +any valid expression, you can pass a variable that evaluates to ``true`` when +the request is made via Ajax and choose the layout accordingly: + +.. code-block:: twig + + {% extends request.ajax ? "base_ajax.html" : "base.html" %} + + {% block content %} + This is the content to be displayed. + {% endblock %} + +Making an Include dynamic +------------------------- + +When including a template, its name does not need to be a string. For +instance, the name can depend on the value of a variable: + +.. code-block:: twig + + {% include var ~ '_foo.html' %} + +If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be +rendered. + +As a matter of fact, the template name can be any valid expression, such as +the following: + +.. code-block:: twig + + {% include var|default('index') ~ '_foo.html' %} + +Overriding a Template that also extends itself +---------------------------------------------- + +A template can be customized in two different ways: + +* *Inheritance*: A template *extends* a parent template and overrides some + blocks; + +* *Replacement*: If you use the filesystem loader, Twig loads the first + template it finds in a list of configured directories; a template found in a + directory *replaces* another one from a directory further in the list. + +But how do you combine both: *replace* a template that also extends itself +(aka a template in a directory further in the list)? + +Let's say that your templates are loaded from both ``.../templates/mysite`` +and ``.../templates/default`` in this order. The ``page.twig`` template, +stored in ``.../templates/default`` reads as follows: + +.. code-block:: twig + + {# page.twig #} + {% extends "layout.twig" %} + + {% block content %} + {% endblock %} + +You can replace this template by putting a file with the same name in +``.../templates/mysite``. And if you want to extend the original template, you +might be tempted to write the following: + +.. code-block:: twig + + {# page.twig in .../templates/mysite #} + {% extends "page.twig" %} {# from .../templates/default #} + +Of course, this will not work as Twig will always load the template from +``.../templates/mysite``. + +It turns out it is possible to get this to work, by adding a directory right +at the end of your template directories, which is the parent of all of the +other directories: ``.../templates`` in our case. This has the effect of +making every template file within our system uniquely addressable. Most of the +time you will use the "normal" paths, but in the special case of wanting to +extend a template with an overriding version of itself we can reference its +parent's full, unambiguous template path in the extends tag: + +.. code-block:: twig + + {# page.twig in .../templates/mysite #} + {% extends "default/page.twig" %} {# from .../templates #} + +.. note:: + + This recipe was inspired by the following Django wiki page: + https://code.djangoproject.com/wiki/ExtendingTemplates + +Customizing the Syntax +---------------------- + +Twig allows some syntax customization for the block delimiters. It's **not** +recommended to use this feature as templates will be tied with your custom +syntax. But for specific projects, it can make sense to change the defaults. + +To change the block delimiters, you need to create your own lexer object:: + + $twig = new \Twig\Environment(); + + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['{#', '#}'], + 'tag_block' => ['{%', '%}'], + 'tag_variable' => ['{{', '}}'], + 'interpolation' => ['#{', '}'], + ]); + $twig->setLexer($lexer); + +Here are some configuration example that simulates some other template engines +syntax:: + + // Ruby erb syntax + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['<%#', '%>'], + 'tag_block' => ['<%', '%>'], + 'tag_variable' => ['<%=', '%>'], + ]); + + // SGML Comment Syntax + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => [''], + 'tag_block' => [''], + 'tag_variable' => ['${', '}'], + ]); + + // Smarty like + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['{*', '*}'], + 'tag_block' => ['{', '}'], + 'tag_variable' => ['{$', '}'], + ]); + +Using dynamic Object Properties +------------------------------- + +When Twig encounters a variable like ``article.title``, it tries to find a +``title`` public property in the ``article`` object. + +It also works if the property does not exist but is rather defined dynamically +thanks to the magic ``__get()`` method; you need to also implement the +``__isset()`` magic method like shown in the following snippet of code:: + + class Article + { + public function __get($name) + { + if ('title' == $name) { + return 'The title'; + } + + // throw some kind of error + } + + public function __isset($name) + { + if ('title' == $name) { + return true; + } + + return false; + } + } + +Accessing the parent Context in Nested Loops +-------------------------------------------- + +Sometimes, when using nested loops, you need to access the parent context. The +parent context is always accessible via the ``loop.parent`` variable. For +instance, if you have the following template data:: + + $data = [ + 'topics' => [ + 'topic1' => ['Message 1 of topic 1', 'Message 2 of topic 1'], + 'topic2' => ['Message 1 of topic 2', 'Message 2 of topic 2'], + ], + ]; + +And the following template to display all messages in all topics: + +.. code-block:: twig + + {% for topic, messages in topics %} + * {{ loop.index }}: {{ topic }} + {% for message in messages %} + - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} + {% endfor %} + {% endfor %} + +The output will be similar to: + +.. code-block:: text + + * 1: topic1 + - 1.1: The message 1 of topic 1 + - 1.2: The message 2 of topic 1 + * 2: topic2 + - 2.1: The message 1 of topic 2 + - 2.2: The message 2 of topic 2 + +In the inner loop, the ``loop.parent`` variable is used to access the outer +context. So, the index of the current ``topic`` defined in the outer for loop +is accessible via the ``loop.parent.loop.index`` variable. + +Defining undefined Functions and Filters on the Fly +--------------------------------------------------- + +When a function (or a filter) is not defined, Twig defaults to throw a +``\Twig\Error\SyntaxError`` exception. However, it can also call a `callback`_ (any +valid PHP callable) which should return a function (or a filter). + +For filters, register callbacks with ``registerUndefinedFilterCallback()``. +For functions, use ``registerUndefinedFunctionCallback()``:: + + // auto-register all native PHP functions as Twig functions + // don't try this at home as it's not secure at all! + $twig->registerUndefinedFunctionCallback(function ($name) { + if (function_exists($name)) { + return new \Twig\TwigFunction($name, $name); + } + + return false; + }); + +If the callable is not able to return a valid function (or filter), it must +return ``false``. + +If you register more than one callback, Twig will call them in turn until one +does not return ``false``. + +.. tip:: + + As the resolution of functions and filters is done during compilation, + there is no overhead when registering these callbacks. + +Validating the Template Syntax +------------------------------ + +When template code is provided by a third-party (through a web interface for +instance), it might be interesting to validate the template syntax before +saving it. If the template code is stored in a `$template` variable, here is +how you can do it:: + + try { + $twig->parse($twig->tokenize(new \Twig\Source($template))); + + // the $template is valid + } catch (\Twig\Error\SyntaxError $e) { + // $template contains one or more syntax errors + } + +If you iterate over a set of files, you can pass the filename to the +``tokenize()`` method to get the filename in the exception message:: + + foreach ($files as $file) { + try { + $twig->parse($twig->tokenize(new \Twig\Source($template, $file->getFilename(), $file))); + + // the $template is valid + } catch (\Twig\Error\SyntaxError $e) { + // $template contains one or more syntax errors + } + } + +.. versionadded:: 1.27 + ``\Twig\Source`` was introduced in version 1.27, pass the source and the + identifier directly on previous versions. + +.. note:: + + This method won't catch any sandbox policy violations because the policy + is enforced during template rendering (as Twig needs the context for some + checks like allowed methods on objects). + +Refreshing modified Templates when OPcache or APC is enabled +------------------------------------------------------------ + +When using OPcache with ``opcache.validate_timestamps`` set to ``0`` or APC +with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing the template +cache won't update the cache. + +To get around this, force Twig to invalidate the bytecode cache:: + + $twig = new \Twig\Environment($loader, [ + 'cache' => new \Twig\Cache\FilesystemCache('/some/cache/path', \Twig\Cache\FilesystemCache::FORCE_BYTECODE_INVALIDATION), + // ... + ]); + +.. note:: + + Before Twig 1.22, you should extend ``\Twig\Environment`` instead:: + + class OpCacheAwareTwigEnvironment extends \Twig\Environment + { + protected function writeCacheFile($file, $content) + { + parent::writeCacheFile($file, $content); + + // Compile cached file into bytecode cache + if (function_exists('opcache_invalidate')) { + opcache_invalidate($file, true); + } elseif (function_exists('apc_compile_file')) { + apc_compile_file($file); + } + } + } + +Reusing a stateful Node Visitor +------------------------------- + +When attaching a visitor to a ``\Twig\Environment`` instance, Twig uses it to +visit *all* templates it compiles. If you need to keep some state information +around, you probably want to reset it when visiting a new template. + +This can be easily achieved with the following code:: + + protected $someTemplateState = []; + + public function enterNode(Twig_NodeInterface $node, \Twig\Environment $env) + { + if ($node instanceof \Twig\Node\ModuleNode) { + // reset the state as we are entering a new template + $this->someTemplateState = []; + } + + // ... + + return $node; + } + +Using a Database to store Templates +----------------------------------- + +If you are developing a CMS, templates are usually stored in a database. This +recipe gives you a simple PDO template loader you can use as a starting point +for your own. + +First, let's create a temporary in-memory SQLite3 database to work with:: + + $dbh = new PDO('sqlite::memory:'); + $dbh->exec('CREATE TABLE templates (name STRING, source STRING, last_modified INTEGER)'); + $base = '{% block content %}{% endblock %}'; + $index = ' + {% extends "base.twig" %} + {% block content %}Hello {{ name }}{% endblock %} + '; + $now = time(); + $dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['base.twig', $base, $now]); + $dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['index.twig', $index, $now]); + +We have created a simple ``templates`` table that hosts two templates: +``base.twig`` and ``index.twig``. + +Now, let's define a loader able to use this database:: + + class DatabaseTwigLoader implements \Twig\Loader\LoaderInterface, \Twig\Loader\ExistsLoaderInterface, \Twig\Loader\SourceContextLoaderInterface + { + protected $dbh; + + public function __construct(PDO $dbh) + { + $this->dbh = $dbh; + } + + public function getSource($name) + { + if (false === $source = $this->getValue('source', $name)) { + throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name)); + } + + return $source; + } + + // \Twig\Loader\SourceContextLoaderInterface as of Twig 1.27 + public function getSourceContext($name) + { + if (false === $source = $this->getValue('source', $name)) { + throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name)); + } + + return new \Twig\Source($source, $name); + } + + // \Twig\Loader\ExistsLoaderInterface as of Twig 1.11 + public function exists($name) + { + return $name === $this->getValue('name', $name); + } + + public function getCacheKey($name) + { + return $name; + } + + public function isFresh($name, $time) + { + if (false === $lastModified = $this->getValue('last_modified', $name)) { + return false; + } + + return $lastModified <= $time; + } + + protected function getValue($column, $name) + { + $sth = $this->dbh->prepare('SELECT '.$column.' FROM templates WHERE name = :name'); + $sth->execute([':name' => (string) $name]); + + return $sth->fetchColumn(); + } + } + +Finally, here is an example on how you can use it:: + + $loader = new DatabaseTwigLoader($dbh); + $twig = new \Twig\Environment($loader); + + echo $twig->render('index.twig', ['name' => 'Fabien']); + +Using different Template Sources +-------------------------------- + +This recipe is the continuation of the previous one. Even if you store the +contributed templates in a database, you might want to keep the original/base +templates on the filesystem. When templates can be loaded from different +sources, you need to use the ``\Twig\Loader\ChainLoader`` loader. + +As you can see in the previous recipe, we reference the template in the exact +same way as we would have done it with a regular filesystem loader. This is +the key to be able to mix and match templates coming from the database, the +filesystem, or any other loader for that matter: the template name should be a +logical name, and not the path from the filesystem:: + + $loader1 = new DatabaseTwigLoader($dbh); + $loader2 = new \Twig\Loader\ArrayLoader([ + 'base.twig' => '{% block content %}{% endblock %}', + ]); + $loader = new \Twig\Loader\ChainLoader([$loader1, $loader2]); + + $twig = new \Twig\Environment($loader); + + echo $twig->render('index.twig', ['name' => 'Fabien']); + +Now that the ``base.twig`` templates is defined in an array loader, you can +remove it from the database, and everything else will still work as before. + +Loading a Template from a String +-------------------------------- + +From a template, you can easily load a template stored in a string via the +``template_from_string`` function (available as of Twig 1.11 via the +``\Twig\Extension\StringLoaderExtension`` extension): + +.. code-block:: twig + + {{ include(template_from_string("Hello {{ name }}")) }} + +From PHP, it's also possible to load a template stored in a string via +``\Twig\Environment::createTemplate()`` (available as of Twig 1.18):: + + $template = $twig->createTemplate('hello {{ name }}'); + echo $template->render(['name' => 'Fabien']); + +.. note:: + + Never use the ``Twig_Loader_String`` loader, which has severe limitations. + +Using Twig and AngularJS in the same Templates +---------------------------------------------- + +Mixing different template syntaxes in the same file is not a recommended +practice as both AngularJS and Twig use the same delimiters in their syntax: +``{{`` and ``}}``. + +Still, if you want to use AngularJS and Twig in the same template, there are +two ways to make it work depending on the amount of AngularJS you need to +include in your templates: + +* Escaping the AngularJS delimiters by wrapping AngularJS sections with the + ``{% verbatim %}`` tag or by escaping each delimiter via ``{{ '{{' }}`` and + ``{{ '}}' }}``; + +* Changing the delimiters of one of the template engines (depending on which + engine you introduced last): + + * For AngularJS, change the interpolation tags using the + ``interpolateProvider`` service, for instance at the module initialization + time: + + .. code-block:: javascript + + angular.module('myApp', []).config(function($interpolateProvider) { + $interpolateProvider.startSymbol('{[').endSymbol(']}'); + }); + + * For Twig, change the delimiters via the ``tag_variable`` Lexer option: + + .. code-block:: php + + $env->setLexer(new \Twig\Lexer($env, [ + 'tag_variable' => ['{[', ']}'], + ])); + +.. _callback: https://secure.php.net/manual/en/function.is-callable.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/apply.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/apply.rst new file mode 100644 index 0000000..09bc036 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/apply.rst @@ -0,0 +1,23 @@ +``apply`` +========= + +.. versionadded:: 1.40 + The ``apply`` tag was added in Twig 1.40. + +The ``apply`` tag allows you to apply Twig filters on a block of template data: + +.. code-block:: twig + + {% apply upper %} + This text becomes uppercase + {% endapply %} + +You can also chain filters and pass arguments to them: + +.. code-block:: twig + + {% apply lower|escape('html') %} + SOME TEXT + {% endapply %} + + {# outputs "<strong>some text</strong>" #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/autoescape.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/autoescape.rst new file mode 100644 index 0000000..0fa34bd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/autoescape.rst @@ -0,0 +1,81 @@ +``autoescape`` +============== + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the ``autoescape`` tag: + +.. code-block:: twig + + {% autoescape %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'html' %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'js' %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + +.. note:: + + Before Twig 1.8, the syntax was different: + + .. code-block:: twig + + {% autoescape true %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + + {% autoescape true js %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + +When automatic escaping is enabled everything is escaped by default except for +values explicitly marked as safe. Those can be marked in the template by using +the :doc:`raw<../filters/raw>` filter: + +.. code-block:: twig + + {% autoescape %} + {{ safe_value|raw }} + {% endautoescape %} + +Functions returning template data (like :doc:`macros` and +:doc:`parent<../functions/parent>`) always return safe markup. + +.. note:: + + Twig is smart enough to not escape an already escaped value by the + :doc:`escape<../filters/escape>` filter. + +.. note:: + + Twig does not escape static expressions: + + .. code-block:: twig + + {% set hello = "Hello" %} + {{ hello }} + {{ "world" }} + + Will be rendered "Hello **world**". + +.. note:: + + The chapter :doc:`Twig for Developers<../api>` gives more information + about when and how automatic escaping is applied. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/block.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/block.rst new file mode 100644 index 0000000..e380482 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/block.rst @@ -0,0 +1,11 @@ +``block`` +========= + +Blocks are used for inheritance and act as placeholders and replacements at +the same time. They are documented in detail in the documentation for the +:doc:`extends<../tags/extends>` tag. + +Block names should consist of alphanumeric characters, and underscores. Dashes +are not permitted. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/deprecated.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/deprecated.rst new file mode 100644 index 0000000..95828ac --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/deprecated.rst @@ -0,0 +1,30 @@ +``deprecated`` +============== + +.. versionadded:: 1.36 and 2.6 + The ``deprecated`` tag was added in Twig 1.36 and 2.6. + +Twig generates a deprecation notice (via a call to the ``trigger_error()`` +PHP function) where the ``deprecated`` tag is used in a template: + +.. code-block:: twig + + {# base.twig #} + {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} + {% extends 'layout.twig' %} + +Also you can deprecate a block in the following way: + +.. code-block:: twig + + {% block hey %} + {% deprecated 'The "hey" block is deprecated, use "greet" instead.' %} + {{ block('greet') }} + {% endblock %} + + {% block greet %} + Hey you! + {% endblock %} + +Note that by default, the deprecation notices are silenced and never displayed nor logged. +See :ref:`deprecation-notices` to learn how to handle them. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/do.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/do.rst new file mode 100644 index 0000000..b5e83eb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/do.rst @@ -0,0 +1,12 @@ +``do`` +====== + +.. versionadded:: 1.5 + The ``do`` tag was added in Twig 1.5. + +The ``do`` tag works exactly like the regular variable expression (``{{ ... +}}``) just that it doesn't print anything: + +.. code-block:: twig + + {% do 1 + 2 %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/embed.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/embed.rst new file mode 100644 index 0000000..e2796b2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/embed.rst @@ -0,0 +1,178 @@ +``embed`` +========= + +.. versionadded:: 1.8 + The ``embed`` tag was added in Twig 1.8. + +The ``embed`` tag combines the behaviour of :doc:`include` and +:doc:`extends`. +It allows you to include another template's contents, just like ``include`` +does. But it also allows you to override any block defined inside the +included template, like when extending a template. + +Think of an embedded template as a "micro layout skeleton". + +.. code-block:: twig + + {% embed "teasers_skeleton.twig" %} + {# These blocks are defined in "teasers_skeleton.twig" #} + {# and we override them right here: #} + {% block left_teaser %} + Some content for the left teaser box + {% endblock %} + {% block right_teaser %} + Some content for the right teaser box + {% endblock %} + {% endembed %} + +The ``embed`` tag takes the idea of template inheritance to the level of +content fragments. While template inheritance allows for "document skeletons", +which are filled with life by child templates, the ``embed`` tag allows you to +create "skeletons" for smaller units of content and re-use and fill them +anywhere you like. + +Since the use case may not be obvious, let's look at a simplified example. +Imagine a base template shared by multiple HTML pages, defining a single block +named "content": + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ │ │ + │ │ (child template to │ │ + │ │ put content here) │ │ + │ │ │ │ + │ │ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Some pages ("foo" and "bar") share the same content structure - +two vertically stacked boxes: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ ┌─ block "top" ───┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ │ ┌─ block "bottom" ┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +While other pages ("boom" and "baz") share a different content structure - +two boxes side by side: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ ┌ block ┐ ┌ block ┐ │ │ + │ │ │"left" │ │"right"│ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ └───────┘ └───────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Without the ``embed`` tag, you have two ways to design your templates: + +* Create two "intermediate" base templates that extend the master layout + template: one with vertically stacked boxes to be used by the "foo" and + "bar" pages and another one with side-by-side boxes for the "boom" and + "baz" pages. + +* Embed the markup for the top/bottom and left/right boxes into each page + template directly. + +These two solutions do not scale well because they each have a major drawback: + +* The first solution may indeed work for this simplified example. But imagine + we add a sidebar, which may again contain different, recurring structures + of content. Now we would need to create intermediate base templates for + all occurring combinations of content structure and sidebar structure... + and so on. + +* The second solution involves duplication of common code with all its negative + consequences: any change involves finding and editing all affected copies + of the structure, correctness has to be verified for each copy, copies may + go out of sync by careless modifications etc. + +In such a situation, the ``embed`` tag comes in handy. The common layout +code can live in a single base template, and the two different content structures, +let's call them "micro layouts" go into separate templates which are embedded +as necessary: + +Page template ``foo.twig``: + +.. code-block:: twig + + {% extends "layout_skeleton.twig" %} + + {% block content %} + {% embed "vertical_boxes_skeleton.twig" %} + {% block top %} + Some content for the top box + {% endblock %} + + {% block bottom %} + Some content for the bottom box + {% endblock %} + {% endembed %} + {% endblock %} + +And here is the code for ``vertical_boxes_skeleton.twig``: + +.. code-block:: html+twig + +
+ {% block top %} + Top box default content + {% endblock %} +
+ +
+ {% block bottom %} + Bottom box default content + {% endblock %} +
+ +The goal of the ``vertical_boxes_skeleton.twig`` template being to factor +out the HTML markup for the boxes. + +The ``embed`` tag takes the exact same arguments as the ``include`` tag: + +.. code-block:: twig + + {% embed "base" with {'foo': 'bar'} %} + ... + {% endembed %} + + {% embed "base" with {'foo': 'bar'} only %} + ... + {% endembed %} + + {% embed "base" ignore missing %} + ... + {% endembed %} + +.. warning:: + + As embedded templates do not have "names", auto-escaping strategies based + on the template name won't work as expected if you change the context (for + instance, if you embed a CSS/JavaScript template into an HTML one). In that + case, explicitly set the default auto-escaping strategy with the + ``autoescape`` tag. + +.. seealso:: :doc:`include<../tags/include>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/extends.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/extends.rst new file mode 100644 index 0000000..e2dc763 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/extends.rst @@ -0,0 +1,272 @@ +``extends`` +=========== + +The ``extends`` tag can be used to extend a template from another one. + +.. note:: + + Like PHP, Twig does not support multiple inheritance. So you can only have + one extends tag called per rendering. However, Twig supports horizontal + :doc:`reuse`. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document: + +.. code-block:: html+twig + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
{% block content %}{% endblock %}
+ + + + +In this example, the :doc:`block` tags define four blocks that child +templates can fill in. + +All the ``block`` tag does is to tell the template engine that a child +template may override those portions of the template. + +Child Template +-------------- + +A child template might look like this: + +.. code-block:: twig + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

Index

+

+ Welcome on my awesome homepage. +

+ {% endblock %} + +The ``extends`` tag is the key here. It tells the template engine that this +template "extends" another template. When the template system evaluates this +template, first it locates the parent. The extends tag should be the first tag +in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +You can't define multiple ``block`` tags with the same name in the same +template. This limitation exists because a block tag works in "both" +directions. That is, a block tag doesn't just provide a hole to fill - it also +defines the content that fills the hole in the *parent*. If there were two +similarly-named ``block`` tags in a template, that template's parent wouldn't +know which one of the blocks' content to use. + +If you want to print a block multiple times you can however use the +``block`` function: + +.. code-block:: twig + + {% block title %}{% endblock %} +

{{ block('title') }}

+ {% block body %}{% endblock %} + +Parent Blocks +------------- + +It's possible to render the contents of the parent block by using the +:doc:`parent<../functions/parent>` function. This gives back the results of +the parent block: + +.. code-block:: twig + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +Named Block End-Tags +-------------------- + +Twig allows you to put the name of the block after the end tag for better +readability: + +.. code-block:: twig + + {% block sidebar %} + {% block inner_sidebar %} + ... + {% endblock inner_sidebar %} + {% endblock sidebar %} + +Of course, the name after the ``endblock`` word must match the block name. + +Block Nesting and Scope +----------------------- + +Blocks can be nested for more complex layouts. Per default, blocks have access +to variables from outer scopes: + +.. code-block:: twig + + {% for item in seq %} +
  • {% block loop_item %}{{ item }}{% endblock %}
  • + {% endfor %} + +Block Shortcuts +--------------- + +For blocks with little content, it's possible to use a shortcut syntax. The +following constructs do the same thing: + +.. code-block:: twig + + {% block title %} + {{ page_title|title }} + {% endblock %} + +.. code-block:: twig + + {% block title page_title|title %} + +Dynamic Inheritance +------------------- + +Twig supports dynamic inheritance by using a variable as the base template: + +.. code-block:: twig + + {% extends some_var %} + +If the variable evaluates to a ``\Twig\Template`` or a ``\Twig\TemplateWrapper`` +instance, Twig will use it as the parent template:: + + // {% extends layout %} + + // deprecated as of Twig 1.28 + $layout = $twig->loadTemplate('some_layout_template.twig'); + + // as of Twig 1.28 + $layout = $twig->load('some_layout_template.twig'); + + $twig->display('template.twig', ['layout' => $layout]); + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence. The +first template that exists will be used as a parent: + +.. code-block:: twig + + {% extends ['layout.html', 'base_layout.html'] %} + +Conditional Inheritance +----------------------- + +As the template name for the parent can be any valid Twig expression, it's +possible to make the inheritance mechanism conditional: + +.. code-block:: twig + + {% extends standalone ? "minimum.html" : "base.html" %} + +In this example, the template will extend the "minimum.html" layout template +if the ``standalone`` variable evaluates to ``true``, and "base.html" +otherwise. + +How do blocks work? +------------------- + +A block provides a way to change how a certain part of a template is rendered +but it does not interfere in any way with the logic around it. + +Let's take the following example to illustrate how a block works and more +importantly, how it does not work: + +.. code-block:: twig + + {# base.twig #} + + {% for post in posts %} + {% block post %} +

    {{ post.title }}

    +

    {{ post.body }}

    + {% endblock %} + {% endfor %} + +If you render this template, the result would be exactly the same with or +without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way +to make it overridable by a child template: + +.. code-block:: twig + + {# child.twig #} + + {% extends "base.twig" %} + + {% block post %} +
    +
    {{ post.title }}
    +
    {{ post.text }}
    +
    + {% endblock %} + +Now, when rendering the child template, the loop is going to use the block +defined in the child template instead of the one defined in the base one; the +executed template is then equivalent to the following one: + +.. code-block:: twig + + {% for post in posts %} +
    +
    {{ post.title }}
    +
    {{ post.text }}
    +
    + {% endfor %} + +Let's take another example: a block included within an ``if`` statement: + +.. code-block:: twig + + {% if posts is empty %} + {% block head %} + {{ parent() }} + + + {% endblock head %} + {% endif %} + +Contrary to what you might think, this template does not define a block +conditionally; it just makes overridable by a child template the output of +what will be rendered when the condition is ``true``. + +If you want the output to be displayed conditionally, use the following +instead: + +.. code-block:: twig + + {% block head %} + {{ parent() }} + + {% if posts is empty %} + + {% endif %} + {% endblock head %} + +.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/filter.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/filter.rst new file mode 100644 index 0000000..a85a6cf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/filter.rst @@ -0,0 +1,26 @@ +``filter`` +========== + +.. note:: + + As of Twig 1.40, you should use the ``apply`` tag instead which does the + same thing except that the wrapped template data is not scoped. + +Filter sections allow you to apply regular Twig filters on a block of template +data. Just wrap the code in the special ``filter`` section: + +.. code-block:: twig + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +You can also chain filters and pass arguments to them: + +.. code-block:: twig + + {% filter lower|escape('html') %} + SOME TEXT + {% endfilter %} + + {# outputs "<strong>some text</strong>" #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/flush.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/flush.rst new file mode 100644 index 0000000..13948b2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/flush.rst @@ -0,0 +1,17 @@ +``flush`` +========= + +.. versionadded:: 1.5 + The flush tag was added in Twig 1.5. + +The ``flush`` tag tells Twig to flush the output buffer: + +.. code-block:: twig + + {% flush %} + +.. note:: + + Internally, Twig uses the PHP `flush`_ function. + +.. _`flush`: https://secure.php.net/flush diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/for.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/for.rst new file mode 100644 index 0000000..1147954 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/for.rst @@ -0,0 +1,172 @@ +``for`` +======= + +Loop over each item in a sequence. For example, to display a list of users +provided in a variable called ``users``: + +.. code-block:: twig + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +.. note:: + + A sequence can be either an array or an object implementing the + ``Traversable`` interface. + +If you do need to iterate over a sequence of numbers, you can use the ``..`` +operator: + +.. code-block:: twig + + {% for i in 0..10 %} + * {{ i }} + {% endfor %} + +The above snippet of code would print all numbers from 0 to 10. + +It can be also useful with letters: + +.. code-block:: twig + + {% for letter in 'a'..'z' %} + * {{ letter }} + {% endfor %} + +The ``..`` operator can take any expression at both sides: + +.. code-block:: twig + + {% for letter in 'a'|upper..'z'|upper %} + * {{ letter }} + {% endfor %} + +.. tip: + + If you need a step different from 1, you can use the ``range`` function + instead. + +The `loop` variable +------------------- + +Inside of a ``for`` loop block you can access some special variables: + +===================== ============================================================= +Variable Description +===================== ============================================================= +``loop.index`` The current iteration of the loop. (1 indexed) +``loop.index0`` The current iteration of the loop. (0 indexed) +``loop.revindex`` The number of iterations from the end of the loop (1 indexed) +``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) +``loop.first`` True if first iteration +``loop.last`` True if last iteration +``loop.length`` The number of items in the sequence +``loop.parent`` The parent context +===================== ============================================================= + +.. code-block:: twig + + {% for user in users %} + {{ loop.index }} - {{ user.username }} + {% endfor %} + +.. note:: + + The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and + ``loop.last`` variables are only available for PHP arrays, or objects that + implement the ``Countable`` interface. They are also not available when + looping with a condition. + +.. versionadded:: 1.2 + The ``if`` modifier support has been added in Twig 1.2. + +Adding a condition +------------------ + +Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You +can however filter the sequence during iteration which allows you to skip +items. The following example skips all the users which are not active: + +.. code-block:: twig + +
      + {% for user in users if user.active %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The advantage is that the special loop variable will count correctly thus not +counting the users not iterated over. Keep in mind that properties like +``loop.last`` will not be defined when using loop conditions. + +.. note:: + + Using the ``loop`` variable within the condition is not recommended as it + will probably not be doing what you expect it to. For instance, adding a + condition like ``loop.index > 4`` won't work as the index is only + incremented when the condition is true (so the condition will never + match). + +The `else` Clause +----------------- + +If no iteration took place because the sequence was empty, you can render a +replacement block by using ``else``: + +.. code-block:: twig + +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% else %} +
    • no user found
    • + {% endfor %} +
    + +Iterating over Keys +------------------- + +By default, a loop iterates over the values of the sequence. You can iterate +on keys by using the ``keys`` filter: + +.. code-block:: twig + +

    Members

    +
      + {% for key in users|keys %} +
    • {{ key }}
    • + {% endfor %} +
    + +Iterating over Keys and Values +------------------------------ + +You can also access both keys and values: + +.. code-block:: twig + +

    Members

    +
      + {% for key, user in users %} +
    • {{ key }}: {{ user.username|e }}
    • + {% endfor %} +
    + +Iterating over a Subset +----------------------- + +You might want to iterate over a subset of values. This can be achieved using +the :doc:`slice <../filters/slice>` filter: + +.. code-block:: twig + +

    Top Ten Members

    +
      + {% for user in users|slice(0, 10) %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/from.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/from.rst new file mode 100644 index 0000000..39334fd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/from.rst @@ -0,0 +1,8 @@ +``from`` +======== + +The ``from`` tag imports :doc:`macro<../tags/macro>` names into the current +namespace. The tag is documented in detail in the documentation for the +:doc:`import<../tags/import>` tag. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/if.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/if.rst new file mode 100644 index 0000000..2a1610c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/if.rst @@ -0,0 +1,79 @@ +``if`` +====== + +The ``if`` statement in Twig is comparable with the if statements of PHP. + +In the simplest form you can use it to test if an expression evaluates to +``true``: + +.. code-block:: twig + + {% if online == false %} +

    Our website is in maintenance mode. Please, come back later.

    + {% endif %} + +You can also test if an array is not empty: + +.. code-block:: twig + + {% if users %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +.. note:: + + If you want to test if the variable is defined, use ``if users is + defined`` instead. + +You can also use ``not`` to check for values that evaluate to ``false``: + +.. code-block:: twig + + {% if not user.subscribed %} +

    You are not subscribed to our mailing list.

    + {% endif %} + +For multiple conditions, ``and`` and ``or`` can be used: + +.. code-block:: twig + + {% if temperature > 18 and temperature < 27 %} +

    It's a nice day for a walk in the park.

    + {% endif %} + +For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can +use more complex ``expressions`` there too: + +.. code-block:: twig + + {% if product.stock > 10 %} + Available + {% elseif product.stock > 0 %} + Only {{ product.stock }} left! + {% else %} + Sold-out! + {% endif %} + +.. note:: + + The rules to determine if an expression is ``true`` or ``false`` are the + same as in PHP; here are the edge cases rules: + + ====================== ==================== + Value Boolean evaluation + ====================== ==================== + empty string false + numeric zero false + NAN (Not A Number) true + INF (Infinity) true + whitespace-only string true + string "0" or '0' false + empty array false + null false + non-empty array true + object true + ====================== ==================== diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/import.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/import.rst new file mode 100644 index 0000000..255a586 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/import.rst @@ -0,0 +1,65 @@ +``import`` +========== + +Twig supports putting often used code into :doc:`macros<../tags/macro>`. These +macros are defined in regular templates. + +Imagine having a generic helper template that define how to render forms via +macros (called ``forms.html``): + +.. code-block:: twig + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro textarea(name, value, rows, cols) %} + + {% endmacro %} + +There are two ways to import macros. You can import the complete template +containing the macros into a local variable or only import specific macros from +the template. + +The easiest and most flexible is importing the whole module into a local +variable: + +.. code-block:: twig + + {% import 'forms.html' as forms %} + +
    +
    Username
    +
    {{ forms.input('username') }}
    +
    Password
    +
    {{ forms.input('password', null, 'password') }}
    +
    +

    {{ forms.textarea('comment') }}

    + +Alternatively you can import names from the template into the current +namespace: + +.. code-block:: twig + + {% from 'forms.html' import input as input_field, textarea %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    +

    {{ textarea('comment') }}

    + +.. note:: + + Importing macros using ``import`` or ``from`` is **local** to the current + file. The imported macros are not available in included templates or child + templates; you need to explicitely re-import macros in each file. + +.. tip:: + + To import macros from the current file, use the special ``_self`` variable + for the source. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/include.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/include.rst new file mode 100644 index 0000000..70d05c8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/include.rst @@ -0,0 +1,114 @@ +``include`` +=========== + +The ``include`` statement includes a template and returns the rendered content +of that file: + +.. code-block:: twig + + {% include 'header.html' %} + Body + {% include 'footer.html' %} + +.. note:: + + As of Twig 1.12, it is recommended to use the + :doc:`include<../functions/include>` function instead as it provides the + same features with a bit more flexibility: + + * The ``include`` function is semantically more "correct" (including a + template outputs its rendered contents in the current scope; a tag should + not display anything); + + * The rendered template can be more easily stored in a variable when using + the ``include`` function: + + .. code-block:: twig + + {% set content %}{% include 'template.html' %}{% endset %} + + {# vs #} + + {% set content = include('template.html') %} + + * The ``include`` function does not impose any specific order for + arguments thanks to :ref:`named arguments `. + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +You can add additional variables by passing them after the ``with`` keyword: + +.. code-block:: twig + + {# template.html will have access to the variables from the current context and the additional ones provided #} + {% include 'template.html' with {'foo': 'bar'} %} + + {% set vars = {'foo': 'bar'} %} + {% include 'template.html' with vars %} + +You can disable access to the context by appending the ``only`` keyword: + +.. code-block:: twig + + {# only the foo variable will be accessible #} + {% include 'template.html' with {'foo': 'bar'} only %} + +.. code-block:: twig + + {# no variables will be accessible #} + {% include 'template.html' only %} + +.. tip:: + + When including a template created by an end user, you should consider + sandboxing it. More information in the :doc:`Twig for Developers<../api>` + chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. + +The template name can be any valid Twig expression: + +.. code-block:: twig + + {% include some_var %} + {% include ajax ? 'ajax.html' : 'not_ajax.html' %} + +And if the expression evaluates to a ``\Twig\Template`` or a +``\Twig\TemplateWrapper`` instance, Twig will use it directly:: + + // {% include template %} + + // deprecated as of Twig 1.28 + $template = $twig->loadTemplate('some_template.twig'); + + // as of Twig 1.28 + $template = $twig->load('some_template.twig'); + + $twig->display('template.twig', ['template' => $template]); + +.. versionadded:: 1.2 + The ``ignore missing`` feature has been added in Twig 1.2. + +You can mark an include with ``ignore missing`` in which case Twig will ignore +the statement if the template to be included does not exist. It has to be +placed just after the template name. Here some valid examples: + +.. code-block:: twig + + {% include 'sidebar.html' ignore missing %} + {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} + {% include 'sidebar.html' ignore missing only %} + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be included: + +.. code-block:: twig + + {% include ['page_detailed.html', 'page.html'] %} + +If ``ignore missing`` is given, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/index.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/index.rst new file mode 100644 index 0000000..530f95f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/index.rst @@ -0,0 +1,27 @@ +Tags +==== + +.. toctree:: + :maxdepth: 1 + + apply + autoescape + block + deprecated + do + embed + extends + filter + flush + for + from + if + import + include + macro + sandbox + set + spaceless + use + verbatim + with diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/macro.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/macro.rst new file mode 100644 index 0000000..2087f4a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/macro.rst @@ -0,0 +1,119 @@ +``macro`` +========= + +.. versionadded:: 1.12 + + The possibility to define default values for arguments in the macro + signature was added in Twig 1.12. + +Macros are comparable with functions in regular programming languages. They +are useful to put often used HTML idioms into reusable elements to not repeat +yourself. + +Here is a small example of a macro that renders a form element: + +.. code-block:: twig + + {% macro input(name, value, type = "text", size = 20) %} + + {% endmacro %} + +Each argument can have a default value (here ``text`` is the default value for +``type`` if not provided in the call). + +.. note:: + + Before Twig 1.12, defining default argument values was done via the + ``default`` filter in the macro body: + + .. code-block:: twig + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros differ from native PHP functions in a few ways: + +* Arguments of a macro are always optional. + +* If extra positional arguments are passed to a macro, they end up in the + special ``varargs`` variable as a list of values. + +But as with PHP functions, macros don't have access to the current template +variables. + +.. tip:: + + You can pass the whole context as an argument by using the special + ``_context`` variable. + +Import +------ + +Macros can be defined in any template, and need to be "imported" before being +used (see the documentation for the :doc:`import<../tags/import>` tag for more +information): + +.. code-block:: twig + + {% import "forms.html" as forms %} + +The above ``import`` call imports the "forms.html" file (which can contain only +macros, or a template and some macros), and import the functions as items of +the ``forms`` local variable. + +The macro can then be called at will in the current template: + +.. code-block:: twig + +

    {{ forms.input('username') }}

    +

    {{ forms.input('password', null, 'password') }}

    + +If macros are defined and used in the same template, you can use the +special ``_self`` variable to import them: + +.. code-block:: twig + + {% import _self as forms %} + +

    {{ forms.input('username') }}

    + +.. warning:: + + When you define a macro in the template where you are going to use it, you + might be tempted to call the macro directly via ``_self.input()`` instead of + importing it; even if it seems to work, this is just a side-effect of the + current implementation and it won't work anymore in Twig 2.x. + +When you want to use a macro in another macro from the same file, you need to +import it locally: + +.. code-block:: twig + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro wrapped_input(name, value, type, size) %} + {% import _self as forms %} + +
    + {{ forms.input(name, value, type, size) }} +
    + {% endmacro %} + +Named Macro End-Tags +-------------------- + +Twig allows you to put the name of the macro after the end tag for better +readability: + +.. code-block:: twig + + {% macro input() %} + ... + {% endmacro input %} + +Of course, the name after the ``endmacro`` word must match the macro name. + +.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/sandbox.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/sandbox.rst new file mode 100644 index 0000000..b331fdb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/sandbox.rst @@ -0,0 +1,30 @@ +``sandbox`` +=========== + +The ``sandbox`` tag can be used to enable the sandboxing mode for an included +template, when sandboxing is not enabled globally for the Twig environment: + +.. code-block:: twig + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +.. warning:: + + The ``sandbox`` tag is only available when the sandbox extension is + enabled (see the :doc:`Twig for Developers<../api>` chapter). + +.. note:: + + The ``sandbox`` tag can only be used to sandbox an include tag and it + cannot be used to sandbox a section of a template. The following example + won't work: + + .. code-block:: twig + + {% sandbox %} + {% for i in 1..2 %} + {{ i }} + {% endfor %} + {% endsandbox %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/set.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/set.rst new file mode 100644 index 0000000..f752fdd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/set.rst @@ -0,0 +1,78 @@ +``set`` +======= + +Inside code blocks you can also assign values to variables. Assignments use +the ``set`` tag and can have multiple targets. + +Here is how you can assign the ``bar`` value to the ``foo`` variable: + +.. code-block:: twig + + {% set foo = 'bar' %} + +After the ``set`` call, the ``foo`` variable is available in the template like +any other ones: + +.. code-block:: twig + + {# displays bar #} + {{ foo }} + +The assigned value can be any valid :ref:`Twig expression +`: + +.. code-block:: twig + + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + {% set foo = 'foo' ~ 'bar' %} + +Several variables can be assigned in one block: + +.. code-block:: twig + + {% set foo, bar = 'foo', 'bar' %} + + {# is equivalent to #} + + {% set foo = 'foo' %} + {% set bar = 'bar' %} + +The ``set`` tag can also be used to 'capture' chunks of text: + +.. code-block:: twig + + {% set foo %} + + {% endset %} + +.. caution:: + + If you enable automatic output escaping, Twig will only consider the + content to be safe when capturing chunks of text. + +.. note:: + + Note that loops are scoped in Twig; therefore a variable declared inside a + ``for`` loop is not accessible outside the loop itself: + + .. code-block:: twig + + {% for item in list %} + {% set foo = item %} + {% endfor %} + + {# foo is NOT available #} + + If you want to access the variable, just declare it before the loop: + + .. code-block:: twig + + {% set foo = "" %} + {% for item in list %} + {% set foo = item %} + {% endfor %} + + {# foo is available #} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/spaceless.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/spaceless.rst new file mode 100644 index 0000000..2608538 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/spaceless.rst @@ -0,0 +1,41 @@ +``spaceless`` +============= + +.. tip:: + + As of Twig 1.38, use the :doc:`spaceless <../filters/spaceless>` filter instead. + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: twig + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +This tag is not meant to "optimize" the size of the generated HTML content but +merely to avoid extra whitespace between HTML tags to avoid browser rendering +quirks under some circumstances. + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :ref:`dedicated section ` of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/use.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/use.rst new file mode 100644 index 0000000..b83d1be --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/use.rst @@ -0,0 +1,124 @@ +``use`` +======= + +.. versionadded:: 1.1 + Horizontal reuse was added in Twig 1.1. + +.. note:: + + Horizontal reuse is an advanced Twig feature that is hardly ever needed in + regular templates. It is mainly used by projects that need to make + template blocks reusable without using inheritance. + +Template inheritance is one of the most powerful features of Twig but it is +limited to single inheritance; a template can only extend one other template. +This limitation makes template inheritance simple to understand and easy to +debug: + +.. code-block:: twig + + {% extends "base.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +Horizontal reuse is a way to achieve the same goal as multiple inheritance, +but without the associated complexity: + +.. code-block:: twig + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +The ``use`` statement tells Twig to import the blocks defined in +``blocks.html`` into the current template (it's like macros, but for blocks): + +.. code-block:: twig + + {# blocks.html #} + + {% block sidebar %}{% endblock %} + +In this example, the ``use`` statement imports the ``sidebar`` block into the +main template. The code is mostly equivalent to the following one (the +imported blocks are not outputted automatically): + +.. code-block:: twig + + {% extends "base.html" %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. note:: + + The ``use`` tag only imports a template if it does not extend another + template, if it does not define macros, and if the body is empty. But it + can *use* other templates. + +.. note:: + + Because ``use`` statements are resolved independently of the context + passed to the template, the template reference cannot be an expression. + +The main template can also override any imported block. If the template +already defines the ``sidebar`` block, then the one defined in ``blocks.html`` +is ignored. To avoid name conflicts, you can rename imported blocks: + +.. code-block:: twig + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. versionadded:: 1.3 + The ``parent()`` support was added in Twig 1.3. + +The ``parent()`` function automatically determines the correct inheritance +tree, so it can be used when overriding a block defined in an imported +template: + +.. code-block:: twig + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block sidebar %} + {{ parent() }} + {% endblock %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +In this example, ``parent()`` will correctly call the ``sidebar`` block from +the ``blocks.html`` template. + +.. tip:: + + In Twig 1.2, renaming allows you to simulate inheritance by calling the + "parent" block: + + .. code-block:: twig + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as parent_sidebar %} + + {% block sidebar %} + {{ block('parent_sidebar') }} + {% endblock %} + +.. note:: + + You can use as many ``use`` statements as you want in any given template. + If two imported templates define the same block, the latest one wins. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/verbatim.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/verbatim.rst new file mode 100644 index 0000000..001bbd5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/verbatim.rst @@ -0,0 +1,24 @@ +``verbatim`` +============ + +.. versionadded:: 1.12 + The ``verbatim`` tag was added in Twig 1.12 (it was named ``raw`` before). + +The ``verbatim`` tag marks sections as being raw text that should not be +parsed. For example to put Twig syntax as example into a template you can use +this snippet: + +.. code-block:: twig + + {% verbatim %} +
      + {% for item in seq %} +
    • {{ item }}
    • + {% endfor %} +
    + {% endverbatim %} + +.. note:: + + The ``verbatim`` tag works in the exact same way as the old ``raw`` tag, + but was renamed to avoid confusion with the ``raw`` filter. \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/with.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/with.rst new file mode 100644 index 0000000..bf9df5d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tags/with.rst @@ -0,0 +1,44 @@ +``with`` +======== + +.. versionadded:: 1.28 + The ``with`` tag was added in Twig 1.28. + +Use the ``with`` tag to create a new inner scope. Variables set within this +scope are not visible outside of the scope: + +.. code-block:: twig + + {% with %} + {% set foo = 42 %} + {{ foo }} foo is 42 here + {% endwith %} + foo is not visible here any longer + +Instead of defining variables at the beginning of the scope, you can pass a +hash of variables you want to define in the ``with`` tag; the previous example +is equivalent to the following one: + +.. code-block:: twig + + {% with { foo: 42 } %} + {{ foo }} foo is 42 here + {% endwith %} + foo is not visible here any longer + + {# it works with any expression that resolves to a hash #} + {% set vars = { foo: 42 } %} + {% with vars %} + ... + {% endwith %} + +By default, the inner scope has access to the outer scope context; you can +disable this behavior by appending the ``only`` keyword: + +.. code-block:: twig + + {% set bar = 'bar' %} + {% with { foo: 42 } only %} + {# only foo is defined #} + {# bar is not defined #} + {% endwith %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/templates.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/templates.rst new file mode 100644 index 0000000..3bac9ec --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/templates.rst @@ -0,0 +1,931 @@ +Twig for Template Designers +=========================== + +This document describes the syntax and semantics of the template engine and +will be most useful as reference to those creating Twig templates. + +Synopsis +-------- + +A template is a regular text file. It can generate any text-based format (HTML, +XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or +``.xml`` are just fine. + +A template contains **variables** or **expressions**, which get replaced with +values when the template is evaluated, and **tags**, which control the +template's logic. + +Below is a minimal template that illustrates a few basics. We will cover further +details later on: + +.. code-block:: html+twig + + + + + My Webpage + + + + +

    My Webpage

    + {{ a_variable }} + + + +There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first +one is used to execute statements such as for-loops, the latter outputs the +result of an expression. + +IDEs Integration +---------------- + +Many IDEs support syntax highlighting and auto-completion for Twig: + +* *Textmate* via the `Twig bundle`_ +* *Vim* via the `Jinja syntax plugin`_ or the `vim-twig plugin`_ +* *Netbeans* via the `Twig syntax plugin`_ (until 7.1, native as of 7.2) +* *PhpStorm* (native as of 2.1) +* *Eclipse* via the `Twig plugin`_ +* *Sublime Text* via the `Twig bundle`_ +* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) +* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ +* *Coda 2* via the `other Twig syntax mode`_ +* *Komodo* and *Komodo Edit* via the Twig highlight/syntax check mode +* *Notepad++* via the `Notepad++ Twig Highlighter`_ +* *Emacs* via `web-mode.el`_ +* *Atom* via the `PHP-twig for atom`_ +* *Visual Studio Code* via the `Twig pack`_ + +Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates +from a browser; it supports all versions of Twig. + +Variables +--------- + +The application passes variables to the templates for manipulation in the +template. Variables may have attributes or elements you can access, too. The +visual representation of a variable depends heavily on the application providing +it. + +Use a dot (``.``) to access attributes of a variable (methods or properties of a +PHP object, or items of a PHP array): + +.. code-block:: twig + + {{ foo.bar }} + +.. note:: + + It's important to know that the curly braces are *not* part of the + variable but the print statement. When accessing variables inside tags, + don't put the braces around them. + +.. sidebar:: Implementation + + For convenience's sake ``foo.bar`` does the following things on the PHP + layer: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid method + (even if ``bar`` is the constructor - use ``__construct()`` instead); + * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; + * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; + * if not, return a ``null`` value. + + Twig also supports a specific syntax for accessing items on PHP arrays, + ``foo['bar']``: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, return a ``null`` value. + +If a variable or attribute does not exist, you will receive a ``null`` value +when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` +is set, Twig will throw an error (see :ref:`environment options`). + +.. note:: + + If you want to access a dynamic attribute of a variable, use the + :doc:`attribute` function instead. + + The ``attribute`` function is also useful when the attribute contains + special characters (like ``-`` that would be interpreted as the minus + operator): + + .. code-block:: twig + + {# equivalent to the non-working foo.data-foo #} + {{ attribute(foo, 'data-foo') }} + +Global Variables +~~~~~~~~~~~~~~~~ + +The following variables are always available in templates: + +* ``_self``: references the current template; +* ``_context``: references the current context; +* ``_charset``: references the current charset. + +Setting Variables +~~~~~~~~~~~~~~~~~ + +You can assign values to variables inside code blocks. Assignments use the +:doc:`set` tag: + +.. code-block:: twig + + {% set foo = 'foo' %} + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + +Filters +------- + +Variables can be modified by **filters**. Filters are separated from the +variable by a pipe symbol (``|``). Multiple filters can be chained. The output +of one filter is applied to the next. + +The following example removes all HTML tags from the ``name`` and title-cases +it: + +.. code-block:: twig + + {{ name|striptags|title }} + +Filters that accept arguments have parentheses around the arguments. This +example joins the elements of a list by commas: + +.. code-block:: twig + + {{ list|join(', ') }} + +To apply a filter on a section of code, wrap it with the +:doc:`apply` tag: + +.. code-block:: twig + + {% apply upper %} + This text becomes uppercase + {% endapply %} + +Go to the :doc:`filters` page to learn more about built-in +filters. + +.. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + +Functions +--------- + +Functions can be called to generate content. Functions are called by their +name followed by parentheses (``()``) and may have arguments. + +For instance, the ``range`` function returns a list containing an arithmetic +progression of integers: + +.. code-block:: twig + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + +Go to the :doc:`functions` page to learn more about the +built-in functions. + +.. _named-arguments: + +Named Arguments +--------------- + +.. versionadded:: 1.12 + Support for named arguments was added in Twig 1.12. + +.. code-block:: twig + + {% for i in range(low=1, high=10, step=2) %} + {{ i }}, + {% endfor %} + +Using named arguments makes your templates more explicit about the meaning of +the values you pass as arguments: + +.. code-block:: twig + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + + {# versus #} + + {{ data|convert_encoding(from='iso-2022-jp', to='UTF-8') }} + +Named arguments also allow you to skip some arguments for which you don't want +to change the default value: + +.. code-block:: twig + + {# the first argument is the date format, which defaults to the global date format if null is passed #} + {{ "now"|date(null, "Europe/Paris") }} + + {# or skip the format value by using a named argument for the time zone #} + {{ "now"|date(timezone="Europe/Paris") }} + +You can also use both positional and named arguments in one call, in which +case positional arguments must always come before named arguments: + +.. code-block:: twig + + {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} + +.. tip:: + + Each function and filter documentation page has a section where the names + of all arguments are listed when supported. + +Control Structure +----------------- + +A control structure refers to all those things that control the flow of a +program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as +well as things like blocks. Control structures appear inside ``{% ... %}`` +blocks. + +For example, to display a list of users provided in a variable called +``users``, use the :doc:`for` tag: + +.. code-block:: twig + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The :doc:`if` tag can be used to test an expression: + +.. code-block:: twig + + {% if users|length > 0 %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +Go to the :doc:`tags` page to learn more about the built-in tags. + +Comments +-------- + +To comment-out part of a line in a template, use the comment syntax ``{# ... +#}``. This is useful for debugging or to add information for other template +designers or yourself: + +.. code-block:: twig + + {# note: disabled template because we no longer use this + {% for user in users %} + ... + {% endfor %} + #} + +Including other Templates +------------------------- + +The :doc:`include` function is useful to include a template +and return the rendered content of that template into the current one: + +.. code-block:: twig + + {{ include('sidebar.html') }} + +By default, included templates have access to the same context as the template +which includes them. This means that any variable defined in the main template +will be available in the included template too: + +.. code-block:: twig + + {% for box in boxes %} + {{ include('render_box.html') }} + {% endfor %} + +The included template ``render_box.html`` is able to access the ``box`` variable. + +The name of the template depends on the template loader. For instance, the +``\Twig\Loader\FilesystemLoader`` allows you to access other templates by giving the +filename. You can access templates in subdirectories with a slash: + +.. code-block:: twig + + {{ include('sections/articles/sidebar.html') }} + +This behavior depends on the application embedding Twig. + +Template Inheritance +-------------------- + +The most powerful part of Twig is template inheritance. Template inheritance +allows you to build a base "skeleton" template that contains all the common +elements of your site and defines **blocks** that child templates can +override. + +It's easier to understand the concept by starting with an example. + +Let's define a base template, ``base.html``, which defines an HTML skeleton +document that might be used for a two-column page: + +.. code-block:: html+twig + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
    {% block content %}{% endblock %}
    + + + + +In this example, the :doc:`block` tags define four blocks that +child templates can fill in. All the ``block`` tag does is to tell the +template engine that a child template may override those portions of the +template. + +A child template might look like this: + +.. code-block:: twig + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

    Index

    +

    + Welcome to my awesome homepage. +

    + {% endblock %} + +The :doc:`extends` tag is the key here. It tells the template +engine that this template "extends" another template. When the template system +evaluates this template, first it locates the parent. The extends tag should +be the first tag in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +It's possible to render the contents of the parent block by using the +:doc:`parent` function. This gives back the results of the +parent block: + +.. code-block:: twig + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +.. tip:: + + The documentation page for the :doc:`extends` tag describes + more advanced features like block nesting, scope, dynamic inheritance, and + conditional inheritance. + +.. note:: + + Twig also supports multiple inheritance via "horizontal reuse" with the help + of the :doc:`use` tag. + +HTML Escaping +------------- + +When generating HTML from templates, there's always a risk that a variable +will include characters that affect the resulting HTML. There are two +approaches: manually escaping each variable or automatically escaping +everything by default. + +Twig supports both, automatic escaping is enabled by default. + +The automatic escaping strategy can be configured via the +:ref:`autoescape` option and defaults to ``html``. + +Working with Manual Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If manual escaping is enabled, it is **your** responsibility to escape variables +if needed. What to escape? Any variable that comes from an untrusted source. + +Escaping works by using the :doc:`escape` or ``e`` filter: + +.. code-block:: twig + + {{ user.username|e }} + +By default, the ``escape`` filter uses the ``html`` strategy, but depending on +the escaping context, you might want to explicitly use an other strategy: + +.. code-block:: twig + + {{ user.username|e('js') }} + {{ user.username|e('css') }} + {{ user.username|e('url') }} + {{ user.username|e('html_attr') }} + +Working with Automatic Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the :doc:`autoescape` +tag: + +.. code-block:: twig + + {% autoescape %} + Everything will be automatically escaped in this block (using the HTML strategy) + {% endautoescape %} + +By default, auto-escaping uses the ``html`` escaping strategy. If you output +variables in other contexts, you need to explicitly escape them with the +appropriate escaping strategy: + +.. code-block:: twig + + {% autoescape 'js' %} + Everything will be automatically escaped in this block (using the JS strategy) + {% endautoescape %} + +Escaping +-------- + +It is sometimes desirable or even necessary to have Twig ignore parts it would +otherwise handle as variables or blocks. For example if the default syntax is +used and you want to use ``{{`` as raw string in the template and not start a +variable you have to use a trick. + +The easiest way is to output the variable delimiter (``{{``) by using a variable +expression: + +.. code-block:: twig + + {{ '{{' }} + +For bigger sections it makes sense to mark a block +:doc:`verbatim`. + +Macros +------ + +.. versionadded:: 1.12 + Support for default argument values was added in Twig 1.12. + +Macros are comparable with functions in regular programming languages. They +are useful to reuse often used HTML fragments to not repeat yourself. + +A macro is defined via the :doc:`macro` tag. Here is a small example +(subsequently called ``forms.html``) of a macro that renders a form element: + +.. code-block:: twig + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros can be defined in any template, and need to be "imported" via the +:doc:`import` tag before being used: + +.. code-block:: twig + + {% import "forms.html" as forms %} + +

    {{ forms.input('username') }}

    + +Alternatively, you can import individual macro names from a template into the +current namespace via the :doc:`from` tag and optionally alias them: + +.. code-block:: twig + + {% from 'forms.html' import input as input_field %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    + +A default value can also be defined for macro arguments when not provided in a +macro call: + +.. code-block:: twig + + {% macro input(name, value = "", type = "text", size = 20) %} + + {% endmacro %} + +If extra positional arguments are passed to a macro call, they end up in the +special ``varargs`` variable as a list of values. + +.. _twig-expressions: + +Expressions +----------- + +Twig allows expressions everywhere. + +.. note:: + + The operator precedence is as follows, with the lowest-precedence operators + listed first: ``?:`` (ternary operator), ``b-and``, ``b-xor``, ``b-or``, + ``or``, ``and``, ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, + ``matches``, ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, + ``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|`` + (filters), ``[]``, and ``.``. + + .. code-block:: twig + + {% set greeting = 'Hello ' %} + {% set name = 'Fabien' %} + + {{ greeting ~ name|lower }} {# Hello fabien #} + + {# use parenthesis to change precedence #} + {{ (greeting ~ name)|lower }} {# hello fabien #} + +Literals +~~~~~~~~ + +.. versionadded:: 1.5 + Support for hash keys as names and expressions was added in Twig 1.5. + +The simplest form of expressions are literals. Literals are representations +for PHP types such as strings, numbers, and arrays. The following literals +exist: + +* ``"Hello World"``: Everything between two double or single quotes is a + string. They are useful whenever you need a string in the template (for + example as arguments to function calls, filters or just to extend or include + a template). A string can contain a delimiter if it is preceded by a + backslash (``\``) -- like in ``'It\'s good'``. If the string contains a + backslash (e.g. ``'c:\Program Files'``) escape it by doubling it + (e.g. ``'c:\\Program Files'``). + +* ``42`` / ``42.23``: Integers and floating point numbers are created by + writing the number down. If a dot is present the number is a float, + otherwise an integer. + +* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions + separated by a comma (``,``) and wrapped with squared brackets (``[]``). + +* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values + separated by a comma (``,``) and wrapped with curly braces (``{}``): + + .. code-block:: twig + + {# keys as string #} + { 'foo': 'foo', 'bar': 'bar' } + + {# keys as names (equivalent to the previous hash) -- as of Twig 1.5 #} + { foo: 'foo', bar: 'bar' } + + {# keys as integer #} + { 2: 'foo', 4: 'bar' } + + {# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #} + {% set foo = 'foo' %} + { (foo): 'foo', (1 + 1): 'bar', (foo ~ 'b'): 'baz' } + +* ``true`` / ``false``: ``true`` represents the true value, ``false`` + represents the false value. + +* ``null``: ``null`` represents no specific value. This is the value returned + when a variable does not exist. ``none`` is an alias for ``null``. + +Arrays and hashes can be nested: + +.. code-block:: twig + + {% set foo = [1, {"foo": "bar"}] %} + +.. tip:: + + Using double-quoted or single-quoted strings has no impact on performance + but :ref:`string interpolation ` is only + supported in double-quoted strings. + +Math +~~~~ + +Twig allows you to do math in templates; the following operators are supported: + +* ``+``: Adds two numbers together (the operands are casted to numbers). ``{{ + 1 + 1 }}`` is ``2``. + +* ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is + ``1``. + +* ``/``: Divides two numbers. The returned value will be a floating point + number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. + +* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is + ``4``. + +* ``//``: Divides two numbers and returns the floored integer result. ``{{ 20 + // 7 }}`` is ``2``, ``{{ -20 // 7 }}`` is ``-3`` (this is just syntactic + sugar for the :doc:`round` filter). + +* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would + return ``4``. + +* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** + 3 }}`` would return ``8``. + +.. _template_logic: + +Logic +~~~~~ + +You can combine multiple expressions with the following operators: + +* ``and``: Returns true if the left and the right operands are both true. + +* ``or``: Returns true if the left or the right operand is true. + +* ``not``: Negates a statement. + +* ``(expr)``: Groups an expression. + +.. note:: + + Twig also supports bitwise operators (``b-and``, ``b-xor``, and ``b-or``). + +.. note:: + + Operators are case sensitive. + +Comparisons +~~~~~~~~~~~ + +The following comparison operators are supported in any expression: ``==``, +``!=``, ``<``, ``>``, ``>=``, and ``<=``. + +You can also check if a string ``starts with`` or ``ends with`` another +string: + +.. code-block:: twig + + {% if 'Fabien' starts with 'F' %} + {% endif %} + + {% if 'Fabien' ends with 'n' %} + {% endif %} + +.. note:: + + For complex string comparisons, the ``matches`` operator allows you to use + `regular expressions`_: + + .. code-block:: twig + + {% if phone matches '/^[\\d\\.]+$/' %} + {% endif %} + +Containment Operator +~~~~~~~~~~~~~~~~~~~~ + +The ``in`` operator performs containment test. It returns ``true`` if the left +operand is contained in the right: + +.. code-block:: twig + + {# returns true #} + + {{ 1 in [1, 2, 3] }} + + {{ 'cd' in 'abcde' }} + +.. tip:: + + You can use this filter to perform a containment test on strings, arrays, + or objects implementing the ``Traversable`` interface. + +To perform a negative test, use the ``not in`` operator: + +.. code-block:: twig + + {% if 1 not in [1, 2, 3] %} + + {# is equivalent to #} + {% if not (1 in [1, 2, 3]) %} + +Test Operator +~~~~~~~~~~~~~ + +The ``is`` operator performs tests. Tests can be used to test a variable against +a common expression. The right operand is name of the test: + +.. code-block:: twig + + {# find out if a variable is odd #} + + {{ name is odd }} + +Tests can accept arguments too: + +.. code-block:: twig + + {% if post.status is constant('Post::PUBLISHED') %} + +Tests can be negated by using the ``is not`` operator: + +.. code-block:: twig + + {% if post.status is not constant('Post::PUBLISHED') %} + + {# is equivalent to #} + {% if not (post.status is constant('Post::PUBLISHED')) %} + +Go to the :doc:`tests` page to learn more about the built-in +tests. + +Other Operators +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.12.0 + Support for the extended ternary operator was added in Twig 1.12.0. + +The following operators don't fit into any of the other categories: + +* ``|``: Applies a filter. + +* ``..``: Creates a sequence based on the operand before and after the operator + (this is syntactic sugar for the :doc:`range` function): + + .. code-block:: twig + + {{ 1..5 }} + + {# equivalent to #} + {{ range(1, 5) }} + + Note that you must use parentheses when combining it with the filter operator + due to the :ref:`operator precedence rules `: + + .. code-block:: twig + + (1..5)|join(', ') + +* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello + " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello + John!``. + +* ``.``, ``[]``: Gets an attribute of a variable. + +* ``?:``: The ternary operator: + + .. code-block:: twig + + {{ foo ? 'yes' : 'no' }} + + {# as of Twig 1.12.0 #} + {{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }} + {{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }} + +* ``??``: The null-coalescing operator: + + .. code-block:: twig + + {# returns the value of foo if it is defined and not null, 'no' otherwise #} + {{ foo ?? 'no' }} + +.. _templates-string-interpolation: + +String Interpolation +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + String interpolation was added in Twig 1.5. + +String interpolation (``#{expression}``) allows any valid expression to appear +within a *double-quoted string*. The result of evaluating that expression is +inserted into the string: + +.. code-block:: twig + + {{ "foo #{bar} baz" }} + {{ "foo #{1 + 2} baz" }} + +.. _templates-whitespace-control: + +Whitespace Control +------------------ + +.. versionadded:: 1.1 + Tag level whitespace control was added in Twig 1.1. + +.. versionadded:: 1.39 + Tag level Line whitespace control was added in Twig 1.39. + +The first newline after a template tag is removed automatically (like in PHP). +Whitespace is not further modified by the template engine, so each whitespace +(spaces, tabs, newlines etc.) is returned unchanged. + +You can also control whitespace on a per tag level. By using the whitespace +control modifiers on your tags, you can trim leading and or trailing whitespace. + +Twig supports two modifiers: + +* *Whitespace trimming* via the ``-`` modifier: Removes all whitespace + (including newlines); + +* *Line whitespace trimming* via the ``~`` modifier: Removes all whitespace + (excluding newlines). Using this modifier on the right disables the default + removal of the first newline inherited from PHP. + +The modifiers can be used on either side of the tags like in ``{%-`` or ``-%}`` +and they consume all whitespace for that side of the tag. It is possible to use +the modifiers on one side of a tag or on both sides: + +.. code-block:: twig + + {% set value = 'no spaces' %} + {#- No leading/trailing whitespace -#} + {%- if true -%} + {{- value -}} + {%- endif -%} + {# output 'no spaces' #} + +
  • + {{ value }}
  • + {# outputs '
  • \n no spaces
  • ' #} + +
  • + {{- value }}
  • + {# outputs '
  • no spaces
  • ' #} + +
  • + {{~ value }}
  • + {# outputs '
  • \nno spaces
  • ' #} + +.. tip:: + + In addition to the whitespace modifiers, Twig also has a ``spaceless`` filter + that removes whitespace **between HTML tags**: + + .. code-block:: twig + + {% apply spaceless %} +
    + foo bar +
    + {% endapply %} + + {# output will be
    foo bar
    #} + + Note that the ``apply`` tag was introduced in Twig 1.40; use the ``filter`` + tag with previous versions. + +Extensions +---------- + +Twig can be extended. If you are looking for new tags, filters, or functions, +have a look at the Twig official `extension repository`_. + +If you want to create your own, read the :ref:`Creating an +Extension` chapter. + +.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle +.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim +.. _`vim-twig plugin`: https://github.com/lumiliet/vim-twig +.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig +.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin +.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language +.. _`extension repository`: https://github.com/twigphp/Twig-extensions +.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode +.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode +.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig +.. _`web-mode.el`: http://web-mode.org/ +.. _`regular expressions`: https://secure.php.net/manual/en/pcre.pattern.php +.. _`PHP-twig for atom`: https://github.com/reesef/php-twig +.. _`TwigFiddle`: https://twigfiddle.com/ +.. _`Twig pack`: https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-twig-pack diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/constant.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/constant.rst new file mode 100644 index 0000000..98abf4d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/constant.rst @@ -0,0 +1,22 @@ +``constant`` +============ + +.. versionadded: 1.13.1 + constant now accepts object instances as the second argument. + +``constant`` checks if a variable has the exact same value as a constant. You +can use either global constants or class constants: + +.. code-block:: twig + + {% if post.status is constant('Post::PUBLISHED') %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} + +You can test constants from object instances as well: + +.. code-block:: twig + + {% if post.status is constant('PUBLISHED', post) %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/defined.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/defined.rst new file mode 100644 index 0000000..234a289 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/defined.rst @@ -0,0 +1,30 @@ +``defined`` +=========== + +``defined`` checks if a variable is defined in the current context. This is very +useful if you use the ``strict_variables`` option: + +.. code-block:: twig + + {# defined works with variable names #} + {% if foo is defined %} + ... + {% endif %} + + {# and attributes on variables names #} + {% if foo.bar is defined %} + ... + {% endif %} + + {% if foo['bar'] is defined %} + ... + {% endif %} + +When using the ``defined`` test on an expression that uses variables in some +method calls, be sure that they are all defined first: + +.. code-block:: twig + + {% if var is defined and foo.method(var) is defined %} + ... + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/divisibleby.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/divisibleby.rst new file mode 100644 index 0000000..0beea8a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/divisibleby.rst @@ -0,0 +1,14 @@ +``divisible by`` +================ + +.. versionadded:: 1.14.2 + The ``divisible by`` test was added in Twig 1.14.2 as an alias for + ``divisibleby``. + +``divisible by`` checks if a variable is divisible by a number: + +.. code-block:: twig + + {% if loop.index is divisible by(3) %} + ... + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/empty.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/empty.rst new file mode 100644 index 0000000..b630c0c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/empty.rst @@ -0,0 +1,22 @@ +``empty`` +========= + +.. versionadded:: 1.33 + + Support for the ``__toString()`` magic method has been added in Twig 1.33. + +``empty`` checks if a variable is an empty string, an empty array, an empty +hash, exactly ``false``, or exactly ``null``. + +For objects that implement the ``Countable`` interface, ``empty`` will check the +return value of the ``count()`` method. + +For objects that implement the ``__toString()`` magic method (and not ``Countable``), +it will check if an empty string is returned. + +.. code-block:: twig + + {% if foo is empty %} + ... + {% endif %} + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/even.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/even.rst new file mode 100644 index 0000000..5d9c876 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/even.rst @@ -0,0 +1,10 @@ +``even`` +======== + +``even`` returns ``true`` if the given number is even: + +.. code-block:: twig + + {{ var is even }} + +.. seealso:: :doc:`odd<../tests/odd>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/index.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/index.rst new file mode 100644 index 0000000..c63208e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/index.rst @@ -0,0 +1,15 @@ +Tests +===== + +.. toctree:: + :maxdepth: 1 + + constant + defined + divisibleby + empty + even + iterable + null + odd + sameas diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/iterable.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/iterable.rst new file mode 100644 index 0000000..f0bfc5f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/iterable.rst @@ -0,0 +1,19 @@ +``iterable`` +============ + +.. versionadded:: 1.7 + The iterable test was added in Twig 1.7. + +``iterable`` checks if a variable is an array or a traversable object: + +.. code-block:: twig + + {# evaluates to true if the foo variable is iterable #} + {% if users is iterable %} + {% for user in users %} + Hello {{ user }}! + {% endfor %} + {% else %} + {# users is probably a string #} + Hello {{ users }}! + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/null.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/null.rst new file mode 100644 index 0000000..9ed93f6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/null.rst @@ -0,0 +1,12 @@ +``null`` +======== + +``null`` returns ``true`` if the variable is ``null``: + +.. code-block:: twig + + {{ var is null }} + +.. note:: + + ``none`` is an alias for ``null``. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/odd.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/odd.rst new file mode 100644 index 0000000..0546f83 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/odd.rst @@ -0,0 +1,10 @@ +``odd`` +======= + +``odd`` returns ``true`` if the given number is odd: + +.. code-block:: twig + + {{ var is odd }} + +.. seealso:: :doc:`even<../tests/even>` diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/sameas.rst b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/sameas.rst new file mode 100644 index 0000000..4fc267d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/doc/tests/sameas.rst @@ -0,0 +1,14 @@ +``same as`` +=========== + +.. versionadded:: 1.14.2 + The ``same as`` test was added in Twig 1.14.2 as an alias for ``sameas``. + +``same as`` checks if a variable is the same as another variable. +This is the equivalent to ``===`` in PHP: + +.. code-block:: twig + + {% if foo.attribute is same as(false) %} + the foo attribute really is the 'false' PHP value + {% endif %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/drupal_test.sh b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/drupal_test.sh new file mode 100644 index 0000000..0374593 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/drupal_test.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -x +set -e + +REPO=`pwd` +cd /tmp +rm -rf drupal-twig-test +composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test +cd drupal-twig-test +(cd vendor/twig && rm -rf twig && ln -sf $REPO twig) +echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php +php ./web/core/scripts/drupal install --no-interaction demo_umami > output +perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output +source output + +wget https://get.symfony.com/cli/installer -O - | bash +export PATH="$HOME/.symfony/bin:$PATH" +symfony server:start -d --no-tls +ENDPOINT=`symfony server:status -no-ansi | sed -E 's/^.+ http/http/'` + +curl -OLsS https://get.blackfire.io/blackfire-player.phar +chmod +x blackfire-player.phar +cat > drupal-tests.bkf < | + +----------------------------------------------------------------------+ + */ + +#ifndef PHP_TWIG_H +#define PHP_TWIG_H + +#define PHP_TWIG_VERSION "1.41.0" + +#include "php.h" + +extern zend_module_entry twig_module_entry; +#define phpext_twig_ptr &twig_module_entry +#ifndef PHP_WIN32 +zend_module_entry *get_module(void); +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +PHP_FUNCTION(twig_template_get_attributes); +PHP_RSHUTDOWN_FUNCTION(twig); + +#endif diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/twig.c b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/twig.c new file mode 100644 index 0000000..171ed10 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/ext/twig/twig.c @@ -0,0 +1,1217 @@ +/* + +----------------------------------------------------------------------+ + | Twig Extension | + +----------------------------------------------------------------------+ + | Copyright (c) 2011 Derick Rethans | + +----------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met (BSD-3-Clause). | + +----------------------------------------------------------------------+ + | Author: Derick Rethans | + +----------------------------------------------------------------------+ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_twig.h" +#include "ext/standard/php_var.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_smart_str.h" +#include "ext/spl/spl_exceptions.h" + +#include "Zend/zend_object_handlers.h" +#include "Zend/zend_interfaces.h" +#include "Zend/zend_exceptions.h" + +#ifndef Z_ADDREF_P +#define Z_ADDREF_P(pz) (pz)->refcount++ +#endif + +#ifndef E_USER_DEPRECATED +#define E_USER_DEPRECATED (1<<14L) +#endif + +#define FREE_DTOR(z) \ + zval_dtor(z); \ + efree(z); + +#if PHP_VERSION_ID >= 50300 + #define APPLY_TSRMLS_DC TSRMLS_DC + #define APPLY_TSRMLS_CC TSRMLS_CC + #define APPLY_TSRMLS_FETCH() +#else + #define APPLY_TSRMLS_DC + #define APPLY_TSRMLS_CC + #define APPLY_TSRMLS_FETCH() TSRMLS_FETCH() +#endif + +ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, template) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, item) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, isDefinedTest) +ZEND_END_ARG_INFO() + +#ifndef PHP_FE_END +#define PHP_FE_END { NULL, NULL, NULL} +#endif + +static const zend_function_entry twig_functions[] = { + PHP_FE(twig_template_get_attributes, twig_template_get_attribute_args) + PHP_FE_END +}; + +PHP_RSHUTDOWN_FUNCTION(twig) +{ +#if ZEND_DEBUG + CG(unclean_shutdown) = 0; /* get rid of PHPUnit's exit() and report memleaks */ +#endif + return SUCCESS; +} + +zend_module_entry twig_module_entry = { + STANDARD_MODULE_HEADER, + "twig", + twig_functions, + NULL, + NULL, + NULL, + PHP_RSHUTDOWN(twig), + NULL, + PHP_TWIG_VERSION, + STANDARD_MODULE_PROPERTIES +}; + + +#ifdef COMPILE_DL_TWIG +ZEND_GET_MODULE(twig) +#endif + +static int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key) +{ + if (Z_TYPE_P(array) != IS_ARRAY) { + return 0; + } + + switch (Z_TYPE_P(key)) { + case IS_NULL: + return zend_hash_exists(Z_ARRVAL_P(array), "", 1); + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(key); + case IS_LONG: + return zend_hash_index_exists(Z_ARRVAL_P(array), Z_LVAL_P(key)); + + default: + convert_to_string(key); + return zend_symtable_exists(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1); + } +} + +static int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC) +{ + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), interface TSRMLS_CC); +} + +static int TWIG_INSTANCE_OF_USERLAND(zval *object, char *interface TSRMLS_DC) +{ + zend_class_entry **pce; + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + if (zend_lookup_class(interface, strlen(interface), &pce TSRMLS_CC) == FAILURE) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), *pce TSRMLS_CC); +} + +static zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array.", ce->name); + } + return NULL; + } + + return retval; + } + return NULL; +} + +static int TWIG_ISSET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array.", ce->name); + } + return 0; + } + + return (retval && Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval)); + } + return 0; +} + +static char *TWIG_STRTOLOWER(const char *str, int str_len) +{ + char *item_dup; + + item_dup = estrndup(str, str_len); + php_strtolower(item_dup, str_len); + return item_dup; +} + +static zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments TSRMLS_DC) +{ + zend_fcall_info fci; + zval ***args = NULL; + int arg_count = 0; + HashTable *table; + HashPosition pos; + int i = 0; + zval *retval_ptr; + zval *zfunction; + + if (arguments) { + table = HASH_OF(arguments); + args = safe_emalloc(sizeof(zval **), table->nNumOfElements, 0); + + zend_hash_internal_pointer_reset_ex(table, &pos); + + while (zend_hash_get_current_data_ex(table, (void **)&args[i], &pos) == SUCCESS) { + i++; + zend_hash_move_forward_ex(table, &pos); + } + arg_count = table->nNumOfElements; + } + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, function, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = arg_count; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + ALLOC_INIT_ZVAL(retval_ptr); + ZVAL_BOOL(retval_ptr, 0); + } + + if (args) { + efree(fci.params); + } + FREE_DTOR(zfunction); + return retval_ptr; +} + +static int TWIG_CALL_BOOLEAN(zval *object, char *functionName TSRMLS_DC) +{ + zval *ret; + int res; + + ret = TWIG_CALL_USER_FUNC_ARRAY(object, functionName, NULL TSRMLS_CC); + res = Z_LVAL_P(ret); + zval_ptr_dtor(&ret); + return res; +} + +static zval *TWIG_GET_STATIC_PROPERTY(zval *class, char *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + zend_class_entry *ce; + + if (class == NULL || Z_TYPE_P(class) != IS_OBJECT) { + return NULL; + } + + ce = zend_get_class_entry(class TSRMLS_CC); +#if PHP_VERSION_ID >= 50400 + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0, NULL TSRMLS_CC); +#else + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0 TSRMLS_CC); +#endif + return *tmp_zval; +} + +static zval *TWIG_GET_ARRAY_ELEMENT_ZVAL(zval *class, zval *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL || Z_TYPE_P(class) != IS_ARRAY) { + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + return TWIG_GET_ARRAYOBJECT_ELEMENT(class, prop_name TSRMLS_CC); + } + return NULL; + } + + switch(Z_TYPE_P(prop_name)) { + case IS_NULL: + zend_hash_find(HASH_OF(class), "", 1, (void**) &tmp_zval); + return *tmp_zval; + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(prop_name); + case IS_LONG: + zend_hash_index_find(HASH_OF(class), Z_LVAL_P(prop_name), (void **) &tmp_zval); + return *tmp_zval; + + case IS_STRING: + zend_symtable_find(HASH_OF(class), Z_STRVAL_P(prop_name), Z_STRLEN_P(prop_name) + 1, (void**) &tmp_zval); + return *tmp_zval; + } + + return NULL; +} + +static zval *TWIG_GET_ARRAY_ELEMENT(zval *class, char *prop_name, int prop_name_length TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL/* || Z_TYPE_P(class) != IS_ARRAY*/) { + return NULL; + } + + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + zval *tmp_name_zval; + zval *tmp_ret_zval; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, prop_name, 1); + tmp_ret_zval = TWIG_GET_ARRAYOBJECT_ELEMENT(class, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp_ret_zval; + } + + if (zend_symtable_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { + return *tmp_zval; + } + return NULL; +} + +static zval *TWIG_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + zval *tmp = NULL; + + if (Z_OBJ_HT_P(object)->read_property) { +#if PHP_VERSION_ID >= 50400 + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS, NULL TSRMLS_CC); +#else + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS TSRMLS_CC); +#endif + if (tmp == EG(uninitialized_zval_ptr)) { + ZVAL_NULL(tmp); + } + } + return tmp; +} + +static int TWIG_HAS_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->has_property) { +#if PHP_VERSION_ID >= 50400 + return Z_OBJ_HT_P(object)->has_property(object, propname, 0, NULL TSRMLS_CC); +#else + return Z_OBJ_HT_P(object)->has_property(object, propname, 0 TSRMLS_CC); +#endif + } + return 0; +} + +static int TWIG_HAS_DYNAMIC_PROPERTY(zval *object, char *prop, int prop_len TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->get_properties) { + return zend_hash_quick_exists( + Z_OBJ_HT_P(object)->get_properties(object TSRMLS_CC), // the properties hash + prop, // property name + prop_len + 1, // property length + zend_get_hash_value(prop, prop_len + 1) // hash value + ); + } + return 0; +} + +static zval *TWIG_PROPERTY_CHAR(zval *object, char *propname TSRMLS_DC) +{ + zval *tmp_name_zval, *tmp; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, propname, 1); + tmp = TWIG_PROPERTY(object, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp; +} + +static zval *TWIG_CALL_S(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[1]; + zval *argument; + zval *zfunction; + zval *retval_ptr; + + MAKE_STD_ZVAL(argument); + ZVAL_STRING(argument, arg0, 1); + args[0] = &argument; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 1; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return 0; + } + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return retval_ptr; +} + +static int TWIG_CALL_SB(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zval *retval_ptr; + int success; + + retval_ptr = TWIG_CALL_S(object, method, arg0 TSRMLS_CC); + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +static int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[2]; + zval *zfunction; + zval *retval_ptr; + int success; + + args[0] = &arg1; + args[1] = &arg2; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 2; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + return 0; + } + + FREE_DTOR(zfunction); + + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +#ifndef Z_SET_REFCOUNT_P +# define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc +# define Z_UNSET_ISREF_P(pz) pz->is_ref = 0 +#endif + +static void TWIG_NEW(zval *object, char *class, zval *arg0, zval *arg1 TSRMLS_DC) +{ + zend_class_entry **pce; + + if (zend_lookup_class(class, strlen(class), &pce TSRMLS_CC) == FAILURE) { + return; + } + + Z_TYPE_P(object) = IS_OBJECT; + object_init_ex(object, *pce); + Z_SET_REFCOUNT_P(object, 1); + Z_UNSET_ISREF_P(object); + + TWIG_CALL_ZZ(object, "__construct", arg0, arg1 TSRMLS_CC); +} + +static int twig_add_array_key_to_string(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + smart_str *buf; + char *joiner; + APPLY_TSRMLS_FETCH(); + + buf = va_arg(args, smart_str*); + joiner = va_arg(args, char*); + + if (buf->len != 0) { + smart_str_appends(buf, joiner); + } + + if (hash_key->nKeyLength == 0) { + smart_str_append_long(buf, (long) hash_key->h); + } else { + char *key, *tmp_str; + int key_len, tmp_len; + key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + + smart_str_appendl(buf, tmp_str, tmp_len); + efree(key); + efree(tmp_str); + } + + return 0; +} + +static char *TWIG_IMPLODE_ARRAY_KEYS(char *joiner, zval *array TSRMLS_DC) +{ + smart_str collector = { 0, 0, 0 }; + + smart_str_appendl(&collector, "", 0); + zend_hash_apply_with_arguments(HASH_OF(array) APPLY_TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner); + smart_str_0(&collector); + + return collector.c; +} + +static void TWIG_RUNTIME_ERROR(zval *template TSRMLS_DC, char *message, ...) +{ + char *buffer; + va_list args; + zend_class_entry **pce; + zval *ex; + zval *constructor; + zval *zmessage; + zval *lineno; + zval *filename_func; + zval *filename; + zval *constructor_args[3]; + zval *constructor_retval; + + if (zend_lookup_class("Twig_Error_Runtime", strlen("Twig_Error_Runtime"), &pce TSRMLS_CC) == FAILURE) { + return; + } + + va_start(args, message); + vspprintf(&buffer, 0, message, args); + va_end(args); + + MAKE_STD_ZVAL(ex); + object_init_ex(ex, *pce); + + // Call Twig_Error constructor + MAKE_STD_ZVAL(constructor); + MAKE_STD_ZVAL(zmessage); + MAKE_STD_ZVAL(lineno); + MAKE_STD_ZVAL(filename); + MAKE_STD_ZVAL(filename_func); + MAKE_STD_ZVAL(constructor_retval); + + ZVAL_STRINGL(constructor, "__construct", sizeof("__construct")-1, 1); + ZVAL_STRING(zmessage, buffer, 1); + ZVAL_LONG(lineno, -1); + + // Get template filename + ZVAL_STRINGL(filename_func, "getTemplateName", sizeof("getTemplateName")-1, 1); + call_user_function(EG(function_table), &template, filename_func, filename, 0, 0 TSRMLS_CC); + + constructor_args[0] = zmessage; + constructor_args[1] = lineno; + constructor_args[2] = filename; + call_user_function(EG(function_table), &ex, constructor, constructor_retval, 3, constructor_args TSRMLS_CC); + + zval_ptr_dtor(&constructor_retval); + zval_ptr_dtor(&zmessage); + zval_ptr_dtor(&lineno); + zval_ptr_dtor(&filename); + FREE_DTOR(constructor); + FREE_DTOR(filename_func); + efree(buffer); + + zend_throw_exception_object(ex TSRMLS_CC); +} + +static char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC) +{ + char *class_name; + zend_uint class_name_len; + + if (Z_TYPE_P(object) != IS_OBJECT) { + return ""; + } +#if PHP_API_VERSION >= 20100412 + zend_get_object_classname(object, (const char **) &class_name, &class_name_len TSRMLS_CC); +#else + zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); +#endif + return class_name; +} + +static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *item; + size_t item_len; + zend_function *mptr = (zend_function *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + + item_len = strlen(mptr->common.function_name); + item = estrndup(mptr->common.function_name, item_len); + php_strtolower(item, item_len); + + if (strcmp("getenvironment", item) == 0) { + zend_class_entry **twig_template_ce; + if (zend_lookup_class("Twig_Template", strlen("Twig_Template"), &twig_template_ce TSRMLS_CC) == FAILURE) { + return 0; + } + if (instanceof_function(ce, *twig_template_ce TSRMLS_CC)) { + return 0; + } + } + + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); + + return 0; +} + +static int twig_add_property_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *class_name, *prop_name; + zend_property_info *pptr = (zend_property_info *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(pptr->flags & ZEND_ACC_PUBLIC) || (pptr->flags & ZEND_ACC_STATIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + +#if PHP_API_VERSION >= 20100412 + zend_unmangle_property_name(pptr->name, pptr->name_length, (const char **) &class_name, (const char **) &prop_name); +#else + zend_unmangle_property_name(pptr->name, pptr->name_length, &class_name, &prop_name); +#endif + + add_assoc_string(retval, prop_name, prop_name, 1); + + return 0; +} + +static void twig_add_class_to_cache(zval *cache, zval *object, char *class_name TSRMLS_DC) +{ + zval *class_info, *class_methods, *class_properties; + zend_class_entry *class_ce; + + class_ce = zend_get_class_entry(object TSRMLS_CC); + + ALLOC_INIT_ZVAL(class_info); + ALLOC_INIT_ZVAL(class_methods); + ALLOC_INIT_ZVAL(class_properties); + array_init(class_info); + array_init(class_methods); + array_init(class_properties); + // add all methods to self::cache[$class]['methods'] + zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 2, &class_ce, class_methods); + zend_hash_apply_with_arguments(&class_ce->properties_info APPLY_TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties); + + add_assoc_zval(class_info, "methods", class_methods); + add_assoc_zval(class_info, "properties", class_properties); + add_assoc_zval(cache, class_name, class_info); +} + +/* {{{ proto mixed twig_template_get_attributes(TwigTemplate template, mixed object, mixed item, array arguments, string type, boolean isDefinedTest, boolean ignoreStrictCheck) + A C implementation of TwigTemplate::getAttribute() */ +PHP_FUNCTION(twig_template_get_attributes) +{ + zval *template; + zval *object; + char *item; + int item_len; + zval *zitem, ztmpitem; + zval *arguments = NULL; + zval *ret = NULL; + char *type = NULL; + int type_len = 0; + zend_bool isDefinedTest = 0; + zend_bool ignoreStrictCheck = 0; + int free_ret = 0; + zval *tmp_self_cache; + char *class_name = NULL; + zval *tmp_class; + char *type_name; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ozz|asbb", &template, &object, &zitem, &arguments, &type, &type_len, &isDefinedTest, &ignoreStrictCheck) == FAILURE) { + return; + } + + // convert the item to a string + ztmpitem = *zitem; + zval_copy_ctor(&ztmpitem); + convert_to_string(&ztmpitem); + item_len = Z_STRLEN(ztmpitem); + item = estrndup(Z_STRVAL(ztmpitem), item_len); + zval_dtor(&ztmpitem); + + if (!type) { + type = "any"; + } + +/* + // array + if (\Twig\Template::METHOD_CALL !== $type) { + $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; + + if ((is_array($object) && array_key_exists($arrayItem, $object)) + || ($object instanceof ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } +*/ + + + if (strcmp("method", type) != 0) { + if ((TWIG_ARRAY_KEY_EXISTS(object, zitem)) + || (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC) && TWIG_ISSET_ARRAYOBJECT_ELEMENT(object, zitem TSRMLS_CC)) + ) { + + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + + ret = TWIG_GET_ARRAY_ELEMENT_ZVAL(object, zitem TSRMLS_CC); + + if (!ret) { + ret = &EG(uninitialized_zval); + } + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + efree(item); + return; + } +/* + if (\Twig\Template::ARRAY_CALL === $type) { + if ($isDefinedTest) { + return false; + } + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } +*/ + if (strcmp("array", type) == 0 || Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } +/* + if ($object instanceof ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist', $arrayItem, get_class($object)); + } elseif (is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface', $item, get_class($object)); + } elseif (is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (\Twig\Template::ARRAY_CALL === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + throw new \Twig\Error\RuntimeError($message, -1, $this->getTemplateName()); + } + } +*/ + if (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC)) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" in object with ArrayAccess of class \"%s\" does not exist.", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_OBJECT) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to access a key \"%s\" on an object of class \"%s\" that does not implement ArrayAccess interface.", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_ARRAY) { + if (0 == zend_hash_num_elements(Z_ARRVAL_P(object))) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" does not exist as the array is empty.", item); + } else { + char *array_keys = TWIG_IMPLODE_ARRAY_KEYS(", ", object TSRMLS_CC); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" for array with keys \"%s\" does not exist.", item, array_keys); + efree(array_keys); + } + } else { + char *type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable." + : "Impossible to access an attribute (\"%s\") on a %s variable.", + item, type_name); + } else { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable (\"%s\")." + : "Impossible to access an attribute (\"%s\") on a %s variable (\"%s\").", + item, type_name, Z_STRVAL_P(object)); + } + zval_ptr_dtor(&object); + } + efree(item); + return; + } + } + +/* + if (!is_object($object)) { + if ($isDefinedTest) { + return false; + } +*/ + + if (Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } +/* + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item); + } elseif (is_array($object)) { + $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + + throw new \Twig\Error\RuntimeError($message, -1, $this->getTemplateName()); + } +*/ + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + + type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a null variable.", item); + } else if (Z_TYPE_P(object) == IS_ARRAY) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on an array.", item); + } else { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable (\"%s\").", item, type_name, Z_STRVAL_P(object)); + } + + zval_ptr_dtor(&object); + efree(item); + return; + } +/* + $class = get_class($object); +*/ + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + tmp_self_cache = TWIG_GET_STATIC_PROPERTY(template, "cache" TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + + if (!tmp_class) { + twig_add_class_to_cache(tmp_self_cache, object, class_name TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + } + efree(class_name); + +/* + // object property + if (\Twig\Template::METHOD_CALL !== $type && !$object instanceof \Twig\Template) { + if (isset($object->$item) || array_key_exists((string) $item, $object)) { + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } +*/ + if (strcmp("method", type) != 0 && !TWIG_INSTANCE_OF_USERLAND(object, "Twig_Template" TSRMLS_CC)) { + zval *tmp_properties, *tmp_item; + + tmp_properties = TWIG_GET_ARRAY_ELEMENT(tmp_class, "properties", strlen("properties") TSRMLS_CC); + tmp_item = TWIG_GET_ARRAY_ELEMENT(tmp_properties, item, item_len TSRMLS_CC); + + if (tmp_item || TWIG_HAS_PROPERTY(object, zitem TSRMLS_CC) || TWIG_HAS_DYNAMIC_PROPERTY(object, item, item_len TSRMLS_CC)) { + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "Twig_Extension_Sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "Twig_Extension_Sandbox" TSRMLS_CC), "checkPropertyAllowed", object, zitem TSRMLS_CC); + } + if (EG(exception)) { + efree(item); + return; + } + + ret = TWIG_PROPERTY(object, zitem TSRMLS_CC); + efree(item); + RETURN_ZVAL(ret, 1, 0); + } + } +/* + // object method + if (!isset(self::$cache[$class]['methods'])) { + if ($object instanceof self) { + $ref = new \ReflectionClass($class); + $methods = []; + + foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { + $methodName = strtolower($refMethod->name); + + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== $methodName) { + $methods[$methodName] = true; + } + } + + self::$cache[$class]['methods'] = $methods; + } else { + self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + } + } + + $call = false; + $lcItem = strtolower($item); + if (isset(self::$cache[$class]['methods'][$lcItem])) { + $method = (string) $item; + } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { + $method = 'get'.$item; + } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { + $method = 'is'.$item; + } elseif (isset(self::$cache[$class]['methods']['__call'])) { + $method = (string) $item; + $call = true; +*/ + { + int call = 0; + char *lcItem = TWIG_STRTOLOWER(item, item_len); + int lcItem_length; + char *method = NULL; + char *methodForDeprecation = NULL; + char *tmp_method_name_get; + char *tmp_method_name_is; + zval *zmethod; + zval *tmp_methods; + + lcItem_length = strlen(lcItem); + tmp_method_name_get = emalloc(4 + lcItem_length); + tmp_method_name_is = emalloc(3 + lcItem_length); + + sprintf(tmp_method_name_get, "get%s", lcItem); + sprintf(tmp_method_name_is, "is%s", lcItem); + + tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", strlen("methods") TSRMLS_CC); + methodForDeprecation = emalloc(item_len + 1); + sprintf(methodForDeprecation, "%s", item); + + if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, lcItem, lcItem_length TSRMLS_CC)) { + method = item; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_get, lcItem_length + 3 TSRMLS_CC)) { + method = tmp_method_name_get; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_is, lcItem_length + 2 TSRMLS_CC)) { + method = tmp_method_name_is; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, "__call", 6 TSRMLS_CC)) { + method = item; + call = 1; +/* + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + throw new \Twig\Error\RuntimeError(sprintf('Method "%s" for object "%s" does not exist.', $item, get_class($object)), -1, $this->getTemplateName()); + } + + if ($isDefinedTest) { + return true; + } +*/ + } else { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Neither the property \"%s\" nor one of the methods \"%s()\", \"get%s()\"/\"is%s()\" or \"__call()\" exist and have public access in class \"%s\".", item, item, item, item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + efree(item); + return; + } + + if (isDefinedTest) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + RETURN_TRUE; + } +/* + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method); + } +*/ + MAKE_STD_ZVAL(zmethod); + ZVAL_STRING(zmethod, method, 1); + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "Twig_Extension_Sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "Twig_Extension_Sandbox" TSRMLS_CC), "checkMethodAllowed", object, zmethod TSRMLS_CC); + } + zval_ptr_dtor(&zmethod); + if (EG(exception)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + return; + } +/* + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + $ret = call_user_func_array([$object, $method], $arguments); + } catch (\BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { + return null; + } + throw $e; + } +*/ + ret = TWIG_CALL_USER_FUNC_ARRAY(object, method, arguments TSRMLS_CC); + if (EG(exception) && TWIG_INSTANCE_OF(EG(exception), spl_ce_BadMethodCallException TSRMLS_CC)) { + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + zend_clear_exception(TSRMLS_C); + return; + } + } + free_ret = 1; + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); +/* + // @deprecated in 1.28 + if ($object instanceof Twig_TemplateInterface) { + $self = $object->getTemplateName() === $this->getTemplateName(); + $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()); + if ('renderBlock' === $method || 'displayBlock' === $method) { + $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('hasBlock' === $method) { + $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('render' === $method || 'display' === $method) { + $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName()); + } + @trigger_error($message, E_USER_DEPRECATED); + + return $ret === '' ? '' : new \Twig\Markup($ret, $this->env->getCharset()); + } + + return $ret; +*/ + efree(item); + // ret can be null, if e.g. the called method throws an exception + if (ret) { + if (TWIG_INSTANCE_OF_USERLAND(object, "Twig_TemplateInterface" TSRMLS_CC)) { + int self; + int old_error_reporting; + zval *object_filename; + zval *this_filename; + zval *filename_func; + char *deprecation_message_complement = NULL; + char *deprecation_message = NULL; + + MAKE_STD_ZVAL(object_filename); + MAKE_STD_ZVAL(this_filename); + MAKE_STD_ZVAL(filename_func); + + // Get templates names + ZVAL_STRINGL(filename_func, "getTemplateName", sizeof("getTemplateName")-1, 1); + call_user_function(EG(function_table), &object, filename_func, object_filename, 0, 0 TSRMLS_CC); + ZVAL_STRINGL(filename_func, "getTemplateName", sizeof("getTemplateName")-1, 1); + call_user_function(EG(function_table), &template, filename_func, this_filename, 0, 0 TSRMLS_CC); + + self = (strcmp(Z_STRVAL_P(object_filename), Z_STRVAL_P(this_filename)) == 0); + + if (strcmp(methodForDeprecation, "renderBlock") == 0 || strcmp(methodForDeprecation, "displayBlock") == 0) { + zval **arg0; + zend_hash_index_find(HASH_OF(arguments), 0, (void **) &arg0); + asprintf( + &deprecation_message_complement, + " Use block(\"%s\"%s) instead).", + Z_STRVAL_PP(arg0), + self ? "" : ", template" + ); + } else if (strcmp(methodForDeprecation, "hasBlock") == 0) { + zval **arg0; + zend_hash_index_find(HASH_OF(arguments), 0, (void **) &arg0); + asprintf( + &deprecation_message_complement, + " Use \"block(\"%s\"%s) is defined\" instead).", + Z_STRVAL_PP(arg0), + self ? "" : ", template" + ); + } else if (strcmp(methodForDeprecation, "render") == 0 || strcmp(methodForDeprecation, "display") == 0) { + asprintf( + &deprecation_message_complement, + " Use include(\"%s\") instead).", + Z_STRVAL_P(object_filename) + ); + } else { + deprecation_message_complement = (char*)calloc(0, sizeof(char)); + } + + asprintf( + &deprecation_message, + "Calling \"%s\" on template \"%s\" from template \"%s\" is deprecated since version 1.28 and won't be supported anymore in 2.0.%s", + methodForDeprecation, + Z_STRVAL_P(object_filename), + Z_STRVAL_P(this_filename), + deprecation_message_complement + ); + + old_error_reporting = EG(error_reporting); + EG(error_reporting) = 0; + zend_error(E_USER_DEPRECATED, "%s", deprecation_message); + EG(error_reporting) = old_error_reporting; + + FREE_DTOR(filename_func) + FREE_DTOR(object_filename) + FREE_DTOR(this_filename) + free(deprecation_message); + free(deprecation_message_complement); + + if (Z_STRLEN_P(ret) != 0) { + zval *charset = TWIG_CALL_USER_FUNC_ARRAY(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getCharset", NULL TSRMLS_CC); + TWIG_NEW(return_value, "Twig_Markup", ret, charset TSRMLS_CC); + zval_ptr_dtor(&charset); + if (ret) { + zval_ptr_dtor(&ret); + } + efree(methodForDeprecation); + return; + } + } + + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + } + + efree(methodForDeprecation); + } +} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Autoloader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Autoloader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Autoloader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Autoloader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/BaseNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/BaseNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Cache/Filesystem.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Cache/Filesystem.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Cache/Filesystem.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Cache/Filesystem.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Cache/Null.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Cache/Null.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Cache/Null.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Cache/Null.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/CacheInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/CacheInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/CacheInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/CacheInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Compiler.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Compiler.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Compiler.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Compiler.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/CompilerInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/CompilerInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/CompilerInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/CompilerInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ContainerRuntimeLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ContainerRuntimeLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Environment.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Environment.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Environment.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Environment.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Loader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Loader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Loader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Loader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Runtime.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Runtime.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Runtime.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Runtime.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Syntax.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Syntax.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Error/Syntax.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Error/Syntax.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExistsLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExistsLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExpressionParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExpressionParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExpressionParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExpressionParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Core.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Core.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Core.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Core.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Debug.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Debug.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Debug.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Debug.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Escaper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Escaper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Escaper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Escaper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/GlobalsInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/GlobalsInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Optimizer.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Optimizer.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Optimizer.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Optimizer.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Profiler.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Profiler.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Profiler.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Profiler.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Sandbox.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Sandbox.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Sandbox.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Sandbox.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Staging.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Staging.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/Staging.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/Staging.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/StringLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/StringLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Extension/StringLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Extension/StringLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExtensionInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExtensionInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ExtensionInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ExtensionInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FactoryRuntimeLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FactoryRuntimeLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Function.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Function.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Function.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Function.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Method.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Method.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Method.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Method.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Node.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Node.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Filter/Node.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Filter/Node.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FilterCallableInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FilterCallableInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FilterCallableInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FilterCallableInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FilterInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FilterInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FilterInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FilterInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Function.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Function.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Function.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Function.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Method.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Method.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Method.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Method.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Node.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Node.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Function/Node.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Function/Node.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FunctionCallableInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FunctionCallableInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FunctionInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FunctionInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/FunctionInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/FunctionInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Lexer.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Lexer.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Lexer.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Lexer.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/LexerInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/LexerInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/LexerInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/LexerInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Array.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Array.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Array.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Array.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Chain.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Chain.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Chain.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Chain.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Filesystem.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Filesystem.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/Filesystem.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/Filesystem.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/String.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/String.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Loader/String.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Loader/String.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/LoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/LoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/LoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/LoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Markup.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Markup.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Markup.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Markup.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/AutoEscape.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/AutoEscape.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/AutoEscape.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/AutoEscape.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Block.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Block.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Block.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Block.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/BlockReference.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/BlockReference.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/BlockReference.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/BlockReference.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Body.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Body.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Body.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Body.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/CheckSecurity.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/CheckSecurity.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Deprecated.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Deprecated.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Deprecated.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Deprecated.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Do.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Do.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Do.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Do.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Embed.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Embed.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Embed.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Embed.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Array.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Array.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Array.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Array.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/AssignName.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/AssignName.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Add.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Add.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/And.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/And.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Div.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Div.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/In.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/In.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Less.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Less.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Or.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Or.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Power.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Power.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Range.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Range.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/BlockReference.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/BlockReference.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Call.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Call.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Call.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Call.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Conditional.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Conditional.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Constant.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Constant.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Filter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Filter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Filter/Default.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Filter/Default.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Function.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Function.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Function.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Function.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/GetAttr.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/GetAttr.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/MethodCall.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/MethodCall.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Name.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Name.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Name.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Name.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Parent.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Parent.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/TempName.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/TempName.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Constant.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Constant.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Defined.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Defined.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Even.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Even.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Null.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Null.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Odd.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Odd.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Not.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Not.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Flush.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Flush.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Flush.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Flush.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/For.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/For.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/For.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/For.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/ForLoop.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/ForLoop.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/ForLoop.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/ForLoop.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/If.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/If.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/If.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/If.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Import.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Import.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Import.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Import.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Include.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Include.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Include.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Include.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Macro.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Macro.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Macro.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Macro.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Module.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Module.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Module.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Module.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Print.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Print.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Print.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Print.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Sandbox.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Sandbox.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Sandbox.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Sandbox.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/SandboxedPrint.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/SandboxedPrint.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Set.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Set.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Set.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Set.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/SetTemp.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/SetTemp.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/SetTemp.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/SetTemp.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Spaceless.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Spaceless.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Spaceless.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Spaceless.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Text.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Text.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/Text.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/Text.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/With.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/With.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Node/With.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Node/With.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeCaptureInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeCaptureInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeOutputInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeOutputInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeOutputInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeOutputInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeTraverser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeTraverser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeTraverser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeTraverser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Escaper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Escaper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Optimizer.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Optimizer.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Sandbox.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitor/Sandbox.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitorInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/NodeVisitorInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Parser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Parser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Parser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Parser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ParserInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ParserInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/ParserInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/ParserInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Base.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Base.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Html.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Html.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Text.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Dumper/Text.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Profile.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Profile.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Profiler/Profile.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Profiler/Profile.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/RuntimeLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/RuntimeLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleFilter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleFilter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleFilter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleFilter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleFunction.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleFunction.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleFunction.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleFunction.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SimpleTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SimpleTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Source.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Source.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Source.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Source.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SourceContextLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/SourceContextLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Template.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Template.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Template.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Template.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TemplateInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TemplateInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TemplateInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TemplateInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TemplateWrapper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TemplateWrapper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TemplateWrapper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TemplateWrapper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Function.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Function.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Function.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Function.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/IntegrationTestCase.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Method.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Method.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Method.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Method.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Node.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Node.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/Node.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/Node.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/NodeTestCase.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Test/NodeTestCase.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TestCallableInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TestCallableInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TestCallableInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TestCallableInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TestInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TestInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TestInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TestInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Token.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Token.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Token.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Token.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/AutoEscape.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/AutoEscape.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Block.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Block.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Block.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Block.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Deprecated.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Deprecated.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Deprecated.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Deprecated.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Do.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Do.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Do.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Do.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Embed.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Embed.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Embed.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Embed.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Extends.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Extends.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Extends.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Extends.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Filter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Filter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Filter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Filter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Flush.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Flush.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Flush.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Flush.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/For.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/For.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/For.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/For.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/From.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/From.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/From.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/From.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/If.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/If.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/If.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/If.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Import.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Import.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Import.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Import.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Include.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Include.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Include.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Include.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Macro.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Macro.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Macro.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Macro.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Sandbox.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Sandbox.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Set.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Set.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Set.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Set.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Spaceless.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Spaceless.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Use.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Use.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/Use.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/Use.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/With.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/With.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParser/With.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParser/With.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserBroker.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserBroker.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserBroker.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserBroker.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserBrokerInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserBrokerInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenParserInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenParserInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenStream.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenStream.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/TokenStream.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/TokenStream.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Util/DeprecationCollector.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Util/DeprecationCollector.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Util/TemplateDirIterator.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/lib/Twig/Util/TemplateDirIterator.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/phpunit.xml.dist b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/phpunit.xml.dist new file mode 100644 index 0000000..c35257f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/phpunit.xml.dist @@ -0,0 +1,33 @@ + + + + + + ./test/Twig/ + + + + + + + + + + + + + + + ./src/ + + + diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/CacheInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/CacheInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/CacheInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/CacheInterface.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/FilesystemCache.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/FilesystemCache.php new file mode 100644 index 0000000..7e22879 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/FilesystemCache.php @@ -0,0 +1,93 @@ + + */ +class FilesystemCache implements CacheInterface +{ + const FORCE_BYTECODE_INVALIDATION = 1; + + private $directory; + private $options; + + /** + * @param string $directory The root cache directory + * @param int $options A set of options + */ + public function __construct($directory, $options = 0) + { + $this->directory = rtrim($directory, '\/').'/'; + $this->options = $options; + } + + public function generateKey($name, $className) + { + $hash = hash('sha256', $className); + + return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; + } + + public function load($key) + { + if (file_exists($key)) { + @include_once $key; + } + } + + public function write($key, $content) + { + $dir = \dirname($key); + if (!is_dir($dir)) { + if (false === @mkdir($dir, 0777, true)) { + clearstatcache(true, $dir); + if (!is_dir($dir)) { + throw new \RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); + } + } + } elseif (!is_writable($dir)) { + throw new \RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); + } + + $tmpFile = tempnam($dir, basename($key)); + if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { + @chmod($key, 0666 & ~umask()); + + if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { + // Compile cached file into bytecode cache + if (\function_exists('opcache_invalidate')) { + opcache_invalidate($key, true); + } elseif (\function_exists('apc_compile_file')) { + apc_compile_file($key); + } + } + + return; + } + + throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $key)); + } + + public function getTimestamp($key) + { + if (!file_exists($key)) { + return 0; + } + + return (int) @filemtime($key); + } +} + +class_alias('Twig\Cache\FilesystemCache', 'Twig_Cache_Filesystem'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/NullCache.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/NullCache.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Cache/NullCache.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Cache/NullCache.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Compiler.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Compiler.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Compiler.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Compiler.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Environment.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Environment.php new file mode 100644 index 0000000..ec59daa --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Environment.php @@ -0,0 +1,1638 @@ + + */ +class Environment +{ + const VERSION = '1.41.0'; + const VERSION_ID = 14100; + const MAJOR_VERSION = 1; + const MINOR_VERSION = 41; + const RELEASE_VERSION = 0; + const EXTRA_VERSION = ''; + + protected $charset; + protected $loader; + protected $debug; + protected $autoReload; + protected $cache; + protected $lexer; + protected $parser; + protected $compiler; + protected $baseTemplateClass; + protected $extensions; + protected $parsers; + protected $visitors; + protected $filters; + protected $tests; + protected $functions; + protected $globals; + protected $runtimeInitialized = false; + protected $extensionInitialized = false; + protected $loadedTemplates; + protected $strictVariables; + protected $unaryOperators; + protected $binaryOperators; + protected $templateClassPrefix = '__TwigTemplate_'; + protected $functionCallbacks = []; + protected $filterCallbacks = []; + protected $staging; + + private $originalCache; + private $bcWriteCacheFile = false; + private $bcGetCacheFilename = false; + private $lastModifiedExtension = 0; + private $extensionsByClass = []; + private $runtimeLoaders = []; + private $runtimes = []; + private $optionsHash; + + /** + * Constructor. + * + * Available options: + * + * * debug: When set to true, it automatically set "auto_reload" to true as + * well (default to false). + * + * * charset: The charset used by the templates (default to UTF-8). + * + * * base_template_class: The base template class to use for generated + * templates (default to \Twig\Template). + * + * * cache: An absolute path where to store the compiled templates, + * a \Twig\Cache\CacheInterface implementation, + * or false to disable compilation cache (default). + * + * * auto_reload: Whether to reload the template if the original source changed. + * If you don't provide the auto_reload option, it will be + * determined automatically based on the debug value. + * + * * strict_variables: Whether to ignore invalid variables in templates + * (default to false). + * + * * autoescape: Whether to enable auto-escaping (default to html): + * * false: disable auto-escaping + * * true: equivalent to html + * * html, js: set the autoescaping to one of the supported strategies + * * name: set the autoescaping strategy based on the template name extension + * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" + * + * * optimizations: A flag that indicates which optimizations to apply + * (default to -1 which means that all optimizations are enabled; + * set it to 0 to disable). + */ + public function __construct(LoaderInterface $loader = null, $options = []) + { + if (null !== $loader) { + $this->setLoader($loader); + } else { + @trigger_error('Not passing a "Twig\Lodaer\LoaderInterface" as the first constructor argument of "Twig\Environment" is deprecated since version 1.21.', E_USER_DEPRECATED); + } + + $options = array_merge([ + 'debug' => false, + 'charset' => 'UTF-8', + 'base_template_class' => '\Twig\Template', + 'strict_variables' => false, + 'autoescape' => 'html', + 'cache' => false, + 'auto_reload' => null, + 'optimizations' => -1, + ], $options); + + $this->debug = (bool) $options['debug']; + $this->charset = strtoupper($options['charset']); + $this->baseTemplateClass = $options['base_template_class']; + $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; + $this->strictVariables = (bool) $options['strict_variables']; + $this->setCache($options['cache']); + + $this->addExtension(new CoreExtension()); + $this->addExtension(new EscaperExtension($options['autoescape'])); + $this->addExtension(new OptimizerExtension($options['optimizations'])); + $this->staging = new StagingExtension(); + + // For BC + if (\is_string($this->originalCache)) { + $r = new \ReflectionMethod($this, 'writeCacheFile'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error('The Twig\Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); + + $this->bcWriteCacheFile = true; + } + + $r = new \ReflectionMethod($this, 'getCacheFilename'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error('The Twig\Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); + + $this->bcGetCacheFilename = true; + } + } + } + + /** + * Gets the base template class for compiled templates. + * + * @return string The base template class name + */ + public function getBaseTemplateClass() + { + return $this->baseTemplateClass; + } + + /** + * Sets the base template class for compiled templates. + * + * @param string $class The base template class name + */ + public function setBaseTemplateClass($class) + { + $this->baseTemplateClass = $class; + $this->updateOptionsHash(); + } + + /** + * Enables debugging mode. + */ + public function enableDebug() + { + $this->debug = true; + $this->updateOptionsHash(); + } + + /** + * Disables debugging mode. + */ + public function disableDebug() + { + $this->debug = false; + $this->updateOptionsHash(); + } + + /** + * Checks if debug mode is enabled. + * + * @return bool true if debug mode is enabled, false otherwise + */ + public function isDebug() + { + return $this->debug; + } + + /** + * Enables the auto_reload option. + */ + public function enableAutoReload() + { + $this->autoReload = true; + } + + /** + * Disables the auto_reload option. + */ + public function disableAutoReload() + { + $this->autoReload = false; + } + + /** + * Checks if the auto_reload option is enabled. + * + * @return bool true if auto_reload is enabled, false otherwise + */ + public function isAutoReload() + { + return $this->autoReload; + } + + /** + * Enables the strict_variables option. + */ + public function enableStrictVariables() + { + $this->strictVariables = true; + $this->updateOptionsHash(); + } + + /** + * Disables the strict_variables option. + */ + public function disableStrictVariables() + { + $this->strictVariables = false; + $this->updateOptionsHash(); + } + + /** + * Checks if the strict_variables option is enabled. + * + * @return bool true if strict_variables is enabled, false otherwise + */ + public function isStrictVariables() + { + return $this->strictVariables; + } + + /** + * Gets the current cache implementation. + * + * @param bool $original Whether to return the original cache option or the real cache instance + * + * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function getCache($original = true) + { + return $original ? $this->originalCache : $this->cache; + } + + /** + * Sets the current cache implementation. + * + * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function setCache($cache) + { + if (\is_string($cache)) { + $this->originalCache = $cache; + $this->cache = new FilesystemCache($cache); + } elseif (false === $cache) { + $this->originalCache = $cache; + $this->cache = new NullCache(); + } elseif (null === $cache) { + @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); + $this->originalCache = false; + $this->cache = new NullCache(); + } elseif ($cache instanceof CacheInterface) { + $this->originalCache = $this->cache = $cache; + } else { + throw new \LogicException(sprintf('Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation.')); + } + } + + /** + * Gets the cache filename for a given template. + * + * @param string $name The template name + * + * @return string|false The cache file name or false when caching is disabled + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function getCacheFilename($name) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + $key = $this->cache->generateKey($name, $this->getTemplateClass($name)); + + return !$key ? false : $key; + } + + /** + * Gets the template class associated with the given string. + * + * The generated template class is based on the following parameters: + * + * * The cache key for the given template; + * * The currently enabled extensions; + * * Whether the Twig C extension is available or not; + * * PHP version; + * * Twig version; + * * Options with what environment was created. + * + * @param string $name The name for which to calculate the template class name + * @param int|null $index The index if it is an embedded template + * + * @return string The template class name + */ + public function getTemplateClass($name, $index = null) + { + $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; + + return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index); + } + + /** + * Gets the template class prefix. + * + * @return string The template class prefix + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function getTemplateClassPrefix() + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + return $this->templateClassPrefix; + } + + /** + * Renders a template. + * + * @param string|TemplateWrapper $name The template name + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered template + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function render($name, array $context = []) + { + return $this->load($name)->render($context); + } + + /** + * Displays a template. + * + * @param string|TemplateWrapper $name The template name + * @param array $context An array of parameters to pass to the template + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function display($name, array $context = []) + { + $this->load($name)->display($context); + } + + /** + * Loads a template. + * + * @param string|TemplateWrapper|\Twig\Template $name The template name + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + * + * @return TemplateWrapper + */ + public function load($name) + { + if ($name instanceof TemplateWrapper) { + return $name; + } + + if ($name instanceof Template) { + return new TemplateWrapper($this, $name); + } + + return new TemplateWrapper($this, $this->loadTemplate($name)); + } + + /** + * Loads a template internal representation. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The template name + * @param int $index The index if it is an embedded template + * + * @return \Twig_TemplateInterface A template instance representing the given template name + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + * + * @internal + */ + public function loadTemplate($name, $index = null) + { + return $this->loadClass($this->getTemplateClass($name), $name, $index); + } + + /** + * @internal + */ + public function loadClass($cls, $name, $index = null) + { + $mainCls = $cls; + if (null !== $index) { + $cls .= '___'.$index; + } + + if (isset($this->loadedTemplates[$cls])) { + return $this->loadedTemplates[$cls]; + } + + if (!class_exists($cls, false)) { + if ($this->bcGetCacheFilename) { + $key = $this->getCacheFilename($name); + } else { + $key = $this->cache->generateKey($name, $mainCls); + } + + if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { + $this->cache->load($key); + } + + $source = null; + if (!class_exists($cls, false)) { + $loader = $this->getLoader(); + if (!$loader instanceof SourceContextLoaderInterface) { + $source = new Source($loader->getSource($name), $name); + } else { + $source = $loader->getSourceContext($name); + } + + $content = $this->compileSource($source); + + if ($this->bcWriteCacheFile) { + $this->writeCacheFile($key, $content); + } else { + $this->cache->write($key, $content); + $this->cache->load($key); + } + + if (!class_exists($mainCls, false)) { + /* Last line of defense if either $this->bcWriteCacheFile was used, + * $this->cache is implemented as a no-op or we have a race condition + * where the cache was cleared between the above calls to write to and load from + * the cache. + */ + eval('?>'.$content); + } + } + + if (!class_exists($cls, false)) { + throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); + } + } + + if (!$this->runtimeInitialized) { + $this->initRuntime(); + } + + return $this->loadedTemplates[$cls] = new $cls($this); + } + + /** + * Creates a template from source. + * + * This method should not be used as a generic way to load templates. + * + * @param string $template The template name + * @param string $name An optional name of the template to be used in error messages + * + * @return TemplateWrapper A template instance representing the given template name + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + */ + public function createTemplate($template, $name = null) + { + $hash = hash('sha256', $template, false); + if (null !== $name) { + $name = sprintf('%s (string template %s)', $name, $hash); + } else { + $name = sprintf('__string_template__%s', $hash); + } + + $loader = new ChainLoader([ + new ArrayLoader([$name => $template]), + $current = $this->getLoader(), + ]); + + $this->setLoader($loader); + try { + $template = new TemplateWrapper($this, $this->loadTemplate($name)); + } catch (\Exception $e) { + $this->setLoader($current); + + throw $e; + } catch (\Throwable $e) { + $this->setLoader($current); + + throw $e; + } + $this->setLoader($current); + + return $template; + } + + /** + * Returns true if the template is still fresh. + * + * Besides checking the loader for freshness information, + * this method also checks if the enabled extensions have + * not changed. + * + * @param string $name The template name + * @param int $time The last modification time of the cached template + * + * @return bool true if the template is fresh, false otherwise + */ + public function isTemplateFresh($name, $time) + { + if (0 === $this->lastModifiedExtension) { + foreach ($this->extensions as $extension) { + $r = new \ReflectionObject($extension); + if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) { + $this->lastModifiedExtension = $extensionTime; + } + } + } + + return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time); + } + + /** + * Tries to load a template consecutively from an array. + * + * Similar to load() but it also accepts instances of \Twig\Template and + * \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded. + * + * @param string|Template|\Twig\TemplateWrapper|array $names A template or an array of templates to try consecutively + * + * @return TemplateWrapper|Template + * + * @throws LoaderError When none of the templates can be found + * @throws SyntaxError When an error occurred during compilation + */ + public function resolveTemplate($names) + { + if (!\is_array($names)) { + $names = [$names]; + } + + foreach ($names as $name) { + if ($name instanceof Template) { + return $name; + } + if ($name instanceof TemplateWrapper) { + return $name; + } + + try { + return $this->loadTemplate($name); + } catch (LoaderError $e) { + if (1 === \count($names)) { + throw $e; + } + } + } + + throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); + } + + /** + * Clears the internal template cache. + * + * @deprecated since 1.18.3 (to be removed in 2.0) + */ + public function clearTemplateCache() + { + @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); + + $this->loadedTemplates = []; + } + + /** + * Clears the template cache files on the filesystem. + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function clearCacheFiles() + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + if (\is_string($this->originalCache)) { + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->originalCache), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if ($file->isFile()) { + @unlink($file->getPathname()); + } + } + } + } + + /** + * Gets the Lexer instance. + * + * @return \Twig_LexerInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getLexer() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->lexer) { + $this->lexer = new Lexer($this); + } + + return $this->lexer; + } + + public function setLexer(\Twig_LexerInterface $lexer) + { + $this->lexer = $lexer; + } + + /** + * Tokenizes a source code. + * + * @param string|Source $source The template source code + * @param string $name The template name (deprecated) + * + * @return TokenStream + * + * @throws SyntaxError When the code is syntactically wrong + */ + public function tokenize($source, $name = null) + { + if (!$source instanceof Source) { + @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $source = new Source($source, $name); + } + + if (null === $this->lexer) { + $this->lexer = new Lexer($this); + } + + return $this->lexer->tokenize($source); + } + + /** + * Gets the Parser instance. + * + * @return \Twig_ParserInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getParser() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->parser) { + $this->parser = new Parser($this); + } + + return $this->parser; + } + + public function setParser(\Twig_ParserInterface $parser) + { + $this->parser = $parser; + } + + /** + * Converts a token stream to a node tree. + * + * @return ModuleNode + * + * @throws SyntaxError When the token stream is syntactically or semantically wrong + */ + public function parse(TokenStream $stream) + { + if (null === $this->parser) { + $this->parser = new Parser($this); + } + + return $this->parser->parse($stream); + } + + /** + * Gets the Compiler instance. + * + * @return \Twig_CompilerInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getCompiler() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->compiler) { + $this->compiler = new Compiler($this); + } + + return $this->compiler; + } + + public function setCompiler(\Twig_CompilerInterface $compiler) + { + $this->compiler = $compiler; + } + + /** + * Compiles a node and returns the PHP code. + * + * @return string The compiled PHP source code + */ + public function compile(\Twig_NodeInterface $node) + { + if (null === $this->compiler) { + $this->compiler = new Compiler($this); + } + + return $this->compiler->compile($node)->getSource(); + } + + /** + * Compiles a template source code. + * + * @param string|Source $source The template source code + * @param string $name The template name (deprecated) + * + * @return string The compiled PHP source code + * + * @throws SyntaxError When there was an error during tokenizing, parsing or compiling + */ + public function compileSource($source, $name = null) + { + if (!$source instanceof Source) { + @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $source = new Source($source, $name); + } + + try { + return $this->compile($this->parse($this->tokenize($source))); + } catch (Error $e) { + $e->setSourceContext($source); + throw $e; + } catch (\Exception $e) { + throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); + } + } + + public function setLoader(LoaderInterface $loader) + { + if (!$loader instanceof SourceContextLoaderInterface && 0 !== strpos(\get_class($loader), 'Mock_')) { + @trigger_error(sprintf('Twig loader "%s" should implement Twig\Loader\SourceContextLoaderInterface since version 1.27.', \get_class($loader)), E_USER_DEPRECATED); + } + + $this->loader = $loader; + } + + /** + * Gets the Loader instance. + * + * @return LoaderInterface + */ + public function getLoader() + { + if (null === $this->loader) { + throw new \LogicException('You must set a loader first.'); + } + + return $this->loader; + } + + /** + * Sets the default template charset. + * + * @param string $charset The default charset + */ + public function setCharset($charset) + { + $this->charset = strtoupper($charset); + } + + /** + * Gets the default template charset. + * + * @return string The default charset + */ + public function getCharset() + { + return $this->charset; + } + + /** + * Initializes the runtime environment. + * + * @deprecated since 1.23 (to be removed in 2.0) + */ + public function initRuntime() + { + $this->runtimeInitialized = true; + + foreach ($this->getExtensions() as $name => $extension) { + if (!$extension instanceof InitRuntimeInterface) { + $m = new \ReflectionMethod($extension, 'initRuntime'); + + $parentClass = $m->getDeclaringClass()->getName(); + if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { + @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the \Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig\Extension\InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED); + } + } + + $extension->initRuntime($this); + } + } + + /** + * Returns true if the given extension is registered. + * + * @param string $class The extension class name + * + * @return bool Whether the extension is registered or not + */ + public function hasExtension($class) + { + $class = ltrim($class, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @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); + } + + return true; + } + + return isset($this->extensionsByClass[$class]); + } + + /** + * Adds a runtime loader. + */ + public function addRuntimeLoader(RuntimeLoaderInterface $loader) + { + $this->runtimeLoaders[] = $loader; + } + + /** + * Gets an extension by class name. + * + * @param string $class The extension class name + * + * @return ExtensionInterface + */ + public function getExtension($class) + { + $class = ltrim($class, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @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); + } + + return $this->extensions[$class]; + } + + if (!isset($this->extensionsByClass[$class])) { + throw new RuntimeError(sprintf('The "%s" extension is not enabled.', $class)); + } + + return $this->extensionsByClass[$class]; + } + + /** + * Returns the runtime implementation of a Twig element (filter/function/test). + * + * @param string $class A runtime class name + * + * @return object The runtime implementation + * + * @throws RuntimeError When the template cannot be found + */ + public function getRuntime($class) + { + if (isset($this->runtimes[$class])) { + return $this->runtimes[$class]; + } + + foreach ($this->runtimeLoaders as $loader) { + if (null !== $runtime = $loader->load($class)) { + return $this->runtimes[$class] = $runtime; + } + } + + throw new RuntimeError(sprintf('Unable to load the "%s" runtime.', $class)); + } + + public function addExtension(ExtensionInterface $extension) + { + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); + } + + $class = \get_class($extension); + if ($class !== $extension->getName()) { + if (isset($this->extensions[$extension->getName()])) { + unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]); + @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); + } + } + + $this->lastModifiedExtension = 0; + $this->extensionsByClass[$class] = $extension; + $this->extensions[$extension->getName()] = $extension; + $this->updateOptionsHash(); + } + + /** + * Removes an extension by name. + * + * This method is deprecated and you should not use it. + * + * @param string $name The extension name + * + * @deprecated since 1.12 (to be removed in 2.0) + */ + public function removeExtension($name) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); + } + + $class = ltrim($name, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @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); + } + + unset($this->extensions[$class]); + } + + unset($this->extensions[$class]); + $this->updateOptionsHash(); + } + + /** + * Registers an array of extensions. + * + * @param array $extensions An array of extensions + */ + public function setExtensions(array $extensions) + { + foreach ($extensions as $extension) { + $this->addExtension($extension); + } + } + + /** + * Returns all registered extensions. + * + * @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) + */ + public function getExtensions() + { + return $this->extensions; + } + + public function addTokenParser(TokenParserInterface $parser) + { + if ($this->extensionInitialized) { + throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); + } + + $this->staging->addTokenParser($parser); + } + + /** + * Gets the registered Token Parsers. + * + * @return \Twig_TokenParserBrokerInterface + * + * @internal + */ + public function getTokenParsers() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->parsers; + } + + /** + * Gets registered tags. + * + * Be warned that this method cannot return tags defined by \Twig_TokenParserBrokerInterface classes. + * + * @return TokenParserInterface[] + * + * @internal + */ + public function getTags() + { + $tags = []; + foreach ($this->getTokenParsers()->getParsers() as $parser) { + if ($parser instanceof TokenParserInterface) { + $tags[$parser->getTag()] = $parser; + } + } + + return $tags; + } + + public function addNodeVisitor(NodeVisitorInterface $visitor) + { + if ($this->extensionInitialized) { + throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); + } + + $this->staging->addNodeVisitor($visitor); + } + + /** + * Gets the registered Node Visitors. + * + * @return NodeVisitorInterface[] + * + * @internal + */ + public function getNodeVisitors() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->visitors; + } + + /** + * Registers a Filter. + * + * @param string|TwigFilter $name The filter name or a \Twig_SimpleFilter instance + * @param \Twig_FilterInterface|TwigFilter $filter + */ + public function addFilter($name, $filter = null) + { + if (!$name instanceof TwigFilter && !($filter instanceof TwigFilter || $filter instanceof \Twig_FilterInterface)) { + throw new \LogicException('A filter must be an instance of \Twig_FilterInterface or \Twig_SimpleFilter.'); + } + + if ($name instanceof TwigFilter) { + $filter = $name; + $name = $filter->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFilter($name, $filter); + } + + /** + * Get a filter by name. + * + * Subclasses may override this method and load filters differently; + * so no list of filters is available. + * + * @param string $name The filter name + * + * @return \Twig_Filter|false + * + * @internal + */ + public function getFilter($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->filters[$name])) { + return $this->filters[$name]; + } + + foreach ($this->filters as $pattern => $filter) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $filter->setArguments($matches); + + return $filter; + } + } + } + + foreach ($this->filterCallbacks as $callback) { + if (false !== $filter = \call_user_func($callback, $name)) { + return $filter; + } + } + + return false; + } + + public function registerUndefinedFilterCallback($callable) + { + $this->filterCallbacks[] = $callable; + } + + /** + * Gets the registered Filters. + * + * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. + * + * @return \Twig_FilterInterface[] + * + * @see registerUndefinedFilterCallback + * + * @internal + */ + public function getFilters() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->filters; + } + + /** + * Registers a Test. + * + * @param string|TwigTest $name The test name or a \Twig_SimpleTest instance + * @param \Twig_TestInterface|TwigTest $test A \Twig_TestInterface instance or a \Twig_SimpleTest instance + */ + public function addTest($name, $test = null) + { + if (!$name instanceof TwigTest && !($test instanceof TwigTest || $test instanceof \Twig_TestInterface)) { + throw new \LogicException('A test must be an instance of \Twig_TestInterface or \Twig_SimpleTest.'); + } + + if ($name instanceof TwigTest) { + $test = $name; + $name = $test->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addTest($name, $test); + } + + /** + * Gets the registered Tests. + * + * @return \Twig_TestInterface[] + * + * @internal + */ + public function getTests() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->tests; + } + + /** + * Gets a test by name. + * + * @param string $name The test name + * + * @return \Twig_Test|false + * + * @internal + */ + public function getTest($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->tests[$name])) { + return $this->tests[$name]; + } + + foreach ($this->tests as $pattern => $test) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $test->setArguments($matches); + + return $test; + } + } + } + + return false; + } + + /** + * Registers a Function. + * + * @param string|TwigFunction $name The function name or a \Twig_SimpleFunction instance + * @param \Twig_FunctionInterface|TwigFunction $function + */ + public function addFunction($name, $function = null) + { + if (!$name instanceof TwigFunction && !($function instanceof TwigFunction || $function instanceof \Twig_FunctionInterface)) { + throw new \LogicException('A function must be an instance of \Twig_FunctionInterface or \Twig_SimpleFunction.'); + } + + if ($name instanceof TwigFunction) { + $function = $name; + $name = $function->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFunction($name, $function); + } + + /** + * Get a function by name. + * + * Subclasses may override this method and load functions differently; + * so no list of functions is available. + * + * @param string $name function name + * + * @return \Twig_Function|false + * + * @internal + */ + public function getFunction($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->functions[$name])) { + return $this->functions[$name]; + } + + foreach ($this->functions as $pattern => $function) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $function->setArguments($matches); + + return $function; + } + } + } + + foreach ($this->functionCallbacks as $callback) { + if (false !== $function = \call_user_func($callback, $name)) { + return $function; + } + } + + return false; + } + + public function registerUndefinedFunctionCallback($callable) + { + $this->functionCallbacks[] = $callable; + } + + /** + * Gets registered functions. + * + * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. + * + * @return \Twig_FunctionInterface[] + * + * @see registerUndefinedFunctionCallback + * + * @internal + */ + public function getFunctions() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->functions; + } + + /** + * Registers a Global. + * + * New globals can be added before compiling or rendering a template; + * but after, you can only update existing globals. + * + * @param string $name The global name + * @param mixed $value The global value + */ + public function addGlobal($name, $value) + { + if ($this->extensionInitialized || $this->runtimeInitialized) { + if (null === $this->globals) { + $this->globals = $this->initGlobals(); + } + + if (!\array_key_exists($name, $this->globals)) { + // The deprecation notice must be turned into the following exception in Twig 2.0 + @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); + //throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); + } + } + + if ($this->extensionInitialized || $this->runtimeInitialized) { + // update the value + $this->globals[$name] = $value; + } else { + $this->staging->addGlobal($name, $value); + } + } + + /** + * Gets the registered Globals. + * + * @return array An array of globals + * + * @internal + */ + public function getGlobals() + { + if (!$this->runtimeInitialized && !$this->extensionInitialized) { + return $this->initGlobals(); + } + + if (null === $this->globals) { + $this->globals = $this->initGlobals(); + } + + return $this->globals; + } + + /** + * Merges a context with the defined globals. + * + * @param array $context An array representing the context + * + * @return array The context merged with the globals + */ + public function mergeGlobals(array $context) + { + // we don't use array_merge as the context being generally + // bigger than globals, this code is faster. + foreach ($this->getGlobals() as $key => $value) { + if (!\array_key_exists($key, $context)) { + $context[$key] = $value; + } + } + + return $context; + } + + /** + * Gets the registered unary Operators. + * + * @return array An array of unary operators + * + * @internal + */ + public function getUnaryOperators() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->unaryOperators; + } + + /** + * Gets the registered binary Operators. + * + * @return array An array of binary operators + * + * @internal + */ + public function getBinaryOperators() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->binaryOperators; + } + + /** + * @deprecated since 1.23 (to be removed in 2.0) + */ + public function computeAlternatives($name, $items) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + return SyntaxError::computeAlternatives($name, $items); + } + + /** + * @internal + */ + protected function initGlobals() + { + $globals = []; + foreach ($this->extensions as $name => $extension) { + if (!$extension instanceof GlobalsInterface) { + $m = new \ReflectionMethod($extension, 'getGlobals'); + + $parentClass = $m->getDeclaringClass()->getName(); + if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { + @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig\Extension\GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED); + } + } + + $extGlob = $extension->getGlobals(); + if (!\is_array($extGlob)) { + throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); + } + + $globals[] = $extGlob; + } + + $globals[] = $this->staging->getGlobals(); + + return \call_user_func_array('array_merge', $globals); + } + + /** + * @internal + */ + protected function initExtensions() + { + if ($this->extensionInitialized) { + return; + } + + $this->parsers = new \Twig_TokenParserBroker([], [], false); + $this->filters = []; + $this->functions = []; + $this->tests = []; + $this->visitors = []; + $this->unaryOperators = []; + $this->binaryOperators = []; + + foreach ($this->extensions as $extension) { + $this->initExtension($extension); + } + $this->initExtension($this->staging); + // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception + $this->extensionInitialized = true; + } + + /** + * @internal + */ + protected function initExtension(ExtensionInterface $extension) + { + // filters + foreach ($extension->getFilters() as $name => $filter) { + if ($filter instanceof TwigFilter) { + $name = $filter->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use \Twig_SimpleFilter instead.', \get_class($filter), $name), E_USER_DEPRECATED); + } + + $this->filters[$name] = $filter; + } + + // functions + foreach ($extension->getFunctions() as $name => $function) { + if ($function instanceof TwigFunction) { + $name = $function->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use \Twig_SimpleFunction instead.', \get_class($function), $name), E_USER_DEPRECATED); + } + + $this->functions[$name] = $function; + } + + // tests + foreach ($extension->getTests() as $name => $test) { + if ($test instanceof TwigTest) { + $name = $test->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use \Twig_SimpleTest instead.', \get_class($test), $name), E_USER_DEPRECATED); + } + + $this->tests[$name] = $test; + } + + // token parsers + foreach ($extension->getTokenParsers() as $parser) { + if ($parser instanceof TokenParserInterface) { + $this->parsers->addTokenParser($parser); + } elseif ($parser instanceof \Twig_TokenParserBrokerInterface) { + @trigger_error('Registering a \Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED); + + $this->parsers->addTokenParserBroker($parser); + } else { + throw new \LogicException('getTokenParsers() must return an array of \Twig_TokenParserInterface or \Twig_TokenParserBrokerInterface instances.'); + } + } + + // node visitors + foreach ($extension->getNodeVisitors() as $visitor) { + $this->visitors[] = $visitor; + } + + // operators + if ($operators = $extension->getOperators()) { + if (!\is_array($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators))); + } + + if (2 !== \count($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); + } + + $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); + $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); + } + } + + /** + * @deprecated since 1.22 (to be removed in 2.0) + */ + protected function writeCacheFile($file, $content) + { + $this->cache->write($file, $content); + } + + private function updateOptionsHash() + { + $hashParts = array_merge( + array_keys($this->extensions), + [ + (int) \function_exists('twig_template_get_attributes'), + PHP_MAJOR_VERSION, + PHP_MINOR_VERSION, + self::VERSION, + (int) $this->debug, + $this->baseTemplateClass, + (int) $this->strictVariables, + ] + ); + $this->optionsHash = implode(':', $hashParts); + } +} + +class_alias('Twig\Environment', 'Twig_Environment'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Error/Error.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/Error.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Error/Error.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/Error.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Error/LoaderError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/LoaderError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Error/LoaderError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/LoaderError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Error/RuntimeError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/RuntimeError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Error/RuntimeError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/RuntimeError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Error/SyntaxError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/SyntaxError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Error/SyntaxError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Error/SyntaxError.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/ExpressionParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/ExpressionParser.php new file mode 100644 index 0000000..d19cb58 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/ExpressionParser.php @@ -0,0 +1,828 @@ + + * + * @internal + */ +class ExpressionParser +{ + const OPERATOR_LEFT = 1; + const OPERATOR_RIGHT = 2; + + protected $parser; + protected $unaryOperators; + protected $binaryOperators; + + private $env; + + public function __construct(Parser $parser, $env = null) + { + $this->parser = $parser; + + if ($env instanceof Environment) { + $this->env = $env; + $this->unaryOperators = $env->getUnaryOperators(); + $this->binaryOperators = $env->getBinaryOperators(); + } else { + @trigger_error('Passing the operators as constructor arguments to '.__METHOD__.' is deprecated since version 1.27. Pass the environment instead.', E_USER_DEPRECATED); + + $this->env = $parser->getEnvironment(); + $this->unaryOperators = func_get_arg(1); + $this->binaryOperators = func_get_arg(2); + } + } + + public function parseExpression($precedence = 0, $allowArrow = false) + { + if ($allowArrow && $arrow = $this->parseArrow()) { + return $arrow; + } + + $expr = $this->getPrimary(); + $token = $this->parser->getCurrentToken(); + while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { + $op = $this->binaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + + if ('is not' === $token->getValue()) { + $expr = $this->parseNotTestExpression($expr); + } elseif ('is' === $token->getValue()) { + $expr = $this->parseTestExpression($expr); + } elseif (isset($op['callable'])) { + $expr = \call_user_func($op['callable'], $this->parser, $expr); + } else { + $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); + $class = $op['class']; + $expr = new $class($expr, $expr1, $token->getLine()); + } + + $token = $this->parser->getCurrentToken(); + } + + if (0 === $precedence) { + return $this->parseConditionalExpression($expr); + } + + return $expr; + } + + /** + * @return ArrowFunctionExpression|null + */ + private function parseArrow() + { + $stream = $this->parser->getStream(); + + // short array syntax (one argument, no parentheses)? + if ($stream->look(1)->test(Token::ARROW_TYPE)) { + $line = $stream->getCurrent()->getLine(); + $token = $stream->expect(Token::NAME_TYPE); + $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; + $stream->expect(Token::ARROW_TYPE); + + return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); + } + + // first, determine if we are parsing an arrow function by finding => (long form) + $i = 0; + if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, '(')) { + return null; + } + ++$i; + while (true) { + // variable name + ++$i; + if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ',')) { + break; + } + ++$i; + } + if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ')')) { + return null; + } + ++$i; + if (!$stream->look($i)->test(Token::ARROW_TYPE)) { + return null; + } + + // yes, let's parse it properly + $token = $stream->expect(Token::PUNCTUATION_TYPE, '('); + $line = $token->getLine(); + + $names = []; + while (true) { + $token = $stream->expect(Token::NAME_TYPE); + $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ')'); + $stream->expect(Token::ARROW_TYPE); + + return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); + } + + protected function getPrimary() + { + $token = $this->parser->getCurrentToken(); + + if ($this->isUnary($token)) { + $operator = $this->unaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + $expr = $this->parseExpression($operator['precedence']); + $class = $operator['class']; + + return $this->parsePostfixExpression(new $class($expr, $token->getLine())); + } elseif ($token->test(Token::PUNCTUATION_TYPE, '(')) { + $this->parser->getStream()->next(); + $expr = $this->parseExpression(); + $this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); + + return $this->parsePostfixExpression($expr); + } + + return $this->parsePrimaryExpression(); + } + + protected function parseConditionalExpression($expr) + { + while ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, '?')) { + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $expr2 = $this->parseExpression(); + if ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $expr3 = $this->parseExpression(); + } else { + $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); + } + } else { + $expr2 = $expr; + $expr3 = $this->parseExpression(); + } + + $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); + } + + return $expr; + } + + protected function isUnary(Token $token) + { + return $token->test(Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); + } + + protected function isBinary(Token $token) + { + return $token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); + } + + public function parsePrimaryExpression() + { + $token = $this->parser->getCurrentToken(); + switch ($token->getType()) { + case Token::NAME_TYPE: + $this->parser->getStream()->next(); + switch ($token->getValue()) { + case 'true': + case 'TRUE': + $node = new ConstantExpression(true, $token->getLine()); + break; + + case 'false': + case 'FALSE': + $node = new ConstantExpression(false, $token->getLine()); + break; + + case 'none': + case 'NONE': + case 'null': + case 'NULL': + $node = new ConstantExpression(null, $token->getLine()); + break; + + default: + if ('(' === $this->parser->getCurrentToken()->getValue()) { + $node = $this->getFunctionNode($token->getValue(), $token->getLine()); + } else { + $node = new NameExpression($token->getValue(), $token->getLine()); + } + } + break; + + case Token::NUMBER_TYPE: + $this->parser->getStream()->next(); + $node = new ConstantExpression($token->getValue(), $token->getLine()); + break; + + case Token::STRING_TYPE: + case Token::INTERPOLATION_START_TYPE: + $node = $this->parseStringExpression(); + break; + + case Token::OPERATOR_TYPE: + if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { + // in this context, string operators are variable names + $this->parser->getStream()->next(); + $node = new NameExpression($token->getValue(), $token->getLine()); + break; + } elseif (isset($this->unaryOperators[$token->getValue()])) { + $class = $this->unaryOperators[$token->getValue()]['class']; + + $ref = new \ReflectionClass($class); + $negClass = 'Twig\Node\Expression\Unary\NegUnary'; + $posClass = 'Twig\Node\Expression\Unary\PosUnary'; + if (!(\in_array($ref->getName(), [$negClass, $posClass, 'Twig_Node_Expression_Unary_Neg', 'Twig_Node_Expression_Unary_Pos']) + || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass) + || $ref->isSubclassOf('Twig_Node_Expression_Unary_Neg') || $ref->isSubclassOf('Twig_Node_Expression_Unary_Pos')) + ) { + throw new SyntaxError(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + + $this->parser->getStream()->next(); + $expr = $this->parsePrimaryExpression(); + + $node = new $class($expr, $token->getLine()); + break; + } + + // no break + default: + if ($token->test(Token::PUNCTUATION_TYPE, '[')) { + $node = $this->parseArrayExpression(); + } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { + $node = $this->parseHashExpression(); + } elseif ($token->test(Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { + throw new SyntaxError(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } else { + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + } + + return $this->parsePostfixExpression($node); + } + + public function parseStringExpression() + { + $stream = $this->parser->getStream(); + + $nodes = []; + // a string cannot be followed by another string in a single expression + $nextCanBeString = true; + while (true) { + if ($nextCanBeString && $token = $stream->nextIf(Token::STRING_TYPE)) { + $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); + $nextCanBeString = false; + } elseif ($stream->nextIf(Token::INTERPOLATION_START_TYPE)) { + $nodes[] = $this->parseExpression(); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $nextCanBeString = true; + } else { + break; + } + } + + $expr = array_shift($nodes); + foreach ($nodes as $node) { + $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); + } + + return $expr; + } + + public function parseArrayExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, ']')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + break; + } + } + $first = false; + + $node->addElement($this->parseExpression()); + } + $stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); + + return $node; + } + + public function parseHashExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { + break; + } + } + $first = false; + + // a hash key can be: + // + // * a number -- 12 + // * a string -- 'a' + // * a name, which is equivalent to a string -- a + // * an expression, which must be enclosed in parentheses -- (1 + 2) + if (($token = $stream->nextIf(Token::STRING_TYPE)) || ($token = $stream->nextIf(Token::NAME_TYPE)) || $token = $stream->nextIf(Token::NUMBER_TYPE)) { + $key = new ConstantExpression($token->getValue(), $token->getLine()); + } elseif ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $key = $this->parseExpression(); + } else { + $current = $stream->getCurrent(); + + throw new SyntaxError(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".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); + } + + $stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); + $value = $this->parseExpression(); + + $node->addElement($value, $key); + } + $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); + + return $node; + } + + public function parsePostfixExpression($node) + { + while (true) { + $token = $this->parser->getCurrentToken(); + if (Token::PUNCTUATION_TYPE == $token->getType()) { + if ('.' == $token->getValue() || '[' == $token->getValue()) { + $node = $this->parseSubscriptExpression($node); + } elseif ('|' == $token->getValue()) { + $node = $this->parseFilterExpression($node); + } else { + break; + } + } else { + break; + } + } + + return $node; + } + + public function getFunctionNode($name, $line) + { + switch ($name) { + case 'parent': + $this->parseArguments(); + if (!\count($this->parser->getBlockStack())) { + throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + if (!$this->parser->getParent() && !$this->parser->hasTraits()) { + throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + return new ParentExpression($this->parser->peekBlockStack(), $line); + case 'block': + $args = $this->parseArguments(); + if (\count($args) < 1) { + throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); + case 'attribute': + $args = $this->parseArguments(); + if (\count($args) < 2) { + throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, Template::ANY_CALL, $line); + default: + if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { + $arguments = new ArrayExpression([], $line); + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + + $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); + $node->setAttribute('safe', true); + + return $node; + } + + $args = $this->parseArguments(true); + $class = $this->getFunctionNodeClass($name, $line); + + return new $class($name, $args, $line); + } + } + + public function parseSubscriptExpression($node) + { + $stream = $this->parser->getStream(); + $token = $stream->next(); + $lineno = $token->getLine(); + $arguments = new ArrayExpression([], $lineno); + $type = Template::ANY_CALL; + if ('.' == $token->getValue()) { + $token = $stream->next(); + if ( + Token::NAME_TYPE == $token->getType() + || + Token::NUMBER_TYPE == $token->getType() + || + (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) + ) { + $arg = new ConstantExpression($token->getValue(), $lineno); + + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $type = Template::METHOD_CALL; + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + } + } else { + throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); + } + + if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { + if (!$arg instanceof ConstantExpression) { + throw new SyntaxError(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); + } + + $name = $arg->getAttribute('value'); + + if ($this->parser->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); + } + + $node = new MethodCallExpression($node, 'get'.$name, $arguments, $lineno); + $node->setAttribute('safe', true); + + return $node; + } + } else { + $type = Template::ARRAY_CALL; + + // slice? + $slice = false; + if ($stream->test(Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + $arg = new ConstantExpression(0, $token->getLine()); + } else { + $arg = $this->parseExpression(); + } + + if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + } + + if ($slice) { + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + $length = new ConstantExpression(null, $token->getLine()); + } else { + $length = $this->parseExpression(); + } + + $class = $this->getFilterNodeClass('slice', $token->getLine()); + $arguments = new Node([$arg, $length]); + $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + + return $filter; + } + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + } + + return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); + } + + public function parseFilterExpression($node) + { + $this->parser->getStream()->next(); + + return $this->parseFilterExpressionRaw($node); + } + + public function parseFilterExpressionRaw($node, $tag = null) + { + while (true) { + $token = $this->parser->getStream()->expect(Token::NAME_TYPE); + + $name = new ConstantExpression($token->getValue(), $token->getLine()); + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = new Node(); + } else { + $arguments = $this->parseArguments(true, false, true); + } + + $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); + + $node = new $class($node, $name, $arguments, $token->getLine(), $tag); + + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '|')) { + break; + } + + $this->parser->getStream()->next(); + } + + return $node; + } + + /** + * Parses arguments. + * + * @param bool $namedArguments Whether to allow named arguments or not + * @param bool $definition Whether we are parsing arguments for a function definition + * + * @return Node + * + * @throws SyntaxError + */ + public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) + { + $args = []; + $stream = $this->parser->getStream(); + + $stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); + while (!$stream->test(Token::PUNCTUATION_TYPE, ')')) { + if (!empty($args)) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); + } + + if ($definition) { + $token = $stream->expect(Token::NAME_TYPE, null, 'An argument must be a name'); + $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); + } else { + $value = $this->parseExpression(0, $allowArrow); + } + + $name = null; + if ($namedArguments && $token = $stream->nextIf(Token::OPERATOR_TYPE, '=')) { + if (!$value instanceof NameExpression) { + throw new SyntaxError(sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); + } + $name = $value->getAttribute('name'); + + if ($definition) { + $value = $this->parsePrimaryExpression(); + + if (!$this->checkConstantExpression($value)) { + throw new SyntaxError(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); + } + } else { + $value = $this->parseExpression(0, $allowArrow); + } + } + + if ($definition) { + if (null === $name) { + $name = $value->getAttribute('name'); + $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); + } + $args[$name] = $value; + } else { + if (null === $name) { + $args[] = $value; + } else { + $args[$name] = $value; + } + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); + + return new Node($args); + } + + public function parseAssignmentExpression() + { + $stream = $this->parser->getStream(); + $targets = []; + while (true) { + $token = $stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to'); + $value = $token->getValue(); + if (\in_array(strtolower($value), ['true', 'false', 'none', 'null'])) { + throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); + } + $targets[] = new AssignNameExpression($value, $token->getLine()); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + + return new Node($targets); + } + + public function parseMultitargetExpression() + { + $targets = []; + while (true) { + $targets[] = $this->parseExpression(); + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + + return new Node($targets); + } + + private function parseNotTestExpression(\Twig_NodeInterface $node) + { + return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); + } + + private function parseTestExpression(\Twig_NodeInterface $node) + { + $stream = $this->parser->getStream(); + list($name, $test) = $this->getTest($node->getTemplateLine()); + + $class = $this->getTestNodeClass($test); + $arguments = null; + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = $this->parseArguments(true); + } + + return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); + } + + private function getTest($line) + { + $stream = $this->parser->getStream(); + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + if ($test = $this->env->getTest($name)) { + return [$name, $test]; + } + + if ($stream->test(Token::NAME_TYPE)) { + // try 2-words tests + $name = $name.' '.$this->parser->getCurrentToken()->getValue(); + + if ($test = $this->env->getTest($name)) { + $stream->next(); + + return [$name, $test]; + } + } + + $e = new SyntaxError(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getTests())); + + throw $e; + } + + private function getTestNodeClass($test) + { + if ($test instanceof TwigTest && $test->isDeprecated()) { + $stream = $this->parser->getStream(); + $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); + if (!\is_bool($test->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); + } + if ($test->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $test->getAlternative()); + } + $src = $stream->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine()); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($test instanceof TwigTest) { + return $test->getNodeClass(); + } + + return $test instanceof \Twig_Test_Node ? $test->getClass() : 'Twig\Node\Expression\TestExpression'; + } + + protected function getFunctionNodeClass($name, $line) + { + if (false === $function = $this->env->getFunction($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFunctions())); + + throw $e; + } + + if ($function instanceof TwigFunction && $function->isDeprecated()) { + $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); + if (!\is_bool($function->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); + } + if ($function->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $function->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($function instanceof TwigFunction) { + return $function->getNodeClass(); + } + + return $function instanceof \Twig_Function_Node ? $function->getClass() : 'Twig\Node\Expression\FunctionExpression'; + } + + protected function getFilterNodeClass($name, $line) + { + if (false === $filter = $this->env->getFilter($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFilters())); + + throw $e; + } + + if ($filter instanceof TwigFilter && $filter->isDeprecated()) { + $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); + if (!\is_bool($filter->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); + } + if ($filter->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($filter instanceof TwigFilter) { + return $filter->getNodeClass(); + } + + return $filter instanceof \Twig_Filter_Node ? $filter->getClass() : 'Twig\Node\Expression\FilterExpression'; + } + + // checks that the node only contains "constant" elements + protected function checkConstantExpression(\Twig_NodeInterface $node) + { + if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression + || $node instanceof NegUnary || $node instanceof PosUnary + )) { + return false; + } + + foreach ($node as $n) { + if (!$this->checkConstantExpression($n)) { + return false; + } + } + + return true; + } +} + +class_alias('Twig\ExpressionParser', 'Twig_ExpressionParser'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/AbstractExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/AbstractExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/AbstractExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/AbstractExtension.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/CoreExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/CoreExtension.php new file mode 100644 index 0000000..f0c9fa0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/CoreExtension.php @@ -0,0 +1,1724 @@ +escapers[$strategy] = $callable; + } + + /** + * Gets all defined escapers. + * + * @return array An array of escapers + */ + public function getEscapers() + { + return $this->escapers; + } + + /** + * Sets the default format to be used by the date filter. + * + * @param string $format The default date format string + * @param string $dateIntervalFormat The default date interval format string + */ + public function setDateFormat($format = null, $dateIntervalFormat = null) + { + if (null !== $format) { + $this->dateFormats[0] = $format; + } + + if (null !== $dateIntervalFormat) { + $this->dateFormats[1] = $dateIntervalFormat; + } + } + + /** + * Gets the default format to be used by the date filter. + * + * @return array The default date format string and the default date interval format string + */ + public function getDateFormat() + { + return $this->dateFormats; + } + + /** + * Sets the default timezone to be used by the date filter. + * + * @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); + } + + /** + * Gets the default timezone to be used by the date filter. + * + * @return \DateTimeZone The default timezone currently in use + */ + public function getTimezone() + { + if (null === $this->timezone) { + $this->timezone = new \DateTimeZone(date_default_timezone_get()); + } + + return $this->timezone; + } + + /** + * Sets the default format to be used by the number_format filter. + * + * @param int $decimal the number of decimal places to use + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + */ + public function setNumberFormat($decimal, $decimalPoint, $thousandSep) + { + $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; + } + + /** + * Get the default format used by the number_format filter. + * + * @return array The arguments for number_format() + */ + public function getNumberFormat() + { + return $this->numberFormat; + } + + public function getTokenParsers() + { + return [ + new ApplyTokenParser(), + new ForTokenParser(), + new IfTokenParser(), + new ExtendsTokenParser(), + new IncludeTokenParser(), + new BlockTokenParser(), + new UseTokenParser(), + new FilterTokenParser(), + new MacroTokenParser(), + new ImportTokenParser(), + new FromTokenParser(), + new SetTokenParser(), + new SpacelessTokenParser(), + new FlushTokenParser(), + new DoTokenParser(), + new EmbedTokenParser(), + new WithTokenParser(), + new DeprecatedTokenParser(), + ]; + } + + public function getFilters() + { + $filters = [ + // formatting filters + new TwigFilter('date', 'twig_date_format_filter', ['needs_environment' => true]), + new TwigFilter('date_modify', 'twig_date_modify_filter', ['needs_environment' => true]), + new TwigFilter('format', 'sprintf'), + new TwigFilter('replace', 'twig_replace_filter'), + new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), + new TwigFilter('abs', 'abs'), + new TwigFilter('round', 'twig_round'), + + // encoding + new TwigFilter('url_encode', 'twig_urlencode_filter'), + new TwigFilter('json_encode', 'twig_jsonencode_filter'), + new TwigFilter('convert_encoding', 'twig_convert_encoding'), + + // string filters + new TwigFilter('title', 'twig_title_string_filter', ['needs_environment' => true]), + new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), + new TwigFilter('upper', 'strtoupper'), + new TwigFilter('lower', 'strtolower'), + new TwigFilter('striptags', 'strip_tags'), + new TwigFilter('trim', 'twig_trim_filter'), + new TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('spaceless', 'twig_spaceless', ['is_safe' => ['html']]), + + // array helpers + new TwigFilter('join', 'twig_join_filter'), + new TwigFilter('split', 'twig_split_filter', ['needs_environment' => true]), + new TwigFilter('sort', 'twig_sort_filter'), + new TwigFilter('merge', 'twig_array_merge'), + new TwigFilter('batch', 'twig_array_batch'), + new TwigFilter('filter', 'twig_array_filter'), + new TwigFilter('map', 'twig_array_map'), + new TwigFilter('reduce', 'twig_array_reduce'), + + // string/array filters + new TwigFilter('reverse', 'twig_reverse_filter', ['needs_environment' => true]), + new TwigFilter('length', 'twig_length_filter', ['needs_environment' => true]), + new TwigFilter('slice', 'twig_slice', ['needs_environment' => true]), + new TwigFilter('first', 'twig_first', ['needs_environment' => true]), + new TwigFilter('last', 'twig_last', ['needs_environment' => true]), + + // iteration and runtime + new TwigFilter('default', '_twig_default_filter', ['node_class' => '\Twig\Node\Expression\Filter\DefaultFilter']), + new TwigFilter('keys', 'twig_get_array_keys_filter'), + + // escaping + new TwigFilter('escape', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + new TwigFilter('e', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + ]; + + if (\function_exists('mb_get_info')) { + $filters[] = new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]); + $filters[] = new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]); + } + + return $filters; + } + + public function getFunctions() + { + return [ + new TwigFunction('max', 'max'), + new TwigFunction('min', 'min'), + new TwigFunction('range', 'range'), + new TwigFunction('constant', 'twig_constant'), + new TwigFunction('cycle', 'twig_cycle'), + new TwigFunction('random', 'twig_random', ['needs_environment' => true]), + new TwigFunction('date', 'twig_date_converter', ['needs_environment' => true]), + new TwigFunction('include', 'twig_include', ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), + new TwigFunction('source', 'twig_source', ['needs_environment' => true, 'is_safe' => ['all']]), + ]; + } + + public function getTests() + { + return [ + new TwigTest('even', null, ['node_class' => '\Twig\Node\Expression\Test\EvenTest']), + new TwigTest('odd', null, ['node_class' => '\Twig\Node\Expression\Test\OddTest']), + new TwigTest('defined', null, ['node_class' => '\Twig\Node\Expression\Test\DefinedTest']), + new TwigTest('sameas', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest', 'deprecated' => '1.21', 'alternative' => 'same as']), + new TwigTest('same as', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest']), + new TwigTest('none', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), + new TwigTest('null', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), + new TwigTest('divisibleby', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest', 'deprecated' => '1.21', 'alternative' => 'divisible by']), + new TwigTest('divisible by', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest']), + new TwigTest('constant', null, ['node_class' => '\Twig\Node\Expression\Test\ConstantTest']), + new TwigTest('empty', 'twig_test_empty'), + new TwigTest('iterable', 'twig_test_iterable'), + ]; + } + + public function getOperators() + { + return [ + [ + 'not' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], + '-' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\NegUnary'], + '+' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\PosUnary'], + ], + [ + 'or' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'and' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-or' => ['precedence' => 16, 'class' => '\Twig\Node\Expression\Binary\BitwiseOrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-xor' => ['precedence' => 17, 'class' => '\Twig\Node\Expression\Binary\BitwiseXorBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-and' => ['precedence' => 18, 'class' => '\Twig\Node\Expression\Binary\BitwiseAndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '==' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '!=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'not in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotInBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\InBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'matches' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\MatchesBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'starts with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\StartsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'ends with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EndsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '..' => ['precedence' => 25, 'class' => '\Twig\Node\Expression\Binary\RangeBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '+' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\AddBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '-' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\SubBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '~' => ['precedence' => 40, 'class' => '\Twig\Node\Expression\Binary\ConcatBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '*' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\MulBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '/' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\DivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '//' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\FloorDivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '%' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\ModBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '**' => ['precedence' => 200, 'class' => '\Twig\Node\Expression\Binary\PowerBinary', 'associativity' => ExpressionParser::OPERATOR_RIGHT], + '??' => ['precedence' => 300, 'class' => '\Twig\Node\Expression\NullCoalesceExpression', 'associativity' => ExpressionParser::OPERATOR_RIGHT], + ], + ]; + } + + public function getName() + { + return 'core'; + } +} + +class_alias('Twig\Extension\CoreExtension', 'Twig_Extension_Core'); +} + +namespace { +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Markup; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; + +/** + * Cycles over a value. + * + * @param \ArrayAccess|array $values + * @param int $position The cycle position + * + * @return string The next value in the cycle + */ +function twig_cycle($values, $position) +{ + if (!\is_array($values) && !$values instanceof \ArrayAccess) { + return $values; + } + + return $values[$position % \count($values)]; +} + +/** + * Returns a random value depending on the supplied parameter type: + * - a random item from a \Traversable or array + * - a random character from a string + * - a random integer between 0 and the integer parameter. + * + * @param \Traversable|array|int|float|string $values The values to pick a random item from + * @param int|null $max Maximum value used when $values is an int + * + * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) + * + * @return mixed A random value from the given sequence + */ +function twig_random(Environment $env, $values = null, $max = null) +{ + if (null === $values) { + return null === $max ? mt_rand() : mt_rand(0, $max); + } + + if (\is_int($values) || \is_float($values)) { + if (null === $max) { + if ($values < 0) { + $max = 0; + $min = $values; + } else { + $max = $values; + $min = 0; + } + } else { + $min = $values; + $max = $max; + } + + return mt_rand($min, $max); + } + + if (\is_string($values)) { + if ('' === $values) { + return ''; + } + if (null !== $charset = $env->getCharset()) { + if ('UTF-8' !== $charset) { + $values = twig_convert_encoding($values, 'UTF-8', $charset); + } + + // unicode version of str_split() + // split at all positions, but not after the start and not before the end + $values = preg_split('/(? $value) { + $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); + } + } + } else { + return $values[mt_rand(0, \strlen($values) - 1)]; + } + } + + if (!twig_test_iterable($values)) { + return $values; + } + + $values = twig_to_array($values); + + if (0 === \count($values)) { + throw new RuntimeError('The random function cannot pick from an empty array.'); + } + + return $values[array_rand($values, 1)]; +} + +/** + * Converts a date to the given format. + * + * {{ post.published_at|date("m/d/Y") }} + * + * @param \DateTime|\DateTimeInterface|\DateInterval|string $date A date + * @param string|null $format The target format, null to use the default + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return string The formatted date + */ +function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) +{ + if (null === $format) { + $formats = $env->getExtension('\Twig\Extension\CoreExtension')->getDateFormat(); + $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; + } + + if ($date instanceof \DateInterval) { + return $date->format($format); + } + + return twig_date_converter($env, $date, $timezone)->format($format); +} + +/** + * Returns a new date object modified. + * + * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} + * + * @param \DateTime|string $date A date + * @param string $modifier A modifier string + * + * @return \DateTime + */ +function twig_date_modify_filter(Environment $env, $date, $modifier) +{ + $date = twig_date_converter($env, $date, false); + $resultDate = $date->modify($modifier); + + // This is a hack to ensure PHP 5.2 support and support for \DateTimeImmutable + // \DateTime::modify does not return the modified \DateTime object < 5.3.0 + // and \DateTimeImmutable does not modify $date. + return null === $resultDate ? $date : $resultDate; +} + +/** + * Converts an input to a \DateTime instance. + * + * {% if date(user.created_at) < date('+2days') %} + * {# do something #} + * {% endif %} + * + * @param \DateTime|\DateTimeInterface|string|null $date A date + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return \DateTime + */ +function twig_date_converter(Environment $env, $date = null, $timezone = null) +{ + // determine the timezone + if (false !== $timezone) { + if (null === $timezone) { + $timezone = $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone(); + } elseif (!$timezone instanceof \DateTimeZone) { + $timezone = new \DateTimeZone($timezone); + } + } + + // immutable dates + if ($date instanceof \DateTimeImmutable) { + return false !== $timezone ? $date->setTimezone($timezone) : $date; + } + + if ($date instanceof \DateTime || $date instanceof \DateTimeInterface) { + $date = clone $date; + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; + } + + if (null === $date || 'now' === $date) { + return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); + } + + $asString = (string) $date; + if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { + $date = new \DateTime('@'.$date); + } else { + $date = new \DateTime($date, $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); + } + + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; +} + +/** + * Replaces strings within a string. + * + * @param string $str String to replace in + * @param array|\Traversable $from Replace values + * @param string|null $to Replace to, deprecated (@see https://secure.php.net/manual/en/function.strtr.php) + * + * @return string + */ +function twig_replace_filter($str, $from, $to = null) +{ + if (\is_string($from) && \is_string($to)) { + @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); + + return strtr($str, $from, $to); + } + + if (!twig_test_iterable($from)) { + throw new RuntimeError(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); + } + + return strtr($str, twig_to_array($from)); +} + +/** + * Rounds a number. + * + * @param int|float $value The value to round + * @param int|float $precision The rounding precision + * @param string $method The method to use for rounding + * + * @return int|float The rounded number + */ +function twig_round($value, $precision = 0, $method = 'common') +{ + if ('common' == $method) { + return round($value, $precision); + } + + if ('ceil' != $method && 'floor' != $method) { + throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); + } + + return $method($value * pow(10, $precision)) / pow(10, $precision); +} + +/** + * Number format filter. + * + * All of the formatting options can be left null, in that case the defaults will + * be used. Supplying any of the parameters will override the defaults set in the + * environment object. + * + * @param mixed $number A float/int/string of the number to format + * @param int $decimal the number of decimal points to display + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + * + * @return string The formatted number + */ +function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) +{ + $defaults = $env->getExtension('\Twig\Extension\CoreExtension')->getNumberFormat(); + if (null === $decimal) { + $decimal = $defaults[0]; + } + + if (null === $decimalPoint) { + $decimalPoint = $defaults[1]; + } + + if (null === $thousandSep) { + $thousandSep = $defaults[2]; + } + + return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); +} + +/** + * URL encodes (RFC 3986) a string as a path segment or an array as a query string. + * + * @param string|array $url A URL or an array of query parameters + * + * @return string The URL encoded value + */ +function twig_urlencode_filter($url) +{ + if (\is_array($url)) { + if (\defined('PHP_QUERY_RFC3986')) { + return http_build_query($url, '', '&', PHP_QUERY_RFC3986); + } + + return http_build_query($url, '', '&'); + } + + return rawurlencode($url); +} + +/** + * JSON encodes a variable. + * + * @param mixed $value the value to encode + * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT + * + * @return mixed The JSON encoded value + */ +function twig_jsonencode_filter($value, $options = 0) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } elseif (\is_array($value)) { + array_walk_recursive($value, '_twig_markup2string'); + } + + return json_encode($value, $options); +} + +function _twig_markup2string(&$value) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } +} + +/** + * Merges an array with another one. + * + * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + * + * {% set items = items|merge({ 'peugeot': 'car' }) %} + * + * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} + * + * @param array|\Traversable $arr1 An array + * @param array|\Traversable $arr2 An array + * + * @return array The merged array + */ +function twig_array_merge($arr1, $arr2) +{ + if (!twig_test_iterable($arr1)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); + } + + if (!twig_test_iterable($arr2)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); + } + + return array_merge(twig_to_array($arr1), twig_to_array($arr2)); +} + +/** + * Slices a variable. + * + * @param mixed $item A variable + * @param int $start Start of the slice + * @param int $length Size of the slice + * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ +function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + while ($item instanceof \IteratorAggregate) { + $item = $item->getIterator(); + } + + if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { + try { + return iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); + } catch (\OutOfBoundsException $e) { + return []; + } + } + + $item = iterator_to_array($item, $preserveKeys); + } + + if (\is_array($item)) { + return \array_slice($item, $start, $length, $preserveKeys); + } + + $item = (string) $item; + + if (\function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { + return (string) mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); + } + + return (string) (null === $length ? substr($item, $start) : substr($item, $start, $length)); +} + +/** + * Returns the first element of the item. + * + * @param mixed $item A variable + * + * @return mixed The first element of the item + */ +function twig_first(Environment $env, $item) +{ + $elements = twig_slice($env, $item, 0, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Returns the last element of the item. + * + * @param mixed $item A variable + * + * @return mixed The last element of the item + */ +function twig_last(Environment $env, $item) +{ + $elements = twig_slice($env, $item, -1, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Joins the values to a string. + * + * The separators between elements are empty strings per default, you can define them with the optional parameters. + * + * {{ [1, 2, 3]|join(', ', ' and ') }} + * {# returns 1, 2 and 3 #} + * + * {{ [1, 2, 3]|join('|') }} + * {# returns 1|2|3 #} + * + * {{ [1, 2, 3]|join }} + * {# returns 123 #} + * + * @param array $value An array + * @param string $glue The separator + * @param string|null $and The separator for the last pair + * + * @return string The concatenated string + */ +function twig_join_filter($value, $glue = '', $and = null) +{ + if (!twig_test_iterable($value)) { + $value = (array) $value; + } + + $value = twig_to_array($value, false); + + if (0 === \count($value)) { + return ''; + } + + if (null === $and || $and === $glue) { + return implode($glue, $value); + } + + if (1 === \count($value)) { + return $value[0]; + } + + return implode($glue, \array_slice($value, 0, -1)).$and.$value[\count($value) - 1]; +} + +/** + * Splits the string into an array. + * + * {{ "one,two,three"|split(',') }} + * {# returns [one, two, three] #} + * + * {{ "one,two,three,four,five"|split(',', 3) }} + * {# returns [one, two, "three,four,five"] #} + * + * {{ "123"|split('') }} + * {# returns [1, 2, 3] #} + * + * {{ "aabbcc"|split('', 2) }} + * {# returns [aa, bb, cc] #} + * + * @param string $value A string + * @param string $delimiter The delimiter + * @param int $limit The limit + * + * @return array The split string as an array + */ +function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) +{ + if (!empty($delimiter)) { + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); + } + + if (!\function_exists('mb_get_info') || null === $charset = $env->getCharset()) { + return str_split($value, null === $limit ? 1 : $limit); + } + + if ($limit <= 1) { + return preg_split('/(?getIterator(); + } + + if ($array instanceof \Iterator) { + $keys = []; + $array->rewind(); + while ($array->valid()) { + $keys[] = $array->key(); + $array->next(); + } + + return $keys; + } + + $keys = []; + foreach ($array as $key => $item) { + $keys[] = $key; + } + + return $keys; + } + + if (!\is_array($array)) { + return []; + } + + return array_keys($array); +} + +/** + * Reverses a variable. + * + * @param array|\Traversable|string $item An array, a \Traversable instance, or a string + * @param bool $preserveKeys Whether to preserve key or not + * + * @return mixed The reversed input + */ +function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + return array_reverse(iterator_to_array($item), $preserveKeys); + } + + if (\is_array($item)) { + return array_reverse($item, $preserveKeys); + } + + if (null !== $charset = $env->getCharset()) { + $string = (string) $item; + + if ('UTF-8' !== $charset) { + $item = twig_convert_encoding($string, 'UTF-8', $charset); + } + + preg_match_all('/./us', $item, $matches); + + $string = implode('', array_reverse($matches[0])); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + } + + return strrev((string) $item); +} + +/** + * Sorts an array. + * + * @param array|\Traversable $array + * + * @return array + */ +function twig_sort_filter($array) +{ + if ($array instanceof \Traversable) { + $array = iterator_to_array($array); + } elseif (!\is_array($array)) { + throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); + } + + asort($array); + + return $array; +} + +/** + * @internal + */ +function twig_in_filter($value, $compare) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } + + if (\is_array($compare)) { + return \in_array($value, $compare, \is_object($value) || \is_resource($value)); + } elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) { + return '' === $value || false !== strpos($compare, (string) $value); + } elseif ($compare instanceof \Traversable) { + if (\is_object($value) || \is_resource($value)) { + foreach ($compare as $item) { + if ($item === $value) { + return true; + } + } + } else { + foreach ($compare as $item) { + if ($item == $value) { + return true; + } + } + } + + return false; + } + + return false; +} + +/** + * Returns a trimmed string. + * + * @return string + * + * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') + */ +function twig_trim_filter($string, $characterMask = null, $side = 'both') +{ + if (null === $characterMask) { + $characterMask = " \t\n\r\0\x0B"; + } + + switch ($side) { + case 'both': + return trim($string, $characterMask); + case 'left': + return ltrim($string, $characterMask); + case 'right': + return rtrim($string, $characterMask); + default: + throw new RuntimeError('Trimming side must be "left", "right" or "both".'); + } +} + +/** + * Removes whitespaces between HTML tags. + * + * @return string + */ +function twig_spaceless($content) +{ + return trim(preg_replace('/>\s+<', $content)); +} + +/** + * Escapes a string. + * + * @param mixed $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string $charset The charset + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * + * @return string + */ +function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) +{ + if ($autoescape && $string instanceof Markup) { + return $string; + } + + if (!\is_string($string)) { + if (\is_object($string) && method_exists($string, '__toString')) { + $string = (string) $string; + } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { + return $string; + } + } + + if ('' === $string) { + return ''; + } + + if (null === $charset) { + $charset = $env->getCharset(); + } + + switch ($strategy) { + case 'html': + // see https://secure.php.net/htmlspecialchars + + // Using a static variable to avoid initializing the array + // each time the function is called. Moving the declaration on the + // top of the function slow downs other escaping strategies. + static $htmlspecialcharsCharsets = [ + 'ISO-8859-1' => true, 'ISO8859-1' => true, + 'ISO-8859-15' => true, 'ISO8859-15' => true, + 'utf-8' => true, 'UTF-8' => true, + 'CP866' => true, 'IBM866' => true, '866' => true, + 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, + '1251' => true, + 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, + 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, + 'BIG5' => true, '950' => true, + 'GB2312' => true, '936' => true, + 'BIG5-HKSCS' => true, + 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, + 'EUC-JP' => true, 'EUCJP' => true, + 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, + ]; + + if (isset($htmlspecialcharsCharsets[$charset])) { + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { + // cache the lowercase variant for future iterations + $htmlspecialcharsCharsets[$charset] = true; + + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + $string = twig_convert_encoding($string, 'UTF-8', $charset); + $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + + return twig_convert_encoding($string, $charset, 'UTF-8'); + + case 'js': + // escape all non-alphanumeric characters + // into their \x or \uHHHH representations + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'css': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'html_attr': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'url': + return rawurlencode($string); + + default: + static $escapers; + + if (null === $escapers) { + $escapers = $env->getExtension('\Twig\Extension\CoreExtension')->getEscapers(); + } + + if (isset($escapers[$strategy])) { + return \call_user_func($escapers[$strategy], $env, $string, $charset); + } + + $validStrategies = implode(', ', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($escapers))); + + throw new RuntimeError(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); + } +} + +/** + * @internal + */ +function twig_escape_filter_is_safe(Node $filterArgs) +{ + foreach ($filterArgs as $arg) { + if ($arg instanceof ConstantExpression) { + return [$arg->getAttribute('value')]; + } + + return []; + } + + return ['html']; +} + +if (\function_exists('mb_convert_encoding')) { + function twig_convert_encoding($string, $to, $from) + { + return mb_convert_encoding($string, $to, $from); + } +} elseif (\function_exists('iconv')) { + function twig_convert_encoding($string, $to, $from) + { + return iconv($from, $to, $string); + } +} else { + function twig_convert_encoding($string, $to, $from) + { + throw new RuntimeError('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); + } +} + +if (\function_exists('mb_ord')) { + function twig_ord($string) + { + return mb_ord($string, 'UTF-8'); + } +} else { + function twig_ord($string) + { + $code = ($string = unpack('C*', substr($string, 0, 4))) ? $string[1] : 0; + if (0xF0 <= $code) { + return (($code - 0xF0) << 18) + (($string[2] - 0x80) << 12) + (($string[3] - 0x80) << 6) + $string[4] - 0x80; + } + if (0xE0 <= $code) { + return (($code - 0xE0) << 12) + (($string[2] - 0x80) << 6) + $string[3] - 0x80; + } + if (0xC0 <= $code) { + return (($code - 0xC0) << 6) + $string[2] - 0x80; + } + + return $code; + } +} + +function _twig_escape_js_callback($matches) +{ + $char = $matches[0]; + + /* + * A few characters have short escape sequences in JSON and JavaScript. + * Escape sequences supported only by JavaScript, not JSON, are ommitted. + * \" is also supported but omitted, because the resulting string is not HTML safe. + */ + static $shortMap = [ + '\\' => '\\\\', + '/' => '\\/', + "\x08" => '\b', + "\x0C" => '\f', + "\x0A" => '\n', + "\x0D" => '\r', + "\x09" => '\t', + ]; + + if (isset($shortMap[$char])) { + return $shortMap[$char]; + } + + // \uHHHH + $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); + $char = strtoupper(bin2hex($char)); + + if (4 >= \strlen($char)) { + return sprintf('\u%04s', $char); + } + + return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); +} + +function _twig_escape_css_callback($matches) +{ + $char = $matches[0]; + + return sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : twig_ord($char)); +} + +/** + * This function is adapted from code coming from Zend Framework. + * + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://framework.zend.com/license/new-bsd New BSD License + */ +function _twig_escape_html_attr_callback($matches) +{ + $chr = $matches[0]; + $ord = \ord($chr); + + /* + * The following replaces characters undefined in HTML with the + * hex entity for the Unicode replacement character. + */ + if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { + return '�'; + } + + /* + * Check if the current character to escape has a name entity we should + * replace it with while grabbing the hex value of the character. + */ + if (1 == \strlen($chr)) { + /* + * While HTML supports far more named entities, the lowest common denominator + * has become HTML5's XML Serialisation which is restricted to the those named + * entities that XML supports. Using HTML entities would result in this error: + * XML Parsing Error: undefined entity + */ + static $entityMap = [ + 34 => '"', /* quotation mark */ + 38 => '&', /* ampersand */ + 60 => '<', /* less-than sign */ + 62 => '>', /* greater-than sign */ + ]; + + if (isset($entityMap[$ord])) { + return $entityMap[$ord]; + } + + return sprintf('&#x%02X;', $ord); + } + + /* + * Per OWASP recommendations, we'll use hex entities for any other + * characters where a named entity does not exist. + */ + return sprintf('&#x%04X;', twig_ord($chr)); +} + +// add multibyte extensions if possible +if (\function_exists('mb_get_info')) { + /** + * Returns the length of a variable. + * + * @param mixed $thing A variable + * + * @return int The length of the value + */ + function twig_length_filter(Environment $env, $thing) + { + if (null === $thing) { + return 0; + } + + if (is_scalar($thing)) { + return mb_strlen($thing, $env->getCharset()); + } + + if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if ($thing instanceof \Traversable) { + return iterator_count($thing); + } + + if (\is_object($thing) && method_exists($thing, '__toString')) { + return mb_strlen((string) $thing, $env->getCharset()); + } + + return 1; + } + + /** + * Converts a string to uppercase. + * + * @param string $string A string + * + * @return string The uppercased string + */ + function twig_upper_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtoupper($string, $charset); + } + + return strtoupper($string); + } + + /** + * Converts a string to lowercase. + * + * @param string $string A string + * + * @return string The lowercased string + */ + function twig_lower_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtolower($string, $charset); + } + + return strtolower($string); + } + + /** + * Returns a titlecased string. + * + * @param string $string A string + * + * @return string The titlecased string + */ + function twig_title_string_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_convert_case($string, MB_CASE_TITLE, $charset); + } + + return ucwords(strtolower($string)); + } + + /** + * Returns a capitalized string. + * + * @param string $string A string + * + * @return string The capitalized string + */ + function twig_capitalize_string_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset); + } + + return ucfirst(strtolower($string)); + } +} +// and byte fallback +else { + /** + * Returns the length of a variable. + * + * @param mixed $thing A variable + * + * @return int The length of the value + */ + function twig_length_filter(Environment $env, $thing) + { + if (null === $thing) { + return 0; + } + + if (is_scalar($thing)) { + return \strlen($thing); + } + + if ($thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if (\is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { + return \strlen((string) $thing); + } + + if ($thing instanceof \Countable || \is_array($thing)) { + return \count($thing); + } + + if ($thing instanceof \IteratorAggregate) { + return iterator_count($thing); + } + + return 1; + } + + /** + * Returns a titlecased string. + * + * @param string $string A string + * + * @return string The titlecased string + */ + function twig_title_string_filter(Environment $env, $string) + { + return ucwords(strtolower($string)); + } + + /** + * Returns a capitalized string. + * + * @param string $string A string + * + * @return string The capitalized string + */ + function twig_capitalize_string_filter(Environment $env, $string) + { + return ucfirst(strtolower($string)); + } +} + +/** + * @internal + */ +function twig_ensure_traversable($seq) +{ + if ($seq instanceof \Traversable || \is_array($seq)) { + return $seq; + } + + return []; +} + +/** + * @internal + */ +function twig_to_array($seq, $preserveKeys = true) +{ + if ($seq instanceof \Traversable) { + return iterator_to_array($seq, $preserveKeys); + } + + if (!\is_array($seq)) { + return $seq; + } + + return $preserveKeys ? $seq : array_values($seq); +} + +/** + * Checks if a variable is empty. + * + * {# evaluates to true if the foo variable is null, false, or the empty string #} + * {% if foo is empty %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is empty, false otherwise + */ +function twig_test_empty($value) +{ + if ($value instanceof \Countable) { + return 0 == \count($value); + } + + if (\is_object($value) && method_exists($value, '__toString')) { + return '' === (string) $value; + } + + return '' === $value || false === $value || null === $value || [] === $value; +} + +/** + * Checks if a variable is traversable. + * + * {# evaluates to true if the foo variable is an array or a traversable object #} + * {% if foo is iterable %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is traversable + */ +function twig_test_iterable($value) +{ + return $value instanceof \Traversable || \is_array($value); +} + +/** + * Renders a template. + * + * @param array $context + * @param string|array $template The template to render or an array of templates to try consecutively + * @param array $variables The variables to pass to the template + * @param bool $withContext + * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param bool $sandboxed Whether to sandbox the template or not + * + * @return string The rendered template + */ +function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) +{ + $alreadySandboxed = false; + $sandbox = null; + if ($withContext) { + $variables = array_merge($context, $variables); + } + + if ($isSandboxed = $sandboxed && $env->hasExtension('\Twig\Extension\SandboxExtension')) { + $sandbox = $env->getExtension('\Twig\Extension\SandboxExtension'); + if (!$alreadySandboxed = $sandbox->isSandboxed()) { + $sandbox->enableSandbox(); + } + } + + $loaded = null; + try { + $loaded = $env->resolveTemplate($template); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } + } catch (\Throwable $e) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } catch (\Exception $e) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } + + try { + $ret = $loaded ? $loaded->render($variables) : ''; + } catch (\Exception $e) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } + + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + return $ret; +} + +/** + * Returns a template content without rendering it. + * + * @param string $name The template name + * @param bool $ignoreMissing Whether to ignore missing templates or not + * + * @return string The template source + */ +function twig_source(Environment $env, $name, $ignoreMissing = false) +{ + $loader = $env->getLoader(); + try { + if (!$loader instanceof SourceContextLoaderInterface) { + return $loader->getSource($name); + } else { + return $loader->getSourceContext($name)->getCode(); + } + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + } +} + +/** + * Provides the ability to get constants from instances as well as class/global constants. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return string + */ +function twig_constant($constant, $object = null) +{ + if (null !== $object) { + $constant = \get_class($object).'::'.$constant; + } + + return \constant($constant); +} + +/** + * Checks if a constant exists. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return bool + */ +function twig_constant_is_defined($constant, $object = null) +{ + if (null !== $object) { + $constant = \get_class($object).'::'.$constant; + } + + return \defined($constant); +} + +/** + * Batches item. + * + * @param array $items An array of items + * @param int $size The size of the batch + * @param mixed $fill A value used to fill missing items + * + * @return array + */ +function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) +{ + if (!twig_test_iterable($items)) { + throw new RuntimeError(sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); + } + + $size = ceil($size); + + $result = array_chunk(twig_to_array($items, $preserveKeys), $size, $preserveKeys); + + if (null !== $fill && $result) { + $last = \count($result) - 1; + if ($fillCount = $size - \count($result[$last])) { + for ($i = 0; $i < $fillCount; ++$i) { + $result[$last][] = $fill; + } + } + } + + return $result; +} + +function twig_array_filter($array, $arrow) +{ + if (\is_array($array)) { + if (\PHP_VERSION_ID >= 50600) { + return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); + } + + return array_filter($array, $arrow); + } + + while ($array instanceof \IteratorAggregate) { + $array = $array->getIterator(); + } + + return new \CallbackFilterIterator($array, $arrow); +} + +function twig_array_map($array, $arrow) +{ + $r = []; + foreach ($array as $k => $v) { + $r[$k] = $arrow($v, $k); + } + + return $r; +} + +function twig_array_reduce($array, $arrow, $initial = null) +{ + if (!\is_array($array)) { + $array = iterator_to_array($array); + } + + return array_reduce($array, $arrow, $initial); +} +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/DebugExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/DebugExtension.php new file mode 100644 index 0000000..cf5a220 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/DebugExtension.php @@ -0,0 +1,76 @@ + $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), + ]; + } + + public function getName() + { + return 'debug'; + } +} + +class_alias('Twig\Extension\DebugExtension', 'Twig_Extension_Debug'); +} + +namespace { +use Twig\Environment; +use Twig\Template; +use Twig\TemplateWrapper; + +function twig_var_dump(Environment $env, $context, array $vars = []) +{ + if (!$env->isDebug()) { + return; + } + + ob_start(function () { return ''; }); + + if (!$vars) { + $vars = []; + foreach ($context as $key => $value) { + if (!$value instanceof Template && !$value instanceof TemplateWrapper) { + $vars[$key] = $value; + } + } + + var_dump($vars); + } else { + foreach ($vars as $var) { + var_dump($var); + } + } + + return ob_get_clean(); +} +} diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/EscaperExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/EscaperExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/EscaperExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/EscaperExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/ExtensionInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/ExtensionInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/ExtensionInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/ExtensionInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/GlobalsInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/GlobalsInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/GlobalsInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/GlobalsInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/InitRuntimeInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/InitRuntimeInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/InitRuntimeInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/InitRuntimeInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/OptimizerExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/OptimizerExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/OptimizerExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/OptimizerExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/ProfilerExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/ProfilerExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/ProfilerExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/ProfilerExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/RuntimeExtensionInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/RuntimeExtensionInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/SandboxExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/SandboxExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/SandboxExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/SandboxExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/StagingExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/StagingExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/StagingExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/StagingExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/StringLoaderExtension.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/StringLoaderExtension.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Extension/StringLoaderExtension.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Extension/StringLoaderExtension.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/FileExtensionEscapingStrategy.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/FileExtensionEscapingStrategy.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/FileExtensionEscapingStrategy.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/FileExtensionEscapingStrategy.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Lexer.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Lexer.php new file mode 100644 index 0000000..8cae359 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Lexer.php @@ -0,0 +1,534 @@ + + */ +class Lexer implements \Twig_LexerInterface +{ + protected $tokens; + protected $code; + protected $cursor; + protected $lineno; + protected $end; + protected $state; + protected $states; + protected $brackets; + protected $env; + // to be renamed to $name in 2.0 (where it is private) + protected $filename; + protected $options; + protected $regexes; + protected $position; + protected $positions; + protected $currentVarBlockLine; + + private $source; + + const STATE_DATA = 0; + const STATE_BLOCK = 1; + const STATE_VAR = 2; + const STATE_STRING = 3; + const STATE_INTERPOLATION = 4; + + const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; + const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; + const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; + const REGEX_DQ_STRING_DELIM = '/"/A'; + const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; + const PUNCTUATION = '()[]{}?:.,|'; + + public function __construct(Environment $env, array $options = []) + { + $this->env = $env; + + $this->options = array_merge([ + 'tag_comment' => ['{#', '#}'], + 'tag_block' => ['{%', '%}'], + 'tag_variable' => ['{{', '}}'], + 'whitespace_trim' => '-', + 'whitespace_line_trim' => '~', + 'whitespace_line_chars' => ' \t\0\x0B', + 'interpolation' => ['#{', '}'], + ], $options); + + // when PHP 7.3 is the min version, we will be able to remove the '#' part in preg_quote as it's part of the default + $this->regexes = [ + // }} + 'lex_var' => '{ + \s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '#').'\s*'. // -}}\s* + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_variable'][1], '#'). // }} + ') + }Ax', + + // %} + 'lex_block' => '{ + \s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*\n?'. // -%}\s*\n? + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#').'\n?'. // %}\n? + ') + }Ax', + + // {% endverbatim %} + 'lex_raw_data' => '{'. + preg_quote($this->options['tag_block'][0], '#'). // {% + '('. + $this->options['whitespace_trim']. // - + '|'. + $this->options['whitespace_line_trim']. // ~ + ')?\s*'. + '(?:end%s)'. // endraw or endverbatim + '\s*'. + '(?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%} + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#'). // %} + ') + }sx', + + 'operator' => $this->getOperatorRegex(), + + // #} + 'lex_comment' => '{ + (?:'. + preg_quote($this->options['whitespace_trim']).preg_quote($this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n? + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_comment'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~#}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_comment'][1], '#').'\n?'. // #}\n? + ') + }sx', + + // verbatim %} + 'lex_block_raw' => '{ + \s* + (raw|verbatim) + \s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%}\s* + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#'). // %} + ') + }Asx', + + 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '#').'}As', + + // {{ or {% or {# + 'lex_tokens_start' => '{ + ('. + preg_quote($this->options['tag_variable'][0], '#'). // {{ + '|'. + preg_quote($this->options['tag_block'][0], '#'). // {% + '|'. + preg_quote($this->options['tag_comment'][0], '#'). // {# + ')('. + preg_quote($this->options['whitespace_trim'], '#'). // - + '|'. + preg_quote($this->options['whitespace_line_trim'], '#'). // ~ + ')? + }sx', + 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0], '#').'\s*}A', + 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1], '#').'}A', + ]; + } + + public function tokenize($code, $name = null) + { + if (!$code instanceof Source) { + @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $this->source = new Source($code, $name); + } else { + $this->source = $code; + } + + if (((int) ini_get('mbstring.func_overload')) & 2) { + @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); + } + + if (\function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); + } else { + $mbEncoding = null; + } + + $this->code = str_replace(["\r\n", "\r"], "\n", $this->source->getCode()); + $this->filename = $this->source->getName(); + $this->cursor = 0; + $this->lineno = 1; + $this->end = \strlen($this->code); + $this->tokens = []; + $this->state = self::STATE_DATA; + $this->states = []; + $this->brackets = []; + $this->position = -1; + + // find all token starts in one go + preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); + $this->positions = $matches; + + while ($this->cursor < $this->end) { + // dispatch to the lexing functions depending + // on the current state + switch ($this->state) { + case self::STATE_DATA: + $this->lexData(); + break; + + case self::STATE_BLOCK: + $this->lexBlock(); + break; + + case self::STATE_VAR: + $this->lexVar(); + break; + + case self::STATE_STRING: + $this->lexString(); + break; + + case self::STATE_INTERPOLATION: + $this->lexInterpolation(); + break; + } + } + + $this->pushToken(Token::EOF_TYPE); + + if (!empty($this->brackets)) { + list($expect, $lineno) = array_pop($this->brackets); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + if ($mbEncoding) { + mb_internal_encoding($mbEncoding); + } + + return new TokenStream($this->tokens, $this->source); + } + + protected function lexData() + { + // if no matches are left we return the rest of the template as simple text token + if ($this->position == \count($this->positions[0]) - 1) { + $this->pushToken(Token::TEXT_TYPE, substr($this->code, $this->cursor)); + $this->cursor = $this->end; + + return; + } + + // Find the first token after the current cursor + $position = $this->positions[0][++$this->position]; + while ($position[1] < $this->cursor) { + if ($this->position == \count($this->positions[0]) - 1) { + return; + } + $position = $this->positions[0][++$this->position]; + } + + // push the template text first + $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); + + // trim? + if (isset($this->positions[2][$this->position][0])) { + if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { + // whitespace_trim detected ({%-, {{- or {#-) + $text = rtrim($text); + } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { + // whitespace_line_trim detected ({%~, {{~ or {#~) + // don't trim \r and \n + $text = rtrim($text, " \t\0\x0B"); + } + } + $this->pushToken(Token::TEXT_TYPE, $text); + $this->moveCursor($textContent.$position[0]); + + switch ($this->positions[1][$this->position][0]) { + case $this->options['tag_comment'][0]: + $this->lexComment(); + break; + + case $this->options['tag_block'][0]: + // raw data? + if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lexRawData($match[1]); + // {% line \d+ %} + } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lineno = (int) $match[1]; + } else { + $this->pushToken(Token::BLOCK_START_TYPE); + $this->pushState(self::STATE_BLOCK); + $this->currentVarBlockLine = $this->lineno; + } + break; + + case $this->options['tag_variable'][0]: + $this->pushToken(Token::VAR_START_TYPE); + $this->pushState(self::STATE_VAR); + $this->currentVarBlockLine = $this->lineno; + break; + } + } + + protected function lexBlock() + { + if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::BLOCK_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function lexVar() + { + if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::VAR_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function lexExpression() + { + // whitespace + if (preg_match('/\s+/A', $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + + if ($this->cursor >= $this->end) { + throw new SyntaxError(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); + } + } + + // arrow function + if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { + $this->pushToken(Token::ARROW_TYPE, '=>'); + $this->moveCursor('=>'); + } + // operators + elseif (preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0])); + $this->moveCursor($match[0]); + } + // names + elseif (preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::NAME_TYPE, $match[0]); + $this->moveCursor($match[0]); + } + // numbers + elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) { + $number = (float) $match[0]; // floats + if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { + $number = (int) $match[0]; // integers lower than the maximum + } + $this->pushToken(Token::NUMBER_TYPE, $number); + $this->moveCursor($match[0]); + } + // punctuation + elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { + // opening bracket + if (false !== strpos('([{', $this->code[$this->cursor])) { + $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; + } + // closing bracket + elseif (false !== strpos(')]}', $this->code[$this->cursor])) { + if (empty($this->brackets)) { + throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + + list($expect, $lineno) = array_pop($this->brackets); + if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + } + + $this->pushToken(Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); + ++$this->cursor; + } + // strings + elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); + $this->moveCursor($match[0]); + } + // opening double quoted string + elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { + $this->brackets[] = ['"', $this->lineno]; + $this->pushState(self::STATE_STRING); + $this->moveCursor($match[0]); + } + // unlexable + else { + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + protected function lexRawData($tag) + { + if ('raw' === $tag) { + @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); + } + + if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source); + } + + $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); + $this->moveCursor($text.$match[0][0]); + + // trim? + if (isset($match[1][0])) { + if ($this->options['whitespace_trim'] === $match[1][0]) { + // whitespace_trim detected ({%-, {{- or {#-) + $text = rtrim($text); + } else { + // whitespace_line_trim detected ({%~, {{~ or {#~) + // don't trim \r and \n + $text = rtrim($text, " \t\0\x0B"); + } + } + + $this->pushToken(Token::TEXT_TYPE, $text); + } + + protected function lexComment() + { + if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError('Unclosed comment.', $this->lineno, $this->source); + } + + $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); + } + + protected function lexString() + { + if (preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) { + $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; + $this->pushToken(Token::INTERPOLATION_START_TYPE); + $this->moveCursor($match[0]); + $this->pushState(self::STATE_INTERPOLATION); + } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) { + $this->pushToken(Token::STRING_TYPE, stripcslashes($match[0])); + $this->moveCursor($match[0]); + } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { + list($expect, $lineno) = array_pop($this->brackets); + if ('"' != $this->code[$this->cursor]) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + $this->popState(); + ++$this->cursor; + } else { + // unlexable + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + protected function lexInterpolation() + { + $bracket = end($this->brackets); + if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) { + array_pop($this->brackets); + $this->pushToken(Token::INTERPOLATION_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function pushToken($type, $value = '') + { + // do not push empty text tokens + if (Token::TEXT_TYPE === $type && '' === $value) { + return; + } + + $this->tokens[] = new Token($type, $value, $this->lineno); + } + + protected function moveCursor($text) + { + $this->cursor += \strlen($text); + $this->lineno += substr_count($text, "\n"); + } + + protected function getOperatorRegex() + { + $operators = array_merge( + ['='], + array_keys($this->env->getUnaryOperators()), + array_keys($this->env->getBinaryOperators()) + ); + + $operators = array_combine($operators, array_map('strlen', $operators)); + arsort($operators); + + $regex = []; + foreach ($operators as $operator => $length) { + // an operator that ends with a character must be followed by + // a whitespace or a parenthesis + if (ctype_alpha($operator[$length - 1])) { + $r = preg_quote($operator, '/').'(?=[\s()])'; + } else { + $r = preg_quote($operator, '/'); + } + + // an operator with a space can be any amount of whitespaces + $r = preg_replace('/\s+/', '\s+', $r); + + $regex[] = $r; + } + + return '/'.implode('|', $regex).'/A'; + } + + protected function pushState($state) + { + $this->states[] = $this->state; + $this->state = $state; + } + + protected function popState() + { + if (0 === \count($this->states)) { + throw new \LogicException('Cannot pop state without a previous state.'); + } + + $this->state = array_pop($this->states); + } +} + +class_alias('Twig\Lexer', 'Twig_Lexer'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ArrayLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ArrayLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ArrayLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ArrayLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ChainLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ChainLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ChainLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ChainLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ExistsLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/ExistsLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/FilesystemLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/FilesystemLoader.php new file mode 100644 index 0000000..d6562d0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/FilesystemLoader.php @@ -0,0 +1,324 @@ + + */ +class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface +{ + /** Identifier of the main namespace. */ + const MAIN_NAMESPACE = '__main__'; + + protected $paths = []; + protected $cache = []; + protected $errorCache = []; + + private $rootPath; + + /** + * @param string|array $paths A path or an array of paths where to look for templates + * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) + */ + public function __construct($paths = [], $rootPath = null) + { + $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR; + if (false !== $realPath = realpath($rootPath)) { + $this->rootPath = $realPath.\DIRECTORY_SEPARATOR; + } + + if ($paths) { + $this->setPaths($paths); + } + } + + /** + * Returns the paths to the templates. + * + * @param string $namespace A path namespace + * + * @return array The array of paths where to look for templates + */ + public function getPaths($namespace = self::MAIN_NAMESPACE) + { + return isset($this->paths[$namespace]) ? $this->paths[$namespace] : []; + } + + /** + * Returns the path namespaces. + * + * The main namespace is always defined. + * + * @return array The array of defined namespaces + */ + public function getNamespaces() + { + return array_keys($this->paths); + } + + /** + * Sets the paths where templates are stored. + * + * @param string|array $paths A path or an array of paths where to look for templates + * @param string $namespace A path namespace + */ + public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) + { + if (!\is_array($paths)) { + $paths = [$paths]; + } + + $this->paths[$namespace] = []; + foreach ($paths as $path) { + $this->addPath($path, $namespace); + } + } + + /** + * Adds a path where templates are stored. + * + * @param string $path A path where to look for templates + * @param string $namespace A path namespace + * + * @throws LoaderError + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) + { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } + + $this->paths[$namespace][] = rtrim($path, '/\\'); + } + + /** + * Prepends a path where templates are stored. + * + * @param string $path A path where to look for templates + * @param string $namespace A path namespace + * + * @throws LoaderError + */ + public function prependPath($path, $namespace = self::MAIN_NAMESPACE) + { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } + + $path = rtrim($path, '/\\'); + + if (!isset($this->paths[$namespace])) { + $this->paths[$namespace][] = $path; + } else { + array_unshift($this->paths[$namespace], $path); + } + } + + public function getSource($name) + { + @trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), E_USER_DEPRECATED); + + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return ''; + } + + return file_get_contents($path); + } + + public function getSourceContext($name) + { + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return new Source('', $name, ''); + } + + return new Source(file_get_contents($path), $name, $path); + } + + public function getCacheKey($name) + { + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return ''; + } + $len = \strlen($this->rootPath); + if (0 === strncmp($this->rootPath, $path, $len)) { + return substr($path, $len); + } + + return $path; + } + + public function exists($name) + { + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return true; + } + + try { + return null !== ($path = $this->findTemplate($name, false)) && false !== $path; + } catch (LoaderError $e) { + @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); + + return false; + } + } + + public function isFresh($name, $time) + { + // false support to be removed in 3.0 + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return false; + } + + return filemtime($path) < $time; + } + + /** + * Checks if the template can be found. + * + * @param string $name The template name + * + * @return string|false The template name or false + * @return string|false|null The template name or false/null + */ + protected function findTemplate($name) + { + $throw = \func_num_args() > 1 ? func_get_arg(1) : true; + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return $this->cache[$name]; + } + + if (isset($this->errorCache[$name])) { + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + try { + $this->validateName($name); + + list($namespace, $shortname) = $this->parseName($name); + } catch (LoaderError $e) { + if (!$throw) { + return false; + } + + throw $e; + } + + if (!isset($this->paths[$namespace])) { + $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); + + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + foreach ($this->paths[$namespace] as $path) { + if (!$this->isAbsolutePath($path)) { + $path = $this->rootPath.$path; + } + + if (is_file($path.'/'.$shortname)) { + if (false !== $realpath = realpath($path.'/'.$shortname)) { + return $this->cache[$name] = $realpath; + } + + return $this->cache[$name] = $path.'/'.$shortname; + } + } + + $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); + + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + protected function parseName($name, $default = self::MAIN_NAMESPACE) + { + if (isset($name[0]) && '@' == $name[0]) { + if (false === $pos = strpos($name, '/')) { + throw new LoaderError(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); + } + + $namespace = substr($name, 1, $pos - 1); + $shortname = substr($name, $pos + 1); + + return [$namespace, $shortname]; + } + + return [$default, $name]; + } + + protected function normalizeName($name) + { + return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name)); + } + + protected function validateName($name) + { + if (false !== strpos($name, "\0")) { + throw new LoaderError('A template name cannot contain NUL bytes.'); + } + + $name = ltrim($name, '/'); + $parts = explode('/', $name); + $level = 0; + foreach ($parts as $part) { + if ('..' === $part) { + --$level; + } elseif ('.' !== $part) { + ++$level; + } + + if ($level < 0) { + throw new LoaderError(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); + } + } + } + + private function isAbsolutePath($file) + { + return strspn($file, '/\\', 0, 1) + || (\strlen($file) > 3 && ctype_alpha($file[0]) + && ':' === substr($file, 1, 1) + && strspn($file, '/\\', 2, 1) + ) + || null !== parse_url($file, PHP_URL_SCHEME) + ; + } +} + +class_alias('Twig\Loader\FilesystemLoader', 'Twig_Loader_Filesystem'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/LoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/LoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/LoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/LoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/SourceContextLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Loader/SourceContextLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Markup.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Markup.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Markup.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Markup.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/AutoEscapeNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/AutoEscapeNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/AutoEscapeNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/AutoEscapeNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BlockNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BlockNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BlockNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BlockNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BlockReferenceNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BlockReferenceNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BlockReferenceNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BlockReferenceNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BodyNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BodyNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/BodyNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/BodyNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/CheckSecurityNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/CheckSecurityNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/CheckSecurityNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/CheckSecurityNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/CheckToStringNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/CheckToStringNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/CheckToStringNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/CheckToStringNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/DeprecatedNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/DeprecatedNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/DeprecatedNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/DeprecatedNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/DoNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/DoNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/DoNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/DoNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/EmbedNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/EmbedNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/EmbedNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/EmbedNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/AbstractExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/AbstractExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/AbstractExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/AbstractExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ArrayExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ArrayExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ArrayExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ArrayExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/AssignNameExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/AssignNameExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AddBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AddBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AndBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/AndBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/DivBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/DivBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/EqualBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/EqualBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/InBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/InBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/LessBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/LessBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/ModBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/ModBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/MulBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/MulBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/NotInBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/NotInBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/OrBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/OrBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/PowerBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/PowerBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/RangeBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/RangeBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/SubBinary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Binary/SubBinary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/BlockReferenceExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/BlockReferenceExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/CallExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/CallExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/CallExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/CallExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ConditionalExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ConditionalExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ConstantExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ConstantExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ConstantExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ConstantExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/FilterExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/FilterExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/FilterExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/FilterExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/FunctionExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/FunctionExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/FunctionExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/FunctionExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/GetAttrExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/GetAttrExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/InlinePrint.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/InlinePrint.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/InlinePrint.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/InlinePrint.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/MethodCallExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/MethodCallExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NameExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NameExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/NameExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NameExpression.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php new file mode 100644 index 0000000..49326d4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php @@ -0,0 +1,58 @@ +getTemplateLine()), + new NotUnary(new NullTest($left, 'null', new Node(), $left->getTemplateLine()), $left->getTemplateLine()), + $left->getTemplateLine() + ); + + parent::__construct($test, $left, $right, $lineno); + } + + public function compile(Compiler $compiler) + { + /* + * This optimizes only one case. PHP 7 also supports more complex expressions + * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, + * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced + * cases might be implemented as an optimizer node visitor, but has not been done + * as benefits are probably not worth the added complexity. + */ + if (\PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof NameExpression) { + $this->getNode('expr2')->setAttribute('always_defined', true); + $compiler + ->raw('((') + ->subcompile($this->getNode('expr2')) + ->raw(') ?? (') + ->subcompile($this->getNode('expr3')) + ->raw('))') + ; + } else { + parent::compile($compiler); + } + } +} + +class_alias('Twig\Node\Expression\NullCoalesceExpression', 'Twig_Node_Expression_NullCoalesce'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ParentExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ParentExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/ParentExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/ParentExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/TempNameExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/TempNameExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/TempNameExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/TempNameExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/ConstantTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/ConstantTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/DefinedTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/DefinedTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/EvenTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/EvenTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/NullTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/NullTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/NullTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/NullTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/OddTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/OddTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/OddTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/OddTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/SameasTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Test/SameasTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/TestExpression.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/TestExpression.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/TestExpression.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/TestExpression.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/NegUnary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/NegUnary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/NotUnary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/NotUnary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/PosUnary.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Expression/Unary/PosUnary.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/FlushNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/FlushNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/FlushNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/FlushNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ForLoopNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ForLoopNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ForLoopNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ForLoopNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ForNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ForNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ForNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ForNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/IfNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/IfNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/IfNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/IfNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ImportNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ImportNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ImportNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ImportNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/IncludeNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/IncludeNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/IncludeNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/IncludeNode.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/MacroNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/MacroNode.php new file mode 100644 index 0000000..017578b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/MacroNode.php @@ -0,0 +1,130 @@ + + */ +class MacroNode extends Node +{ + const VARARGS_NAME = 'varargs'; + + public function __construct($name, \Twig_NodeInterface $body, \Twig_NodeInterface $arguments, $lineno, $tag = null) + { + foreach ($arguments as $argumentName => $argument) { + if (self::VARARGS_NAME === $argumentName) { + throw new SyntaxError(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(), $argument->getSourceContext()); + } + } + + parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write(sprintf('public function get%s(', $this->getAttribute('name'))) + ; + + $count = \count($this->getNode('arguments')); + $pos = 0; + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->raw('$__'.$name.'__ = ') + ->subcompile($default) + ; + + if (++$pos < $count) { + $compiler->raw(', '); + } + } + + if (\PHP_VERSION_ID >= 50600) { + if ($count) { + $compiler->raw(', '); + } + + $compiler->raw('...$__varargs__'); + } + + $compiler + ->raw(")\n") + ->write("{\n") + ->indent() + ; + + $compiler + ->write("\$context = \$this->env->mergeGlobals([\n") + ->indent() + ; + + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->write('') + ->string($name) + ->raw(' => $__'.$name.'__') + ->raw(",\n") + ; + } + + $compiler + ->write('') + ->string(self::VARARGS_NAME) + ->raw(' => ') + ; + + if (\PHP_VERSION_ID >= 50600) { + $compiler->raw("\$__varargs__,\n"); + } else { + $compiler + ->raw('func_num_args() > ') + ->repr($count) + ->raw(' ? array_slice(func_get_args(), ') + ->repr($count) + ->raw(") : [],\n") + ; + } + + $compiler + ->outdent() + ->write("]);\n\n") + ->write("\$blocks = [];\n\n") + ->write("ob_start(function () { return ''; });\n") + ->write("try {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->outdent() + ->write("} catch (\Exception \$e) {\n") + ->indent() + ->write("ob_end_clean();\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("} catch (\Throwable \$e) {\n") + ->indent() + ->write("ob_end_clean();\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("}\n\n") + ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n") + ->outdent() + ->write("}\n\n") + ; + } +} + +class_alias('Twig\Node\MacroNode', 'Twig_Node_Macro'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ModuleNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ModuleNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/ModuleNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/ModuleNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Node.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Node.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/Node.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/Node.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/NodeCaptureInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/NodeCaptureInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/NodeCaptureInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/NodeCaptureInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/NodeOutputInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/NodeOutputInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/NodeOutputInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/NodeOutputInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/PrintNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/PrintNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/PrintNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/PrintNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SandboxNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SandboxNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SandboxNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SandboxNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SandboxedPrintNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SandboxedPrintNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SandboxedPrintNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SandboxedPrintNode.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetNode.php new file mode 100644 index 0000000..15e5467 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetNode.php @@ -0,0 +1,103 @@ + + */ +class SetNode extends Node implements NodeCaptureInterface +{ + public function __construct($capture, \Twig_NodeInterface $names, \Twig_NodeInterface $values, $lineno, $tag = null) + { + parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => false], $lineno, $tag); + + /* + * Optimizes the node when capture is used for a large block of text. + * + * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo"); + */ + if ($this->getAttribute('capture')) { + $this->setAttribute('safe', true); + + $values = $this->getNode('values'); + if ($values instanceof TextNode) { + $this->setNode('values', new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); + $this->setAttribute('capture', false); + } + } + } + + public function compile(Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('list('); + foreach ($this->getNode('names') as $idx => $node) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($node); + } + $compiler->raw(')'); + } else { + if ($this->getAttribute('capture')) { + $compiler + ->write("ob_start(function () { return ''; });\n") + ->subcompile($this->getNode('values')) + ; + } + + $compiler->subcompile($this->getNode('names'), false); + + if ($this->getAttribute('capture')) { + $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); + } + } + + if (!$this->getAttribute('capture')) { + $compiler->raw(' = '); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('['); + foreach ($this->getNode('values') as $idx => $value) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($value); + } + $compiler->raw(']'); + } else { + if ($this->getAttribute('safe')) { + $compiler + ->raw("('' === \$tmp = ") + ->subcompile($this->getNode('values')) + ->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())") + ; + } else { + $compiler->subcompile($this->getNode('values')); + } + } + } + + $compiler->raw(";\n"); + } +} + +class_alias('Twig\Node\SetNode', 'Twig_Node_Set'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetTempNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetTempNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/SetTempNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SetTempNode.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SpacelessNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SpacelessNode.php new file mode 100644 index 0000000..9d85748 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/SpacelessNode.php @@ -0,0 +1,41 @@ + + */ +class SpacelessNode extends Node +{ + public function __construct(\Twig_NodeInterface $body, $lineno, $tag = 'spaceless') + { + parent::__construct(['body' => $body], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("ob_start(function () { return ''; });\n") + ->subcompile($this->getNode('body')) + ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") + ; + } +} + +class_alias('Twig\Node\SpacelessNode', 'Twig_Node_Spaceless'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/TextNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/TextNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/TextNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/TextNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Node/WithNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/WithNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Node/WithNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Node/WithNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeTraverser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeTraverser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeTraverser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeTraverser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php new file mode 100644 index 0000000..c1d302a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php @@ -0,0 +1,137 @@ + + */ +class SandboxNodeVisitor extends AbstractNodeVisitor +{ + protected $inAModule = false; + protected $tags; + protected $filters; + protected $functions; + + private $needsToStringWrap = false; + + protected function doEnterNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + $this->inAModule = true; + $this->tags = []; + $this->filters = []; + $this->functions = []; + + return $node; + } elseif ($this->inAModule) { + // look for tags + if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { + $this->tags[$node->getNodeTag()] = $node; + } + + // look for filters + if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { + $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; + } + + // look for functions + if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { + $this->functions[$node->getAttribute('name')] = $node; + } + + // the .. operator is equivalent to the range() function + if ($node instanceof RangeBinary && !isset($this->functions['range'])) { + $this->functions['range'] = $node; + } + + if ($node instanceof PrintNode) { + $this->needsToStringWrap = true; + $this->wrapNode($node, 'expr'); + } + + if ($node instanceof SetNode && !$node->getAttribute('capture')) { + $this->needsToStringWrap = true; + } + + // wrap outer nodes that can implicitly call __toString() + if ($this->needsToStringWrap) { + if ($node instanceof ConcatBinary) { + $this->wrapNode($node, 'left'); + $this->wrapNode($node, 'right'); + } + if ($node instanceof FilterExpression) { + $this->wrapNode($node, 'node'); + $this->wrapArrayNode($node, 'arguments'); + } + if ($node instanceof FunctionExpression) { + $this->wrapArrayNode($node, 'arguments'); + } + } + } + + return $node; + } + + protected function doLeaveNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + $this->inAModule = false; + + $node->setNode('constructor_end', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')])); + } elseif ($this->inAModule) { + if ($node instanceof PrintNode || $node instanceof SetNode) { + $this->needsToStringWrap = false; + } + } + + return $node; + } + + private function wrapNode(Node $node, $name) + { + $expr = $node->getNode($name); + if ($expr instanceof NameExpression || $expr instanceof GetAttrExpression) { + $node->setNode($name, new CheckToStringNode($expr)); + } + } + + private function wrapArrayNode(Node $node, $name) + { + $args = $node->getNode($name); + foreach ($args as $name => $_) { + $this->wrapNode($args, $name); + } + } + + public function getPriority() + { + return 0; + } +} + +class_alias('Twig\NodeVisitor\SandboxNodeVisitor', 'Twig_NodeVisitor_Sandbox'); diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Parser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Parser.php new file mode 100644 index 0000000..444d4c5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Parser.php @@ -0,0 +1,431 @@ + + */ +class Parser implements \Twig_ParserInterface +{ + protected $stack = []; + protected $stream; + protected $parent; + protected $handlers; + protected $visitors; + protected $expressionParser; + protected $blocks; + protected $blockStack; + protected $macros; + protected $env; + protected $reservedMacroNames; + protected $importedSymbols; + protected $traits; + protected $embeddedTemplates = []; + private $varNameSalt = 0; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getEnvironment() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->env; + } + + public function getVarName() + { + return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); + } + + /** + * @deprecated since 1.27 (to be removed in 2.0). Use $parser->getStream()->getSourceContext()->getPath() instead. + */ + public function getFilename() + { + @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); + + return $this->stream->getSourceContext()->getName(); + } + + public function parse(TokenStream $stream, $test = null, $dropNeedle = false) + { + // push all variables into the stack to keep the current state of the parser + // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336 + // This hack can be removed when min version if PHP 7.0 + $vars = []; + foreach ($this as $k => $v) { + $vars[$k] = $v; + } + + unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); + $this->stack[] = $vars; + + // tag handlers + if (null === $this->handlers) { + $this->handlers = $this->env->getTokenParsers(); + $this->handlers->setParser($this); + } + + // node visitors + if (null === $this->visitors) { + $this->visitors = $this->env->getNodeVisitors(); + } + + if (null === $this->expressionParser) { + $this->expressionParser = new ExpressionParser($this, $this->env); + } + + $this->stream = $stream; + $this->parent = null; + $this->blocks = []; + $this->macros = []; + $this->traits = []; + $this->blockStack = []; + $this->importedSymbols = [[]]; + $this->embeddedTemplates = []; + $this->varNameSalt = 0; + + try { + $body = $this->subparse($test, $dropNeedle); + + if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { + $body = new Node(); + } + } catch (SyntaxError $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->stream->getSourceContext()); + } + + if (!$e->getTemplateLine()) { + $e->setTemplateLine($this->stream->getCurrent()->getLine()); + } + + throw $e; + } + + $node = new ModuleNode(new BodyNode([$body]), $this->parent, new Node($this->blocks), new Node($this->macros), new Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); + + $traverser = new NodeTraverser($this->env, $this->visitors); + + $node = $traverser->traverse($node); + + // restore previous stack so previous parse() call can resume working + foreach (array_pop($this->stack) as $key => $val) { + $this->$key = $val; + } + + return $node; + } + + public function subparse($test, $dropNeedle = false) + { + $lineno = $this->getCurrentToken()->getLine(); + $rv = []; + while (!$this->stream->isEOF()) { + switch ($this->getCurrentToken()->getType()) { + case Token::TEXT_TYPE: + $token = $this->stream->next(); + $rv[] = new TextNode($token->getValue(), $token->getLine()); + break; + + case Token::VAR_START_TYPE: + $token = $this->stream->next(); + $expr = $this->expressionParser->parseExpression(); + $this->stream->expect(Token::VAR_END_TYPE); + $rv[] = new PrintNode($expr, $token->getLine()); + break; + + case Token::BLOCK_START_TYPE: + $this->stream->next(); + $token = $this->getCurrentToken(); + + if (Token::NAME_TYPE !== $token->getType()) { + throw new SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); + } + + if (null !== $test && \call_user_func($test, $token)) { + if ($dropNeedle) { + $this->stream->next(); + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + $subparser = $this->handlers->getTokenParser($token->getValue()); + if (null === $subparser) { + if (null !== $test) { + $e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + + if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) { + $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); + } + } else { + $e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); + } + + throw $e; + } + + $this->stream->next(); + + $node = $subparser->parse($token); + if (null !== $node) { + $rv[] = $node; + } + break; + + default: + throw new SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); + } + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function addHandler($name, $class) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + $this->handlers[$name] = $class; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function addNodeVisitor(NodeVisitorInterface $visitor) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + $this->visitors[] = $visitor; + } + + public function getBlockStack() + { + return $this->blockStack; + } + + public function peekBlockStack() + { + return $this->blockStack[\count($this->blockStack) - 1]; + } + + public function popBlockStack() + { + array_pop($this->blockStack); + } + + public function pushBlockStack($name) + { + $this->blockStack[] = $name; + } + + public function hasBlock($name) + { + return isset($this->blocks[$name]); + } + + public function getBlock($name) + { + return $this->blocks[$name]; + } + + public function setBlock($name, BlockNode $value) + { + $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); + } + + public function hasMacro($name) + { + return isset($this->macros[$name]); + } + + public function setMacro($name, MacroNode $node) + { + if ($this->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + $this->macros[$name] = $node; + } + + public function isReservedMacroName($name) + { + if (null === $this->reservedMacroNames) { + $this->reservedMacroNames = []; + $r = new \ReflectionClass($this->env->getBaseTemplateClass()); + foreach ($r->getMethods() as $method) { + $methodName = strtolower($method->getName()); + + if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) { + $this->reservedMacroNames[] = substr($methodName, 3); + } + } + } + + return \in_array(strtolower($name), $this->reservedMacroNames); + } + + public function addTrait($trait) + { + $this->traits[] = $trait; + } + + public function hasTraits() + { + return \count($this->traits) > 0; + } + + public function embedTemplate(ModuleNode $template) + { + $template->setIndex(mt_rand()); + + $this->embeddedTemplates[] = $template; + } + + public function addImportedSymbol($type, $alias, $name = null, AbstractExpression $node = null) + { + $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; + } + + public function getImportedSymbol($type, $alias) + { + foreach ($this->importedSymbols as $functions) { + if (isset($functions[$type][$alias])) { + return $functions[$type][$alias]; + } + } + } + + public function isMainScope() + { + return 1 === \count($this->importedSymbols); + } + + public function pushLocalScope() + { + array_unshift($this->importedSymbols, []); + } + + public function popLocalScope() + { + array_shift($this->importedSymbols); + } + + /** + * @return ExpressionParser + */ + public function getExpressionParser() + { + return $this->expressionParser; + } + + public function getParent() + { + return $this->parent; + } + + public function setParent($parent) + { + $this->parent = $parent; + } + + /** + * @return TokenStream + */ + public function getStream() + { + return $this->stream; + } + + /** + * @return Token + */ + public function getCurrentToken() + { + return $this->stream->getCurrent(); + } + + protected function filterBodyNodes(\Twig_NodeInterface $node) + { + // check that the body does not contain non-empty output nodes + if ( + ($node instanceof TextNode && !ctype_space($node->getAttribute('data'))) + || + (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface) + ) { + if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) { + $t = substr($node->getAttribute('data'), 3); + if ('' === $t || ctype_space($t)) { + // bypass empty nodes starting with a BOM + return; + } + } + + throw new SyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + // bypass nodes that will "capture" the output + if ($node instanceof NodeCaptureInterface) { + return $node; + } + + if ($node instanceof NodeOutputInterface) { + return; + } + + foreach ($node as $k => $n) { + if (null !== $n && null === $this->filterBodyNodes($n)) { + $node->removeNode($k); + } + } + + return $node; + } +} + +class_alias('Twig\Parser', 'Twig_Parser'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/BaseDumper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/BaseDumper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/HtmlDumper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/HtmlDumper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/TextDumper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Dumper/TextDumper.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Node/EnterProfileNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Node/EnterProfileNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Node/LeaveProfileNode.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Node/LeaveProfileNode.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Profile.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Profile.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Profiler/Profile.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Profiler/Profile.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicy.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicy.php new file mode 100644 index 0000000..31b6c34 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicy.php @@ -0,0 +1,129 @@ + + */ +class SecurityPolicy implements SecurityPolicyInterface +{ + protected $allowedTags; + protected $allowedFilters; + protected $allowedMethods; + protected $allowedProperties; + protected $allowedFunctions; + + public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) + { + $this->allowedTags = $allowedTags; + $this->allowedFilters = $allowedFilters; + $this->setAllowedMethods($allowedMethods); + $this->allowedProperties = $allowedProperties; + $this->allowedFunctions = $allowedFunctions; + } + + public function setAllowedTags(array $tags) + { + $this->allowedTags = $tags; + } + + public function setAllowedFilters(array $filters) + { + $this->allowedFilters = $filters; + } + + public function setAllowedMethods(array $methods) + { + $this->allowedMethods = []; + foreach ($methods as $class => $m) { + $this->allowedMethods[$class] = array_map('strtolower', \is_array($m) ? $m : [$m]); + } + } + + public function setAllowedProperties(array $properties) + { + $this->allowedProperties = $properties; + } + + public function setAllowedFunctions(array $functions) + { + $this->allowedFunctions = $functions; + } + + public function checkSecurity($tags, $filters, $functions) + { + foreach ($tags as $tag) { + if (!\in_array($tag, $this->allowedTags)) { + throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); + } + } + + foreach ($filters as $filter) { + if (!\in_array($filter, $this->allowedFilters)) { + throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); + } + } + + foreach ($functions as $function) { + if (!\in_array($function, $this->allowedFunctions)) { + throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); + } + } + } + + public function checkMethodAllowed($obj, $method) + { + if ($obj instanceof \Twig_TemplateInterface || $obj instanceof Markup) { + return; + } + + $allowed = false; + $method = strtolower($method); + foreach ($this->allowedMethods as $class => $methods) { + if ($obj instanceof $class) { + $allowed = \in_array($method, $methods); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); + } + } + + public function checkPropertyAllowed($obj, $property) + { + $allowed = false; + foreach ($this->allowedProperties as $class => $properties) { + if ($obj instanceof $class) { + $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); + } + } +} + +class_alias('Twig\Sandbox\SecurityPolicy', 'Twig_Sandbox_SecurityPolicy'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Sandbox/SecurityPolicyInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Source.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Source.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Source.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Source.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Template.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Template.php new file mode 100644 index 0000000..4264d1c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Template.php @@ -0,0 +1,721 @@ +load() + * instead, which returns an instance of \Twig\TemplateWrapper. + * + * @author Fabien Potencier + * + * @internal + */ +abstract class Template implements \Twig_TemplateInterface +{ + /** + * @internal + */ + protected static $cache = []; + + protected $parent; + protected $parents = []; + protected $env; + protected $blocks = []; + protected $traits = []; + protected $sandbox; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + /** + * @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0 + */ + public function __toString() + { + return $this->getTemplateName(); + } + + /** + * Returns the template name. + * + * @return string The template name + */ + abstract public function getTemplateName(); + + /** + * Returns debug information about the template. + * + * @return array Debug information + */ + public function getDebugInfo() + { + return []; + } + + /** + * Returns the template source code. + * + * @return string The template source code + * + * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead + */ + public function getSource() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); + + return ''; + } + + /** + * Returns information about the original template source code. + * + * @return Source + */ + public function getSourceContext() + { + return new Source('', $this->getTemplateName()); + } + + /** + * @deprecated since 1.20 (to be removed in 2.0) + */ + public function getEnvironment() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->env; + } + + /** + * Returns the parent template. + * + * This method is for internal use only and should never be called + * directly. + * + * @param array $context + * + * @return \Twig_TemplateInterface|TemplateWrapper|false The parent template or false if there is no parent + * + * @internal + */ + public function getParent(array $context) + { + if (null !== $this->parent) { + return $this->parent; + } + + try { + $parent = $this->doGetParent($context); + + if (false === $parent) { + return false; + } + + if ($parent instanceof self || $parent instanceof TemplateWrapper) { + return $this->parents[$parent->getSourceContext()->getName()] = $parent; + } + + if (!isset($this->parents[$parent])) { + $this->parents[$parent] = $this->loadTemplate($parent); + } + } catch (LoaderError $e) { + $e->setSourceContext(null); + $e->guess(); + + throw $e; + } + + return $this->parents[$parent]; + } + + protected function doGetParent(array $context) + { + return false; + } + + public function isTraitable() + { + return true; + } + + /** + * Displays a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + */ + public function displayParentBlock($name, array $context, array $blocks = []) + { + $name = (string) $name; + + if (isset($this->traits[$name])) { + $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, $blocks, false); + } else { + throw new RuntimeError(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); + } + } + + /** + * Displays a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + */ + public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true) + { + $name = (string) $name; + + if ($useBlocks && isset($blocks[$name])) { + $template = $blocks[$name][0]; + $block = $blocks[$name][1]; + } elseif (isset($this->blocks[$name])) { + $template = $this->blocks[$name][0]; + $block = $this->blocks[$name][1]; + } else { + $template = null; + $block = null; + } + + // avoid RCEs when sandbox is enabled + if (null !== $template && !$template instanceof self) { + throw new \LogicException('A block must be a method on a \Twig\Template instance.'); + } + + if (null !== $template) { + try { + $template->$block($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($template->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); + $e->guess(); + + throw $e; + } + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false); + } else { + @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); + } + } + + /** + * Renders a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return string The rendered block + */ + public function renderParentBlock($name, array $context, array $blocks = []) + { + ob_start(function () { return ''; }); + $this->displayParentBlock($name, $context, $blocks); + + return ob_get_clean(); + } + + /** + * Renders a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + * + * @return string The rendered block + */ + public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true) + { + ob_start(function () { return ''; }); + $this->displayBlock($name, $context, $blocks, $useBlocks); + + return ob_get_clean(); + } + + /** + * Returns whether a block exists or not in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param string $name The block name + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return bool true if the block exists, false otherwise + */ + public function hasBlock($name, array $context = null, array $blocks = []) + { + if (null === $context) { + @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); + + return isset($this->blocks[(string) $name]); + } + + if (isset($blocks[$name])) { + return $blocks[$name][0] instanceof self; + } + + if (isset($this->blocks[$name])) { + return true; + } + + if (false !== $parent = $this->getParent($context)) { + return $parent->hasBlock($name, $context); + } + + return false; + } + + /** + * Returns all block names in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return array An array of block names + */ + public function getBlockNames(array $context = null, array $blocks = []) + { + if (null === $context) { + @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); + + return array_keys($this->blocks); + } + + $names = array_merge(array_keys($blocks), array_keys($this->blocks)); + + if (false !== $parent = $this->getParent($context)) { + $names = array_merge($names, $parent->getBlockNames($context)); + } + + return array_unique($names); + } + + /** + * @return Template|TemplateWrapper + */ + protected function loadTemplate($template, $templateName = null, $line = null, $index = null) + { + try { + if (\is_array($template)) { + return $this->env->resolveTemplate($template); + } + + if ($template instanceof self || $template instanceof TemplateWrapper) { + return $template; + } + + if ($template === $this->getTemplateName()) { + $class = \get_class($this); + if (false !== $pos = strrpos($class, '___', -1)) { + $class = substr($class, 0, $pos); + } + + return $this->env->loadClass($class, $template, $index); + } + + return $this->env->loadTemplate($template, $index); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); + } + + if ($e->getTemplateLine() > 0) { + throw $e; + } + + if (!$line) { + $e->guess(); + } else { + $e->setTemplateLine($line); + } + + throw $e; + } + } + + /** + * @internal + * + * @return Template + */ + protected function unwrap() + { + return $this; + } + + /** + * Returns all blocks. + * + * This method is for internal use only and should never be called + * directly. + * + * @return array An array of blocks + */ + public function getBlocks() + { + return $this->blocks; + } + + public function display(array $context, array $blocks = []) + { + $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); + } + + public function render(array $context) + { + $level = ob_get_level(); + ob_start(function () { return ''; }); + try { + $this->display($context); + } catch (\Exception $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + protected function displayWithErrorHandling(array $context, array $blocks = []) + { + try { + $this->doDisplay($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); + $e->guess(); + + throw $e; + } + } + + /** + * Auto-generated method to display the template with the given context. + * + * @param array $context An array of parameters to pass to the template + * @param array $blocks An array of blocks to pass to the template + */ + abstract protected function doDisplay(array $context, array $blocks = []); + + /** + * Returns a variable from the context. + * + * This method is for internal use only and should never be called + * directly. + * + * This method should not be overridden in a sub-class as this is an + * implementation detail that has been introduced to optimize variable + * access for versions of PHP before 5.4. This is not a way to override + * the way to get a variable value. + * + * @param array $context The context + * @param string $item The variable to return from the context + * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not + * + * @return mixed The content of the context variable + * + * @throws RuntimeError if the variable does not exist and Twig is running in strict mode + * + * @internal + */ + final protected function getContext($context, $item, $ignoreStrictCheck = false) + { + if (!\array_key_exists($item, $context)) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + throw new RuntimeError(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext()); + } + + return $context[$item]; + } + + /** + * Returns the attribute value for a given array/object. + * + * @param mixed $object The object or array from where to get the item + * @param mixed $item The item to get from the array or object + * @param array $arguments An array of arguments to pass if the item is an object method + * @param string $type The type of attribute (@see \Twig\Template constants) + * @param bool $isDefinedTest Whether this is only a defined check + * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not + * + * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true + * + * @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false + * + * @internal + */ + protected function getAttribute($object, $item, array $arguments = [], $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + { + // array + if (self::METHOD_CALL !== $type) { + $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; + + if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, $object))) + || ($object instanceof \ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } + + if (self::ARRAY_CALL === $type || !\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + if ($object instanceof \ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); + } elseif (\is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); + } elseif (\is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (self::ARRAY_CALL === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, -1, $this->getSourceContext()); + } + } + + if (!\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); + } elseif (\is_array($object)) { + $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, -1, $this->getSourceContext()); + } + + // object property + if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones + if (isset($object->$item) || \array_key_exists((string) $item, $object)) { + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } + + $class = \get_class($object); + + // object method + if (!isset(self::$cache[$class])) { + // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates + if ($object instanceof self) { + $ref = new \ReflectionClass($class); + $methods = []; + + foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) { + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== strtolower($refMethod->name)) { + $methods[] = $refMethod->name; + } + } + } else { + $methods = get_class_methods($object); + } + // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods + sort($methods); + + $cache = []; + + foreach ($methods as $method) { + $cache[$method] = $method; + $cache[$lcName = strtolower($method)] = $method; + + if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { + $name = substr($method, 3); + $lcName = substr($lcName, 3); + } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { + $name = substr($method, 2); + $lcName = substr($lcName, 2); + } else { + continue; + } + + // skip get() and is() methods (in which case, $name is empty) + if ($name) { + if (!isset($cache[$name])) { + $cache[$name] = $method; + } + if (!isset($cache[$lcName])) { + $cache[$lcName] = $method; + } + } + } + self::$cache[$class] = $cache; + } + + $call = false; + if (isset(self::$cache[$class][$item])) { + $method = self::$cache[$class][$item]; + } elseif (isset(self::$cache[$class][$lcItem = strtolower($item)])) { + $method = self::$cache[$class][$lcItem]; + } elseif (isset(self::$cache[$class]['__call'])) { + $method = $item; + $call = true; + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + throw new RuntimeError(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()); + } + + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method); + } + + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + if (!$arguments) { + $ret = $object->$method(); + } else { + $ret = \call_user_func_array([$object, $method], $arguments); + } + } catch (\BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { + return; + } + throw $e; + } + + // @deprecated in 1.28 + if ($object instanceof \Twig_TemplateInterface) { + $self = $object->getTemplateName() === $this->getTemplateName(); + $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()); + if ('renderBlock' === $method || 'displayBlock' === $method) { + $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('hasBlock' === $method) { + $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('render' === $method || 'display' === $method) { + $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName()); + } + @trigger_error($message, E_USER_DEPRECATED); + + return '' === $ret ? '' : new Markup($ret, $this->env->getCharset()); + } + + return $ret; + } +} + +class_alias('Twig\Template', 'Twig_Template'); diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TemplateWrapper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TemplateWrapper.php new file mode 100644 index 0000000..84c6317 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TemplateWrapper.php @@ -0,0 +1,157 @@ + + */ +final class TemplateWrapper +{ + private $env; + private $template; + + /** + * This method is for internal use only and should never be called + * directly (use Twig\Environment::load() instead). + * + * @internal + */ + public function __construct(Environment $env, Template $template) + { + $this->env = $env; + $this->template = $template; + } + + /** + * Renders the template. + * + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered template + */ + public function render($context = []) + { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + return $this->template->render($context, \func_num_args() > 1 ? func_get_arg(1) : []); + } + + /** + * Displays the template. + * + * @param array $context An array of parameters to pass to the template + */ + public function display($context = []) + { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + $this->template->display($context, \func_num_args() > 1 ? func_get_arg(1) : []); + } + + /** + * Checks if a block is defined. + * + * @param string $name The block name + * @param array $context An array of parameters to pass to the template + * + * @return bool + */ + public function hasBlock($name, $context = []) + { + return $this->template->hasBlock($name, $context); + } + + /** + * Returns defined block names in the template. + * + * @param array $context An array of parameters to pass to the template + * + * @return string[] An array of defined template block names + */ + public function getBlockNames($context = []) + { + return $this->template->getBlockNames($context); + } + + /** + * Renders a template block. + * + * @param string $name The block name to render + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered block + */ + public function renderBlock($name, $context = []) + { + $context = $this->env->mergeGlobals($context); + $level = ob_get_level(); + ob_start(function () { return ''; }); + try { + $this->template->displayBlock($name, $context); + } catch (\Exception $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + /** + * Displays a template block. + * + * @param string $name The block name to render + * @param array $context An array of parameters to pass to the template + */ + public function displayBlock($name, $context = []) + { + $this->template->displayBlock($name, $this->env->mergeGlobals($context)); + } + + /** + * @return Source + */ + public function getSourceContext() + { + return $this->template->getSourceContext(); + } + + /** + * @return string + */ + public function getTemplateName() + { + return $this->template->getTemplateName(); + } + + /** + * @internal + * + * @return Template + */ + public function unwrap() + { + return $this->template; + } +} + +class_alias('Twig\TemplateWrapper', 'Twig_TemplateWrapper'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Test/IntegrationTestCase.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Test/IntegrationTestCase.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Test/IntegrationTestCase.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Test/IntegrationTestCase.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Test/NodeTestCase.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Test/NodeTestCase.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Test/NodeTestCase.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Test/NodeTestCase.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Token.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Token.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Token.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Token.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/AbstractTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/AbstractTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ApplyTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ApplyTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/BlockTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/BlockTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/BlockTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/BlockTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/DeprecatedTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/DeprecatedTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/DoTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/DoTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/DoTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/DoTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/EmbedTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/EmbedTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php new file mode 100644 index 0000000..9e1cea8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php @@ -0,0 +1,52 @@ +parser->getStream(); + + if (!$this->parser->isMainScope()) { + throw new SyntaxError('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext()); + } + + if (null !== $this->parser->getParent()) { + throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); + } + $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new Node(); + } + + public function getTag() + { + return 'extends'; + } +} + +class_alias('Twig\TokenParser\ExtendsTokenParser', 'Twig_TokenParser_Extends'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FilterTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FilterTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FilterTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FilterTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FlushTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FlushTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/FlushTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FlushTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ForTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ForTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/ForTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ForTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FromTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FromTokenParser.php new file mode 100644 index 0000000..a47f197 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/FromTokenParser.php @@ -0,0 +1,71 @@ +parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect('import'); + + $targets = []; + do { + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(Token::NAME_TYPE)->getValue(); + } + + $targets[$name] = $alias; + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } while (true); + + $stream->expect(Token::BLOCK_END_TYPE); + + $node = new ImportNode($macro, new AssignNameExpression($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); + + foreach ($targets as $name => $alias) { + if ($this->parser->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); + } + + $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); + } + + return $node; + } + + public function getTag() + { + return 'from'; + } +} + +class_alias('Twig\TokenParser\FromTokenParser', 'Twig_TokenParser_From'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/IfTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/IfTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/IfTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/IfTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ImportTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ImportTokenParser.php new file mode 100644 index 0000000..317e0a5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/ImportTokenParser.php @@ -0,0 +1,45 @@ +parser->getExpressionParser()->parseExpression(); + $this->parser->getStream()->expect('as'); + $var = new AssignNameExpression($this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(), $token->getLine()); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + $this->parser->addImportedSymbol('template', $var->getAttribute('name')); + + return new ImportNode($macro, $var, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'import'; + } +} + +class_alias('Twig\TokenParser\ImportTokenParser', 'Twig_TokenParser_Import'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/IncludeTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/IncludeTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/MacroTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/MacroTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/MacroTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/MacroTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SandboxTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SandboxTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SetTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SetTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SetTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SetTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SpacelessTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/SpacelessTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/TokenParserInterface.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/TokenParserInterface.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/TokenParserInterface.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/TokenParserInterface.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/UseTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/UseTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/UseTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/UseTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/WithTokenParser.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/WithTokenParser.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TokenParser/WithTokenParser.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenParser/WithTokenParser.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenStream.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenStream.php new file mode 100644 index 0000000..b5b089f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TokenStream.php @@ -0,0 +1,200 @@ + + */ +class TokenStream +{ + protected $tokens; + protected $current = 0; + protected $filename; + + private $source; + + /** + * @param array $tokens An array of tokens + * @param string|null $name The name of the template which tokens are associated with + * @param string|null $source The source code associated with the tokens + */ + public function __construct(array $tokens, $name = null, $source = null) + { + if (!$name instanceof Source) { + if (null !== $name || null !== $source) { + @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + } + $this->source = new Source($source, $name); + } else { + $this->source = $name; + } + + $this->tokens = $tokens; + + // deprecated, not used anymore, to be removed in 2.0 + $this->filename = $this->source->getName(); + } + + public function __toString() + { + return implode("\n", $this->tokens); + } + + public function injectTokens(array $tokens) + { + $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); + } + + /** + * Sets the pointer to the next token and returns the old one. + * + * @return Token + */ + public function next() + { + if (!isset($this->tokens[++$this->current])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current - 1]; + } + + /** + * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. + * + * @return Token|null The next token if the condition is true, null otherwise + */ + public function nextIf($primary, $secondary = null) + { + if ($this->tokens[$this->current]->test($primary, $secondary)) { + return $this->next(); + } + } + + /** + * Tests a token and returns it or throws a syntax error. + * + * @return Token + */ + public function expect($type, $value = null, $message = null) + { + $token = $this->tokens[$this->current]; + if (!$token->test($type, $value)) { + $line = $token->getLine(); + throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', + $message ? $message.'. ' : '', + Token::typeToEnglish($token->getType()), $token->getValue(), + Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), + $line, + $this->source + ); + } + $this->next(); + + return $token; + } + + /** + * Looks at the next token. + * + * @param int $number + * + * @return Token + */ + public function look($number = 1) + { + if (!isset($this->tokens[$this->current + $number])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current + $number]; + } + + /** + * Tests the current token. + * + * @return bool + */ + public function test($primary, $secondary = null) + { + return $this->tokens[$this->current]->test($primary, $secondary); + } + + /** + * Checks if end of stream was reached. + * + * @return bool + */ + public function isEOF() + { + return Token::EOF_TYPE === $this->tokens[$this->current]->getType(); + } + + /** + * @return Token + */ + public function getCurrent() + { + return $this->tokens[$this->current]; + } + + /** + * Gets the name associated with this stream (null if not defined). + * + * @return string|null + * + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getFilename() + { + @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); + + return $this->source->getName(); + } + + /** + * Gets the source code associated with this stream. + * + * @return string + * + * @internal Don't use this as it might be empty depending on the environment configuration + * + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getSource() + { + @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); + + return $this->source->getCode(); + } + + /** + * Gets the source associated with this stream. + * + * @return Source + * + * @internal + */ + public function getSourceContext() + { + return $this->source; + } +} + +class_alias('Twig\TokenStream', 'Twig_TokenStream'); diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TwigFilter.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigFilter.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TwigFilter.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigFilter.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TwigFunction.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigFunction.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TwigFunction.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigFunction.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/TwigTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigTest.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/TwigTest.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/TwigTest.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Util/DeprecationCollector.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Util/DeprecationCollector.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Util/DeprecationCollector.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Util/DeprecationCollector.php diff --git a/system/templateEngines/Twig/Twig1x/twig/twig/src/Util/TemplateDirIterator.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Util/TemplateDirIterator.php similarity index 100% rename from system/templateEngines/Twig/Twig1x/twig/twig/src/Util/TemplateDirIterator.php rename to system/templateEngines/Twig/Twig1x/vendor/twig/twig/src/Util/TemplateDirIterator.php diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php new file mode 100644 index 0000000..4252940 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php @@ -0,0 +1,24 @@ +assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig'); + + $autoloader = new Twig_Autoloader(); + $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class'); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php new file mode 100644 index 0000000..8ea464d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php @@ -0,0 +1,195 @@ +classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; + $this->directory = sys_get_temp_dir().'/twig-test'; + $this->cache = new FilesystemCache($this->directory); + } + + protected function tearDown() + { + if (file_exists($this->directory)) { + Twig_Tests_FilesystemHelper::removeDir($this->directory); + } + } + + public function testLoad() + { + $key = $this->directory.'/cache/cachefile.php'; + + $dir = \dirname($key); + @mkdir($dir, 0777, true); + $this->assertTrue(is_dir($dir)); + $this->assertFalse(class_exists($this->classname, false)); + + $content = $this->generateSource(); + file_put_contents($key, $content); + + $this->cache->load($key); + + $this->assertTrue(class_exists($this->classname, false)); + } + + public function testLoadMissing() + { + $key = $this->directory.'/cache/cachefile.php'; + + $this->assertFalse(class_exists($this->classname, false)); + + $this->cache->load($key); + + $this->assertFalse(class_exists($this->classname, false)); + } + + public function testWrite() + { + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFileNotExists($key); + $this->assertFileNotExists($this->directory); + + $this->cache->write($key, $content); + + $this->assertFileExists($this->directory); + $this->assertFileExists($key); + $this->assertSame(file_get_contents($key), $content); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Unable to create the cache directory + */ + public function testWriteFailMkdir() + { + if (\defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Read-only directories not possible on Windows.'); + } + + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFileNotExists($key); + + // Create read-only root directory. + @mkdir($this->directory, 0555, true); + $this->assertTrue(is_dir($this->directory)); + + $this->cache->write($key, $content); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Unable to write in the cache directory + */ + public function testWriteFailDirWritable() + { + if (\defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Read-only directories not possible on Windows.'); + } + + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFileNotExists($key); + + // Create root directory. + @mkdir($this->directory, 0777, true); + // Create read-only subdirectory. + @mkdir($this->directory.'/cache', 0555); + $this->assertTrue(is_dir($this->directory.'/cache')); + + $this->cache->write($key, $content); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Failed to write cache file + */ + public function testWriteFailWriteFile() + { + $key = $this->directory.'/cache/cachefile.php'; + $content = $this->generateSource(); + + $this->assertFileNotExists($key); + + // Create a directory in the place of the cache file. + @mkdir($key, 0777, true); + $this->assertTrue(is_dir($key)); + + $this->cache->write($key, $content); + } + + public function testGetTimestamp() + { + $key = $this->directory.'/cache/cachefile.php'; + + $dir = \dirname($key); + @mkdir($dir, 0777, true); + $this->assertTrue(is_dir($dir)); + + // Create the file with a specific modification time. + touch($key, 1234567890); + + $this->assertSame(1234567890, $this->cache->getTimestamp($key)); + } + + public function testGetTimestampMissingFile() + { + $key = $this->directory.'/cache/cachefile.php'; + $this->assertSame(0, $this->cache->getTimestamp($key)); + } + + /** + * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory. + * + * @dataProvider provideDirectories + */ + public function testGenerateKey($expected, $input) + { + $cache = new FilesystemCache($input); + $this->assertRegExp($expected, $cache->generateKey('_test_', \get_class($this))); + } + + public function provideDirectories() + { + $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#'; + + return [ + [$pattern, 'a/b'], + [$pattern, 'a/b/'], + [$pattern, 'a/b\\'], + [$pattern, 'a/b\\/'], + [$pattern, 'a/b\\//'], + ['#/'.substr($pattern, 1), '/a/b'], + ]; + } + + private function generateSource() + { + return strtr(' $this->classname, + ]); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CompilerTest.php new file mode 100644 index 0000000..5191b28 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CompilerTest.php @@ -0,0 +1,36 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + + $locale = setlocale(LC_NUMERIC, 0); + if (false === $locale) { + $this->markTestSkipped('Your platform does not support locales.'); + } + + $required_locales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252']; + if (false === setlocale(LC_NUMERIC, $required_locales)) { + $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales)); + } + + $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); + $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); + + setlocale(LC_NUMERIC, $locale); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php new file mode 100644 index 0000000..1c04ef2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php @@ -0,0 +1,42 @@ +getMockBuilder('Psr\Container\ContainerInterface')->getMock(); + $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true); + $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new \stdClass()); + + $loader = new ContainerRuntimeLoader($container); + + $this->assertInstanceOf('stdClass', $loader->load('stdClass')); + } + + /** + * @requires PHP 5.3 + */ + public function testLoadUnknownRuntimeReturnsNull() + { + $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock(); + $container->expects($this->once())->method('has')->with('Foo'); + $container->expects($this->never())->method('get'); + + $loader = new ContainerRuntimeLoader($container); + $this->assertNull($loader->load('Foo')); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php new file mode 100644 index 0000000..6505313 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php @@ -0,0 +1,96 @@ +expectException('InvalidArgumentException'); + $this->expectExceptionMessage($expectedExceptionMessage); + } else { + $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); + } + + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $env->addExtension($extension); + $env->getUnaryOperators(); + } + + public function provideInvalidExtensions() + { + return [ + [new InvalidOperatorExtension(new \stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'], + [new InvalidOperatorExtension([1, 2, 3]), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'], + ]; + } +} + +class InvalidOperatorExtension implements ExtensionInterface +{ + private $operators; + + public function __construct($operators) + { + $this->operators = $operators; + } + + public function initRuntime(Environment $environment) + { + } + + public function getTokenParsers() + { + return []; + } + + public function getNodeVisitors() + { + return []; + } + + public function getFilters() + { + return []; + } + + public function getTests() + { + return []; + } + + public function getFunctions() + { + return []; + } + + public function getGlobals() + { + return []; + } + + public function getOperators() + { + return $this->operators; + } + + public function getName() + { + return __CLASS__; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php new file mode 100644 index 0000000..88fd15c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php @@ -0,0 +1,677 @@ +tokenize('{{ foo }}', 'foo'); + $this->assertEquals('{{ foo }}', $stream->getSource()); + $this->assertEquals('foo', $stream->getFilename()); + } + + /** + * @group legacy + */ + public function testLegacyCompileSourceSignature() + { + $loader = new ArrayLoader(['foo' => '{{ foo }}']); + $env = new Environment($loader); + $this->assertContains('getTemplateName', $env->compileSource('{{ foo }}', 'foo')); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage You must set a loader first. + * @group legacy + */ + public function testRenderNoLoader() + { + $env = new Environment(); + $env->render('test'); + } + + public function testAutoescapeOption() + { + $loader = new ArrayLoader([ + 'html' => '{{ foo }} {{ foo }}', + 'js' => '{{ bar }} {{ bar }}', + ]); + + $twig = new Environment($loader, [ + 'debug' => true, + 'cache' => false, + 'autoescape' => [$this, 'escapingStrategyCallback'], + ]); + + $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', ['foo' => 'foo
    '])); + $this->assertEquals('foo\u003Cbr\/\u0020\u003E foo\u003Cbr\/\u0020\u003E', $twig->render('js', ['bar' => 'foo
    '])); + } + + public function escapingStrategyCallback($name) + { + return $name; + } + + public function testGlobals() + { + // to be removed in 2.0 + $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock(); + //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); + $loader->expects($this->any())->method('getSourceContext')->will($this->returnValue(new Source('', ''))); + + // globals can be added after calling getGlobals + + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after a template has been loaded + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->load('index'); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after extensions init + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + // globals can be modified after extensions and a template has been loaded + $arrayLoader = new ArrayLoader(['index' => '{{foo}}']); + $twig = new Environment($arrayLoader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->load('index'); + $twig->addGlobal('foo', 'bar'); + $globals = $twig->getGlobals(); + $this->assertEquals('bar', $globals['foo']); + + $twig = new Environment($arrayLoader); + $twig->getGlobals(); + $twig->addGlobal('foo', 'bar'); + $template = $twig->load('index'); + $this->assertEquals('bar', $template->render([])); + + /* to be uncomment in Twig 2.0 + // globals cannot be added after a template has been loaded + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->load('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (\LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // globals cannot be added after extensions init + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (\LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // globals cannot be added after extensions and a template has been loaded + $twig = new Environment($loader); + $twig->addGlobal('foo', 'foo'); + $twig->getGlobals(); + $twig->getFunctions(); + $twig->load('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (\LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + + // test adding globals after a template has been loaded without call to getGlobals + $twig = new Environment($loader); + $twig->load('index'); + try { + $twig->addGlobal('bar', 'bar'); + $this->fail(); + } catch (\LogicException $e) { + $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); + } + */ + } + + public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() + { + $cache = new FilesystemCache($dir = sys_get_temp_dir().'/twig'); + $options = ['cache' => $cache, 'auto_reload' => false, 'debug' => false]; + + // force compilation + $twig = new Environment($loader = new ArrayLoader(['index' => '{{ foo }}']), $options); + + $key = $cache->generateKey('index', $twig->getTemplateClass('index')); + $cache->write($key, $twig->compileSource(new Source('{{ foo }}', 'index'))); + + // check that extensions won't be initialized when rendering a template that is already in the cache + $twig = $this + ->getMockBuilder('\Twig\Environment') + ->setConstructorArgs([$loader, $options]) + ->setMethods(['initExtensions']) + ->getMock() + ; + + $twig->expects($this->never())->method('initExtensions'); + + // render template + $output = $twig->render('index', ['foo' => 'bar']); + $this->assertEquals('bar', $output); + + Twig_Tests_FilesystemHelper::removeDir($dir); + } + + public function testAutoReloadCacheMiss() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); + + // Cache miss: getTimestamp returns 0 and as a result the load() is + // skipped. + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue(0)); + $loader->expects($this->never()) + ->method('isFresh'); + $cache->expects($this->once()) + ->method('write'); + $cache->expects($this->once()) + ->method('load'); + + $twig->load($templateName); + } + + public function testAutoReloadCacheHit() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); + + $now = time(); + + // Cache hit: getTimestamp returns something > extension timestamps and + // the loader returns true for isFresh(). + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue($now)); + $loader->expects($this->once()) + ->method('isFresh') + ->will($this->returnValue(true)); + $cache->expects($this->atLeastOnce()) + ->method('load'); + + $twig->load($templateName); + } + + public function testAutoReloadOutdatedCacheHit() + { + $templateName = __FUNCTION__; + $templateContent = __FUNCTION__; + + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); + $loader = $this->getMockLoader($templateName, $templateContent); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); + + $now = time(); + + $cache->expects($this->once()) + ->method('generateKey') + ->will($this->returnValue('key')); + $cache->expects($this->once()) + ->method('getTimestamp') + ->will($this->returnValue($now)); + $loader->expects($this->once()) + ->method('isFresh') + ->will($this->returnValue(false)); + $cache->expects($this->once()) + ->method('write'); + $cache->expects($this->once()) + ->method('load'); + + $twig->load($templateName); + } + + /** + * @group legacy + */ + public function testHasGetExtensionWithDynamicName() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + + $ext1 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext1'); + $ext2 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext2'); + $twig->addExtension($ext1); + $twig->addExtension($ext2); + + $this->assertTrue($twig->hasExtension('ext1')); + $this->assertTrue($twig->hasExtension('ext2')); + + $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName')); + + $this->assertSame($ext1, $twig->getExtension('ext1')); + $this->assertSame($ext2, $twig->getExtension('ext2')); + } + + public function testHasGetExtensionByClassName() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension($ext = new Twig_Tests_EnvironmentTest_Extension()); + $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension')); + $this->assertTrue($twig->hasExtension('\Twig_Tests_EnvironmentTest_Extension')); + + $this->assertSame($ext, $twig->getExtension('Twig_Tests_EnvironmentTest_Extension')); + $this->assertSame($ext, $twig->getExtension('\Twig_Tests_EnvironmentTest_Extension')); + + $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest\Extension')); + $this->assertSame($ext, $twig->getExtension('Twig\Tests\EnvironmentTest\Extension')); + } + + public function testAddExtension() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); + + $this->assertArrayHasKey('test', $twig->getTags()); + $this->assertArrayHasKey('foo_filter', $twig->getFilters()); + $this->assertArrayHasKey('foo_function', $twig->getFunctions()); + $this->assertArrayHasKey('foo_test', $twig->getTests()); + $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators()); + $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators()); + $this->assertArrayHasKey('foo_global', $twig->getGlobals()); + $visitors = $twig->getNodeVisitors(); + $found = false; + foreach ($visitors as $visitor) { + if ($visitor instanceof Twig_Tests_EnvironmentTest_NodeVisitor) { + $found = true; + } + } + $this->assertTrue($found); + } + + /** + * @requires PHP 5.3 + */ + public function testAddExtensionWithDeprecatedGetGlobals() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals()); + + $this->deprecations = []; + set_error_handler([$this, 'handleError']); + + $this->assertArrayHasKey('foo_global', $twig->getGlobals()); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('Defining the getGlobals() method in the "Twig_Tests_EnvironmentTest_Extension_WithGlobals" extension ', $this->deprecations[0]); + + restore_error_handler(); + } + + /** + * @group legacy + */ + public function testRemoveExtension() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); + $twig->removeExtension('environment_test'); + + $this->assertArrayNotHasKey('test', $twig->getTags()); + $this->assertArrayNotHasKey('foo_filter', $twig->getFilters()); + $this->assertArrayNotHasKey('foo_function', $twig->getFunctions()); + $this->assertArrayNotHasKey('foo_test', $twig->getTests()); + $this->assertArrayNotHasKey('foo_unary', $twig->getUnaryOperators()); + $this->assertArrayNotHasKey('foo_binary', $twig->getBinaryOperators()); + $this->assertArrayNotHasKey('foo_global', $twig->getGlobals()); + $this->assertCount(2, $twig->getNodeVisitors()); + } + + public function testAddMockExtension() + { + // should be replaced by the following in 2.0 (this current code is just to avoid a dep notice) + // $extension = $this->getMockBuilder('\Twig\Extension\AbstractExtension')->getMock(); + $extension = eval(<< 'hey']); + + $twig = new Environment($loader); + $twig->addExtension($extension); + + $this->assertInstanceOf('\Twig\Extension\ExtensionInterface', $twig->getExtension(\get_class($extension))); + $this->assertTrue($twig->isTemplateFresh('page', time())); + } + + public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime()); + $twig->initRuntime(); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any deprecations + $this->addToAssertionCount(1); + } + + /** + * @requires PHP 5.3 + */ + public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); + + $this->deprecations = []; + set_error_handler([$this, 'handleError']); + + $twig->initRuntime(); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('Defining the initRuntime() method in the "Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime" extension is deprecated since version 1.23.', $this->deprecations[0]); + + restore_error_handler(); + } + + public function handleError($type, $msg) + { + if (E_USER_DEPRECATED === $type) { + $this->deprecations[] = $msg; + } + } + + /** + * @requires PHP 5.3 + */ + public function testOverrideExtension() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); + + $this->deprecations = []; + set_error_handler([$this, 'handleError']); + + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); + $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); + + $this->assertCount(1, $this->deprecations); + $this->assertContains('The possibility to register the same extension twice', $this->deprecations[0]); + + restore_error_handler(); + } + + public function testAddRuntimeLoader() + { + $runtimeLoader = $this->getMockBuilder('\Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); + $runtimeLoader->expects($this->any())->method('load')->will($this->returnValue(new Twig_Tests_EnvironmentTest_Runtime())); + + $loader = new ArrayLoader([ + 'func_array' => '{{ from_runtime_array("foo") }}', + 'func_array_default' => '{{ from_runtime_array() }}', + 'func_array_named_args' => '{{ from_runtime_array(name="foo") }}', + 'func_string' => '{{ from_runtime_string("foo") }}', + 'func_string_default' => '{{ from_runtime_string() }}', + 'func_string_named_args' => '{{ from_runtime_string(name="foo") }}', + ]); + + $twig = new Environment($loader); + $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime()); + $twig->addRuntimeLoader($runtimeLoader); + + $this->assertEquals('foo', $twig->render('func_array')); + $this->assertEquals('bar', $twig->render('func_array_default')); + $this->assertEquals('foo', $twig->render('func_array_named_args')); + $this->assertEquals('foo', $twig->render('func_string')); + $this->assertEquals('bar', $twig->render('func_string_default')); + $this->assertEquals('foo', $twig->render('func_string_named_args')); + } + + protected function getMockLoader($templateName, $templateContent) + { + // to be removed in 2.0 + $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock(); + //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); + $loader->expects($this->any()) + ->method('getSourceContext') + ->with($templateName) + ->will($this->returnValue(new Source($templateContent, $templateName))); + $loader->expects($this->any()) + ->method('getCacheKey') + ->with($templateName) + ->will($this->returnValue($templateName)); + + return $loader; + } +} + +class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends AbstractExtension +{ + public function getGlobals() + { + return [ + 'foo_global' => 'foo_global', + ]; + } +} + +class Twig_Tests_EnvironmentTest_Extension extends AbstractExtension implements GlobalsInterface +{ + public function getTokenParsers() + { + return [ + new Twig_Tests_EnvironmentTest_TokenParser(), + ]; + } + + public function getNodeVisitors() + { + return [ + new Twig_Tests_EnvironmentTest_NodeVisitor(), + ]; + } + + public function getFilters() + { + return [ + new TwigFilter('foo_filter', 'foo_filter'), + ]; + } + + public function getTests() + { + return [ + new TwigTest('foo_test', 'foo_test'), + ]; + } + + public function getFunctions() + { + return [ + new TwigFunction('foo_function', 'foo_function'), + ]; + } + + public function getOperators() + { + return [ + ['foo_unary' => []], + ['foo_binary' => []], + ]; + } + + public function getGlobals() + { + return [ + 'foo_global' => 'foo_global', + ]; + } +} +class_alias('Twig_Tests_EnvironmentTest_Extension', 'Twig\Tests\EnvironmentTest\Extension', false); + +class Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName extends AbstractExtension +{ + public function getName() + { + return 'environment_test'; + } +} + +class Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName extends AbstractExtension +{ + private $name; + + public function __construct($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } +} + +class Twig_Tests_EnvironmentTest_TokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + } + + public function getTag() + { + return 'test'; + } +} + +class Twig_Tests_EnvironmentTest_NodeVisitor implements NodeVisitorInterface +{ + public function enterNode(Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function leaveNode(Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} + +class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends AbstractExtension +{ + public function initRuntime(Environment $env) + { + } +} + +class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends AbstractExtension implements InitRuntimeInterface +{ + public function initRuntime(Environment $env) + { + } +} + +class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends AbstractExtension +{ + public function getFunctions() + { + return [ + new TwigFunction('from_runtime_array', ['Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime']), + new TwigFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), + ]; + } + + public function getName() + { + return 'from_runtime'; + } +} + +class Twig_Tests_EnvironmentTest_Runtime +{ + public function fromRuntime($name = 'bar') + { + return $name; + } +} + +// to be removed in 2.0 +interface Twig_EnvironmentTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ErrorTest.php new file mode 100644 index 0000000..5201061 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ErrorTest.php @@ -0,0 +1,218 @@ +setSourceContext(new Source('', new \SplFileInfo(__FILE__))); + + $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); + } + + public function testErrorWithArrayFilename() + { + $error = new Error('foo'); + $error->setSourceContext(new Source('', ['foo' => 'bar'])); + + $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); + } + + public function testTwigExceptionGuessWithMissingVarAndArrayLoader() + { + $loader = new ArrayLoader([ + 'base.html' => '{% block content %}{% endblock %}', + 'index.html' => << true, 'debug' => true, 'cache' => false]); + + $template = $twig->load('index.html'); + try { + $template->render([]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getSourceContext()->getName()); + } + } + + public function testTwigExceptionGuessWithExceptionAndArrayLoader() + { + $loader = new ArrayLoader([ + 'base.html' => '{% block content %}{% endblock %}', + 'index.html' => << true, 'debug' => true, 'cache' => false]); + + $template = $twig->load('index.html'); + try { + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getSourceContext()->getName()); + } + } + + public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader() + { + $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors'); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); + + $template = $twig->load('index.html'); + try { + $template->render([]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals('Variable "foo" does not exist.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getSourceContext()->getName()); + $this->assertEquals(3, $e->getLine()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + } + } + + public function testTwigExceptionGuessWithExceptionAndFilesystemLoader() + { + $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors'); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); + + $template = $twig->load('index.html'); + try { + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getSourceContext()->getName()); + $this->assertEquals(3, $e->getLine()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + } + } + + /** + * @dataProvider getErroredTemplates + */ + public function testTwigExceptionAddsFileAndLine($templates, $name, $line) + { + $loader = new ArrayLoader($templates); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); + + $template = $twig->load('index'); + + try { + $template->render([]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage()); + $this->assertEquals($line, $e->getTemplateLine()); + $this->assertEquals($name, $e->getSourceContext()->getName()); + } + + try { + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); + + $this->fail(); + } catch (RuntimeError $e) { + $this->assertEquals(sprintf('An exception has been thrown during the rendering of a template ("Runtime error...") in "%s" at line %d.', $name, $line), $e->getMessage()); + $this->assertEquals($line, $e->getTemplateLine()); + $this->assertEquals($name, $e->getSourceContext()->getName()); + } + } + + public function getErroredTemplates() + { + return [ + // error occurs in a template + [ + [ + 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}", + ], + 'index', 3, + ], + + // error occurs in an included template + [ + [ + 'index' => "{% include 'partial' %}", + 'partial' => '{{ foo.bar }}', + ], + 'partial', 1, + ], + + // error occurs in a parent block when called via parent() + [ + [ + 'index' => "{% extends 'base' %} + {% block content %} + {{ parent() }} + {% endblock %}", + 'base' => '{% block content %}{{ foo.bar }}{% endblock %}', + ], + 'base', 1, + ], + + // error occurs in a block from the child + [ + [ + 'index' => "{% extends 'base' %} + {% block content %} + {{ foo.bar }} + {% endblock %} + {% block foo %} + {{ foo.bar }} + {% endblock %}", + 'base' => '{% block content %}{% endblock %}', + ], + 'index', 3, + ], + ]; + } +} + +class Twig_Tests_ErrorTest_Foo +{ + public function bar() + { + throw new \Exception('Runtime error...'); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php new file mode 100644 index 0000000..6a447a9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php @@ -0,0 +1,387 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source($template, 'index'))); + } + + public function getFailingTestsForAssignment() + { + return [ + ['{% set false = "foo" %}'], + ['{% set FALSE = "foo" %}'], + ['{% set true = "foo" %}'], + ['{% set TRUE = "foo" %}'], + ['{% set none = "foo" %}'], + ['{% set NONE = "foo" %}'], + ['{% set null = "foo" %}'], + ['{% set NULL = "foo" %}'], + ['{% set 3 = "foo" %}'], + ['{% set 1 + 2 = "foo" %}'], + ['{% set "bar" = "foo" %}'], + ['{% set %}{% endset %}'], + ]; + } + + /** + * @dataProvider getTestsForArray + */ + public function testArrayExpression($template, $expected) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $stream = $env->tokenize($source = new Source($template, '')); + $parser = new Parser($env); + $expected->setSourceContext($source); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @dataProvider getFailingTestsForArray + */ + public function testArraySyntaxError($template) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source($template, 'index'))); + } + + public function getFailingTestsForArray() + { + return [ + ['{{ [1, "a": "b"] }}'], + ['{{ {"a": "b", 2} }}'], + ]; + } + + public function getTestsForArray() + { + return [ + // simple array + ['{{ [1, 2] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), + + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + ], + + // array with trailing , + ['{{ [1, 2, ] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), + + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + ], + + // simple hash + ['{{ {"a": "b", "b": "c"} }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), + + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], + + // hash with trailing , + ['{{ {"a": "b", "b": "c", } }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), + + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], + + // hash in an array + ['{{ [1, {"a": "b", "b": "c"}] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), + + new ConstantExpression(1, 1), + new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), + + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], 1), + ], + + // array in a hash + ['{{ {"a": [1, 2], "b": "c"} }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), + + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], + ]; + } + + /** + * @expectedException \Twig\Error\SyntaxError + */ + public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]); + $stream = $env->tokenize(new Source('{{ "a" "b" }}', 'index')); + $parser = new Parser($env); + + $parser->parse($stream); + } + + /** + * @dataProvider getTestsForString + */ + public function testStringExpression($template, $expected) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]); + $stream = $env->tokenize($source = new Source($template, '')); + $parser = new Parser($env); + $expected->setSourceContext($source); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + public function getTestsForString() + { + return [ + [ + '{{ "foo" }}', new ConstantExpression('foo', 1), + ], + [ + '{{ "foo #{bar}" }}', new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), + 1 + ), + ], + [ + '{{ "foo #{bar} baz" }}', new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), + 1 + ), + new ConstantExpression(' baz', 1), + 1 + ), + ], + + [ + '{{ "foo #{"foo #{bar} baz"} baz" }}', new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), + 1 + ), + new ConstantExpression(' baz', 1), + 1 + ), + 1 + ), + new ConstantExpression(' baz', 1), + 1 + ), + ], + ]; + } + + /** + * @expectedException \Twig\Error\SyntaxError + */ + public function testAttributeCallDoesNotSupportNamedArguments() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ foo.bar(name="Foo") }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + */ + public function testMacroCallDoesNotSupportNamedArguments() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. + */ + public function testMacroDefinitionDoesNotSupportNonNameVariableName() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{% macro foo("a") %}{% endmacro %}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 + * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues + */ + public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source($template, 'index'))); + } + + public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() + { + return [ + ['{% macro foo(name = "a #{foo} a") %}{% endmacro %}'], + ['{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'], + ]; + } + + /** + * @dataProvider getMacroDefinitionSupportsConstantDefaultValues + */ + public function testMacroDefinitionSupportsConstantDefaultValues($template) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source($template, 'index'))); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function getMacroDefinitionSupportsConstantDefaultValues() + { + return [ + ['{% macro foo(name = "aa") %}{% endmacro %}'], + ['{% macro foo(name = 12) %}{% endmacro %}'], + ['{% macro foo(name = true) %}{% endmacro %}'], + ['{% macro foo(name = ["a"]) %}{% endmacro %}'], + ['{% macro foo(name = [["a"]]) %}{% endmacro %}'], + ['{% macro foo(name = {a: "a"}) %}{% endmacro %}'], + ['{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'], + ]; + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? + */ + public function testUnknownFunction() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ cycl() }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. + */ + public function testUnknownFunctionWithoutSuggestions() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ foobar() }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? + */ + public function testUnknownFilter() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ 1|lowe }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. + */ + public function testUnknownFilterWithoutSuggestions() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ 1|foobar }}', 'index'))); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 + */ + public function testUnknownTest() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + $stream = $env->tokenize(new Source('{{ 1 is nul }}', 'index')); + $parser->parse($stream); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. + */ + public function testUnknownTestWithoutSuggestions() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + + $parser->parse($env->tokenize(new Source('{{ 1 is foobar }}', 'index'))); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php new file mode 100644 index 0000000..c294318 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php @@ -0,0 +1,371 @@ +getMockBuilder('Twig_LoaderInterface')->getMock()); + for ($i = 0; $i < 100; ++$i) { + $this->assertTrue(\in_array(twig_random($env, $value1, $value2), $expectedInArray, true)); // assertContains() would not consider the type + } + } + + public function getRandomFunctionTestData() + { + return [ + 'array' => [ + ['apple', 'orange', 'citrus'], + ['apple', 'orange', 'citrus'], + ], + 'Traversable' => [ + ['apple', 'orange', 'citrus'], + new ArrayObject(['apple', 'orange', 'citrus']), + ], + 'unicode string' => [ + ['Ä', '€', 'é'], + 'Ä€é', + ], + 'numeric but string' => [ + ['1', '2', '3'], + '123', + ], + 'integer' => [ + range(0, 5, 1), + 5, + ], + 'float' => [ + range(0, 5, 1), + 5.9, + ], + 'negative' => [ + [0, -1, -2], + -2, + ], + 'min max int' => [ + range(50, 100), + 50, + 100, + ], + 'min max float' => [ + range(-10, 10), + -9.5, + 9.5, + ], + 'min null' => [ + range(0, 100), + null, + 100, + ], + ]; + } + + public function testRandomFunctionWithoutParameter() + { + $max = mt_getrandmax(); + + for ($i = 0; $i < 100; ++$i) { + $val = twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $this->assertTrue(\is_int($val) && $val >= 0 && $val <= $max); + } + } + + public function testRandomFunctionReturnsAsIs() + { + $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), '')); + $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['charset' => null]), '')); + + $instance = new \stdClass(); + $this->assertSame($instance, twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), $instance)); + } + + /** + * @expectedException \Twig\Error\RuntimeError + */ + public function testRandomFunctionOfEmptyArrayThrowsException() + { + twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), []); + } + + public function testRandomFunctionOnNonUTF8String() + { + if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->setCharset('ISO-8859-1'); + + $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + for ($i = 0; $i < 30; ++$i) { + $rand = twig_random($twig, $text); + $this->assertTrue(\in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), ['Ä', 'é'], true)); + } + } + + public function testReverseFilterOnNonUTF8String() + { + if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->setCharset('ISO-8859-1'); + + $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); + + $this->assertEquals($output, 'éÄ'); + } + + /** + * @dataProvider provideCustomEscaperCases + */ + public function testCustomEscaper($expected, $string, $strategy) + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('foo', 'foo_escaper_for_test'); + + $this->assertSame($expected, twig_escape_filter($twig, $string, $strategy)); + } + + public function provideCustomEscaperCases() + { + return [ + ['fooUTF-8', 'foo', 'foo'], + ['UTF-8', null, 'foo'], + ['42UTF-8', 42, 'foo'], + ]; + } + + /** + * @expectedException \Twig\Error\RuntimeError + */ + public function testUnknownCustomEscaper() + { + twig_escape_filter(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), 'foo', 'bar'); + } + + /** + * @dataProvider provideTwigFirstCases + */ + public function testTwigFirst($expected, $input) + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $this->assertSame($expected, twig_first($twig, $input)); + } + + public function provideTwigFirstCases() + { + $i = [1 => 'a', 2 => 'b', 3 => 'c']; + + return [ + ['a', 'abc'], + [1, [1, 2, 3]], + ['', null], + ['', ''], + ['a', new CoreTestIterator($i, array_keys($i), true, 3)], + ]; + } + + /** + * @dataProvider provideTwigLastCases + */ + public function testTwigLast($expected, $input) + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $this->assertSame($expected, twig_last($twig, $input)); + } + + public function provideTwigLastCases() + { + $i = [1 => 'a', 2 => 'b', 3 => 'c']; + + return [ + ['c', 'abc'], + [3, [1, 2, 3]], + ['', null], + ['', ''], + ['c', new CoreTestIterator($i, array_keys($i), true)], + ]; + } + + /** + * @dataProvider provideArrayKeyCases + */ + public function testArrayKeysFilter(array $expected, $input) + { + $this->assertSame($expected, twig_get_array_keys_filter($input)); + } + + public function provideArrayKeyCases() + { + $array = ['a' => 'a1', 'b' => 'b1', 'c' => 'c1']; + $keys = array_keys($array); + + return [ + [$keys, $array], + [$keys, new CoreTestIterator($array, $keys)], + [$keys, new CoreTestIteratorAggregate($array, $keys)], + [$keys, new CoreTestIteratorAggregateAggregate($array, $keys)], + [[], null], + [['a'], new \SimpleXMLElement('')], + ]; + } + + /** + * @dataProvider provideInFilterCases + */ + public function testInFilter($expected, $value, $compare) + { + $this->assertSame($expected, twig_in_filter($value, $compare)); + } + + public function provideInFilterCases() + { + $array = [1, 2, 'a' => 3, 5, 6, 7]; + $keys = array_keys($array); + + return [ + [true, 1, $array], + [true, '3', $array], + [true, '3', 'abc3def'], + [true, 1, new CoreTestIterator($array, $keys, true, 1)], + [true, '3', new CoreTestIterator($array, $keys, true, 3)], + [true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)], + [false, 4, $array], + [false, 4, new CoreTestIterator($array, $keys, true)], + [false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)], + [false, 1, 1], + [true, 'b', new \SimpleXMLElement('b')], + ]; + } + + /** + * @dataProvider provideSliceFilterCases + */ + public function testSliceFilter($expected, $input, $start, $length = null, $preserveKeys = false) + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $this->assertSame($expected, twig_slice($twig, $input, $start, $length, $preserveKeys)); + } + + public function provideSliceFilterCases() + { + $i = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]; + $keys = array_keys($i); + + return [ + [['a' => 1], $i, 0, 1, true], + [['a' => 1], $i, 0, 1, false], + [['b' => 2, 'c' => 3], $i, 1, 2], + [[1], [1, 2, 3, 4], 0, 1], + [[2, 3], [1, 2, 3, 4], 1, 2], + [[2, 3], new CoreTestIterator($i, $keys, true), 1, 2], + [['c' => 3, 'd' => 4], new CoreTestIteratorAggregate($i, $keys, true), 2, null, true], + [$i, new CoreTestIterator($i, $keys, true), 0, \count($keys) + 10, true], + [[], new CoreTestIterator($i, $keys, true), \count($keys) + 10], + ['de', 'abcdef', 3, 2], + [[], new \SimpleXMLElement('12'), 3], + [[], new \ArrayIterator([1, 2]), 3], + ]; + } +} + +function foo_escaper_for_test(Environment $env, $string, $charset) +{ + return $string.$charset; +} + +final class CoreTestIteratorAggregate implements \IteratorAggregate +{ + private $iterator; + + public function __construct(array $array, array $keys, $allowAccess = false, $maxPosition = false) + { + $this->iterator = new CoreTestIterator($array, $keys, $allowAccess, $maxPosition); + } + + public function getIterator() + { + return $this->iterator; + } +} + +final class CoreTestIteratorAggregateAggregate implements \IteratorAggregate +{ + private $iterator; + + public function __construct(array $array, array $keys, $allowValueAccess = false, $maxPosition = false) + { + $this->iterator = new CoreTestIteratorAggregate($array, $keys, $allowValueAccess, $maxPosition); + } + + public function getIterator() + { + return $this->iterator; + } +} + +final class CoreTestIterator implements Iterator +{ + private $position; + private $array; + private $arrayKeys; + private $allowValueAccess; + private $maxPosition; + + public function __construct(array $values, array $keys, $allowValueAccess = false, $maxPosition = false) + { + $this->array = $values; + $this->arrayKeys = $keys; + $this->position = 0; + $this->allowValueAccess = $allowValueAccess; + $this->maxPosition = false === $maxPosition ? \count($values) + 1 : $maxPosition; + } + + public function rewind() + { + $this->position = 0; + } + + public function current() + { + if ($this->allowValueAccess) { + return $this->array[$this->key()]; + } + + throw new \LogicException('Code should only use the keys, not the values provided by iterator.'); + } + + public function key() + { + return $this->arrayKeys[$this->position]; + } + + public function next() + { + ++$this->position; + if ($this->position === $this->maxPosition) { + throw new \LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition)); + } + } + + public function valid() + { + return isset($this->arrayKeys[$this->position]); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php new file mode 100644 index 0000000..3420b7e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php @@ -0,0 +1,364 @@ + 'Fabien', + 'obj' => new FooObject(), + 'arr' => ['obj' => new FooObject()], + ]; + + self::$templates = [ + '1_basic1' => '{{ obj.foo }}', + '1_basic2' => '{{ name|upper }}', + '1_basic3' => '{% if name %}foo{% endif %}', + '1_basic4' => '{{ obj.bar }}', + '1_basic5' => '{{ obj }}', + '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', + '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', + '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}', + '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + '1_layout' => '{% block content %}{% endblock %}', + '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}", + '1_include' => '{{ include("1_basic1", sandboxed=true) }}', + '1_range_operator' => '{{ (1..2)[0] }}', + ]; + } + + /** + * @expectedException \Twig\Sandbox\SecurityError + * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. + */ + public function testSandboxWithInheritance() + { + $twig = $this->getEnvironment(true, [], self::$templates, ['block']); + $twig->load('1_child')->render([]); + } + + public function testSandboxGloballySet() + { + $twig = $this->getEnvironment(false, [], self::$templates); + $this->assertEquals('FOO', $twig->load('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); + } + + public function testSandboxUnallowedMethodAccessor() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_basic1')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); + $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); + $this->assertEquals('foo', $e->getMethodName(), 'Exception should be raised on the "foo" method'); + } + } + + public function testSandboxUnallowedFilter() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_basic2')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError'); + $this->assertEquals('upper', $e->getFilterName(), 'Exception should be raised on the "upper" filter'); + } + } + + public function testSandboxUnallowedTag() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_basic3')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); + $this->assertEquals('if', $e->getTagName(), 'Exception should be raised on the "if" tag'); + } + } + + public function testSandboxUnallowedProperty() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_basic4')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError'); + $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); + $this->assertEquals('bar', $e->getPropertyName(), 'Exception should be raised on the "bar" property'); + } + } + + /** + * @dataProvider getSandboxUnallowedToStringTests + */ + public function testSandboxUnallowedToString($template) + { + $twig = $this->getEnvironment(true, [], ['index' => $template], [], ['upper'], ['FooObject' => 'getAnotherFooObject'], [], ['random']); + try { + $twig->load('index')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); + $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); + $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method'); + } + } + + public function getSandboxUnallowedToStringTests() + { + return [ + 'simple' => ['{{ obj }}'], + 'object_from_array' => ['{{ arr.obj }}'], + 'object_chain' => ['{{ obj.anotherFooObject }}'], + 'filter' => ['{{ obj|upper }}'], + 'filter_from_array' => ['{{ arr.obj|upper }}'], + 'function' => ['{{ random(obj) }}'], + 'function_from_array' => ['{{ random(arr.obj) }}'], + 'function_and_filter' => ['{{ random(obj|upper) }}'], + 'function_and_filter_from_array' => ['{{ random(arr.obj|upper) }}'], + 'object_chain_and_filter' => ['{{ obj.anotherFooObject|upper }}'], + 'object_chain_and_function' => ['{{ random(obj.anotherFooObject) }}'], + 'concat' => ['{{ obj ~ "" }}'], + 'concat_again' => ['{{ "" ~ obj }}'], + ]; + } + + /** + * @dataProvider getSandboxAllowedToStringTests + */ + public function testSandboxAllowedToString($template, $output) + { + $twig = $this->getEnvironment(true, [], ['index' => $template], ['set'], [], ['FooObject' => ['foo', 'getAnotherFooObject']]); + $this->assertEquals($output, $twig->load('index')->render(self::$params)); + } + + public function getSandboxAllowedToStringTests() + { + return [ + 'constant_test' => ['{{ obj is constant("PHP_INT_MAX") }}', ''], + 'set_object' => ['{% set a = obj.anotherFooObject %}{{ a.foo }}', 'foo'], + 'is_defined' => ['{{ obj.anotherFooObject is defined }}', '1'], + 'is_null' => ['{{ obj is null }}', ''], + 'is_sameas' => ['{{ obj is same as(obj) }}', '1'], + 'is_sameas_from_array' => ['{{ arr.obj is same as(arr.obj) }}', '1'], + 'is_sameas_from_another_method' => ['{{ obj.anotherFooObject is same as(obj.anotherFooObject) }}', ''], + ]; + } + + public function testSandboxAllowMethodToString() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => '__toString']); + FooObject::reset(); + $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); + } + + public function testSandboxAllowMethodToStringDisabled() + { + $twig = $this->getEnvironment(false, [], self::$templates); + FooObject::reset(); + $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); + } + + public function testSandboxUnallowedFunction() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_basic7')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); + $this->assertEquals('cycle', $e->getFunctionName(), 'Exception should be raised on the "cycle" function'); + } + } + + public function testSandboxUnallowedRangeOperator() + { + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('1_range_operator')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); + $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function'); + } + } + + public function testSandboxAllowMethodFoo() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => 'foo']); + FooObject::reset(); + $this->assertEquals('foo', $twig->load('1_basic1')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); + } + + public function testSandboxAllowFilter() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], ['upper']); + $this->assertEquals('FABIEN', $twig->load('1_basic2')->render(self::$params), 'Sandbox allow some filters'); + } + + public function testSandboxAllowTag() + { + $twig = $this->getEnvironment(true, [], self::$templates, ['if']); + $this->assertEquals('foo', $twig->load('1_basic3')->render(self::$params), 'Sandbox allow some tags'); + } + + public function testSandboxAllowProperty() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], ['FooObject' => 'bar']); + $this->assertEquals('bar', $twig->load('1_basic4')->render(self::$params), 'Sandbox allow some properties'); + } + + public function testSandboxAllowFunction() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['cycle']); + $this->assertEquals('bar', $twig->load('1_basic7')->render(self::$params), 'Sandbox allow some functions'); + } + + public function testSandboxAllowRangeOperator() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['range']); + $this->assertEquals('1', $twig->load('1_range_operator')->render(self::$params), 'Sandbox allow the range operator'); + } + + public function testSandboxAllowFunctionsCaseInsensitive() + { + foreach (['getfoobar', 'getFoobar', 'getFooBar'] as $name) { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => $name]); + FooObject::reset(); + $this->assertEquals('foobarfoobar', $twig->load('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); + $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); + + $this->assertEquals('foobarfoobar', $twig->load('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); + } + } + + public function testSandboxLocallySetForAnInclude() + { + self::$templates = [ + '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', + '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ]; + + $twig = $this->getEnvironment(false, [], self::$templates); + $this->assertEquals('fooFOOfoo', $twig->load('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); + + self::$templates = [ + '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', + '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ]; + + $twig = $this->getEnvironment(true, [], self::$templates); + try { + $twig->load('3_basic')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); + $this->assertEquals('sandbox', $e->getTagName()); + } + } + + public function testMacrosInASandbox() + { + $twig = $this->getEnvironment(true, ['autoescape' => 'html'], ['index' => <<{{ text }}

    {% endmacro %} + +{{- macros.test('username') }} +EOF + ], ['macro', 'import'], ['escape']); + + $this->assertEquals('

    username

    ', $twig->load('index')->render([])); + } + + public function testSandboxDisabledAfterIncludeFunctionError() + { + $twig = $this->getEnvironment(false, [], self::$templates); + + $e = null; + try { + $twig->load('1_include')->render(self::$params); + } catch (\Throwable $e) { + } catch (\Exception $e) { + } + if (null === $e) { + $this->fail('An exception should be thrown for this test to be valid.'); + } + + $this->assertFalse($twig->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.'); + } + + protected function getEnvironment($sandboxed, $options, $templates, $tags = [], $filters = [], $methods = [], $properties = [], $functions = []) + { + $loader = new ArrayLoader($templates); + $twig = new Environment($loader, array_merge(['debug' => true, 'cache' => false, 'autoescape' => false], $options)); + $policy = new SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $twig->addExtension(new SandboxExtension($policy, $sandboxed)); + + return $twig; + } +} + +class FooObject +{ + public static $called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0]; + + public $bar = 'bar'; + + public static function reset() + { + self::$called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0]; + } + + public function __toString() + { + ++self::$called['__toString']; + + return 'foo'; + } + + public function foo() + { + ++self::$called['foo']; + + return 'foo'; + } + + public function getFooBar() + { + ++self::$called['getFooBar']; + + return 'foobar'; + } + + public function getAnotherFooObject() + { + return new self(); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php new file mode 100644 index 0000000..47d62af --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php @@ -0,0 +1,34 @@ + 'getRuntime']); + + $this->assertInstanceOf('stdClass', $loader->load('stdClass')); + } + + public function testLoadReturnsNullForUnmappedRuntime() + { + $loader = new FactoryRuntimeLoader(); + + $this->assertNull($loader->load('stdClass')); + } +} + +function getRuntime() +{ + return new \stdClass(); +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php new file mode 100644 index 0000000..fd7a4eb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php @@ -0,0 +1,66 @@ +tmpDir = sys_get_temp_dir().'/TwigTests'; + if (!file_exists($this->tmpDir)) { + @mkdir($this->tmpDir, 0777, true); + } + + if (!is_writable($this->tmpDir)) { + $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); + } + + $this->env = new Environment(new ArrayLoader(['index' => 'index', 'index2' => 'index2']), ['cache' => $this->tmpDir]); + } + + protected function tearDown() + { + Twig_Tests_FilesystemHelper::removeDir($this->tmpDir); + } + + /** + * @group legacy + */ + public function testWritingCacheFiles() + { + $name = 'index'; + $this->env->load($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertFileExists($cacheFileName, 'Cache file does not exist.'); + } + + /** + * @group legacy + */ + public function testClearingCacheFiles() + { + $name = 'index2'; + $this->env->load($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertFileExists($cacheFileName, 'Cache file does not exist.'); + $this->env->clearCacheFiles(); + $this->assertFileNotExists($cacheFileName, 'Cache file was not cleared.'); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php new file mode 100644 index 0000000..120d9ce --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php @@ -0,0 +1,53 @@ +assertSame($strategy, FileExtensionEscapingStrategy::guess($filename)); + } + + public function getGuessData() + { + return [ + // default + ['html', 'foo.html'], + ['html', 'foo.html.twig'], + ['html', 'foo'], + ['html', 'foo.bar.twig'], + ['html', 'foo.txt/foo'], + ['html', 'foo.txt/foo.js/'], + + // css + ['css', 'foo.css'], + ['css', 'foo.css.twig'], + ['css', 'foo.twig.css'], + ['css', 'foo.js.css'], + ['css', 'foo.js.css.twig'], + + // js + ['js', 'foo.js'], + ['js', 'foo.js.twig'], + ['js', 'foo.txt/foo.js'], + ['js', 'foo.txt.twig/foo.js'], + + // txt + [false, 'foo.txt'], + [false, 'foo.txt.twig'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php new file mode 100644 index 0000000..17c7ae1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php @@ -0,0 +1,30 @@ + $fileInfo) { + if ($iterator->isDot()) { + continue; + } + + if ($fileInfo->isDir()) { + rmdir($filename); + } else { + unlink($filename); + } + } + rmdir($dir); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test new file mode 100644 index 0000000..a80b80c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test @@ -0,0 +1,21 @@ +--TEST-- +blocks and autoescape +--TEMPLATE-- +{{ include('unrelated.txt.twig') -}} +{{ include('template.html.twig') -}} +--TEMPLATE(unrelated.txt.twig)-- +{% block content %}{% endblock %} +--TEMPLATE(template.html.twig)-- +{% extends 'parent.html.twig' %} +{% block content %} +{{ br -}} +{% endblock %} +--TEMPLATE(parent.html.twig)-- +{% set _content = block('content')|raw %} +{{ _content|raw }} +--DATA-- +return ['br' => '
    '] +--CONFIG-- +return ['autoescape' => 'name'] +--EXPECT-- +<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test new file mode 100644 index 0000000..5ad573c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test @@ -0,0 +1,22 @@ +--TEST-- +"name" autoescape strategy +--TEMPLATE-- +{{ br -}} +{{ include('index.js.twig') -}} +{{ include('index.html.twig') -}} +{{ include('index.txt.twig') -}} +--TEMPLATE(index.js.twig)-- +{{ br -}} +--TEMPLATE(index.html.twig)-- +{{ br -}} +--TEMPLATE(index.txt.twig)-- +{{ br -}} +--DATA-- +return ['br' => '
    '] +--CONFIG-- +return ['autoescape' => 'name'] +--EXPECT-- +<br /> +\u003Cbr\u0020\/\u003E +<br /> +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html new file mode 100644 index 0000000..cb0dbe4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html @@ -0,0 +1 @@ +{% block content %}{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html new file mode 100644 index 0000000..df57c82 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% block content %} + {{ foo.bar }} +{% endblock %} +{% block foo %} + {{ foo.bar }} +{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test new file mode 100644 index 0000000..74a1cc2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test @@ -0,0 +1,15 @@ +--TEST-- +Exception for child templates defining content outside blocks defined by parent +--TEMPLATE-- +{% extends 'base.twig' %} + +Content outside a block. + +{% block sidebar %} + Content inside a block. +{% endblock %} +--TEMPLATE(base.twig)-- +{% block sidebar %} +{% endblock %} +--EXCEPTION-- +Twig\Error\SyntaxError: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 3? diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test new file mode 100644 index 0000000..2ab2980 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_extends.test @@ -0,0 +1,12 @@ +--TEST-- +Exception thrown from a child for an extension error +--TEMPLATE-- +{% extends 'base.twig' %} +--TEMPLATE(base.twig)-- + + +{{ random([]) }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: The random function cannot pick from an empty array in "base.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test new file mode 100644 index 0000000..e2281b2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/exception_in_extension_include.test @@ -0,0 +1,12 @@ +--TEST-- +Exception thrown from an include for an extension error +--TEMPLATE-- +{% include 'content.twig' %} +--TEMPLATE(content.twig)-- + + +{{ random([]) }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: The random function cannot pick from an empty array in "content.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test new file mode 100644 index 0000000..6678429 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test @@ -0,0 +1,18 @@ +--TEST-- +Exception for multiline array with undefined variable +--TEMPLATE-- +{% set foo = { + foo: 'foo', + bar: 'bar', + + + foobar: foobar, + + + + foo2: foo2, +} %} +--DATA-- +return ['foobar' => 'foobar'] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "foo2" does not exist in "index.twig" at line 11. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test new file mode 100644 index 0000000..7f5e96b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test @@ -0,0 +1,18 @@ +--TEST-- +Exception for multiline array with undefined variable +--TEMPLATE-- +{% set foo = { + foo: 'foo', + bar: 'bar', + + + foobar: foobar, + + + + foo2: foo2, +} %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "foobar" does not exist in "index.twig" at line 7. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test new file mode 100644 index 0000000..8bc524e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test @@ -0,0 +1,12 @@ +--TEST-- +Exception for multile function with undefined variable +--TEMPLATE-- +{{ include('foo', + with_context=with_context +) }} +--TEMPLATE(foo)-- +Foo +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "with_context" does not exist in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test new file mode 100644 index 0000000..5f413d4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test @@ -0,0 +1,9 @@ +--TEST-- +Exception for multiline function with unknown argument +--TEMPLATE-- +{{ include('foo', + with_context=True, + invalid=False +) }} +--EXCEPTION-- +Twig\Error\SyntaxError: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test new file mode 100644 index 0000000..032ad83 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test @@ -0,0 +1,12 @@ +--TEST-- +Exception for multiline tag with undefined variable +--TEMPLATE-- +{% include 'foo' + with vars +%} +--TEMPLATE(foo)-- +Foo +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "vars" does not exist in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test new file mode 100644 index 0000000..e14beb6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test @@ -0,0 +1,6 @@ +--TEST-- +The PHP === strict comparison operator is not supported +--TEMPLATE-- +{{ 1 === 2 }} +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected operator of value "=". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test new file mode 100644 index 0000000..4ce0685 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test @@ -0,0 +1,10 @@ +--TEST-- +Exception for syntax error in reused template +--TEMPLATE-- +{% use 'foo.twig' %} +--TEMPLATE(foo.twig)-- +{% block bar %} + {% do node.data = 5 %} +{% endblock %} +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test new file mode 100644 index 0000000..b4fc169 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test @@ -0,0 +1,20 @@ +--TEST-- +Exception for an unclosed tag +--TEMPLATE-- +{% block foo %} + {% if foo %} + + + + + {% for i in fo %} + + + + {% endfor %} + + + +{% endblock %} +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test new file mode 100644 index 0000000..07f855a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test @@ -0,0 +1,10 @@ +--TEST-- +Exception for an undefined parent +--TEMPLATE-- +{% extends 'foo.html' %} + +{% set foo = "foo" %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "foo.html" is not defined in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test new file mode 100644 index 0000000..904faa5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test @@ -0,0 +1,15 @@ +--TEST-- +Exception for an undefined template in a child template +--TEMPLATE-- +{% extends 'base.twig' %} + +{% block sidebar %} + {{ include('include.twig') }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block sidebar %} +{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "include.twig" is not defined in "index.twig" at line 5. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test new file mode 100644 index 0000000..5bfdd07 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test @@ -0,0 +1,9 @@ +--TEST-- +Exception for an undefined trait +--TEMPLATE-- +{% use 'foo' with foobar as bar %} +--TEMPLATE(foo)-- +{% block bar %} +{% endblock %} +--EXCEPTION-- +Twig\Error\RuntimeError: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test new file mode 100644 index 0000000..fb88f4c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test @@ -0,0 +1,8 @@ +--TEST-- +_self returns the template name +--TEMPLATE-- +{{ _self }} +--DATA-- +return [] +--EXPECT-- +index.twig diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test new file mode 100644 index 0000000..bf60333 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test @@ -0,0 +1,61 @@ +--TEST-- +Twig supports array notation +--TEMPLATE-- +{# empty array #} +{{ []|join(',') }} + +{{ [1, 2]|join(',') }} +{{ ['foo', "bar"]|join(',') }} +{{ {0: 1, 'foo': 'bar'}|join(',') }} +{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} + +{{ {0: 1, foo: 'bar'}|join(',') }} +{{ {0: 1, foo: 'bar'}|keys|join(',') }} + +{# nested arrays #} +{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} +{{ a[2]|join(',') }} +{{ a[3]["foo"]|join(',') }} + +{# works even if [] is used inside the array #} +{{ [foo[bar]]|join(',') }} + +{# elements can be any expression #} +{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} + +{# arrays can have a trailing , like in PHP #} +{{ + [ + 1, + 2, + ]|join(',') +}} + +{# keys can be any expression #} +{% set a = 1 %} +{% set b = "foo" %} +{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} +{{ ary|keys|join(',') }} +{{ ary|join(',') }} +--DATA-- +return ['bar' => 'bar', 'foo' => ['bar' => 'bar']] +--EXPECT-- +1,2 +foo,bar +1,bar +0,foo + +1,bar +0,foo + +1,2 +bar + +bar + +FOO,BAR, + +1,2 + +1,foo,c,1foo +a,b,c,d diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test new file mode 100644 index 0000000..8c7a2ee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo }} +{{ items['foo'] }} +{{ items[foo] }} +{{ items[items[foo]] }} +--DATA-- +return ['foo' => 'bar', 'items' => ['foo' => 'bar', 'bar' => 'foo']] +--EXPECT-- +bar +bar +foo +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test new file mode 100644 index 0000000..b4e8be5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test @@ -0,0 +1,46 @@ +--TEST-- +Twig supports binary operations (+, -, *, /, ~, %, and, or) +--TEMPLATE-- +{{ 1 + 1 }} +{{ 2 - 1 }} +{{ 2 * 2 }} +{{ 2 / 2 }} +{{ 3 % 2 }} +{{ 1 and 1 }} +{{ 1 and 0 }} +{{ 0 and 1 }} +{{ 0 and 0 }} +{{ 1 or 1 }} +{{ 1 or 0 }} +{{ 0 or 1 }} +{{ 0 or 0 }} +{{ 0 or 1 and 0 }} +{{ 1 or 0 and 1 }} +{{ "foo" ~ "bar" }} +{{ foo ~ "bar" }} +{{ "foo" ~ bar }} +{{ foo ~ bar }} +{{ 20 // 7 }} +--DATA-- +return ['foo' => 'bar', 'bar' => 'foo'] +--EXPECT-- +2 +1 +4 +1 +1 +1 + + + +1 +1 +1 + + +1 +foobar +barbar +foofoo +barfoo +2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test new file mode 100644 index 0000000..c2bda1c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports bitwise operations +--TEMPLATE-- +{{ 1 b-and 5 }} +{{ 1 b-or 5 }} +{{ 1 b-xor 5 }} +{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }} +--DATA-- +return [] +--EXPECT-- +1 +5 +4 +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_argument_defined_twice.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_argument_defined_twice.test new file mode 100644 index 0000000..36539a6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_argument_defined_twice.test @@ -0,0 +1,8 @@ +--TEST-- +Argument is defined twice in a call +--TEMPLATE-- +{{ date(987654, date = 123456) }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Argument "date" is defined twice for function "date" in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_positional_arg_after_named_arg.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_positional_arg_after_named_arg.test new file mode 100644 index 0000000..729c674 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/call_positional_arg_after_named_arg.test @@ -0,0 +1,8 @@ +--TEST-- +Positional arguments after named arguments in a call +--TEMPLATE-- +{{ date(date = 123456, 'Y-m-d') }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Positional arguments cannot be used after named arguments for function "date" in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test new file mode 100644 index 0000000..2811634 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports comparison operators (==, !=, <, >, >=, <=) +--TEMPLATE-- +{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} +{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} +{{ 1 == 1 }}/{{ 1 == 2 }} +{{ 1 != 1 }}/{{ 1 != 2 }} +--DATA-- +return [] +--EXPECT-- +///1 +1//1/1 +1/ +/1 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test new file mode 100644 index 0000000..f1bf568 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test @@ -0,0 +1,17 @@ +--TEST-- +Twig supports the "divisible by" operator +--TEMPLATE-- +{{ 8 is divisible by(2) ? 'OK' }} +{{ 8 is not divisible by(3) ? 'OK' }} +{{ 8 is divisible by (2) ? 'OK' }} +{{ 8 is not + divisible + by + (3) ? 'OK' }} +--DATA-- +return [] +--EXPECT-- +OK +OK +OK +OK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test new file mode 100644 index 0000000..0efa930 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test @@ -0,0 +1,20 @@ +--TEST-- +Twig supports the .. operator +--TEMPLATE-- +{% for i in 0..10 %}{{ i }} {% endfor %} + +{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} + +{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} + +{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} + +{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} +--DATA-- +return ['foo' => [1, 10]] +--EXPECT-- +0 1 2 3 4 5 6 7 8 9 10 +a b c d e f g h i j k l m n o p q r s t u v w x y z +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +1 2 3 4 5 6 7 8 9 10 +1 2 3 4 5 6 7 8 9 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test new file mode 100644 index 0000000..c8086d6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test @@ -0,0 +1,26 @@ +--TEST-- +Twig supports the "ends with" operator +--TEMPLATE-- +{{ 'foo' ends with 'o' ? 'OK' : 'KO' }} +{{ not ('foo' ends with 'f') ? 'OK' : 'KO' }} +{{ not ('foo' ends with 'foowaytoolong') ? 'OK' : 'KO' }} +{{ 'foo' ends with '' ? 'OK' : 'KO' }} +{{ '1' ends with true ? 'OK' : 'KO' }} +{{ 1 ends with true ? 'OK' : 'KO' }} +{{ 0 ends with false ? 'OK' : 'KO' }} +{{ '' ends with false ? 'OK' : 'KO' }} +{{ false ends with false ? 'OK' : 'KO' }} +{{ false ends with '' ? 'OK' : 'KO' }} +--DATA-- +return [] +--EXPECT-- +OK +OK +OK +OK +KO +KO +KO +KO +KO +KO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test new file mode 100644 index 0000000..cdf871c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test @@ -0,0 +1,16 @@ +--TEST-- +Twig compiles floats properly +--CONDITION-- +version_compare(phpversion(), '7.0.0', '>=') +--TEMPLATE-- +{% set val2 = 0.0 %} + +{{ val is same as (0.0) ? 'Yes' : 'No' }} +{{ val2 is same as (0.0) ? 'Yes' : 'No' }} +{{ val is same as (val2) ? 'Yes' : 'No' }} +--DATA-- +return ['val' => 0.0] +--EXPECT-- +Yes +Yes +Yes diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test new file mode 100644 index 0000000..069ebf7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test @@ -0,0 +1,8 @@ +--TEST-- +Twig supports grouping of expressions +--TEMPLATE-- +{{ (2 + 2) / 2 }} +--DATA-- +return [] +--EXPECT-- +2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test new file mode 100644 index 0000000..308e8df --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test @@ -0,0 +1,22 @@ +--TEST-- +Twig supports literals +--TEMPLATE-- +1 {{ true }} +2 {{ TRUE }} +3 {{ false }} +4 {{ FALSE }} +5 {{ none }} +6 {{ NONE }} +7 {{ null }} +8 {{ NULL }} +--DATA-- +return [] +--EXPECT-- +1 1 +2 1 +3 +4 +5 +6 +7 +8 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test new file mode 100644 index 0000000..60417e0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports __call() for attributes +--TEMPLATE-- +{{ foo.foo }} +{{ foo.bar }} +--DATA-- +class TestClassForMagicCallAttributes +{ + public function getBar() + { + return 'bar_from_getbar'; + } + + public function __call($method, $arguments) + { + if ('foo' === $method) { + return 'foo_from_call'; + } + + return false; + } +} + +return ['foo' => new TestClassForMagicCallAttributes()] +--EXPECT-- +foo_from_call +bar_from_getbar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test new file mode 100644 index 0000000..95459c3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports the "matches" operator +--TEMPLATE-- +{{ 'foo' matches '/o/' ? 'OK' : 'KO' }} +{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }} +{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }} +--DATA-- +return [] +--EXPECT-- +OK +OK +OK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test new file mode 100644 index 0000000..1826842 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test @@ -0,0 +1,28 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo.foo }} +{{ items.foo.getFoo() }} +{{ items.foo.bar }} +{{ items.foo['bar'] }} +{{ items.foo.bar('a', 43) }} +{{ items.foo.bar(foo) }} +{{ items.foo.self.foo() }} +{{ items.foo.is }} +{{ items.foo.in }} +{{ items.foo.not }} +--DATA-- +return ['foo' => 'bar', 'items' => ['foo' => new TwigTestFoo(), 'bar' => 'foo']] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- +foo +foo +bar + +bar_a-43 +bar_bar +foo +is +in +not diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test new file mode 100644 index 0000000..c2a6e34 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test @@ -0,0 +1,18 @@ +--TEST-- +Twig manages negative numbers correctly +--TEMPLATE-- +{{ -1 }} +{{ - 1 }} +{{ 5 - 1 }} +{{ 5-1 }} +{{ 5 + -1 }} +{{ 5 + - 1 }} +--DATA-- +return [] +--EXPECT-- +-1 +-1 +4 +4 +4 +4 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/not_arrow_fn.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/not_arrow_fn.test new file mode 100644 index 0000000..af82c47 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/not_arrow_fn.test @@ -0,0 +1,8 @@ +--TEST-- +A string in parentheses cannot be confused with an arrow function +--TEMPLATE-- +{{ ["foo", "bar"]|join(("f")) }} +--DATA-- +return [] +--EXPECT-- +foofbar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test new file mode 100644 index 0000000..fa9a843 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test @@ -0,0 +1,16 @@ +--TEST-- +Twig allows to use named operators as variable names +--TEMPLATE-- +{% for match in matches %} + {{- match }} +{% endfor %} +{{ in }} +{{ is }} +--DATA-- +return ['matches' => [1, 2, 3], 'in' => 'in', 'is' => 'is'] +--EXPECT-- +1 +2 +3 +in +is diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test new file mode 100644 index 0000000..276cbf1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test @@ -0,0 +1,22 @@ +--TEST-- +Twig parses postfix expressions +--TEMPLATE-- +{% import _self as macros %} + +{% macro foo() %}foo{% endmacro %} + +{{ 'a' }} +{{ 'a'|upper }} +{{ ('a')|upper }} +{{ -1|upper }} +{{ macros.foo() }} +{{ (macros).foo() }} +--DATA-- +return [] +--EXPECT-- +a +A +A +-1 +foo +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test new file mode 100644 index 0000000..84fd236 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test @@ -0,0 +1,20 @@ +--TEST-- +Twig parses power expressions +--TEMPLATE-- +{{ 2**3 }} +{{ (-2)**3 }} +{{ (-2)**(-3) }} +{{ a ** a }} +{{ a ** b }} +{{ b ** a }} +{{ b ** b }} +--DATA-- +return ['a' => 4, 'b' => -2] +--EXPECT-- +8 +-8 +-0.125 +256 +0.0625 +16 +0.25 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test new file mode 100644 index 0000000..83f3691 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test @@ -0,0 +1,21 @@ +--TEST-- +Twig supports the "same as" operator +--TEMPLATE-- +{{ 1 is same as(1) ? 'OK' }} +{{ 1 is not same as(true) ? 'OK' }} +{{ 1 is same as(1) ? 'OK' }} +{{ 1 is not same as(true) ? 'OK' }} +{{ 1 is same as (1) ? 'OK' }} +{{ 1 is not + same + as + (true) ? 'OK' }} +--DATA-- +return [] +--EXPECT-- +OK +OK +OK +OK +OK +OK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test new file mode 100644 index 0000000..a78ff1e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports the "starts with" operator +--TEMPLATE-- +{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} +{{ not ('foo' starts with 'oo') ? 'OK' : 'KO' }} +{{ not ('foo' starts with 'foowaytoolong') ? 'OK' : 'KO' }} +{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} +{{ 'foo' starts +with 'f' ? 'OK' : 'KO' }} +{{ 'foo' starts with '' ? 'OK' : 'KO' }} +{{ '1' starts with true ? 'OK' : 'KO' }} +{{ '' starts with false ? 'OK' : 'KO' }} +{{ 'a' starts with false ? 'OK' : 'KO' }} +{{ false starts with '' ? 'OK' : 'KO' }} +--DATA-- +return [] +--EXPECT-- +OK +OK +OK +OK +OK +OK +KO +KO +KO +KO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test new file mode 100644 index 0000000..f402c89 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports string interpolation +--TEMPLATE-- +{{ "foo #{"foo #{bar} baz"} baz" }} +{{ "foo #{bar}#{bar} baz" }} +--DATA-- +return ['bar' => 'BAR'] +--EXPECT-- +foo foo BAR baz baz +foo BARBAR baz diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test new file mode 100644 index 0000000..37eccc0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test @@ -0,0 +1,18 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} +{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} +{{ 1 == 1 ? 'foo
    ':'' }} +{{ foo ~ (bar ? ('-' ~ bar) : '') }} +--DATA-- +return ['foo' => 'foo', 'bar' => 'bar'] +--EXPECT-- +YES +NO +YES1 +NO1 +foo
    +foo-bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test new file mode 100644 index 0000000..8b0f728 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' }} +{{ 0 ? 'YES' }} +--DATA-- +return [] +--EXPECT-- +YES + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test new file mode 100644 index 0000000..ecd6b75 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 'YES' ?: 'NO' }} +{{ 0 ?: 'NO' }} +--DATA-- +return [] +--EXPECT-- +YES +NO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test new file mode 100644 index 0000000..eca3b28 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not allow to use two-word named operators as variable names +--TEMPLATE-- +{{ starts with }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test new file mode 100644 index 0000000..5422531 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports unary operators (not, -, +) +--TEMPLATE-- +{{ not 1 }}/{{ not 0 }} +{{ +1 + 1 }}/{{ -1 - 1 }} +{{ not (false or true) }} +--DATA-- +return [] +--EXPECT-- +/1 +2/-2 + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test new file mode 100644 index 0000000..27deba3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test @@ -0,0 +1,22 @@ +--TEST-- +Twig manages negative numbers as default parameters +--TEMPLATE-- +{% import _self as macros %} +{{ macros.negative_number1() }} +{{ macros.negative_number2() }} +{{ macros.negative_number3() }} +{{ macros.positive_number1() }} +{{ macros.positive_number2() }} +{% macro negative_number1(nb=-1) %}{{ nb }}{% endmacro %} +{% macro negative_number2(nb = --1) %}{{ nb }}{% endmacro %} +{% macro negative_number3(nb = - 1) %}{{ nb }}{% endmacro %} +{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %} +{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %} +--DATA-- +return [] +--EXPECT-- +-1 +1 +-1 +1 +1 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test new file mode 100644 index 0000000..9c56ab1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test @@ -0,0 +1,14 @@ +--TEST-- +Twig unary operators precedence +--TEMPLATE-- +{{ -1 - 1 }} +{{ -1 - -1 }} +{{ -1 * -1 }} +{{ 4 / -1 * 5 }} +--DATA-- +return [] +--EXPECT-- +-2 +0 +1 +-20 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test new file mode 100644 index 0000000..7518769 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test @@ -0,0 +1,30 @@ +--TEST-- +"abs" filter +--TEMPLATE-- +{{ (-5.5)|abs }} +{{ (-5)|abs }} +{{ (-0)|abs }} +{{ 0|abs }} +{{ 5|abs }} +{{ 5.5|abs }} +{{ number1|abs }} +{{ number2|abs }} +{{ number3|abs }} +{{ number4|abs }} +{{ number5|abs }} +{{ number6|abs }} +--DATA-- +return ['number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5] +--EXPECT-- +5.5 +5 +0 +0 +5 +5.5 +5.5 +5 +0 +0 +5 +5.5 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test new file mode 100644 index 0000000..0acf25b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test @@ -0,0 +1,31 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3) %} +
    + {% for column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    +
    +
    d
    +
    e
    +
    f
    +
    +
    +
    g
    +
    h
    +
    i
    +
    +
    +
    j
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test new file mode 100644 index 0000000..dad004e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test @@ -0,0 +1,29 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3.1) %} +
    + {% for column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    d
    +
    +
    +
    e
    +
    f
    +
    g
    +
    h
    +
    +
    +
    i
    +
    j
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test new file mode 100644 index 0000000..411b4fc --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test @@ -0,0 +1,37 @@ +--TEST-- +"batch" filter +--TEMPLATE-- + +{% for row in items|batch(3, '') %} + + {% for column in row %} + + {% endfor %} + +{% endfor %} +
    {{ column }}
    +--DATA-- +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] +--EXPECT-- + + + + + + + + + + + + + + + + + + + + + +
    abc
    def
    ghi
    j
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test new file mode 100644 index 0000000..750d155 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test @@ -0,0 +1,33 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3, 'fill') %} +
    + {% for column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']] +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    +
    +
    d
    +
    e
    +
    f
    +
    +
    +
    g
    +
    h
    +
    i
    +
    +
    +
    j
    +
    k
    +
    l
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test new file mode 100644 index 0000000..5d470d0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test @@ -0,0 +1,37 @@ +--TEST-- +"batch" filter +--TEMPLATE-- + +{% for row in items|batch(3, 'fill') %} + + {% for column in row %} + + {% endfor %} + +{% endfor %} +
    {{ column }}
    +--DATA-- +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] +--EXPECT-- + + + + + + + + + + + + + + + + + + + + + +
    abc
    def
    ghi
    jfillfill
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test new file mode 100644 index 0000000..e56cd79 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test @@ -0,0 +1,10 @@ +--TEST-- +"batch" filter preserves array keys +--TEMPLATE-- +{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} +{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} +--DATA-- +return [] +--EXPECT-- +foo,key +foo,key,0,1 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test new file mode 100644 index 0000000..90f4de6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test @@ -0,0 +1,23 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3, 'fill') %} +
    + {% for key, column in row %} +
    {{ column }}
    + {% endfor %} +
    +{% endfor %} +--DATA-- +return ['items' => ['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', '123' => 'e']] +--EXPECT-- +
    +
    a
    +
    b
    +
    c
    +
    +
    +
    d
    +
    e
    +
    fill
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test new file mode 100644 index 0000000..bc303da --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test @@ -0,0 +1,10 @@ +--TEST-- +"batch" filter with zero elements +--TEMPLATE-- +{{ []|batch(3)|length }} +{{ []|batch(3, 'fill')|length }} +--DATA-- +return [] +--EXPECT-- +0 +0 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test new file mode 100644 index 0000000..db8aced --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test @@ -0,0 +1,10 @@ +--TEST-- +"convert_encoding" filter +--CONDITION-- +function_exists('iconv') || function_exists('mb_convert_encoding') +--TEMPLATE-- +{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} +--DATA-- +return [] +--EXPECT-- +愛していますか? diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test new file mode 100644 index 0000000..16816aa --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test @@ -0,0 +1,90 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} +{{ date1|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} +{{ date1|date('e') }} +{{ date1|date('d/m/Y H:i:s') }} + +{{ date2|date }} +{{ date2|date('d/m/Y') }} +{{ date2|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} +{{ date2|date('d/m/Y H:i:s', timezone1) }} +{{ date2|date('d/m/Y H:i:s') }} + +{{ date3|date }} +{{ date3|date('d/m/Y') }} + +{{ date4|date }} +{{ date4|date('d/m/Y') }} + +{{ date5|date }} +{{ date5|date('d/m/Y') }} + +{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date6|date('d/m/Y H:i:s P', false) }} +{{ date6|date('e', 'Europe/Paris') }} +{{ date6|date('e', false) }} + +{{ date7|date }} +{{ date7|date(timezone='Europe/Paris') }} +{{ date7|date(timezone='Asia/Hong_Kong') }} +{{ date7|date(timezone=false) }} +{{ date7|date(timezone='Indian/Mauritius') }} + +{{ '2010-01-28 15:00:00'|date(timezone="Europe/Paris") }} +{{ '2010-01-28 15:00:00'|date(timezone="Asia/Hong_Kong") }} +--DATA-- +date_default_timezone_set('Europe/Paris'); +return [ + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new \DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + 'date4' => 1286199900, // \DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new \DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT + 'date5' => -189291360, // \DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new \DateTimeZone('UTC'))->getTimestamp(), + 'date6' => new \DateTime('2010-10-04 13:45', new \DateTimeZone('America/New_York')), + 'date7' => '2010-01-28T15:00:00+04:00', + 'timezone1' => new \DateTimeZone('America/New_York'), +] +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +04/10/2010 19:45:00 +04/10/2010 19:45:00 +08:00 +04/10/2010 06:45:00 -05:00 +Europe/Paris +04/10/2010 13:45:00 + +October 4, 2010 13:45 +04/10/2010 +04/10/2010 19:45:00 +04/10/2010 07:45:00 +04/10/2010 13:45:00 + +October 4, 2010 13:45 +04/10/2010 + +October 4, 2010 15:45 +04/10/2010 + +January 2, 1964 04:04 +02/01/1964 + +04/10/2010 19:45:00 +02:00 +05/10/2010 01:45:00 +08:00 +04/10/2010 13:45:00 -04:00 +Europe/Paris +America/New_York + +January 28, 2010 12:00 +January 28, 2010 12:00 +January 28, 2010 19:00 +January 28, 2010 15:00 +January 28, 2010 15:00 + +January 28, 2010 15:00 +January 28, 2010 22:00 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test new file mode 100644 index 0000000..c6e8130 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test @@ -0,0 +1,14 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('Y-m-d', '%d days %h hours'); +return [ + 'date1' => mktime(13, 45, 0, 10, 4, 2010), +] +--EXPECT-- +2010-10-04 +04/10/2010 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test new file mode 100644 index 0000000..a72fb81 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date2|date }} +{{ date2|date('%d days') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('Y-m-d', '%d days %h hours'); +return [ + 'date2' => new \DateInterval('P2D'), +] +--EXPECT-- +2 days 0 hours +2 days diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test new file mode 100644 index 0000000..2414db5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test @@ -0,0 +1,37 @@ +--TEST-- +"date" filter +--CONDITION-- +version_compare(phpversion(), '5.5.0', '>=') +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} +{{ date1|date('d/m/Y H:i:s', timezone1) }} +{{ date1|date('d/m/Y H:i:s') }} +{{ date1|date_modify('+1 hour')|date('d/m/Y H:i:s') }} + +{{ date2|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date2|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date2|date('d/m/Y H:i:s P', false) }} +{{ date2|date('e', 'Europe/Paris') }} +{{ date2|date('e', false) }} +--DATA-- +date_default_timezone_set('Europe/Paris'); +return [ + 'date1' => new \DateTimeImmutable('2010-10-04 13:45'), + 'date2' => new \DateTimeImmutable('2010-10-04 13:45', new \DateTimeZone('America/New_York')), + 'timezone1' => new \DateTimeZone('America/New_York'), +] +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +04/10/2010 19:45:00 +04/10/2010 07:45:00 +04/10/2010 13:45:00 +04/10/2010 14:45:00 + +04/10/2010 19:45:00 +02:00 +05/10/2010 01:45:00 +08:00 +04/10/2010 13:45:00 -04:00 +Europe/Paris +America/New_York diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test new file mode 100644 index 0000000..c3333f5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test @@ -0,0 +1,19 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('%d days %h hours') }} +{{ date1|date('%d days %h hours', timezone1) }} +--DATA-- +date_default_timezone_set('UTC'); +return [ + 'date1' => new \DateInterval('P2D'), + // This should have no effect on \DateInterval formatting + 'timezone1' => new \DateTimeZone('America/New_York'), +] +--EXPECT-- +2 days +2 days 0 hours +2 days 0 hours diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test new file mode 100644 index 0000000..d7f8fdf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test @@ -0,0 +1,14 @@ +--TEST-- +"date_modify" filter +--TEMPLATE-- +{{ date1|date_modify('-1day')|date('Y-m-d H:i:s') }} +{{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} +--DATA-- +date_default_timezone_set('UTC'); +return [ + 'date1' => '2010-10-04 13:45', + 'date2' => new \DateTime('2010-10-04 13:45'), +] +--EXPECT-- +2010-10-03 13:45:00 +2010-10-03 13:45:00 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test new file mode 100644 index 0000000..2d1aa13 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test @@ -0,0 +1,13 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date|date(format='d/m/Y H:i:s P', timezone='America/Chicago') }} +{{ date|date(timezone='America/Chicago', format='d/m/Y H:i:s P') }} +{{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }} +--DATA-- +date_default_timezone_set('UTC'); +return ['date' => mktime(13, 45, 0, 10, 4, 2010)] +--EXPECT-- +04/10/2010 08:45:00 -05:00 +04/10/2010 08:45:00 -05:00 +04/10/2010 08:45:00 -05:00 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test new file mode 100644 index 0000000..058873a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test @@ -0,0 +1,150 @@ +--TEST-- +"default" filter +--TEMPLATE-- +Variable: +{{ definedVar |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ nullVar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }} +Array access: +{{ nested.definedVar |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ nested['definedVar'] |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ nested.zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ nested.emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ nested.nullVar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ nested.undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ nested['undefinedVar'] |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ undefinedVar.foo |default('default') is same as('default') ? 'ok' : 'ko' }} +Plain values: +{{ 'defined' |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ 0 |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ '' |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ null |default('default') is same as('default') ? 'ok' : 'ko' }} +Precedence: +{{ 'o' ~ nullVar |default('k') }} +{{ 'o' ~ nested.nullVar |default('k') }} +Object methods: +{{ object.foo |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ object.getFoo() |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ object.getFoo('a') |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod() |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod('a') |default('default') is same as('default') ? 'ok' : 'ko' }} +Deep nested: +{{ nested.undefinedVar.foo.bar |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ nested.definedArray.0 |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ nested['definedArray'][0] |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ object.self.foo |default('default') is same as('default') ? 'ko' : 'ok' }} +{{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }} +--DATA-- +return [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => [0], + ], + 'object' => new TwigTestFoo(), +] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok +--DATA-- +return [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => [0], + ], + 'object' => new TwigTestFoo(), +] +--CONFIG-- +return ['strict_variables' => true] +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test new file mode 100644 index 0000000..27dc878 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic filter +--TEMPLATE-- +{{ 'bar'|foo_path }} +{{ 'bar'|a_foo_b_bar }} +--DATA-- +return [] +--EXPECT-- +foo/bar +a/b/bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test new file mode 100644 index 0000000..131f5b4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "foo
    "|e }} +--DATA-- +return [] +--EXPECT-- +foo <br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test new file mode 100644 index 0000000..10e3275 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter does not escape with the html strategy when using the html_attr strategy +--TEMPLATE-- +{{ '
    '|escape('html_attr') }} +--DATA-- +return [] +--EXPECT-- +<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test new file mode 100644 index 0000000..4c2fb7a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "é ♜ 𝌆"|e('js') }} +--DATA-- +return [] +--EXPECT-- +\u00E9\u0020\u265C\u0020\uD834\uDF06 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test new file mode 100644 index 0000000..93f3429 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "愛していますか?
    "|e }} +--DATA-- +return [] +--EXPECT-- +愛していますか? <br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test new file mode 100644 index 0000000..faaa5e0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter.test @@ -0,0 +1,46 @@ +--TEST-- +"filter" filter +--TEMPLATE-- +{% set offset = 3 %} + +{% for k, v in [1, 5, 3, 4, 5]|filter((v) => v > offset) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in {a: 1, b: 2, c: 5, d: 8}|filter(v => v > offset) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in [1, 5, 3, 4, 5]|filter(v => v > offset) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in it|filter((v) => v > offset) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in ita|filter(v => v > offset) -%} + {{ k }} = {{ v }} +{% endfor %} +--DATA-- +return [ + 'it' => new \ArrayIterator(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]), + 'ita' => new IteratorAggregateStub(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8]), +] +--EXPECT-- +1 = 5 +3 = 4 +4 = 5 + +c = 5 +d = 8 + +1 = 5 +3 = 4 +4 = 5 + +c = 5 +d = 8 + +c = 5 +d = 8 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter_php_56.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter_php_56.test new file mode 100644 index 0000000..05711e9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/filter_php_56.test @@ -0,0 +1,20 @@ +--TEST-- +"filter" filter (PHP 5.6 required) +--CONDITION-- +version_compare(phpversion(), '5.6.0', '>=') +--TEMPLATE-- +{% set offset = 3 %} + +{% for k, v in {a: 1, b: 2, c: 5, d: 8}|filter((v, k) => (v > offset) and (k != "d")) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in it|filter((v, k) => (v > offset) and (k != "d")) -%} + {{ k }} = {{ v }} +{% endfor %} +--DATA-- +return ['it' => new \ArrayIterator(['a' => 1, 'b' => 2, 'c' => 5, 'd' => 8])] +--EXPECT-- +c = 5 + +c = 5 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test new file mode 100644 index 0000000..b19f2ee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test @@ -0,0 +1,17 @@ +--TEST-- +"first" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|first }} +{{ {a: 1, b: 2, c: 3, d: 4}|first }} +{{ '1234'|first }} +{{ arr|first }} +{{ 'Ä€é'|first }} +{{ ''|first }} +--DATA-- +return ['arr' => new \ArrayObject([1, 2, 3, 4])] +--EXPECT-- +1 +1 +1 +1 +Ä diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test new file mode 100644 index 0000000..7efbe32 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test @@ -0,0 +1,18 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{% set foo %} + foo
    +{% endset %} + +{{ foo|e('html') -}} +{{ foo|e('js') }} +{% autoescape true %} + {{ foo }} +{% endautoescape %} +--DATA-- +return [] +--EXPECT-- + foo<br /> +\u0020\u0020\u0020\u0020foo\u003Cbr\u0020\/\u003E\n + foo
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test new file mode 100644 index 0000000..efaf831 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test @@ -0,0 +1,8 @@ +--TEST-- +"format" filter +--TEMPLATE-- +{{ string|format(foo, 3) }} +--DATA-- +return ['string' => '%s/%d', 'foo' => 'bar'] +--EXPECT-- +bar/3 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test new file mode 100644 index 0000000..5792586 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test @@ -0,0 +1,38 @@ +--TEST-- +"join" filter +--TEMPLATE-- +{{ ["foo", "bar"]|join(', ') }} +{{ foo|join(', ') }} +{{ bar|join(', ') }} + +{{ ["foo", "bar"]|join(', ', ' and ') }} +{{ foo|join(', ', ' and ') }} +{{ bar|join(', ', ' and ') }} +{{ ["one", "two", "three"]|join(', ', ' and ') }} +{{ ["a", "b", "c"]|join('','-') }} +{{ ["a", "b", "c"]|join('-','-') }} +{{ ["a", "b", "c"]|join('-','') }} +{{ ["hello"]|join('|','-') }} + +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join }} +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',') }} +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',','-') }} +--DATA-- +return ['foo' => new TwigTestFoo(), 'bar' => new \ArrayObject([3, 4])] +--EXPECT-- +foo, bar +1, 2 +3, 4 + +foo and bar +1 and 2 +3 and 4 +one, two and three +ab-c +a-b-c +a-bc +hello + +wxyz +w,x,y,z +w,x,y-z diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test new file mode 100644 index 0000000..902f90b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test @@ -0,0 +1,12 @@ +--TEST-- +"json_encode" filter +--TEMPLATE-- +{{ "foo"|json_encode|raw }} +{{ foo|json_encode|raw }} +{{ [foo, "foo"]|json_encode|raw }} +--DATA-- +return ['foo' => new \Twig\Markup('foo', 'UTF-8')] +--EXPECT-- +"foo" +"foo" +["foo","foo"] diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test new file mode 100644 index 0000000..f71896c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test @@ -0,0 +1,17 @@ +--TEST-- +"last" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|last }} +{{ {a: 1, b: 2, c: 3, d: 4}|last }} +{{ '1234'|last }} +{{ arr|last }} +{{ 'Ä€é'|last }} +{{ ''|last }} +--DATA-- +return ['arr' => new \ArrayObject([1, 2, 3, 4])] +--EXPECT-- +4 +4 +4 +4 +é diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test new file mode 100644 index 0000000..52ad9e8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test @@ -0,0 +1,40 @@ +--TEST-- +"length" filter +--TEMPLATE-- +{{ array|length }} +{{ string|length }} +{{ number|length }} +{{ to_string_able|length }} +{{ countable|length }} +{{ iterator_aggregate|length }} +{{ null|length }} +{{ magic|length }} +{{ non_countable|length }} +{{ simple_xml_element|length }} +{{ iterator|length }} +--DATA-- +return [ + 'array' => [1, 4], + 'string' => 'foo', + 'number' => 1000, + 'to_string_able' => new ToStringStub('foobar'), + 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */ + 'iterator_aggregate' => new IteratorAggregateStub(['a', 'b', 'c']), /* also asserts we do *not* call __toString() */ + 'null' => null, + 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */ + 'non_countable' => new \StdClass(), + 'simple_xml_element' => new \SimpleXMLElement(''), + 'iterator' => new \SimpleIteratorForTesting() +] +--EXPECT-- +2 +3 +4 +6 +42 +3 +0 +1 +1 +2 +7 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test new file mode 100644 index 0000000..b1e9681 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test @@ -0,0 +1,12 @@ +--TEST-- +"length" filter +--CONDITION-- +function_exists('mb_get_info') +--TEMPLATE-- +{{ string|length }} +{{ markup|length }} +--DATA-- +return ['string' => 'été', 'markup' => new \Twig\Markup('foo', 'UTF-8')] +--EXPECT-- +3 +3 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/map.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/map.test new file mode 100644 index 0000000..5552f81 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/map.test @@ -0,0 +1,41 @@ +--TEST-- +"map" filter +--TEMPLATE-- +{% set offset = 3 %} + +{% for k, v in [1, 2]|map((item) => item + 2 ) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in {a: 1, b: 2}|map((item) => item ~ "*" ) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in {a: 1, b: 2}|map((item, k) => item ~ "*" ~ k ) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in [1, 2]|map(item => item + 2 ) -%} + {{ k }} = {{ v }} +{% endfor %} + +{% for k, v in it|map(item => item + 2 ) -%} + {{ k }} = {{ v }} +{% endfor %} +--DATA-- +return ['it' => new \ArrayIterator([1, 2])] +--EXPECT-- +0 = 3 +1 = 4 + +a = 1* +b = 2* + +a = 1*a +b = 2*b + +0 = 3 +1 = 4 + +0 = 3 +1 = 4 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test new file mode 100644 index 0000000..8877501 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -0,0 +1,25 @@ +--TEST-- +"merge" filter +--TEMPLATE-- +{{ items|merge({'bar': 'foo'})|join }} +{{ items|merge({'bar': 'foo'})|keys|join }} +{{ {'bar': 'foo'}|merge(items)|join }} +{{ {'bar': 'foo'}|merge(items)|keys|join }} +{{ numerics|merge([4, 5, 6])|join }} +{{ traversable.a|merge(traversable.b)|join }} +--DATA-- +return [ + 'items' => ['foo' => 'bar'], + 'numerics' => [1, 2, 3], + 'traversable' => [ + 'a' => new \ArrayObject([0 => 1, 1 => 2, 2 => 3]), + 'b' => new \ArrayObject(['a' => 'b']) + ] +] +--EXPECT-- +barfoo +foobar +foobar +barfoo +123456 +123b diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test new file mode 100644 index 0000000..524ec45 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test @@ -0,0 +1,14 @@ +--TEST-- +"nl2br" filter +--TEMPLATE-- +{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} +{{ text|nl2br }} +--DATA-- +return ['text' => "If you have some HTML\nit will be escaped."] +--EXPECT-- +I like Twig.
    +You will like it too.
    +
    +Everybody like it! +If you have some <strong>HTML</strong>
    +it will be escaped. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test new file mode 100644 index 0000000..7f1e2e1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test @@ -0,0 +1,18 @@ +--TEST-- +"number_format" filter +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(2) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +return [] +--EXPECT-- +20 +20 +20.25 +20,25 +1,020,25 +1.020,25 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test new file mode 100644 index 0000000..beedd90 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test @@ -0,0 +1,21 @@ +--TEST-- +"number_format" filter with defaults. +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(1) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +$twig->getExtension('\Twig\Extension\CoreExtension')->setNumberFormat(2, '!', '='); +return [] +--EXPECT-- +20!00 +20!25 +20!3 +20,25 +1=020!25 +1=020,25 +1.020,25 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reduce.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reduce.test new file mode 100644 index 0000000..73cad41 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reduce.test @@ -0,0 +1,14 @@ +--TEST-- +"reduce" filter +--TEMPLATE-- +{% set offset = 3 %} + +{{ [1, -1, 4]|reduce((carry, item) => carry + item + offset, 10) }} + +{{ it|reduce((carry, item) => carry + item + offset, 10) }} +--DATA-- +return ['it' => new \ArrayIterator([1, -1, 4])] +--EXPECT-- +23 + +23 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test new file mode 100644 index 0000000..1b9670a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test @@ -0,0 +1,12 @@ +--TEST-- +"replace" filter +--TEMPLATE-- +{{ "I liké %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} +{{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }} +{{ 'I like %this% and %that%.'|replace(traversable) }} +--DATA-- +return ['traversable' => new \ArrayObject(['%this%' => 'foo', '%that%' => 'bar'])] +--EXPECT-- +I liké foo and bar. +I like single replace operation only %that%1 +I like foo and bar. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test new file mode 100644 index 0000000..ba6fea4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test @@ -0,0 +1,8 @@ +--TEST-- +Exception for invalid argument type in replace call +--TEMPLATE-- +{{ 'test %foo%'|replace(stdClass) }} +--DATA-- +return ['stdClass' => new \stdClass()] +--EXCEPTION-- +Twig\Error\RuntimeError: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test new file mode 100644 index 0000000..904e583 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test @@ -0,0 +1,18 @@ +--TEST-- +"reverse" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|reverse|join('') }} +{{ '1234évènement'|reverse }} +{{ arr|reverse|join('') }} +{{ {'a': 'c', 'b': 'a'}|reverse()|join(',') }} +{{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }} +{{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }} +--DATA-- +return ['arr' => new \ArrayObject([1, 2, 3, 4])] +--EXPECT-- +4321 +tnemenèvé4321 +4321 +a,c +a,c +a,c diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test new file mode 100644 index 0000000..7092375 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test @@ -0,0 +1,22 @@ +--TEST-- +"round" filter +--TEMPLATE-- +{{ 2.7|round }} +{{ 2.1|round }} +{{ 2.1234|round(3, 'floor') }} +{{ 2.1|round(0, 'ceil') }} + +{{ 21.3|round(-1)}} +{{ 21.3|round(-1, 'ceil')}} +{{ 21.3|round(-1, 'floor')}} +--DATA-- +return [] +--EXPECT-- +3 +2 +2.123 +3 + +20 +30 +20 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test new file mode 100644 index 0000000..fc975d7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test @@ -0,0 +1,54 @@ +--TEST-- +"slice" filter +--TEMPLATE-- +{{ [1, 2, 3, 4][1:2]|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} +{{ [1, 2, 3, 4][start:length]|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} +{{ '1234'|slice(1, 2) }} +{{ '1234'[1:2] }} +{{ arr|slice(1, 2)|join('') }} +{{ arr[1:2]|join('') }} +{{ arr[4:1]|join('') }} +{{ arr[3:2]|join('') }} + +{{ [1, 2, 3, 4]|slice(1)|join('') }} +{{ [1, 2, 3, 4][1:]|join('') }} +{{ '1234'|slice(1) }} +{{ '1234'[1:] }} +{{ '1234'[:1] }} + +{{ arr|slice(3)|join('') }} +{{ arr[2:]|join('') }} +{{ xml|slice(1)|join('')}} +--DATA-- +return ['start' => 1, 'length' => 2, 'arr' => new \ArrayObject([1, 2, 3, 4]), 'xml' => new \SimpleXMLElement('12')] +--EXPECT-- +23 +23 +23 +23 +01 +12 +23 +bc +23 +23 +23 +23 + +4 + +234 +234 +234 +234 +1 + +4 +34 +2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test new file mode 100644 index 0000000..c3b2c70 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test @@ -0,0 +1,12 @@ +--TEST-- +"sort" filter +--TEMPLATE-- +{{ array1|sort|join }} +{{ array2|sort|join }} +{{ traversable|sort|join }} +--DATA-- +return ['array1' => [4, 1], 'array2' => ['foo', 'bar'], 'traversable' => new \ArrayObject([0 => 3, 1 => 2, 2 => 1])] +--EXPECT-- +14 +barfoo +123 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test new file mode 100644 index 0000000..eadc1d4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test @@ -0,0 +1,8 @@ +--TEST-- +"spaceless" filter +--TEMPLATE-- +{{ "
    foo
    "|spaceless }} +--DATA-- +return [] +--EXPECT-- +
    foo
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test new file mode 100644 index 0000000..9869ec9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom filter +--TEMPLATE-- +{{ 'foo'|§ }} +--DATA-- +return [] +--EXPECT-- +§foo§ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test new file mode 100644 index 0000000..92dbf0a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test @@ -0,0 +1,20 @@ +--TEST-- +"split" filter +--TEMPLATE-- +{{ "one,two,three,four,five"|split(',')|join('-') }} +{{ foo|split(',')|join('-') }} +{{ foo|split(',', 3)|join('-') }} +{{ baz|split('')|join('-') }} +{{ baz|split('', 1)|join('-') }} +{{ baz|split('', 2)|join('-') }} +{{ foo|split(',', -2)|join('-') }} +--DATA-- +return ['foo' => "one,two,three,four,five", 'baz' => '12345',] +--EXPECT-- +one-two-three-four-five +one-two-three-four-five +one-two-three,four,five +1-2-3-4-5 +1-2-3-4-5 +12-34-5 +one-two-three \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test new file mode 100644 index 0000000..bf52e6d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test @@ -0,0 +1,24 @@ +--TEST-- +"split" filter +--CONDITION-- +function_exists('mb_get_info') +--TEMPLATE-- +{{ "é"|split('', 10)|join('-') }} +{{ foo|split(',')|join('-') }} +{{ foo|split(',', 1)|join('-') }} +{{ foo|split(',', 2)|join('-') }} +{{ foo|split(',', 3)|join('-') }} +{{ baz|split('')|join('-') }} +{{ baz|split('', 1)|join('-') }} +{{ baz|split('', 2)|join('-') }} +--DATA-- +return ['foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',] +--EXPECT-- +é +Ä-é-Äほ +Ä,é,Äほ +Ä-é,Äほ +Ä-é-Äほ +é-Ä-ß-ご-a +é-Ä-ß-ご-a +éÄ-ßご-a \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test new file mode 100644 index 0000000..1626db0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test @@ -0,0 +1,10 @@ +--TEST-- +Filters as static method calls +--TEMPLATE-- +{{ 'foo'|static_call_string }} +{{ 'foo'|static_call_array }} +--DATA-- +return ['foo' => 'foo'] +--EXPECT-- +*foo* +*foo* diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test new file mode 100644 index 0000000..432989f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test @@ -0,0 +1,24 @@ +--TEST-- +"trim" filter +--TEMPLATE-- +{{ " I like Twig. "|trim }} +{{ text|trim }} +{{ " foo/"|trim("/") }} +{{ "xxxI like Twig.xxx"|trim(character_mask="x", side="left") }} +{{ "xxxI like Twig.xxx"|trim(side="right", character_mask="x") }} +{{ "xxxI like Twig.xxx"|trim("x", "right") }} +{{ "/ foo/"|trim("/", "left") }} +{{ "/ foo/"|trim(character_mask="/", side="left") }} +{{ " do nothing. "|trim("", "right") }} +--DATA-- +return ['text' => " If you have some HTML it will be escaped. "] +--EXPECT-- +I like Twig. +If you have some <strong>HTML</strong> it will be escaped. + foo +I like Twig.xxx +xxxI like Twig. +xxxI like Twig. + foo/ + foo/ + do nothing. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test new file mode 100644 index 0000000..66a682d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test @@ -0,0 +1,16 @@ +--TEST-- +"url_encode" filter +--CONDITION-- +defined('PHP_QUERY_RFC3986') +--TEMPLATE-- +{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }} +{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }} +{{ {}|url_encode|default("default") }} +{{ 'spéßi%le%c0d@dspa ce'|url_encode }} +--DATA-- +return [] +--EXPECT-- +foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= +foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= +default +sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test new file mode 100644 index 0000000..38d7264 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test @@ -0,0 +1,16 @@ +--TEST-- +"url_encode" filter for PHP < 5.4 +--CONDITION-- +defined('PHP_QUERY_RFC3986') +--TEMPLATE-- +{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }} +{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }} +{{ {}|url_encode|default("default") }} +{{ 'spéßi%le%c0d@dspa ce'|url_encode }} +--DATA-- +return [] +--EXPECT-- +foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= +foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= +default +sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test new file mode 100644 index 0000000..2972bd4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test @@ -0,0 +1,18 @@ +--TEST-- +"attribute" function +--TEMPLATE-- +{{ attribute(obj, method) }} +{{ attribute(array, item) }} +{{ attribute(obj, "bar", ["a", "b"]) }} +{{ attribute(obj, "bar", arguments) }} +{{ attribute(obj, method) is defined ? 'ok' : 'ko' }} +{{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }} +--DATA-- +return ['obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => ['foo' => 'bar'], 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => ['a', 'b']] +--EXPECT-- +foo +bar +bar_a-b +bar_a-b +ok +ko diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test new file mode 100644 index 0000000..1a4fd54 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function +--TEMPLATE-- +{% extends 'base.twig' %} +{% block bar %}BAR{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}{{ block('bar') }}{% endblock %} +{% block bar %}BAR_BASE{% endblock %} +--DATA-- +return [] +--EXPECT-- +BARBAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test new file mode 100644 index 0000000..37cb7a4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test @@ -0,0 +1,22 @@ +--TEST-- +"block" function with a template argument +--TEMPLATE-- +{{ block('foo', 'included.twig') }} +{{ block('foo', included_loaded) }} +{{ block('foo', included_loaded_internal) }} +{% set output = block('foo', 'included.twig') %} +{{ output }} +{% block foo %}NOT FOO{% endblock %} +--TEMPLATE(included.twig)-- +{% block foo %}FOO{% endblock %} +--DATA-- +return [ + 'included_loaded' => $twig->load('included.twig'), + 'included_loaded_internal' => $twig->load('included.twig'), +] +--EXPECT-- +FOO +FOO +FOO +FOO +NOT FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test new file mode 100644 index 0000000..236df94 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function without arguments +--TEMPLATE-- +{% extends 'base.twig' %} +{% block bar %}BAR{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}{{ block() }}{% endblock %} +{% block bar %}BAR_BASE{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: The "block" function takes one argument (the block name) in "base.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test new file mode 100644 index 0000000..fd6dd06 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test @@ -0,0 +1,10 @@ +--TEST-- +"constant" function +--TEMPLATE-- +{{ constant('DATE_W3C') == expect ? 'true' : 'false' }} +{{ constant('ARRAY_AS_PROPS', object) }} +--DATA-- +return ['expect' => DATE_W3C, 'object' => new \ArrayObject(['hi'])] +--EXPECT-- +true +2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test new file mode 100644 index 0000000..0ac6dcc --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test @@ -0,0 +1,16 @@ +--TEST-- +"cycle" function +--TEMPLATE-- +{% for i in 0..6 %} +{{ cycle(array1, i) }}-{{ cycle(array2, i) }} +{% endfor %} +--DATA-- +return ['array1' => ['odd', 'even'], 'array2' => ['apple', 'orange', 'citrus']] +--EXPECT-- +odd-apple +even-orange +odd-citrus +even-apple +odd-orange +even-citrus +odd-apple diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test new file mode 100644 index 0000000..c879da3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test @@ -0,0 +1,27 @@ +--TEST-- +"date" function +--TEMPLATE-- +{{ date().format('r') == date('now').format('r') ? 'OK' : 'KO' }} +{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }} +{{ date() > date('-1day') ? 'OK' : 'KO' }} +--DATA-- +date_default_timezone_set('UTC'); +return [ + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new \DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + 'date4' => 1286199900, // \DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new \DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT + 'date5' => -189291360, // \DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new \DateTimeZone('UTC'))->getTimestamp(), +] +--EXPECT-- +OK +OK +OK +OK +OK +OK +OK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test new file mode 100644 index 0000000..11f60ee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test @@ -0,0 +1,11 @@ +--TEST-- +"date" function +--TEMPLATE-- +{{ date(date, "America/New_York")|date('d/m/Y H:i:s P', false) }} +{{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }} +--DATA-- +date_default_timezone_set('UTC'); +return ['date' => mktime(13, 45, 0, 10, 4, 2010)] +--EXPECT-- +04/10/2010 09:45:00 -04:00 +04/10/2010 09:45:00 -04:00 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test new file mode 100644 index 0000000..691a3ab --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test @@ -0,0 +1,16 @@ +--TEST-- +"dump" function +--CONDITION-- +!extension_loaded('xdebug') +--TEMPLATE-- +{{ dump('foo') }} +{{ dump('foo', 'bar') }} +--DATA-- +return ['foo' => 'foo', 'bar' => 'bar'] +--CONFIG-- +return ['debug' => true, 'autoescape' => false] +--EXPECT-- +string(3) "foo" + +string(3) "foo" +string(3) "bar" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test new file mode 100644 index 0000000..5fd9383 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test @@ -0,0 +1,19 @@ +--TEST-- +"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded +--CONDITION-- +!extension_loaded('xdebug') || (($r = new \ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) +--TEMPLATE-- +{{ dump() }} +--DATA-- +return ['foo' => 'foo', 'bar' => 'bar'] +--CONFIG-- +return ['debug' => true, 'autoescape' => false] +--EXPECT-- +array(3) { + ["foo"]=> + string(3) "foo" + ["bar"]=> + string(3) "bar" + ["global"]=> + string(6) "global" +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test new file mode 100644 index 0000000..c7b3539 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic function +--TEMPLATE-- +{{ foo_path('bar') }} +{{ a_foo_b_bar('bar') }} +--DATA-- +return [] +--EXPECT-- +foo/bar +a/b/bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test new file mode 100644 index 0000000..c9ce812 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test @@ -0,0 +1,13 @@ +--TEST-- +"include" function +--TEMPLATE-- +{% set tmp = include("foo.twig") %} + +FOO{{ tmp }}BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return [] +--EXPECT-- +FOO +FOOBARBAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test new file mode 100644 index 0000000..a366626 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function is safe for auto-escaping +--TEMPLATE-- +{{ include("foo.twig") }} +--TEMPLATE(foo.twig)-- +

    Test

    +--DATA-- +return [] +--EXPECT-- +

    Test

    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test new file mode 100644 index 0000000..f90983c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test @@ -0,0 +1,17 @@ +--TEST-- +"include" function +--TEMPLATE-- +FOO +{{ include("foo.twig") }} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return [] +--EXPECT-- +FOO + +FOOBAR + +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test new file mode 100644 index 0000000..c6d3d1c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test @@ -0,0 +1,17 @@ +--TEST-- +"include" function allows expressions for the template to include +--TEMPLATE-- +FOO +{{ include(foo) }} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return ['foo' => 'foo.twig'] +--EXPECT-- +FOO + +FOOBAR + +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test new file mode 100644 index 0000000..c05b43e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include(["foo.twig", "bar.twig"], ignore_missing = true) }} +{{ include("foo.twig", ignore_missing = true) }} +{{ include("foo.twig", ignore_missing = true, variables = {}) }} +{{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }} +--DATA-- +return [] +--EXPECT-- diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing_exists.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing_exists.test new file mode 100644 index 0000000..fc2d211 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing_exists.test @@ -0,0 +1,11 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include("included.twig", ignore_missing = true) }} +NOT DISPLAYED +--TEMPLATE(included.twig)-- +{{ include("DOES NOT EXIST") }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "DOES NOT EXIST" is not defined in "included.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/include_missing_extends.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/include_missing_extends.test new file mode 100644 index 0000000..810ae82 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/include_missing_extends.test @@ -0,0 +1,13 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include(['bad.twig', 'good.twig'], ignore_missing = true) }} +NOT DISPLAYED +--TEMPLATE(bad.twig)-- +{% extends 'DOES NOT EXIST' %} +--TEMPLATE(good.twig)-- +NOT DISPLAYED +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "DOES NOT EXIST" is not defined in "bad.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test new file mode 100644 index 0000000..1d50f7a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test @@ -0,0 +1,8 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include("foo.twig") }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test new file mode 100644 index 0000000..9ae8c9e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test @@ -0,0 +1,16 @@ +--TEST-- +"include" function +--TEMPLATE-- +{% extends "base.twig" %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %} + {{ include("foo.twig") }} +{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test new file mode 100644 index 0000000..ebfdb1e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("foo.twig", sandboxed = true) }} +--TEMPLATE(foo.twig)-- + + +{{ foo|e }} +{{ foo|e }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Sandbox\SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test new file mode 100644 index 0000000..1206b67 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("foo.twig", sandboxed = true) }} +{{ include("bar.twig") }} +--TEMPLATE(foo.twig)-- +foo +--TEMPLATE(bar.twig)-- +{{ foo|e }} +--DATA-- +return ['foo' => 'bar
    '] +--EXPECT-- +foo + + +bar<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test new file mode 100644 index 0000000..c5be008 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag sandboxed +--TEMPLATE-- +{{ include("unknown.twig", sandboxed = true, ignore_missing = true) }} +{{ include("bar.twig") }} +--TEMPLATE(bar.twig)-- +{{ foo|e }} +--DATA-- +return ['foo' => 'bar
    '] +--EXPECT-- + + +bar<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test new file mode 100644 index 0000000..4c8b450 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test @@ -0,0 +1,10 @@ +--TEST-- +"include" function accepts Twig_Template instance +--TEMPLATE-- +{{ include(foo) }} FOO +--TEMPLATE(foo.twig)-- +BAR +--DATA-- +return ['foo' => $twig->load('foo.twig')] +--EXPECT-- +BAR FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test new file mode 100644 index 0000000..21e5bb2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" function +--TEMPLATE-- +{{ include(["foo.twig", "bar.twig"]) }} +{{- include(["bar.twig", "foo.twig"]) }} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return [] +--EXPECT-- +foo +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test new file mode 100644 index 0000000..46ac8c7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test @@ -0,0 +1,16 @@ +--TEST-- +"include" function accept variables and with_context +--TEMPLATE-- +{{ include("foo.twig") }} +{{- include("foo.twig", with_context = false) }} +{{- include("foo.twig", {'foo1': 'bar'}) }} +{{- include("foo.twig", {'foo1': 'bar'}, with_context = false) }} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return ['foo' => 'bar'] +--EXPECT-- +foo,global,_parent, +global,_parent, +foo,global,foo1,_parent, +foo1,global,_parent, diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test new file mode 100644 index 0000000..0ed98fe --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test @@ -0,0 +1,12 @@ +--TEST-- +"include" function accept variables +--TEMPLATE-- +{{ include("foo.twig", {'foo': 'bar'}) }} +{{- include("foo.twig", vars) }} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return ['vars' => ['foo' => 'bar']] +--EXPECT-- +bar +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test new file mode 100644 index 0000000..8d9ba60 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test @@ -0,0 +1,11 @@ +--TEST-- +"template_from_string" function works in an "include" +--TEMPLATE-- +{% set embed = '{% embed "embed.twig" %}{% endembed %}' %} +{{ include(template_from_string(embed)) }} +--TEMPLATE(embed.twig)-- +Cool +--DATA-- +return [] +--EXPECT-- +Cool diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test new file mode 100644 index 0000000..4dd5e27 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test @@ -0,0 +1,8 @@ +--TEST-- +__call calls +--TEMPLATE-- +{{ 'foo'|magic_call }} +--DATA-- +return [] +--EXPECT-- +magic_foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test new file mode 100644 index 0000000..a7c65bf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test @@ -0,0 +1,12 @@ +--TEST-- +__staticCall calls +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ 'foo'|magic_call_string }} +{{ 'foo'|magic_call_array }} +--DATA-- +return [] +--EXPECT-- +static_magic_foo +static_magic_foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test new file mode 100644 index 0000000..6d2de00 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test @@ -0,0 +1,12 @@ +--TEST-- +"max" function +--TEMPLATE-- +{{ max([2, 1, 3, 5, 4]) }} +{{ max(2, 1, 3, 5, 4) }} +{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} +--DATA-- +return [] +--EXPECT-- +5 +5 +two diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test new file mode 100644 index 0000000..1fe5446 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test @@ -0,0 +1,12 @@ +--TEST-- +"min" function +--TEMPLATE-- +{{ min(2, 1, 3, 5, 4) }} +{{ min([2, 1, 3, 5, 4]) }} +{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} +--DATA-- +return [] +--EXPECT-- +1 +1 +five diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test new file mode 100644 index 0000000..2927333 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test @@ -0,0 +1,8 @@ +--TEST-- +"range" function +--TEMPLATE-- +{{ range(low=0+1, high=10+0, step=2)|join(',') }} +--DATA-- +return [] +--EXPECT-- +1,3,5,7,9 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test new file mode 100644 index 0000000..1c3fffb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test @@ -0,0 +1,21 @@ +--TEST-- +"block" function recursively called in a parent template +--TEMPLATE-- +{% extends "ordered_menu.twig" %} +{% block label %}"{{ parent() }}"{% endblock %} +{% block list %}{% set class = 'b' %}{{ parent() }}{% endblock %} +--TEMPLATE(ordered_menu.twig)-- +{% extends "menu.twig" %} +{% block list %}{% set class = class|default('a') %}
      {{ block('children') }}
    {% endblock %} +--TEMPLATE(menu.twig)-- +{% extends "base.twig" %} +{% block list %}
      {{ block('children') }}
    {% endblock %} +{% block children %}{% set currentItem = item %}{% for item in currentItem %}{{ block('item') }}{% endfor %}{% set item = currentItem %}{% endblock %} +{% block item %}
  • {% if item is not iterable %}{{ block('label') }}{% else %}{{ block('list') }}{% endif %}
  • {% endblock %} +{% block label %}{{ item }}{% endblock %} +--TEMPLATE(base.twig)-- +{{ block('list') }} +--DATA-- +return ['item' => ['1', '2', ['3.1', ['3.2.1', '3.2.2'], '3.4']]] +--EXPECT-- +
    1. "1"
    2. "2"
      1. "3.1"
        1. "3.2.1"
        2. "3.2.2"
      2. "3.4"
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test new file mode 100644 index 0000000..b691ce7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test @@ -0,0 +1,17 @@ +--TEST-- +"source" function +--TEMPLATE-- +FOO +{{ source("foo.twig") }} + +BAR +--TEMPLATE(foo.twig)-- +{{ foo }}
    +--DATA-- +return [] +--EXPECT-- +FOO + +{{ foo }}
    + +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test new file mode 100644 index 0000000..9c9e249 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom function +--TEMPLATE-- +{{ §('foo') }} +--DATA-- +return [] +--EXPECT-- +§foo§ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test new file mode 100644 index 0000000..dd13abb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test @@ -0,0 +1,10 @@ +--TEST-- +Functions as static method calls +--TEMPLATE-- +{{ static_call_string('foo') }} +{{ static_call_array('foo') }} +--DATA-- +return ['foo' => 'foo'] +--EXPECT-- +*foo* +*foo* diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test new file mode 100644 index 0000000..33b0e40 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test @@ -0,0 +1,15 @@ +--TEST-- +"template_from_string" function +--TEMPLATE-- +{% include template_from_string(template) %} + +{% include template_from_string("Hello {{ name }}") %} +{% include template_from_string('{% extends "parent.twig" %}{% block content %}Hello {{ name }}{% endblock %}') %} +--TEMPLATE(parent.twig)-- +{% block content %}{% endblock %} +--DATA-- +return ['name' => 'Fabien', 'template' => "Hello {{ name }}"] +--EXPECT-- +Hello Fabien +Hello Fabien +Hello Fabien diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string_error.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string_error.test new file mode 100644 index 0000000..900d238 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string_error.test @@ -0,0 +1,8 @@ +--TEST-- +"template_from_string" function +--TEMPLATE-- +{% include template_from_string("{{ not a Twig template ", "foo.twig") %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Unclosed "variable" in "foo.twig (string template 4900163d56b1af4b704c6b0afee7f98ba53418ce7a93d37a3af1882735baf9cd)" at line 1. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test new file mode 100644 index 0000000..18bba52 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test @@ -0,0 +1,16 @@ +--TEST-- +macro +--TEMPLATE-- +{% from _self import test %} + +{% macro test(a, b = 'bar') -%} +{{ a }}{{ b }} +{%- endmacro %} + +{{ test('foo') }} +{{ test('bar', 'foo') }} +--DATA-- +return [] +--EXPECT-- +foobar +barfoo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test new file mode 100644 index 0000000..4577286 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test @@ -0,0 +1,18 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as macros %} + +{% macro foo(data) %} + {{ data }} +{% endmacro %} + +{% macro bar() %} +
    +{% endmacro %} + +{{ macros.foo(macros.bar()) }} +--DATA-- +return [] +--EXPECT-- +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test new file mode 100644 index 0000000..05dd921 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test @@ -0,0 +1,14 @@ +--TEST-- +macro +--TEMPLATE-- +{% from _self import test %} + +{% macro test(this) -%} + {{ this }} +{%- endmacro %} + +{{ test(this) }} +--DATA-- +return ['this' => 'foo'] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test new file mode 100644 index 0000000..8fc6b47 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test @@ -0,0 +1,22 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as test %} +{% from _self import test %} + +{% macro test(a, b) -%} + {{ a|default('a') }}
    + {{- b|default('b') }}
    +{%- endmacro %} + +{{ test.test() }} +{{ test() }} +{{ test.test(1, "c") }} +{{ test(1, "c") }} +--DATA-- +return [] +--EXPECT-- +a
    b
    +a
    b
    +1
    c
    +1
    c
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test new file mode 100644 index 0000000..dd4b5c9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test @@ -0,0 +1,21 @@ +--TEST-- +macro with arbitrary arguments +--TEMPLATE-- +{% from _self import test1, test2 %} + +{% macro test1(var) %} + {{- var }}: {{ varargs|join(", ") }} +{% endmacro %} + +{% macro test2() %} + {{- varargs|join(", ") }} +{% endmacro %} + +{{ test1("foo", "bar", "foobar") }} +{{ test2("foo", "bar", "foobar") }} +--DATA-- +return [] +--EXPECT-- +foo: bar, foobar + +foo, bar, foobar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test new file mode 100644 index 0000000..1ad368b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test @@ -0,0 +1,7 @@ +--TEST-- +macro with varargs argument +--TEMPLATE-- +{% macro test(varargs) %} +{% endmacro %} +--EXCEPTION-- +Twig\Error\SyntaxError: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test new file mode 100644 index 0000000..96064ba --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -0,0 +1,14 @@ +--TEST-- +macro with a filter +--TEMPLATE-- +{% import _self as test %} + +{% macro test() %} + {% filter escape %}foo
    {% endfilter %} +{% endmacro %} + +{{ test.test() }} +--DATA-- +return [] +--EXPECT-- +foo<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test new file mode 100644 index 0000000..df07470 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test @@ -0,0 +1,19 @@ +--TEST-- +Block names are unique per template +--TEMPLATE-- +{% extends 'layout' %} +{% block content -%} + {% filter title -%} + second + {% endfilter %} +{% endblock %} +--TEMPLATE(layout)-- +{% filter title -%} + first +{% endfilter %} +{% block content %}{% endblock %} +--DATA-- +return [] +--EXPECT-- +First +Second diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test new file mode 100644 index 0000000..6426d2c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test @@ -0,0 +1,15 @@ +--TEST-- +Exception with bad line number +--TEMPLATE-- +{% block content %} + {{ foo }} + {{ include("foo") }} +{% endblock %} +index +--TEMPLATE(foo)-- +foo +{{ foo.bar }} +--DATA-- +return ['foo' => 'foo'] +--EXCEPTION-- +Twig\Error\RuntimeError: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test new file mode 100644 index 0000000..25bdc9e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test @@ -0,0 +1,8 @@ +--TEST-- +Twig outputs 0 nodes correctly +--TEMPLATE-- +{{ foo }}0{{ foo }} +--DATA-- +return ['foo' => 'foo'] +--EXPECT-- +foo0foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test new file mode 100644 index 0000000..e2ab950 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test @@ -0,0 +1,23 @@ +--TEST-- +error in twig extension +--TEMPLATE-- +{{ object.region is not null ? object.regionChoices[object.region] }} +--DATA-- +class House +{ + const REGION_S = 1; + const REGION_P = 2; + + public static $regionChoices = [self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p']; + + public function getRegionChoices() + { + return self::$regionChoices; + } +} + +$object = new House(); +$object->region = 1; +return ['object' => $object] +--EXPECT-- +house.region.s diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test new file mode 100644 index 0000000..96ca551 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test @@ -0,0 +1,10 @@ +--TEST-- +Twig allows multi-word tests without a custom node class +--TEMPLATE-- +{{ 'foo' is multi word ? 'yes' : 'no' }} +{{ 'foo bar' is multi word ? 'yes' : 'no' }} +--DATA-- +return [] +--EXPECT-- +no +yes diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test new file mode 100644 index 0000000..b6e62c8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test @@ -0,0 +1,19 @@ +--TEST-- +Twig is able to deal with SimpleXMLElement instances as variables +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +Hello '{{ images.image.0.group }}'! +{{ images.image.0.group.attributes.myattr }} +{{ images.children().image.count() }} +{% for image in images %} + - {{ image.group }} +{% endfor %} +--DATA-- +return ['images' => new \SimpleXMLElement('foobar')] +--EXPECT-- +Hello 'foo'! +example +2 + - foo + - bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test new file mode 100644 index 0000000..62fe884 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not confuse strings with integers in getAttribute() +--TEMPLATE-- +{{ hash['2e2'] }} +--DATA-- +return ['hash' => ['2e2' => 'works']] +--EXPECT-- +works diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test new file mode 100644 index 0000000..4848ee0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"apply" tag applies a filter on its children +--TEMPLATE-- +{% apply upper %} +Some text with a {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test new file mode 100644 index 0000000..8a590b4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"apply" tag applies a filter on its children +--TEMPLATE-- +{% apply json_encode|raw %}test{% endapply %} +--DATA-- +return [] +--EXPECT-- +"test" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test new file mode 100644 index 0000000..e16998a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"apply" tags accept multiple chained filters +--TEMPLATE-- +{% apply lower|title %} + {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'VAR'] +--EXPECT-- + Var diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test new file mode 100644 index 0000000..b64a691 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"apply" tags can be nested at will +--TEMPLATE-- +{% apply lower|title %} + {{ var }} + {% apply upper %} + {{ var }} + {% endapply %} + {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- + Var + Var + Var diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test new file mode 100644 index 0000000..a87ff91 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test @@ -0,0 +1,15 @@ +--TEST-- +"apply" tag does not create a new scope +--TEMPLATE-- +{% set foo = 'baz' %} +{% apply spaceless %} + {% set foo = 'foo' %} + {% set bar = 'bar' %} +{% endapply %} +{{ 'foo' == foo ? 'OK ' ~ foo : 'KO' }} +{{ 'bar' == bar ? 'OK ' ~ bar : 'KO' }} +--DATA-- +return [] +--EXPECT-- +OK foo +OK bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test new file mode 100644 index 0000000..4453880 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"apply" tag applies the filter on "for" tags +--TEMPLATE-- +{% apply upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endapply %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A +B diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test new file mode 100644 index 0000000..ca7a592 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"apply" tag applies the filter on "if" tags +--TEMPLATE-- +{% apply upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endapply %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A, B + +B + +A diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test new file mode 100644 index 0000000..5979725 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping on its children +--TEMPLATE-- +{% autoescape %} +{{ var }}
    +{% endautoescape %} +{% autoescape 'html' %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +{% autoescape true %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +--DATA-- +return ['var' => '
    '] +--EXPECT-- +<br />
    +<br />
    +

    +<br />
    +

    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test new file mode 100644 index 0000000..292e1b4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test @@ -0,0 +1,12 @@ +--TEST-- +"autoescape" tag applies escaping on embedded blocks +--TEMPLATE-- +{% autoescape 'html' %} + {% block foo %} + {{ var }} + {% endblock %} +{% endautoescape %} +--DATA-- +return ['var' => '
    '] +--EXPECT-- +<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test new file mode 100644 index 0000000..1724b48 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not double-escape +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|escape }} +{% endautoescape %} +--DATA-- +return ['var' => '
    '] +--EXPECT-- +<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test new file mode 100644 index 0000000..170e707 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test @@ -0,0 +1,83 @@ +--TEST-- +"autoescape" tag applies escaping after calling functions +--TEMPLATE-- + +autoescape false +{% autoescape false %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +{% endautoescape %} + +autoescape 'html' +{% autoescape 'html' %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +unsafe_br()|raw +{{ (unsafe_br())|raw }} + +safe_br()|escape +{{ (safe_br())|escape }} + +safe_br()|raw +{{ (safe_br())|raw }} + +unsafe_br()|escape +{{ (unsafe_br())|escape }} + +{% endautoescape %} + +autoescape js +{% autoescape 'js' %} + +safe_br +{{ safe_br() }} + +{% endautoescape %} +--DATA-- +return [] +--EXPECT-- + +autoescape false + +safe_br +
    + +unsafe_br +
    + + +autoescape 'html' + +safe_br +
    + +unsafe_br +<br /> + +unsafe_br()|raw +
    + +safe_br()|escape +<br /> + +safe_br()|raw +
    + +unsafe_br()|escape +<br /> + + +autoescape js + +safe_br +\u003Cbr\u0020\/\u003E diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test new file mode 100644 index 0000000..3d8d4f8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test @@ -0,0 +1,87 @@ +--TEST-- +"autoescape" tag does not apply escaping on literals +--TEMPLATE-- +{% autoescape 'html' %} + +1. Simple literal +{{ "
    " }} + +2. Conditional expression with only literals +{{ true ? "
    " : "
    " }} + +3. Conditional expression with a variable +{{ true ? "
    " : someVar }} +{{ false ? "
    " : someVar }} +{{ true ? someVar : "
    " }} +{{ false ? someVar : "
    " }} + +4. Nested conditionals with only literals +{{ true ? (true ? "
    " : "
    ") : "\n" }} + +5. Nested conditionals with a variable +{{ true ? (true ? "
    " : someVar) : "\n" }} +{{ true ? (false ? "
    " : someVar) : "\n" }} +{{ true ? (true ? someVar : "
    ") : "\n" }} +{{ true ? (false ? someVar : "
    ") : "\n" }} +{{ false ? "\n" : (true ? someVar : "
    ") }} +{{ false ? "\n" : (false ? someVar : "
    ") }} + +6. Nested conditionals with a variable marked safe +{{ true ? (true ? "
    " : someVar|raw) : "\n" }} +{{ true ? (false ? "
    " : someVar|raw) : "\n" }} +{{ true ? (true ? someVar|raw : "
    ") : "\n" }} +{{ true ? (false ? someVar|raw : "
    ") : "\n" }} +{{ false ? "\n" : (true ? someVar|raw : "
    ") }} +{{ false ? "\n" : (false ? someVar|raw : "
    ") }} + +7. Without then clause +{{ "
    " ?: someVar }} +{{ someFalseVar ?: "
    " }} + +8. NullCoalesce +{{ aaaa ?? "
    " }} +{{ "
    " ?? someVar }} + +{% endautoescape %} +--DATA-- +return ['someVar' => '
    ', 'someFalseVar' => false] +--EXPECT-- + +1. Simple literal +
    + +2. Conditional expression with only literals +
    + +3. Conditional expression with a variable +
    +<br /> +<br /> +
    + +4. Nested conditionals with only literals +
    + +5. Nested conditionals with a variable +
    +<br /> +<br /> +
    +<br /> +
    + +6. Nested conditionals with a variable marked safe +
    +
    +
    +
    +
    +
    + +7. Without then clause +
    +
    + +8. NullCoalesce +
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test new file mode 100644 index 0000000..0d88c7e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tags can be nested at will +--TEMPLATE-- +{{ var }} +{% autoescape 'html' %} + {{ var }} + {% autoescape false %} + {{ var }} + {% autoescape 'html' %} + {{ var }} + {% endautoescape %} + {{ var }} + {% endautoescape %} + {{ var }} +{% endautoescape %} +{{ var }} +--DATA-- +return ['var' => '
    '] +--EXPECT-- +<br /> + <br /> +
    + <br /> +
    + <br /> +<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test new file mode 100644 index 0000000..9d959b2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping to object method calls +--TEMPLATE-- +{% autoescape 'html' %} +{{ user.name }} +{{ user.name|lower }} +{{ user }} +{% endautoescape %} +--DATA-- +class UserForAutoEscapeTest +{ + public function getName() + { + return 'Fabien
    '; + } + + public function __toString() + { + return 'Fabien
    '; + } +} +return ['user' => new UserForAutoEscapeTest()] +--EXPECT-- +Fabien<br /> +fabien<br /> +Fabien<br /> diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test new file mode 100644 index 0000000..187327c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not escape when raw is used as a filter +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|raw }} +{% endautoescape %} +--DATA-- +return ['var' => '
    '] +--EXPECT-- +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test new file mode 100644 index 0000000..289f2b1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test @@ -0,0 +1,11 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape true js %}{{ var }}{% endautoescape %} + +{% autoescape true html %}{{ var }}{% endautoescape %} +--DATA-- +return ['var' => '
    "'] +--EXPECT-- +\u003Cbr\u0020\/\u003E\u0022 +<br />" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test new file mode 100644 index 0000000..9a0137e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test @@ -0,0 +1,11 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape 'js' %}{{ var }}{% endautoescape %} + +{% autoescape 'html' %}{{ var }}{% endautoescape %} +--DATA-- +return ['var' => '
    "'] +--EXPECT-- +\u003Cbr\u0020\/\u003E\u0022 +<br />" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test new file mode 100644 index 0000000..9ae8d7b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test @@ -0,0 +1,69 @@ +--TEST-- +escape types +--TEMPLATE-- + +1. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +2. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +3. autoescape 'js' |escape('js') + +{% autoescape 'js' %} + +{% endautoescape %} + +4. no escape + +{% autoescape false %} + +{% endautoescape %} + +5. |escape('js')|escape('html') + +{% autoescape false %} + +{% endautoescape %} + +6. autoescape 'html' |escape('js')|escape('html') + +{% autoescape 'html' %} + +{% endautoescape %} + +--DATA-- +return ['msg' => "<>\n'\""] +--EXPECT-- + +1. autoescape 'html' |escape('js') + + + +2. autoescape 'html' |escape('js') + + + +3. autoescape 'js' |escape('js') + + + +4. no escape + + + +5. |escape('js')|escape('html') + + + +6. autoescape 'html' |escape('js')|escape('html') + + + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test new file mode 100644 index 0000000..f97105b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test @@ -0,0 +1,131 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters +--TEMPLATE-- +{% autoescape 'html' %} + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +{{ var|escape_and_nl2br }} + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +{{ var|escape_and_nl2br|raw }} + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +{{ var|escape_and_nl2br|escape }} + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +{{ var|upper }} + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +{{ var|escape_and_nl2br|upper }} + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +{{ var|upper|escape_and_nl2br }} + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +{{ "%s"|format(var) }} + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +{{ "%s"|raw|format(var) }} + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) +{{ "%s"|format(var)|raw }} + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) +{{ "%s"|format(var|raw)|raw }} + +{% endautoescape %} +--DATA-- +return ['var' => "\nTwig"] +--EXPECT-- + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +<Fabien>
    +Twig + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +<Fabien>
    +Twig + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +&lt;Fabien&gt;<br /> +Twig + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +<FABIEN> +TWIG + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +&LT;FABIEN&GT;<BR /> +TWIG + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +<FABIEN>
    +TWIG + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) + +Twig + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) + +Twig diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test new file mode 100644 index 0000000..50f72d8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test @@ -0,0 +1,23 @@ +--TEST-- +"autoescape" tag do not applies escaping on filter arguments +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|nl2br("
    ") }} +{{ var|nl2br("
    "|escape) }} +{{ var|nl2br(sep) }} +{{ var|nl2br(sep|raw) }} +{{ var|nl2br(sep|escape) }} +{% endautoescape %} +--DATA-- +return ['var' => "\nTwig", 'sep' => '
    '] +--EXPECT-- +<Fabien>
    +Twig +<Fabien><br /> +Twig +<Fabien>
    +Twig +<Fabien>
    +Twig +<Fabien><br /> +Twig diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test new file mode 100644 index 0000000..c9c7380 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test @@ -0,0 +1,68 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters +--TEMPLATE-- +{% autoescape 'html' %} + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +{{ var|nl2br }} + +2. Don't double-pre-escape +( var|escape|nl2br ) +{{ var|escape|nl2br }} + +3. Don't escape safe values +( var|raw|nl2br ) +{{ var|raw|nl2br }} + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +{{ var|nl2br|nl2br }} + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +{{ var|escape_something|nl2br }} + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +{{ var|nl2br|upper }} + +{% endautoescape %} +--DATA-- +return ['var' => "\nTwig"] +--EXPECT-- + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +2. Don't double-pre-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +3. Don't escape safe values +( var|raw|nl2br ) +
    +Twig + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +<Fabien>

    +Twig + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +<FABIEN>
    +TWIG + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +&LT;FABIEN&GT;<BR /> +TWIG + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test new file mode 100644 index 0000000..c764d43 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test @@ -0,0 +1,50 @@ +--TEST-- +"autoescape" tag handles filters preserving the safety +--TEMPLATE-- +{% autoescape 'html' %} + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +{{ var|preserves_safety }} + +2. Safe values are still safe +( var|escape|preserves_safety ) +{{ var|escape|preserves_safety }} + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +{{ var|escape_something|preserves_safety }} + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} + +{% endautoescape %} +--DATA-- +return ['var' => "\nTwig"] +--EXPECT-- + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +<FABIEN> +TWIG + +2. Safe values are still safe +( var|escape|preserves_safety ) +<FABIEN> +TWIG + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +<FABIEN> +TWIG + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +&LT;FABPOT&GT; +TWIG + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test new file mode 100644 index 0000000..988b09c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block title1 %}FOO{% endblock %} +{% block title2 foo|lower %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return ['foo' => 'bar'] +--EXPECT-- +FOObar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test new file mode 100644 index 0000000..3009f8b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + {% block content %} + {% endblock %} +{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: The block 'content' has already been defined line 2 in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test new file mode 100644 index 0000000..e8e240e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test @@ -0,0 +1,10 @@ +--TEST-- +"§" special chars in a block name +--TEMPLATE-- +{% block § %} +§ +{% endblock § %} +--DATA-- +return [] +--EXPECT-- +§ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test new file mode 100644 index 0000000..53729dd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test @@ -0,0 +1,20 @@ +--TEST-- +Deprecating a block with "deprecated" tag +--TEMPLATE-- +{% use 'greeting.twig' %} + +{{ block('welcome') }} + +--TEMPLATE(greeting.twig)-- +{% block welcome %} + {% deprecated 'The "welcome" block is deprecated, use "hello" instead.' %} + {{ block('hello') }} +{% endblock %} + +{% block hello %} +Hello Fabien +{% endblock %} +--DATA-- +return [] +--EXPECT-- + Hello Fabien diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test new file mode 100644 index 0000000..5cc48dd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test @@ -0,0 +1,21 @@ +--TEST-- +Deprecating a macro with "deprecated" tag +--TEMPLATE-- +{% import 'greeting.twig' as greeting %} + +{{ greeting.welcome('Fabien') }} + +--TEMPLATE(greeting.twig)-- +{% macro welcome(name) %} + {% deprecated 'The "welcome" macro is deprecated, use "hello" instead.' %} + {% import _self as self %} + {{ self.hello(name) }} +{% endmacro %} + +{% macro hello(name) %} +Hello {{ name }} +{% endmacro %} +--DATA-- +return [] +--EXPECT-- + Hello Fabien diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test new file mode 100644 index 0000000..7f786d5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test @@ -0,0 +1,12 @@ +--TEST-- +Deprecating a template with "deprecated" tag +--TEMPLATE-- +{% extends 'greeting.twig' %} + +{% deprecated 'The "index.twig" template is deprecated, use "greeting.twig" instead.' %} +--TEMPLATE(greeting.twig)-- +Hello Fabien +--DATA-- +return [] +--EXPECT-- +Hello Fabien diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test new file mode 100644 index 0000000..16781e4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return [] +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test new file mode 100644 index 0000000..b799a8c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed foo ~ ".twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return ['foo' => 'foo'] +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test new file mode 100644 index 0000000..6f0879e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed foo %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return ['foo' => 'foo.twig'] +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test new file mode 100644 index 0000000..b1c6c85 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test @@ -0,0 +1,16 @@ +--TEST-- +"embed" tag +--TEMPLATE(index.twig)-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ nothing }} + {% endblock %} +{% endembed %} +BAR +--TEMPLATE(foo.twig)-- +{% block c1 %}{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "nothing" does not exist in "index.twig" at line 5. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test new file mode 100644 index 0000000..9f7b52f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test @@ -0,0 +1,50 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return [] +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test new file mode 100644 index 0000000..9f33723 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test @@ -0,0 +1,42 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} + + {% endblock %} +{% endembed %} +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return [] +--EXPECT-- +A + block1 + + +A + block1 + + block1extended + B + block2 +C + B + block2 +C diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test new file mode 100644 index 0000000..ce726ac --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test @@ -0,0 +1,60 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block c1 %} + {{ parent() }} + blockc1baseextended +{% endblock %} + +{% block c2 %} + {{ parent() }} + + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +A +{% block c1 %} + blockc1base +{% endblock %} +{% block c2 %} + blockc2base +{% endblock %} +B +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return [] +--EXPECT-- +A + blockc1base + + blockc1baseextended + blockc2base + + + +A + block1 + + block1extended + B + block2 +C blockc2base + +B \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test new file mode 100644 index 0000000..866171e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter upper %} +Some text with a {{ var }} +{% endfilter %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test new file mode 100644 index 0000000..a2562b9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter json_encode|raw %}test{% endfilter %} +--DATA-- +return [] +--EXPECT-- +"test" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test new file mode 100644 index 0000000..8eb3cbd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tags accept multiple chained filters +--TEMPLATE-- +{% filter lower|title %} + {{ var }} +{% endfilter %} +--DATA-- +return ['var' => 'VAR'] +--EXPECT-- + Var diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test new file mode 100644 index 0000000..6d18e1a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"filter" tags can be nested at will +--TEMPLATE-- +{% filter lower|title %} + {{ var }} + {% filter upper %} + {{ var }} + {% endfilter %} + {{ var }} +{% endfilter %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- + Var + Var + Var diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test new file mode 100644 index 0000000..889a46f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test @@ -0,0 +1,11 @@ +--TEST-- +"scope" tag creates a new scope +--TEMPLATE-- +{% filter spaceless %} +{% set item = 'foo' %} +{% endfilter %} +{{ item }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "item" does not exist in "index.twig" at line 5. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test new file mode 100644 index 0000000..d2d87cf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"filter" tag applies the filter on "for" tags +--TEMPLATE-- +{% filter upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endfilter %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A +B diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test new file mode 100644 index 0000000..f2e804b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"filter" tag applies the filter on "if" tags +--TEMPLATE-- +{% filter upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endfilter %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A, B + +B + +A diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test new file mode 100644 index 0000000..b1ad22f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test @@ -0,0 +1,14 @@ +--TEST-- +"for" tag takes a condition +--TEMPLATE-- +{% for i in 1..5 if i is odd -%} + {{ loop.index }}.{{ i }}{{ foo.bar }} +{% endfor %} +--DATA-- +return ['foo' => ['bar' => 'X']] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- +1.1X +2.3X +3.5X diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test new file mode 100644 index 0000000..3cdd575 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tag keeps the context safe +--TEMPLATE-- +{% for item in items %} + {% for item in items %} + * {{ item }} + {% endfor %} + * {{ item }} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * a + * b + * a + * a + * b + * b diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test new file mode 100644 index 0000000..86ec9c2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test @@ -0,0 +1,23 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% else %} + no item +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * a + * b +--DATA-- +return ['items' => []] +--EXPECT-- + no item +--DATA-- +return [] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- + no item diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test new file mode 100644 index 0000000..e1ad3c7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag does not reset inner variables +--TEMPLATE-- +{% for i in 1..2 %} + {% for j in 0..2 %} + {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} + {% endfor %} +{% endfor %} +--DATA-- +return ['k' => 0] +--EXPECT-- + 0 1 + 1 1 + 2 1 + 3 2 + 4 2 + 5 2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test new file mode 100644 index 0000000..9213557 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys +--TEMPLATE-- +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * 0 + * 1 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test new file mode 100644 index 0000000..ab39ddf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys and values +--TEMPLATE-- +{% for key, item in items %} + * {{ key }}/{{ item }} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * 0/a + * 1/b diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test new file mode 100644 index 0000000..56a60c2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test @@ -0,0 +1,19 @@ +--TEST-- +"for" tag adds a loop variable to the context +--TEMPLATE-- +{% for item in items %} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * 1/0 + * 2/1 + * 1//2 + + * 2/1 + * 1/0 + * /1/2 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test new file mode 100644 index 0000000..58e5a9b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag adds a loop variable to the context locally +--TEMPLATE-- +{% for item in items %} +{% endfor %} +{% if loop is not defined %}WORKS{% endif %} +--DATA-- +return ['items' => []] +--EXPECT-- +WORKS diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test new file mode 100644 index 0000000..2d8c0b8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag +--TEMPLATE-- +{% for i, item in items if i > 0 %} + {{ loop.last }} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXCEPTION-- +Twig\Error\SyntaxError: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test new file mode 100644 index 0000000..e90e96b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test @@ -0,0 +1,9 @@ +--TEST-- +"for" tag +--TEMPLATE-- +{% for i, item in items if loop.last > 0 %} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXCEPTION-- +Twig\Error\SyntaxError: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test new file mode 100644 index 0000000..df1bb07 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + {% for item in items1 %} + * {{ item }} + {% else %} + no {{ item }} + {% endfor %} +{% else %} + no item1 +{% endfor %} +--DATA-- +return ['items' => ['a', 'b'], 'items1' => []] +--EXPECT-- +no a + no b diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test new file mode 100644 index 0000000..2ba2d92 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test @@ -0,0 +1,43 @@ +--TEST-- +"for" tag iterates over iterable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.first }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIterator implements Iterator +{ + protected $values = ['foo' => 'bar', 'bar' => 'foo']; + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } +} +return ['items' => new ItemsIterator()] +--EXPECT-- + * bar + * 1/0 + * 1 + + * foo + * 2/1 + * + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test new file mode 100644 index 0000000..99146bd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test @@ -0,0 +1,47 @@ +--TEST-- +"for" tag iterates over iterable and countable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIteratorCountable implements Iterator, \Countable +{ + protected $values = ['foo' => 'bar', 'bar' => 'foo']; + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } + public function count() { return count($this->values); } +} +return ['items' => new ItemsIteratorCountable()] +--EXPECT-- + * bar + * 1/0 + * 2/1 + * 1//2 + + * foo + * 2/1 + * 1/0 + * /1/2 + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test new file mode 100644 index 0000000..3b677d6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tags can be nested +--TEMPLATE-- +{% for key, item in items %} +* {{ key }} ({{ loop.length }}): +{% for value in item %} + * {{ value }} ({{ loop.length }}) +{% endfor %} +{% endfor %} +--DATA-- +return ['items' => ['a' => ['a1', 'a2', 'a3'], 'b' => ['b1']]] +--EXPECT-- +* a (2): + * a1 (3) + * a2 (3) + * a3 (3) +* b (2): + * b1 (1) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test new file mode 100644 index 0000000..384c41b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag iterates over item values +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% endfor %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- + * a + * b diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test new file mode 100644 index 0000000..1d3c9e2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test @@ -0,0 +1,14 @@ +--TEST-- +global variables +--TEMPLATE-- +{% include "included.twig" %} +{% from "included.twig" import foobar %} +{{ foobar() }} +--TEMPLATE(included.twig)-- +{% macro foobar() %} +called foobar +{% endmacro %} +--DATA-- +return [] +--EXPECT-- +called foobar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test new file mode 100644 index 0000000..a02165e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test @@ -0,0 +1,22 @@ +--TEST-- +"if" creates a condition +--TEMPLATE-- +{% if a is defined %} + {{ a }} +{% elseif b is defined %} + {{ b }} +{% else %} + NOTHING +{% endif %} +--DATA-- +return ['a' => 'a'] +--EXPECT-- + a +--DATA-- +return ['b' => 'b'] +--EXPECT-- + b +--DATA-- +return [] +--EXPECT-- + NOTHING diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test new file mode 100644 index 0000000..eb65083 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test @@ -0,0 +1,22 @@ +--TEST-- +"if" takes an expression as a test +--TEMPLATE-- +{% if a < 2 %} + A1 +{% elseif a > 10 %} + A2 +{% else %} + A3 +{% endif %} +--DATA-- +return ['a' => 1] +--EXPECT-- + A1 +--DATA-- +return ['a' => 12] +--EXPECT-- + A2 +--DATA-- +return ['a' => 7] +--EXPECT-- + A3 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test new file mode 100644 index 0000000..9982b03 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +FOO +{% include "foo.twig" %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return [] +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test new file mode 100644 index 0000000..23db181 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag allows expressions for the template to include +--TEMPLATE-- +FOO +{% include foo %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return ['foo' => 'foo.twig'] +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test new file mode 100644 index 0000000..6c8bdb1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] ignore missing %} +{% include "foo.twig" ignore missing %} +{% include "foo.twig" ignore missing with {} %} +{% include "foo.twig" ignore missing with {} only %} +--DATA-- +return [] +--EXPECT-- diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing_exists.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing_exists.test new file mode 100644 index 0000000..1af0122 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing_exists.test @@ -0,0 +1,11 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include "included.twig" ignore missing %} +NOT DISPLAYED +--TEMPLATE(included.twig)-- +{% include "DOES NOT EXIST" %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "DOES NOT EXIST" is not defined in "included.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/include_missing_extends.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/include_missing_extends.test new file mode 100644 index 0000000..d0d1bfe --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/include_missing_extends.test @@ -0,0 +1,13 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ['bad.twig', 'good.twig'] ignore missing %} +NOT DISPLAYED +--TEMPLATE(bad.twig)-- +{% extends 'DOES NOT EXIST' %} +--TEMPLATE(good.twig)-- +NOT DISPLAYED +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "DOES NOT EXIST" is not defined in "bad.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test new file mode 100644 index 0000000..ac72838 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test @@ -0,0 +1,8 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include "foo.twig" %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test new file mode 100644 index 0000000..0ee51b7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %} + {% include "foo.twig" %} +{% endblock %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\LoaderError: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test new file mode 100644 index 0000000..8da402f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test @@ -0,0 +1,20 @@ +--TEST-- +"include" tag accept variables and only +--TEMPLATE-- +{% include "foo.twig" %} +{% include "foo.twig" only %} +{% include "foo.twig" with vars1 %} +{% include "foo.twig" with vars1 only %} +{% include "foo.twig" with vars2 %} +{% include "foo.twig" with vars2 only %} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return ['vars1' => ['foo1' => 'bar'], 'vars2' => new ArrayObject(['foo2' => 'bar'])] +--EXPECT-- +vars1,vars2,global,_parent, +global,_parent, +vars1,vars2,global,foo1,_parent, +foo1,global,_parent, +vars1,vars2,global,foo2,_parent, +foo2,global,_parent, diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test new file mode 100644 index 0000000..4fb862a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag accepts \Twig\TemplateWrapper instance +--TEMPLATE-- +{% include foo %} FOO +--TEMPLATE(foo.twig)-- +BAR +--DATA-- +return ['foo' => $twig->load('foo.twig')] +--EXPECT-- +BAR FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test new file mode 100644 index 0000000..3806395 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] %} +{% include ["bar.twig", "foo.twig"] %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return [] +--EXPECT-- +foo +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test new file mode 100644 index 0000000..45a0519 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test @@ -0,0 +1,14 @@ +--TEST-- +"include" tag accept variables +--TEMPLATE-- +{% include "foo.twig" with {'foo': 'bar'} %} +{% include "foo.twig" with vars1 %} +{% include "foo.twig" with vars2 %} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return ['vars1' => ['foo' => 'bar'], 'vars2' => new ArrayObject(['foo' => 'bar'])] +--EXPECT-- +bar +bar +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test new file mode 100644 index 0000000..703b61b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return [] +--EXPECT-- +FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test new file mode 100644 index 0000000..0b82d4c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test @@ -0,0 +1,30 @@ +--TEST-- +block_expr +--TEMPLATE-- +{% extends "base.twig" %} + +{% block element -%} + Element: + {{- parent() -}} +{% endblock %} +--TEMPLATE(base.twig)-- +{% block element -%} +
    + {%- if item.children is defined %} + {%- for item in item.children %} + {{- block('element') -}} + {% endfor %} + {%- endif -%} +
    +{%- endblock %} +--DATA-- +return [ + 'item' => [ + 'children' => [ + null, + null, + ] + ] +] +--EXPECT-- +Element:
    Element:
    Element:
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test new file mode 100644 index 0000000..18f6604 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test @@ -0,0 +1,32 @@ +--TEST-- +block_expr2 +--TEMPLATE-- +{% extends "base2.twig" %} + +{% block element -%} + Element: + {{- parent() -}} +{% endblock %} +--TEMPLATE(base2.twig)-- +{% extends "base.twig" %} +--TEMPLATE(base.twig)-- +{% block element -%} +
    + {%- if item.children is defined %} + {%- for item in item.children %} + {{- block('element') -}} + {% endfor %} + {%- endif -%} +
    +{%- endblock %} +--DATA-- +return [ + 'item' => [ + 'children' => [ + null, + null, + ] + ] +] +--EXPECT-- +Element:
    Element:
    Element:
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test new file mode 100644 index 0000000..bd28248 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends standalone ? foo : 'bar.twig' %} + +{% block content %}{{ parent() }}FOO{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--TEMPLATE(bar.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return ['foo' => 'foo.twig', 'standalone' => true] +--EXPECT-- +FOOFOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test new file mode 100644 index 0000000..e6a0f01 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return ['foo' => 'foo.twig'] +--EXPECT-- +FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test new file mode 100644 index 0000000..ca11bf2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test @@ -0,0 +1,10 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--DATA-- +return [] +--EXPECT-- +FOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test new file mode 100644 index 0000000..4d2cb6c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["foo.twig", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test new file mode 100644 index 0000000..5108651 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test new file mode 100644 index 0000000..c5ee6f1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends [null, "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test new file mode 100644 index 0000000..fc25bad --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}base {% endblock %} +--DATA-- +return [] +--EXPECT-- +base layout index diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test new file mode 100644 index 0000000..fa88717 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test @@ -0,0 +1,22 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% set foo = 1 %} +{{ include('parent.twig') }} +{{ include('parent.twig') }} +{% set foo = 2 %} +{{ include('parent.twig') }} +--TEMPLATE(parent.twig)-- +{% extends foo~'_parent.twig' %}{% block content %}{{ parent() }} parent{% endblock %} +--TEMPLATE(1_parent.twig)-- +{% block content %}1{% endblock %} +--TEMPLATE(2_parent.twig)-- +{% block content %}2{% endblock %} +--DATA-- +return [] +--EXPECT-- +1 parent + +1 parent + +2 parent diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test new file mode 100644 index 0000000..abea2e9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test @@ -0,0 +1,22 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block subcontent %} + {% block subsubcontent %} + SUBSUBCONTENT + {% endblock %} + {% endblock %} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + {% block subcontent %} + SUBCONTENT + {% endblock %} +{% endblock %} +--DATA-- +return [] +--EXPECT-- +SUBSUBCONTENT diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test new file mode 100644 index 0000000..20b7848 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test @@ -0,0 +1,15 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + CONTENT + {%- block subcontent -%} + SUBCONTENT + {%- endblock -%} + ENDCONTENT +{% endblock %} +--TEMPLATE(foo.twig)-- +--DATA-- +return [] +--EXPECT-- +CONTENTSUBCONTENTENDCONTENT diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test new file mode 100644 index 0000000..0b585b4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %} +{% block inside %}INSIDE{% endblock inside %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %} +{% block body %} + {% block inside '' %} +{% endblock body %} +--TEMPLATE(base.twig)-- +{% block body '' %} +--DATA-- +return [] +--EXPECT-- +INSIDE diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test new file mode 100644 index 0000000..73f4c0e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return [] +--EXPECT-- +BARFOOBAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test new file mode 100644 index 0000000..1aaed55 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag with a parent as a Twig_TemplateWrapper instance +--TEMPLATE-- +{% extends foo %} + +{% block content %}New{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}Default{% endblock %} +--DATA-- +return ['foo' => $twig->load('foo.twig')] +--EXPECT-- +New diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test new file mode 100644 index 0000000..01bd544 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo ? 'foo.twig' : 'bar.twig' %} +--TEMPLATE(foo.twig)-- +FOO +--TEMPLATE(bar.twig)-- +BAR +--DATA-- +return ['foo' => true] +--EXPECT-- +FOO +--DATA-- +return ['foo' => false] +--EXPECT-- +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test new file mode 100644 index 0000000..1d1987d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test @@ -0,0 +1,8 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% block content %} + {% extends "foo.twig" %} +{% endblock %} +--EXCEPTION-- +Twig\Error\SyntaxError: Cannot extend from a block in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test new file mode 100644 index 0000000..58a37bd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test @@ -0,0 +1,20 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "base.twig" %} +{% block content %}{% include "included.twig" %}{% endblock %} + +{% block footer %}Footer{% endblock %} +--TEMPLATE(included.twig)-- +{% extends "base.twig" %} +{% block content %}Included Content{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}Default Content{% endblock %} + +{% block footer %}Default Footer{% endblock %} +--DATA-- +return [] +--EXPECT-- +Included Content +Default Footer +Footer diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test new file mode 100644 index 0000000..d4347ba --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test @@ -0,0 +1,28 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block inside %} + INSIDE OVERRIDDEN + {% endblock %} + + BEFORE + {{ parent() }} + AFTER +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + BAR +{% endblock %} +--DATA-- +return [] +--EXPECT-- + +INSIDE OVERRIDDEN + + BEFORE + BAR + + AFTER diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test new file mode 100644 index 0000000..6d98891 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test @@ -0,0 +1,8 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% block content %} + {{ parent() }} +{% endblock %} +--EXCEPTION-- +Twig\Error\SyntaxError: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test new file mode 100644 index 0000000..39882b8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test @@ -0,0 +1,14 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% use 'foo.twig' %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return [] +--EXPECT-- +BAR diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test new file mode 100644 index 0000000..a5a2238 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag accepts Twig_Template instance +--TEMPLATE-- +{% extends foo %} + +{% block content %} +{{ parent() }}FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return ['foo' => $twig->load('foo.twig')] +--EXPECT-- +BARFOO diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test new file mode 100644 index 0000000..4df32ee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test @@ -0,0 +1,44 @@ +--TEST-- +"parent" function +--TEMPLATE-- +{% extends "parent.twig" %} + +{% use "use1.twig" %} +{% use "use2.twig" %} + +{% block content_parent %} + {{ parent() }} +{% endblock %} + +{% block content_use1 %} + {{ parent() }} +{% endblock %} + +{% block content_use2 %} + {{ parent() }} +{% endblock %} + +{% block content %} + {{ block('content_use1_only') }} + {{ block('content_use2_only') }} +{% endblock %} +--TEMPLATE(parent.twig)-- +{% block content_parent 'content_parent' %} +{% block content_use1 'content_parent' %} +{% block content_use2 'content_parent' %} +{% block content '' %} +--TEMPLATE(use1.twig)-- +{% block content_use1 'content_use1' %} +{% block content_use2 'content_use1' %} +{% block content_use1_only 'content_use1_only' %} +--TEMPLATE(use2.twig)-- +{% block content_use2 'content_use2' %} +{% block content_use2_only 'content_use2_only' %} +--DATA-- +return [] +--EXPECT-- + content_parent + content_use1 + content_use2 + content_use1_only + content_use2_only diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test new file mode 100644 index 0000000..ae090f9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.input('username') }} +{{ macros.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return [] +--EXPECT-- + + + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test new file mode 100644 index 0000000..3f3caf7 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test @@ -0,0 +1,16 @@ +--TEST-- +"macro" tag supports name for endmacro +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.foo() }} +{{ macros.bar() }} + +{% macro foo() %}foo{% endmacro %} +{% macro bar() %}bar{% endmacro bar %} +--DATA-- +return [] +--EXPECT-- +foo +bar + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test new file mode 100644 index 0000000..b28ca19 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import 'forms.twig' as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} +--TEMPLATE(forms.twig)-- +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return [] +--EXPECT-- + + + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test new file mode 100644 index 0000000..8b9aae8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test @@ -0,0 +1,18 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} +{% from 'forms.twig' import foo as foobar, bar %} + +{{ foo('foo') }} +{{ foobar('foo') }} +{{ bar('foo') }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}foo{{ name }}{% endmacro %} +{% macro bar(name) %}bar{{ name }}{% endmacro %} +--DATA-- +return [] +--EXPECT-- +foofoo +foofoo +barfoo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test new file mode 100644 index 0000000..c844ae3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test @@ -0,0 +1,9 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% from 'forms.twig' import templateName %} +--TEMPLATE(forms.twig)-- +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test new file mode 100644 index 0000000..832740e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} + +{{ foo('foo') }} +{{ foo() }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} +--DATA-- +return [] +--EXPECT-- +fooglobal +fooglobal diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test new file mode 100644 index 0000000..6c1817b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test @@ -0,0 +1,10 @@ +--TEST-- +"import" tag with a template as string +--TEMPLATE-- +{% import template_from_string("{% macro test() %}ok{% endmacro %}") as m %} +{{ m.test() }} +--TEMPLATE(forms.twig)-- +--DATA-- +return [] +--EXPECT-- +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test new file mode 100644 index 0000000..dc7a810 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test @@ -0,0 +1,11 @@ +--TEST-- +"from" tag with reserved name +--TEMPLATE-- +{% import 'forms.twig' as macros %} + +{{ macros.parent() }} +--TEMPLATE(forms.twig)-- +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test new file mode 100644 index 0000000..e58dd7c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test @@ -0,0 +1,10 @@ +--TEST-- +"macro" tag with reserved name +--TEMPLATE-- +{% macro parent(arg1, arg2) %} + parent +{% endmacro %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test new file mode 100644 index 0000000..ca3157d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return [] +--EXPECT-- + + + diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test new file mode 100644 index 0000000..491e91e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test @@ -0,0 +1,14 @@ +--TEST-- +"§" as a macro name +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.§('foo') }} + +{% macro §(foo) %} + §{{ foo }}§ +{% endmacro %} +--DATA-- +return [] +--EXPECT-- +§foo§ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test new file mode 100644 index 0000000..643697c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test @@ -0,0 +1,14 @@ +--TEST-- +Super globals as macro arguments +--TEMPLATE-- +{% import _self as macros %} + +{{ macros.foo('foo') }} + +{% macro foo(GET) %} + {{ GET }} +{% endmacro %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test new file mode 100644 index 0000000..7875b2a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endraw %} +--DATA-- +return [] +--EXPECT-- +{{ foo }} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test new file mode 100644 index 0000000..d4c8dd2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endverbatim %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test new file mode 100644 index 0000000..11f4202 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test @@ -0,0 +1,56 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +1*** + +{%- raw %} + {{ 'bla' }} +{% endraw %} + +1*** +2*** + +{%- raw -%} + {{ 'bla' }} +{% endraw %} + +2*** +3*** + +{%- raw -%} + {{ 'bla' }} +{% endraw -%} + +3*** +4*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw %} + +4*** +5*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw -%} + +5*** +--DATA-- +return [] +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/array.test new file mode 100644 index 0000000..b432427 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/array.test @@ -0,0 +1,16 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +{{ [a][0] }} +{{ dump([a][0]) }} +--DATA-- +return ['a' => 'b'] +--CONFIG-- +return ['autoescape' => false, 'debug' => true] +--EXPECT-- +b +string(1) "b" diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test new file mode 100644 index 0000000..e26a78b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test @@ -0,0 +1,11 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + a +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig\Error\SyntaxError: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test new file mode 100644 index 0000000..bb2a329 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test @@ -0,0 +1,14 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + + {% if 1 %} + {%- include "foo.twig" %} + {% endif %} +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig\Error\SyntaxError: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test new file mode 100644 index 0000000..4d232d8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test @@ -0,0 +1,22 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %} + {%- include "foo.twig" %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return [] +--EXPECT-- +foo +foo +foo +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test new file mode 100644 index 0000000..aae1427 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test @@ -0,0 +1,20 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo = 'foo' %} +{% set bar = 'foo
    ' %} + +{{ foo }} +{{ bar }} + +{% set foo, bar = 'foo', 'bar' %} + +{{ foo }}{{ bar }} +--DATA-- +return [] +--EXPECT-- +foo +foo<br /> + + +foobar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test new file mode 100644 index 0000000..97fc43c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test @@ -0,0 +1,9 @@ +--TEST-- +"set" tag block empty capture +--TEMPLATE-- +{% set foo %}{% endset %} + +{% if foo %}FAIL{% endif %} +--DATA-- +return [] +--EXPECT-- diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test new file mode 100644 index 0000000..c3faf25 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -0,0 +1,10 @@ +--TEST-- +"set" tag block capture +--TEMPLATE-- +{% set foo %}f
    o
    o{% endset %} + +{{ foo }} +--DATA-- +return [] +--EXPECT-- +f
    o
    o diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture_scope.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture_scope.test new file mode 100644 index 0000000..bb2bbeb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture_scope.test @@ -0,0 +1,10 @@ +--TEST-- +"set" tag block capture +--TEMPLATE-- +{% set foo %}{{ foo }}{% endset %} + +{{ foo }} +--DATA-- +return ['foo' => 'foo'] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test new file mode 100644 index 0000000..bd47277 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test @@ -0,0 +1,12 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} + +{{ foo }} +{{ bar }} +--DATA-- +return [] +--EXPECT-- +foobar +barfoo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance.test new file mode 100644 index 0000000..79e89ce --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance.test @@ -0,0 +1,24 @@ +--TEST-- +"set" tag with inheritance +--TEMPLATE-- +{% extends "layout.twig" %} + +{% set bar %}bar{% endset %} + +{% block var_from_child %} + {{- bar -}} +{% endblock %} +--TEMPLATE(layout.twig)-- +{% set foo %}foo{% endset %} + +{% block var_from_layout %} + {{- foo -}} +{% endblock %} + +{% block var_from_child %} +{% endblock %} +--DATA-- +return [] +--EXPECT-- +foo +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance_overriding.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance_overriding.test new file mode 100644 index 0000000..2d23c83 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/inheritance_overriding.test @@ -0,0 +1,24 @@ +--TEST-- +"set" tag with inheritance +--TEMPLATE-- +{% extends "layout.twig" %} + +{% set foo %}bar{% endset %} + +{% block var_from_child %} + {{- foo -}} +{% endblock %} +--TEMPLATE(layout.twig)-- +{% set foo %}foo{% endset %} + +{% block var_from_layout %} + {{- foo -}} +{% endblock %} + +{% block var_from_child %} +{% endblock %} +--DATA-- +return [] +--EXPECT-- +foo +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/mutating.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/mutating.test new file mode 100644 index 0000000..ae388bb --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/mutating.test @@ -0,0 +1,17 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo = "foo" %} + +{% set bar %} + {%- set foo = "bar" -%} + bar +{% endset %} + +{{ foo }} +{{ bar }} +--DATA-- +return [] +--EXPECT-- +bar +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test new file mode 100644 index 0000000..98bd27a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test @@ -0,0 +1,12 @@ +--TEST-- +"spaceless" tag removes whites between HTML tags +--TEMPLATE-- +{% spaceless %} + +
    foo
    + +{% endspaceless %} +--DATA-- +return [] +--EXPECT-- +
    foo
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test new file mode 100644 index 0000000..64ffd1d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"§" custom tag +--TEMPLATE-- +{% § %} +--DATA-- +return [] +--EXPECT-- +§ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test new file mode 100644 index 0000000..b6b1d5c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" with content as foo %} + +{{ block('foo') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test new file mode 100644 index 0000000..be622a1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" %} + +{{ block('content') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return [] +--EXPECT-- +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test new file mode 100644 index 0000000..771ba64 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test @@ -0,0 +1,22 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} + +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return [] +--EXPECT-- +foo +foo +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test new file mode 100644 index 0000000..f14ce83 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test @@ -0,0 +1,10 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} +--TEMPLATE(bar.twig)-- +--DATA-- +return [] +--EXPECT-- diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test new file mode 100644 index 0000000..1edeaa1 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test @@ -0,0 +1,25 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "parent.twig" %} + +{{ block('container') }} +--TEMPLATE(parent.twig)-- +{% use "ancestor.twig" %} + +{% block sub_container %} +
    overridden sub_container
    +{% endblock %} +--TEMPLATE(ancestor.twig)-- +{% block container %} +
    {{ block('sub_container') }}
    +{% endblock %} + +{% block sub_container %} +
    sub_container
    +{% endblock %} +--DATA-- +return [] +--EXPECT-- +
    overridden sub_container
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test new file mode 100644 index 0000000..accec50 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test @@ -0,0 +1,24 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "ancestor.twig" %} +{% use "parent.twig" %} + +{{ block('container') }} +--TEMPLATE(parent.twig)-- +{% block sub_container %} +
    overridden sub_container
    +{% endblock %} +--TEMPLATE(ancestor.twig)-- +{% block container %} +
    {{ block('sub_container') }}
    +{% endblock %} + +{% block sub_container %} +
    sub_container
    +{% endblock %} +--DATA-- +return [] +--EXPECT-- +
    overridden sub_container
    +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test new file mode 100644 index 0000000..85a6395 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test @@ -0,0 +1,21 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return [] +--EXPECT-- +bar +foo +bar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test new file mode 100644 index 0000000..413bdfa --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test @@ -0,0 +1,23 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" with content as foo_content %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +{{ block('foo_content') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return [] +--EXPECT-- +bar +foo +bar +foo diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test new file mode 100644 index 0000000..49328f6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test @@ -0,0 +1,24 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use 'file2.html.twig' with foobar as base_base_foobar %} +{% block foobar %} + {{- block('base_base_foobar') -}} + Content of block (second override) +{% endblock foobar %} +--TEMPLATE(file2.html.twig)-- +{% use 'file1.html.twig' with foobar as base_foobar %} +{% block foobar %} + {{- block('base_foobar') -}} + Content of block (first override) +{% endblock foobar %} +--TEMPLATE(file1.html.twig)-- +{% block foobar -%} + Content of block +{% endblock foobar %} +--DATA-- +return [] +--EXPECT-- +Content of block +Content of block (first override) +Content of block (second override) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test new file mode 100644 index 0000000..274baa8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test @@ -0,0 +1,24 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use 'file2.html.twig'%} +{% block foobar %} + {{- parent() -}} + Content of block (second override) +{% endblock foobar %} +--TEMPLATE(file2.html.twig)-- +{% use 'file1.html.twig' %} +{% block foobar %} + {{- parent() -}} + Content of block (first override) +{% endblock foobar %} +--TEMPLATE(file1.html.twig)-- +{% block foobar -%} + Content of block +{% endblock foobar %} +--DATA-- +return [] +--EXPECT-- +Content of block +Content of block (first override) +Content of block (second override) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test new file mode 100644 index 0000000..f6f2212 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test @@ -0,0 +1,38 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use 'file2.html.twig' %} +{% use 'file1.html.twig' with foo %} +{% block foo %} + {{- parent() -}} + Content of foo (second override) +{% endblock foo %} +{% block bar %} + {{- parent() -}} + Content of bar (second override) +{% endblock bar %} +--TEMPLATE(file2.html.twig)-- +{% use 'file1.html.twig' %} +{% block foo %} + {{- parent() -}} + Content of foo (first override) +{% endblock foo %} +{% block bar %} + {{- parent() -}} + Content of bar (first override) +{% endblock bar %} +--TEMPLATE(file1.html.twig)-- +{% block foo -%} + Content of foo +{% endblock foo %} +{% block bar -%} + Content of bar +{% endblock bar %} +--DATA-- +return [] +--EXPECT-- +Content of foo +Content of foo (first override) +Content of foo (second override) +Content of bar +Content of bar (second override) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test new file mode 100644 index 0000000..fad9a2d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test @@ -0,0 +1,24 @@ +--TEST-- +"use" tag with a parent block +--TEMPLATE-- +{% extends "parent.twig" %} + +{% use 'blocks.twig' %} + +{% block body %} + {{ parent() -}} + CHILD + {{ block('content') }} +{% endblock %} +--TEMPLATE(parent.twig)-- +{% block body %} + PARENT +{% endblock %} +--TEMPLATE(blocks.twig)-- +{% block content 'BLOCK' %} +--DATA-- +return [] +--EXPECT-- +PARENT +CHILD + BLOCK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test new file mode 100644 index 0000000..9b60abc --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +{% verbatim %} +{{ foo }} +{% endverbatim %} +--DATA-- +return [] +--EXPECT-- +{{ foo }} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test new file mode 100644 index 0000000..2177538 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test @@ -0,0 +1,10 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +{% verbatim %} +{{ foo }} +{% endraw %} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test new file mode 100644 index 0000000..501922b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test @@ -0,0 +1,56 @@ +--TEST-- +"verbatim" tag +--TEMPLATE-- +1*** + +{%- verbatim %} + {{ 'bla' }} +{% endverbatim %} + +1*** +2*** + +{%- verbatim -%} + {{ 'bla' }} +{% endverbatim %} + +2*** +3*** + +{%- verbatim -%} + {{ 'bla' }} +{% endverbatim -%} + +3*** +4*** + +{%- verbatim -%} + {{ 'bla' }} +{%- endverbatim %} + +4*** +5*** + +{%- verbatim -%} + {{ 'bla' }} +{%- endverbatim -%} + +5*** +--DATA-- +return [] +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test new file mode 100644 index 0000000..7c2abd0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test @@ -0,0 +1,13 @@ +--TEST-- +"with" tag +--TEMPLATE-- +{% with %} + {% set bar = 'BAZ' %} + {{ foo }}{{ bar }} +{% endwith %} +{{ foo }}{{ bar }} +--DATA-- +return ['foo' => 'foo', 'bar' => 'bar'] +--EXPECT-- +fooBAZ +foobar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test new file mode 100644 index 0000000..e4433d4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test @@ -0,0 +1,10 @@ +--TEST-- +"with" tag with expression +--TEMPLATE-- +{% with {foo: 'foo', bar: 'BAZ'} %} + {{ foo }}{{ bar }} +{% endwith %} +--DATA-- +return ['foo' => 'baz'] +--EXPECT-- +fooBAZ diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/globals.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/globals.test new file mode 100644 index 0000000..b030e7e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/globals.test @@ -0,0 +1,10 @@ +--TEST-- +"with" tag +--TEMPLATE-- +{% with [] only %} + {{ global }} +{% endwith %} +--DATA-- +return [] +--EXPECT-- +global diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/iterable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/iterable.test new file mode 100644 index 0000000..1b0cbc6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/iterable.test @@ -0,0 +1,10 @@ +--TEST-- +"with" tag with an iterable expression +--TEMPLATE-- +{% with vars %} + {{ foo }}{{ bar }} +{% endwith %} +--DATA-- +return ['vars' => new ArrayObject(['foo' => 'baz', 'bar' => 'qux'])] +--EXPECT-- +bazqux diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test new file mode 100644 index 0000000..33ca390 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test @@ -0,0 +1,15 @@ +--TEST-- +nested "with" tags +--TEMPLATE-- +{% set foo, bar = 'foo', 'bar' %} +{% with {bar: 'BAZ'} %} + {% with {foo: 'FOO'} %} + {{ foo }}{{ bar }} + {% endwith %} +{% endwith %} +{{ foo }}{{ bar }} +--DATA-- +return [] +--EXPECT-- +FOOBAZ + foobar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test new file mode 100644 index 0000000..7083050 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test @@ -0,0 +1,10 @@ +--TEST-- +"with" tag with an expression that is not a hash +--TEMPLATE-- +{% with vars %} + {{ foo }}{{ bar }} +{% endwith %} +--DATA-- +return ['vars' => 'no-hash'] +--EXCEPTION-- +Twig\Error\RuntimeError: Variables passed to the "with" tag must be a hash in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test new file mode 100644 index 0000000..1aca34f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test @@ -0,0 +1,10 @@ +--TEST-- +"with" tag with expression and only +--TEMPLATE-- +{% with {foo: 'foo', bar: 'BAZ'} only %} + {{ foo }}{{ bar }}{{ baz }} +{% endwith %} +--DATA-- +return ['foo' => 'baz', 'baz' => 'baz'] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "baz" does not exist in "index.twig" at line 3. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test new file mode 100644 index 0000000..7c9a6c8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test @@ -0,0 +1,24 @@ +--TEST-- +array index test +--TEMPLATE-- +{% for key, value in days %} +{{ key }} +{% endfor %} +--DATA-- +return ['days' => [ + 1 => ['money' => 9], + 2 => ['money' => 21], + 3 => ['money' => 38], + 4 => ['money' => 6], + 18 => ['money' => 6], + 19 => ['money' => 3], + 31 => ['money' => 11], +]] +--EXPECT-- +1 +2 +3 +4 +18 +19 +31 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test new file mode 100644 index 0000000..0fa4b37 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test @@ -0,0 +1,14 @@ +--TEST-- +"const" test +--TEMPLATE-- +{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} +{{ 'bar' is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} +{{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} +{{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }} +--DATA-- +return ['value' => 'bar', 'object' => new \ArrayObject(['hi'])] +--EXPECT-- +ok +ok +ok +ok \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test new file mode 100644 index 0000000..879c651 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test @@ -0,0 +1,129 @@ +--TEST-- +"defined" test +--TEMPLATE-- +{{ definedVar is defined ? 'ok' : 'ko' }} +{{ definedVar is not defined ? 'ko' : 'ok' }} +{{ undefinedVar is defined ? 'ko' : 'ok' }} +{{ undefinedVar is not defined ? 'ok' : 'ko' }} +{{ zeroVar is defined ? 'ok' : 'ko' }} +{{ nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is defined ? 'ok' : 'ko' }} +{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is not defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} +{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} +{{ nested.zeroVar is defined ? 'ok' : 'ko' }} +{{ nested.nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} +{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} +{{ object.foo is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.getFoo() is defined ? 'ok' : 'ko' }} +{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} +{{ object.self.foo is defined ? 'ok' : 'ko' }} +{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} +{{ 0 is defined ? 'ok' : 'ko' }} +{{ "foo" is defined ? 'ok' : 'ko' }} +{{ true is defined ? 'ok' : 'ko' }} +{{ false is defined ? 'ok' : 'ko' }} +{{ null is defined ? 'ok' : 'ko' }} +{{ [1, 2] is defined ? 'ok' : 'ko' }} +{{ { foo: "bar" } is defined ? 'ok' : 'ko' }} +--DATA-- +return [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => [0], + ], + 'object' => new TwigTestFoo(), +] +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +--DATA-- +return [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => [ + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => [0], + ], + 'object' => new TwigTestFoo(), +] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test new file mode 100644 index 0000000..5fd2fe3 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test @@ -0,0 +1,35 @@ +--TEST-- +"defined" support for attribute +--TEMPLATE-- +{{ attribute(nested, "definedVar") is defined ? 'ok' : 'ko' }} +{{ attribute(nested, "undefinedVar") is not defined ? 'ok' : 'ko' }} +{{ attribute(nested, definedVarName) is defined ? 'ok' : 'ko' }} +{{ attribute(nested, undefinedVarName) is not defined ? 'ok' : 'ko' }} +--DATA-- +return [ + 'nested' => [ + 'definedVar' => 'defined', + ], + 'definedVarName' => 'definedVar', + 'undefinedVarName' => 'undefinedVar', +] +--EXPECT-- +ok +ok +ok +ok +--DATA-- +return [ + 'nested' => [ + 'definedVar' => 'defined', + ], + 'definedVarName' => 'definedVar', + 'undefinedVarName' => 'undefinedVar', +] +--CONFIG-- +return ['strict_variables' => false] +--EXPECT-- +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test new file mode 100644 index 0000000..c8b90f8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test @@ -0,0 +1,38 @@ +--TEST-- +"defined" support for blocks +--TEMPLATE-- +{% extends 'parent' %} +{% block icon %}icon{% endblock %} +{% block body %} + {{ parent() }} + {{ block('foo') is defined ? 'ok' : 'ko' }} + {{ block('footer') is defined ? 'ok' : 'ko' }} + {{ block('icon') is defined ? 'ok' : 'ko' }} + {{ block('block1') is defined ? 'ok' : 'ko' }} + {%- embed 'embed' %} + {% block content %}content{% endblock %} + {% endembed %} +{% endblock %} +{% use 'blocks' %} +--TEMPLATE(parent)-- +{% block body %} + {{ block('icon') is defined ? 'ok' : 'ko' -}} +{% endblock %} +{% block footer %}{% endblock %} +--TEMPLATE(embed)-- +{{ block('icon') is defined ? 'ok' : 'ko' }} +{{ block('content') is defined ? 'ok' : 'ko' }} +{{ block('block1') is defined ? 'ok' : 'ko' }} +--TEMPLATE(blocks)-- +{% block block1 %}{%endblock %} +--DATA-- +return [] +--EXPECT-- +ok + ko + ok + ok + ok +ko +ok +ko diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test new file mode 100644 index 0000000..68540de --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test @@ -0,0 +1,17 @@ +--TEST-- +"defined" support for blocks with a template argument +--TEMPLATE-- +{{ block('foo', 'included.twig') is defined ? 'ok' : 'ko' }} +{{ block('foo', included_loaded) is defined ? 'ok' : 'ko' }} +{{ block('foo', included_loaded_internal) is defined ? 'ok' : 'ko' }} +--TEMPLATE(included.twig)-- +{% block foo %}FOO{% endblock %} +--DATA-- +return [ + 'included_loaded' => $twig->load('included.twig'), + 'included_loaded_internal' => $twig->load('included.twig'), +] +--EXPECT-- +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test new file mode 100644 index 0000000..62172e4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test @@ -0,0 +1,14 @@ +--TEST-- +"defined" support for constants +--TEMPLATE-- +{{ constant('DATE_W3C') is defined ? 'ok' : 'ko' }} +{{ constant('ARRAY_AS_PROPS', object) is defined ? 'ok' : 'ko' }} +{{ constant('FOOBAR') is not defined ? 'ok' : 'ko' }} +{{ constant('FOOBAR', object) is not defined ? 'ok' : 'ko' }} +--DATA-- +return ['expect' => DATE_W3C, 'object' => new \ArrayObject(['hi'])] +--EXPECT-- +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_on_complex_expr.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_on_complex_expr.test new file mode 100644 index 0000000..2d06158 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_on_complex_expr.test @@ -0,0 +1,8 @@ +--TEST-- +"defined" support for "complex" expressions +--TEMPLATE-- +{{ (1 + 2) is defined ? 'ok' : 'ko' }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\SyntaxError: The "defined" test only works with simple variables in "index.twig" at line 2. diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test new file mode 100644 index 0000000..41625f6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test @@ -0,0 +1,14 @@ +--TEST-- +dynamic test +--TEMPLATE-- +{{ 'bar' is test_bar ? '1' :'0' }} +{{ 'foo' is test_foo ? '1' :'0' }} +{{ 'bar' is test_foo ? '1' :'0' }} +{{ 'foo' is test_bar ? '1' :'0' }} +--DATA-- +return [] +--EXPECT-- +1 +1 +0 +0 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test new file mode 100644 index 0000000..3e7fcf0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test @@ -0,0 +1,42 @@ +--TEST-- +"empty" test +--TEMPLATE-- +{{ string_empty is empty ? 'ok' : 'ko' }} +{{ string_zero is empty ? 'ko' : 'ok' }} +{{ value_null is empty ? 'ok' : 'ko' }} +{{ value_false is empty ? 'ok' : 'ko' }} +{{ value_int_zero is empty ? 'ko' : 'ok' }} +{{ array_empty is empty ? 'ok' : 'ko' }} +{{ array_not_empty is empty ? 'ko' : 'ok' }} +{{ magically_callable is empty ? 'ko' : 'ok' }} +{{ countable_empty is empty ? 'ok' : 'ko' }} +{{ countable_not_empty is empty ? 'ko' : 'ok' }} +{{ tostring_empty is empty ? 'ok' : 'ko' }} +{{ tostring_not_empty is empty ? 'ko' : 'ok' }} +{{ markup_empty is empty ? 'ok' : 'ko' }} +{{ markup_not_empty is empty ? 'ko' : 'ok' }} +--DATA-- +return [ + 'string_empty' => '', 'string_zero' => '0', + 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0, + 'array_empty' => [], 'array_not_empty' => [1, 2], + 'magically_callable' => new MagicCallStub(), + 'countable_empty' => new CountableStub([]), 'countable_not_empty' => new CountableStub([1, 2]), + 'tostring_empty' => new ToStringStub(''), 'tostring_not_empty' => new ToStringStub('0' /* edge case of using "0" as the string */), + 'markup_empty' => new \Twig\Markup('', 'UTF-8'), 'markup_not_empty' => new \Twig\Markup('test', 'UTF-8'), +] +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test new file mode 100644 index 0000000..5c73b01 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test @@ -0,0 +1,14 @@ +--TEST-- +"even" test +--TEMPLATE-- +{{ 1 is even ? 'ko' : 'ok' }} +{{ 2 is even ? 'ok' : 'ko' }} +{{ 1 is not even ? 'ok' : 'ko' }} +{{ 2 is not even ? 'ko' : 'ok' }} +--DATA-- +return [] +--EXPECT-- +ok +ok +ok +ok diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test new file mode 100644 index 0000000..e3ebf05 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -0,0 +1,116 @@ +--TEST-- +Twig supports the in operator +--TEMPLATE-- +{{ bar in foo ? 'OK' : 'KO' }} +{{ not (bar in foo) ? 'KO' : 'OK' }} +{{ bar not in foo ? 'KO' : 'OK' }} +{{ 'a' in bar ? 'OK' : 'KO' }} +{{ 'c' not in bar ? 'OK' : 'KO' }} +{{ '' in bar ? 'OK' : 'KO' }} +{{ '' in '' ? 'OK' : 'KO' }} +{{ '0' not in '' ? 'OK' : 'KO' }} +{{ 'a' not in '0' ? 'OK' : 'KO' }} +{{ '0' in '0' ? 'OK' : 'KO' }} + +{{ false in [0, 1] ? 'OK' : 'KO' }} +{{ true in [0, 1] ? 'OK' : 'KO' }} +{{ '0' in [0, 1] ? 'OK' : 'KO' }} +{{ '0' in [1, 0] ? 'OK' : 'KO' }} +{{ '' in [0, 1] ? 'OK' : 'KO' }} +{{ '' in [1, 0] ? 'OK' : 'KO' }} +{{ 0 in ['', 1] ? 'OK' : 'KO' }} +{{ 0 in [1, ''] ? 'OK' : 'KO' }} + +{{ '' in 'foo' ? 'OK' : 'KO' }} +{{ 0 in 'foo' ? 'KO' : 'OK' }} +{{ false in 'foo' ? 'KO' : 'OK' }} +{{ false in '100' ? 'KO' : 'OK' }} +{{ true in '100' ? 'KO' : 'OK' }} + +{{ [] in [true, false] ? 'OK' : 'KO' }} +{{ [] in [true, ''] ? 'KO' : 'OK' }} +{{ [] in [true, []] ? 'OK' : 'KO' }} + +{{ resource ? 'OK' : 'KO' }} +{{ resource in 'foo'~resource ? 'KO' : 'OK' }} +{{ object in 'stdClass' ? 'KO' : 'OK' }} +{{ [] in 'Array' ? 'KO' : 'OK' }} +{{ dir_object in 'foo'~dir_object ? 'KO' : 'OK' }} + +{{ ''~resource in resource ? 'KO' : 'OK' }} +{{ 'stdClass' in object ? 'KO' : 'OK' }} +{{ 'Array' in [] ? 'KO' : 'OK' }} +{{ ''~dir_object in dir_object ? 'KO' : 'OK' }} + +{{ resource in [''~resource] ? 'KO' : 'OK' }} +{{ resource in [resource + 1 - 1] ? 'KO' : 'OK' }} +{{ dir_object in [''~dir_object] ? 'KO' : 'OK' }} + +{{ 5 in 125 ? 'KO' : 'OK' }} +{{ 5 in '125' ? 'OK' : 'KO' }} +{{ '5' in 125 ? 'KO' : 'OK' }} +{{ '5' in '125' ? 'OK' : 'KO' }} + +{{ 5.5 in 125.5 ? 'KO' : 'OK' }} +{{ 5.5 in '125.5' ? 'OK' : 'KO' }} +{{ '5.5' in 125.5 ? 'KO' : 'OK' }} + +{{ safe in ['foo', 'bar'] ? 'OK' : 'KO' }} +--DATA-- +return ['bar' => 'bar', 'foo' => ['bar' => 'bar'], 'dir_object' => new \SplFileInfo(dirname(__FILE__)), 'object' => new \stdClass(), 'resource' => opendir(dirname(__FILE__)), 'safe' => new \Twig\Markup('foo', 'UTF-8')] +--EXPECT-- +OK +OK +OK +OK +OK +OK +OK +OK +OK +OK + +OK +OK +OK +OK +OK +OK +OK +OK + +OK +OK +OK +OK +OK + +OK +OK +OK + +OK +OK +OK +OK +OK + +OK +OK +OK +OK + +OK +OK +OK + +OK +OK +OK +OK + +OK +OK +OK + +OK diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test new file mode 100644 index 0000000..b53eb06 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test @@ -0,0 +1,19 @@ +--TEST-- +Twig supports the in operator when using objects +--TEMPLATE-- +{% if object in object_list %} +TRUE +{% endif %} +--DATA-- +$foo = new TwigTestFoo(); +$foo1 = new TwigTestFoo(); + +$foo->position = $foo1; +$foo1->position = $foo; + +return [ + 'object' => $foo, + 'object_list' => [$foo1, $foo], +] +--EXPECT-- +TRUE diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test new file mode 100644 index 0000000..75b5756 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test @@ -0,0 +1,19 @@ +--TEST-- +"iterable" test +--TEMPLATE-- +{{ foo is iterable ? 'ok' : 'ko' }} +{{ traversable is iterable ? 'ok' : 'ko' }} +{{ obj is iterable ? 'ok' : 'ko' }} +{{ val is iterable ? 'ok' : 'ko' }} +--DATA-- +return [ + 'foo' => [], + 'traversable' => new \ArrayIterator([]), + 'obj' => new \stdClass(), + 'val' => 'test', +] +--EXPECT-- +ok +ok +ko +ko \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test new file mode 100644 index 0000000..7af3255 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test @@ -0,0 +1,30 @@ +--TEST-- +Twig supports the ?? operator +--TEMPLATE-- +{{ 'OK' ?? 'KO' }} +{{ null ?? 'OK' }} +{{ bar ?? 'KO' }} +{{ baz ?? 'OK' }} +{{ foo.bar ?? 'KO' }} +{{ foo.missing ?? 'OK' }} +{{ foo.bar.baz.missing ?? 'OK' }} +{{ foo['bar'] ?? 'KO' }} +{{ foo['missing'] ?? 'OK' }} +{{ nope ?? nada ?? 'OK' }} +{{ 1 + nope ?? nada ?? 2 }} +{{ 1 + nope ?? 3 + nada ?? 2 }} +--DATA-- +return ['bar' => 'OK', 'foo' => ['bar' => 'OK']] +--EXPECT-- +OK +OK +OK +OK +OK +OK +OK +OK +OK +OK +3 +6 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test new file mode 100644 index 0000000..ec88bb5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test @@ -0,0 +1,10 @@ +--TEST-- +"odd" test +--TEMPLATE-- +{{ 1 is odd ? 'ok' : 'ko' }} +{{ 2 is odd ? 'ko' : 'ok' }} +--DATA-- +return [] +--EXPECT-- +ok +ok \ No newline at end of file diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_block.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_block.test new file mode 100644 index 0000000..346a110 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_block.test @@ -0,0 +1,68 @@ +--TEST-- +Whitespace trimming on tags. +--TEMPLATE-- +Trim on control tag: +{% for i in range(1, 9) -%} + {{ i }} +{%- endfor %} + + +Trim on output tag: +{% for i in range(1, 9) %} + {{- i -}} +{% endfor %} + + +Trim comments: + +{#- Invisible -#} + +After the comment. + +Trim leading space: +{% if leading %} + + {{- leading }} +{% endif %} + +{%- if leading %} + {{- leading }} + +{%- endif %} + + +Trim trailing space: +{% if trailing -%} + {{ trailing -}} + +{% endif -%} + +Combined: + +{%- if both -%} +
      +
    • {{- both -}}
    • +
    + +{%- endif -%} + +end +--DATA-- +return ['leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both'] +--EXPECT-- +Trim on control tag: +123456789 + +Trim on output tag: +123456789 + +Trim comments:After the comment. + +Trim leading space: +leading space +leading space + +Trim trailing space: +trailing spaceCombined:
      +
    • both
    • +
    end diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_delimiter_as_strings.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_delimiter_as_strings.test new file mode 100644 index 0000000..a58818d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_delimiter_as_strings.test @@ -0,0 +1,10 @@ +--TEST-- +Whitespace trimming as strings. +--TEMPLATE-- +{{ 5 * '{#-'|length }} +{{ '{{-'|length * 5 + '{%-'|length }} +--DATA-- +return [] +--EXPECT-- +15 +18 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_left.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_left.test new file mode 100644 index 0000000..75d0f80 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_left.test @@ -0,0 +1,32 @@ +--TEST-- +Whitespace trimming on tags (left side). +--TEMPLATE-- +**{% if true %} +foo + + {%- endif %}** + +** + + {{- 'foo' }}** + +** + + +{#- comment #}** + +**{% verbatim %} +foo + + {%- endverbatim %}** +--DATA-- +return [] +--EXPECT-- +**foo** + +**foo** + +**** + +** +foo** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_left.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_left.test new file mode 100644 index 0000000..e5e845f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_left.test @@ -0,0 +1,33 @@ +--TEST-- +Line whitespace trimming on tags (left side). +--TEMPLATE-- +**{% if true %} +foo + {%~ endif %}** + +** + {{~ 'foo' }}** + +** + {#~ comment #}** + +**{% verbatim %} +foo + + {%~ endverbatim %}** +--DATA-- +return [] +--EXPECT-- +**foo +** + +** +foo** + +** +** + +** +foo + +** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_right.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_right.test new file mode 100644 index 0000000..e7b510c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_line_right.test @@ -0,0 +1,32 @@ +--TEST-- +Line whitespace trimming on tags (right side). +--TEMPLATE-- +**{% if true ~%} +foo{% endif %}** + +**{{ 'foo' ~}} +foo +** + +**{# comment ~#} + foo +** + +**{% verbatim ~%} + foo{% endverbatim %}** +--DATA-- +return [] +--EXPECT-- +** +foo** + +**foo +foo +** + +** + foo +** + +** + foo** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_right.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_right.test new file mode 100644 index 0000000..0ec3b0c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Fixtures/whitespace/trim_right.test @@ -0,0 +1,28 @@ +--TEST-- +Whitespace trimming on tags (right side). +--TEMPLATE-- +**{% if true -%} + + foo{% endif %}** + +**{{ 'foo' -}} + +** + +**{# comment -#} + +** + +**{% verbatim -%} + +foo{% endverbatim %}** +--DATA-- +return [] +--EXPECT-- +**foo** + +**foo** + +**** + +**foo** diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php new file mode 100644 index 0000000..e4b7d1d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php @@ -0,0 +1,384 @@ +position = 0; + } + + public function current() + { + return $this->array[$this->position]; + } + + public function key() + { + return 'a'; + } + + public function next() + { + ++$this->position; + } + + public function valid() + { + return isset($this->array[$this->position]); + } +} + +class TwigTestTokenParser_§ extends AbstractTokenParser +{ + public function parse(Token $token) + { + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new PrintNode(new ConstantExpression('§', -1), -1); + } + + public function getTag() + { + return '§'; + } +} + +class TwigTestExtension extends AbstractExtension +{ + public function getTokenParsers() + { + return [ + new TwigTestTokenParser_§(), + ]; + } + + public function getFilters() + { + return [ + new TwigFilter('§', [$this, '§Filter']), + new TwigFilter('escape_and_nl2br', [$this, 'escape_and_nl2br'], ['needs_environment' => true, 'is_safe' => ['html']]), + new TwigFilter('nl2br', [$this, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('escape_something', [$this, 'escape_something'], ['is_safe' => ['something']]), + new TwigFilter('preserves_safety', [$this, 'preserves_safety'], ['preserves_safety' => ['html']]), + new TwigFilter('static_call_string', 'TwigTestExtension::staticCall'), + new TwigFilter('static_call_array', ['TwigTestExtension', 'staticCall']), + new TwigFilter('magic_call', [$this, 'magicCall']), + new TwigFilter('magic_call_string', 'TwigTestExtension::magicStaticCall'), + new TwigFilter('magic_call_array', ['TwigTestExtension', 'magicStaticCall']), + new TwigFilter('*_path', [$this, 'dynamic_path']), + new TwigFilter('*_foo_*_bar', [$this, 'dynamic_foo']), + ]; + } + + public function getFunctions() + { + return [ + new TwigFunction('§', [$this, '§Function']), + new TwigFunction('safe_br', [$this, 'br'], ['is_safe' => ['html']]), + new TwigFunction('unsafe_br', [$this, 'br']), + new TwigFunction('static_call_string', 'TwigTestExtension::staticCall'), + new TwigFunction('static_call_array', ['TwigTestExtension', 'staticCall']), + new TwigFunction('*_path', [$this, 'dynamic_path']), + new TwigFunction('*_foo_*_bar', [$this, 'dynamic_foo']), + ]; + } + + public function getTests() + { + return [ + new TwigTest('multi word', [$this, 'is_multi_word']), + new TwigTest('test_*', [$this, 'dynamic_test']), + ]; + } + + public function §Filter($value) + { + return "§{$value}§"; + } + + public function §Function($value) + { + return "§{$value}§"; + } + + /** + * nl2br which also escapes, for testing escaper filters. + */ + public function escape_and_nl2br($env, $value, $sep = '
    ') + { + return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); + } + + /** + * nl2br only, for testing filters with pre_escape. + */ + public function nl2br($value, $sep = '
    ') + { + // not secure if $value contains html tags (not only entities) + // don't use + return str_replace("\n", "$sep\n", $value); + } + + public function dynamic_path($element, $item) + { + return $element.'/'.$item; + } + + public function dynamic_foo($foo, $bar, $item) + { + return $foo.'/'.$bar.'/'.$item; + } + + public function dynamic_test($element, $item) + { + return $element === $item; + } + + public function escape_something($value) + { + return strtoupper($value); + } + + public function preserves_safety($value) + { + return strtoupper($value); + } + + public static function staticCall($value) + { + return "*$value*"; + } + + public function br() + { + return '
    '; + } + + public function is_multi_word($value) + { + return false !== strpos($value, ' '); + } + + public function __call($method, $arguments) + { + if ('magicCall' !== $method) { + throw new \BadMethodCallException('Unexpected call to __call'); + } + + return 'magic_'.$arguments[0]; + } + + public static function __callStatic($method, $arguments) + { + if ('magicStaticCall' !== $method) { + throw new \BadMethodCallException('Unexpected call to __callStatic'); + } + + return 'static_magic_'.$arguments[0]; + } +} + +/** + * This class is used in tests for the "length" filter and "empty" test. It asserts that __call is not + * used to convert such objects to strings. + */ +class MagicCallStub +{ + public function __call($name, $args) + { + throw new \Exception('__call shall not be called'); + } +} + +class ToStringStub +{ + /** + * @var string + */ + private $string; + + public function __construct($string) + { + $this->string = $string; + } + + public function __toString() + { + return $this->string; + } +} + +/** + * This class is used in tests for the length filter and empty test to show + * that when \Countable is implemented, it is preferred over the __toString() + * method. + */ +class CountableStub implements \Countable +{ + private $count; + + public function __construct($count) + { + $this->count = $count; + } + + public function count() + { + return $this->count; + } + + public function __toString() + { + throw new \Exception('__toString shall not be called on \Countables'); + } +} + +/** + * This class is used in tests for the length filter. + */ +class IteratorAggregateStub implements \IteratorAggregate +{ + private $data; + + public function __construct(array $data) + { + $this->data = $data; + } + + public function getIterator() + { + return new \ArrayIterator($this->data); + } +} + +class SimpleIteratorForTesting implements Iterator +{ + private $data = [1, 2, 3, 4, 5, 6, 7]; + private $key = 0; + + public function current() + { + return $this->key; + } + + public function next() + { + ++$this->key; + } + + public function key() + { + return $this->key; + } + + public function valid() + { + return isset($this->data[$this->key]); + } + + public function rewind() + { + $this->key = 0; + } + + public function __toString() + { + // for testing, make sure string length returned is not the same as the `iterator_count` + return str_repeat('X', iterator_count($this) + 10); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test new file mode 100644 index 0000000..d25f75e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test @@ -0,0 +1,18 @@ +--TEST-- +"filename" autoescape strategy +--TEMPLATE-- +{{ br -}} +{{ include('index.html.twig') -}} +{{ include('index.txt.twig') -}} +--TEMPLATE(index.html.twig)-- +{{ br -}} +--TEMPLATE(index.txt.twig)-- +{{ br -}} +--DATA-- +return ['br' => '
    '] +--CONFIG-- +return ['autoescape' => 'filename'] +--EXPECT-- +<br /> +<br /> +
    diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test new file mode 100644 index 0000000..e52c3b2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function with undefined block +--TEMPLATE-- +{% extends "base.twig" %} +{% block foo %}{{ parent() }}{{ block('unknown') }}{{ block('bar') }}{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}Foo{% endblock %} +{% block bar %}Bar{% endblock %} +--DATA-- +return [] +--EXPECT-- +FooBarBar diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test new file mode 100644 index 0000000..4bd1f6a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test @@ -0,0 +1,8 @@ +--TEST-- +Old test classes usage +--TEMPLATE-- +{{ 'foo' is multi word ? 'yes' : 'no' }} +--DATA-- +return [] +--EXPECT-- +no diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php new file mode 100644 index 0000000..92cac3f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php @@ -0,0 +1,57 @@ + new Twig_Test_Method($this, 'is_multi_word'), + ]; + } + + public function is_multi_word($value) + { + return false !== strpos($value, ' '); + } + + public function getName() + { + return 'legacy_integration_test'; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LexerTest.php new file mode 100644 index 0000000..c1e62a6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -0,0 +1,379 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize('{{ foo }}', 'foo'); + $this->assertEquals('foo', $stream->getFilename()); + $this->assertEquals('{{ foo }}', $stream->getSource()); + } + + public function testNameLabelForTag() + { + $template = '{% § %}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + + $stream->expect(Token::BLOCK_START_TYPE); + $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue()); + } + + public function testNameLabelForFunction() + { + $template = '{{ §() }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + + $stream->expect(Token::VAR_START_TYPE); + $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue()); + } + + public function testBracketsNesting() + { + $template = '{{ {"a":{"b":"c"}} }}'; + + $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '{')); + $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '}')); + } + + protected function countToken($template, $type, $value = null) + { + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + + $count = 0; + while (!$stream->isEOF()) { + $token = $stream->next(); + if ($type === $token->getType()) { + if (null === $value || $value === $token->getValue()) { + ++$count; + } + } + } + + return $count; + } + + public function testLineDirective() + { + $template = "foo\n" + ."bar\n" + ."{% line 10 %}\n" + ."{{\n" + ."baz\n" + ."}}\n"; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + + // foo\nbar\n + $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine()); + // \n (after {% line %}) + $this->assertSame(10, $stream->expect(Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(11, $stream->expect(Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(12, $stream->expect(Token::NAME_TYPE)->getLine()); + } + + public function testLineDirectiveInline() + { + $template = "foo\n" + ."bar{% line 10 %}{{\n" + ."baz\n" + ."}}\n"; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + + // foo\nbar + $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(10, $stream->expect(Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(11, $stream->expect(Token::NAME_TYPE)->getLine()); + } + + public function testLongComments() + { + $template = '{# '.str_repeat('*', 100000).' #}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testLongVerbatim() + { + $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testLongVar() + { + $template = '{{ '.str_repeat('x', 100000).' }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testLongBlock() + { + $template = '{% '.str_repeat('x', 100000).' %}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testBigNumbers() + { + $template = '{{ 922337203685477580700 }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->next(); + $node = $stream->next(); + $this->assertEquals('922337203685477580700', $node->getValue()); + } + + public function testStringWithEscapedDelimiter() + { + $tests = [ + "{{ 'foo \' bar' }}" => 'foo \' bar', + '{{ "foo \" bar" }}' => 'foo " bar', + ]; + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + foreach ($tests as $template => $expected) { + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, $expected); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + } + + public function testStringWithInterpolation() + { + $template = 'foo {{ "bar #{ baz + 1 }" }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::TEXT_TYPE, 'foo '); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'baz'); + $stream->expect(Token::OPERATOR_TYPE, '+'); + $stream->expect(Token::NUMBER_TYPE, '1'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::VAR_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testStringWithEscapedInterpolation() + { + $template = '{{ "bar \#{baz+1}" }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar #{baz+1}'); + $stream->expect(Token::VAR_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testStringWithHash() + { + $template = '{{ "bar # baz" }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar # baz'); + $stream->expect(Token::VAR_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unclosed """ + */ + public function testStringWithUnterminatedInterpolation() + { + $template = '{{ "bar #{x" }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + } + + public function testStringWithNestedInterpolations() + { + $template = '{{ "bar #{ "foo#{bar}" }" }}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'foo'); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'bar'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::VAR_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testStringWithNestedInterpolationsInBlock() + { + $template = '{% foo "bar #{ "foo#{bar}" }" %}'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'foo'); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'foo'); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'bar'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::BLOCK_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + public function testOperatorEndingWithALetterAtTheEndOfALine() + { + $template = "{{ 1 and\n0}}"; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::NUMBER_TYPE, 1); + $stream->expect(Token::OPERATOR_TYPE, 'and'); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unclosed "variable" in "index" at line 3 + */ + public function testUnterminatedVariable() + { + $template = ' + +{{ + +bar + + +'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unclosed "block" in "index" at line 3 + */ + public function testUnterminatedBlock() + { + $template = ' + +{% + +bar + + +'; + + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); + } + + public function testOverridingSyntax() + { + $template = '[# comment #]{# variable #}/# if true #/true/# endif #/'; + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), [ + 'tag_comment' => ['[#', '#]'], + 'tag_block' => ['/#', '#/'], + 'tag_variable' => ['{#', '#}'], + ]); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'variable'); + $stream->expect(Token::VAR_END_TYPE); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'if'); + $stream->expect(Token::NAME_TYPE, 'true'); + $stream->expect(Token::BLOCK_END_TYPE); + $stream->expect(Token::TEXT_TYPE, 'true'); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'endif'); + $stream->expect(Token::BLOCK_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php new file mode 100644 index 0000000..6f308f5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php @@ -0,0 +1,139 @@ + 'bar']); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + /** + * @group legacy + * @expectedException \Twig\Error\LoaderError + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new ArrayLoader([]); + + $loader->getSource('foo'); + } + + /** + * @expectedException \Twig\Error\LoaderError + */ + public function testGetSourceContextWhenTemplateDoesNotExist() + { + $loader = new ArrayLoader([]); + + $loader->getSourceContext('foo'); + } + + public function testGetCacheKey() + { + $loader = new ArrayLoader(['foo' => 'bar']); + + $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); + } + + public function testGetCacheKeyWhenTemplateHasDuplicateContent() + { + $loader = new ArrayLoader([ + 'foo' => 'bar', + 'baz' => 'bar', + ]); + + $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); + $this->assertEquals('baz:bar', $loader->getCacheKey('baz')); + } + + public function testGetCacheKeyIsProtectedFromEdgeCollisions() + { + $loader = new ArrayLoader([ + 'foo__' => 'bar', + 'foo' => '__bar', + ]); + + $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__')); + $this->assertEquals('foo:__bar', $loader->getCacheKey('foo')); + } + + /** + * @expectedException \Twig\Error\LoaderError + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new ArrayLoader([]); + + $loader->getCacheKey('foo'); + } + + public function testSetTemplate() + { + $loader = new ArrayLoader([]); + $loader->setTemplate('foo', 'bar'); + + $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); + } + + public function testIsFresh() + { + $loader = new ArrayLoader(['foo' => 'bar']); + $this->assertTrue($loader->isFresh('foo', time())); + } + + /** + * @expectedException \Twig\Error\LoaderError + */ + public function testIsFreshWhenTemplateDoesNotExist() + { + $loader = new ArrayLoader([]); + + $loader->isFresh('foo', time()); + } + + public function testTemplateReference() + { + $name = new Twig_Test_Loader_TemplateReference('foo'); + $loader = new ArrayLoader(['foo' => 'bar']); + + $loader->getCacheKey($name); + $loader->getSourceContext($name); + $loader->isFresh($name, time()); + $loader->setTemplate($name, 'foo:bar'); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without crashing PHP + $this->addToAssertionCount(1); + } +} + +class Twig_Test_Loader_TemplateReference +{ + private $name; + + public function __construct($name) + { + $this->name = $name; + } + + public function __toString() + { + return $this->name; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php new file mode 100644 index 0000000..c486eee --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php @@ -0,0 +1,132 @@ + 'bar']), + new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']), + ]); + + $this->assertEquals('bar', $loader->getSource('foo')); + $this->assertEquals('foo', $loader->getSource('bar')); + } + + public function testGetSourceContext() + { + $path = __DIR__.'/../Fixtures'; + $loader = new ChainLoader([ + new ArrayLoader(['foo' => 'bar']), + new ArrayLoader(['errors/index.html' => 'baz']), + new FilesystemLoader([$path]), + ]); + + $this->assertEquals('foo', $loader->getSourceContext('foo')->getName()); + $this->assertSame('', $loader->getSourceContext('foo')->getPath()); + + $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); + $this->assertSame('', $loader->getSourceContext('errors/index.html')->getPath()); + $this->assertEquals('baz', $loader->getSourceContext('errors/index.html')->getCode()); + + $this->assertEquals('errors/base.html', $loader->getSourceContext('errors/base.html')->getName()); + $this->assertEquals(realpath($path.'/errors/base.html'), realpath($loader->getSourceContext('errors/base.html')->getPath())); + $this->assertNotEquals('baz', $loader->getSourceContext('errors/base.html')->getCode()); + } + + /** + * @expectedException \Twig\Error\LoaderError + */ + public function testGetSourceContextWhenTemplateDoesNotExist() + { + $loader = new ChainLoader([]); + + $loader->getSourceContext('foo'); + } + + /** + * @group legacy + * @expectedException \Twig\Error\LoaderError + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new ChainLoader([]); + + $loader->getSource('foo'); + } + + public function testGetCacheKey() + { + $loader = new ChainLoader([ + new ArrayLoader(['foo' => 'bar']), + new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']), + ]); + + $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); + $this->assertEquals('bar:foo', $loader->getCacheKey('bar')); + } + + /** + * @expectedException \Twig\Error\LoaderError + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new ChainLoader([]); + + $loader->getCacheKey('foo'); + } + + public function testAddLoader() + { + $loader = new ChainLoader(); + $loader->addLoader(new ArrayLoader(['foo' => 'bar'])); + + $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); + } + + public function testExists() + { + $loader1 = $this->getMockBuilder('Twig_ChainTestLoaderWithExistsInterface')->getMock(); + $loader1->expects($this->once())->method('exists')->will($this->returnValue(false)); + $loader1->expects($this->never())->method('getSourceContext'); + + // can be removed in 2.0 + $loader2 = $this->getMockBuilder('Twig_ChainTestLoaderInterface')->getMock(); + //$loader2 = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); + $loader2->expects($this->once())->method('getSourceContext')->will($this->returnValue(new Source('content', 'index'))); + + $loader = new ChainLoader(); + $loader->addLoader($loader1); + $loader->addLoader($loader2); + + $this->assertTrue($loader->exists('foo')); + } +} + +interface Twig_ChainTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface +{ +} + +interface Twig_ChainTestLoaderWithExistsInterface extends LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php new file mode 100644 index 0000000..86e58e6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -0,0 +1,245 @@ +assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); + $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath())); + } + + /** + * @dataProvider getSecurityTests + */ + public function testSecurity($template) + { + $loader = new FilesystemLoader([__DIR__.'/../Fixtures']); + + try { + $loader->getCacheKey($template); + $this->fail(); + } catch (LoaderError $e) { + $this->assertNotContains('Unable to find template', $e->getMessage()); + } + } + + public function getSecurityTests() + { + return [ + ["AutoloaderTest\0.php"], + ['..\\AutoloaderTest.php'], + ['..\\\\\\AutoloaderTest.php'], + ['../AutoloaderTest.php'], + ['..////AutoloaderTest.php'], + ['./../AutoloaderTest.php'], + ['.\\..\\AutoloaderTest.php'], + ['././././././../AutoloaderTest.php'], + ['.\\./.\\./.\\./../AutoloaderTest.php'], + ['foo/../../AutoloaderTest.php'], + ['foo\\..\\..\\AutoloaderTest.php'], + ['foo/../bar/../../AutoloaderTest.php'], + ['foo/bar/../../../AutoloaderTest.php'], + ['filters/../../AutoloaderTest.php'], + ['filters//..//..//AutoloaderTest.php'], + ['filters\\..\\..\\AutoloaderTest.php'], + ['filters\\\\..\\\\..\\\\AutoloaderTest.php'], + ['filters\\//../\\/\\..\\AutoloaderTest.php'], + ['/../AutoloaderTest.php'], + ]; + } + + /** + * @dataProvider getBasePaths + */ + public function testPaths($basePath, $cacheKey, $rootPath) + { + $loader = new FilesystemLoader([$basePath.'/normal', $basePath.'/normal_bis'], $rootPath); + $loader->setPaths([$basePath.'/named', $basePath.'/named_bis'], 'named'); + $loader->addPath($basePath.'/named_ter', 'named'); + $loader->addPath($basePath.'/normal_ter'); + $loader->prependPath($basePath.'/normal_final'); + $loader->prependPath($basePath.'/named/../named_quater', 'named'); + $loader->prependPath($basePath.'/named_final', 'named'); + + $this->assertEquals([ + $basePath.'/normal_final', + $basePath.'/normal', + $basePath.'/normal_bis', + $basePath.'/normal_ter', + ], $loader->getPaths()); + $this->assertEquals([ + $basePath.'/named_final', + $basePath.'/named/../named_quater', + $basePath.'/named', + $basePath.'/named_bis', + $basePath.'/named_ter', + ], $loader->getPaths('named')); + + // do not use realpath here as it would make the test unuseful + $this->assertEquals($cacheKey, str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html'))); + $this->assertEquals("path (final)\n", $loader->getSourceContext('index.html')->getCode()); + $this->assertEquals("path (final)\n", $loader->getSourceContext('@__main__/index.html')->getCode()); + $this->assertEquals("named path (final)\n", $loader->getSourceContext('@named/index.html')->getCode()); + } + + public function getBasePaths() + { + return [ + [ + __DIR__.'/Fixtures', + 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', + null, + ], + [ + __DIR__.'/Fixtures/../Fixtures', + 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', + null, + ], + [ + 'test/Twig/Tests/Loader/Fixtures', + 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', + getcwd(), + ], + [ + 'Fixtures', + 'Fixtures/named_quater/named_absolute.html', + getcwd().'/test/Twig/Tests/Loader', + ], + [ + 'Fixtures', + 'Fixtures/named_quater/named_absolute.html', + getcwd().'/test/../test/Twig/Tests/Loader', + ], + ]; + } + + public function testEmptyConstructor() + { + $loader = new FilesystemLoader(); + $this->assertEquals([], $loader->getPaths()); + } + + public function testGetNamespaces() + { + $loader = new FilesystemLoader(sys_get_temp_dir()); + $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE], $loader->getNamespaces()); + + $loader->addPath(sys_get_temp_dir(), 'named'); + $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE, 'named'], $loader->getNamespaces()); + } + + public function testFindTemplateExceptionNamespace() + { + $basePath = __DIR__.'/Fixtures'; + + $loader = new FilesystemLoader([$basePath.'/normal']); + $loader->addPath($basePath.'/named', 'named'); + + try { + $loader->getSourceContext('@named/nowhere.html'); + } catch (\Exception $e) { + $this->assertInstanceOf('\Twig\Error\LoaderError', $e); + $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage()); + } + } + + public function testFindTemplateWithCache() + { + $basePath = __DIR__.'/Fixtures'; + + $loader = new FilesystemLoader([$basePath.'/normal']); + $loader->addPath($basePath.'/named', 'named'); + + // prime the cache for index.html in the named namespace + $namedSource = $loader->getSourceContext('@named/index.html')->getCode(); + $this->assertEquals("named path\n", $namedSource); + + // get index.html from the main namespace + $this->assertEquals("path\n", $loader->getSourceContext('index.html')->getCode()); + } + + public function testLoadTemplateAndRenderBlockWithCache() + { + $loader = new FilesystemLoader([]); + $loader->addPath(__DIR__.'/Fixtures/themes/theme2'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme'); + + $twig = new Environment($loader); + + $template = $twig->load('blocks.html.twig'); + $this->assertSame('block from theme 1', $template->renderBlock('b1', [])); + + $template = $twig->load('blocks.html.twig'); + $this->assertSame('block from theme 2', $template->renderBlock('b2', [])); + } + + public function getArrayInheritanceTests() + { + return [ + 'valid array inheritance' => ['array_inheritance_valid_parent.html.twig'], + 'array inheritance with null first template' => ['array_inheritance_null_parent.html.twig'], + 'array inheritance with empty first template' => ['array_inheritance_empty_parent.html.twig'], + 'array inheritance with non-existent first template' => ['array_inheritance_nonexistent_parent.html.twig'], + ]; + } + + /** + * @dataProvider getArrayInheritanceTests + * + * @param $templateName string Template name with array inheritance + */ + public function testArrayInheritance($templateName) + { + $loader = new FilesystemLoader([]); + $loader->addPath(__DIR__.'/Fixtures/inheritance'); + + $twig = new Environment($loader); + + $template = $twig->load($templateName); + $this->assertSame('VALID Child', $template->renderBlock('body', [])); + } + + /** + * @requires PHP 5.3 + */ + public function testLoadTemplateFromPhar() + { + $loader = new FilesystemLoader([]); + // phar-sample.phar was created with the following script: + // $f = new Phar('phar-test.phar'); + // $f->addFromString('hello.twig', 'hello from phar'); + $loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar'); + $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode()); + } + + public function testTemplateExistsAlwaysReturnsBool() + { + $loader = new FilesystemLoader([]); + $this->assertFalse($loader->exists("foo\0.twig")); + $this->assertFalse($loader->exists('../foo.twig')); + $this->assertFalse($loader->exists('@foo')); + $this->assertFalse($loader->exists('foo')); + $this->assertFalse($loader->exists('@foo/bar.twig')); + + $loader->addPath(__DIR__.'/Fixtures/normal'); + $this->assertTrue($loader->exists('index.html')); + $loader->addPath(__DIR__.'/Fixtures/normal', 'foo'); + $this->assertTrue($loader->exists('@foo/index.html')); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig new file mode 100644 index 0000000..6977ebf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['','parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig new file mode 100644 index 0000000..5b50a8b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['nonexistent.html.twig','parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig new file mode 100644 index 0000000..a16b3ad --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig @@ -0,0 +1,3 @@ +{% extends [null,'parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig new file mode 100644 index 0000000..4940dad --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig @@ -0,0 +1,3 @@ +{% extends ['parent.html.twig','spare_parent.html.twig'] %} + +{% block body %}{{ parent() }} Child{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig new file mode 100644 index 0000000..d594c0e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig @@ -0,0 +1 @@ +{% block body %}VALID{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig new file mode 100644 index 0000000..70b7360 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig @@ -0,0 +1 @@ +{% block body %}SPARE PARENT{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html new file mode 100644 index 0000000..9e5449c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html @@ -0,0 +1 @@ +named path diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html new file mode 100644 index 0000000..d3a272b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html @@ -0,0 +1 @@ +named path (bis) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html new file mode 100644 index 0000000..9f05d15 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html @@ -0,0 +1 @@ +named path (final) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html new file mode 100644 index 0000000..b1fb5f5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html @@ -0,0 +1 @@ +named path (quater) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html new file mode 100644 index 0000000..24fb68a --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html @@ -0,0 +1 @@ +named path (ter) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html new file mode 100644 index 0000000..e7a8fd4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html @@ -0,0 +1 @@ +path diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html new file mode 100644 index 0000000..bfa9160 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html @@ -0,0 +1 @@ +path (bis) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html new file mode 100644 index 0000000..73a089b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html @@ -0,0 +1 @@ +path (final) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html new file mode 100644 index 0000000..b7ad97d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html @@ -0,0 +1 @@ +path (ter) diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar new file mode 100644 index 0000000000000000000000000000000000000000..092bbfae3e4c98b308dc98bf7653ead68ae3ee6e GIT binary patch literal 6786 zcmb_hOLN=E5q5IqWh?g_#w@G>Mx-dx&rq@~*-JkvlEqM5ZLJv>0s=!4E4&r}B}(hP zu&2!Q zBabh)K{9u1HGj%1KeC-Pb*?NknLDZ3WLchaC$wigw=YvCNqCxBjRw1SkGX-9Wj0^> zS)N(uK(g;(@4Ff;dObhNdFt{cf9VJO@V}w zadTVhIUOAiN4vF@=ZiGjt$i4sBa?mjz}5||unkU5M`lALde!||Y~|^KBX%S7L!RM;DW<2Eh9F$qo(Np_{kp$|P=Z;JZ%l z$5DIP`o_6%GB@>;oK%Lsr_$prJU?!WwWLdxx5%-|y&_{t%<+X}#s{Cbzg_t5d5&Tf zd&&J3MOczVqCA#|5~={jZxP8VJ@M2LltUpRR3*B2Wbm{EHM^{k$mX$oe(7BB))akg zPJH?5;bJM2ir=M_YC43=(a;h~mJ?MA(gj))6(u25hzg-qvxaM0n{&tGsa1dBxO3im z5l49%2R#7h?{wI4e8D|7;A!YYJj#PB z^Cq?CQ7o@WkI_(CZ^t4}*pV{?wjhf^nA6BG97K+p8HnLlkv7PE@n+b6fvNWO%7Bx4 z#0fzOLQ)|k{dA(1;ov;>G_^vrI4)HlI@%rfVCMmQ8|Un0yofxClDqSm)%U3J?EfKR zdn7?0*k11E0pF)_eIucW#MsuHdz09^k|OiYJ{f2+Ayr55Bzcq7OY&{72x%n*HDtM7 zN*Q4hN|zr^V+vE9tQxA5v585=qYO<8la!8E2T3;ur`H-?CA`N<1FdwJn&*f|vwSX( zbczr&|61mh3fJ+7ByH=H6nIEZelbqR#;PaM72=ZPc5NT^_>^_X-{PJ)H&K5|uqy)f zXY&C6b9>#t>Lj3IH@Ne2API}dtQVmI=2Lw!w5ZrpxBzWz`CBja`W)LGJ*yWt=wxw+mS-@9K5XOZu$ckZ6v4b!? zpIc^sI6N8l7#gTQ?f#|I;*1 zd+a*!C#+~N%+D}>bA};02{0jA6oknNd8@&+au#v!fn^$}LP^Vw!zAVC7#_o$%1JXB zlzK*#JVn)Sc6D;?ajj|H+sU<`bU*2CS;q#CC)eGNI4mx5aSnNy5C+gSaaZnQLf!Q< zJPZAta%D+SAj&pF7I6Ehrwb)wWoLj}^34ZL)c#N$03zt0C4LN#-Fk!FMe9`8wY*E( z1gf|#v{}_wM_Ic|EmT)TS!siYErmisu51*w@0szR$>{jy>FZ3E^~zEw6%4o2Y!kPVY@6E}eU&?ts3%e=FGiu1bQDC@ZjmFrmEB8^ z4(uR27f}&olkGfy{J6>VBT+a|0xR+W)x}!Pmh^Q4a0$JKay;o)Dj%on4yPPX0X_6Ltez1B^mjZ>a#xRo3j8g)V~Wo(A#dxoZD$eP?| z2B{XsN`P%8S|m&YE)}(gd8lS;?JA`oWYb7xzf`GS(fE9BW_@U>e-u z*z)leK?^x)0`7dzIHnq!+NW}*#N@H4a-%b`)P~3i#@aLyQM&Um#zb4s0W3dy^oT5r ze>M3)SS=nkb48a^Zv<&qeZ@keYqMIn84T!~?qCgG5A2gu9P3wa-U8d-GzNq$Fw}*U z%97{Ng=LP82jF@}1y)-3Zq|KbAjcFeFd$E{kS^5&%r-?0HRucS{%A@`4&@~=zTP7x zN~h>tS}7S=brAT!(gh`5)=X}YqP1j|W+MR_H8;!nL_fbm99WYHR01RbPc|@hG?&0G zCF#xsyuXY9I0dd4^tI9k4TS<4;lOwXYCa`|A{1m$02+c616;DuJ*7J;Rv7O9Kk~wY z7oWDaDC02BBXDdmE6u17mCY>}-Gv~{96g5Aa}@c|5~Np$C0vD=qCuE3=`32uxKM=K zDZf>-@hD%Qp%qR!?XyYy%x#}}?K9p!!70eif2a zY}5~RK6da`w1npMH<9?ph>5S@BPWn}l+lC$>cYd9aRR@1r*9Vz52J-!82Nj$#F)uGaeJ3q1ba)V<%e^m|15jfyCh>Q8eK-+j5~*&>u~YU3y&d@s+0 zTH(#@$DUn{H4Fue=;e27SQRK?7Q_?F{0(|OfrP29CNWdh-#9=OWQ7yK^Nby&p@3Id z^w_~73jBzkjz|_A^DSxmtBFRLQr8BEG+n_*YRqa=G@77)9aE^#bg-&a`zwFpz;hU~ zw*C6>Xk@=QIUeB8Eklslv;8M`?%eqW{{Kq-#xMNT@PE#OAl}X|{n=+&{rQLgenr2R zUq3wj2MORuaIk3_hXVQj>yQ8J|L^Zl{`Bz2U;pj!umAb+FF!2*{Y$XDdVc);|E1Ux AZ~y=R literal 0 HcmV?d00001 diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig new file mode 100644 index 0000000..dd0cbc2 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig @@ -0,0 +1,3 @@ +{% block b1 %}block from theme 1{% endblock %} + +{% block b2 %}block from theme 1{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig new file mode 100644 index 0000000..07cf9db --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig @@ -0,0 +1,3 @@ +{% use '@default_theme/blocks.html.twig' %} + +{% block b2 %}block from theme 2{% endblock %} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php new file mode 100644 index 0000000..6a122fa --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php @@ -0,0 +1,39 @@ += 70000) { + $this->markTestSkipped('Extension is not available on PHP 7+'); + } + + $twig = new Environment(new ArrayLoader(['index' => '{{ d1.date }}{{ d2.date }}']), [ + 'debug' => true, + 'cache' => false, + 'autoescape' => false, + ]); + + $d1 = new \DateTime(); + $d2 = new \DateTime(); + $output = $twig->render('index', compact('d1', 'd2')); + + // If it fails, PHP will crash. + $this->assertEquals($output, $d1->date.$d2->date); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php new file mode 100644 index 0000000..1633e06 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php @@ -0,0 +1,37 @@ +assertEquals($body, $node->getNode('body')); + $this->assertTrue($node->getAttribute('value')); + } + + public function getTests() + { + $body = new Node([new TextNode('foo', 1)]); + $node = new AutoEscapeNode(true, $body, 1); + + return [ + [$node, "// line 1\necho \"foo\";"], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php new file mode 100644 index 0000000..ff021ff --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php @@ -0,0 +1,34 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + return [ + [new BlockReferenceNode('foo', 1), <<displayBlock('foo', \$context, \$blocks); +EOF + ], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php new file mode 100644 index 0000000..8b4a1ec --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php @@ -0,0 +1,43 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $body = new TextNode('foo', 1); + $node = new BlockNode('foo', $body, 1); + + return [ + [$node, <<assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = []; + + $expr = new ConstantExpression('This section is deprecated', 1); + $node = new DeprecatedNode($expr, 1, 'deprecated'); + $node->setTemplateName('foo.twig'); + + $tests[] = [$node, <<setTemplateName('foo.twig'); + + $tests[] = [$node, <<getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFunction(new TwigFunction('foo', 'foo', [])); + + $expr = new FunctionExpression('foo', new Node(), 1); + $node = new DeprecatedNode($expr, 1, 'deprecated'); + $node->setTemplateName('foo.twig'); + + $compiler = $this->getCompiler($environment); + $varName = $compiler->getVarName(); + + $tests[] = [$node, <<assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = []; + + $expr = new ConstantExpression('foo', 1); + $node = new DoNode($expr, 1); + $tests[] = [$node, "// line 1\n\"foo\";"]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php new file mode 100644 index 0000000..842dac4 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php @@ -0,0 +1,41 @@ +assertEquals($foo, $node->getNode(1)); + } + + public function getTests() + { + $elements = [ + new ConstantExpression('foo', 1), + new ConstantExpression('bar', 1), + + new ConstantExpression('bar', 1), + new ConstantExpression('foo', 1), + ]; + $node = new ArrayExpression($elements, 1); + + return [ + [$node, '["foo" => "bar", "bar" => "foo"]'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php new file mode 100644 index 0000000..47fddca --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php @@ -0,0 +1,32 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $node = new AssignNameExpression('foo', 1); + + return [ + [$node, '$context["foo"]'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php new file mode 100644 index 0000000..d91ee8e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AddBinary($left, $right, 1); + + return [ + [$node, '(1 + 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php new file mode 100644 index 0000000..61cc1c9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AndBinary($left, $right, 1); + + return [ + [$node, '(1 && 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php new file mode 100644 index 0000000..f8d4c6e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ConcatBinary($left, $right, 1); + + return [ + [$node, '(1 . 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php new file mode 100644 index 0000000..b605423 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new DivBinary($left, $right, 1); + + return [ + [$node, '(1 / 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php new file mode 100644 index 0000000..cb27e00 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new FloorDivBinary($left, $right, 1); + + return [ + [$node, '(int) floor((1 / 2))'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php new file mode 100644 index 0000000..c5497cd --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ModBinary($left, $right, 1); + + return [ + [$node, '(1 % 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php new file mode 100644 index 0000000..3b19b05 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new MulBinary($left, $right, 1); + + return [ + [$node, '(1 * 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php new file mode 100644 index 0000000..0f1c3bf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new OrBinary($left, $right, 1); + + return [ + [$node, '(1 || 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php new file mode 100644 index 0000000..9955c4b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php @@ -0,0 +1,38 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + public function getTests() + { + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new SubBinary($left, $right, 1); + + return [ + [$node, '(1 - 2)'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php new file mode 100644 index 0000000..32b5d19 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php @@ -0,0 +1,145 @@ + 'function', 'name' => 'date']); + $this->assertEquals(['U', null], $node->getArguments('date', ['format' => 'U', 'timestamp' => null])); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". + */ + public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['timestamp' => 123456, 'Y-m-d']); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Argument "format" is defined twice for function "date". + */ + public function testGetArgumentsWhenArgumentIsDefinedTwice() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'format' => 'U']); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". + */ + public function testGetArgumentsWithWrongNamedArgumentName() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown' => '']); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". + */ + public function testGetArgumentsWithWrongNamedArgumentNames() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". + */ + public function testResolveArgumentsWithMissingValueForOptionalArgument() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'substr_compare']); + $node->getArguments('substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]); + } + + public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_function']); + + $this->assertEquals(['arg1'], $node->getArguments([$this, 'customFunction'], ['arg1' => 'arg1'])); + } + + public function testGetArgumentsForStaticMethod() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_static_function']); + $this->assertEquals(['arg1'], $node->getArguments(__CLASS__.'::customStaticFunction', ['arg1' => 'arg1'])); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []". + */ + public function testResolveArgumentsWithMissingParameterForArbitraryArguments() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments([$this, 'customFunctionWithArbitraryArguments'], []); + } + + public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = []) + { + } + + public function customFunction($arg1, $arg2 = 'default', $arg3 = []) + { + } + + public function customFunctionWithArbitraryArguments() + { + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# + */ + public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', []); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# + */ + public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject() + { + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments(new CallableTestClass(), []); + } +} + +class Twig_Tests_Node_Expression_Call extends CallExpression +{ + public function getArguments($callable, $arguments) + { + return parent::getArguments($callable, $arguments); + } +} + +class CallableTestClass +{ + public function __invoke($required) + { + } +} + +function custom_Twig_Tests_Node_Expression_CallTest_function($required) +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php new file mode 100644 index 0000000..32be4d0 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php @@ -0,0 +1,42 @@ +assertEquals($expr1, $node->getNode('expr1')); + $this->assertEquals($expr2, $node->getNode('expr2')); + $this->assertEquals($expr3, $node->getNode('expr3')); + } + + public function getTests() + { + $tests = []; + + $expr1 = new ConstantExpression(1, 1); + $expr2 = new ConstantExpression(2, 1); + $expr3 = new ConstantExpression(3, 1); + $node = new ConditionalExpression($expr1, $expr2, $expr3, 1); + $tests[] = [$node, '((1) ? (2) : (3))']; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php new file mode 100644 index 0000000..ae38101 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php @@ -0,0 +1,33 @@ +assertEquals('foo', $node->getAttribute('value')); + } + + public function getTests() + { + $tests = []; + + $node = new ConstantExpression('foo', 1); + $tests[] = [$node, '"foo"']; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php new file mode 100644 index 0000000..1cca1a5 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -0,0 +1,161 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($name, $node->getNode('filter')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + public function getTests() + { + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFilter(new TwigFilter('bar', 'bar', ['needs_environment' => true])); + $environment->addFilter(new TwigFilter('barbar', 'twig_tests_filter_barbar', ['needs_context' => true, 'is_variadic' => true])); + + $tests = []; + + $expr = new ConstantExpression('foo', 1); + $node = $this->createFilter($expr, 'upper'); + $node = $this->createFilter($node, 'number_format', [new ConstantExpression(2, 1), new ConstantExpression('.', 1), new ConstantExpression(',', 1)]); + + if (\function_exists('mb_get_info')) { + $tests[] = [$node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")']; + } else { + $tests[] = [$node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")']; + } + + // named arguments + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + 'format' => new ConstantExpression('d/m/Y H:i:s P', 1), + ]); + $tests[] = [$node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")']; + + // skip an optional argument + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + ]); + $tests[] = [$node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")']; + + // underscores vs camelCase for named arguments + $string = new ConstantExpression('abc', 1); + $node = $this->createFilter($string, 'reverse', [ + 'preserve_keys' => new ConstantExpression(true, 1), + ]); + $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)']; + $node = $this->createFilter($string, 'reverse', [ + 'preserveKeys' => new ConstantExpression(true, 1), + ]); + $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)']; + + // filter as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createFilter(new ConstantExpression('foo', 1), 'anonymous'); + $tests[] = [$node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), ["foo"])']; + } + + // needs environment + $node = $this->createFilter($string, 'bar'); + $tests[] = [$node, 'bar($this->env, "abc")', $environment]; + + $node = $this->createFilter($string, 'bar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'bar($this->env, "abc", "bar")', $environment]; + + // arbitrary named arguments + $node = $this->createFilter($string, 'barbar'); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc")', $environment]; + + $node = $this->createFilter($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, null, ["foo" => "bar"])', $environment]; + + $node = $this->createFilter($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment]; + + $node = $this->createFilter($string, 'barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment]; + + return $tests; + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. + */ + public function testCompileWithWrongNamedArgumentName() + { + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'foobar' => new ConstantExpression('America/Chicago', 1), + ]); + + $compiler = $this->getCompiler(); + $compiler->compile($node); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Value for argument "from" is required for filter "replace" at line 1. + */ + public function testCompileWithMissingNamedArgument() + { + $value = new ConstantExpression(0, 1); + $node = $this->createFilter($value, 'replace', [ + 'to' => new ConstantExpression('foo', 1), + ]); + + $compiler = $this->getCompiler(); + $compiler->compile($node); + } + + protected function createFilter($node, $name, array $arguments = []) + { + $name = new ConstantExpression($name, 1); + $arguments = new Node($arguments); + + return new FilterExpression($node, $name, $arguments, 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/FilterInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = []) +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php new file mode 100644 index 0000000..51001a6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -0,0 +1,117 @@ +assertEquals($name, $node->getAttribute('name')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + public function getTests() + { + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFunction(new TwigFunction('foo', 'foo', [])); + $environment->addFunction(new TwigFunction('bar', 'bar', ['needs_environment' => true])); + $environment->addFunction(new TwigFunction('foofoo', 'foofoo', ['needs_context' => true])); + $environment->addFunction(new TwigFunction('foobar', 'foobar', ['needs_environment' => true, 'needs_context' => true])); + $environment->addFunction(new TwigFunction('barbar', 'twig_tests_function_barbar', ['is_variadic' => true])); + + $tests = []; + + $node = $this->createFunction('foo'); + $tests[] = [$node, 'foo()', $environment]; + + $node = $this->createFunction('foo', [new ConstantExpression('bar', 1), new ConstantExpression('foobar', 1)]); + $tests[] = [$node, 'foo("bar", "foobar")', $environment]; + + $node = $this->createFunction('bar'); + $tests[] = [$node, 'bar($this->env)', $environment]; + + $node = $this->createFunction('bar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'bar($this->env, "bar")', $environment]; + + $node = $this->createFunction('foofoo'); + $tests[] = [$node, 'foofoo($context)', $environment]; + + $node = $this->createFunction('foofoo', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'foofoo($context, "bar")', $environment]; + + $node = $this->createFunction('foobar'); + $tests[] = [$node, 'foobar($this->env, $context)', $environment]; + + $node = $this->createFunction('foobar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'foobar($this->env, $context, "bar")', $environment]; + + // named arguments + $node = $this->createFunction('date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + 'date' => new ConstantExpression(0, 1), + ]); + $tests[] = [$node, 'twig_date_converter($this->env, 0, "America/Chicago")']; + + // arbitrary named arguments + $node = $this->createFunction('barbar'); + $tests[] = [$node, 'twig_tests_function_barbar()', $environment]; + + $node = $this->createFunction('barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_function_barbar(null, null, ["foo" => "bar"])', $environment]; + + $node = $this->createFunction('barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_function_barbar(null, "bar")', $environment]; + + $node = $this->createFunction('barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_function_barbar("1", "2", [0 => "3", "foo" => "bar"])', $environment]; + + // function as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createFunction('anonymous', [new ConstantExpression('foo', 1)]); + $tests[] = [$node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), ["foo"])']; + } + + return $tests; + } + + protected function createFunction($name, array $arguments = []) + { + return new FunctionExpression($name, new Node($arguments), 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/FunctionInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = []) +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php new file mode 100644 index 0000000..036b421 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php @@ -0,0 +1,57 @@ +addElement(new NameExpression('foo', 1)); + $args->addElement(new ConstantExpression('bar', 1)); + $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1); + + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($attr, $node->getNode('attribute')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals(Template::ARRAY_CALL, $node->getAttribute('type')); + } + + public function getTests() + { + $tests = []; + + $expr = new NameExpression('foo', 1); + $attr = new ConstantExpression('bar', 1); + $args = new ArrayExpression([], 1); + $node = new GetAttrExpression($expr, $attr, $args, Template::ANY_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [])', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))]; + + $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [], "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))]; + + $args = new ArrayExpression([], 1); + $args->addElement(new NameExpression('foo', 1)); + $args->addElement(new ConstantExpression('bar', 1)); + $node = new GetAttrExpression($expr, $attr, $args, Template::METHOD_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [0 => %s, 1 => "bar"], "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php new file mode 100644 index 0000000..269c04b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php @@ -0,0 +1,47 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $node = new NameExpression('foo', 1); + $context = new NameExpression('_context', 1); + + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]); + $env1 = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => false]); + + if (PHP_VERSION_ID >= 70000) { + $output = '($context["foo"] ?? $this->getContext($context, "foo"))'; + } elseif (PHP_VERSION_ID >= 50400) { + $output = '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))'; + } else { + $output = '$this->getContext($context, "foo")'; + } + + return [ + [$node, "// line 1\n".$output, $env], + [$node, $this->getVariableGetter('foo', 1), $env1], + [$context, "// line 1\n\$context"], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php new file mode 100644 index 0000000..eb7c335 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php @@ -0,0 +1,36 @@ += 70000) { + $tests[] = [$node, "((// line 1\n\$context[\"foo\"]) ?? (2))"]; + } elseif (PHP_VERSION_ID >= 50400) { + $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"]; + } else { + $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"]; + } + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php new file mode 100644 index 0000000..5ea41d8 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php @@ -0,0 +1,6 @@ +addFilter(new \Twig\TwigFilter('anonymous', function () {})); + +return $env; diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php new file mode 100644 index 0000000..44cd979 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php @@ -0,0 +1,6 @@ +addFunction(new \Twig\TwigFunction('anonymous', function () {})); + +return $env; diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php new file mode 100644 index 0000000..1f30a71 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php @@ -0,0 +1,6 @@ +addTest(new \Twig\TwigTest('anonymous', function () {})); + +return $env; diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php new file mode 100644 index 0000000..0c3a9aa --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php @@ -0,0 +1,31 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $tests = []; + $tests[] = [new ParentExpression('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)']; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php new file mode 100644 index 0000000..ef7fb66 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -0,0 +1,90 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals($name, $node->getAttribute('name')); + } + + public function getTests() + { + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addTest(new TwigTest('barbar', 'twig_tests_test_barbar', ['is_variadic' => true, 'need_context' => true])); + + $tests = []; + + $expr = new ConstantExpression('foo', 1); + $node = new NullTest($expr, 'null', new Node([]), 1); + $tests[] = [$node, '(null === "foo")']; + + // test as an anonymous function + if (PHP_VERSION_ID >= 50300) { + $node = $this->createTest(new ConstantExpression('foo', 1), 'anonymous', [new ConstantExpression('foo', 1)]); + $tests[] = [$node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), ["foo", "foo"])']; + } + + // arbitrary named arguments + $string = new ConstantExpression('abc', 1); + $node = $this->createTest($string, 'barbar'); + $tests[] = [$node, 'twig_tests_test_barbar("abc")', $environment]; + + $node = $this->createTest($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", null, null, ["foo" => "bar"])', $environment]; + + $node = $this->createTest($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", null, "bar")', $environment]; + + $node = $this->createTest($string, 'barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment]; + + return $tests; + } + + protected function createTest($node, $name, array $arguments = []) + { + return new TestExpression($node, $name, new Node($arguments), 1); + } + + protected function getEnvironment() + { + if (PHP_VERSION_ID >= 50300) { + return include 'PHP53/TestInclude.php'; + } + + return parent::getEnvironment(); + } +} + +function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = []) +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php new file mode 100644 index 0000000..6c976ad --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php @@ -0,0 +1,36 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new ConstantExpression(1, 1); + $node = new NegUnary($node, 1); + + return [ + [$node, '-1'], + [new NegUnary($node, 1), '- -1'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php new file mode 100644 index 0000000..493a37e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php @@ -0,0 +1,35 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new ConstantExpression(1, 1); + $node = new NotUnary($node, 1); + + return [ + [$node, '!1'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php new file mode 100644 index 0000000..015446d --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php @@ -0,0 +1,35 @@ +assertEquals($expr, $node->getNode('node')); + } + + public function getTests() + { + $node = new ConstantExpression(1, 1); + $node = new PosUnary($node, 1); + + return [ + [$node, '+1'], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php new file mode 100644 index 0000000..44b986e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php @@ -0,0 +1,199 @@ +setAttribute('with_loop', false); + + $this->assertEquals($keyTarget, $node->getNode('key_target')); + $this->assertEquals($valueTarget, $node->getNode('value_target')); + $this->assertEquals($seq, $node->getNode('seq')); + $this->assertTrue($node->getAttribute('ifexpr')); + $this->assertInstanceOf('\Twig\Node\IfNode', $node->getNode('body')); + $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); + $this->assertFalse($node->hasNode('else')); + + $else = new PrintNode(new NameExpression('foo', 1), 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', false); + $this->assertEquals($else, $node->getNode('else')); + } + + public function getTests() + { + $tests = []; + + $keyTarget = new AssignNameExpression('key', 1); + $valueTarget = new AssignNameExpression('item', 1); + $seq = new NameExpression('items', 1); + $ifexpr = null; + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); + $else = null; + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', false); + + $tests[] = [$node, <<getVariableGetter('items')}); +foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ]; + + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); + $ifexpr = null; + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); + $else = null; + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = [$node, <<getVariableGetter('values')}); +\$context['loop'] = [ + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +]; +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ]; + + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); + $ifexpr = new ConstantExpression(true, 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); + $else = null; + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = [$node, <<getVariableGetter('values')}); +\$context['loop'] = [ + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +]; +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + if (true) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ]; + + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); + $ifexpr = null; + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); + $else = new PrintNode(new NameExpression('foo', 1), 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node->setAttribute('with_loop', true); + + $tests[] = [$node, <<getVariableGetter('values')}); +\$context['_iterated'] = false; +\$context['loop'] = [ + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +]; +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + \$context['_iterated'] = true; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +if (!\$context['_iterated']) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_intersect_key(\$context, \$_parent) + \$_parent; +EOF + ]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php new file mode 100644 index 0000000..82a6959 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php @@ -0,0 +1,95 @@ +assertEquals($t, $node->getNode('tests')); + $this->assertFalse($node->hasNode('else')); + + $else = new PrintNode(new NameExpression('bar', 1), 1); + $node = new IfNode($t, $else, 1); + $this->assertEquals($else, $node->getNode('else')); + } + + public function getTests() + { + $tests = []; + + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + ], [], 1); + $else = null; + $node = new IfNode($t, $else, 1); + + $tests[] = [$node, <<getVariableGetter('foo')}; +} +EOF + ]; + + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + new ConstantExpression(false, 1), + new PrintNode(new NameExpression('bar', 1), 1), + ], [], 1); + $else = null; + $node = new IfNode($t, $else, 1); + + $tests[] = [$node, <<getVariableGetter('foo')}; +} elseif (false) { + echo {$this->getVariableGetter('bar')}; +} +EOF + ]; + + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + ], [], 1); + $else = new PrintNode(new NameExpression('bar', 1), 1); + $node = new IfNode($t, $else, 1); + + $tests[] = [$node, <<getVariableGetter('foo')}; +} else { + echo {$this->getVariableGetter('bar')}; +} +EOF + ]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php new file mode 100644 index 0000000..2118bff --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -0,0 +1,45 @@ +assertEquals($macro, $node->getNode('expr')); + $this->assertEquals($var, $node->getNode('var')); + } + + public function getTests() + { + $tests = []; + + $macro = new ConstantExpression('foo.twig', 1); + $var = new AssignNameExpression('macro', 1); + $node = new ImportNode($macro, $var, 1); + + $tests[] = [$node, <<loadTemplate("foo.twig", null, 1)->unwrap(); +EOF + ]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php new file mode 100644 index 0000000..ae8ff07 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php @@ -0,0 +1,93 @@ +assertFalse($node->hasNode('variables')); + $this->assertEquals($expr, $node->getNode('expr')); + $this->assertFalse($node->getAttribute('only')); + + $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1); + $node = new IncludeNode($expr, $vars, true, false, 1); + $this->assertEquals($vars, $node->getNode('variables')); + $this->assertTrue($node->getAttribute('only')); + } + + public function getTests() + { + $tests = []; + + $expr = new ConstantExpression('foo.twig', 1); + $node = new IncludeNode($expr, null, false, false, 1); + $tests[] = [$node, <<loadTemplate("foo.twig", null, 1)->display(\$context); +EOF + ]; + + $expr = new ConditionalExpression( + new ConstantExpression(true, 1), + new ConstantExpression('foo', 1), + new ConstantExpression('foo', 1), + 0 + ); + $node = new IncludeNode($expr, null, false, false, 1); + $tests[] = [$node, <<loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context); +EOF + ]; + + $expr = new ConstantExpression('foo.twig', 1); + $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1); + $node = new IncludeNode($expr, $vars, false, false, 1); + $tests[] = [$node, <<loadTemplate("foo.twig", null, 1)->display(twig_array_merge(\$context, ["foo" => true])); +EOF + ]; + + $node = new IncludeNode($expr, $vars, true, false, 1); + $tests[] = [$node, <<loadTemplate("foo.twig", null, 1)->display(twig_to_array(["foo" => true])); +EOF + ]; + + $node = new IncludeNode($expr, $vars, true, true, 1); + $tests[] = [$node, <<loadTemplate("foo.twig", null, 1); +} catch (LoaderError \$e) { + // ignore missing template +} +if (\$__internal_%s) { + \$__internal_%s->display(twig_to_array(["foo" => true])); +} +EOF + , null, true]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php new file mode 100644 index 0000000..424d7da --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -0,0 +1,81 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($arguments, $node->getNode('arguments')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + public function getTests() + { + $body = new TextNode('foo', 1); + $arguments = new Node([ + 'foo' => new ConstantExpression(null, 1), + 'bar' => new ConstantExpression('Foo', 1), + ], [], 1); + $node = new MacroNode('foo', $body, $arguments, 1); + + if (PHP_VERSION_ID >= 50600) { + $declaration = ', ...$__varargs__'; + $varargs = '$__varargs__'; + } else { + $declaration = ''; + $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : []'; + } + + return [ + [$node, <<env->mergeGlobals([ + "foo" => \$__foo__, + "bar" => \$__bar__, + "varargs" => $varargs, + ]); + + \$blocks = []; + + ob_start(function () { return ''; }); + try { + echo "foo"; + } catch (\Exception \$e) { + ob_end_clean(); + + throw \$e; + } catch (\Throwable \$e) { + ob_end_clean(); + + throw \$e; + } + + return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset()); +} +EOF + ], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php new file mode 100644 index 0000000..1eb337f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -0,0 +1,268 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($source->getName(), $node->getTemplateName()); + } + + public function getTests() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + + $tests = []; + + $body = new TextNode('foo', 1); + $extends = null; + $blocks = new Node(); + $macros = new Node(); + $traits = new Node(); + $source = new Source('{{ foo }}', 'foo.twig'); + + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<parent = false; + + \$this->blocks = [ + ]; + } + + protected function doDisplay(array \$context, array \$blocks = []) + { + // line 1 + echo "foo"; + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function getDebugInfo() + { + return array ( 30 => 1,); + } + + /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ + public function getSource() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); + + return \$this->getSourceContext()->getCode(); + } + + public function getSourceContext() + { + return new Source("", "foo.twig", ""); + } +} +EOF + , $twig, true]; + + $import = new ImportNode(new ConstantExpression('foo.twig', 1), new AssignNameExpression('macro', 1), 2); + + $body = new Node([$import]); + $extends = new ConstantExpression('layout.twig', 1); + + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<blocks = [ + ]; + } + + protected function doGetParent(array \$context) + { + // line 1 + return "layout.twig"; + } + + protected function doDisplay(array \$context, array \$blocks = []) + { + // line 2 + \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2)->unwrap(); + // line 1 + \$this->parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 36 => 1, 34 => 2, 28 => 1,); + } + + /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ + public function getSource() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); + + return \$this->getSourceContext()->getCode(); + } + + public function getSourceContext() + { + return new Source("", "foo.twig", ""); + } +} +EOF + , $twig, true]; + + $set = new SetNode(false, new Node([new AssignNameExpression('foo', 4)]), new Node([new ConstantExpression('foo', 4)]), 4); + $body = new Node([$set]); + $extends = new ConditionalExpression( + new ConstantExpression(true, 2), + new ConstantExpression('foo', 2), + new ConstantExpression('foo', 2), + 2 + ); + + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['debug' => true]); + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2); + } + + protected function doDisplay(array \$context, array \$blocks = []) + { + // line 4 + \$context["foo"] = "foo"; + // line 2 + \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 28 => 2, 26 => 4, 20 => 2,); + } + + /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ + public function getSource() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); + + return \$this->getSourceContext()->getCode(); + } + + public function getSourceContext() + { + return new Source("{{ foo }}", "foo.twig", ""); + } +} +EOF + , $twig, true]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php new file mode 100644 index 0000000..efb5eba --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php @@ -0,0 +1,33 @@ +assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = []; + $tests[] = [new PrintNode(new ConstantExpression('foo', 1), 1), "// line 1\necho \"foo\";"]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php new file mode 100644 index 0000000..7dd3e08 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php @@ -0,0 +1,47 @@ +assertEquals($body, $node->getNode('body')); + } + + public function getTests() + { + $tests = []; + + $body = new TextNode('foo', 1); + $node = new SandboxNode($body, 1); + + $tests[] = [$node, <<sandbox->isSandboxed()) { + \$this->sandbox->enableSandbox(); +} +echo "foo"; +if (!\$alreadySandboxed) { + \$this->sandbox->disableSandbox(); +} +EOF + ]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php new file mode 100644 index 0000000..ff4e43e --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php @@ -0,0 +1,78 @@ +assertEquals($names, $node->getNode('names')); + $this->assertEquals($values, $node->getNode('values')); + $this->assertFalse($node->getAttribute('capture')); + } + + public function getTests() + { + $tests = []; + + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new Node([new ConstantExpression('foo', 1)], [], 1); + $node = new SetNode(false, $names, $values, 1); + $tests[] = [$node, <<env->getCharset()); +EOF + ]; + + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new TextNode('foo', 1); + $node = new SetNode(true, $names, $values, 1); + $tests[] = [$node, <<env->getCharset()); +EOF + ]; + + $names = new Node([new AssignNameExpression('foo', 1), new AssignNameExpression('bar', 1)], [], 1); + $values = new Node([new ConstantExpression('foo', 1), new NameExpression('bar', 1)], [], 1); + $node = new SetNode(false, $names, $values, 1); + $tests[] = [$node, <<getVariableGetter('bar')}]; +EOF + ]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php new file mode 100644 index 0000000..13f400f --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php @@ -0,0 +1,42 @@ +
    foo
    ', 1)]); + $node = new SpacelessNode($body, 1); + + $this->assertEquals($body, $node->getNode('body')); + } + + public function getTests() + { + $body = new Node([new TextNode('
    foo
    ', 1)]); + $node = new SpacelessNode($body, 1); + + return [ + [$node, <<
    foo
    "; +echo trim(preg_replace('/>\s+<', ob_get_clean())); +EOF + ], + ]; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php new file mode 100644 index 0000000..6735083 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php @@ -0,0 +1,31 @@ +assertEquals('foo', $node->getAttribute('data')); + } + + public function getTests() + { + $tests = []; + $tests[] = [new TextNode('foo', 1), "// line 1\necho \"foo\";"]; + + return $tests; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php new file mode 100644 index 0000000..2e08aac --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php @@ -0,0 +1,47 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $traverser = new NodeTraverser($env, [new IdentityVisitor()]); + $n = new Node([new Node([]), null, new Node([])]); + $this->assertCount(3, $traverser->traverse($n)); + } +} + +class IdentityVisitor implements NodeVisitorInterface +{ + public function enterNode(\Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function leaveNode(\Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php new file mode 100644 index 0000000..9afdbc6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php @@ -0,0 +1,129 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + + $stream = $env->parse($env->tokenize(new Source('{{ block("foo") }}', 'index'))); + + $node = $stream->getNode('body')->getNode(0); + + $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderParentBlockOptimizer() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + + $stream = $env->parse($env->tokenize(new Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'))); + + $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); + + $this->assertInstanceOf('\Twig\Node\Expression\ParentExpression', $node); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderVariableBlockOptimizer() + { + if (PHP_VERSION_ID >= 50400) { + $this->markTestSkipped('not needed on PHP >= 5.4'); + } + + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $stream = $env->parse($env->tokenize(new Source('{{ block(name|lower) }}', 'index'))); + + $node = $stream->getNode('body')->getNode(0)->getNode(1); + + $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node); + $this->assertTrue($node->getAttribute('output')); + } + + /** + * @dataProvider getTestsForForOptimizer + */ + public function testForOptimizer($template, $expected) + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false]); + + $stream = $env->parse($env->tokenize(new Source($template, 'index'))); + + foreach ($expected as $target => $withLoop) { + $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); + } + } + + public function getTestsForForOptimizer() + { + return [ + ['{% for i in foo %}{% endfor %}', ['i' => false]], + + ['{% for i in foo %}{{ loop.index }}{% endfor %}', ['i' => true]], + + ['{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]], + + ['{% for i in foo %}{% include "foo" %}{% endfor %}', ['i' => true]], + + ['{% for i in foo %}{% include "foo" only %}{% endfor %}', ['i' => false]], + + ['{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', ['i' => false]], + + ['{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', ['i' => true]], + + ['{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => true]], + + ['{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]], + + ['{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => false]], + + ['{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]], + + ['{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]], + + ['{% for i in foo %}{{ include("foo") }}{% endfor %}', ['i' => true]], + + ['{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', ['i' => false]], + + ['{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', ['i' => true]], + + ['{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', ['i' => false]], + + ['{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', ['i' => true]], + ]; + } + + public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) + { + if (null === $node) { + return; + } + + foreach ($node as $n) { + if ($n instanceof ForNode) { + if ($target === $n->getNode('value_target')->getAttribute('name')) { + return $withLoop == $n->getAttribute('with_loop'); + } + } + + $ret = $this->checkForConfiguration($n, $target, $withLoop); + if (null !== $ret) { + return $ret; + } + } + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ParserTest.php new file mode 100644 index 0000000..bb39dc9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -0,0 +1,217 @@ +getParser(); + $parser->setMacro('parent', $this->getMockBuilder('\Twig\Node\MacroNode')->disableOriginalConstructor()->getMock()); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1? + */ + public function testUnknownTag() + { + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foo', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ]); + $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $parser->parse($stream); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unknown "foobar" tag at line 1. + */ + public function testUnknownTagWithoutSuggestions() + { + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foobar', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ]); + $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $parser->parse($stream); + } + + /** + * @dataProvider getFilterBodyNodesData + */ + public function testFilterBodyNodes($input, $expected) + { + $parser = $this->getParser(); + + $this->assertEquals($expected, $parser->filterBodyNodes($input)); + } + + public function getFilterBodyNodesData() + { + return [ + [ + new Node([new TextNode(' ', 1)]), + new Node([]), + ], + [ + $input = new Node([new SetNode(false, new Node(), new Node(), 1)]), + $input, + ], + [ + $input = new Node([new SetNode(true, new Node(), new Node([new Node([new TextNode('foo', 1)])]), 1)]), + $input, + ], + ]; + } + + /** + * @dataProvider getFilterBodyNodesDataThrowsException + * @expectedException \Twig\Error\SyntaxError + */ + public function testFilterBodyNodesThrowsException($input) + { + $parser = $this->getParser(); + + $parser->filterBodyNodes($input); + } + + public function getFilterBodyNodesDataThrowsException() + { + return [ + [new TextNode('foo', 1)], + [new Node([new Node([new TextNode('foo', 1)])])], + ]; + } + + /** + * @dataProvider getFilterBodyNodesWithBOMData + */ + public function testFilterBodyNodesWithBOM($emptyNode) + { + $this->assertNull($this->getParser()->filterBodyNodes(new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyNode, 1))); + } + + public function getFilterBodyNodesWithBOMData() + { + return [ + [' '], + ["\t"], + ["\n"], + ["\n\t\n "], + ]; + } + + public function testParseIsReentrant() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [ + 'autoescape' => false, + 'optimizations' => 0, + ]); + $twig->addTokenParser(new TestTokenParser()); + + $parser = new Parser($twig); + + $parser->parse(new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'test', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::VAR_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foo', 1), + new Token(Token::VAR_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ])); + + $this->assertNull($parser->getParent()); + } + + public function testGetVarName() + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [ + 'autoescape' => false, + 'optimizations' => 0, + ]); + + $twig->parse($twig->tokenize(new Source(<<addToAssertionCount(1); + } + + protected function getParser() + { + $parser = new TestParser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $parser->setParent(new Node()); + $parser->stream = new TokenStream([]); + + return $parser; + } +} + +class TestParser extends Parser +{ + public $stream; + + public function filterBodyNodes(Twig_NodeInterface $node) + { + return parent::filterBodyNodes($node); + } +} + +class TestTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + // simulate the parsing of another template right in the middle of the parsing of the current template + $this->parser->parse(new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'extends', 1), + new Token(Token::STRING_TYPE, 'base', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ])); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new Node([]); + } + + public function getTag() + { + return 'test'; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php new file mode 100644 index 0000000..508f79c --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php @@ -0,0 +1,105 @@ +getIndexProfile( + [ + $this->getEmbeddedBlockProfile(), + $this->getEmbeddedTemplateProfile( + [ + $this->getIncludedTemplateProfile(), + ] + ), + $this->getMacroProfile(), + $this->getEmbeddedTemplateProfile( + [ + $this->getIncludedTemplateProfile(), + ] + ), + ] + ), + ]; + + $p = new \ReflectionProperty($profile, 'profiles'); + $p->setAccessible(true); + $p->setValue($profile, $subProfiles); + + return $profile; + } + + private function getIndexProfile(array $subProfiles = []) + { + return $this->generateProfile('main', 1, 'template', 'index.twig', $subProfiles); + } + + private function getEmbeddedBlockProfile(array $subProfiles = []) + { + return $this->generateProfile('body', 0.0001, 'block', 'embedded.twig', $subProfiles); + } + + private function getEmbeddedTemplateProfile(array $subProfiles = []) + { + return $this->generateProfile('main', 0.0001, 'template', 'embedded.twig', $subProfiles); + } + + private function getIncludedTemplateProfile(array $subProfiles = []) + { + return $this->generateProfile('main', 0.0001, 'template', 'included.twig', $subProfiles); + } + + private function getMacroProfile(array $subProfiles = []) + { + return $this->generateProfile('foo', 0.0001, 'macro', 'index.twig', $subProfiles); + } + + /** + * @param string $name + * @param float $duration + * @param bool $isTemplate + * @param string $type + * @param string $templateName + * @param array $subProfiles + * + * @return Profile + */ + private function generateProfile($name, $duration, $type, $templateName, array $subProfiles = []) + { + $profile = new Profile($templateName, $type, $name); + + $p = new \ReflectionProperty($profile, 'profiles'); + $p->setAccessible(true); + $p->setValue($profile, $subProfiles); + + $starts = new \ReflectionProperty($profile, 'starts'); + $starts->setAccessible(true); + $starts->setValue($profile, [ + 'wt' => 0, + 'mu' => 0, + 'pmu' => 0, + ]); + $ends = new \ReflectionProperty($profile, 'ends'); + $ends->setAccessible(true); + $ends->setValue($profile, [ + 'wt' => $duration, + 'mu' => 0, + 'pmu' => 0, + ]); + + return $profile; + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php new file mode 100644 index 0000000..26ef2da --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php @@ -0,0 +1,34 @@ +assertStringMatchesFormat(<<index.twig//1 %d %d %d +index.twig==>embedded.twig::block(body)//1 %d %d 0 +index.twig==>embedded.twig//2 %d %d %d +embedded.twig==>included.twig//2 %d %d %d +index.twig==>index.twig::macro(foo)//1 %d %d %d +EOF + , $dumper->dump($this->getProfile())); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php new file mode 100644 index 0000000..e04bbcf --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php @@ -0,0 +1,32 @@ +assertStringMatchesFormat(<<main %d.%dms/%d% +└ index.twig %d.%dms/%d% + └ embedded.twig::block(body) + └ embedded.twig + │ └ included.twig + └ index.twig::macro(foo) + └ embedded.twig + └ included.twig + +EOF + , $dumper->dump($this->getProfile())); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php new file mode 100644 index 0000000..e36d0ad --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php @@ -0,0 +1,32 @@ +assertStringMatchesFormat(<<dump($this->getProfile())); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php new file mode 100644 index 0000000..18e2a5b --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php @@ -0,0 +1,112 @@ +assertEquals('template', $profile->getTemplate()); + $this->assertEquals('type', $profile->getType()); + $this->assertEquals('name', $profile->getName()); + } + + public function testIsRoot() + { + $profile = new Profile('template', Profile::ROOT); + $this->assertTrue($profile->isRoot()); + + $profile = new Profile('template', Profile::TEMPLATE); + $this->assertFalse($profile->isRoot()); + } + + public function testIsTemplate() + { + $profile = new Profile('template', Profile::TEMPLATE); + $this->assertTrue($profile->isTemplate()); + + $profile = new Profile('template', Profile::ROOT); + $this->assertFalse($profile->isTemplate()); + } + + public function testIsBlock() + { + $profile = new Profile('template', Profile::BLOCK); + $this->assertTrue($profile->isBlock()); + + $profile = new Profile('template', Profile::ROOT); + $this->assertFalse($profile->isBlock()); + } + + public function testIsMacro() + { + $profile = new Profile('template', Profile::MACRO); + $this->assertTrue($profile->isMacro()); + + $profile = new Profile('template', Profile::ROOT); + $this->assertFalse($profile->isMacro()); + } + + public function testGetAddProfile() + { + $profile = new Profile(); + $profile->addProfile($a = new Profile()); + $profile->addProfile($b = new Profile()); + + $this->assertSame([$a, $b], $profile->getProfiles()); + $this->assertSame([$a, $b], iterator_to_array($profile)); + } + + public function testGetDuration() + { + $profile = new Profile(); + usleep(1); + $profile->leave(); + + $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration())); + } + + public function testSerialize() + { + $profile = new Profile('template', 'type', 'name'); + $profile1 = new Profile('template1', 'type1', 'name1'); + $profile->addProfile($profile1); + $profile->leave(); + $profile1->leave(); + + $profile2 = unserialize(serialize($profile)); + $profiles = $profile->getProfiles(); + $this->assertCount(1, $profiles); + $profile3 = $profiles[0]; + + $this->assertEquals($profile->getTemplate(), $profile2->getTemplate()); + $this->assertEquals($profile->getType(), $profile2->getType()); + $this->assertEquals($profile->getName(), $profile2->getName()); + $this->assertEquals($profile->getDuration(), $profile2->getDuration()); + + $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate()); + $this->assertEquals($profile1->getType(), $profile3->getType()); + $this->assertEquals($profile1->getName(), $profile3->getName()); + } + + public function testReset() + { + $profile = new Profile(); + usleep(1); + $profile->leave(); + $profile->reset(); + + $this->assertEquals(0, $profile->getDuration()); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateTest.php new file mode 100644 index 0000000..1b42b93 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -0,0 +1,812 @@ +getMockForAbstractClass('\Twig\Template', [], '', false); + $template->displayBlock('foo', [], ['foo' => [new \stdClass(), 'foo']]); + } + + /** + * @dataProvider getAttributeExceptions + */ + public function testGetAttributeExceptions($template, $message) + { + $templates = ['index' => $template]; + $env = new Environment(new ArrayLoader($templates), ['strict_variables' => true]); + $template = $env->load('index'); + + $context = [ + 'string' => 'foo', + 'null' => null, + 'empty_array' => [], + 'array' => ['foo' => 'foo'], + 'array_access' => new Twig_TemplateArrayAccessObject(), + 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), + 'object' => new \stdClass(), + ]; + + try { + $template->render($context); + $this->fail('Accessing an invalid attribute should throw an exception.'); + } catch (RuntimeError $e) { + $this->assertSame(sprintf($message, 'index'), $e->getMessage()); + } + } + + public function getAttributeExceptions() + { + return [ + ['{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'], + ['{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'], + ['{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'], + ['{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'], + ['{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'], + ['{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'], + ['{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'], + ['{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'], + ['{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'], + ['{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.'], + ['{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.'], + ]; + } + + /** + * @dataProvider getGetAttributeWithSandbox + */ + public function testGetAttributeWithSandbox($object, $item, $allowed) + { + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $policy = new SecurityPolicy([], [], [/*method*/], [/*prop*/], []); + $twig->addExtension(new SandboxExtension($policy, !$allowed)); + $template = new Twig_TemplateTest($twig); + + try { + $template->getAttribute($object, $item, [], 'any'); + + if (!$allowed) { + $this->fail(); + } else { + $this->addToAssertionCount(1); + } + } catch (SecurityError $e) { + if ($allowed) { + $this->fail(); + } else { + $this->addToAssertionCount(1); + } + + $this->assertContains('is not allowed', $e->getMessage()); + } + } + + public function getGetAttributeWithSandbox() + { + return [ + [new Twig_TemplatePropertyObject(), 'defined', false], + [new Twig_TemplatePropertyObject(), 'defined', true], + [new Twig_TemplateMethodObject(), 'defined', false], + [new Twig_TemplateMethodObject(), 'defined', true], + ]; + } + + /** + * @group legacy + */ + public function testGetAttributeWithTemplateAsObject() + { + // to be removed in 2.0 + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock()); + + $template = new Twig_TemplateTest($twig, 'index.twig'); + $template1 = new Twig_TemplateTest($twig, 'index1.twig'); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string')); + $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true')); + $this->assertEquals('1', $template->getAttribute($template1, 'true')); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero')); + $this->assertEquals('0', $template->getAttribute($template1, 'zero')); + + $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty')); + $this->assertSame('', $template->getAttribute($template1, 'empty')); + + $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true)); + } + + /** + * @group legacy + * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. + * @expectedDeprecation Calling "renderBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead). + * @expectedDeprecation Calling "displayBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead). + * @expectedDeprecation Calling "hasBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name") is defined" instead). + * @expectedDeprecation Calling "render" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead). + * @expectedDeprecation Calling "display" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead). + * @expectedDeprecation Calling "renderBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead). + * @expectedDeprecation Calling "displayBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead). + * @expectedDeprecation Calling "hasBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name", template) is defined" instead). + * @expectedDeprecation Calling "render" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead). + * @expectedDeprecation Calling "display" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead). + */ + public function testGetAttributeWithTemplateAsObjectForDeprecations() + { + // to be removed in 2.0 + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock()); + + $template = new Twig_TemplateTest($twig, 'index.twig'); + $template1 = new Twig_TemplateTest($twig, 'index1.twig'); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string')); + $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true')); + $this->assertEquals('1', $template->getAttribute($template1, 'true')); + + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero')); + $this->assertEquals('0', $template->getAttribute($template1, 'zero')); + + $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty')); + $this->assertSame('', $template->getAttribute($template1, 'empty')); + + $blocks = ['name' => [$template1, 'block_name']]; + + // trigger some deprecation notice messages to check them with @expectedDeprecation + $template->getAttribute($template, 'renderBlock', ['name', [], $blocks]); + $template->getAttribute($template, 'displayBlock', ['name', [], $blocks]); + $template->getAttribute($template, 'hasBlock', ['name', []]); + $template->getAttribute($template, 'render', [[]]); + $template->getAttribute($template, 'display', [[]]); + + $template->getAttribute($template1, 'renderBlock', ['name', [], $blocks]); + $template->getAttribute($template1, 'displayBlock', ['name', [], $blocks]); + $template->getAttribute($template1, 'hasBlock', ['name', []]); + $template->getAttribute($template1, 'render', [[]]); + $template->getAttribute($template1, 'display', [[]]); + + $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true)); + } + + /** + * @group legacy + * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence. + * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence. + */ + public function testRenderBlockWithUndefinedBlock() + { + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + + $template = new Twig_TemplateTest($twig, 'index.twig'); + $template->renderBlock('unknown', []); + $template->displayBlock('unknown', []); + } + + public function testGetAttributeOnArrayWithConfusableKey() + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + + $array = ['Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros']; + + $this->assertSame('Zero', $array[false]); + $this->assertSame('One', $array[true]); + $this->assertSame('One', $array[1.5]); + $this->assertSame('One', $array['1']); + $this->assertSame('MinusOne', $array[-1.5]); + $this->assertSame('FloatButString', $array['1.5']); + $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']); + $this->assertSame('EmptyString', $array[null]); + + $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)'); + $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)'); + $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)'); + $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)'); + $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)'); + $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)'); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttribute($defined, $value, $object, $item, $arguments, $type) + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null) + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); + + if ($defined) { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } else { + if (method_exists($this, 'expectException')) { + $this->expectException('\Twig\Error\RuntimeError'); + if (null !== $exceptionMessage) { + $this->expectExceptionMessage($exceptionMessage); + } + } else { + $this->setExpectedException('\Twig\Error\RuntimeError', $exceptionMessage); + } + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type) + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type) + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + public function testGetAttributeCallExceptions() + { + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + + $object = new Twig_TemplateMagicMethodExceptionObject(); + + $this->assertNull($template->getAttribute($object, 'foo')); + } + + public function getGetAttributeTests() + { + $array = [ + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + 'baz' => 'baz', + '09' => '09', + '+4' => '+4', + ]; + + $objectArray = new Twig_TemplateArrayAccessObject(); + $arrayObject = new \ArrayObject($array); + $stdObject = (object) $array; + $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); + $propertyObject = new Twig_TemplatePropertyObject(); + $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); + $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); + $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); + $methodObject = new Twig_TemplateMethodObject(); + $magicMethodObject = new Twig_TemplateMagicMethodObject(); + + $anyType = Template::ANY_CALL; + $methodType = Template::METHOD_CALL; + $arrayType = Template::ARRAY_CALL; + + $basicTests = [ + // array(defined, value, property to fetch) + [true, 'defined', 'defined'], + [false, null, 'undefined'], + [false, null, 'protected'], + [true, 0, 'zero'], + [true, 1, 1], + [true, 1, 1.0], + [true, null, 'null'], + [true, true, 'bar'], + [true, 'baz', 'baz'], + [true, '09', '09'], + [true, '+4', '+4'], + ]; + $testObjects = [ + // array(object, type of fetch) + [$array, $arrayType], + [$objectArray, $arrayType], + [$arrayObject, $anyType], + [$stdObject, $anyType], + [$magicPropertyObject, $anyType], + [$methodObject, $methodType], + [$methodObject, $anyType], + [$propertyObject, $anyType], + [$propertyObject1, $anyType], + [$propertyObject2, $anyType], + ]; + + $tests = []; + foreach ($testObjects as $testObject) { + foreach ($basicTests as $test) { + // properties cannot be numbers + if (($testObject[0] instanceof \stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { + continue; + } + + if ('+4' === $test[2] && $methodObject === $testObject[0]) { + continue; + } + + $tests[] = [$test[0], $test[1], $testObject[0], $test[2], [], $testObject[1]]; + } + } + + // additional properties tests + $tests = array_merge($tests, [ + [true, null, $propertyObject3, 'foo', [], $anyType], + ]); + + // additional method tests + $tests = array_merge($tests, [ + [true, 'defined', $methodObject, 'defined', [], $methodType], + [true, 'defined', $methodObject, 'DEFINED', [], $methodType], + [true, 'defined', $methodObject, 'getDefined', [], $methodType], + [true, 'defined', $methodObject, 'GETDEFINED', [], $methodType], + [true, 'static', $methodObject, 'static', [], $methodType], + [true, 'static', $methodObject, 'getStatic', [], $methodType], + + [true, '__call_undefined', $magicMethodObject, 'undefined', [], $methodType], + [true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', [], $methodType], + ]); + + // add the same tests for the any type + foreach ($tests as $test) { + if ($anyType !== $test[5]) { + $test[5] = $anyType; + $tests[] = $test; + } + } + + $methodAndPropObject = new Twig_TemplateMethodAndPropObject(); + + // additional method tests + $tests = array_merge($tests, [ + [true, 'a', $methodAndPropObject, 'a', [], $anyType], + [true, 'a', $methodAndPropObject, 'a', [], $methodType], + [false, null, $methodAndPropObject, 'a', [], $arrayType], + + [true, 'b_prop', $methodAndPropObject, 'b', [], $anyType], + [true, 'b', $methodAndPropObject, 'B', [], $anyType], + [true, 'b', $methodAndPropObject, 'b', [], $methodType], + [true, 'b', $methodAndPropObject, 'B', [], $methodType], + [false, null, $methodAndPropObject, 'b', [], $arrayType], + + [false, null, $methodAndPropObject, 'c', [], $anyType], + [false, null, $methodAndPropObject, 'c', [], $methodType], + [false, null, $methodAndPropObject, 'c', [], $arrayType], + ]); + + $arrayAccess = new Twig_TemplateArrayAccess(); + $tests = array_merge($tests, [ + [true, ['foo' => 'bar'], $arrayAccess, 'vars', [], $anyType], + ]); + + // tests when input is not an array or object + $tests = array_merge($tests, [ + [false, null, 42, 'a', [], $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'], + [false, null, 'string', 'a', [], $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'], + [false, null, [], 'a', [], $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'], + ]); + + return $tests; + } + + /** + * @expectedException \Twig\Error\RuntimeError + */ + public function testGetIsMethods() + { + $getIsObject = new Twig_TemplateGetIsMethods(); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); + // first time should not create a cache for "get" + $this->assertNull($template->getAttribute($getIsObject, 'get')); + // 0 should be in the method cache now, so this should fail + $this->assertNull($template->getAttribute($getIsObject, 0)); + } +} + +class Twig_TemplateTest extends Template +{ + private $name; + + public function __construct(Environment $env, $name = 'index.twig') + { + parent::__construct($env); + self::$cache = []; + $this->name = $name; + } + + public function getZero() + { + return 0; + } + + public function getEmpty() + { + return ''; + } + + public function getString() + { + return 'some_string'; + } + + public function getTrue() + { + return true; + } + + public function getTemplateName() + { + return $this->name; + } + + public function getDebugInfo() + { + return []; + } + + protected function doGetParent(array $context) + { + return false; + } + + protected function doDisplay(array $context, array $blocks = []) + { + } + + public function getAttribute($object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + { + if (\function_exists('twig_template_get_attributes')) { + return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } else { + return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } + } + + public function block_name($context, array $blocks = []) + { + } +} + +class Twig_TemplateArrayAccessObject implements \ArrayAccess +{ + protected $protected = 'protected'; + + public $attributes = [ + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + 'baz' => 'baz', + '09' => '09', + '+4' => '+4', + ]; + + public function offsetExists($name) + { + return \array_key_exists($name, $this->attributes); + } + + public function offsetGet($name) + { + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } + + public function offsetSet($name, $value) + { + } + + public function offsetUnset($name) + { + } +} + +class Twig_TemplateMagicPropertyObject +{ + public $defined = 'defined'; + + public $attributes = [ + 'zero' => 0, + 'null' => null, + '1' => 1, + 'bar' => true, + 'baz' => 'baz', + '09' => '09', + '+4' => '+4', + ]; + + protected $protected = 'protected'; + + public function __isset($name) + { + return \array_key_exists($name, $this->attributes); + } + + public function __get($name) + { + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } +} + +class Twig_TemplateMagicPropertyObjectWithException +{ + public function __isset($key) + { + throw new \Exception('Hey! Don\'t try to isset me!'); + } +} + +class Twig_TemplatePropertyObject +{ + public $defined = 'defined'; + public $zero = 0; + public $null = null; + public $bar = true; + public $baz = 'baz'; + + protected $protected = 'protected'; +} + +class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements \IteratorAggregate +{ + public function getIterator() + { + return new \ArrayIterator(['foo', 'bar']); + } +} + +class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements \ArrayAccess +{ + private $data = [ + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + 'bar' => true, + 'foo' => true, + 'baz' => 'baz', + 'baf' => 'baf', + ]; + + public function offsetExists($offset) + { + return \array_key_exists($offset, $this->data); + } + + public function offsetGet($offset) + { + return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a'; + } + + public function offsetSet($offset, $value) + { + } + + public function offsetUnset($offset) + { + } +} + +class Twig_TemplatePropertyObjectDefinedWithUndefinedValue +{ + public $foo; + + public function __construct() + { + $this->foo = @$notExist; + } +} + +class Twig_TemplateMethodObject +{ + public function getDefined() + { + return 'defined'; + } + + public function get1() + { + return 1; + } + + public function get09() + { + return '09'; + } + + public function getZero() + { + return 0; + } + + public function getNull() + { + } + + public function isBar() + { + return true; + } + + public function isBaz() + { + return 'should never be returned'; + } + + public function getBaz() + { + return 'baz'; + } + + protected function getProtected() + { + return 'protected'; + } + + public static function getStatic() + { + return 'static'; + } +} + +class Twig_TemplateGetIsMethods +{ + public function get() + { + } + + public function is() + { + } +} + +class Twig_TemplateMethodAndPropObject +{ + private $a = 'a_prop'; + + public function getA() + { + return 'a'; + } + + public $b = 'b_prop'; + + public function getB() + { + return 'b'; + } + + private $c = 'c_prop'; + + private function getC() + { + return 'c'; + } +} + +class Twig_TemplateArrayAccess implements \ArrayAccess +{ + public $vars = [ + 'foo' => 'bar', + ]; + private $children = []; + + public function offsetExists($offset) + { + return \array_key_exists($offset, $this->children); + } + + public function offsetGet($offset) + { + return $this->children[$offset]; + } + + public function offsetSet($offset, $value) + { + $this->children[$offset] = $value; + } + + public function offsetUnset($offset) + { + unset($this->children[$offset]); + } +} + +class Twig_TemplateMagicMethodObject +{ + public function __call($method, $arguments) + { + return '__call_'.$method; + } +} + +class Twig_TemplateMagicMethodExceptionObject +{ + public function __call($method, $arguments) + { + throw new \BadMethodCallException(sprintf('Unknown method "%s".', $method)); + } +} + +class CExtDisablingNodeVisitor implements NodeVisitorInterface +{ + public function enterNode(Twig_NodeInterface $node, Environment $env) + { + if ($node instanceof GetAttrExpression) { + $node->setAttribute('disable_c_ext', true); + } + + return $node; + } + + public function leaveNode(Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} + +// to be removed in 2.0 +interface Twig_TemplateTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface +{ +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php new file mode 100644 index 0000000..7461840 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php @@ -0,0 +1,68 @@ + '{% block foo %}{% endblock %}', + 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}', + 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}', + 'imported' => '{% block imported %}{% endblock %}', + 'extended' => '{% block extended %}{% endblock %}', + ])); + + $wrapper = $twig->load('index'); + $this->assertTrue($wrapper->hasBlock('foo')); + $this->assertFalse($wrapper->hasBlock('bar')); + $this->assertEquals(['foo'], $wrapper->getBlockNames()); + + $wrapper = $twig->load('index_with_use'); + $this->assertTrue($wrapper->hasBlock('foo')); + $this->assertTrue($wrapper->hasBlock('imported')); + $this->assertEquals(['imported', 'foo'], $wrapper->getBlockNames()); + + $wrapper = $twig->load('index_with_extends'); + $this->assertTrue($wrapper->hasBlock('foo')); + $this->assertTrue($wrapper->hasBlock('extended')); + $this->assertEquals(['foo', 'extended'], $wrapper->getBlockNames()); + } + + public function testRenderBlock() + { + $twig = new Environment(new ArrayLoader([ + 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', + ])); + $twig->addGlobal('bar', 'BAR'); + + $wrapper = $twig->load('index'); + $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', ['foo' => 'FOO'])); + } + + public function testDisplayBlock() + { + $twig = new Environment(new ArrayLoader([ + 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', + ])); + $twig->addGlobal('bar', 'BAR'); + + $wrapper = $twig->load('index'); + + ob_start(); + $wrapper->displayBlock('foo', ['foo' => 'FOO']); + + $this->assertEquals('FOOBAR', ob_get_clean()); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php new file mode 100644 index 0000000..e5cd568 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php @@ -0,0 +1,85 @@ +assertEquals('foo', $stream->getFilename()); + $this->assertEquals('{{ foo }}', $stream->getSource()); + $this->assertEquals('foo', $stream->getSourceContext()->getName()); + $this->assertEquals('{{ foo }}', $stream->getSourceContext()->getCode()); + } + + public function testNext() + { + $stream = new TokenStream(self::$tokens); + $repr = []; + while (!$stream->isEOF()) { + $token = $stream->next(); + + $repr[] = $token->getValue(); + } + $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unexpected end of template + */ + public function testEndOfTemplateNext() + { + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, 1, 1), + ]); + while (!$stream->isEOF()) { + $stream->next(); + } + } + + /** + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Unexpected end of template + */ + public function testEndOfTemplateLook() + { + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, 1, 1), + ]); + while (!$stream->isEOF()) { + $stream->look(); + $stream->next(); + } + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php new file mode 100644 index 0000000..0f577c6 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php @@ -0,0 +1,46 @@ +getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addFunction(new TwigFunction('deprec', [$this, 'deprec'], ['deprecated' => true])); + + $collector = new DeprecationCollector($twig); + $deprecations = $collector->collect(new Twig_Tests_Util_Iterator()); + + $this->assertEquals(['Twig Function "deprec" is deprecated in deprec.twig at line 1.'], $deprecations); + } + + public function deprec() + { + } +} + +class Twig_Tests_Util_Iterator implements \IteratorAggregate +{ + public function getIterator() + { + return new \ArrayIterator([ + 'ok.twig' => '{{ foo }}', + 'deprec.twig' => '{{ deprec("foo") }}', + ]); + } +} diff --git a/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/escapingTest.php new file mode 100644 index 0000000..6de31a9 --- /dev/null +++ b/system/templateEngines/Twig/Twig1x/vendor/twig/twig/test/Twig/Tests/escapingTest.php @@ -0,0 +1,325 @@ + ''', + '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&', + ]; + + protected $htmlAttrSpecialChars = [ + '\'' => ''', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => 'Ā', + '😀' => '😀', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '-' => '-', + '_' => '_', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => ' ', + "\n" => ' ', + "\t" => ' ', + "\0" => '�', // should use Unicode replacement char + /* Encode chars as named entities where possible */ + '<' => '<', + '>' => '>', + '&' => '&', + '"' => '"', + /* Encode spaces for quoteless attribute protection */ + ' ' => ' ', + ]; + + protected $jsSpecialChars = [ + /* HTML special chars - escape without exception to hex */ + '<' => '\\u003C', + '>' => '\\u003E', + '\'' => '\\u0027', + '"' => '\\u0022', + '&' => '\\u0026', + '/' => '\\/', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\u0100', + '😀' => '\\uD83D\\uDE00', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '_' => '_', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\r', + "\n" => '\n', + "\x08" => '\b', + "\t" => '\t', + "\x0C" => '\f', + "\0" => '\\u0000', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\u0020', + ]; + + protected $urlSpecialChars = [ + /* HTML special chars - escape without exception to percent encoding */ + '<' => '%3C', + '>' => '%3E', + '\'' => '%27', + '"' => '%22', + '&' => '%26', + /* Characters beyond ASCII value 255 to hex sequence */ + 'Ā' => '%C4%80', + /* Punctuation and unreserved check */ + ',' => '%2C', + '.' => '.', + '_' => '_', + '-' => '-', + ':' => '%3A', + ';' => '%3B', + '!' => '%21', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '%0D', + "\n" => '%0A', + "\t" => '%09', + "\0" => '%00', + /* PHP quirks from the past */ + ' ' => '%20', + '~' => '~', + '+' => '%2B', + ]; + + protected $cssSpecialChars = [ + /* HTML special chars - escape without exception to hex */ + '<' => '\\3C ', + '>' => '\\3E ', + '\'' => '\\27 ', + '"' => '\\22 ', + '&' => '\\26 ', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\100 ', + /* Immune chars excluded */ + ',' => '\\2C ', + '.' => '\\2E ', + '_' => '\\5F ', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\\D ', + "\n" => '\\A ', + "\t" => '\\9 ', + "\0" => '\\0 ', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\20 ', + ]; + + protected $env; + + protected function setUp() + { + $this->env = new \Twig\Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + } + + public function testHtmlEscapingConvertsSpecialChars() + { + foreach ($this->htmlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key); + } + } + + public function testHtmlAttributeEscapingConvertsSpecialChars() + { + foreach ($this->htmlAttrSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingConvertsSpecialChars() + { + foreach ($this->jsSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'js')); + } + + public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js')); + } + + public function testCssEscapingConvertsSpecialChars() + { + foreach ($this->cssSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key); + } + } + + public function testCssEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'css')); + } + + public function testCssEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css')); + } + + public function testUrlEscapingConvertsSpecialChars() + { + foreach ($this->urlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key); + } + } + + /** + * Range tests to confirm escaped range of characters is within OWASP recommendation. + */ + + /** + * Only testing the first few 2 ranges on this prot. function as that's all these + * other range tests require. + */ + public function testUnicodeCodepointConversionToUtf8() + { + $expected = ' ~ޙ'; + $codepoints = [0x20, 0x7e, 0x799]; + $result = ''; + foreach ($codepoints as $value) { + $result .= $this->codepointToUtf8($value); + } + $this->assertEquals($expected, $result); + } + + /** + * Convert a Unicode Codepoint to a literal UTF-8 character. + * + * @param int $codepoint Unicode codepoint in hex notation + * + * @return string UTF-8 literal string + */ + protected function codepointToUtf8($codepoint) + { + if ($codepoint < 0x80) { + return \chr($codepoint); + } + if ($codepoint < 0x800) { + return \chr($codepoint >> 6 & 0x3f | 0xc0) + .\chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x10000) { + return \chr($codepoint >> 12 & 0x0f | 0xe0) + .\chr($codepoint >> 6 & 0x3f | 0x80) + .\chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x110000) { + return \chr($codepoint >> 18 & 0x07 | 0xf0) + .\chr($codepoint >> 12 & 0x3f | 0x80) + .\chr($codepoint >> 6 & 0x3f | 0x80) + .\chr($codepoint & 0x3f | 0x80); + } + throw new \Exception('Codepoint requested outside of Unicode range.'); + } + + public function testJavascriptEscapingEscapesOwaspRecommendedRanges() + { + $immune = [',', '.', '_']; // Exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $literal = $this->codepointToUtf8($chr); + if (\in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'js'), + "$literal should be escaped!"); + } + } + } + } + + public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() + { + $immune = [',', '.', '-', '_']; // Exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $literal = $this->codepointToUtf8($chr); + if (\in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'html_attr'), + "$literal should be escaped!"); + } + } + } + } + + public function testCssEscapingEscapesOwaspRecommendedRanges() + { + // CSS has no exceptions to escaping ranges + for ($chr = 0; $chr < 0xFF; ++$chr) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css')); + } else { + $literal = $this->codepointToUtf8($chr); + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'css'), + "$literal should be escaped!"); + } + } + } +} diff --git a/system/templateEngines/Twig/Twig2x/autoload.php b/system/templateEngines/Twig/Twig2x/autoload.php deleted file mode 100644 index bf8baa6..0000000 --- a/system/templateEngines/Twig/Twig2x/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/system/templateEngines/Twig/Twig2x/composer/LICENSE b/system/templateEngines/Twig/Twig2x/composer/LICENSE deleted file mode 100644 index f27399a..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/system/templateEngines/Twig/Twig2x/composer/autoload_classmap.php b/system/templateEngines/Twig/Twig2x/composer/autoload_classmap.php deleted file mode 100644 index 7a91153..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/autoload_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ - $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', -); diff --git a/system/templateEngines/Twig/Twig2x/composer/autoload_namespaces.php b/system/templateEngines/Twig/Twig2x/composer/autoload_namespaces.php deleted file mode 100644 index a7edd32..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/autoload_namespaces.php +++ /dev/null @@ -1,10 +0,0 @@ - array($vendorDir . '/twig/twig/lib'), -); diff --git a/system/templateEngines/Twig/Twig2x/composer/autoload_psr4.php b/system/templateEngines/Twig/Twig2x/composer/autoload_psr4.php deleted file mode 100644 index b591d7b..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/autoload_psr4.php +++ /dev/null @@ -1,12 +0,0 @@ - array($vendorDir . '/twig/twig/src'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), -); diff --git a/system/templateEngines/Twig/Twig2x/composer/autoload_real.php b/system/templateEngines/Twig/Twig2x/composer/autoload_real.php deleted file mode 100644 index d327384..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/autoload_real.php +++ /dev/null @@ -1,70 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit1187ddbb948ea98f88282cd2e2605ab8::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit1187ddbb948ea98f88282cd2e2605ab8::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire1187ddbb948ea98f88282cd2e2605ab8($fileIdentifier, $file); - } - - return $loader; - } -} - -function composerRequire1187ddbb948ea98f88282cd2e2605ab8($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/system/templateEngines/Twig/Twig2x/composer/autoload_static.php b/system/templateEngines/Twig/Twig2x/composer/autoload_static.php deleted file mode 100644 index f1ac2f6..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/autoload_static.php +++ /dev/null @@ -1,60 +0,0 @@ - __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'T' => - array ( - 'Twig\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Polyfill\\Ctype\\' => 23, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/src', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - ); - - public static $prefixesPsr0 = array ( - 'T' => - array ( - 'Twig_' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/lib', - ), - ), - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit1187ddbb948ea98f88282cd2e2605ab8::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit1187ddbb948ea98f88282cd2e2605ab8::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit1187ddbb948ea98f88282cd2e2605ab8::$prefixesPsr0; - - }, null, ClassLoader::class); - } -} diff --git a/system/templateEngines/Twig/Twig2x/composer/installed.json b/system/templateEngines/Twig/Twig2x/composer/installed.json deleted file mode 100644 index e0982d1..0000000 --- a/system/templateEngines/Twig/Twig2x/composer/installed.json +++ /dev/null @@ -1,190 +0,0 @@ -[ - { - "name": "symfony/polyfill-ctype", - "version": "v1.14.0", - "version_normalized": "1.14.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2020-01-13T11:15:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ] - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", - "version_normalized": "1.14.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2020-01-13T11:15:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ] - }, - { - "name": "twig/twig", - "version": "v2.12.5", - "version_normalized": "2.12.5.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "18772e0190734944277ee97a02a9a6c6555fcd94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/18772e0190734944277ee97a02a9a6c6555fcd94", - "reference": "18772e0190734944277ee97a02a9a6c6555fcd94", - "shasum": "" - }, - "require": { - "php": "^7.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.0" - }, - "time": "2020-02-11T15:31:23+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.12-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "https://twig.symfony.com", - "keywords": [ - "templating" - ] - } -] diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/Ctype.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/Ctype.php deleted file mode 100644 index 58414dc..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/Ctype.php +++ /dev/null @@ -1,227 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Ctype; - -/** - * Ctype implementation through regex. - * - * @internal - * - * @author Gert de Pagter - */ -final class Ctype -{ - /** - * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise. - * - * @see https://php.net/ctype-alnum - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_alnum($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is a letter, FALSE otherwise. - * - * @see https://php.net/ctype-alpha - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_alpha($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); - } - - /** - * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. - * - * @see https://php.net/ctype-cntrl - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_cntrl($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); - } - - /** - * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. - * - * @see https://php.net/ctype-digit - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_digit($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. - * - * @see https://php.net/ctype-graph - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_graph($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); - } - - /** - * Returns TRUE if every character in text is a lowercase letter. - * - * @see https://php.net/ctype-lower - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_lower($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); - } - - /** - * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. - * - * @see https://php.net/ctype-print - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_print($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); - } - - /** - * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. - * - * @see https://php.net/ctype-punct - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_punct($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); - } - - /** - * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. - * - * @see https://php.net/ctype-space - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_space($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); - } - - /** - * Returns TRUE if every character in text is an uppercase letter. - * - * @see https://php.net/ctype-upper - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_upper($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); - } - - /** - * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. - * - * @see https://php.net/ctype-xdigit - * - * @param string|int $text - * - * @return bool - */ - public static function ctype_xdigit($text) - { - $text = self::convert_int_to_char_for_ctype($text); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); - } - - /** - * Converts integers to their char versions according to normal ctype behaviour, if needed. - * - * If an integer between -128 and 255 inclusive is provided, - * it is interpreted as the ASCII value of a single character - * (negative values have 256 added in order to allow characters in the Extended ASCII range). - * Any other integer is interpreted as a string containing the decimal digits of the integer. - * - * @param string|int $int - * - * @return mixed - */ - private static function convert_int_to_char_for_ctype($int) - { - if (!\is_int($int)) { - return $int; - } - - if ($int < -128 || $int > 255) { - return (string) $int; - } - - if ($int < 0) { - $int += 256; - } - - return \chr($int); - } -} diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/LICENSE b/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/LICENSE deleted file mode 100644 index 3f853aa..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2018-2019 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/README.md b/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/README.md deleted file mode 100644 index 8add1ab..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Symfony Polyfill / Ctype -======================== - -This component provides `ctype_*` functions to users who run php versions without the ctype extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/bootstrap.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/bootstrap.php deleted file mode 100644 index 14d1d0f..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/bootstrap.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (!function_exists('ctype_alnum')) { - function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } - function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } - function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } - function ctype_digit($text) { return p\Ctype::ctype_digit($text); } - function ctype_graph($text) { return p\Ctype::ctype_graph($text); } - function ctype_lower($text) { return p\Ctype::ctype_lower($text); } - function ctype_print($text) { return p\Ctype::ctype_print($text); } - function ctype_punct($text) { return p\Ctype::ctype_punct($text); } - function ctype_space($text) { return p\Ctype::ctype_space($text); } - function ctype_upper($text) { return p\Ctype::ctype_upper($text); } - function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } -} diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/composer.json b/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/composer.json deleted file mode 100644 index 2596c74..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-ctype/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/polyfill-ctype", - "type": "library", - "description": "Symfony polyfill for ctype functions", - "keywords": ["polyfill", "compatibility", "portable", "ctype"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - } -} diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/LICENSE b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/LICENSE deleted file mode 100644 index 4cd8bdd..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015-2019 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Mbstring.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Mbstring.php deleted file mode 100644 index 15503bc..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Mbstring.php +++ /dev/null @@ -1,847 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Mbstring; - -/** - * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. - * - * Implemented: - * - mb_chr - Returns a specific character from its Unicode code point - * - mb_convert_encoding - Convert character encoding - * - mb_convert_variables - Convert character code in variable(s) - * - mb_decode_mimeheader - Decode string in MIME header field - * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED - * - mb_decode_numericentity - Decode HTML numeric string reference to character - * - mb_encode_numericentity - Encode character to HTML numeric string reference - * - mb_convert_case - Perform case folding on a string - * - mb_detect_encoding - Detect character encoding - * - mb_get_info - Get internal settings of mbstring - * - mb_http_input - Detect HTTP input character encoding - * - mb_http_output - Set/Get HTTP output character encoding - * - mb_internal_encoding - Set/Get internal character encoding - * - mb_list_encodings - Returns an array of all supported encodings - * - mb_ord - Returns the Unicode code point of a character - * - mb_output_handler - Callback function converts character encoding in output buffer - * - mb_scrub - Replaces ill-formed byte sequences with substitute characters - * - mb_strlen - Get string length - * - mb_strpos - Find position of first occurrence of string in a string - * - mb_strrpos - Find position of last occurrence of a string in a string - * - mb_str_split - Convert a string to an array - * - mb_strtolower - Make a string lowercase - * - mb_strtoupper - Make a string uppercase - * - mb_substitute_character - Set/Get substitution character - * - mb_substr - Get part of string - * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive - * - mb_stristr - Finds first occurrence of a string within another, case insensitive - * - mb_strrchr - Finds the last occurrence of a character in a string within another - * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive - * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within another - * - mb_strwidth - Return width of string - * - mb_substr_count - Count the number of substring occurrences - * - * Not implemented: - * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * - mb_ereg_* - Regular expression with multibyte support - * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable - * - mb_preferred_mime_name - Get MIME charset string - * - mb_regex_encoding - Returns current encoding for multibyte regex as string - * - mb_regex_set_options - Set/Get the default options for mbregex functions - * - mb_send_mail - Send encoded mail - * - mb_split - Split multibyte string using regular expression - * - mb_strcut - Get part of string - * - mb_strimwidth - Get truncated string with specified width - * - * @author Nicolas Grekas - * - * @internal - */ -final class Mbstring -{ - const MB_CASE_FOLD = PHP_INT_MAX; - - private static $encodingList = array('ASCII', 'UTF-8'); - private static $language = 'neutral'; - private static $internalEncoding = 'UTF-8'; - private static $caseFold = array( - array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), - array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), - ); - - public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) - { - if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) { - $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); - } else { - $fromEncoding = self::getEncoding($fromEncoding); - } - - $toEncoding = self::getEncoding($toEncoding); - - if ('BASE64' === $fromEncoding) { - $s = base64_decode($s); - $fromEncoding = $toEncoding; - } - - if ('BASE64' === $toEncoding) { - return base64_encode($s); - } - - if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { - if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { - $fromEncoding = 'Windows-1252'; - } - if ('UTF-8' !== $fromEncoding) { - $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); - } - - return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); - } - - if ('HTML-ENTITIES' === $fromEncoding) { - $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8'); - $fromEncoding = 'UTF-8'; - } - - return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); - } - - public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) - { - $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); - - $ok = true; - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { - if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { - $ok = false; - } - }); - - return $ok ? $fromEncoding : false; - } - - public static function mb_decode_mimeheader($s) - { - return iconv_mime_decode($s, 2, self::$internalEncoding); - } - - public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) - { - trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING); - } - - public static function mb_decode_numericentity($s, $convmap, $encoding = null) - { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); - - return null; - } - - if (!\is_array($convmap) || !$convmap) { - return false; - } - - if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); - - return ''; // Instead of null (cf. mb_encode_numericentity). - } - - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - $cnt = floor(\count($convmap) / 4) * 4; - - for ($i = 0; $i < $cnt; $i += 4) { - // collector_decode_htmlnumericentity ignores $convmap[$i + 3] - $convmap[$i] += $convmap[$i + 2]; - $convmap[$i + 1] += $convmap[$i + 2]; - } - - $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { - $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; - for ($i = 0; $i < $cnt; $i += 4) { - if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { - return Mbstring::mb_chr($c - $convmap[$i + 2]); - } - } - - return $m[0]; - }, $s); - - if (null === $encoding) { - return $s; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $s); - } - - public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) - { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); - - return null; - } - - if (!\is_array($convmap) || !$convmap) { - return false; - } - - if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); - - return null; // Instead of '' (cf. mb_decode_numericentity). - } - - if (null !== $is_hex && !\is_scalar($is_hex)) { - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING); - - return null; - } - - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4); - - $cnt = floor(\count($convmap) / 4) * 4; - $i = 0; - $len = \strlen($s); - $result = ''; - - while ($i < $len) { - $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; - $uchr = substr($s, $i, $ulen); - $i += $ulen; - $c = self::mb_ord($uchr); - - for ($j = 0; $j < $cnt; $j += 4) { - if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { - $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; - $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; - continue 2; - } - } - $result .= $uchr; - } - - if (null === $encoding) { - return $result; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $result); - } - - public static function mb_convert_case($s, $mode, $encoding = null) - { - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - if (MB_CASE_TITLE == $mode) { - static $titleRegexp = null; - if (null === $titleRegexp) { - $titleRegexp = self::getData('titleCaseRegexp'); - } - $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); - } else { - if (MB_CASE_UPPER == $mode) { - static $upper = null; - if (null === $upper) { - $upper = self::getData('upperCase'); - } - $map = $upper; - } else { - if (self::MB_CASE_FOLD === $mode) { - $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s); - } - - static $lower = null; - if (null === $lower) { - $lower = self::getData('lowerCase'); - } - $map = $lower; - } - - static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4); - - $i = 0; - $len = \strlen($s); - - while ($i < $len) { - $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; - $uchr = substr($s, $i, $ulen); - $i += $ulen; - - if (isset($map[$uchr])) { - $uchr = $map[$uchr]; - $nlen = \strlen($uchr); - - if ($nlen == $ulen) { - $nlen = $i; - do { - $s[--$nlen] = $uchr[--$ulen]; - } while ($ulen); - } else { - $s = substr_replace($s, $uchr, $i - $ulen, $ulen); - $len += $nlen - $ulen; - $i += $nlen - $ulen; - } - } - } - } - - if (null === $encoding) { - return $s; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $s); - } - - public static function mb_internal_encoding($encoding = null) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) { - self::$internalEncoding = $encoding; - - return true; - } - - return false; - } - - public static function mb_language($lang = null) - { - if (null === $lang) { - return self::$language; - } - - switch ($lang = strtolower($lang)) { - case 'uni': - case 'neutral': - self::$language = $lang; - - return true; - } - - return false; - } - - public static function mb_list_encodings() - { - return array('UTF-8'); - } - - public static function mb_encoding_aliases($encoding) - { - switch (strtoupper($encoding)) { - case 'UTF8': - case 'UTF-8': - return array('utf8'); - } - - return false; - } - - public static function mb_check_encoding($var = null, $encoding = null) - { - if (null === $encoding) { - if (null === $var) { - return false; - } - $encoding = self::$internalEncoding; - } - - return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var); - } - - public static function mb_detect_encoding($str, $encodingList = null, $strict = false) - { - if (null === $encodingList) { - $encodingList = self::$encodingList; - } else { - if (!\is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - } - - foreach ($encodingList as $enc) { - switch ($enc) { - case 'ASCII': - if (!preg_match('/[\x80-\xFF]/', $str)) { - return $enc; - } - break; - - case 'UTF8': - case 'UTF-8': - if (preg_match('//u', $str)) { - return 'UTF-8'; - } - break; - - default: - if (0 === strncmp($enc, 'ISO-8859-', 9)) { - return $enc; - } - } - } - - return false; - } - - public static function mb_detect_order($encodingList = null) - { - if (null === $encodingList) { - return self::$encodingList; - } - - if (!\is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - - foreach ($encodingList as $enc) { - switch ($enc) { - default: - if (strncmp($enc, 'ISO-8859-', 9)) { - return false; - } - // no break - case 'ASCII': - case 'UTF8': - case 'UTF-8': - } - } - - self::$encodingList = $encodingList; - - return true; - } - - public static function mb_strlen($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strlen($s); - } - - return @iconv_strlen($s, $encoding); - } - - public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strpos($haystack, $needle, $offset); - } - - $needle = (string) $needle; - if ('' === $needle) { - trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING); - - return false; - } - - return iconv_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strrpos($haystack, $needle, $offset); - } - - if ($offset != (int) $offset) { - $offset = 0; - } elseif ($offset = (int) $offset) { - if ($offset < 0) { - if (0 > $offset += self::mb_strlen($needle)) { - $haystack = self::mb_substr($haystack, 0, $offset, $encoding); - } - $offset = 0; - } else { - $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); - } - } - - $pos = iconv_strrpos($haystack, $needle, $encoding); - - return false !== $pos ? $offset + $pos : false; - } - - public static function mb_str_split($string, $split_length = 1, $encoding = null) - { - if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) { - trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING); - - return null; - } - - if (1 > $split_length = (int) $split_length) { - trigger_error('The length of each segment must be greater than zero', E_USER_WARNING); - - return false; - } - - if (null === $encoding) { - $encoding = mb_internal_encoding(); - } - - if ('UTF-8' === $encoding = self::getEncoding($encoding)) { - $rx = '/('; - while (65535 < $split_length) { - $rx .= '.{65535}'; - $split_length -= 65535; - } - $rx .= '.{'.$split_length.'})/us'; - - return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - } - - $result = array(); - $length = mb_strlen($string, $encoding); - - for ($i = 0; $i < $length; $i += $split_length) { - $result[] = mb_substr($string, $i, $split_length, $encoding); - } - - return $result; - } - - public static function mb_strtolower($s, $encoding = null) - { - return self::mb_convert_case($s, MB_CASE_LOWER, $encoding); - } - - public static function mb_strtoupper($s, $encoding = null) - { - return self::mb_convert_case($s, MB_CASE_UPPER, $encoding); - } - - public static function mb_substitute_character($c = null) - { - if (0 === strcasecmp($c, 'none')) { - return true; - } - - return null !== $c ? false : 'none'; - } - - public static function mb_substr($s, $start, $length = null, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return (string) substr($s, $start, null === $length ? 2147483647 : $length); - } - - if ($start < 0) { - $start = iconv_strlen($s, $encoding) + $start; - if ($start < 0) { - $start = 0; - } - } - - if (null === $length) { - $length = 2147483647; - } elseif ($length < 0) { - $length = iconv_strlen($s, $encoding) + $length - $start; - if ($length < 0) { - return ''; - } - } - - return (string) iconv_substr($s, $start, $length, $encoding); - } - - public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) - { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); - - return self::mb_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) - { - $pos = self::mb_stripos($haystack, $needle, 0, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strrchr($haystack, $needle, $part); - } - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = iconv_strrpos($haystack, $needle, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) - { - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = self::mb_strripos($haystack, $needle, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) - { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); - - return self::mb_strrpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) - { - $pos = strpos($haystack, $needle); - if (false === $pos) { - return false; - } - if ($part) { - return substr($haystack, 0, $pos); - } - - return substr($haystack, $pos); - } - - public static function mb_get_info($type = 'all') - { - $info = array( - 'internal_encoding' => self::$internalEncoding, - 'http_output' => 'pass', - 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)', - 'func_overload' => 0, - 'func_overload_list' => 'no overload', - 'mail_charset' => 'UTF-8', - 'mail_header_encoding' => 'BASE64', - 'mail_body_encoding' => 'BASE64', - 'illegal_chars' => 0, - 'encoding_translation' => 'Off', - 'language' => self::$language, - 'detect_order' => self::$encodingList, - 'substitute_character' => 'none', - 'strict_detection' => 'Off', - ); - - if ('all' === $type) { - return $info; - } - if (isset($info[$type])) { - return $info[$type]; - } - - return false; - } - - public static function mb_http_input($type = '') - { - return false; - } - - public static function mb_http_output($encoding = null) - { - return null !== $encoding ? 'pass' === $encoding : 'pass'; - } - - public static function mb_strwidth($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - - if ('UTF-8' !== $encoding) { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); - - return ($wide << 1) + iconv_strlen($s, 'UTF-8'); - } - - public static function mb_substr_count($haystack, $needle, $encoding = null) - { - return substr_count($haystack, $needle); - } - - public static function mb_output_handler($contents, $status) - { - return $contents; - } - - public static function mb_chr($code, $encoding = null) - { - if (0x80 > $code %= 0x200000) { - $s = \chr($code); - } elseif (0x800 > $code) { - $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); - } elseif (0x10000 > $code) { - $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } else { - $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } - - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, $encoding, 'UTF-8'); - } - - return $s; - } - - public static function mb_ord($s, $encoding = null) - { - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, 'UTF-8', $encoding); - } - - if (1 === \strlen($s)) { - return \ord($s); - } - - $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; - if (0xF0 <= $code) { - return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; - } - if (0xE0 <= $code) { - return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; - } - if (0xC0 <= $code) { - return (($code - 0xC0) << 6) + $s[2] - 0x80; - } - - return $code; - } - - private static function getSubpart($pos, $part, $haystack, $encoding) - { - if (false === $pos) { - return false; - } - if ($part) { - return self::mb_substr($haystack, 0, $pos, $encoding); - } - - return self::mb_substr($haystack, $pos, null, $encoding); - } - - private static function html_encoding_callback(array $m) - { - $i = 1; - $entities = ''; - $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8')); - - while (isset($m[$i])) { - if (0x80 > $m[$i]) { - $entities .= \chr($m[$i++]); - continue; - } - if (0xF0 <= $m[$i]) { - $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } elseif (0xE0 <= $m[$i]) { - $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } else { - $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; - } - - $entities .= '&#'.$c.';'; - } - - return $entities; - } - - private static function title_case(array $s) - { - return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8'); - } - - private static function getData($file) - { - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { - return require $file; - } - - return false; - } - - private static function getEncoding($encoding) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - if ('UTF-8' === $encoding) { - return 'UTF-8'; - } - - $encoding = strtoupper($encoding); - - if ('8BIT' === $encoding || 'BINARY' === $encoding) { - return 'CP850'; - } - - if ('UTF8' === $encoding) { - return 'UTF-8'; - } - - return $encoding; - } -} diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/README.md b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/README.md deleted file mode 100644 index 342e828..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Symfony Polyfill / Mbstring -=========================== - -This component provides a partial, native PHP implementation for the -[Mbstring](http://php.net/mbstring) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php deleted file mode 100644 index e6fbfa6..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ /dev/null @@ -1,1096 +0,0 @@ - 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - 'À' => 'à', - 'Á' => 'á', - 'Â' => 'â', - 'Ã' => 'ã', - 'Ä' => 'ä', - 'Å' => 'å', - 'Æ' => 'æ', - 'Ç' => 'ç', - 'È' => 'è', - 'É' => 'é', - 'Ê' => 'ê', - 'Ë' => 'ë', - 'Ì' => 'ì', - 'Í' => 'í', - 'Î' => 'î', - 'Ï' => 'ï', - 'Ð' => 'ð', - 'Ñ' => 'ñ', - 'Ò' => 'ò', - 'Ó' => 'ó', - 'Ô' => 'ô', - 'Õ' => 'õ', - 'Ö' => 'ö', - 'Ø' => 'ø', - 'Ù' => 'ù', - 'Ú' => 'ú', - 'Û' => 'û', - 'Ü' => 'ü', - 'Ý' => 'ý', - 'Þ' => 'þ', - 'Ā' => 'ā', - 'Ă' => 'ă', - 'Ą' => 'ą', - 'Ć' => 'ć', - 'Ĉ' => 'ĉ', - 'Ċ' => 'ċ', - 'Č' => 'č', - 'Ď' => 'ď', - 'Đ' => 'đ', - 'Ē' => 'ē', - 'Ĕ' => 'ĕ', - 'Ė' => 'ė', - 'Ę' => 'ę', - 'Ě' => 'ě', - 'Ĝ' => 'ĝ', - 'Ğ' => 'ğ', - 'Ġ' => 'ġ', - 'Ģ' => 'ģ', - 'Ĥ' => 'ĥ', - 'Ħ' => 'ħ', - 'Ĩ' => 'ĩ', - 'Ī' => 'ī', - 'Ĭ' => 'ĭ', - 'Į' => 'į', - 'İ' => 'i', - 'IJ' => 'ij', - 'Ĵ' => 'ĵ', - 'Ķ' => 'ķ', - 'Ĺ' => 'ĺ', - 'Ļ' => 'ļ', - 'Ľ' => 'ľ', - 'Ŀ' => 'ŀ', - 'Ł' => 'ł', - 'Ń' => 'ń', - 'Ņ' => 'ņ', - 'Ň' => 'ň', - 'Ŋ' => 'ŋ', - 'Ō' => 'ō', - 'Ŏ' => 'ŏ', - 'Ő' => 'ő', - 'Œ' => 'œ', - 'Ŕ' => 'ŕ', - 'Ŗ' => 'ŗ', - 'Ř' => 'ř', - 'Ś' => 'ś', - 'Ŝ' => 'ŝ', - 'Ş' => 'ş', - 'Š' => 'š', - 'Ţ' => 'ţ', - 'Ť' => 'ť', - 'Ŧ' => 'ŧ', - 'Ũ' => 'ũ', - 'Ū' => 'ū', - 'Ŭ' => 'ŭ', - 'Ů' => 'ů', - 'Ű' => 'ű', - 'Ų' => 'ų', - 'Ŵ' => 'ŵ', - 'Ŷ' => 'ŷ', - 'Ÿ' => 'ÿ', - 'Ź' => 'ź', - 'Ż' => 'ż', - 'Ž' => 'ž', - 'Ɓ' => 'ɓ', - 'Ƃ' => 'ƃ', - 'Ƅ' => 'ƅ', - 'Ɔ' => 'ɔ', - 'Ƈ' => 'ƈ', - 'Ɖ' => 'ɖ', - 'Ɗ' => 'ɗ', - 'Ƌ' => 'ƌ', - 'Ǝ' => 'ǝ', - 'Ə' => 'ə', - 'Ɛ' => 'ɛ', - 'Ƒ' => 'ƒ', - 'Ɠ' => 'ɠ', - 'Ɣ' => 'ɣ', - 'Ɩ' => 'ɩ', - 'Ɨ' => 'ɨ', - 'Ƙ' => 'ƙ', - 'Ɯ' => 'ɯ', - 'Ɲ' => 'ɲ', - 'Ɵ' => 'ɵ', - 'Ơ' => 'ơ', - 'Ƣ' => 'ƣ', - 'Ƥ' => 'ƥ', - 'Ʀ' => 'ʀ', - 'Ƨ' => 'ƨ', - 'Ʃ' => 'ʃ', - 'Ƭ' => 'ƭ', - 'Ʈ' => 'ʈ', - 'Ư' => 'ư', - 'Ʊ' => 'ʊ', - 'Ʋ' => 'ʋ', - 'Ƴ' => 'ƴ', - 'Ƶ' => 'ƶ', - 'Ʒ' => 'ʒ', - 'Ƹ' => 'ƹ', - 'Ƽ' => 'ƽ', - 'DŽ' => 'dž', - 'Dž' => 'dž', - 'LJ' => 'lj', - 'Lj' => 'lj', - 'NJ' => 'nj', - 'Nj' => 'nj', - 'Ǎ' => 'ǎ', - 'Ǐ' => 'ǐ', - 'Ǒ' => 'ǒ', - 'Ǔ' => 'ǔ', - 'Ǖ' => 'ǖ', - 'Ǘ' => 'ǘ', - 'Ǚ' => 'ǚ', - 'Ǜ' => 'ǜ', - 'Ǟ' => 'ǟ', - 'Ǡ' => 'ǡ', - 'Ǣ' => 'ǣ', - 'Ǥ' => 'ǥ', - 'Ǧ' => 'ǧ', - 'Ǩ' => 'ǩ', - 'Ǫ' => 'ǫ', - 'Ǭ' => 'ǭ', - 'Ǯ' => 'ǯ', - 'DZ' => 'dz', - 'Dz' => 'dz', - 'Ǵ' => 'ǵ', - 'Ƕ' => 'ƕ', - 'Ƿ' => 'ƿ', - 'Ǹ' => 'ǹ', - 'Ǻ' => 'ǻ', - 'Ǽ' => 'ǽ', - 'Ǿ' => 'ǿ', - 'Ȁ' => 'ȁ', - 'Ȃ' => 'ȃ', - 'Ȅ' => 'ȅ', - 'Ȇ' => 'ȇ', - 'Ȉ' => 'ȉ', - 'Ȋ' => 'ȋ', - 'Ȍ' => 'ȍ', - 'Ȏ' => 'ȏ', - 'Ȑ' => 'ȑ', - 'Ȓ' => 'ȓ', - 'Ȕ' => 'ȕ', - 'Ȗ' => 'ȗ', - 'Ș' => 'ș', - 'Ț' => 'ț', - 'Ȝ' => 'ȝ', - 'Ȟ' => 'ȟ', - 'Ƞ' => 'ƞ', - 'Ȣ' => 'ȣ', - 'Ȥ' => 'ȥ', - 'Ȧ' => 'ȧ', - 'Ȩ' => 'ȩ', - 'Ȫ' => 'ȫ', - 'Ȭ' => 'ȭ', - 'Ȯ' => 'ȯ', - 'Ȱ' => 'ȱ', - 'Ȳ' => 'ȳ', - 'Ⱥ' => 'ⱥ', - 'Ȼ' => 'ȼ', - 'Ƚ' => 'ƚ', - 'Ⱦ' => 'ⱦ', - 'Ɂ' => 'ɂ', - 'Ƀ' => 'ƀ', - 'Ʉ' => 'ʉ', - 'Ʌ' => 'ʌ', - 'Ɇ' => 'ɇ', - 'Ɉ' => 'ɉ', - 'Ɋ' => 'ɋ', - 'Ɍ' => 'ɍ', - 'Ɏ' => 'ɏ', - 'Ͱ' => 'ͱ', - 'Ͳ' => 'ͳ', - 'Ͷ' => 'ͷ', - 'Ϳ' => 'ϳ', - 'Ά' => 'ά', - 'Έ' => 'έ', - 'Ή' => 'ή', - 'Ί' => 'ί', - 'Ό' => 'ό', - 'Ύ' => 'ύ', - 'Ώ' => 'ώ', - 'Α' => 'α', - 'Β' => 'β', - 'Γ' => 'γ', - 'Δ' => 'δ', - 'Ε' => 'ε', - 'Ζ' => 'ζ', - 'Η' => 'η', - 'Θ' => 'θ', - 'Ι' => 'ι', - 'Κ' => 'κ', - 'Λ' => 'λ', - 'Μ' => 'μ', - 'Ν' => 'ν', - 'Ξ' => 'ξ', - 'Ο' => 'ο', - 'Π' => 'π', - 'Ρ' => 'ρ', - 'Σ' => 'σ', - 'Τ' => 'τ', - 'Υ' => 'υ', - 'Φ' => 'φ', - 'Χ' => 'χ', - 'Ψ' => 'ψ', - 'Ω' => 'ω', - 'Ϊ' => 'ϊ', - 'Ϋ' => 'ϋ', - 'Ϗ' => 'ϗ', - 'Ϙ' => 'ϙ', - 'Ϛ' => 'ϛ', - 'Ϝ' => 'ϝ', - 'Ϟ' => 'ϟ', - 'Ϡ' => 'ϡ', - 'Ϣ' => 'ϣ', - 'Ϥ' => 'ϥ', - 'Ϧ' => 'ϧ', - 'Ϩ' => 'ϩ', - 'Ϫ' => 'ϫ', - 'Ϭ' => 'ϭ', - 'Ϯ' => 'ϯ', - 'ϴ' => 'θ', - 'Ϸ' => 'ϸ', - 'Ϲ' => 'ϲ', - 'Ϻ' => 'ϻ', - 'Ͻ' => 'ͻ', - 'Ͼ' => 'ͼ', - 'Ͽ' => 'ͽ', - 'Ѐ' => 'ѐ', - 'Ё' => 'ё', - 'Ђ' => 'ђ', - 'Ѓ' => 'ѓ', - 'Є' => 'є', - 'Ѕ' => 'ѕ', - 'І' => 'і', - 'Ї' => 'ї', - 'Ј' => 'ј', - 'Љ' => 'љ', - 'Њ' => 'њ', - 'Ћ' => 'ћ', - 'Ќ' => 'ќ', - 'Ѝ' => 'ѝ', - 'Ў' => 'ў', - 'Џ' => 'џ', - 'А' => 'а', - 'Б' => 'б', - 'В' => 'в', - 'Г' => 'г', - 'Д' => 'д', - 'Е' => 'е', - 'Ж' => 'ж', - 'З' => 'з', - 'И' => 'и', - 'Й' => 'й', - 'К' => 'к', - 'Л' => 'л', - 'М' => 'м', - 'Н' => 'н', - 'О' => 'о', - 'П' => 'п', - 'Р' => 'р', - 'С' => 'с', - 'Т' => 'т', - 'У' => 'у', - 'Ф' => 'ф', - 'Х' => 'х', - 'Ц' => 'ц', - 'Ч' => 'ч', - 'Ш' => 'ш', - 'Щ' => 'щ', - 'Ъ' => 'ъ', - 'Ы' => 'ы', - 'Ь' => 'ь', - 'Э' => 'э', - 'Ю' => 'ю', - 'Я' => 'я', - 'Ѡ' => 'ѡ', - 'Ѣ' => 'ѣ', - 'Ѥ' => 'ѥ', - 'Ѧ' => 'ѧ', - 'Ѩ' => 'ѩ', - 'Ѫ' => 'ѫ', - 'Ѭ' => 'ѭ', - 'Ѯ' => 'ѯ', - 'Ѱ' => 'ѱ', - 'Ѳ' => 'ѳ', - 'Ѵ' => 'ѵ', - 'Ѷ' => 'ѷ', - 'Ѹ' => 'ѹ', - 'Ѻ' => 'ѻ', - 'Ѽ' => 'ѽ', - 'Ѿ' => 'ѿ', - 'Ҁ' => 'ҁ', - 'Ҋ' => 'ҋ', - 'Ҍ' => 'ҍ', - 'Ҏ' => 'ҏ', - 'Ґ' => 'ґ', - 'Ғ' => 'ғ', - 'Ҕ' => 'ҕ', - 'Җ' => 'җ', - 'Ҙ' => 'ҙ', - 'Қ' => 'қ', - 'Ҝ' => 'ҝ', - 'Ҟ' => 'ҟ', - 'Ҡ' => 'ҡ', - 'Ң' => 'ң', - 'Ҥ' => 'ҥ', - 'Ҧ' => 'ҧ', - 'Ҩ' => 'ҩ', - 'Ҫ' => 'ҫ', - 'Ҭ' => 'ҭ', - 'Ү' => 'ү', - 'Ұ' => 'ұ', - 'Ҳ' => 'ҳ', - 'Ҵ' => 'ҵ', - 'Ҷ' => 'ҷ', - 'Ҹ' => 'ҹ', - 'Һ' => 'һ', - 'Ҽ' => 'ҽ', - 'Ҿ' => 'ҿ', - 'Ӏ' => 'ӏ', - 'Ӂ' => 'ӂ', - 'Ӄ' => 'ӄ', - 'Ӆ' => 'ӆ', - 'Ӈ' => 'ӈ', - 'Ӊ' => 'ӊ', - 'Ӌ' => 'ӌ', - 'Ӎ' => 'ӎ', - 'Ӑ' => 'ӑ', - 'Ӓ' => 'ӓ', - 'Ӕ' => 'ӕ', - 'Ӗ' => 'ӗ', - 'Ә' => 'ә', - 'Ӛ' => 'ӛ', - 'Ӝ' => 'ӝ', - 'Ӟ' => 'ӟ', - 'Ӡ' => 'ӡ', - 'Ӣ' => 'ӣ', - 'Ӥ' => 'ӥ', - 'Ӧ' => 'ӧ', - 'Ө' => 'ө', - 'Ӫ' => 'ӫ', - 'Ӭ' => 'ӭ', - 'Ӯ' => 'ӯ', - 'Ӱ' => 'ӱ', - 'Ӳ' => 'ӳ', - 'Ӵ' => 'ӵ', - 'Ӷ' => 'ӷ', - 'Ӹ' => 'ӹ', - 'Ӻ' => 'ӻ', - 'Ӽ' => 'ӽ', - 'Ӿ' => 'ӿ', - 'Ԁ' => 'ԁ', - 'Ԃ' => 'ԃ', - 'Ԅ' => 'ԅ', - 'Ԇ' => 'ԇ', - 'Ԉ' => 'ԉ', - 'Ԋ' => 'ԋ', - 'Ԍ' => 'ԍ', - 'Ԏ' => 'ԏ', - 'Ԑ' => 'ԑ', - 'Ԓ' => 'ԓ', - 'Ԕ' => 'ԕ', - 'Ԗ' => 'ԗ', - 'Ԙ' => 'ԙ', - 'Ԛ' => 'ԛ', - 'Ԝ' => 'ԝ', - 'Ԟ' => 'ԟ', - 'Ԡ' => 'ԡ', - 'Ԣ' => 'ԣ', - 'Ԥ' => 'ԥ', - 'Ԧ' => 'ԧ', - 'Ԩ' => 'ԩ', - 'Ԫ' => 'ԫ', - 'Ԭ' => 'ԭ', - 'Ԯ' => 'ԯ', - 'Ա' => 'ա', - 'Բ' => 'բ', - 'Գ' => 'գ', - 'Դ' => 'դ', - 'Ե' => 'ե', - 'Զ' => 'զ', - 'Է' => 'է', - 'Ը' => 'ը', - 'Թ' => 'թ', - 'Ժ' => 'ժ', - 'Ի' => 'ի', - 'Լ' => 'լ', - 'Խ' => 'խ', - 'Ծ' => 'ծ', - 'Կ' => 'կ', - 'Հ' => 'հ', - 'Ձ' => 'ձ', - 'Ղ' => 'ղ', - 'Ճ' => 'ճ', - 'Մ' => 'մ', - 'Յ' => 'յ', - 'Ն' => 'ն', - 'Շ' => 'շ', - 'Ո' => 'ո', - 'Չ' => 'չ', - 'Պ' => 'պ', - 'Ջ' => 'ջ', - 'Ռ' => 'ռ', - 'Ս' => 'ս', - 'Վ' => 'վ', - 'Տ' => 'տ', - 'Ր' => 'ր', - 'Ց' => 'ց', - 'Ւ' => 'ւ', - 'Փ' => 'փ', - 'Ք' => 'ք', - 'Օ' => 'օ', - 'Ֆ' => 'ֆ', - 'Ⴀ' => 'ⴀ', - 'Ⴁ' => 'ⴁ', - 'Ⴂ' => 'ⴂ', - 'Ⴃ' => 'ⴃ', - 'Ⴄ' => 'ⴄ', - 'Ⴅ' => 'ⴅ', - 'Ⴆ' => 'ⴆ', - 'Ⴇ' => 'ⴇ', - 'Ⴈ' => 'ⴈ', - 'Ⴉ' => 'ⴉ', - 'Ⴊ' => 'ⴊ', - 'Ⴋ' => 'ⴋ', - 'Ⴌ' => 'ⴌ', - 'Ⴍ' => 'ⴍ', - 'Ⴎ' => 'ⴎ', - 'Ⴏ' => 'ⴏ', - 'Ⴐ' => 'ⴐ', - 'Ⴑ' => 'ⴑ', - 'Ⴒ' => 'ⴒ', - 'Ⴓ' => 'ⴓ', - 'Ⴔ' => 'ⴔ', - 'Ⴕ' => 'ⴕ', - 'Ⴖ' => 'ⴖ', - 'Ⴗ' => 'ⴗ', - 'Ⴘ' => 'ⴘ', - 'Ⴙ' => 'ⴙ', - 'Ⴚ' => 'ⴚ', - 'Ⴛ' => 'ⴛ', - 'Ⴜ' => 'ⴜ', - 'Ⴝ' => 'ⴝ', - 'Ⴞ' => 'ⴞ', - 'Ⴟ' => 'ⴟ', - 'Ⴠ' => 'ⴠ', - 'Ⴡ' => 'ⴡ', - 'Ⴢ' => 'ⴢ', - 'Ⴣ' => 'ⴣ', - 'Ⴤ' => 'ⴤ', - 'Ⴥ' => 'ⴥ', - 'Ⴧ' => 'ⴧ', - 'Ⴭ' => 'ⴭ', - 'Ḁ' => 'ḁ', - 'Ḃ' => 'ḃ', - 'Ḅ' => 'ḅ', - 'Ḇ' => 'ḇ', - 'Ḉ' => 'ḉ', - 'Ḋ' => 'ḋ', - 'Ḍ' => 'ḍ', - 'Ḏ' => 'ḏ', - 'Ḑ' => 'ḑ', - 'Ḓ' => 'ḓ', - 'Ḕ' => 'ḕ', - 'Ḗ' => 'ḗ', - 'Ḙ' => 'ḙ', - 'Ḛ' => 'ḛ', - 'Ḝ' => 'ḝ', - 'Ḟ' => 'ḟ', - 'Ḡ' => 'ḡ', - 'Ḣ' => 'ḣ', - 'Ḥ' => 'ḥ', - 'Ḧ' => 'ḧ', - 'Ḩ' => 'ḩ', - 'Ḫ' => 'ḫ', - 'Ḭ' => 'ḭ', - 'Ḯ' => 'ḯ', - 'Ḱ' => 'ḱ', - 'Ḳ' => 'ḳ', - 'Ḵ' => 'ḵ', - 'Ḷ' => 'ḷ', - 'Ḹ' => 'ḹ', - 'Ḻ' => 'ḻ', - 'Ḽ' => 'ḽ', - 'Ḿ' => 'ḿ', - 'Ṁ' => 'ṁ', - 'Ṃ' => 'ṃ', - 'Ṅ' => 'ṅ', - 'Ṇ' => 'ṇ', - 'Ṉ' => 'ṉ', - 'Ṋ' => 'ṋ', - 'Ṍ' => 'ṍ', - 'Ṏ' => 'ṏ', - 'Ṑ' => 'ṑ', - 'Ṓ' => 'ṓ', - 'Ṕ' => 'ṕ', - 'Ṗ' => 'ṗ', - 'Ṙ' => 'ṙ', - 'Ṛ' => 'ṛ', - 'Ṝ' => 'ṝ', - 'Ṟ' => 'ṟ', - 'Ṡ' => 'ṡ', - 'Ṣ' => 'ṣ', - 'Ṥ' => 'ṥ', - 'Ṧ' => 'ṧ', - 'Ṩ' => 'ṩ', - 'Ṫ' => 'ṫ', - 'Ṭ' => 'ṭ', - 'Ṯ' => 'ṯ', - 'Ṱ' => 'ṱ', - 'Ṳ' => 'ṳ', - 'Ṵ' => 'ṵ', - 'Ṷ' => 'ṷ', - 'Ṹ' => 'ṹ', - 'Ṻ' => 'ṻ', - 'Ṽ' => 'ṽ', - 'Ṿ' => 'ṿ', - 'Ẁ' => 'ẁ', - 'Ẃ' => 'ẃ', - 'Ẅ' => 'ẅ', - 'Ẇ' => 'ẇ', - 'Ẉ' => 'ẉ', - 'Ẋ' => 'ẋ', - 'Ẍ' => 'ẍ', - 'Ẏ' => 'ẏ', - 'Ẑ' => 'ẑ', - 'Ẓ' => 'ẓ', - 'Ẕ' => 'ẕ', - 'ẞ' => 'ß', - 'Ạ' => 'ạ', - 'Ả' => 'ả', - 'Ấ' => 'ấ', - 'Ầ' => 'ầ', - 'Ẩ' => 'ẩ', - 'Ẫ' => 'ẫ', - 'Ậ' => 'ậ', - 'Ắ' => 'ắ', - 'Ằ' => 'ằ', - 'Ẳ' => 'ẳ', - 'Ẵ' => 'ẵ', - 'Ặ' => 'ặ', - 'Ẹ' => 'ẹ', - 'Ẻ' => 'ẻ', - 'Ẽ' => 'ẽ', - 'Ế' => 'ế', - 'Ề' => 'ề', - 'Ể' => 'ể', - 'Ễ' => 'ễ', - 'Ệ' => 'ệ', - 'Ỉ' => 'ỉ', - 'Ị' => 'ị', - 'Ọ' => 'ọ', - 'Ỏ' => 'ỏ', - 'Ố' => 'ố', - 'Ồ' => 'ồ', - 'Ổ' => 'ổ', - 'Ỗ' => 'ỗ', - 'Ộ' => 'ộ', - 'Ớ' => 'ớ', - 'Ờ' => 'ờ', - 'Ở' => 'ở', - 'Ỡ' => 'ỡ', - 'Ợ' => 'ợ', - 'Ụ' => 'ụ', - 'Ủ' => 'ủ', - 'Ứ' => 'ứ', - 'Ừ' => 'ừ', - 'Ử' => 'ử', - 'Ữ' => 'ữ', - 'Ự' => 'ự', - 'Ỳ' => 'ỳ', - 'Ỵ' => 'ỵ', - 'Ỷ' => 'ỷ', - 'Ỹ' => 'ỹ', - 'Ỻ' => 'ỻ', - 'Ỽ' => 'ỽ', - 'Ỿ' => 'ỿ', - 'Ἀ' => 'ἀ', - 'Ἁ' => 'ἁ', - 'Ἂ' => 'ἂ', - 'Ἃ' => 'ἃ', - 'Ἄ' => 'ἄ', - 'Ἅ' => 'ἅ', - 'Ἆ' => 'ἆ', - 'Ἇ' => 'ἇ', - 'Ἐ' => 'ἐ', - 'Ἑ' => 'ἑ', - 'Ἒ' => 'ἒ', - 'Ἓ' => 'ἓ', - 'Ἔ' => 'ἔ', - 'Ἕ' => 'ἕ', - 'Ἠ' => 'ἠ', - 'Ἡ' => 'ἡ', - 'Ἢ' => 'ἢ', - 'Ἣ' => 'ἣ', - 'Ἤ' => 'ἤ', - 'Ἥ' => 'ἥ', - 'Ἦ' => 'ἦ', - 'Ἧ' => 'ἧ', - 'Ἰ' => 'ἰ', - 'Ἱ' => 'ἱ', - 'Ἲ' => 'ἲ', - 'Ἳ' => 'ἳ', - 'Ἴ' => 'ἴ', - 'Ἵ' => 'ἵ', - 'Ἶ' => 'ἶ', - 'Ἷ' => 'ἷ', - 'Ὀ' => 'ὀ', - 'Ὁ' => 'ὁ', - 'Ὂ' => 'ὂ', - 'Ὃ' => 'ὃ', - 'Ὄ' => 'ὄ', - 'Ὅ' => 'ὅ', - 'Ὑ' => 'ὑ', - 'Ὓ' => 'ὓ', - 'Ὕ' => 'ὕ', - 'Ὗ' => 'ὗ', - 'Ὠ' => 'ὠ', - 'Ὡ' => 'ὡ', - 'Ὢ' => 'ὢ', - 'Ὣ' => 'ὣ', - 'Ὤ' => 'ὤ', - 'Ὥ' => 'ὥ', - 'Ὦ' => 'ὦ', - 'Ὧ' => 'ὧ', - 'ᾈ' => 'ᾀ', - 'ᾉ' => 'ᾁ', - 'ᾊ' => 'ᾂ', - 'ᾋ' => 'ᾃ', - 'ᾌ' => 'ᾄ', - 'ᾍ' => 'ᾅ', - 'ᾎ' => 'ᾆ', - 'ᾏ' => 'ᾇ', - 'ᾘ' => 'ᾐ', - 'ᾙ' => 'ᾑ', - 'ᾚ' => 'ᾒ', - 'ᾛ' => 'ᾓ', - 'ᾜ' => 'ᾔ', - 'ᾝ' => 'ᾕ', - 'ᾞ' => 'ᾖ', - 'ᾟ' => 'ᾗ', - 'ᾨ' => 'ᾠ', - 'ᾩ' => 'ᾡ', - 'ᾪ' => 'ᾢ', - 'ᾫ' => 'ᾣ', - 'ᾬ' => 'ᾤ', - 'ᾭ' => 'ᾥ', - 'ᾮ' => 'ᾦ', - 'ᾯ' => 'ᾧ', - 'Ᾰ' => 'ᾰ', - 'Ᾱ' => 'ᾱ', - 'Ὰ' => 'ὰ', - 'Ά' => 'ά', - 'ᾼ' => 'ᾳ', - 'Ὲ' => 'ὲ', - 'Έ' => 'έ', - 'Ὴ' => 'ὴ', - 'Ή' => 'ή', - 'ῌ' => 'ῃ', - 'Ῐ' => 'ῐ', - 'Ῑ' => 'ῑ', - 'Ὶ' => 'ὶ', - 'Ί' => 'ί', - 'Ῠ' => 'ῠ', - 'Ῡ' => 'ῡ', - 'Ὺ' => 'ὺ', - 'Ύ' => 'ύ', - 'Ῥ' => 'ῥ', - 'Ὸ' => 'ὸ', - 'Ό' => 'ό', - 'Ὼ' => 'ὼ', - 'Ώ' => 'ώ', - 'ῼ' => 'ῳ', - 'Ω' => 'ω', - 'K' => 'k', - 'Å' => 'å', - 'Ⅎ' => 'ⅎ', - 'Ⅰ' => 'ⅰ', - 'Ⅱ' => 'ⅱ', - 'Ⅲ' => 'ⅲ', - 'Ⅳ' => 'ⅳ', - 'Ⅴ' => 'ⅴ', - 'Ⅵ' => 'ⅵ', - 'Ⅶ' => 'ⅶ', - 'Ⅷ' => 'ⅷ', - 'Ⅸ' => 'ⅸ', - 'Ⅹ' => 'ⅹ', - 'Ⅺ' => 'ⅺ', - 'Ⅻ' => 'ⅻ', - 'Ⅼ' => 'ⅼ', - 'Ⅽ' => 'ⅽ', - 'Ⅾ' => 'ⅾ', - 'Ⅿ' => 'ⅿ', - 'Ↄ' => 'ↄ', - 'Ⓐ' => 'ⓐ', - 'Ⓑ' => 'ⓑ', - 'Ⓒ' => 'ⓒ', - 'Ⓓ' => 'ⓓ', - 'Ⓔ' => 'ⓔ', - 'Ⓕ' => 'ⓕ', - 'Ⓖ' => 'ⓖ', - 'Ⓗ' => 'ⓗ', - 'Ⓘ' => 'ⓘ', - 'Ⓙ' => 'ⓙ', - 'Ⓚ' => 'ⓚ', - 'Ⓛ' => 'ⓛ', - 'Ⓜ' => 'ⓜ', - 'Ⓝ' => 'ⓝ', - 'Ⓞ' => 'ⓞ', - 'Ⓟ' => 'ⓟ', - 'Ⓠ' => 'ⓠ', - 'Ⓡ' => 'ⓡ', - 'Ⓢ' => 'ⓢ', - 'Ⓣ' => 'ⓣ', - 'Ⓤ' => 'ⓤ', - 'Ⓥ' => 'ⓥ', - 'Ⓦ' => 'ⓦ', - 'Ⓧ' => 'ⓧ', - 'Ⓨ' => 'ⓨ', - 'Ⓩ' => 'ⓩ', - 'Ⰰ' => 'ⰰ', - 'Ⰱ' => 'ⰱ', - 'Ⰲ' => 'ⰲ', - 'Ⰳ' => 'ⰳ', - 'Ⰴ' => 'ⰴ', - 'Ⰵ' => 'ⰵ', - 'Ⰶ' => 'ⰶ', - 'Ⰷ' => 'ⰷ', - 'Ⰸ' => 'ⰸ', - 'Ⰹ' => 'ⰹ', - 'Ⰺ' => 'ⰺ', - 'Ⰻ' => 'ⰻ', - 'Ⰼ' => 'ⰼ', - 'Ⰽ' => 'ⰽ', - 'Ⰾ' => 'ⰾ', - 'Ⰿ' => 'ⰿ', - 'Ⱀ' => 'ⱀ', - 'Ⱁ' => 'ⱁ', - 'Ⱂ' => 'ⱂ', - 'Ⱃ' => 'ⱃ', - 'Ⱄ' => 'ⱄ', - 'Ⱅ' => 'ⱅ', - 'Ⱆ' => 'ⱆ', - 'Ⱇ' => 'ⱇ', - 'Ⱈ' => 'ⱈ', - 'Ⱉ' => 'ⱉ', - 'Ⱊ' => 'ⱊ', - 'Ⱋ' => 'ⱋ', - 'Ⱌ' => 'ⱌ', - 'Ⱍ' => 'ⱍ', - 'Ⱎ' => 'ⱎ', - 'Ⱏ' => 'ⱏ', - 'Ⱐ' => 'ⱐ', - 'Ⱑ' => 'ⱑ', - 'Ⱒ' => 'ⱒ', - 'Ⱓ' => 'ⱓ', - 'Ⱔ' => 'ⱔ', - 'Ⱕ' => 'ⱕ', - 'Ⱖ' => 'ⱖ', - 'Ⱗ' => 'ⱗ', - 'Ⱘ' => 'ⱘ', - 'Ⱙ' => 'ⱙ', - 'Ⱚ' => 'ⱚ', - 'Ⱛ' => 'ⱛ', - 'Ⱜ' => 'ⱜ', - 'Ⱝ' => 'ⱝ', - 'Ⱞ' => 'ⱞ', - 'Ⱡ' => 'ⱡ', - 'Ɫ' => 'ɫ', - 'Ᵽ' => 'ᵽ', - 'Ɽ' => 'ɽ', - 'Ⱨ' => 'ⱨ', - 'Ⱪ' => 'ⱪ', - 'Ⱬ' => 'ⱬ', - 'Ɑ' => 'ɑ', - 'Ɱ' => 'ɱ', - 'Ɐ' => 'ɐ', - 'Ɒ' => 'ɒ', - 'Ⱳ' => 'ⱳ', - 'Ⱶ' => 'ⱶ', - 'Ȿ' => 'ȿ', - 'Ɀ' => 'ɀ', - 'Ⲁ' => 'ⲁ', - 'Ⲃ' => 'ⲃ', - 'Ⲅ' => 'ⲅ', - 'Ⲇ' => 'ⲇ', - 'Ⲉ' => 'ⲉ', - 'Ⲋ' => 'ⲋ', - 'Ⲍ' => 'ⲍ', - 'Ⲏ' => 'ⲏ', - 'Ⲑ' => 'ⲑ', - 'Ⲓ' => 'ⲓ', - 'Ⲕ' => 'ⲕ', - 'Ⲗ' => 'ⲗ', - 'Ⲙ' => 'ⲙ', - 'Ⲛ' => 'ⲛ', - 'Ⲝ' => 'ⲝ', - 'Ⲟ' => 'ⲟ', - 'Ⲡ' => 'ⲡ', - 'Ⲣ' => 'ⲣ', - 'Ⲥ' => 'ⲥ', - 'Ⲧ' => 'ⲧ', - 'Ⲩ' => 'ⲩ', - 'Ⲫ' => 'ⲫ', - 'Ⲭ' => 'ⲭ', - 'Ⲯ' => 'ⲯ', - 'Ⲱ' => 'ⲱ', - 'Ⲳ' => 'ⲳ', - 'Ⲵ' => 'ⲵ', - 'Ⲷ' => 'ⲷ', - 'Ⲹ' => 'ⲹ', - 'Ⲻ' => 'ⲻ', - 'Ⲽ' => 'ⲽ', - 'Ⲿ' => 'ⲿ', - 'Ⳁ' => 'ⳁ', - 'Ⳃ' => 'ⳃ', - 'Ⳅ' => 'ⳅ', - 'Ⳇ' => 'ⳇ', - 'Ⳉ' => 'ⳉ', - 'Ⳋ' => 'ⳋ', - 'Ⳍ' => 'ⳍ', - 'Ⳏ' => 'ⳏ', - 'Ⳑ' => 'ⳑ', - 'Ⳓ' => 'ⳓ', - 'Ⳕ' => 'ⳕ', - 'Ⳗ' => 'ⳗ', - 'Ⳙ' => 'ⳙ', - 'Ⳛ' => 'ⳛ', - 'Ⳝ' => 'ⳝ', - 'Ⳟ' => 'ⳟ', - 'Ⳡ' => 'ⳡ', - 'Ⳣ' => 'ⳣ', - 'Ⳬ' => 'ⳬ', - 'Ⳮ' => 'ⳮ', - 'Ⳳ' => 'ⳳ', - 'Ꙁ' => 'ꙁ', - 'Ꙃ' => 'ꙃ', - 'Ꙅ' => 'ꙅ', - 'Ꙇ' => 'ꙇ', - 'Ꙉ' => 'ꙉ', - 'Ꙋ' => 'ꙋ', - 'Ꙍ' => 'ꙍ', - 'Ꙏ' => 'ꙏ', - 'Ꙑ' => 'ꙑ', - 'Ꙓ' => 'ꙓ', - 'Ꙕ' => 'ꙕ', - 'Ꙗ' => 'ꙗ', - 'Ꙙ' => 'ꙙ', - 'Ꙛ' => 'ꙛ', - 'Ꙝ' => 'ꙝ', - 'Ꙟ' => 'ꙟ', - 'Ꙡ' => 'ꙡ', - 'Ꙣ' => 'ꙣ', - 'Ꙥ' => 'ꙥ', - 'Ꙧ' => 'ꙧ', - 'Ꙩ' => 'ꙩ', - 'Ꙫ' => 'ꙫ', - 'Ꙭ' => 'ꙭ', - 'Ꚁ' => 'ꚁ', - 'Ꚃ' => 'ꚃ', - 'Ꚅ' => 'ꚅ', - 'Ꚇ' => 'ꚇ', - 'Ꚉ' => 'ꚉ', - 'Ꚋ' => 'ꚋ', - 'Ꚍ' => 'ꚍ', - 'Ꚏ' => 'ꚏ', - 'Ꚑ' => 'ꚑ', - 'Ꚓ' => 'ꚓ', - 'Ꚕ' => 'ꚕ', - 'Ꚗ' => 'ꚗ', - 'Ꚙ' => 'ꚙ', - 'Ꚛ' => 'ꚛ', - 'Ꜣ' => 'ꜣ', - 'Ꜥ' => 'ꜥ', - 'Ꜧ' => 'ꜧ', - 'Ꜩ' => 'ꜩ', - 'Ꜫ' => 'ꜫ', - 'Ꜭ' => 'ꜭ', - 'Ꜯ' => 'ꜯ', - 'Ꜳ' => 'ꜳ', - 'Ꜵ' => 'ꜵ', - 'Ꜷ' => 'ꜷ', - 'Ꜹ' => 'ꜹ', - 'Ꜻ' => 'ꜻ', - 'Ꜽ' => 'ꜽ', - 'Ꜿ' => 'ꜿ', - 'Ꝁ' => 'ꝁ', - 'Ꝃ' => 'ꝃ', - 'Ꝅ' => 'ꝅ', - 'Ꝇ' => 'ꝇ', - 'Ꝉ' => 'ꝉ', - 'Ꝋ' => 'ꝋ', - 'Ꝍ' => 'ꝍ', - 'Ꝏ' => 'ꝏ', - 'Ꝑ' => 'ꝑ', - 'Ꝓ' => 'ꝓ', - 'Ꝕ' => 'ꝕ', - 'Ꝗ' => 'ꝗ', - 'Ꝙ' => 'ꝙ', - 'Ꝛ' => 'ꝛ', - 'Ꝝ' => 'ꝝ', - 'Ꝟ' => 'ꝟ', - 'Ꝡ' => 'ꝡ', - 'Ꝣ' => 'ꝣ', - 'Ꝥ' => 'ꝥ', - 'Ꝧ' => 'ꝧ', - 'Ꝩ' => 'ꝩ', - 'Ꝫ' => 'ꝫ', - 'Ꝭ' => 'ꝭ', - 'Ꝯ' => 'ꝯ', - 'Ꝺ' => 'ꝺ', - 'Ꝼ' => 'ꝼ', - 'Ᵹ' => 'ᵹ', - 'Ꝿ' => 'ꝿ', - 'Ꞁ' => 'ꞁ', - 'Ꞃ' => 'ꞃ', - 'Ꞅ' => 'ꞅ', - 'Ꞇ' => 'ꞇ', - 'Ꞌ' => 'ꞌ', - 'Ɥ' => 'ɥ', - 'Ꞑ' => 'ꞑ', - 'Ꞓ' => 'ꞓ', - 'Ꞗ' => 'ꞗ', - 'Ꞙ' => 'ꞙ', - 'Ꞛ' => 'ꞛ', - 'Ꞝ' => 'ꞝ', - 'Ꞟ' => 'ꞟ', - 'Ꞡ' => 'ꞡ', - 'Ꞣ' => 'ꞣ', - 'Ꞥ' => 'ꞥ', - 'Ꞧ' => 'ꞧ', - 'Ꞩ' => 'ꞩ', - 'Ɦ' => 'ɦ', - 'Ɜ' => 'ɜ', - 'Ɡ' => 'ɡ', - 'Ɬ' => 'ɬ', - 'Ʞ' => 'ʞ', - 'Ʇ' => 'ʇ', - 'A' => 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - '𐐀' => '𐐨', - '𐐁' => '𐐩', - '𐐂' => '𐐪', - '𐐃' => '𐐫', - '𐐄' => '𐐬', - '𐐅' => '𐐭', - '𐐆' => '𐐮', - '𐐇' => '𐐯', - '𐐈' => '𐐰', - '𐐉' => '𐐱', - '𐐊' => '𐐲', - '𐐋' => '𐐳', - '𐐌' => '𐐴', - '𐐍' => '𐐵', - '𐐎' => '𐐶', - '𐐏' => '𐐷', - '𐐐' => '𐐸', - '𐐑' => '𐐹', - '𐐒' => '𐐺', - '𐐓' => '𐐻', - '𐐔' => '𐐼', - '𐐕' => '𐐽', - '𐐖' => '𐐾', - '𐐗' => '𐐿', - '𐐘' => '𐑀', - '𐐙' => '𐑁', - '𐐚' => '𐑂', - '𐐛' => '𐑃', - '𐐜' => '𐑄', - '𐐝' => '𐑅', - '𐐞' => '𐑆', - '𐐟' => '𐑇', - '𐐠' => '𐑈', - '𐐡' => '𐑉', - '𐐢' => '𐑊', - '𐐣' => '𐑋', - '𐐤' => '𐑌', - '𐐥' => '𐑍', - '𐐦' => '𐑎', - '𐐧' => '𐑏', - '𑢠' => '𑣀', - '𑢡' => '𑣁', - '𑢢' => '𑣂', - '𑢣' => '𑣃', - '𑢤' => '𑣄', - '𑢥' => '𑣅', - '𑢦' => '𑣆', - '𑢧' => '𑣇', - '𑢨' => '𑣈', - '𑢩' => '𑣉', - '𑢪' => '𑣊', - '𑢫' => '𑣋', - '𑢬' => '𑣌', - '𑢭' => '𑣍', - '𑢮' => '𑣎', - '𑢯' => '𑣏', - '𑢰' => '𑣐', - '𑢱' => '𑣑', - '𑢲' => '𑣒', - '𑢳' => '𑣓', - '𑢴' => '𑣔', - '𑢵' => '𑣕', - '𑢶' => '𑣖', - '𑢷' => '𑣗', - '𑢸' => '𑣘', - '𑢹' => '𑣙', - '𑢺' => '𑣚', - '𑢻' => '𑣛', - '𑢼' => '𑣜', - '𑢽' => '𑣝', - '𑢾' => '𑣞', - '𑢿' => '𑣟', -); diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php deleted file mode 100644 index 2a8f6e7..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +++ /dev/null @@ -1,5 +0,0 @@ - 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - 'µ' => 'Μ', - 'à' => 'À', - 'á' => 'Á', - 'â' => 'Â', - 'ã' => 'Ã', - 'ä' => 'Ä', - 'å' => 'Å', - 'æ' => 'Æ', - 'ç' => 'Ç', - 'è' => 'È', - 'é' => 'É', - 'ê' => 'Ê', - 'ë' => 'Ë', - 'ì' => 'Ì', - 'í' => 'Í', - 'î' => 'Î', - 'ï' => 'Ï', - 'ð' => 'Ð', - 'ñ' => 'Ñ', - 'ò' => 'Ò', - 'ó' => 'Ó', - 'ô' => 'Ô', - 'õ' => 'Õ', - 'ö' => 'Ö', - 'ø' => 'Ø', - 'ù' => 'Ù', - 'ú' => 'Ú', - 'û' => 'Û', - 'ü' => 'Ü', - 'ý' => 'Ý', - 'þ' => 'Þ', - 'ÿ' => 'Ÿ', - 'ā' => 'Ā', - 'ă' => 'Ă', - 'ą' => 'Ą', - 'ć' => 'Ć', - 'ĉ' => 'Ĉ', - 'ċ' => 'Ċ', - 'č' => 'Č', - 'ď' => 'Ď', - 'đ' => 'Đ', - 'ē' => 'Ē', - 'ĕ' => 'Ĕ', - 'ė' => 'Ė', - 'ę' => 'Ę', - 'ě' => 'Ě', - 'ĝ' => 'Ĝ', - 'ğ' => 'Ğ', - 'ġ' => 'Ġ', - 'ģ' => 'Ģ', - 'ĥ' => 'Ĥ', - 'ħ' => 'Ħ', - 'ĩ' => 'Ĩ', - 'ī' => 'Ī', - 'ĭ' => 'Ĭ', - 'į' => 'Į', - 'ı' => 'I', - 'ij' => 'IJ', - 'ĵ' => 'Ĵ', - 'ķ' => 'Ķ', - 'ĺ' => 'Ĺ', - 'ļ' => 'Ļ', - 'ľ' => 'Ľ', - 'ŀ' => 'Ŀ', - 'ł' => 'Ł', - 'ń' => 'Ń', - 'ņ' => 'Ņ', - 'ň' => 'Ň', - 'ŋ' => 'Ŋ', - 'ō' => 'Ō', - 'ŏ' => 'Ŏ', - 'ő' => 'Ő', - 'œ' => 'Œ', - 'ŕ' => 'Ŕ', - 'ŗ' => 'Ŗ', - 'ř' => 'Ř', - 'ś' => 'Ś', - 'ŝ' => 'Ŝ', - 'ş' => 'Ş', - 'š' => 'Š', - 'ţ' => 'Ţ', - 'ť' => 'Ť', - 'ŧ' => 'Ŧ', - 'ũ' => 'Ũ', - 'ū' => 'Ū', - 'ŭ' => 'Ŭ', - 'ů' => 'Ů', - 'ű' => 'Ű', - 'ų' => 'Ų', - 'ŵ' => 'Ŵ', - 'ŷ' => 'Ŷ', - 'ź' => 'Ź', - 'ż' => 'Ż', - 'ž' => 'Ž', - 'ſ' => 'S', - 'ƀ' => 'Ƀ', - 'ƃ' => 'Ƃ', - 'ƅ' => 'Ƅ', - 'ƈ' => 'Ƈ', - 'ƌ' => 'Ƌ', - 'ƒ' => 'Ƒ', - 'ƕ' => 'Ƕ', - 'ƙ' => 'Ƙ', - 'ƚ' => 'Ƚ', - 'ƞ' => 'Ƞ', - 'ơ' => 'Ơ', - 'ƣ' => 'Ƣ', - 'ƥ' => 'Ƥ', - 'ƨ' => 'Ƨ', - 'ƭ' => 'Ƭ', - 'ư' => 'Ư', - 'ƴ' => 'Ƴ', - 'ƶ' => 'Ƶ', - 'ƹ' => 'Ƹ', - 'ƽ' => 'Ƽ', - 'ƿ' => 'Ƿ', - 'Dž' => 'DŽ', - 'dž' => 'DŽ', - 'Lj' => 'LJ', - 'lj' => 'LJ', - 'Nj' => 'NJ', - 'nj' => 'NJ', - 'ǎ' => 'Ǎ', - 'ǐ' => 'Ǐ', - 'ǒ' => 'Ǒ', - 'ǔ' => 'Ǔ', - 'ǖ' => 'Ǖ', - 'ǘ' => 'Ǘ', - 'ǚ' => 'Ǚ', - 'ǜ' => 'Ǜ', - 'ǝ' => 'Ǝ', - 'ǟ' => 'Ǟ', - 'ǡ' => 'Ǡ', - 'ǣ' => 'Ǣ', - 'ǥ' => 'Ǥ', - 'ǧ' => 'Ǧ', - 'ǩ' => 'Ǩ', - 'ǫ' => 'Ǫ', - 'ǭ' => 'Ǭ', - 'ǯ' => 'Ǯ', - 'Dz' => 'DZ', - 'dz' => 'DZ', - 'ǵ' => 'Ǵ', - 'ǹ' => 'Ǹ', - 'ǻ' => 'Ǻ', - 'ǽ' => 'Ǽ', - 'ǿ' => 'Ǿ', - 'ȁ' => 'Ȁ', - 'ȃ' => 'Ȃ', - 'ȅ' => 'Ȅ', - 'ȇ' => 'Ȇ', - 'ȉ' => 'Ȉ', - 'ȋ' => 'Ȋ', - 'ȍ' => 'Ȍ', - 'ȏ' => 'Ȏ', - 'ȑ' => 'Ȑ', - 'ȓ' => 'Ȓ', - 'ȕ' => 'Ȕ', - 'ȗ' => 'Ȗ', - 'ș' => 'Ș', - 'ț' => 'Ț', - 'ȝ' => 'Ȝ', - 'ȟ' => 'Ȟ', - 'ȣ' => 'Ȣ', - 'ȥ' => 'Ȥ', - 'ȧ' => 'Ȧ', - 'ȩ' => 'Ȩ', - 'ȫ' => 'Ȫ', - 'ȭ' => 'Ȭ', - 'ȯ' => 'Ȯ', - 'ȱ' => 'Ȱ', - 'ȳ' => 'Ȳ', - 'ȼ' => 'Ȼ', - 'ȿ' => 'Ȿ', - 'ɀ' => 'Ɀ', - 'ɂ' => 'Ɂ', - 'ɇ' => 'Ɇ', - 'ɉ' => 'Ɉ', - 'ɋ' => 'Ɋ', - 'ɍ' => 'Ɍ', - 'ɏ' => 'Ɏ', - 'ɐ' => 'Ɐ', - 'ɑ' => 'Ɑ', - 'ɒ' => 'Ɒ', - 'ɓ' => 'Ɓ', - 'ɔ' => 'Ɔ', - 'ɖ' => 'Ɖ', - 'ɗ' => 'Ɗ', - 'ə' => 'Ə', - 'ɛ' => 'Ɛ', - 'ɜ' => 'Ɜ', - 'ɠ' => 'Ɠ', - 'ɡ' => 'Ɡ', - 'ɣ' => 'Ɣ', - 'ɥ' => 'Ɥ', - 'ɦ' => 'Ɦ', - 'ɨ' => 'Ɨ', - 'ɩ' => 'Ɩ', - 'ɫ' => 'Ɫ', - 'ɬ' => 'Ɬ', - 'ɯ' => 'Ɯ', - 'ɱ' => 'Ɱ', - 'ɲ' => 'Ɲ', - 'ɵ' => 'Ɵ', - 'ɽ' => 'Ɽ', - 'ʀ' => 'Ʀ', - 'ʃ' => 'Ʃ', - 'ʇ' => 'Ʇ', - 'ʈ' => 'Ʈ', - 'ʉ' => 'Ʉ', - 'ʊ' => 'Ʊ', - 'ʋ' => 'Ʋ', - 'ʌ' => 'Ʌ', - 'ʒ' => 'Ʒ', - 'ʞ' => 'Ʞ', - 'ͅ' => 'Ι', - 'ͱ' => 'Ͱ', - 'ͳ' => 'Ͳ', - 'ͷ' => 'Ͷ', - 'ͻ' => 'Ͻ', - 'ͼ' => 'Ͼ', - 'ͽ' => 'Ͽ', - 'ά' => 'Ά', - 'έ' => 'Έ', - 'ή' => 'Ή', - 'ί' => 'Ί', - 'α' => 'Α', - 'β' => 'Β', - 'γ' => 'Γ', - 'δ' => 'Δ', - 'ε' => 'Ε', - 'ζ' => 'Ζ', - 'η' => 'Η', - 'θ' => 'Θ', - 'ι' => 'Ι', - 'κ' => 'Κ', - 'λ' => 'Λ', - 'μ' => 'Μ', - 'ν' => 'Ν', - 'ξ' => 'Ξ', - 'ο' => 'Ο', - 'π' => 'Π', - 'ρ' => 'Ρ', - 'ς' => 'Σ', - 'σ' => 'Σ', - 'τ' => 'Τ', - 'υ' => 'Υ', - 'φ' => 'Φ', - 'χ' => 'Χ', - 'ψ' => 'Ψ', - 'ω' => 'Ω', - 'ϊ' => 'Ϊ', - 'ϋ' => 'Ϋ', - 'ό' => 'Ό', - 'ύ' => 'Ύ', - 'ώ' => 'Ώ', - 'ϐ' => 'Β', - 'ϑ' => 'Θ', - 'ϕ' => 'Φ', - 'ϖ' => 'Π', - 'ϗ' => 'Ϗ', - 'ϙ' => 'Ϙ', - 'ϛ' => 'Ϛ', - 'ϝ' => 'Ϝ', - 'ϟ' => 'Ϟ', - 'ϡ' => 'Ϡ', - 'ϣ' => 'Ϣ', - 'ϥ' => 'Ϥ', - 'ϧ' => 'Ϧ', - 'ϩ' => 'Ϩ', - 'ϫ' => 'Ϫ', - 'ϭ' => 'Ϭ', - 'ϯ' => 'Ϯ', - 'ϰ' => 'Κ', - 'ϱ' => 'Ρ', - 'ϲ' => 'Ϲ', - 'ϳ' => 'Ϳ', - 'ϵ' => 'Ε', - 'ϸ' => 'Ϸ', - 'ϻ' => 'Ϻ', - 'а' => 'А', - 'б' => 'Б', - 'в' => 'В', - 'г' => 'Г', - 'д' => 'Д', - 'е' => 'Е', - 'ж' => 'Ж', - 'з' => 'З', - 'и' => 'И', - 'й' => 'Й', - 'к' => 'К', - 'л' => 'Л', - 'м' => 'М', - 'н' => 'Н', - 'о' => 'О', - 'п' => 'П', - 'р' => 'Р', - 'с' => 'С', - 'т' => 'Т', - 'у' => 'У', - 'ф' => 'Ф', - 'х' => 'Х', - 'ц' => 'Ц', - 'ч' => 'Ч', - 'ш' => 'Ш', - 'щ' => 'Щ', - 'ъ' => 'Ъ', - 'ы' => 'Ы', - 'ь' => 'Ь', - 'э' => 'Э', - 'ю' => 'Ю', - 'я' => 'Я', - 'ѐ' => 'Ѐ', - 'ё' => 'Ё', - 'ђ' => 'Ђ', - 'ѓ' => 'Ѓ', - 'є' => 'Є', - 'ѕ' => 'Ѕ', - 'і' => 'І', - 'ї' => 'Ї', - 'ј' => 'Ј', - 'љ' => 'Љ', - 'њ' => 'Њ', - 'ћ' => 'Ћ', - 'ќ' => 'Ќ', - 'ѝ' => 'Ѝ', - 'ў' => 'Ў', - 'џ' => 'Џ', - 'ѡ' => 'Ѡ', - 'ѣ' => 'Ѣ', - 'ѥ' => 'Ѥ', - 'ѧ' => 'Ѧ', - 'ѩ' => 'Ѩ', - 'ѫ' => 'Ѫ', - 'ѭ' => 'Ѭ', - 'ѯ' => 'Ѯ', - 'ѱ' => 'Ѱ', - 'ѳ' => 'Ѳ', - 'ѵ' => 'Ѵ', - 'ѷ' => 'Ѷ', - 'ѹ' => 'Ѹ', - 'ѻ' => 'Ѻ', - 'ѽ' => 'Ѽ', - 'ѿ' => 'Ѿ', - 'ҁ' => 'Ҁ', - 'ҋ' => 'Ҋ', - 'ҍ' => 'Ҍ', - 'ҏ' => 'Ҏ', - 'ґ' => 'Ґ', - 'ғ' => 'Ғ', - 'ҕ' => 'Ҕ', - 'җ' => 'Җ', - 'ҙ' => 'Ҙ', - 'қ' => 'Қ', - 'ҝ' => 'Ҝ', - 'ҟ' => 'Ҟ', - 'ҡ' => 'Ҡ', - 'ң' => 'Ң', - 'ҥ' => 'Ҥ', - 'ҧ' => 'Ҧ', - 'ҩ' => 'Ҩ', - 'ҫ' => 'Ҫ', - 'ҭ' => 'Ҭ', - 'ү' => 'Ү', - 'ұ' => 'Ұ', - 'ҳ' => 'Ҳ', - 'ҵ' => 'Ҵ', - 'ҷ' => 'Ҷ', - 'ҹ' => 'Ҹ', - 'һ' => 'Һ', - 'ҽ' => 'Ҽ', - 'ҿ' => 'Ҿ', - 'ӂ' => 'Ӂ', - 'ӄ' => 'Ӄ', - 'ӆ' => 'Ӆ', - 'ӈ' => 'Ӈ', - 'ӊ' => 'Ӊ', - 'ӌ' => 'Ӌ', - 'ӎ' => 'Ӎ', - 'ӏ' => 'Ӏ', - 'ӑ' => 'Ӑ', - 'ӓ' => 'Ӓ', - 'ӕ' => 'Ӕ', - 'ӗ' => 'Ӗ', - 'ә' => 'Ә', - 'ӛ' => 'Ӛ', - 'ӝ' => 'Ӝ', - 'ӟ' => 'Ӟ', - 'ӡ' => 'Ӡ', - 'ӣ' => 'Ӣ', - 'ӥ' => 'Ӥ', - 'ӧ' => 'Ӧ', - 'ө' => 'Ө', - 'ӫ' => 'Ӫ', - 'ӭ' => 'Ӭ', - 'ӯ' => 'Ӯ', - 'ӱ' => 'Ӱ', - 'ӳ' => 'Ӳ', - 'ӵ' => 'Ӵ', - 'ӷ' => 'Ӷ', - 'ӹ' => 'Ӹ', - 'ӻ' => 'Ӻ', - 'ӽ' => 'Ӽ', - 'ӿ' => 'Ӿ', - 'ԁ' => 'Ԁ', - 'ԃ' => 'Ԃ', - 'ԅ' => 'Ԅ', - 'ԇ' => 'Ԇ', - 'ԉ' => 'Ԉ', - 'ԋ' => 'Ԋ', - 'ԍ' => 'Ԍ', - 'ԏ' => 'Ԏ', - 'ԑ' => 'Ԑ', - 'ԓ' => 'Ԓ', - 'ԕ' => 'Ԕ', - 'ԗ' => 'Ԗ', - 'ԙ' => 'Ԙ', - 'ԛ' => 'Ԛ', - 'ԝ' => 'Ԝ', - 'ԟ' => 'Ԟ', - 'ԡ' => 'Ԡ', - 'ԣ' => 'Ԣ', - 'ԥ' => 'Ԥ', - 'ԧ' => 'Ԧ', - 'ԩ' => 'Ԩ', - 'ԫ' => 'Ԫ', - 'ԭ' => 'Ԭ', - 'ԯ' => 'Ԯ', - 'ա' => 'Ա', - 'բ' => 'Բ', - 'գ' => 'Գ', - 'դ' => 'Դ', - 'ե' => 'Ե', - 'զ' => 'Զ', - 'է' => 'Է', - 'ը' => 'Ը', - 'թ' => 'Թ', - 'ժ' => 'Ժ', - 'ի' => 'Ի', - 'լ' => 'Լ', - 'խ' => 'Խ', - 'ծ' => 'Ծ', - 'կ' => 'Կ', - 'հ' => 'Հ', - 'ձ' => 'Ձ', - 'ղ' => 'Ղ', - 'ճ' => 'Ճ', - 'մ' => 'Մ', - 'յ' => 'Յ', - 'ն' => 'Ն', - 'շ' => 'Շ', - 'ո' => 'Ո', - 'չ' => 'Չ', - 'պ' => 'Պ', - 'ջ' => 'Ջ', - 'ռ' => 'Ռ', - 'ս' => 'Ս', - 'վ' => 'Վ', - 'տ' => 'Տ', - 'ր' => 'Ր', - 'ց' => 'Ց', - 'ւ' => 'Ւ', - 'փ' => 'Փ', - 'ք' => 'Ք', - 'օ' => 'Օ', - 'ֆ' => 'Ֆ', - 'ᵹ' => 'Ᵹ', - 'ᵽ' => 'Ᵽ', - 'ḁ' => 'Ḁ', - 'ḃ' => 'Ḃ', - 'ḅ' => 'Ḅ', - 'ḇ' => 'Ḇ', - 'ḉ' => 'Ḉ', - 'ḋ' => 'Ḋ', - 'ḍ' => 'Ḍ', - 'ḏ' => 'Ḏ', - 'ḑ' => 'Ḑ', - 'ḓ' => 'Ḓ', - 'ḕ' => 'Ḕ', - 'ḗ' => 'Ḗ', - 'ḙ' => 'Ḙ', - 'ḛ' => 'Ḛ', - 'ḝ' => 'Ḝ', - 'ḟ' => 'Ḟ', - 'ḡ' => 'Ḡ', - 'ḣ' => 'Ḣ', - 'ḥ' => 'Ḥ', - 'ḧ' => 'Ḧ', - 'ḩ' => 'Ḩ', - 'ḫ' => 'Ḫ', - 'ḭ' => 'Ḭ', - 'ḯ' => 'Ḯ', - 'ḱ' => 'Ḱ', - 'ḳ' => 'Ḳ', - 'ḵ' => 'Ḵ', - 'ḷ' => 'Ḷ', - 'ḹ' => 'Ḹ', - 'ḻ' => 'Ḻ', - 'ḽ' => 'Ḽ', - 'ḿ' => 'Ḿ', - 'ṁ' => 'Ṁ', - 'ṃ' => 'Ṃ', - 'ṅ' => 'Ṅ', - 'ṇ' => 'Ṇ', - 'ṉ' => 'Ṉ', - 'ṋ' => 'Ṋ', - 'ṍ' => 'Ṍ', - 'ṏ' => 'Ṏ', - 'ṑ' => 'Ṑ', - 'ṓ' => 'Ṓ', - 'ṕ' => 'Ṕ', - 'ṗ' => 'Ṗ', - 'ṙ' => 'Ṙ', - 'ṛ' => 'Ṛ', - 'ṝ' => 'Ṝ', - 'ṟ' => 'Ṟ', - 'ṡ' => 'Ṡ', - 'ṣ' => 'Ṣ', - 'ṥ' => 'Ṥ', - 'ṧ' => 'Ṧ', - 'ṩ' => 'Ṩ', - 'ṫ' => 'Ṫ', - 'ṭ' => 'Ṭ', - 'ṯ' => 'Ṯ', - 'ṱ' => 'Ṱ', - 'ṳ' => 'Ṳ', - 'ṵ' => 'Ṵ', - 'ṷ' => 'Ṷ', - 'ṹ' => 'Ṹ', - 'ṻ' => 'Ṻ', - 'ṽ' => 'Ṽ', - 'ṿ' => 'Ṿ', - 'ẁ' => 'Ẁ', - 'ẃ' => 'Ẃ', - 'ẅ' => 'Ẅ', - 'ẇ' => 'Ẇ', - 'ẉ' => 'Ẉ', - 'ẋ' => 'Ẋ', - 'ẍ' => 'Ẍ', - 'ẏ' => 'Ẏ', - 'ẑ' => 'Ẑ', - 'ẓ' => 'Ẓ', - 'ẕ' => 'Ẕ', - 'ẛ' => 'Ṡ', - 'ạ' => 'Ạ', - 'ả' => 'Ả', - 'ấ' => 'Ấ', - 'ầ' => 'Ầ', - 'ẩ' => 'Ẩ', - 'ẫ' => 'Ẫ', - 'ậ' => 'Ậ', - 'ắ' => 'Ắ', - 'ằ' => 'Ằ', - 'ẳ' => 'Ẳ', - 'ẵ' => 'Ẵ', - 'ặ' => 'Ặ', - 'ẹ' => 'Ẹ', - 'ẻ' => 'Ẻ', - 'ẽ' => 'Ẽ', - 'ế' => 'Ế', - 'ề' => 'Ề', - 'ể' => 'Ể', - 'ễ' => 'Ễ', - 'ệ' => 'Ệ', - 'ỉ' => 'Ỉ', - 'ị' => 'Ị', - 'ọ' => 'Ọ', - 'ỏ' => 'Ỏ', - 'ố' => 'Ố', - 'ồ' => 'Ồ', - 'ổ' => 'Ổ', - 'ỗ' => 'Ỗ', - 'ộ' => 'Ộ', - 'ớ' => 'Ớ', - 'ờ' => 'Ờ', - 'ở' => 'Ở', - 'ỡ' => 'Ỡ', - 'ợ' => 'Ợ', - 'ụ' => 'Ụ', - 'ủ' => 'Ủ', - 'ứ' => 'Ứ', - 'ừ' => 'Ừ', - 'ử' => 'Ử', - 'ữ' => 'Ữ', - 'ự' => 'Ự', - 'ỳ' => 'Ỳ', - 'ỵ' => 'Ỵ', - 'ỷ' => 'Ỷ', - 'ỹ' => 'Ỹ', - 'ỻ' => 'Ỻ', - 'ỽ' => 'Ỽ', - 'ỿ' => 'Ỿ', - 'ἀ' => 'Ἀ', - 'ἁ' => 'Ἁ', - 'ἂ' => 'Ἂ', - 'ἃ' => 'Ἃ', - 'ἄ' => 'Ἄ', - 'ἅ' => 'Ἅ', - 'ἆ' => 'Ἆ', - 'ἇ' => 'Ἇ', - 'ἐ' => 'Ἐ', - 'ἑ' => 'Ἑ', - 'ἒ' => 'Ἒ', - 'ἓ' => 'Ἓ', - 'ἔ' => 'Ἔ', - 'ἕ' => 'Ἕ', - 'ἠ' => 'Ἠ', - 'ἡ' => 'Ἡ', - 'ἢ' => 'Ἢ', - 'ἣ' => 'Ἣ', - 'ἤ' => 'Ἤ', - 'ἥ' => 'Ἥ', - 'ἦ' => 'Ἦ', - 'ἧ' => 'Ἧ', - 'ἰ' => 'Ἰ', - 'ἱ' => 'Ἱ', - 'ἲ' => 'Ἲ', - 'ἳ' => 'Ἳ', - 'ἴ' => 'Ἴ', - 'ἵ' => 'Ἵ', - 'ἶ' => 'Ἶ', - 'ἷ' => 'Ἷ', - 'ὀ' => 'Ὀ', - 'ὁ' => 'Ὁ', - 'ὂ' => 'Ὂ', - 'ὃ' => 'Ὃ', - 'ὄ' => 'Ὄ', - 'ὅ' => 'Ὅ', - 'ὑ' => 'Ὑ', - 'ὓ' => 'Ὓ', - 'ὕ' => 'Ὕ', - 'ὗ' => 'Ὗ', - 'ὠ' => 'Ὠ', - 'ὡ' => 'Ὡ', - 'ὢ' => 'Ὢ', - 'ὣ' => 'Ὣ', - 'ὤ' => 'Ὤ', - 'ὥ' => 'Ὥ', - 'ὦ' => 'Ὦ', - 'ὧ' => 'Ὧ', - 'ὰ' => 'Ὰ', - 'ά' => 'Ά', - 'ὲ' => 'Ὲ', - 'έ' => 'Έ', - 'ὴ' => 'Ὴ', - 'ή' => 'Ή', - 'ὶ' => 'Ὶ', - 'ί' => 'Ί', - 'ὸ' => 'Ὸ', - 'ό' => 'Ό', - 'ὺ' => 'Ὺ', - 'ύ' => 'Ύ', - 'ὼ' => 'Ὼ', - 'ώ' => 'Ώ', - 'ᾀ' => 'ᾈ', - 'ᾁ' => 'ᾉ', - 'ᾂ' => 'ᾊ', - 'ᾃ' => 'ᾋ', - 'ᾄ' => 'ᾌ', - 'ᾅ' => 'ᾍ', - 'ᾆ' => 'ᾎ', - 'ᾇ' => 'ᾏ', - 'ᾐ' => 'ᾘ', - 'ᾑ' => 'ᾙ', - 'ᾒ' => 'ᾚ', - 'ᾓ' => 'ᾛ', - 'ᾔ' => 'ᾜ', - 'ᾕ' => 'ᾝ', - 'ᾖ' => 'ᾞ', - 'ᾗ' => 'ᾟ', - 'ᾠ' => 'ᾨ', - 'ᾡ' => 'ᾩ', - 'ᾢ' => 'ᾪ', - 'ᾣ' => 'ᾫ', - 'ᾤ' => 'ᾬ', - 'ᾥ' => 'ᾭ', - 'ᾦ' => 'ᾮ', - 'ᾧ' => 'ᾯ', - 'ᾰ' => 'Ᾰ', - 'ᾱ' => 'Ᾱ', - 'ᾳ' => 'ᾼ', - 'ι' => 'Ι', - 'ῃ' => 'ῌ', - 'ῐ' => 'Ῐ', - 'ῑ' => 'Ῑ', - 'ῠ' => 'Ῠ', - 'ῡ' => 'Ῡ', - 'ῥ' => 'Ῥ', - 'ῳ' => 'ῼ', - 'ⅎ' => 'Ⅎ', - 'ⅰ' => 'Ⅰ', - 'ⅱ' => 'Ⅱ', - 'ⅲ' => 'Ⅲ', - 'ⅳ' => 'Ⅳ', - 'ⅴ' => 'Ⅴ', - 'ⅵ' => 'Ⅵ', - 'ⅶ' => 'Ⅶ', - 'ⅷ' => 'Ⅷ', - 'ⅸ' => 'Ⅸ', - 'ⅹ' => 'Ⅹ', - 'ⅺ' => 'Ⅺ', - 'ⅻ' => 'Ⅻ', - 'ⅼ' => 'Ⅼ', - 'ⅽ' => 'Ⅽ', - 'ⅾ' => 'Ⅾ', - 'ⅿ' => 'Ⅿ', - 'ↄ' => 'Ↄ', - 'ⓐ' => 'Ⓐ', - 'ⓑ' => 'Ⓑ', - 'ⓒ' => 'Ⓒ', - 'ⓓ' => 'Ⓓ', - 'ⓔ' => 'Ⓔ', - 'ⓕ' => 'Ⓕ', - 'ⓖ' => 'Ⓖ', - 'ⓗ' => 'Ⓗ', - 'ⓘ' => 'Ⓘ', - 'ⓙ' => 'Ⓙ', - 'ⓚ' => 'Ⓚ', - 'ⓛ' => 'Ⓛ', - 'ⓜ' => 'Ⓜ', - 'ⓝ' => 'Ⓝ', - 'ⓞ' => 'Ⓞ', - 'ⓟ' => 'Ⓟ', - 'ⓠ' => 'Ⓠ', - 'ⓡ' => 'Ⓡ', - 'ⓢ' => 'Ⓢ', - 'ⓣ' => 'Ⓣ', - 'ⓤ' => 'Ⓤ', - 'ⓥ' => 'Ⓥ', - 'ⓦ' => 'Ⓦ', - 'ⓧ' => 'Ⓧ', - 'ⓨ' => 'Ⓨ', - 'ⓩ' => 'Ⓩ', - 'ⰰ' => 'Ⰰ', - 'ⰱ' => 'Ⰱ', - 'ⰲ' => 'Ⰲ', - 'ⰳ' => 'Ⰳ', - 'ⰴ' => 'Ⰴ', - 'ⰵ' => 'Ⰵ', - 'ⰶ' => 'Ⰶ', - 'ⰷ' => 'Ⰷ', - 'ⰸ' => 'Ⰸ', - 'ⰹ' => 'Ⰹ', - 'ⰺ' => 'Ⰺ', - 'ⰻ' => 'Ⰻ', - 'ⰼ' => 'Ⰼ', - 'ⰽ' => 'Ⰽ', - 'ⰾ' => 'Ⰾ', - 'ⰿ' => 'Ⰿ', - 'ⱀ' => 'Ⱀ', - 'ⱁ' => 'Ⱁ', - 'ⱂ' => 'Ⱂ', - 'ⱃ' => 'Ⱃ', - 'ⱄ' => 'Ⱄ', - 'ⱅ' => 'Ⱅ', - 'ⱆ' => 'Ⱆ', - 'ⱇ' => 'Ⱇ', - 'ⱈ' => 'Ⱈ', - 'ⱉ' => 'Ⱉ', - 'ⱊ' => 'Ⱊ', - 'ⱋ' => 'Ⱋ', - 'ⱌ' => 'Ⱌ', - 'ⱍ' => 'Ⱍ', - 'ⱎ' => 'Ⱎ', - 'ⱏ' => 'Ⱏ', - 'ⱐ' => 'Ⱐ', - 'ⱑ' => 'Ⱑ', - 'ⱒ' => 'Ⱒ', - 'ⱓ' => 'Ⱓ', - 'ⱔ' => 'Ⱔ', - 'ⱕ' => 'Ⱕ', - 'ⱖ' => 'Ⱖ', - 'ⱗ' => 'Ⱗ', - 'ⱘ' => 'Ⱘ', - 'ⱙ' => 'Ⱙ', - 'ⱚ' => 'Ⱚ', - 'ⱛ' => 'Ⱛ', - 'ⱜ' => 'Ⱜ', - 'ⱝ' => 'Ⱝ', - 'ⱞ' => 'Ⱞ', - 'ⱡ' => 'Ⱡ', - 'ⱥ' => 'Ⱥ', - 'ⱦ' => 'Ⱦ', - 'ⱨ' => 'Ⱨ', - 'ⱪ' => 'Ⱪ', - 'ⱬ' => 'Ⱬ', - 'ⱳ' => 'Ⱳ', - 'ⱶ' => 'Ⱶ', - 'ⲁ' => 'Ⲁ', - 'ⲃ' => 'Ⲃ', - 'ⲅ' => 'Ⲅ', - 'ⲇ' => 'Ⲇ', - 'ⲉ' => 'Ⲉ', - 'ⲋ' => 'Ⲋ', - 'ⲍ' => 'Ⲍ', - 'ⲏ' => 'Ⲏ', - 'ⲑ' => 'Ⲑ', - 'ⲓ' => 'Ⲓ', - 'ⲕ' => 'Ⲕ', - 'ⲗ' => 'Ⲗ', - 'ⲙ' => 'Ⲙ', - 'ⲛ' => 'Ⲛ', - 'ⲝ' => 'Ⲝ', - 'ⲟ' => 'Ⲟ', - 'ⲡ' => 'Ⲡ', - 'ⲣ' => 'Ⲣ', - 'ⲥ' => 'Ⲥ', - 'ⲧ' => 'Ⲧ', - 'ⲩ' => 'Ⲩ', - 'ⲫ' => 'Ⲫ', - 'ⲭ' => 'Ⲭ', - 'ⲯ' => 'Ⲯ', - 'ⲱ' => 'Ⲱ', - 'ⲳ' => 'Ⲳ', - 'ⲵ' => 'Ⲵ', - 'ⲷ' => 'Ⲷ', - 'ⲹ' => 'Ⲹ', - 'ⲻ' => 'Ⲻ', - 'ⲽ' => 'Ⲽ', - 'ⲿ' => 'Ⲿ', - 'ⳁ' => 'Ⳁ', - 'ⳃ' => 'Ⳃ', - 'ⳅ' => 'Ⳅ', - 'ⳇ' => 'Ⳇ', - 'ⳉ' => 'Ⳉ', - 'ⳋ' => 'Ⳋ', - 'ⳍ' => 'Ⳍ', - 'ⳏ' => 'Ⳏ', - 'ⳑ' => 'Ⳑ', - 'ⳓ' => 'Ⳓ', - 'ⳕ' => 'Ⳕ', - 'ⳗ' => 'Ⳗ', - 'ⳙ' => 'Ⳙ', - 'ⳛ' => 'Ⳛ', - 'ⳝ' => 'Ⳝ', - 'ⳟ' => 'Ⳟ', - 'ⳡ' => 'Ⳡ', - 'ⳣ' => 'Ⳣ', - 'ⳬ' => 'Ⳬ', - 'ⳮ' => 'Ⳮ', - 'ⳳ' => 'Ⳳ', - 'ⴀ' => 'Ⴀ', - 'ⴁ' => 'Ⴁ', - 'ⴂ' => 'Ⴂ', - 'ⴃ' => 'Ⴃ', - 'ⴄ' => 'Ⴄ', - 'ⴅ' => 'Ⴅ', - 'ⴆ' => 'Ⴆ', - 'ⴇ' => 'Ⴇ', - 'ⴈ' => 'Ⴈ', - 'ⴉ' => 'Ⴉ', - 'ⴊ' => 'Ⴊ', - 'ⴋ' => 'Ⴋ', - 'ⴌ' => 'Ⴌ', - 'ⴍ' => 'Ⴍ', - 'ⴎ' => 'Ⴎ', - 'ⴏ' => 'Ⴏ', - 'ⴐ' => 'Ⴐ', - 'ⴑ' => 'Ⴑ', - 'ⴒ' => 'Ⴒ', - 'ⴓ' => 'Ⴓ', - 'ⴔ' => 'Ⴔ', - 'ⴕ' => 'Ⴕ', - 'ⴖ' => 'Ⴖ', - 'ⴗ' => 'Ⴗ', - 'ⴘ' => 'Ⴘ', - 'ⴙ' => 'Ⴙ', - 'ⴚ' => 'Ⴚ', - 'ⴛ' => 'Ⴛ', - 'ⴜ' => 'Ⴜ', - 'ⴝ' => 'Ⴝ', - 'ⴞ' => 'Ⴞ', - 'ⴟ' => 'Ⴟ', - 'ⴠ' => 'Ⴠ', - 'ⴡ' => 'Ⴡ', - 'ⴢ' => 'Ⴢ', - 'ⴣ' => 'Ⴣ', - 'ⴤ' => 'Ⴤ', - 'ⴥ' => 'Ⴥ', - 'ⴧ' => 'Ⴧ', - 'ⴭ' => 'Ⴭ', - 'ꙁ' => 'Ꙁ', - 'ꙃ' => 'Ꙃ', - 'ꙅ' => 'Ꙅ', - 'ꙇ' => 'Ꙇ', - 'ꙉ' => 'Ꙉ', - 'ꙋ' => 'Ꙋ', - 'ꙍ' => 'Ꙍ', - 'ꙏ' => 'Ꙏ', - 'ꙑ' => 'Ꙑ', - 'ꙓ' => 'Ꙓ', - 'ꙕ' => 'Ꙕ', - 'ꙗ' => 'Ꙗ', - 'ꙙ' => 'Ꙙ', - 'ꙛ' => 'Ꙛ', - 'ꙝ' => 'Ꙝ', - 'ꙟ' => 'Ꙟ', - 'ꙡ' => 'Ꙡ', - 'ꙣ' => 'Ꙣ', - 'ꙥ' => 'Ꙥ', - 'ꙧ' => 'Ꙧ', - 'ꙩ' => 'Ꙩ', - 'ꙫ' => 'Ꙫ', - 'ꙭ' => 'Ꙭ', - 'ꚁ' => 'Ꚁ', - 'ꚃ' => 'Ꚃ', - 'ꚅ' => 'Ꚅ', - 'ꚇ' => 'Ꚇ', - 'ꚉ' => 'Ꚉ', - 'ꚋ' => 'Ꚋ', - 'ꚍ' => 'Ꚍ', - 'ꚏ' => 'Ꚏ', - 'ꚑ' => 'Ꚑ', - 'ꚓ' => 'Ꚓ', - 'ꚕ' => 'Ꚕ', - 'ꚗ' => 'Ꚗ', - 'ꚙ' => 'Ꚙ', - 'ꚛ' => 'Ꚛ', - 'ꜣ' => 'Ꜣ', - 'ꜥ' => 'Ꜥ', - 'ꜧ' => 'Ꜧ', - 'ꜩ' => 'Ꜩ', - 'ꜫ' => 'Ꜫ', - 'ꜭ' => 'Ꜭ', - 'ꜯ' => 'Ꜯ', - 'ꜳ' => 'Ꜳ', - 'ꜵ' => 'Ꜵ', - 'ꜷ' => 'Ꜷ', - 'ꜹ' => 'Ꜹ', - 'ꜻ' => 'Ꜻ', - 'ꜽ' => 'Ꜽ', - 'ꜿ' => 'Ꜿ', - 'ꝁ' => 'Ꝁ', - 'ꝃ' => 'Ꝃ', - 'ꝅ' => 'Ꝅ', - 'ꝇ' => 'Ꝇ', - 'ꝉ' => 'Ꝉ', - 'ꝋ' => 'Ꝋ', - 'ꝍ' => 'Ꝍ', - 'ꝏ' => 'Ꝏ', - 'ꝑ' => 'Ꝑ', - 'ꝓ' => 'Ꝓ', - 'ꝕ' => 'Ꝕ', - 'ꝗ' => 'Ꝗ', - 'ꝙ' => 'Ꝙ', - 'ꝛ' => 'Ꝛ', - 'ꝝ' => 'Ꝝ', - 'ꝟ' => 'Ꝟ', - 'ꝡ' => 'Ꝡ', - 'ꝣ' => 'Ꝣ', - 'ꝥ' => 'Ꝥ', - 'ꝧ' => 'Ꝧ', - 'ꝩ' => 'Ꝩ', - 'ꝫ' => 'Ꝫ', - 'ꝭ' => 'Ꝭ', - 'ꝯ' => 'Ꝯ', - 'ꝺ' => 'Ꝺ', - 'ꝼ' => 'Ꝼ', - 'ꝿ' => 'Ꝿ', - 'ꞁ' => 'Ꞁ', - 'ꞃ' => 'Ꞃ', - 'ꞅ' => 'Ꞅ', - 'ꞇ' => 'Ꞇ', - 'ꞌ' => 'Ꞌ', - 'ꞑ' => 'Ꞑ', - 'ꞓ' => 'Ꞓ', - 'ꞗ' => 'Ꞗ', - 'ꞙ' => 'Ꞙ', - 'ꞛ' => 'Ꞛ', - 'ꞝ' => 'Ꞝ', - 'ꞟ' => 'Ꞟ', - 'ꞡ' => 'Ꞡ', - 'ꞣ' => 'Ꞣ', - 'ꞥ' => 'Ꞥ', - 'ꞧ' => 'Ꞧ', - 'ꞩ' => 'Ꞩ', - 'a' => 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - '𐐨' => '𐐀', - '𐐩' => '𐐁', - '𐐪' => '𐐂', - '𐐫' => '𐐃', - '𐐬' => '𐐄', - '𐐭' => '𐐅', - '𐐮' => '𐐆', - '𐐯' => '𐐇', - '𐐰' => '𐐈', - '𐐱' => '𐐉', - '𐐲' => '𐐊', - '𐐳' => '𐐋', - '𐐴' => '𐐌', - '𐐵' => '𐐍', - '𐐶' => '𐐎', - '𐐷' => '𐐏', - '𐐸' => '𐐐', - '𐐹' => '𐐑', - '𐐺' => '𐐒', - '𐐻' => '𐐓', - '𐐼' => '𐐔', - '𐐽' => '𐐕', - '𐐾' => '𐐖', - '𐐿' => '𐐗', - '𐑀' => '𐐘', - '𐑁' => '𐐙', - '𐑂' => '𐐚', - '𐑃' => '𐐛', - '𐑄' => '𐐜', - '𐑅' => '𐐝', - '𐑆' => '𐐞', - '𐑇' => '𐐟', - '𐑈' => '𐐠', - '𐑉' => '𐐡', - '𐑊' => '𐐢', - '𐑋' => '𐐣', - '𐑌' => '𐐤', - '𐑍' => '𐐥', - '𐑎' => '𐐦', - '𐑏' => '𐐧', - '𑣀' => '𑢠', - '𑣁' => '𑢡', - '𑣂' => '𑢢', - '𑣃' => '𑢣', - '𑣄' => '𑢤', - '𑣅' => '𑢥', - '𑣆' => '𑢦', - '𑣇' => '𑢧', - '𑣈' => '𑢨', - '𑣉' => '𑢩', - '𑣊' => '𑢪', - '𑣋' => '𑢫', - '𑣌' => '𑢬', - '𑣍' => '𑢭', - '𑣎' => '𑢮', - '𑣏' => '𑢯', - '𑣐' => '𑢰', - '𑣑' => '𑢱', - '𑣒' => '𑢲', - '𑣓' => '𑢳', - '𑣔' => '𑢴', - '𑣕' => '𑢵', - '𑣖' => '𑢶', - '𑣗' => '𑢷', - '𑣘' => '𑢸', - '𑣙' => '𑢹', - '𑣚' => '𑢺', - '𑣛' => '𑢻', - '𑣜' => '𑢼', - '𑣝' => '𑢽', - '𑣞' => '𑢾', - '𑣟' => '𑢿', -); diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/bootstrap.php b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/bootstrap.php deleted file mode 100644 index 204a41b..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/bootstrap.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Mbstring as p; - -if (!function_exists('mb_strlen')) { - define('MB_CASE_UPPER', 0); - define('MB_CASE_LOWER', 1); - define('MB_CASE_TITLE', 2); - - function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } - function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } - function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } - function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); } - function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); } - function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } - function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } - function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } - function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); } - function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); } - function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); } - function mb_parse_str($s, &$result = array()) { parse_str($s, $result); } - function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); } - function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); } - function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); } - function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); } - function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); } - function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); } - function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); } - function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); } - function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); } - function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); } - function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); } - function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); } - function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); } - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } - function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); } - function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); } - function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); } - function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); } - function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); } - function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); } -} -if (!function_exists('mb_chr')) { - function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); } - function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); } - function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); } -} - -if (!function_exists('mb_str_split')) { - function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); } -} diff --git a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/composer.json b/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/composer.json deleted file mode 100644 index 1a8bec5..0000000 --- a/system/templateEngines/Twig/Twig2x/symfony/polyfill-mbstring/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/polyfill-mbstring", - "type": "library", - "description": "Symfony polyfill for the Mbstring extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/LICENSE b/system/templateEngines/Twig/Twig2x/twig/twig/LICENSE deleted file mode 100644 index 5e8a0b8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2009-2020 by the Twig Team. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/README.rst b/system/templateEngines/Twig/Twig2x/twig/twig/README.rst deleted file mode 100644 index d896ff5..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/README.rst +++ /dev/null @@ -1,24 +0,0 @@ -Twig, the flexible, fast, and secure template language for PHP -============================================================== - -Twig is a template language for PHP, released under the new BSD license (code -and documentation). - -Twig uses a syntax similar to the Django and Jinja template languages which -inspired the Twig runtime environment. - -Sponsors --------- - -.. raw:: html - - - Blackfire.io - - -More Information ----------------- - -Read the `documentation`_ for more information. - -.. _documentation: https://twig.symfony.com/documentation diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/BaseNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/BaseNodeVisitor.php deleted file mode 100644 index e1191f9..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/lib/Twig/BaseNodeVisitor.php +++ /dev/null @@ -1,14 +0,0 @@ - - */ -interface CacheInterface -{ - /** - * Generates a cache key for the given template class name. - * - * @param string $name The template name - * @param string $className The template class name - * - * @return string - */ - public function generateKey($name, $className); - - /** - * Writes the compiled template to cache. - * - * @param string $key The cache key - * @param string $content The template representation as a PHP class - */ - public function write($key, $content); - - /** - * Loads a template from the cache. - * - * @param string $key The cache key - */ - public function load($key); - - /** - * Returns the modification timestamp of a key. - * - * @param string $key The cache key - * - * @return int - */ - public function getTimestamp($key); -} - -class_alias('Twig\Cache\CacheInterface', 'Twig_CacheInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/FilesystemCache.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/FilesystemCache.php deleted file mode 100644 index b7c1e43..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/FilesystemCache.php +++ /dev/null @@ -1,93 +0,0 @@ - - */ -class FilesystemCache implements CacheInterface -{ - const FORCE_BYTECODE_INVALIDATION = 1; - - private $directory; - private $options; - - /** - * @param string $directory The root cache directory - * @param int $options A set of options - */ - public function __construct($directory, $options = 0) - { - $this->directory = rtrim($directory, '\/').'/'; - $this->options = $options; - } - - public function generateKey($name, $className) - { - $hash = hash('sha256', $className); - - return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; - } - - public function load($key) - { - if (file_exists($key)) { - @include_once $key; - } - } - - public function write($key, $content) - { - $dir = \dirname($key); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - clearstatcache(true, $dir); - if (!is_dir($dir)) { - throw new \RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); - } - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); - } - - $tmpFile = tempnam($dir, basename($key)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { - @chmod($key, 0666 & ~umask()); - - if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { - // Compile cached file into bytecode cache - if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { - @opcache_invalidate($key, true); - } elseif (\function_exists('apc_compile_file')) { - apc_compile_file($key); - } - } - - return; - } - - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $key)); - } - - public function getTimestamp($key) - { - if (!file_exists($key)) { - return 0; - } - - return (int) @filemtime($key); - } -} - -class_alias('Twig\Cache\FilesystemCache', 'Twig_Cache_Filesystem'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/NullCache.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/NullCache.php deleted file mode 100644 index 02c868c..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Cache/NullCache.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -final class NullCache implements CacheInterface -{ - public function generateKey($name, $className) - { - return ''; - } - - public function write($key, $content) - { - } - - public function load($key) - { - } - - public function getTimestamp($key) - { - return 0; - } -} - -class_alias('Twig\Cache\NullCache', 'Twig_Cache_Null'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Compiler.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Compiler.php deleted file mode 100644 index 56933e2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Compiler.php +++ /dev/null @@ -1,245 +0,0 @@ - - */ -class Compiler -{ - private $lastLine; - private $source; - private $indentation; - private $env; - private $debugInfo = []; - private $sourceOffset; - private $sourceLine; - private $varNameSalt = 0; - - public function __construct(Environment $env) - { - $this->env = $env; - } - - /** - * Returns the environment instance related to this compiler. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->env; - } - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource() - { - return $this->source; - } - - /** - * Compiles a node. - * - * @param int $indentation The current indentation - * - * @return $this - */ - public function compile(Node $node, $indentation = 0) - { - $this->lastLine = null; - $this->source = ''; - $this->debugInfo = []; - $this->sourceOffset = 0; - // source code starts at 1 (as we then increment it when we encounter new lines) - $this->sourceLine = 1; - $this->indentation = $indentation; - $this->varNameSalt = 0; - - $node->compile($this); - - return $this; - } - - public function subcompile(Node $node, $raw = true) - { - if (false === $raw) { - $this->source .= str_repeat(' ', $this->indentation * 4); - } - - $node->compile($this); - - return $this; - } - - /** - * Adds a raw string to the compiled code. - * - * @param string $string The string - * - * @return $this - */ - public function raw($string) - { - $this->source .= $string; - - return $this; - } - - /** - * Writes a string to the compiled code by adding indentation. - * - * @return $this - */ - public function write(...$strings) - { - foreach ($strings as $string) { - $this->source .= str_repeat(' ', $this->indentation * 4).$string; - } - - return $this; - } - - /** - * Adds a quoted string to the compiled code. - * - * @param string $value The string - * - * @return $this - */ - public function string($value) - { - $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); - - return $this; - } - - /** - * Returns a PHP representation of a given value. - * - * @param mixed $value The value to convert - * - * @return $this - */ - public function repr($value) - { - if (\is_int($value) || \is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, '0')) { - setlocale(LC_NUMERIC, 'C'); - } - - $this->raw(var_export($value, true)); - - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - } elseif (null === $value) { - $this->raw('null'); - } elseif (\is_bool($value)) { - $this->raw($value ? 'true' : 'false'); - } elseif (\is_array($value)) { - $this->raw('array('); - $first = true; - foreach ($value as $key => $v) { - if (!$first) { - $this->raw(', '); - } - $first = false; - $this->repr($key); - $this->raw(' => '); - $this->repr($v); - } - $this->raw(')'); - } else { - $this->string($value); - } - - return $this; - } - - /** - * Adds debugging information. - * - * @return $this - */ - public function addDebugInfo(Node $node) - { - if ($node->getTemplateLine() != $this->lastLine) { - $this->write(sprintf("// line %d\n", $node->getTemplateLine())); - - $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); - $this->sourceOffset = \strlen($this->source); - $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); - - $this->lastLine = $node->getTemplateLine(); - } - - return $this; - } - - public function getDebugInfo() - { - ksort($this->debugInfo); - - return $this->debugInfo; - } - - /** - * Indents the generated code. - * - * @param int $step The number of indentation to add - * - * @return $this - */ - public function indent($step = 1) - { - $this->indentation += $step; - - return $this; - } - - /** - * Outdents the generated code. - * - * @param int $step The number of indentation to remove - * - * @return $this - * - * @throws \LogicException When trying to outdent too much so the indentation would become negative - */ - public function outdent($step = 1) - { - // can't outdent by more steps than the current indentation level - if ($this->indentation < $step) { - throw new \LogicException('Unable to call outdent() as the indentation would become negative.'); - } - - $this->indentation -= $step; - - return $this; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); - } -} - -class_alias('Twig\Compiler', 'Twig_Compiler'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Environment.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Environment.php deleted file mode 100644 index d0419fb..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Environment.php +++ /dev/null @@ -1,995 +0,0 @@ - - */ -class Environment -{ - const VERSION = '2.12.5'; - const VERSION_ID = 21205; - const MAJOR_VERSION = 2; - const MINOR_VERSION = 12; - const RELEASE_VERSION = 5; - const EXTRA_VERSION = ''; - - private $charset; - private $loader; - private $debug; - private $autoReload; - private $cache; - private $lexer; - private $parser; - private $compiler; - private $baseTemplateClass; - private $globals = []; - private $resolvedGlobals; - private $loadedTemplates; - private $strictVariables; - private $templateClassPrefix = '__TwigTemplate_'; - private $originalCache; - private $extensionSet; - private $runtimeLoaders = []; - private $runtimes = []; - private $optionsHash; - - /** - * Constructor. - * - * Available options: - * - * * debug: When set to true, it automatically set "auto_reload" to true as - * well (default to false). - * - * * charset: The charset used by the templates (default to UTF-8). - * - * * base_template_class: The base template class to use for generated - * templates (default to \Twig\Template). - * - * * cache: An absolute path where to store the compiled templates, - * a \Twig\Cache\CacheInterface implementation, - * or false to disable compilation cache (default). - * - * * auto_reload: Whether to reload the template if the original source changed. - * If you don't provide the auto_reload option, it will be - * determined automatically based on the debug value. - * - * * strict_variables: Whether to ignore invalid variables in templates - * (default to false). - * - * * autoescape: Whether to enable auto-escaping (default to html): - * * false: disable auto-escaping - * * html, js: set the autoescaping to one of the supported strategies - * * name: set the autoescaping strategy based on the template name extension - * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" - * - * * optimizations: A flag that indicates which optimizations to apply - * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable). - */ - public function __construct(LoaderInterface $loader, $options = []) - { - $this->setLoader($loader); - - $options = array_merge([ - 'debug' => false, - 'charset' => 'UTF-8', - 'base_template_class' => Template::class, - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - ], $options); - - $this->debug = (bool) $options['debug']; - $this->setCharset($options['charset']); - $this->baseTemplateClass = '\\'.ltrim($options['base_template_class'], '\\'); - if ('\\'.Template::class !== $this->baseTemplateClass && '\Twig_Template' !== $this->baseTemplateClass) { - @trigger_error('The "base_template_class" option on '.__CLASS__.' is deprecated since Twig 2.7.0.', E_USER_DEPRECATED); - } - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; - $this->setCache($options['cache']); - $this->extensionSet = new ExtensionSet(); - - $this->addExtension(new CoreExtension()); - $this->addExtension(new EscaperExtension($options['autoescape'])); - $this->addExtension(new OptimizerExtension($options['optimizations'])); - } - - /** - * Gets the base template class for compiled templates. - * - * @return string The base template class name - */ - public function getBaseTemplateClass() - { - if (1 > \func_num_args() || \func_get_arg(0)) { - @trigger_error('The '.__METHOD__.' is deprecated since Twig 2.7.0.', E_USER_DEPRECATED); - } - - return $this->baseTemplateClass; - } - - /** - * Sets the base template class for compiled templates. - * - * @param string $class The base template class name - */ - public function setBaseTemplateClass($class) - { - @trigger_error('The '.__METHOD__.' is deprecated since Twig 2.7.0.', E_USER_DEPRECATED); - - $this->baseTemplateClass = $class; - $this->updateOptionsHash(); - } - - /** - * Enables debugging mode. - */ - public function enableDebug() - { - $this->debug = true; - $this->updateOptionsHash(); - } - - /** - * Disables debugging mode. - */ - public function disableDebug() - { - $this->debug = false; - $this->updateOptionsHash(); - } - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Enables the auto_reload option. - */ - public function enableAutoReload() - { - $this->autoReload = true; - } - - /** - * Disables the auto_reload option. - */ - public function disableAutoReload() - { - $this->autoReload = false; - } - - /** - * Checks if the auto_reload option is enabled. - * - * @return bool true if auto_reload is enabled, false otherwise - */ - public function isAutoReload() - { - return $this->autoReload; - } - - /** - * Enables the strict_variables option. - */ - public function enableStrictVariables() - { - $this->strictVariables = true; - $this->updateOptionsHash(); - } - - /** - * Disables the strict_variables option. - */ - public function disableStrictVariables() - { - $this->strictVariables = false; - $this->updateOptionsHash(); - } - - /** - * Checks if the strict_variables option is enabled. - * - * @return bool true if strict_variables is enabled, false otherwise - */ - public function isStrictVariables() - { - return $this->strictVariables; - } - - /** - * Gets the current cache implementation. - * - * @param bool $original Whether to return the original cache option or the real cache instance - * - * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function getCache($original = true) - { - return $original ? $this->originalCache : $this->cache; - } - - /** - * Sets the current cache implementation. - * - * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function setCache($cache) - { - if (\is_string($cache)) { - $this->originalCache = $cache; - $this->cache = new FilesystemCache($cache); - } elseif (false === $cache) { - $this->originalCache = $cache; - $this->cache = new NullCache(); - } elseif ($cache instanceof CacheInterface) { - $this->originalCache = $this->cache = $cache; - } else { - throw new \LogicException(sprintf('Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation.')); - } - } - - /** - * Gets the template class associated with the given string. - * - * The generated template class is based on the following parameters: - * - * * The cache key for the given template; - * * The currently enabled extensions; - * * Whether the Twig C extension is available or not; - * * PHP version; - * * Twig version; - * * Options with what environment was created. - * - * @param string $name The name for which to calculate the template class name - * @param int|null $index The index if it is an embedded template - * - * @return string The template class name - * - * @internal - */ - public function getTemplateClass($name, $index = null) - { - $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; - - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index); - } - - /** - * Renders a template. - * - * @param string|TemplateWrapper $name The template name - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - * @throws RuntimeError When an error occurred during rendering - */ - public function render($name, array $context = []) - { - return $this->load($name)->render($context); - } - - /** - * Displays a template. - * - * @param string|TemplateWrapper $name The template name - * @param array $context An array of parameters to pass to the template - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - * @throws RuntimeError When an error occurred during rendering - */ - public function display($name, array $context = []) - { - $this->load($name)->display($context); - } - - /** - * Loads a template. - * - * @param string|TemplateWrapper $name The template name - * - * @throws LoaderError When the template cannot be found - * @throws RuntimeError When a previously generated cache is corrupted - * @throws SyntaxError When an error occurred during compilation - * - * @return TemplateWrapper - */ - public function load($name) - { - if ($name instanceof TemplateWrapper) { - return $name; - } - - if ($name instanceof Template) { - @trigger_error('Passing a \Twig\Template instance to '.__METHOD__.' is deprecated since Twig 2.7.0, use \Twig\TemplateWrapper instead.', E_USER_DEPRECATED); - - return new TemplateWrapper($this, $name); - } - - return new TemplateWrapper($this, $this->loadTemplate($name)); - } - - /** - * Loads a template internal representation. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The template name - * @param int $index The index if it is an embedded template - * - * @return Template A template instance representing the given template name - * - * @throws LoaderError When the template cannot be found - * @throws RuntimeError When a previously generated cache is corrupted - * @throws SyntaxError When an error occurred during compilation - * - * @internal - */ - public function loadTemplate($name, $index = null) - { - return $this->loadClass($this->getTemplateClass($name), $name, $index); - } - - /** - * @internal - */ - public function loadClass($cls, $name, $index = null) - { - $mainCls = $cls; - if (null !== $index) { - $cls .= '___'.$index; - } - - if (isset($this->loadedTemplates[$cls])) { - return $this->loadedTemplates[$cls]; - } - - if (!class_exists($cls, false)) { - $key = $this->cache->generateKey($name, $mainCls); - - if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { - $this->cache->load($key); - } - - $source = null; - if (!class_exists($cls, false)) { - $source = $this->getLoader()->getSourceContext($name); - $content = $this->compileSource($source); - $this->cache->write($key, $content); - $this->cache->load($key); - - if (!class_exists($mainCls, false)) { - /* Last line of defense if either $this->bcWriteCacheFile was used, - * $this->cache is implemented as a no-op or we have a race condition - * where the cache was cleared between the above calls to write to and load from - * the cache. - */ - eval('?>'.$content); - } - - if (!class_exists($cls, false)) { - throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); - } - } - } - - // to be removed in 3.0 - $this->extensionSet->initRuntime($this); - - return $this->loadedTemplates[$cls] = new $cls($this); - } - - /** - * Creates a template from source. - * - * This method should not be used as a generic way to load templates. - * - * @param string $template The template source - * @param string $name An optional name of the template to be used in error messages - * - * @return TemplateWrapper A template instance representing the given template name - * - * @throws LoaderError When the template cannot be found - * @throws SyntaxError When an error occurred during compilation - */ - public function createTemplate($template, string $name = null) - { - $hash = hash('sha256', $template, false); - if (null !== $name) { - $name = sprintf('%s (string template %s)', $name, $hash); - } else { - $name = sprintf('__string_template__%s', $hash); - } - - $loader = new ChainLoader([ - new ArrayLoader([$name => $template]), - $current = $this->getLoader(), - ]); - - $this->setLoader($loader); - try { - return new TemplateWrapper($this, $this->loadTemplate($name)); - } finally { - $this->setLoader($current); - } - } - - /** - * Returns true if the template is still fresh. - * - * Besides checking the loader for freshness information, - * this method also checks if the enabled extensions have - * not changed. - * - * @param string $name The template name - * @param int $time The last modification time of the cached template - * - * @return bool true if the template is fresh, false otherwise - */ - public function isTemplateFresh($name, $time) - { - return $this->extensionSet->getLastModified() <= $time && $this->getLoader()->isFresh($name, $time); - } - - /** - * Tries to load a template consecutively from an array. - * - * Similar to load() but it also accepts instances of \Twig\Template and - * \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded. - * - * @param string|TemplateWrapper|array $names A template or an array of templates to try consecutively - * - * @return TemplateWrapper|Template - * - * @throws LoaderError When none of the templates can be found - * @throws SyntaxError When an error occurred during compilation - */ - public function resolveTemplate($names) - { - if (!\is_array($names)) { - $names = [$names]; - } - - foreach ($names as $name) { - if ($name instanceof Template) { - return $name; - } - if ($name instanceof TemplateWrapper) { - return $name; - } - - try { - return $this->loadTemplate($name); - } catch (LoaderError $e) { - if (1 === \count($names)) { - throw $e; - } - } - } - - throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); - } - - public function setLexer(Lexer $lexer) - { - $this->lexer = $lexer; - } - - /** - * Tokenizes a source code. - * - * @return TokenStream - * - * @throws SyntaxError When the code is syntactically wrong - */ - public function tokenize(Source $source) - { - if (null === $this->lexer) { - $this->lexer = new Lexer($this); - } - - return $this->lexer->tokenize($source); - } - - public function setParser(Parser $parser) - { - $this->parser = $parser; - } - - /** - * Converts a token stream to a node tree. - * - * @return ModuleNode - * - * @throws SyntaxError When the token stream is syntactically or semantically wrong - */ - public function parse(TokenStream $stream) - { - if (null === $this->parser) { - $this->parser = new Parser($this); - } - - return $this->parser->parse($stream); - } - - public function setCompiler(Compiler $compiler) - { - $this->compiler = $compiler; - } - - /** - * Compiles a node and returns the PHP code. - * - * @return string The compiled PHP source code - */ - public function compile(Node $node) - { - if (null === $this->compiler) { - $this->compiler = new Compiler($this); - } - - return $this->compiler->compile($node)->getSource(); - } - - /** - * Compiles a template source code. - * - * @return string The compiled PHP source code - * - * @throws SyntaxError When there was an error during tokenizing, parsing or compiling - */ - public function compileSource(Source $source) - { - try { - return $this->compile($this->parse($this->tokenize($source))); - } catch (Error $e) { - $e->setSourceContext($source); - throw $e; - } catch (\Exception $e) { - throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); - } - } - - public function setLoader(LoaderInterface $loader) - { - $this->loader = $loader; - } - - /** - * Gets the Loader instance. - * - * @return LoaderInterface - */ - public function getLoader() - { - return $this->loader; - } - - /** - * Sets the default template charset. - * - * @param string $charset The default charset - */ - public function setCharset($charset) - { - if ('UTF8' === $charset = strtoupper($charset)) { - // iconv on Windows requires "UTF-8" instead of "UTF8" - $charset = 'UTF-8'; - } - - $this->charset = $charset; - } - - /** - * Gets the default template charset. - * - * @return string The default charset - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Returns true if the given extension is registered. - * - * @param string $class The extension class name - * - * @return bool Whether the extension is registered or not - */ - public function hasExtension($class) - { - return $this->extensionSet->hasExtension($class); - } - - /** - * Adds a runtime loader. - */ - public function addRuntimeLoader(RuntimeLoaderInterface $loader) - { - $this->runtimeLoaders[] = $loader; - } - - /** - * Gets an extension by class name. - * - * @param string $class The extension class name - * - * @return ExtensionInterface - */ - public function getExtension($class) - { - return $this->extensionSet->getExtension($class); - } - - /** - * Returns the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class name - * - * @return object The runtime implementation - * - * @throws RuntimeError When the template cannot be found - */ - public function getRuntime($class) - { - if (isset($this->runtimes[$class])) { - return $this->runtimes[$class]; - } - - foreach ($this->runtimeLoaders as $loader) { - if (null !== $runtime = $loader->load($class)) { - return $this->runtimes[$class] = $runtime; - } - } - - throw new RuntimeError(sprintf('Unable to load the "%s" runtime.', $class)); - } - - public function addExtension(ExtensionInterface $extension) - { - $this->extensionSet->addExtension($extension); - $this->updateOptionsHash(); - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - $this->extensionSet->setExtensions($extensions); - $this->updateOptionsHash(); - } - - /** - * Returns all registered extensions. - * - * @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) - */ - public function getExtensions() - { - return $this->extensionSet->getExtensions(); - } - - public function addTokenParser(TokenParserInterface $parser) - { - $this->extensionSet->addTokenParser($parser); - } - - /** - * Gets the registered Token Parsers. - * - * @return TokenParserInterface[] - * - * @internal - */ - public function getTokenParsers() - { - return $this->extensionSet->getTokenParsers(); - } - - /** - * Gets registered tags. - * - * @return TokenParserInterface[] - * - * @internal - */ - public function getTags() - { - $tags = []; - foreach ($this->getTokenParsers() as $parser) { - $tags[$parser->getTag()] = $parser; - } - - return $tags; - } - - public function addNodeVisitor(NodeVisitorInterface $visitor) - { - $this->extensionSet->addNodeVisitor($visitor); - } - - /** - * Gets the registered Node Visitors. - * - * @return NodeVisitorInterface[] - * - * @internal - */ - public function getNodeVisitors() - { - return $this->extensionSet->getNodeVisitors(); - } - - public function addFilter(TwigFilter $filter) - { - $this->extensionSet->addFilter($filter); - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return TwigFilter|false - * - * @internal - */ - public function getFilter($name) - { - return $this->extensionSet->getFilter($name); - } - - public function registerUndefinedFilterCallback(callable $callable) - { - $this->extensionSet->registerUndefinedFilterCallback($callable); - } - - /** - * Gets the registered Filters. - * - * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. - * - * @return TwigFilter[] - * - * @see registerUndefinedFilterCallback - * - * @internal - */ - public function getFilters() - { - return $this->extensionSet->getFilters(); - } - - public function addTest(TwigTest $test) - { - $this->extensionSet->addTest($test); - } - - /** - * Gets the registered Tests. - * - * @return TwigTest[] - * - * @internal - */ - public function getTests() - { - return $this->extensionSet->getTests(); - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return TwigTest|false - * - * @internal - */ - public function getTest($name) - { - return $this->extensionSet->getTest($name); - } - - public function addFunction(TwigFunction $function) - { - $this->extensionSet->addFunction($function); - } - - /** - * Get a function by name. - * - * Subclasses may override this method and load functions differently; - * so no list of functions is available. - * - * @param string $name function name - * - * @return TwigFunction|false - * - * @internal - */ - public function getFunction($name) - { - return $this->extensionSet->getFunction($name); - } - - public function registerUndefinedFunctionCallback(callable $callable) - { - $this->extensionSet->registerUndefinedFunctionCallback($callable); - } - - /** - * Gets registered functions. - * - * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. - * - * @return TwigFunction[] - * - * @see registerUndefinedFunctionCallback - * - * @internal - */ - public function getFunctions() - { - return $this->extensionSet->getFunctions(); - } - - /** - * Registers a Global. - * - * New globals can be added before compiling or rendering a template; - * but after, you can only update existing globals. - * - * @param string $name The global name - * @param mixed $value The global value - */ - public function addGlobal($name, $value) - { - if ($this->extensionSet->isInitialized() && !\array_key_exists($name, $this->getGlobals())) { - throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); - } - - if (null !== $this->resolvedGlobals) { - $this->resolvedGlobals[$name] = $value; - } else { - $this->globals[$name] = $value; - } - } - - /** - * Gets the registered Globals. - * - * @return array An array of globals - * - * @internal - */ - public function getGlobals() - { - if ($this->extensionSet->isInitialized()) { - if (null === $this->resolvedGlobals) { - $this->resolvedGlobals = array_merge($this->extensionSet->getGlobals(), $this->globals); - } - - return $this->resolvedGlobals; - } - - return array_merge($this->extensionSet->getGlobals(), $this->globals); - } - - /** - * Merges a context with the defined globals. - * - * @param array $context An array representing the context - * - * @return array The context merged with the globals - */ - public function mergeGlobals(array $context) - { - // we don't use array_merge as the context being generally - // bigger than globals, this code is faster. - foreach ($this->getGlobals() as $key => $value) { - if (!\array_key_exists($key, $context)) { - $context[$key] = $value; - } - } - - return $context; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - * - * @internal - */ - public function getUnaryOperators() - { - return $this->extensionSet->getUnaryOperators(); - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - * - * @internal - */ - public function getBinaryOperators() - { - return $this->extensionSet->getBinaryOperators(); - } - - private function updateOptionsHash() - { - $this->optionsHash = implode(':', [ - $this->extensionSet->getSignature(), - PHP_MAJOR_VERSION, - PHP_MINOR_VERSION, - self::VERSION, - (int) $this->debug, - $this->baseTemplateClass, - (int) $this->strictVariables, - ]); - } -} - -class_alias('Twig\Environment', 'Twig_Environment'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/Error.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/Error.php deleted file mode 100644 index a64cbcb..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/Error.php +++ /dev/null @@ -1,257 +0,0 @@ - - */ -class Error extends \Exception -{ - private $lineno; - private $name; - private $rawMessage; - private $sourcePath; - private $sourceCode; - - /** - * Constructor. - * - * Set the line number to -1 to enable its automatic guessing. - * Set the name to null to enable its automatic guessing. - * - * @param string $message The error message - * @param int $lineno The template line where the error occurred - * @param Source|string|null $source The source context where the error occurred - * @param \Exception $previous The previous exception - */ - public function __construct(string $message, int $lineno = -1, $source = null, \Exception $previous = null) - { - parent::__construct('', 0, $previous); - - if (null === $source) { - $name = null; - } elseif (!$source instanceof Source && !$source instanceof \Twig_Source) { - @trigger_error(sprintf('Passing a string as a source to %s is deprecated since Twig 2.6.1; pass a Twig\Source instance instead.', __CLASS__), E_USER_DEPRECATED); - $name = $source; - } else { - $name = $source->getName(); - $this->sourceCode = $source->getCode(); - $this->sourcePath = $source->getPath(); - } - - $this->lineno = $lineno; - $this->name = $name; - $this->rawMessage = $message; - $this->updateRepr(); - } - - /** - * Gets the raw message. - * - * @return string The raw message - */ - public function getRawMessage() - { - return $this->rawMessage; - } - - /** - * Gets the template line where the error occurred. - * - * @return int The template line - */ - public function getTemplateLine() - { - return $this->lineno; - } - - /** - * Sets the template line where the error occurred. - * - * @param int $lineno The template line - */ - public function setTemplateLine($lineno) - { - $this->lineno = $lineno; - - $this->updateRepr(); - } - - /** - * Gets the source context of the Twig template where the error occurred. - * - * @return Source|null - */ - public function getSourceContext() - { - return $this->name ? new Source($this->sourceCode, $this->name, $this->sourcePath) : null; - } - - /** - * Sets the source context of the Twig template where the error occurred. - */ - public function setSourceContext(Source $source = null) - { - if (null === $source) { - $this->sourceCode = $this->name = $this->sourcePath = null; - } else { - $this->sourceCode = $source->getCode(); - $this->name = $source->getName(); - $this->sourcePath = $source->getPath(); - } - - $this->updateRepr(); - } - - public function guess() - { - $this->guessTemplateInfo(); - $this->updateRepr(); - } - - public function appendMessage($rawMessage) - { - $this->rawMessage .= $rawMessage; - $this->updateRepr(); - } - - private function updateRepr() - { - $this->message = $this->rawMessage; - - if ($this->sourcePath && $this->lineno > 0) { - $this->file = $this->sourcePath; - $this->line = $this->lineno; - - return; - } - - $dot = false; - if ('.' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - $questionMark = false; - if ('?' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $questionMark = true; - } - - if ($this->name) { - if (\is_string($this->name) || (\is_object($this->name) && method_exists($this->name, '__toString'))) { - $name = sprintf('"%s"', $this->name); - } else { - $name = json_encode($this->name); - } - $this->message .= sprintf(' in %s', $name); - } - - if ($this->lineno && $this->lineno >= 0) { - $this->message .= sprintf(' at line %d', $this->lineno); - } - - if ($dot) { - $this->message .= '.'; - } - - if ($questionMark) { - $this->message .= '?'; - } - } - - private function guessTemplateInfo() - { - $template = null; - $templateClass = null; - - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); - foreach ($backtrace as $trace) { - if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) { - $currentClass = \get_class($trace['object']); - $isEmbedContainer = 0 === strpos($templateClass, $currentClass); - if (null === $this->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) { - $template = $trace['object']; - $templateClass = \get_class($trace['object']); - } - } - } - - // update template name - if (null !== $template && null === $this->name) { - $this->name = $template->getTemplateName(); - } - - // update template path if any - if (null !== $template && null === $this->sourcePath) { - $src = $template->getSourceContext(); - $this->sourceCode = $src->getCode(); - $this->sourcePath = $src->getPath(); - } - - if (null === $template || $this->lineno > -1) { - return; - } - - $r = new \ReflectionObject($template); - $file = $r->getFileName(); - - $exceptions = [$e = $this]; - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - while ($e = array_pop($exceptions)) { - $traces = $e->getTrace(); - array_unshift($traces, ['file' => $e->getFile(), 'line' => $e->getLine()]); - - while ($trace = array_shift($traces)) { - if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { - continue; - } - - foreach ($template->getDebugInfo() as $codeLine => $templateLine) { - if ($codeLine <= $trace['line']) { - // update template line - $this->lineno = $templateLine; - - return; - } - } - } - } - } -} - -class_alias('Twig\Error\Error', 'Twig_Error'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/LoaderError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/LoaderError.php deleted file mode 100644 index dc5a9f1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/LoaderError.php +++ /dev/null @@ -1,23 +0,0 @@ - - */ -class LoaderError extends Error -{ -} - -class_alias('Twig\Error\LoaderError', 'Twig_Error_Loader'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/RuntimeError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/RuntimeError.php deleted file mode 100644 index 9b3f36e..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/RuntimeError.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ -class RuntimeError extends Error -{ -} - -class_alias('Twig\Error\RuntimeError', 'Twig_Error_Runtime'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/SyntaxError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/SyntaxError.php deleted file mode 100644 index efece92..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Error/SyntaxError.php +++ /dev/null @@ -1,48 +0,0 @@ - - */ -class SyntaxError extends Error -{ - /** - * Tweaks the error message to include suggestions. - * - * @param string $name The original name of the item that does not exist - * @param array $items An array of possible items - */ - public function addSuggestions($name, array $items) - { - $alternatives = []; - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - - if (!$alternatives) { - return; - } - - asort($alternatives); - - $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', array_keys($alternatives)))); - } -} - -class_alias('Twig\Error\SyntaxError', 'Twig_Error_Syntax'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/ExpressionParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/ExpressionParser.php deleted file mode 100644 index e6a2073..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/ExpressionParser.php +++ /dev/null @@ -1,814 +0,0 @@ - - * - * @internal - */ -class ExpressionParser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; - - private $parser; - private $env; - private $unaryOperators; - private $binaryOperators; - - public function __construct(Parser $parser, Environment $env) - { - $this->parser = $parser; - $this->env = $env; - $this->unaryOperators = $env->getUnaryOperators(); - $this->binaryOperators = $env->getBinaryOperators(); - } - - public function parseExpression($precedence = 0, $allowArrow = false) - { - if ($allowArrow && $arrow = $this->parseArrow()) { - return $arrow; - } - - $expr = $this->getPrimary(); - $token = $this->parser->getCurrentToken(); - while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - - if ('is not' === $token->getValue()) { - $expr = $this->parseNotTestExpression($expr); - } elseif ('is' === $token->getValue()) { - $expr = $this->parseTestExpression($expr); - } elseif (isset($op['callable'])) { - $expr = $op['callable']($this->parser, $expr); - } else { - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $class = $op['class']; - $expr = new $class($expr, $expr1, $token->getLine()); - } - - $token = $this->parser->getCurrentToken(); - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - /** - * @return ArrowFunctionExpression|null - */ - private function parseArrow() - { - $stream = $this->parser->getStream(); - - // short array syntax (one argument, no parentheses)? - if ($stream->look(1)->test(/* Token::ARROW_TYPE */ 12)) { - $line = $stream->getCurrent()->getLine(); - $token = $stream->expect(/* Token::NAME_TYPE */ 5); - $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; - $stream->expect(/* Token::ARROW_TYPE */ 12); - - return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); - } - - // first, determine if we are parsing an arrow function by finding => (long form) - $i = 0; - if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - return null; - } - ++$i; - while (true) { - // variable name - ++$i; - if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - ++$i; - } - if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, ')')) { - return null; - } - ++$i; - if (!$stream->look($i)->test(/* Token::ARROW_TYPE */ 12)) { - return null; - } - - // yes, let's parse it properly - $token = $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '('); - $line = $token->getLine(); - - $names = []; - while (true) { - $token = $stream->expect(/* Token::NAME_TYPE */ 5); - $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); - - if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - } - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ')'); - $stream->expect(/* Token::ARROW_TYPE */ 12); - - return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); - } - - private function getPrimary(): AbstractExpression - { - $token = $this->parser->getCurrentToken(); - - if ($this->isUnary($token)) { - $operator = $this->unaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - $expr = $this->parseExpression($operator['precedence']); - $class = $operator['class']; - - return $this->parsePostfixExpression(new $class($expr, $token->getLine())); - } elseif ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(/* Token::PUNCTUATION_TYPE */ 9, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - private function parseConditionalExpression($expr): AbstractExpression - { - while ($this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, '?')) { - if (!$this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { - $expr3 = $this->parseExpression(); - } else { - $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); - } - } else { - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); - } - - return $expr; - } - - private function isUnary(Token $token): bool - { - return $token->test(/* Token::OPERATOR_TYPE */ 8) && isset($this->unaryOperators[$token->getValue()]); - } - - private function isBinary(Token $token): bool - { - return $token->test(/* Token::OPERATOR_TYPE */ 8) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case /* Token::NAME_TYPE */ 5: - $this->parser->getStream()->next(); - switch ($token->getValue()) { - case 'true': - case 'TRUE': - $node = new ConstantExpression(true, $token->getLine()); - break; - - case 'false': - case 'FALSE': - $node = new ConstantExpression(false, $token->getLine()); - break; - - case 'none': - case 'NONE': - case 'null': - case 'NULL': - $node = new ConstantExpression(null, $token->getLine()); - break; - - default: - if ('(' === $this->parser->getCurrentToken()->getValue()) { - $node = $this->getFunctionNode($token->getValue(), $token->getLine()); - } else { - $node = new NameExpression($token->getValue(), $token->getLine()); - } - } - break; - - case /* Token::NUMBER_TYPE */ 6: - $this->parser->getStream()->next(); - $node = new ConstantExpression($token->getValue(), $token->getLine()); - break; - - case /* Token::STRING_TYPE */ 7: - case /* Token::INTERPOLATION_START_TYPE */ 10: - $node = $this->parseStringExpression(); - break; - - case /* Token::OPERATOR_TYPE */ 8: - if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - $node = new NameExpression($token->getValue(), $token->getLine()); - break; - } elseif (isset($this->unaryOperators[$token->getValue()])) { - $class = $this->unaryOperators[$token->getValue()]['class']; - - $ref = new \ReflectionClass($class); - if (!(\in_array($ref->getName(), [NegUnary::class, PosUnary::class, 'Twig_Node_Expression_Unary_Neg', 'Twig_Node_Expression_Unary_Pos']) - || $ref->isSubclassOf(NegUnary::class) || $ref->isSubclassOf(PosUnary::class) - || $ref->isSubclassOf('Twig_Node_Expression_Unary_Neg') || $ref->isSubclassOf('Twig_Node_Expression_Unary_Pos')) - ) { - throw new SyntaxError(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - - $this->parser->getStream()->next(); - $expr = $this->parsePrimaryExpression(); - - $node = new $class($expr, $token->getLine()); - break; - } - - // no break - default: - if ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '{')) { - $node = $this->parseHashExpression(); - } elseif ($token->test(/* Token::OPERATOR_TYPE */ 8, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { - throw new SyntaxError(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } else { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseStringExpression() - { - $stream = $this->parser->getStream(); - - $nodes = []; - // a string cannot be followed by another string in a single expression - $nextCanBeString = true; - while (true) { - if ($nextCanBeString && $token = $stream->nextIf(/* Token::STRING_TYPE */ 7)) { - $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->nextIf(/* Token::INTERPOLATION_START_TYPE */ 10)) { - $nodes[] = $this->parseExpression(); - $stream->expect(/* Token::INTERPOLATION_END_TYPE */ 11); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); - } - - return $expr; - } - - public function parseArrayExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '[', 'An array element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { - if (!$first) { - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '{', 'A hash element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, '}')) { - if (!$first) { - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if (($token = $stream->nextIf(/* Token::STRING_TYPE */ 7)) || ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) || $token = $stream->nextIf(/* Token::NUMBER_TYPE */ 6)) { - $key = new ConstantExpression($token->getValue(), $token->getLine()); - } elseif ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new SyntaxError(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".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); - } - - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - while (true) { - $token = $this->parser->getCurrentToken(); - if (/* Token::PUNCTUATION_TYPE */ 9 == $token->getType()) { - if ('.' == $token->getValue() || '[' == $token->getValue()) { - $node = $this->parseSubscriptExpression($node); - } elseif ('|' == $token->getValue()) { - $node = $this->parseFilterExpression($node); - } else { - break; - } - } else { - break; - } - } - - return $node; - } - - public function getFunctionNode($name, $line) - { - switch ($name) { - case 'parent': - $this->parseArguments(); - if (!\count($this->parser->getBlockStack())) { - throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - return new ParentExpression($this->parser->peekBlockStack(), $line); - case 'block': - $args = $this->parseArguments(); - if (\count($args) < 1) { - throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); - case 'attribute': - $args = $this->parseArguments(); - if (\count($args) < 2) { - throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, Template::ANY_CALL, $line); - default: - if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { - $arguments = new ArrayExpression([], $line); - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - - $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); - $node->setAttribute('safe', true); - - return $node; - } - - $args = $this->parseArguments(true); - $class = $this->getFunctionNodeClass($name, $line); - - return new $class($name, $args, $line); - } - } - - public function parseSubscriptExpression($node) - { - $stream = $this->parser->getStream(); - $token = $stream->next(); - $lineno = $token->getLine(); - $arguments = new ArrayExpression([], $lineno); - $type = Template::ANY_CALL; - if ('.' == $token->getValue()) { - $token = $stream->next(); - if ( - /* Token::NAME_TYPE */ 5 == $token->getType() - || - /* Token::NUMBER_TYPE */ 6 == $token->getType() - || - (/* Token::OPERATOR_TYPE */ 8 == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new ConstantExpression($token->getValue(), $lineno); - - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - $type = Template::METHOD_CALL; - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - } - } else { - throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); - } - - if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { - if (!$arg instanceof ConstantExpression) { - throw new SyntaxError(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); - } - - $name = $arg->getAttribute('value'); - - $node = new MethodCallExpression($node, 'macro_'.$name, $arguments, $lineno); - $node->setAttribute('safe', true); - - return $node; - } - } else { - $type = Template::ARRAY_CALL; - - // slice? - $slice = false; - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ':')) { - $slice = true; - $arg = new ConstantExpression(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { - $slice = true; - } - - if ($slice) { - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { - $length = new ConstantExpression(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $class = $this->getFilterNodeClass('slice', $token->getLine()); - $arguments = new Node([$arg, $length]); - $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); - - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']'); - - return $filter; - } - - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']'); - } - - return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node, $tag = null) - { - while (true) { - $token = $this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5); - - $name = new ConstantExpression($token->getValue(), $token->getLine()); - if (!$this->parser->getStream()->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - $arguments = new Node(); - } else { - $arguments = $this->parseArguments(true, false, true); - } - - $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); - - $node = new $class($node, $name, $arguments, $token->getLine(), $tag); - - if (!$this->parser->getStream()->test(/* Token::PUNCTUATION_TYPE */ 9, '|')) { - break; - } - - $this->parser->getStream()->next(); - } - - return $node; - } - - /** - * Parses arguments. - * - * @param bool $namedArguments Whether to allow named arguments or not - * @param bool $definition Whether we are parsing arguments for a function definition - * - * @return Node - * - * @throws SyntaxError - */ - public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) - { - $args = []; - $stream = $this->parser->getStream(); - - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, ')')) { - if (!empty($args)) { - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'Arguments must be separated by a comma'); - } - - if ($definition) { - $token = $stream->expect(/* Token::NAME_TYPE */ 5, null, 'An argument must be a name'); - $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); - } else { - $value = $this->parseExpression(0, $allowArrow); - } - - $name = null; - if ($namedArguments && $token = $stream->nextIf(/* Token::OPERATOR_TYPE */ 8, '=')) { - if (!$value instanceof NameExpression) { - throw new SyntaxError(sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); - } - $name = $value->getAttribute('name'); - - if ($definition) { - $value = $this->parsePrimaryExpression(); - - if (!$this->checkConstantExpression($value)) { - throw new SyntaxError(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); - } - } else { - $value = $this->parseExpression(0, $allowArrow); - } - } - - if ($definition) { - if (null === $name) { - $name = $value->getAttribute('name'); - $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Node($args); - } - - public function parseAssignmentExpression() - { - $stream = $this->parser->getStream(); - $targets = []; - while (true) { - $token = $this->parser->getCurrentToken(); - if ($stream->test(/* Token::OPERATOR_TYPE */ 8) && preg_match(Lexer::REGEX_NAME, $token->getValue())) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - } else { - $stream->expect(/* Token::NAME_TYPE */ 5, null, 'Only variables can be assigned to'); - } - $value = $token->getValue(); - if (\in_array(strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) { - throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); - } - $targets[] = new AssignNameExpression($value, $token->getLine()); - - if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - } - - return new Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = []; - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - } - - return new Node($targets); - } - - private function parseNotTestExpression(Node $node): NotUnary - { - return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); - } - - private function parseTestExpression(Node $node): TestExpression - { - $stream = $this->parser->getStream(); - list($name, $test) = $this->getTest($node->getTemplateLine()); - - $class = $this->getTestNodeClass($test); - $arguments = null; - if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { - $arguments = $this->parseArguments(true); - } - - if ('defined' === $name && $node instanceof NameExpression && null !== $alias = $this->parser->getImportedSymbol('function', $node->getAttribute('name'))) { - $node = new MethodCallExpression($alias['node'], $alias['name'], new ArrayExpression([], $node->getTemplateLine()), $node->getTemplateLine()); - $node->setAttribute('safe', true); - } - - return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); - } - - private function getTest(int $line): array - { - $stream = $this->parser->getStream(); - $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - - if ($test = $this->env->getTest($name)) { - return [$name, $test]; - } - - if ($stream->test(/* Token::NAME_TYPE */ 5)) { - // try 2-words tests - $name = $name.' '.$this->parser->getCurrentToken()->getValue(); - - if ($test = $this->env->getTest($name)) { - $stream->next(); - - return [$name, $test]; - } - } - - $e = new SyntaxError(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getTests())); - - throw $e; - } - - private function getTestNodeClass(TwigTest $test): string - { - if ($test->isDeprecated()) { - $stream = $this->parser->getStream(); - $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); - - if (!\is_bool($test->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); - } - if ($test->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $test->getAlternative()); - } - $src = $stream->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine()); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $test->getNodeClass(); - } - - private function getFunctionNodeClass(string $name, int $line): string - { - if (false === $function = $this->env->getFunction($name)) { - $e = new SyntaxError(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFunctions())); - - throw $e; - } - - if ($function->isDeprecated()) { - $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); - if (!\is_bool($function->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); - } - if ($function->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $function->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $function->getNodeClass(); - } - - private function getFilterNodeClass(string $name, int $line): string - { - if (false === $filter = $this->env->getFilter($name)) { - $e = new SyntaxError(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFilters())); - - throw $e; - } - - if ($filter->isDeprecated()) { - $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); - if (!\is_bool($filter->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); - } - if ($filter->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $filter->getNodeClass(); - } - - // checks that the node only contains "constant" elements - private function checkConstantExpression(Node $node): bool - { - if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression - || $node instanceof NegUnary || $node instanceof PosUnary - )) { - return false; - } - - foreach ($node as $n) { - if (!$this->checkConstantExpression($n)) { - return false; - } - } - - return true; - } -} - -class_alias('Twig\ExpressionParser', 'Twig_ExpressionParser'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/AbstractExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/AbstractExtension.php deleted file mode 100644 index 0c012b3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/AbstractExtension.php +++ /dev/null @@ -1,47 +0,0 @@ -escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return callable[] An array of escapers - * - * @deprecated since Twig 2.11, to be removed in 3.0; use the same method on EscaperExtension instead - */ - public function getEscapers(/* $triggerDeprecation = true */) - { - if (0 === \func_num_args() || func_get_arg(0)) { - @trigger_error(sprintf('The "%s" method is deprecated since Twig 2.11; use "%s::getEscapers" instead.', __METHOD__, EscaperExtension::class), E_USER_DEPRECATED); - } - - return $this->escapers; - } - - /** - * Sets the default format to be used by the date filter. - * - * @param string $format The default date format string - * @param string $dateIntervalFormat The default date interval format string - */ - public function setDateFormat($format = null, $dateIntervalFormat = null) - { - if (null !== $format) { - $this->dateFormats[0] = $format; - } - - if (null !== $dateIntervalFormat) { - $this->dateFormats[1] = $dateIntervalFormat; - } - } - - /** - * Gets the default format to be used by the date filter. - * - * @return array The default date format string and the default date interval format string - */ - public function getDateFormat() - { - return $this->dateFormats; - } - - /** - * Sets the default timezone to be used by the date filter. - * - * @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object - */ - public function setTimezone($timezone) - { - $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); - } - - /** - * Gets the default timezone to be used by the date filter. - * - * @return \DateTimeZone The default timezone currently in use - */ - public function getTimezone() - { - if (null === $this->timezone) { - $this->timezone = new \DateTimeZone(date_default_timezone_get()); - } - - return $this->timezone; - } - - /** - * Sets the default format to be used by the number_format filter. - * - * @param int $decimal the number of decimal places to use - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - */ - public function setNumberFormat($decimal, $decimalPoint, $thousandSep) - { - $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; - } - - /** - * Get the default format used by the number_format filter. - * - * @return array The arguments for number_format() - */ - public function getNumberFormat() - { - return $this->numberFormat; - } - - public function getTokenParsers() - { - return [ - new ApplyTokenParser(), - new ForTokenParser(), - new IfTokenParser(), - new ExtendsTokenParser(), - new IncludeTokenParser(), - new BlockTokenParser(), - new UseTokenParser(), - new FilterTokenParser(), - new MacroTokenParser(), - new ImportTokenParser(), - new FromTokenParser(), - new SetTokenParser(), - new SpacelessTokenParser(), - new FlushTokenParser(), - new DoTokenParser(), - new EmbedTokenParser(), - new WithTokenParser(), - new DeprecatedTokenParser(), - ]; - } - - public function getFilters() - { - return [ - // formatting filters - new TwigFilter('date', 'twig_date_format_filter', ['needs_environment' => true]), - new TwigFilter('date_modify', 'twig_date_modify_filter', ['needs_environment' => true]), - new TwigFilter('format', 'sprintf'), - new TwigFilter('replace', 'twig_replace_filter'), - new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), - new TwigFilter('abs', 'abs'), - new TwigFilter('round', 'twig_round'), - - // encoding - new TwigFilter('url_encode', 'twig_urlencode_filter'), - new TwigFilter('json_encode', 'json_encode'), - new TwigFilter('convert_encoding', 'twig_convert_encoding'), - - // string filters - new TwigFilter('title', 'twig_title_string_filter', ['needs_environment' => true]), - new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), - new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]), - new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]), - new TwigFilter('striptags', 'strip_tags'), - new TwigFilter('trim', 'twig_trim_filter'), - new TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), - new TwigFilter('spaceless', 'twig_spaceless', ['is_safe' => ['html']]), - - // array helpers - new TwigFilter('join', 'twig_join_filter'), - new TwigFilter('split', 'twig_split_filter', ['needs_environment' => true]), - new TwigFilter('sort', 'twig_sort_filter'), - new TwigFilter('merge', 'twig_array_merge'), - new TwigFilter('batch', 'twig_array_batch'), - new TwigFilter('column', 'twig_array_column'), - new TwigFilter('filter', 'twig_array_filter'), - new TwigFilter('map', 'twig_array_map'), - new TwigFilter('reduce', 'twig_array_reduce'), - - // string/array filters - new TwigFilter('reverse', 'twig_reverse_filter', ['needs_environment' => true]), - new TwigFilter('length', 'twig_length_filter', ['needs_environment' => true]), - new TwigFilter('slice', 'twig_slice', ['needs_environment' => true]), - new TwigFilter('first', 'twig_first', ['needs_environment' => true]), - new TwigFilter('last', 'twig_last', ['needs_environment' => true]), - - // iteration and runtime - new TwigFilter('default', '_twig_default_filter', ['node_class' => DefaultFilter::class]), - new TwigFilter('keys', 'twig_get_array_keys_filter'), - ]; - } - - public function getFunctions() - { - return [ - new TwigFunction('max', 'max'), - new TwigFunction('min', 'min'), - new TwigFunction('range', 'range'), - new TwigFunction('constant', 'twig_constant'), - new TwigFunction('cycle', 'twig_cycle'), - new TwigFunction('random', 'twig_random', ['needs_environment' => true]), - new TwigFunction('date', 'twig_date_converter', ['needs_environment' => true]), - new TwigFunction('include', 'twig_include', ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), - new TwigFunction('source', 'twig_source', ['needs_environment' => true, 'is_safe' => ['all']]), - ]; - } - - public function getTests() - { - return [ - new TwigTest('even', null, ['node_class' => EvenTest::class]), - new TwigTest('odd', null, ['node_class' => OddTest::class]), - new TwigTest('defined', null, ['node_class' => DefinedTest::class]), - new TwigTest('same as', null, ['node_class' => SameasTest::class]), - new TwigTest('none', null, ['node_class' => NullTest::class]), - new TwigTest('null', null, ['node_class' => NullTest::class]), - new TwigTest('divisible by', null, ['node_class' => DivisiblebyTest::class]), - new TwigTest('constant', null, ['node_class' => ConstantTest::class]), - new TwigTest('empty', 'twig_test_empty'), - new TwigTest('iterable', 'twig_test_iterable'), - ]; - } - - public function getNodeVisitors() - { - return [new MacroAutoImportNodeVisitor()]; - } - - public function getOperators() - { - return [ - [ - 'not' => ['precedence' => 50, 'class' => NotUnary::class], - '-' => ['precedence' => 500, 'class' => NegUnary::class], - '+' => ['precedence' => 500, 'class' => PosUnary::class], - ], - [ - 'or' => ['precedence' => 10, 'class' => OrBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'and' => ['precedence' => 15, 'class' => AndBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-or' => ['precedence' => 16, 'class' => BitwiseOrBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-xor' => ['precedence' => 17, 'class' => BitwiseXorBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'b-and' => ['precedence' => 18, 'class' => BitwiseAndBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '==' => ['precedence' => 20, 'class' => EqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '!=' => ['precedence' => 20, 'class' => NotEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '<=>' => ['precedence' => 20, 'class' => SpaceshipBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '<' => ['precedence' => 20, 'class' => LessBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '>' => ['precedence' => 20, 'class' => GreaterBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '>=' => ['precedence' => 20, 'class' => GreaterEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '<=' => ['precedence' => 20, 'class' => LessEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'not in' => ['precedence' => 20, 'class' => NotInBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'in' => ['precedence' => 20, 'class' => InBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'matches' => ['precedence' => 20, 'class' => MatchesBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'starts with' => ['precedence' => 20, 'class' => StartsWithBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'ends with' => ['precedence' => 20, 'class' => EndsWithBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '..' => ['precedence' => 25, 'class' => RangeBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '+' => ['precedence' => 30, 'class' => AddBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '-' => ['precedence' => 30, 'class' => SubBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '~' => ['precedence' => 40, 'class' => ConcatBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '*' => ['precedence' => 60, 'class' => MulBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '/' => ['precedence' => 60, 'class' => DivBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '//' => ['precedence' => 60, 'class' => FloorDivBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '%' => ['precedence' => 60, 'class' => ModBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], - '**' => ['precedence' => 200, 'class' => PowerBinary::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT], - '??' => ['precedence' => 300, 'class' => NullCoalesceExpression::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT], - ], - ]; - } -} - -class_alias('Twig\Extension\CoreExtension', 'Twig_Extension_Core'); -} - -namespace { - use Twig\Environment; - use Twig\Error\LoaderError; - use Twig\Error\RuntimeError; - use Twig\Extension\CoreExtension; - use Twig\Extension\SandboxExtension; - use Twig\Markup; - use Twig\Source; - use Twig\Template; - - /** - * Cycles over a value. - * - * @param \ArrayAccess|array $values - * @param int $position The cycle position - * - * @return string The next value in the cycle - */ -function twig_cycle($values, $position) -{ - if (!\is_array($values) && !$values instanceof \ArrayAccess) { - return $values; - } - - return $values[$position % \count($values)]; -} - -/** - * Returns a random value depending on the supplied parameter type: - * - a random item from a \Traversable or array - * - a random character from a string - * - a random integer between 0 and the integer parameter. - * - * @param \Traversable|array|int|float|string $values The values to pick a random item from - * @param int|null $max Maximum value used when $values is an int - * - * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) - * - * @return mixed A random value from the given sequence - */ -function twig_random(Environment $env, $values = null, $max = null) -{ - if (null === $values) { - return null === $max ? mt_rand() : mt_rand(0, $max); - } - - if (\is_int($values) || \is_float($values)) { - if (null === $max) { - if ($values < 0) { - $max = 0; - $min = $values; - } else { - $max = $values; - $min = 0; - } - } else { - $min = $values; - $max = $max; - } - - return mt_rand($min, $max); - } - - if (\is_string($values)) { - if ('' === $values) { - return ''; - } - - $charset = $env->getCharset(); - - if ('UTF-8' !== $charset) { - $values = twig_convert_encoding($values, 'UTF-8', $charset); - } - - // unicode version of str_split() - // split at all positions, but not after the start and not before the end - $values = preg_split('/(? $value) { - $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); - } - } - } - - if (!twig_test_iterable($values)) { - return $values; - } - - $values = twig_to_array($values); - - if (0 === \count($values)) { - throw new RuntimeError('The random function cannot pick from an empty array.'); - } - - return $values[array_rand($values, 1)]; -} - -/** - * Converts a date to the given format. - * - * {{ post.published_at|date("m/d/Y") }} - * - * @param \DateTimeInterface|\DateInterval|string $date A date - * @param string|null $format The target format, null to use the default - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return string The formatted date - */ -function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) -{ - if (null === $format) { - $formats = $env->getExtension(CoreExtension::class)->getDateFormat(); - $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof \DateInterval) { - return $date->format($format); - } - - return twig_date_converter($env, $date, $timezone)->format($format); -} - -/** - * Returns a new date object modified. - * - * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} - * - * @param \DateTimeInterface|string $date A date - * @param string $modifier A modifier string - * - * @return \DateTimeInterface - */ -function twig_date_modify_filter(Environment $env, $date, $modifier) -{ - $date = twig_date_converter($env, $date, false); - - return $date->modify($modifier); -} - -/** - * Converts an input to a \DateTime instance. - * - * {% if date(user.created_at) < date('+2days') %} - * {# do something #} - * {% endif %} - * - * @param \DateTimeInterface|string|null $date A date or null to use the current time - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return \DateTimeInterface - */ -function twig_date_converter(Environment $env, $date = null, $timezone = null) -{ - // determine the timezone - if (false !== $timezone) { - if (null === $timezone) { - $timezone = $env->getExtension(CoreExtension::class)->getTimezone(); - } elseif (!$timezone instanceof \DateTimeZone) { - $timezone = new \DateTimeZone($timezone); - } - } - - // immutable dates - if ($date instanceof \DateTimeImmutable) { - return false !== $timezone ? $date->setTimezone($timezone) : $date; - } - - if ($date instanceof \DateTimeInterface) { - $date = clone $date; - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; - } - - if (null === $date || 'now' === $date) { - return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension(CoreExtension::class)->getTimezone()); - } - - $asString = (string) $date; - if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { - $date = new \DateTime('@'.$date); - } else { - $date = new \DateTime($date, $env->getExtension(CoreExtension::class)->getTimezone()); - } - - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; -} - -/** - * Replaces strings within a string. - * - * @param string $str String to replace in - * @param array|\Traversable $from Replace values - * - * @return string - */ -function twig_replace_filter($str, $from) -{ - if (!twig_test_iterable($from)) { - throw new RuntimeError(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); - } - - return strtr($str, twig_to_array($from)); -} - -/** - * Rounds a number. - * - * @param int|float $value The value to round - * @param int|float $precision The rounding precision - * @param string $method The method to use for rounding - * - * @return int|float The rounded number - */ -function twig_round($value, $precision = 0, $method = 'common') -{ - if ('common' == $method) { - return round($value, $precision); - } - - if ('ceil' != $method && 'floor' != $method) { - throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); - } - - return $method($value * pow(10, $precision)) / pow(10, $precision); -} - -/** - * Number format filter. - * - * All of the formatting options can be left null, in that case the defaults will - * be used. Supplying any of the parameters will override the defaults set in the - * environment object. - * - * @param mixed $number A float/int/string of the number to format - * @param int $decimal the number of decimal points to display - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - * - * @return string The formatted number - */ -function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - $defaults = $env->getExtension(CoreExtension::class)->getNumberFormat(); - if (null === $decimal) { - $decimal = $defaults[0]; - } - - if (null === $decimalPoint) { - $decimalPoint = $defaults[1]; - } - - if (null === $thousandSep) { - $thousandSep = $defaults[2]; - } - - return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * URL encodes (RFC 3986) a string as a path segment or an array as a query string. - * - * @param string|array $url A URL or an array of query parameters - * - * @return string The URL encoded value - */ -function twig_urlencode_filter($url) -{ - if (\is_array($url)) { - return http_build_query($url, '', '&', PHP_QUERY_RFC3986); - } - - return rawurlencode($url); -} - -/** - * Merges an array with another one. - * - * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - * - * {% set items = items|merge({ 'peugeot': 'car' }) %} - * - * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} - * - * @param array|\Traversable $arr1 An array - * @param array|\Traversable $arr2 An array - * - * @return array The merged array - */ -function twig_array_merge($arr1, $arr2) -{ - if (!twig_test_iterable($arr1)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); - } - - if (!twig_test_iterable($arr2)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); - } - - return array_merge(twig_to_array($arr1), twig_to_array($arr2)); -} - -/** - * Slices a variable. - * - * @param mixed $item A variable - * @param int $start Start of the slice - * @param int $length Size of the slice - * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) - * - * @return mixed The sliced variable - */ -function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - if ($item instanceof \Traversable) { - while ($item instanceof \IteratorAggregate) { - $item = $item->getIterator(); - } - - if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { - try { - return iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); - } catch (\OutOfBoundsException $e) { - return []; - } - } - - $item = iterator_to_array($item, $preserveKeys); - } - - if (\is_array($item)) { - return \array_slice($item, $start, $length, $preserveKeys); - } - - $item = (string) $item; - - return (string) mb_substr($item, $start, $length, $env->getCharset()); -} - -/** - * Returns the first element of the item. - * - * @param mixed $item A variable - * - * @return mixed The first element of the item - */ -function twig_first(Environment $env, $item) -{ - $elements = twig_slice($env, $item, 0, 1, false); - - return \is_string($elements) ? $elements : current($elements); -} - -/** - * Returns the last element of the item. - * - * @param mixed $item A variable - * - * @return mixed The last element of the item - */ -function twig_last(Environment $env, $item) -{ - $elements = twig_slice($env, $item, -1, 1, false); - - return \is_string($elements) ? $elements : current($elements); -} - -/** - * Joins the values to a string. - * - * The separators between elements are empty strings per default, you can define them with the optional parameters. - * - * {{ [1, 2, 3]|join(', ', ' and ') }} - * {# returns 1, 2 and 3 #} - * - * {{ [1, 2, 3]|join('|') }} - * {# returns 1|2|3 #} - * - * {{ [1, 2, 3]|join }} - * {# returns 123 #} - * - * @param array $value An array - * @param string $glue The separator - * @param string|null $and The separator for the last pair - * - * @return string The concatenated string - */ -function twig_join_filter($value, $glue = '', $and = null) -{ - if (!twig_test_iterable($value)) { - $value = (array) $value; - } - - $value = twig_to_array($value, false); - - if (0 === \count($value)) { - return ''; - } - - if (null === $and || $and === $glue) { - return implode($glue, $value); - } - - if (1 === \count($value)) { - return $value[0]; - } - - return implode($glue, \array_slice($value, 0, -1)).$and.$value[\count($value) - 1]; -} - -/** - * Splits the string into an array. - * - * {{ "one,two,three"|split(',') }} - * {# returns [one, two, three] #} - * - * {{ "one,two,three,four,five"|split(',', 3) }} - * {# returns [one, two, "three,four,five"] #} - * - * {{ "123"|split('') }} - * {# returns [1, 2, 3] #} - * - * {{ "aabbcc"|split('', 2) }} - * {# returns [aa, bb, cc] #} - * - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit - * - * @return array The split string as an array - */ -function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) -{ - if (\strlen($delimiter) > 0) { - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); - } - - if ($limit <= 1) { - return preg_split('/(?getCharset()); - if ($length < $limit) { - return [$value]; - } - - $r = []; - for ($i = 0; $i < $length; $i += $limit) { - $r[] = mb_substr($value, $i, $limit, $env->getCharset()); - } - - return $r; -} - -// The '_default' filter is used internally to avoid using the ternary operator -// which costs a lot for big contexts (before PHP 5.4). So, on average, -// a function call is cheaper. -/** - * @internal - */ -function _twig_default_filter($value, $default = '') -{ - if (twig_test_empty($value)) { - return $default; - } - - return $value; -} - -/** - * Returns the keys for the given array. - * - * It is useful when you want to iterate over the keys of an array: - * - * {% for key in array|keys %} - * {# ... #} - * {% endfor %} - * - * @param array $array An array - * - * @return array The keys - */ -function twig_get_array_keys_filter($array) -{ - if ($array instanceof \Traversable) { - while ($array instanceof \IteratorAggregate) { - $array = $array->getIterator(); - } - - if ($array instanceof \Iterator) { - $keys = []; - $array->rewind(); - while ($array->valid()) { - $keys[] = $array->key(); - $array->next(); - } - - return $keys; - } - - $keys = []; - foreach ($array as $key => $item) { - $keys[] = $key; - } - - return $keys; - } - - if (!\is_array($array)) { - return []; - } - - return array_keys($array); -} - -/** - * Reverses a variable. - * - * @param array|\Traversable|string $item An array, a \Traversable instance, or a string - * @param bool $preserveKeys Whether to preserve key or not - * - * @return mixed The reversed input - */ -function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) -{ - if ($item instanceof \Traversable) { - return array_reverse(iterator_to_array($item), $preserveKeys); - } - - if (\is_array($item)) { - return array_reverse($item, $preserveKeys); - } - - $string = (string) $item; - - $charset = $env->getCharset(); - - if ('UTF-8' !== $charset) { - $item = twig_convert_encoding($string, 'UTF-8', $charset); - } - - preg_match_all('/./us', $item, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; -} - -/** - * Sorts an array. - * - * @param array|\Traversable $array - * - * @return array - */ -function twig_sort_filter($array, $arrow = null) -{ - if ($array instanceof \Traversable) { - $array = iterator_to_array($array); - } elseif (!\is_array($array)) { - throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); - } - - if (null !== $arrow) { - uasort($array, $arrow); - } else { - asort($array); - } - - return $array; -} - -/** - * @internal - */ -function twig_in_filter($value, $compare) -{ - if ($value instanceof Markup) { - $value = (string) $value; - } - if ($compare instanceof Markup) { - $compare = (string) $compare; - } - - if (\is_array($compare)) { - return \in_array($value, $compare, \is_object($value) || \is_resource($value)); - } elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) { - return '' === $value || false !== strpos($compare, (string) $value); - } elseif ($compare instanceof \Traversable) { - if (\is_object($value) || \is_resource($value)) { - foreach ($compare as $item) { - if ($item === $value) { - return true; - } - } - } else { - foreach ($compare as $item) { - if ($item == $value) { - return true; - } - } - } - - return false; - } - - return false; -} - -/** - * Returns a trimmed string. - * - * @return string - * - * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') - */ -function twig_trim_filter($string, $characterMask = null, $side = 'both') -{ - if (null === $characterMask) { - $characterMask = " \t\n\r\0\x0B"; - } - - switch ($side) { - case 'both': - return trim($string, $characterMask); - case 'left': - return ltrim($string, $characterMask); - case 'right': - return rtrim($string, $characterMask); - default: - throw new RuntimeError('Trimming side must be "left", "right" or "both".'); - } -} - -/** - * Removes whitespaces between HTML tags. - * - * @return string - */ -function twig_spaceless($content) -{ - return trim(preg_replace('/>\s+<', $content)); -} - -function twig_convert_encoding($string, $to, $from) -{ - if (!function_exists('iconv')) { - throw new RuntimeError('Unable to convert encoding: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); - } - - return iconv($from, $to, $string); -} - -/** - * Returns the length of a variable. - * - * @param mixed $thing A variable - * - * @return int The length of the value - */ -function twig_length_filter(Environment $env, $thing) -{ - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return mb_strlen($thing, $env->getCharset()); - } - - if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { - return \count($thing); - } - - if ($thing instanceof \Traversable) { - return iterator_count($thing); - } - - if (method_exists($thing, '__toString') && !$thing instanceof \Countable) { - return mb_strlen((string) $thing, $env->getCharset()); - } - - return 1; -} - -/** - * Converts a string to uppercase. - * - * @param string $string A string - * - * @return string The uppercased string - */ -function twig_upper_filter(Environment $env, $string) -{ - return mb_strtoupper($string, $env->getCharset()); -} - -/** - * Converts a string to lowercase. - * - * @param string $string A string - * - * @return string The lowercased string - */ -function twig_lower_filter(Environment $env, $string) -{ - return mb_strtolower($string, $env->getCharset()); -} - -/** - * Returns a titlecased string. - * - * @param string $string A string - * - * @return string The titlecased string - */ -function twig_title_string_filter(Environment $env, $string) -{ - if (null !== $charset = $env->getCharset()) { - return mb_convert_case($string, MB_CASE_TITLE, $charset); - } - - return ucwords(strtolower($string)); -} - -/** - * Returns a capitalized string. - * - * @param string $string A string - * - * @return string The capitalized string - */ -function twig_capitalize_string_filter(Environment $env, $string) -{ - $charset = $env->getCharset(); - - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, null, $charset), $charset); -} - -/** - * @internal - */ -function twig_call_macro(Template $template, string $method, array $args, int $lineno, array $context, Source $source) -{ - if (!method_exists($template, $method)) { - $parent = $template; - while ($parent = $parent->getParent($context)) { - if (method_exists($parent, $method)) { - return $parent->$method(...$args); - } - } - - throw new RuntimeError(sprintf('Macro "%s" is not defined in template "%s".', substr($method, \strlen('macro_')), $template->getTemplateName()), $lineno, $source); - } - - return $template->$method(...$args); -} - -/** - * @internal - */ -function twig_ensure_traversable($seq) -{ - if ($seq instanceof \Traversable || \is_array($seq)) { - return $seq; - } - - return []; -} - -/** - * @internal - */ -function twig_to_array($seq, $preserveKeys = true) -{ - if ($seq instanceof \Traversable) { - return iterator_to_array($seq, $preserveKeys); - } - - if (!\is_array($seq)) { - return $seq; - } - - return $preserveKeys ? $seq : array_values($seq); -} - -/** - * Checks if a variable is empty. - * - * {# evaluates to true if the foo variable is null, false, or the empty string #} - * {% if foo is empty %} - * {# ... #} - * {% endif %} - * - * @param mixed $value A variable - * - * @return bool true if the value is empty, false otherwise - */ -function twig_test_empty($value) -{ - if ($value instanceof \Countable) { - return 0 == \count($value); - } - - if ($value instanceof \Traversable) { - return !iterator_count($value); - } - - if (\is_object($value) && method_exists($value, '__toString')) { - return '' === (string) $value; - } - - return '' === $value || false === $value || null === $value || [] === $value; -} - -/** - * Checks if a variable is traversable. - * - * {# evaluates to true if the foo variable is an array or a traversable object #} - * {% if foo is iterable %} - * {# ... #} - * {% endif %} - * - * @param mixed $value A variable - * - * @return bool true if the value is traversable - */ -function twig_test_iterable($value) -{ - return $value instanceof \Traversable || \is_array($value); -} - -/** - * Renders a template. - * - * @param array $context - * @param string|array $template The template to render or an array of templates to try consecutively - * @param array $variables The variables to pass to the template - * @param bool $withContext - * @param bool $ignoreMissing Whether to ignore missing templates or not - * @param bool $sandboxed Whether to sandbox the template or not - * - * @return string The rendered template - */ -function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - $alreadySandboxed = false; - $sandbox = null; - if ($withContext) { - $variables = array_merge($context, $variables); - } - - if ($isSandboxed = $sandboxed && $env->hasExtension(SandboxExtension::class)) { - $sandbox = $env->getExtension(SandboxExtension::class); - if (!$alreadySandboxed = $sandbox->isSandboxed()) { - $sandbox->enableSandbox(); - } - } - - try { - $loaded = null; - try { - $loaded = $env->resolveTemplate($template); - } catch (LoaderError $e) { - if (!$ignoreMissing) { - throw $e; - } - } - - return $loaded ? $loaded->render($variables) : ''; - } finally { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - } -} - -/** - * Returns a template content without rendering it. - * - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not - * - * @return string The template source - */ -function twig_source(Environment $env, $name, $ignoreMissing = false) -{ - $loader = $env->getLoader(); - try { - return $loader->getSourceContext($name)->getCode(); - } catch (LoaderError $e) { - if (!$ignoreMissing) { - throw $e; - } - } -} - -/** - * Provides the ability to get constants from instances as well as class/global constants. - * - * @param string $constant The name of the constant - * @param object|null $object The object to get the constant from - * - * @return string - */ -function twig_constant($constant, $object = null) -{ - if (null !== $object) { - $constant = \get_class($object).'::'.$constant; - } - - return \constant($constant); -} - -/** - * Checks if a constant exists. - * - * @param string $constant The name of the constant - * @param object|null $object The object to get the constant from - * - * @return bool - */ -function twig_constant_is_defined($constant, $object = null) -{ - if (null !== $object) { - $constant = \get_class($object).'::'.$constant; - } - - return \defined($constant); -} - -/** - * Batches item. - * - * @param array $items An array of items - * @param int $size The size of the batch - * @param mixed $fill A value used to fill missing items - * - * @return array - */ -function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) -{ - if (!twig_test_iterable($items)) { - throw new RuntimeError(sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); - } - - $size = ceil($size); - - $result = array_chunk(twig_to_array($items, $preserveKeys), $size, $preserveKeys); - - if (null !== $fill && $result) { - $last = \count($result) - 1; - if ($fillCount = $size - \count($result[$last])) { - for ($i = 0; $i < $fillCount; ++$i) { - $result[$last][] = $fill; - } - } - } - - return $result; -} - -/** - * Returns the attribute value for a given array/object. - * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see \Twig\Template constants) - * @param bool $isDefinedTest Whether this is only a defined check - * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not - * @param int $lineno The template line where the attribute was called - * - * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true - * - * @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false - * - * @internal - */ -function twig_get_attribute(Environment $env, Source $source, $object, $item, array $arguments = [], $type = /* Template::ANY_CALL */ 'any', $isDefinedTest = false, $ignoreStrictCheck = false, $sandboxed = false, int $lineno = -1) -{ - // array - if (/* Template::METHOD_CALL */ 'method' !== $type) { - $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; - - if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object))) - || ($object instanceof ArrayAccess && isset($object[$arrayItem])) - ) { - if ($isDefinedTest) { - return true; - } - - return $object[$arrayItem]; - } - - if (/* Template::ARRAY_CALL */ 'array' === $type || !\is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - if ($object instanceof ArrayAccess) { - $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); - } elseif (\is_object($object)) { - $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); - } elseif (\is_array($object)) { - if (empty($object)) { - $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); - } else { - $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); - } - } elseif (/* Template::ARRAY_CALL */ 'array' === $type) { - if (null === $object) { - $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - } elseif (null === $object) { - $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - - throw new RuntimeError($message, $lineno, $source); - } - } - - if (!\is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - if (null === $object) { - $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); - } elseif (\is_array($object)) { - $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); - } else { - $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); - } - - throw new RuntimeError($message, $lineno, $source); - } - - if ($object instanceof Template) { - throw new RuntimeError('Accessing \Twig\Template attributes is forbidden.', $lineno, $source); - } - - // object property - if (/* Template::METHOD_CALL */ 'method' !== $type) { - if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) { - if ($isDefinedTest) { - return true; - } - - if ($sandboxed) { - $env->getExtension(SandboxExtension::class)->checkPropertyAllowed($object, $item, $lineno, $source); - } - - return $object->$item; - } - } - - static $cache = []; - - $class = \get_class($object); - - // object method - // precedence: getXxx() > isXxx() > hasXxx() - if (!isset($cache[$class])) { - $methods = get_class_methods($object); - sort($methods); - $lcMethods = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, $methods); - $classCache = []; - foreach ($methods as $i => $method) { - $classCache[$method] = $method; - $classCache[$lcName = $lcMethods[$i]] = $method; - - if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { - $name = substr($method, 2); - $lcName = substr($lcName, 2); - } elseif ('h' === $lcName[0] && 0 === strpos($lcName, 'has')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - if (\in_array('is'.$lcName, $lcMethods)) { - continue; - } - } else { - continue; - } - - // skip get() and is() methods (in which case, $name is empty) - if ($name) { - if (!isset($classCache[$name])) { - $classCache[$name] = $method; - } - - if (!isset($classCache[$lcName])) { - $classCache[$lcName] = $method; - } - } - } - $cache[$class] = $classCache; - } - - $call = false; - if (isset($cache[$class][$item])) { - $method = $cache[$class][$item]; - } elseif (isset($cache[$class][$lcItem = strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) { - $method = $cache[$class][$lcItem]; - } elseif (isset($cache[$class]['__call'])) { - $method = $item; - $call = true; - } else { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), $lineno, $source); - } - - if ($isDefinedTest) { - return true; - } - - if ($sandboxed) { - $env->getExtension(SandboxExtension::class)->checkMethodAllowed($object, $method, $lineno, $source); - } - - // Some objects throw exceptions when they have __call, and the method we try - // to call is not supported. If ignoreStrictCheck is true, we should return null. - try { - $ret = $object->$method(...$arguments); - } catch (\BadMethodCallException $e) { - if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) { - return; - } - throw $e; - } - - return $ret; -} - -/** - * Returns the values from a single column in the input array. - * - *
    - *  {% set items = [{ 'fruit' : 'apple'}, {'fruit' : 'orange' }] %}
    - *
    - *  {% set fruits = items|column('fruit') %}
    - *
    - *  {# fruits now contains ['apple', 'orange'] #}
    - * 
    - * - * @param array|Traversable $array An array - * @param mixed $name The column name - * @param mixed $index The column to use as the index/keys for the returned array - * - * @return array The array of values - */ -function twig_array_column($array, $name, $index = null): array -{ - if ($array instanceof Traversable) { - $array = iterator_to_array($array); - } elseif (!\is_array($array)) { - throw new RuntimeError(sprintf('The column filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($array))); - } - - return array_column($array, $name, $index); -} - -function twig_array_filter($array, $arrow) -{ - if (\is_array($array)) { - return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); - } - - // the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator - return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow); -} - -function twig_array_map($array, $arrow) -{ - $r = []; - foreach ($array as $k => $v) { - $r[$k] = $arrow($v, $k); - } - - return $r; -} - -function twig_array_reduce($array, $arrow, $initial = null) -{ - if (!\is_array($array)) { - $array = iterator_to_array($array); - } - - return array_reduce($array, $arrow, $initial); -} -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/DebugExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/DebugExtension.php deleted file mode 100644 index 2e8510d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/DebugExtension.php +++ /dev/null @@ -1,66 +0,0 @@ - $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), - ]; - } -} - -class_alias('Twig\Extension\DebugExtension', 'Twig_Extension_Debug'); -} - -namespace { -use Twig\Environment; -use Twig\Template; -use Twig\TemplateWrapper; - -function twig_var_dump(Environment $env, $context, ...$vars) -{ - if (!$env->isDebug()) { - return; - } - - ob_start(); - - if (!$vars) { - $vars = []; - foreach ($context as $key => $value) { - if (!$value instanceof Template && !$value instanceof TemplateWrapper) { - $vars[$key] = $value; - } - } - - var_dump($vars); - } else { - var_dump(...$vars); - } - - return ob_get_clean(); -} -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/EscaperExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/EscaperExtension.php deleted file mode 100644 index 136f75f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/EscaperExtension.php +++ /dev/null @@ -1,427 +0,0 @@ -setDefaultStrategy($defaultStrategy); - } - - public function getTokenParsers() - { - return [new AutoEscapeTokenParser()]; - } - - public function getNodeVisitors() - { - return [new EscaperNodeVisitor()]; - } - - public function getFilters() - { - return [ - new TwigFilter('escape', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), - new TwigFilter('e', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), - new TwigFilter('raw', 'twig_raw_filter', ['is_safe' => ['all']]), - ]; - } - - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * name as an argument and returns the strategy to use. - * - * @param string|false|callable $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) - { - if ('name' === $defaultStrategy) { - $defaultStrategy = [FileExtensionEscapingStrategy::class, 'guess']; - } - - $this->defaultStrategy = $defaultStrategy; - } - - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $name The template name - * - * @return string|false The default strategy to use for the template - */ - public function getDefaultStrategy($name) - { - // disable string callables to avoid calling a function named html or js, - // or any other upcoming escaping strategy - if (!\is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { - return \call_user_func($this->defaultStrategy, $name); - } - - return $this->defaultStrategy; - } - - /** - * Defines a new escaper to be used via the escape filter. - * - * @param string $strategy The strategy name that should be used as a strategy in the escape call - * @param callable $callable A valid PHP callable - */ - public function setEscaper($strategy, callable $callable) - { - $this->escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return callable[] An array of escapers - */ - public function getEscapers() - { - return $this->escapers; - } - - public function setSafeClasses(array $safeClasses = []) - { - $this->safeClasses = []; - $this->safeLookup = []; - foreach ($safeClasses as $class => $strategies) { - $this->addSafeClass($class, $strategies); - } - } - - public function addSafeClass(string $class, array $strategies) - { - $class = ltrim($class, '\\'); - if (!isset($this->safeClasses[$class])) { - $this->safeClasses[$class] = []; - } - $this->safeClasses[$class] = array_merge($this->safeClasses[$class], $strategies); - - foreach ($strategies as $strategy) { - $this->safeLookup[$strategy][$class] = true; - } - } -} - -class_alias('Twig\Extension\EscaperExtension', 'Twig_Extension_Escaper'); -} - -namespace { -use Twig\Environment; -use Twig\Error\RuntimeError; -use Twig\Extension\CoreExtension; -use Twig\Extension\EscaperExtension; -use Twig\Markup; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Node; - -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - * - * @return string - */ -function twig_raw_filter($string) -{ - return $string; -} - -/** - * Escapes a string. - * - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - * - * @return string - */ -function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) -{ - if ($autoescape && $string instanceof Markup) { - return $string; - } - - if (!\is_string($string)) { - if (\is_object($string) && method_exists($string, '__toString')) { - if ($autoescape) { - $c = \get_class($string); - $ext = $env->getExtension(EscaperExtension::class); - if (!isset($ext->safeClasses[$c])) { - $ext->safeClasses[$c] = []; - foreach (class_parents($string) + class_implements($string) as $class) { - if (isset($ext->safeClasses[$class])) { - $ext->safeClasses[$c] = array_unique(array_merge($ext->safeClasses[$c], $ext->safeClasses[$class])); - foreach ($ext->safeClasses[$class] as $s) { - $ext->safeLookup[$s][$c] = true; - } - } - } - } - if (isset($ext->safeLookup[$strategy][$c]) || isset($ext->safeLookup['all'][$c])) { - return (string) $string; - } - } - - $string = (string) $string; - } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { - return $string; - } - } - - if ('' === $string) { - return ''; - } - - if (null === $charset) { - $charset = $env->getCharset(); - } - - switch ($strategy) { - case 'html': - // see https://secure.php.net/htmlspecialchars - - // Using a static variable to avoid initializing the array - // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping strategies. - static $htmlspecialcharsCharsets = [ - 'ISO-8859-1' => true, 'ISO8859-1' => true, - 'ISO-8859-15' => true, 'ISO8859-15' => true, - 'utf-8' => true, 'UTF-8' => true, - 'CP866' => true, 'IBM866' => true, '866' => true, - 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, - '1251' => true, - 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, - 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, - 'BIG5' => true, '950' => true, - 'GB2312' => true, '936' => true, - 'BIG5-HKSCS' => true, - 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, - 'EUC-JP' => true, 'EUCJP' => true, - 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, - ]; - - if (isset($htmlspecialcharsCharsets[$charset])) { - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { - // cache the lowercase variant for future iterations - $htmlspecialcharsCharsets[$charset] = true; - - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - $string = twig_convert_encoding($string, 'UTF-8', $charset); - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); - - return iconv('UTF-8', $charset, $string); - - case 'js': - // escape all non-alphanumeric characters - // into their \x or \uHHHH representations - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', function ($matches) { - $char = $matches[0]; - - /* - * A few characters have short escape sequences in JSON and JavaScript. - * Escape sequences supported only by JavaScript, not JSON, are ommitted. - * \" is also supported but omitted, because the resulting string is not HTML safe. - */ - static $shortMap = [ - '\\' => '\\\\', - '/' => '\\/', - "\x08" => '\b', - "\x0C" => '\f', - "\x0A" => '\n', - "\x0D" => '\r', - "\x09" => '\t', - ]; - - if (isset($shortMap[$char])) { - return $shortMap[$char]; - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - $char = strtoupper(bin2hex($char)); - - if (4 >= \strlen($char)) { - return sprintf('\u%04s', $char); - } - - return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'css': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) { - $char = $matches[0]; - - return sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : mb_ord($char, 'UTF-8')); - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'html_attr': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (!preg_match('//u', $string)) { - throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', function ($matches) { - /** - * This function is adapted from code coming from Zend Framework. - * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) - * @license https://framework.zend.com/license/new-bsd New BSD License - */ - $chr = $matches[0]; - $ord = \ord($chr); - - /* - * The following replaces characters undefined in HTML with the - * hex entity for the Unicode replacement character. - */ - if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { - return '�'; - } - - /* - * Check if the current character to escape has a name entity we should - * replace it with while grabbing the hex value of the character. - */ - if (1 === \strlen($chr)) { - /* - * While HTML supports far more named entities, the lowest common denominator - * has become HTML5's XML Serialisation which is restricted to the those named - * entities that XML supports. Using HTML entities would result in this error: - * XML Parsing Error: undefined entity - */ - static $entityMap = [ - 34 => '"', /* quotation mark */ - 38 => '&', /* ampersand */ - 60 => '<', /* less-than sign */ - 62 => '>', /* greater-than sign */ - ]; - - if (isset($entityMap[$ord])) { - return $entityMap[$ord]; - } - - return sprintf('&#x%02X;', $ord); - } - - /* - * Per OWASP recommendations, we'll use hex entities for any other - * characters where a named entity does not exist. - */ - return sprintf('&#x%04X;', mb_ord($chr, 'UTF-8')); - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'url': - return rawurlencode($string); - - default: - static $escapers; - - if (null === $escapers) { - // merge the ones set on CoreExtension for BC (to be removed in 3.0) - $escapers = array_merge( - $env->getExtension(CoreExtension::class)->getEscapers(false), - $env->getExtension(EscaperExtension::class)->getEscapers() - ); - } - - if (isset($escapers[$strategy])) { - return $escapers[$strategy]($env, $string, $charset); - } - - $validStrategies = implode(', ', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($escapers))); - - throw new RuntimeError(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); - } -} - -/** - * @internal - */ -function twig_escape_filter_is_safe(Node $filterArgs) -{ - foreach ($filterArgs as $arg) { - if ($arg instanceof ConstantExpression) { - return [$arg->getAttribute('value')]; - } - - return []; - } - - return ['html']; -} -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ExtensionInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ExtensionInterface.php deleted file mode 100644 index a083211..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ExtensionInterface.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ -interface ExtensionInterface -{ - /** - * Returns the token parser instances to add to the existing list. - * - * @return TokenParserInterface[] - */ - public function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return NodeVisitorInterface[] - */ - public function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return TwigFilter[] - */ - public function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return TwigTest[] - */ - public function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return TwigFunction[] - */ - public function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array First array of unary operators, second array of binary operators - */ - public function getOperators(); -} - -class_alias('Twig\Extension\ExtensionInterface', 'Twig_ExtensionInterface'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Environment'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/GlobalsInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/GlobalsInterface.php deleted file mode 100644 index 4421271..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/GlobalsInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ -interface GlobalsInterface -{ - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals(); -} - -class_alias('Twig\Extension\GlobalsInterface', 'Twig_Extension_GlobalsInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/InitRuntimeInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/InitRuntimeInterface.php deleted file mode 100644 index d64d3cd..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/InitRuntimeInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * @deprecated since Twig 2.7, to be removed in 3.0 - */ -interface InitRuntimeInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - */ - public function initRuntime(Environment $environment); -} - -class_alias('Twig\Extension\InitRuntimeInterface', 'Twig_Extension_InitRuntimeInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/OptimizerExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/OptimizerExtension.php deleted file mode 100644 index 9552b35..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/OptimizerExtension.php +++ /dev/null @@ -1,31 +0,0 @@ -optimizers = $optimizers; - } - - public function getNodeVisitors() - { - return [new OptimizerNodeVisitor($this->optimizers)]; - } -} - -class_alias('Twig\Extension\OptimizerExtension', 'Twig_Extension_Optimizer'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ProfilerExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ProfilerExtension.php deleted file mode 100644 index ca5367c..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/ProfilerExtension.php +++ /dev/null @@ -1,48 +0,0 @@ -actives[] = $profile; - } - - public function enter(Profile $profile) - { - $this->actives[0]->addProfile($profile); - array_unshift($this->actives, $profile); - } - - public function leave(Profile $profile) - { - $profile->leave(); - array_shift($this->actives); - - if (1 === \count($this->actives)) { - $this->actives[0]->leave(); - } - } - - public function getNodeVisitors() - { - return [new ProfilerNodeVisitor(\get_class($this))]; - } -} - -class_alias('Twig\Extension\ProfilerExtension', 'Twig_Extension_Profiler'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/RuntimeExtensionInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/RuntimeExtensionInterface.php deleted file mode 100644 index 63bc3b1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/RuntimeExtensionInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -interface RuntimeExtensionInterface -{ -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/SandboxExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/SandboxExtension.php deleted file mode 100644 index d16e4ed..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/SandboxExtension.php +++ /dev/null @@ -1,125 +0,0 @@ -policy = $policy; - $this->sandboxedGlobally = $sandboxed; - } - - public function getTokenParsers() - { - return [new SandboxTokenParser()]; - } - - public function getNodeVisitors() - { - return [new SandboxNodeVisitor()]; - } - - public function enableSandbox() - { - $this->sandboxed = true; - } - - public function disableSandbox() - { - $this->sandboxed = false; - } - - public function isSandboxed() - { - return $this->sandboxedGlobally || $this->sandboxed; - } - - public function isSandboxedGlobally() - { - return $this->sandboxedGlobally; - } - - public function setSecurityPolicy(SecurityPolicyInterface $policy) - { - $this->policy = $policy; - } - - public function getSecurityPolicy() - { - return $this->policy; - } - - public function checkSecurity($tags, $filters, $functions) - { - if ($this->isSandboxed()) { - $this->policy->checkSecurity($tags, $filters, $functions); - } - } - - public function checkMethodAllowed($obj, $method, int $lineno = -1, Source $source = null) - { - if ($this->isSandboxed()) { - try { - $this->policy->checkMethodAllowed($obj, $method); - } catch (SecurityNotAllowedMethodError $e) { - $e->setSourceContext($source); - $e->setTemplateLine($lineno); - - throw $e; - } - } - } - - public function checkPropertyAllowed($obj, $method, int $lineno = -1, Source $source = null) - { - if ($this->isSandboxed()) { - try { - $this->policy->checkPropertyAllowed($obj, $method); - } catch (SecurityNotAllowedPropertyError $e) { - $e->setSourceContext($source); - $e->setTemplateLine($lineno); - - throw $e; - } - } - } - - public function ensureToStringAllowed($obj, int $lineno = -1, Source $source = null) - { - if ($this->isSandboxed() && \is_object($obj) && method_exists($obj, '__toString')) { - try { - $this->policy->checkMethodAllowed($obj, '__toString'); - } catch (SecurityNotAllowedMethodError $e) { - $e->setSourceContext($source); - $e->setTemplateLine($lineno); - - throw $e; - } - } - - return $obj; - } -} - -class_alias('Twig\Extension\SandboxExtension', 'Twig_Extension_Sandbox'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StagingExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StagingExtension.php deleted file mode 100644 index 7c0c26c..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StagingExtension.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * @internal - */ -final class StagingExtension extends AbstractExtension -{ - private $functions = []; - private $filters = []; - private $visitors = []; - private $tokenParsers = []; - private $tests = []; - - public function addFunction(TwigFunction $function) - { - if (isset($this->functions[$function->getName()])) { - throw new \LogicException(sprintf('Function "%s" is already registered.', $function->getName())); - } - - $this->functions[$function->getName()] = $function; - } - - public function getFunctions() - { - return $this->functions; - } - - public function addFilter(TwigFilter $filter) - { - if (isset($this->filters[$filter->getName()])) { - throw new \LogicException(sprintf('Filter "%s" is already registered.', $filter->getName())); - } - - $this->filters[$filter->getName()] = $filter; - } - - public function getFilters() - { - return $this->filters; - } - - public function addNodeVisitor(NodeVisitorInterface $visitor) - { - $this->visitors[] = $visitor; - } - - public function getNodeVisitors() - { - return $this->visitors; - } - - public function addTokenParser(TokenParserInterface $parser) - { - if (isset($this->tokenParsers[$parser->getTag()])) { - throw new \LogicException(sprintf('Tag "%s" is already registered.', $parser->getTag())); - } - - $this->tokenParsers[$parser->getTag()] = $parser; - } - - public function getTokenParsers() - { - return $this->tokenParsers; - } - - public function addTest(TwigTest $test) - { - if (isset($this->tests[$test->getName()])) { - throw new \LogicException(sprintf('Test "%s" is already registered.', $test->getName())); - } - - $this->tests[$test->getName()] = $test; - } - - public function getTests() - { - return $this->tests; - } -} - -class_alias('Twig\Extension\StagingExtension', 'Twig_Extension_Staging'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StringLoaderExtension.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StringLoaderExtension.php deleted file mode 100644 index d671862..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Extension/StringLoaderExtension.php +++ /dev/null @@ -1,46 +0,0 @@ - true]), - ]; - } -} - -class_alias('Twig\Extension\StringLoaderExtension', 'Twig_Extension_StringLoader'); -} - -namespace { -use Twig\Environment; -use Twig\TemplateWrapper; - -/** - * Loads a template from a string. - * - * {{ include(template_from_string("Hello {{ name }}")) }} - * - * @param string $template A template as a string or object implementing __toString() - * @param string $name An optional name of the template to be used in error messages - * - * @return TemplateWrapper - */ -function twig_template_from_string(Environment $env, $template, string $name = null) -{ - return $env->createTemplate((string) $template, $name); -} -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/ExtensionSet.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/ExtensionSet.php deleted file mode 100644 index dc25b13..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/ExtensionSet.php +++ /dev/null @@ -1,477 +0,0 @@ - - * - * @internal - */ -final class ExtensionSet -{ - private $extensions; - private $initialized = false; - private $runtimeInitialized = false; - private $staging; - private $parsers; - private $visitors; - private $filters; - private $tests; - private $functions; - private $unaryOperators; - private $binaryOperators; - private $globals; - private $functionCallbacks = []; - private $filterCallbacks = []; - private $lastModified = 0; - - public function __construct() - { - $this->staging = new StagingExtension(); - } - - /** - * Initializes the runtime environment. - * - * @deprecated since Twig 2.7 - */ - public function initRuntime(Environment $env) - { - if ($this->runtimeInitialized) { - return; - } - - $this->runtimeInitialized = true; - - foreach ($this->extensions as $extension) { - if ($extension instanceof InitRuntimeInterface) { - $extension->initRuntime($env); - } - } - } - - public function hasExtension(string $class): bool - { - $class = ltrim($class, '\\'); - if (!isset($this->extensions[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = (new \ReflectionClass($class))->name; - } - - return isset($this->extensions[$class]); - } - - public function getExtension(string $class): ExtensionInterface - { - $class = ltrim($class, '\\'); - if (!isset($this->extensions[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = (new \ReflectionClass($class))->name; - } - - if (!isset($this->extensions[$class])) { - throw new RuntimeError(sprintf('The "%s" extension is not enabled.', $class)); - } - - return $this->extensions[$class]; - } - - /** - * @param ExtensionInterface[] $extensions - */ - public function setExtensions(array $extensions) - { - foreach ($extensions as $extension) { - $this->addExtension($extension); - } - } - - /** - * @return ExtensionInterface[] - */ - public function getExtensions(): array - { - return $this->extensions; - } - - public function getSignature(): string - { - return json_encode(array_keys($this->extensions)); - } - - public function isInitialized(): bool - { - return $this->initialized || $this->runtimeInitialized; - } - - public function getLastModified(): int - { - if (0 !== $this->lastModified) { - return $this->lastModified; - } - - foreach ($this->extensions as $extension) { - $r = new \ReflectionObject($extension); - if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) { - $this->lastModified = $extensionTime; - } - } - - return $this->lastModified; - } - - public function addExtension(ExtensionInterface $extension) - { - $class = \get_class($extension); - - if ($this->initialized) { - throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class)); - } - - if (isset($this->extensions[$class])) { - throw new \LogicException(sprintf('Unable to register extension "%s" as it is already registered.', $class)); - } - - // For BC/FC with namespaced aliases - $class = (new \ReflectionClass($class))->name; - $this->extensions[$class] = $extension; - } - - public function addFunction(TwigFunction $function) - { - if ($this->initialized) { - throw new \LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $function->getName())); - } - - $this->staging->addFunction($function); - } - - /** - * @return TwigFunction[] - */ - public function getFunctions(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->functions; - } - - /** - * @return TwigFunction|false - */ - public function getFunction(string $name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->functions[$name])) { - return $this->functions[$name]; - } - - foreach ($this->functions as $pattern => $function) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $function->setArguments($matches); - - return $function; - } - } - - foreach ($this->functionCallbacks as $callback) { - if (false !== $function = $callback($name)) { - return $function; - } - } - - return false; - } - - public function registerUndefinedFunctionCallback(callable $callable) - { - $this->functionCallbacks[] = $callable; - } - - public function addFilter(TwigFilter $filter) - { - if ($this->initialized) { - throw new \LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $filter->getName())); - } - - $this->staging->addFilter($filter); - } - - /** - * @return TwigFilter[] - */ - public function getFilters(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->filters; - } - - /** - * @return TwigFilter|false - */ - public function getFilter(string $name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->filters[$name])) { - return $this->filters[$name]; - } - - foreach ($this->filters as $pattern => $filter) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $filter->setArguments($matches); - - return $filter; - } - } - - foreach ($this->filterCallbacks as $callback) { - if (false !== $filter = $callback($name)) { - return $filter; - } - } - - return false; - } - - public function registerUndefinedFilterCallback(callable $callable) - { - $this->filterCallbacks[] = $callable; - } - - public function addNodeVisitor(NodeVisitorInterface $visitor) - { - if ($this->initialized) { - throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); - } - - $this->staging->addNodeVisitor($visitor); - } - - /** - * @return NodeVisitorInterface[] - */ - public function getNodeVisitors(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->visitors; - } - - public function addTokenParser(TokenParserInterface $parser) - { - if ($this->initialized) { - throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); - } - - $this->staging->addTokenParser($parser); - } - - /** - * @return TokenParserInterface[] - */ - public function getTokenParsers(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->parsers; - } - - public function getGlobals(): array - { - if (null !== $this->globals) { - return $this->globals; - } - - $globals = []; - foreach ($this->extensions as $extension) { - if (!$extension instanceof GlobalsInterface) { - continue; - } - - $extGlobals = $extension->getGlobals(); - if (!\is_array($extGlobals)) { - throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); - } - - $globals = array_merge($globals, $extGlobals); - } - - if ($this->initialized) { - $this->globals = $globals; - } - - return $globals; - } - - public function addTest(TwigTest $test) - { - if ($this->initialized) { - throw new \LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $test->getName())); - } - - $this->staging->addTest($test); - } - - /** - * @return TwigTest[] - */ - public function getTests(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->tests; - } - - /** - * @return TwigTest|false - */ - public function getTest(string $name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->tests[$name])) { - return $this->tests[$name]; - } - - foreach ($this->tests as $pattern => $test) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $test->setArguments($matches); - - return $test; - } - } - } - - return false; - } - - public function getUnaryOperators(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - public function getBinaryOperators(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->binaryOperators; - } - - private function initExtensions() - { - $this->parsers = []; - $this->filters = []; - $this->functions = []; - $this->tests = []; - $this->visitors = []; - $this->unaryOperators = []; - $this->binaryOperators = []; - - foreach ($this->extensions as $extension) { - $this->initExtension($extension); - } - $this->initExtension($this->staging); - // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception - $this->initialized = true; - } - - private function initExtension(ExtensionInterface $extension) - { - // filters - foreach ($extension->getFilters() as $filter) { - $this->filters[$filter->getName()] = $filter; - } - - // functions - foreach ($extension->getFunctions() as $function) { - $this->functions[$function->getName()] = $function; - } - - // tests - foreach ($extension->getTests() as $test) { - $this->tests[$test->getName()] = $test; - } - - // token parsers - foreach ($extension->getTokenParsers() as $parser) { - if (!$parser instanceof TokenParserInterface) { - throw new \LogicException('getTokenParsers() must return an array of \Twig\TokenParser\TokenParserInterface.'); - } - - $this->parsers[] = $parser; - } - - // node visitors - foreach ($extension->getNodeVisitors() as $visitor) { - $this->visitors[] = $visitor; - } - - // operators - if ($operators = $extension->getOperators()) { - if (!\is_array($operators)) { - throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators))); - } - - if (2 !== \count($operators)) { - throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); - } - - $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); - $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); - } - } -} - -class_alias('Twig\ExtensionSet', 'Twig_ExtensionSet'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/FileExtensionEscapingStrategy.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/FileExtensionEscapingStrategy.php deleted file mode 100644 index bc95f33..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/FileExtensionEscapingStrategy.php +++ /dev/null @@ -1,62 +0,0 @@ - - */ -class FileExtensionEscapingStrategy -{ - /** - * Guesses the best autoescaping strategy based on the file name. - * - * @param string $name The template name - * - * @return string|false The escaping strategy name to use or false to disable - */ - public static function guess($name) - { - if (\in_array(substr($name, -1), ['/', '\\'])) { - return 'html'; // return html for directories - } - - if ('.twig' === substr($name, -5)) { - $name = substr($name, 0, -5); - } - - $extension = pathinfo($name, PATHINFO_EXTENSION); - - switch ($extension) { - case 'js': - return 'js'; - - case 'css': - return 'css'; - - case 'txt': - return false; - - default: - return 'html'; - } - } -} - -class_alias('Twig\FileExtensionEscapingStrategy', 'Twig_FileExtensionEscapingStrategy'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Lexer.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Lexer.php deleted file mode 100644 index 45c7290..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Lexer.php +++ /dev/null @@ -1,501 +0,0 @@ - - */ -class Lexer -{ - private $tokens; - private $code; - private $cursor; - private $lineno; - private $end; - private $state; - private $states; - private $brackets; - private $env; - private $source; - private $options; - private $regexes; - private $position; - private $positions; - private $currentVarBlockLine; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - const STATE_STRING = 3; - const STATE_INTERPOLATION = 4; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A'; - const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const REGEX_DQ_STRING_DELIM = '/"/A'; - const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; - const PUNCTUATION = '()[]{}?:.,|'; - - public function __construct(Environment $env, array $options = []) - { - $this->env = $env; - - $this->options = array_merge([ - 'tag_comment' => ['{#', '#}'], - 'tag_block' => ['{%', '%}'], - 'tag_variable' => ['{{', '}}'], - 'whitespace_trim' => '-', - 'whitespace_line_trim' => '~', - 'whitespace_line_chars' => ' \t\0\x0B', - 'interpolation' => ['#{', '}'], - ], $options); - - // when PHP 7.3 is the min version, we will be able to remove the '#' part in preg_quote as it's part of the default - $this->regexes = [ - // }} - 'lex_var' => '{ - \s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '#').'\s*'. // -}}\s* - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_variable'][1], '#'). // }} - ') - }Ax', - - // %} - 'lex_block' => '{ - \s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*\n?'. // -%}\s*\n? - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#').'\n?'. // %}\n? - ') - }Ax', - - // {% endverbatim %} - 'lex_raw_data' => '{'. - preg_quote($this->options['tag_block'][0], '#'). // {% - '('. - $this->options['whitespace_trim']. // - - '|'. - $this->options['whitespace_line_trim']. // ~ - ')?\s*endverbatim\s*'. - '(?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%} - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#'). // %} - ') - }sx', - - 'operator' => $this->getOperatorRegex(), - - // #} - 'lex_comment' => '{ - (?:'. - preg_quote($this->options['whitespace_trim']).preg_quote($this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n? - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_comment'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~#}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_comment'][1], '#').'\n?'. // #}\n? - ') - }sx', - - // verbatim %} - 'lex_block_raw' => '{ - \s*verbatim\s* - (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%}\s* - '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* - '|'. - preg_quote($this->options['tag_block'][1], '#'). // %} - ') - }Asx', - - 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '#').'}As', - - // {{ or {% or {# - 'lex_tokens_start' => '{ - ('. - preg_quote($this->options['tag_variable'][0], '#'). // {{ - '|'. - preg_quote($this->options['tag_block'][0], '#'). // {% - '|'. - preg_quote($this->options['tag_comment'][0], '#'). // {# - ')('. - preg_quote($this->options['whitespace_trim'], '#'). // - - '|'. - preg_quote($this->options['whitespace_line_trim'], '#'). // ~ - ')? - }sx', - 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0], '#').'\s*}A', - 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1], '#').'}A', - ]; - } - - public function tokenize(Source $source) - { - $this->source = $source; - $this->code = str_replace(["\r\n", "\r"], "\n", $source->getCode()); - $this->cursor = 0; - $this->lineno = 1; - $this->end = \strlen($this->code); - $this->tokens = []; - $this->state = self::STATE_DATA; - $this->states = []; - $this->brackets = []; - $this->position = -1; - - // find all token starts in one go - preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); - $this->positions = $matches; - - while ($this->cursor < $this->end) { - // dispatch to the lexing functions depending - // on the current state - switch ($this->state) { - case self::STATE_DATA: - $this->lexData(); - break; - - case self::STATE_BLOCK: - $this->lexBlock(); - break; - - case self::STATE_VAR: - $this->lexVar(); - break; - - case self::STATE_STRING: - $this->lexString(); - break; - - case self::STATE_INTERPOLATION: - $this->lexInterpolation(); - break; - } - } - - $this->pushToken(/* Token::EOF_TYPE */ -1); - - if (!empty($this->brackets)) { - list($expect, $lineno) = array_pop($this->brackets); - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - return new TokenStream($this->tokens, $this->source); - } - - private function lexData() - { - // if no matches are left we return the rest of the template as simple text token - if ($this->position == \count($this->positions[0]) - 1) { - $this->pushToken(/* Token::TEXT_TYPE */ 0, substr($this->code, $this->cursor)); - $this->cursor = $this->end; - - return; - } - - // Find the first token after the current cursor - $position = $this->positions[0][++$this->position]; - while ($position[1] < $this->cursor) { - if ($this->position == \count($this->positions[0]) - 1) { - return; - } - $position = $this->positions[0][++$this->position]; - } - - // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); - - // trim? - if (isset($this->positions[2][$this->position][0])) { - if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { - // whitespace_trim detected ({%-, {{- or {#-) - $text = rtrim($text); - } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { - // whitespace_line_trim detected ({%~, {{~ or {#~) - // don't trim \r and \n - $text = rtrim($text, " \t\0\x0B"); - } - } - $this->pushToken(/* Token::TEXT_TYPE */ 0, $text); - $this->moveCursor($textContent.$position[0]); - - switch ($this->positions[1][$this->position][0]) { - case $this->options['tag_comment'][0]: - $this->lexComment(); - break; - - case $this->options['tag_block'][0]: - // raw data? - if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lexRawData(); - // {% line \d+ %} - } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lineno = (int) $match[1]; - } else { - $this->pushToken(/* Token::BLOCK_START_TYPE */ 1); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(/* Token::VAR_START_TYPE */ 2); - $this->pushState(self::STATE_VAR); - $this->currentVarBlockLine = $this->lineno; - break; - } - } - - private function lexBlock() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(/* Token::BLOCK_END_TYPE */ 3); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function lexVar() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(/* Token::VAR_END_TYPE */ 4); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function lexExpression() - { - // whitespace - if (preg_match('/\s+/A', $this->code, $match, 0, $this->cursor)) { - $this->moveCursor($match[0]); - - if ($this->cursor >= $this->end) { - throw new SyntaxError(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); - } - } - - // arrow function - if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { - $this->pushToken(Token::ARROW_TYPE, '=>'); - $this->moveCursor('=>'); - } - // operators - elseif (preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) { - $this->pushToken(/* Token::OPERATOR_TYPE */ 8, preg_replace('/\s+/', ' ', $match[0])); - $this->moveCursor($match[0]); - } - // names - elseif (preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) { - $this->pushToken(/* Token::NAME_TYPE */ 5, $match[0]); - $this->moveCursor($match[0]); - } - // numbers - elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) { - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $this->pushToken(/* Token::NUMBER_TYPE */ 6, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (false !== strpos('([{', $this->code[$this->cursor])) { - $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; - } - // closing bracket - elseif (false !== strpos(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - } - - $this->pushToken(/* Token::PUNCTUATION_TYPE */ 9, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { - $this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes(substr($match[0], 1, -1))); - $this->moveCursor($match[0]); - } - // opening double quoted string - elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { - $this->brackets[] = ['"', $this->lineno]; - $this->pushState(self::STATE_STRING); - $this->moveCursor($match[0]); - } - // unlexable - else { - throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - private function lexRawData() - { - if (!preg_match($this->regexes['lex_raw_data'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new SyntaxError('Unexpected end of file: Unclosed "verbatim" block.', $this->lineno, $this->source); - } - - $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->moveCursor($text.$match[0][0]); - - // trim? - if (isset($match[1][0])) { - if ($this->options['whitespace_trim'] === $match[1][0]) { - // whitespace_trim detected ({%-, {{- or {#-) - $text = rtrim($text); - } else { - // whitespace_line_trim detected ({%~, {{~ or {#~) - // don't trim \r and \n - $text = rtrim($text, " \t\0\x0B"); - } - } - - $this->pushToken(/* Token::TEXT_TYPE */ 0, $text); - } - - private function lexComment() - { - if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new SyntaxError('Unclosed comment.', $this->lineno, $this->source); - } - - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); - } - - private function lexString() - { - if (preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) { - $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; - $this->pushToken(/* Token::INTERPOLATION_START_TYPE */ 10); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) { - $this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes($match[0])); - $this->moveCursor($match[0]); - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { - list($expect, $lineno) = array_pop($this->brackets); - if ('"' != $this->code[$this->cursor]) { - throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - $this->popState(); - ++$this->cursor; - } else { - // unlexable - throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - private function lexInterpolation() - { - $bracket = end($this->brackets); - if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) { - array_pop($this->brackets); - $this->pushToken(/* Token::INTERPOLATION_END_TYPE */ 11); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function pushToken($type, $value = '') - { - // do not push empty text tokens - if (/* Token::TEXT_TYPE */ 0 === $type && '' === $value) { - return; - } - - $this->tokens[] = new Token($type, $value, $this->lineno); - } - - private function moveCursor($text) - { - $this->cursor += \strlen($text); - $this->lineno += substr_count($text, "\n"); - } - - private function getOperatorRegex() - { - $operators = array_merge( - ['='], - array_keys($this->env->getUnaryOperators()), - array_keys($this->env->getBinaryOperators()) - ); - - $operators = array_combine($operators, array_map('strlen', $operators)); - arsort($operators); - - $regex = []; - foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - if (ctype_alpha($operator[$length - 1])) { - $r = preg_quote($operator, '/').'(?=[\s()])'; - } else { - $r = preg_quote($operator, '/'); - } - - // an operator with a space can be any amount of whitespaces - $r = preg_replace('/\s+/', '\s+', $r); - - $regex[] = $r; - } - - return '/'.implode('|', $regex).'/A'; - } - - private function pushState($state) - { - $this->states[] = $this->state; - $this->state = $state; - } - - private function popState() - { - if (0 === \count($this->states)) { - throw new \LogicException('Cannot pop state without a previous state.'); - } - - $this->state = array_pop($this->states); - } -} - -class_alias('Twig\Lexer', 'Twig_Lexer'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ArrayLoader.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ArrayLoader.php deleted file mode 100644 index b03170b..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ArrayLoader.php +++ /dev/null @@ -1,86 +0,0 @@ - - */ -final class ArrayLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface -{ - private $templates = []; - - /** - * @param array $templates An array of templates (keys are the names, and values are the source code) - */ - public function __construct(array $templates = []) - { - $this->templates = $templates; - } - - /** - * Adds or overrides a template. - * - * @param string $name The template name - * @param string $template The template source - */ - public function setTemplate($name, $template) - { - $this->templates[$name] = $template; - } - - public function getSourceContext($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); - } - - return new Source($this->templates[$name], $name); - } - - public function exists($name) - { - return isset($this->templates[$name]); - } - - public function getCacheKey($name) - { - if (!isset($this->templates[$name])) { - throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); - } - - return $name.':'.$this->templates[$name]; - } - - public function isFresh($name, $time) - { - if (!isset($this->templates[$name])) { - throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); - } - - return true; - } -} - -class_alias('Twig\Loader\ArrayLoader', 'Twig_Loader_Array'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ChainLoader.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ChainLoader.php deleted file mode 100644 index edb9df8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ChainLoader.php +++ /dev/null @@ -1,120 +0,0 @@ - - */ -final class ChainLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface -{ - private $hasSourceCache = []; - private $loaders = []; - - /** - * @param LoaderInterface[] $loaders - */ - public function __construct(array $loaders = []) - { - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - public function addLoader(LoaderInterface $loader) - { - $this->loaders[] = $loader; - $this->hasSourceCache = []; - } - - /** - * @return LoaderInterface[] - */ - public function getLoaders() - { - return $this->loaders; - } - - public function getSourceContext($name) - { - $exceptions = []; - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->getSourceContext($name); - } catch (LoaderError $e) { - $exceptions[] = $e->getMessage(); - } - } - - throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function exists($name) - { - if (isset($this->hasSourceCache[$name])) { - return $this->hasSourceCache[$name]; - } - - foreach ($this->loaders as $loader) { - if ($loader->exists($name)) { - return $this->hasSourceCache[$name] = true; - } - } - - return $this->hasSourceCache[$name] = false; - } - - public function getCacheKey($name) - { - $exceptions = []; - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->getCacheKey($name); - } catch (LoaderError $e) { - $exceptions[] = \get_class($loader).': '.$e->getMessage(); - } - } - - throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function isFresh($name, $time) - { - $exceptions = []; - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->isFresh($name, $time); - } catch (LoaderError $e) { - $exceptions[] = \get_class($loader).': '.$e->getMessage(); - } - } - - throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } -} - -class_alias('Twig\Loader\ChainLoader', 'Twig_Loader_Chain'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ExistsLoaderInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ExistsLoaderInterface.php deleted file mode 100644 index aab8bd8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/ExistsLoaderInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - */ -class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface -{ - /** Identifier of the main namespace. */ - const MAIN_NAMESPACE = '__main__'; - - protected $paths = []; - protected $cache = []; - protected $errorCache = []; - - private $rootPath; - - /** - * @param string|array $paths A path or an array of paths where to look for templates - * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) - */ - public function __construct($paths = [], string $rootPath = null) - { - $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR; - if (false !== $realPath = realpath($rootPath)) { - $this->rootPath = $realPath.\DIRECTORY_SEPARATOR; - } - - if ($paths) { - $this->setPaths($paths); - } - } - - /** - * Returns the paths to the templates. - * - * @param string $namespace A path namespace - * - * @return array The array of paths where to look for templates - */ - public function getPaths($namespace = self::MAIN_NAMESPACE) - { - return isset($this->paths[$namespace]) ? $this->paths[$namespace] : []; - } - - /** - * Returns the path namespaces. - * - * The main namespace is always defined. - * - * @return array The array of defined namespaces - */ - public function getNamespaces() - { - return array_keys($this->paths); - } - - /** - * Sets the paths where templates are stored. - * - * @param string|array $paths A path or an array of paths where to look for templates - * @param string $namespace A path namespace - */ - public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) - { - if (!\is_array($paths)) { - $paths = [$paths]; - } - - $this->paths[$namespace] = []; - foreach ($paths as $path) { - $this->addPath($path, $namespace); - } - } - - /** - * Adds a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws LoaderError - */ - public function addPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = []; - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $this->paths[$namespace][] = rtrim($path, '/\\'); - } - - /** - * Prepends a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws LoaderError - */ - public function prependPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = []; - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $path = rtrim($path, '/\\'); - - if (!isset($this->paths[$namespace])) { - $this->paths[$namespace][] = $path; - } else { - array_unshift($this->paths[$namespace], $path); - } - } - - public function getSourceContext($name) - { - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return new Source('', $name, ''); - } - - return new Source(file_get_contents($path), $name, $path); - } - - public function getCacheKey($name) - { - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return ''; - } - $len = \strlen($this->rootPath); - if (0 === strncmp($this->rootPath, $path, $len)) { - return substr($path, $len); - } - - return $path; - } - - public function exists($name) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return true; - } - - return null !== ($path = $this->findTemplate($name, false)) && false !== $path; - } - - public function isFresh($name, $time) - { - // false support to be removed in 3.0 - if (null === ($path = $this->findTemplate($name)) || false === $path) { - return false; - } - - return filemtime($path) < $time; - } - - /** - * Checks if the template can be found. - * - * In Twig 3.0, findTemplate must return a string or null (returning false won't work anymore). - * - * @param string $name The template name - * @param bool $throw Whether to throw an exception when an error occurs - * - * @return string|false|null The template name or false/null - */ - protected function findTemplate($name, $throw = true) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - - if (isset($this->errorCache[$name])) { - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - try { - $this->validateName($name); - - list($namespace, $shortname) = $this->parseName($name); - } catch (LoaderError $e) { - if (!$throw) { - return false; - } - - throw $e; - } - - if (!isset($this->paths[$namespace])) { - $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); - - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - foreach ($this->paths[$namespace] as $path) { - if (!$this->isAbsolutePath($path)) { - $path = $this->rootPath.$path; - } - - if (is_file($path.'/'.$shortname)) { - if (false !== $realpath = realpath($path.'/'.$shortname)) { - return $this->cache[$name] = $realpath; - } - - return $this->cache[$name] = $path.'/'.$shortname; - } - } - - $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); - - if (!$throw) { - return false; - } - - throw new LoaderError($this->errorCache[$name]); - } - - private function normalizeName($name) - { - return preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name)); - } - - private function parseName($name, $default = self::MAIN_NAMESPACE) - { - if (isset($name[0]) && '@' == $name[0]) { - if (false === $pos = strpos($name, '/')) { - throw new LoaderError(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); - } - - $namespace = substr($name, 1, $pos - 1); - $shortname = substr($name, $pos + 1); - - return [$namespace, $shortname]; - } - - return [$default, $name]; - } - - private function validateName($name) - { - if (false !== strpos($name, "\0")) { - throw new LoaderError('A template name cannot contain NUL bytes.'); - } - - $name = ltrim($name, '/'); - $parts = explode('/', $name); - $level = 0; - foreach ($parts as $part) { - if ('..' === $part) { - --$level; - } elseif ('.' !== $part) { - ++$level; - } - - if ($level < 0) { - throw new LoaderError(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); - } - } - } - - private function isAbsolutePath($file) - { - return strspn($file, '/\\', 0, 1) - || (\strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === $file[1] - && strspn($file, '/\\', 2, 1) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ; - } -} - -class_alias('Twig\Loader\FilesystemLoader', 'Twig_Loader_Filesystem'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/LoaderInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/LoaderInterface.php deleted file mode 100644 index 5ccd2c7..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/LoaderInterface.php +++ /dev/null @@ -1,69 +0,0 @@ - - */ -interface LoaderInterface -{ - /** - * Returns the source context for a given template logical name. - * - * @param string $name The template logical name - * - * @return Source - * - * @throws LoaderError When $name is not found - */ - public function getSourceContext($name); - - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key - * - * @throws LoaderError When $name is not found - */ - public function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param int $time Timestamp of the last modification time of the - * cached template - * - * @return bool true if the template is fresh, false otherwise - * - * @throws LoaderError When $name is not found - */ - public function isFresh($name, $time); - - /** - * Check if we have the source code of a template, given its name. - * - * @param string $name The name of the template to check if we can load - * - * @return bool If the template source code is handled by this loader or not - */ - public function exists($name); -} - -class_alias('Twig\Loader\LoaderInterface', 'Twig_LoaderInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/SourceContextLoaderInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/SourceContextLoaderInterface.php deleted file mode 100644 index 4fdb17e..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Loader/SourceContextLoaderInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -class Markup implements \Countable, \JsonSerializable -{ - private $content; - private $charset; - - public function __construct($content, $charset) - { - $this->content = (string) $content; - $this->charset = $charset; - } - - public function __toString() - { - return $this->content; - } - - public function count() - { - return mb_strlen($this->content, $this->charset); - } - - public function jsonSerialize() - { - return $this->content; - } -} - -class_alias('Twig\Markup', 'Twig_Markup'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/AutoEscapeNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/AutoEscapeNode.php deleted file mode 100644 index 0bd5ae1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/AutoEscapeNode.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class AutoEscapeNode extends Node -{ - public function __construct($value, Node $body, int $lineno, string $tag = 'autoescape') - { - parent::__construct(['body' => $body], ['value' => $value], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->subcompile($this->getNode('body')); - } -} - -class_alias('Twig\Node\AutoEscapeNode', 'Twig_Node_AutoEscape'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockNode.php deleted file mode 100644 index 4da6e6f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockNode.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ -class BlockNode extends Node -{ - public function __construct(string $name, Node $body, int $lineno, string $tag = null) - { - parent::__construct(['body' => $body], ['name' => $name], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("public function block_%s(\$context, array \$blocks = [])\n", $this->getAttribute('name')), "{\n") - ->indent() - ->write("\$macros = \$this->macros;\n") - ; - - $compiler - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig\Node\BlockNode', 'Twig_Node_Block'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockReferenceNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockReferenceNode.php deleted file mode 100644 index c46d8b3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BlockReferenceNode.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class BlockReferenceNode extends Node implements NodeOutputInterface -{ - public function __construct(string $name, int $lineno, string $tag = null) - { - parent::__construct([], ['name' => $name], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) - ; - } -} - -class_alias('Twig\Node\BlockReferenceNode', 'Twig_Node_BlockReference'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BodyNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BodyNode.php deleted file mode 100644 index 5290be5..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/BodyNode.php +++ /dev/null @@ -1,23 +0,0 @@ - - */ -class BodyNode extends Node -{ -} - -class_alias('Twig\Node\BodyNode', 'Twig_Node_Body'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckSecurityNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckSecurityNode.php deleted file mode 100644 index 59857ca..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckSecurityNode.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ -class CheckSecurityNode extends Node -{ - private $usedFilters; - private $usedTags; - private $usedFunctions; - - public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) - { - $this->usedFilters = $usedFilters; - $this->usedTags = $usedTags; - $this->usedFunctions = $usedFunctions; - - parent::__construct(); - } - - public function compile(Compiler $compiler) - { - $tags = $filters = $functions = []; - foreach (['tags', 'filters', 'functions'] as $type) { - foreach ($this->{'used'.ucfirst($type)} as $name => $node) { - if ($node instanceof Node) { - ${$type}[$name] = $node->getTemplateLine(); - } else { - ${$type}[$node] = null; - } - } - } - - $compiler - ->write("\$this->sandbox = \$this->env->getExtension('\Twig\Extension\SandboxExtension');\n") - ->write('$tags = ')->repr(array_filter($tags))->raw(";\n") - ->write('$filters = ')->repr(array_filter($filters))->raw(";\n") - ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n") - ->write("try {\n") - ->indent() - ->write("\$this->sandbox->checkSecurity(\n") - ->indent() - ->write(!$tags ? "[],\n" : "['".implode("', '", array_keys($tags))."'],\n") - ->write(!$filters ? "[],\n" : "['".implode("', '", array_keys($filters))."'],\n") - ->write(!$functions ? "[]\n" : "['".implode("', '", array_keys($functions))."']\n") - ->outdent() - ->write(");\n") - ->outdent() - ->write("} catch (SecurityError \$e) {\n") - ->indent() - ->write("\$e->setSourceContext(\$this->source);\n\n") - ->write("if (\$e instanceof SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n") - ->outdent() - ->write("}\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig\Node\CheckSecurityNode', 'Twig_Node_CheckSecurity'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckToStringNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckToStringNode.php deleted file mode 100644 index 02b42fc..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/CheckToStringNode.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -class CheckToStringNode extends AbstractExpression -{ - public function __construct(AbstractExpression $expr) - { - parent::__construct(['expr' => $expr], [], $expr->getTemplateLine(), $expr->getNodeTag()); - } - - public function compile(Compiler $compiler) - { - $expr = $this->getNode('expr'); - $compiler - ->raw('$this->sandbox->ensureToStringAllowed(') - ->subcompile($expr) - ->raw(', ') - ->repr($expr->getTemplateLine()) - ->raw(', $this->source)') - ; - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DeprecatedNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DeprecatedNode.php deleted file mode 100644 index accd768..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DeprecatedNode.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -class DeprecatedNode extends Node -{ - public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) - { - parent::__construct(['expr' => $expr], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - $expr = $this->getNode('expr'); - - if ($expr instanceof ConstantExpression) { - $compiler->write('@trigger_error(') - ->subcompile($expr); - } else { - $varName = $compiler->getVarName(); - $compiler->write(sprintf('$%s = ', $varName)) - ->subcompile($expr) - ->raw(";\n") - ->write(sprintf('@trigger_error($%s', $varName)); - } - - $compiler - ->raw('.') - ->string(sprintf(' ("%s" at line %d).', $this->getTemplateName(), $this->getTemplateLine())) - ->raw(", E_USER_DEPRECATED);\n") - ; - } -} - -class_alias('Twig\Node\DeprecatedNode', 'Twig_Node_Deprecated'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DoNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DoNode.php deleted file mode 100644 index d74804c..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/DoNode.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class DoNode extends Node -{ - public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) - { - parent::__construct(['expr' => $expr], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} - -class_alias('Twig\Node\DoNode', 'Twig_Node_Do'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/EmbedNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/EmbedNode.php deleted file mode 100644 index 4a1ef6f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/EmbedNode.php +++ /dev/null @@ -1,50 +0,0 @@ - - */ -class EmbedNode extends IncludeNode -{ - // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) - public function __construct(string $name, int $index, AbstractExpression $variables = null, bool $only = false, bool $ignoreMissing = false, int $lineno, string $tag = null) - { - parent::__construct(new ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); - - $this->setAttribute('name', $name); - $this->setAttribute('index', $index); - } - - protected function addGetTemplate(Compiler $compiler) - { - $compiler - ->write('$this->loadTemplate(') - ->string($this->getAttribute('name')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(', ') - ->string($this->getAttribute('index')) - ->raw(')') - ; - } -} - -class_alias('Twig\Node\EmbedNode', 'Twig_Node_Embed'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AbstractExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AbstractExpression.php deleted file mode 100644 index a352892..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AbstractExpression.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -abstract class AbstractExpression extends Node -{ -} - -class_alias('Twig\Node\Expression\AbstractExpression', 'Twig_Node_Expression'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrayExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrayExpression.php deleted file mode 100644 index 917675d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrayExpression.php +++ /dev/null @@ -1,88 +0,0 @@ -index = -1; - foreach ($this->getKeyValuePairs() as $pair) { - if ($pair['key'] instanceof ConstantExpression && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { - $this->index = $pair['key']->getAttribute('value'); - } - } - } - - public function getKeyValuePairs() - { - $pairs = []; - - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = [ - 'key' => $pair[0], - 'value' => $pair[1], - ]; - } - - return $pairs; - } - - public function hasElement(AbstractExpression $key) - { - foreach ($this->getKeyValuePairs() as $pair) { - // we compare the string representation of the keys - // to avoid comparing the line numbers which are not relevant here. - if ((string) $key === (string) $pair['key']) { - return true; - } - } - - return false; - } - - public function addElement(AbstractExpression $value, AbstractExpression $key = null) - { - if (null === $key) { - $key = new ConstantExpression(++$this->index, $value->getTemplateLine()); - } - - array_push($this->nodes, $key, $value); - } - - public function compile(Compiler $compiler) - { - $compiler->raw('['); - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ->subcompile($pair['value']) - ; - } - $compiler->raw(']'); - } -} - -class_alias('Twig\Node\Expression\ArrayExpression', 'Twig_Node_Expression_Array'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php deleted file mode 100644 index b5b720e..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ArrowFunctionExpression.php +++ /dev/null @@ -1,64 +0,0 @@ - - */ -class ArrowFunctionExpression extends AbstractExpression -{ - public function __construct(AbstractExpression $expr, Node $names, $lineno, $tag = null) - { - parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->raw('function (') - ; - foreach ($this->getNode('names') as $i => $name) { - if ($i) { - $compiler->raw(', '); - } - - $compiler - ->raw('$__') - ->raw($name->getAttribute('name')) - ->raw('__') - ; - } - $compiler - ->raw(') use ($context, $macros) { ') - ; - foreach ($this->getNode('names') as $name) { - $compiler - ->raw('$context["') - ->raw($name->getAttribute('name')) - ->raw('"] = $__') - ->raw($name->getAttribute('name')) - ->raw('__; ') - ; - } - $compiler - ->raw('return ') - ->subcompile($this->getNode('expr')) - ->raw('; }') - ; - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AssignNameExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AssignNameExpression.php deleted file mode 100644 index 62c4ac0..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/AssignNameExpression.php +++ /dev/null @@ -1,29 +0,0 @@ -raw('$context[') - ->string($this->getAttribute('name')) - ->raw(']') - ; - } -} - -class_alias('Twig\Node\Expression\AssignNameExpression', 'Twig_Node_Expression_AssignName'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php deleted file mode 100644 index 67c388a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AbstractBinary.php +++ /dev/null @@ -1,44 +0,0 @@ - $left, 'right' => $right], [], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('left')) - ->raw(' ') - ; - $this->operator($compiler); - $compiler - ->raw(' ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - abstract public function operator(Compiler $compiler); -} - -class_alias('Twig\Node\Expression\Binary\AbstractBinary', 'Twig_Node_Expression_Binary'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AddBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AddBinary.php deleted file mode 100644 index f7719a1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AddBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('+'); - } -} - -class_alias('Twig\Node\Expression\Binary\AddBinary', 'Twig_Node_Expression_Binary_Add'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AndBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AndBinary.php deleted file mode 100644 index 484597d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/AndBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('&&'); - } -} - -class_alias('Twig\Node\Expression\Binary\AndBinary', 'Twig_Node_Expression_Binary_And'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php deleted file mode 100644 index cf28691..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('&'); - } -} - -class_alias('Twig\Node\Expression\Binary\BitwiseAndBinary', 'Twig_Node_Expression_Binary_BitwiseAnd'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php deleted file mode 100644 index 7d5d260..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('|'); - } -} - -class_alias('Twig\Node\Expression\Binary\BitwiseOrBinary', 'Twig_Node_Expression_Binary_BitwiseOr'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php deleted file mode 100644 index 7291987..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('^'); - } -} - -class_alias('Twig\Node\Expression\Binary\BitwiseXorBinary', 'Twig_Node_Expression_Binary_BitwiseXor'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php deleted file mode 100644 index f6e5938..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ConcatBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('.'); - } -} - -class_alias('Twig\Node\Expression\Binary\ConcatBinary', 'Twig_Node_Expression_Binary_Concat'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/DivBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/DivBinary.php deleted file mode 100644 index ebfcc75..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/DivBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('/'); - } -} - -class_alias('Twig\Node\Expression\Binary\DivBinary', 'Twig_Node_Expression_Binary_Div'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php deleted file mode 100644 index 41a0065..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php +++ /dev/null @@ -1,37 +0,0 @@ -getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig\Node\Expression\Binary\EndsWithBinary', 'Twig_Node_Expression_Binary_EndsWith'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EqualBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EqualBinary.php deleted file mode 100644 index 84904c3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/EqualBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('=='); - } -} - -class_alias('Twig\Node\Expression\Binary\EqualBinary', 'Twig_Node_Expression_Binary_Equal'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php deleted file mode 100644 index 4dd5e3d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php +++ /dev/null @@ -1,31 +0,0 @@ -raw('(int) floor('); - parent::compile($compiler); - $compiler->raw(')'); - } - - public function operator(Compiler $compiler) - { - return $compiler->raw('/'); - } -} - -class_alias('Twig\Node\Expression\Binary\FloorDivBinary', 'Twig_Node_Expression_Binary_FloorDiv'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php deleted file mode 100644 index be73001..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('>'); - } -} - -class_alias('Twig\Node\Expression\Binary\GreaterBinary', 'Twig_Node_Expression_Binary_Greater'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php deleted file mode 100644 index 5c2ae72..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('>='); - } -} - -class_alias('Twig\Node\Expression\Binary\GreaterEqualBinary', 'Twig_Node_Expression_Binary_GreaterEqual'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/InBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/InBinary.php deleted file mode 100644 index f00b230..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/InBinary.php +++ /dev/null @@ -1,35 +0,0 @@ -raw('twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw('in'); - } -} - -class_alias('Twig\Node\Expression\Binary\InBinary', 'Twig_Node_Expression_Binary_In'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessBinary.php deleted file mode 100644 index 2b202da..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('<'); - } -} - -class_alias('Twig\Node\Expression\Binary\LessBinary', 'Twig_Node_Expression_Binary_Less'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php deleted file mode 100644 index 4fffafe..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('<='); - } -} - -class_alias('Twig\Node\Expression\Binary\LessEqualBinary', 'Twig_Node_Expression_Binary_LessEqual'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php deleted file mode 100644 index ae810b2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MatchesBinary.php +++ /dev/null @@ -1,35 +0,0 @@ -raw('preg_match(') - ->subcompile($this->getNode('right')) - ->raw(', ') - ->subcompile($this->getNode('left')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig\Node\Expression\Binary\MatchesBinary', 'Twig_Node_Expression_Binary_Matches'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ModBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ModBinary.php deleted file mode 100644 index e6a2b36..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/ModBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('%'); - } -} - -class_alias('Twig\Node\Expression\Binary\ModBinary', 'Twig_Node_Expression_Binary_Mod'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MulBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MulBinary.php deleted file mode 100644 index cd65f5d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/MulBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('*'); - } -} - -class_alias('Twig\Node\Expression\Binary\MulBinary', 'Twig_Node_Expression_Binary_Mul'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php deleted file mode 100644 index df5c6a2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('!='); - } -} - -class_alias('Twig\Node\Expression\Binary\NotEqualBinary', 'Twig_Node_Expression_Binary_NotEqual'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotInBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotInBinary.php deleted file mode 100644 index ed2034e..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/NotInBinary.php +++ /dev/null @@ -1,35 +0,0 @@ -raw('!twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw('not in'); - } -} - -class_alias('Twig\Node\Expression\Binary\NotInBinary', 'Twig_Node_Expression_Binary_NotIn'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/OrBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/OrBinary.php deleted file mode 100644 index 8f9da43..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/OrBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('||'); - } -} - -class_alias('Twig\Node\Expression\Binary\OrBinary', 'Twig_Node_Expression_Binary_Or'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/PowerBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/PowerBinary.php deleted file mode 100644 index 32d0214..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/PowerBinary.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('**'); - } -} - -class_alias('Twig\Node\Expression\Binary\PowerBinary', 'Twig_Node_Expression_Binary_Power'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/RangeBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/RangeBinary.php deleted file mode 100644 index e9c0cdf..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/RangeBinary.php +++ /dev/null @@ -1,35 +0,0 @@ -raw('range(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw('..'); - } -} - -class_alias('Twig\Node\Expression\Binary\RangeBinary', 'Twig_Node_Expression_Binary_Range'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php deleted file mode 100644 index 5245e40..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php +++ /dev/null @@ -1,22 +0,0 @@ -raw('<=>'); - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php deleted file mode 100644 index 1fe59fb..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php +++ /dev/null @@ -1,37 +0,0 @@ -getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) - ; - } - - public function operator(Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig\Node\Expression\Binary\StartsWithBinary', 'Twig_Node_Expression_Binary_StartsWith'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SubBinary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SubBinary.php deleted file mode 100644 index 2546975..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Binary/SubBinary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('-'); - } -} - -class_alias('Twig\Node\Expression\Binary\SubBinary', 'Twig_Node_Expression_Binary_Sub'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/BlockReferenceExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/BlockReferenceExpression.php deleted file mode 100644 index c68989a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/BlockReferenceExpression.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ -class BlockReferenceExpression extends AbstractExpression -{ - public function __construct(Node $name, Node $template = null, int $lineno, string $tag = null) - { - $nodes = ['name' => $name]; - if (null !== $template) { - $nodes['template'] = $template; - } - - parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - if ($this->getAttribute('is_defined_test')) { - $this->compileTemplateCall($compiler, 'hasBlock'); - } else { - if ($this->getAttribute('output')) { - $compiler->addDebugInfo($this); - - $this - ->compileTemplateCall($compiler, 'displayBlock') - ->raw(";\n"); - } else { - $this->compileTemplateCall($compiler, 'renderBlock'); - } - } - } - - private function compileTemplateCall(Compiler $compiler, string $method): Compiler - { - if (!$this->hasNode('template')) { - $compiler->write('$this'); - } else { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('template')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - $compiler->raw(sprintf('->%s', $method)); - - return $this->compileBlockArguments($compiler); - } - - private function compileBlockArguments(Compiler $compiler): Compiler - { - $compiler - ->raw('(') - ->subcompile($this->getNode('name')) - ->raw(', $context'); - - if (!$this->hasNode('template')) { - $compiler->raw(', $blocks'); - } - - return $compiler->raw(')'); - } -} - -class_alias('Twig\Node\Expression\BlockReferenceExpression', 'Twig_Node_Expression_BlockReference'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/CallExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/CallExpression.php deleted file mode 100644 index 4ecd2c1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/CallExpression.php +++ /dev/null @@ -1,313 +0,0 @@ -getAttribute('callable'); - - $closingParenthesis = false; - $isArray = false; - if (\is_string($callable) && false === strpos($callable, '::')) { - $compiler->raw($callable); - } else { - list($r, $callable) = $this->reflectCallable($callable); - if ($r instanceof \ReflectionMethod && \is_string($callable[0])) { - if ($r->isStatic()) { - $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); - } else { - $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); - } - } elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof ExtensionInterface) { - // For BC/FC with namespaced aliases - $class = (new \ReflectionClass(\get_class($callable[0])))->name; - if (!$compiler->getEnvironment()->hasExtension($class)) { - // Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error - $compiler->raw(sprintf('$this->env->getExtension(\'%s\')', $class)); - } else { - $compiler->raw(sprintf('$this->extensions[\'%s\']', ltrim($class, '\\'))); - } - - $compiler->raw(sprintf('->%s', $callable[1])); - } else { - $closingParenthesis = true; - $isArray = true; - $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); - } - } - - $this->compileArguments($compiler, $isArray); - - if ($closingParenthesis) { - $compiler->raw(')'); - } - } - - protected function compileArguments(Compiler $compiler, $isArray = false) - { - $compiler->raw($isArray ? '[' : '('); - - $first = true; - - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - $compiler->raw('$this->env'); - $first = false; - } - - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$context'); - $first = false; - } - - if ($this->hasAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->string($argument); - $first = false; - } - } - - if ($this->hasNode('node')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($this->getNode('node')); - $first = false; - } - - if ($this->hasNode('arguments')) { - $callable = $this->getAttribute('callable'); - $arguments = $this->getArguments($callable, $this->getNode('arguments')); - foreach ($arguments as $node) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($node); - $first = false; - } - } - - $compiler->raw($isArray ? ']' : ')'); - } - - protected function getArguments($callable = null, $arguments) - { - $callType = $this->getAttribute('type'); - $callName = $this->getAttribute('name'); - - $parameters = []; - $named = false; - foreach ($arguments as $name => $node) { - if (!\is_int($name)) { - $named = true; - $name = $this->normalizeName($name); - } elseif ($named) { - throw new SyntaxError(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); - } - - $parameters[$name] = $node; - } - - $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); - if (!$named && !$isVariadic) { - return $parameters; - } - - if (!$callable) { - if ($named) { - $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); - } else { - $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); - } - - throw new \LogicException($message); - } - - list($callableParameters, $isPhpVariadic) = $this->getCallableParameters($callable, $isVariadic); - $arguments = []; - $names = []; - $missingArguments = []; - $optionalArguments = []; - $pos = 0; - foreach ($callableParameters as $callableParameter) { - $names[] = $name = $this->normalizeName($callableParameter->name); - - if (\array_key_exists($name, $parameters)) { - if (\array_key_exists($pos, $parameters)) { - throw new SyntaxError(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); - } - - if (\count($missingArguments)) { - throw new SyntaxError(sprintf( - '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".', - $name, $callType, $callName, implode(', ', $names), \count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments) - ), $this->getTemplateLine(), $this->getSourceContext()); - } - - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$name]; - unset($parameters[$name]); - $optionalArguments = []; - } elseif (\array_key_exists($pos, $parameters)) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$pos]; - unset($parameters[$pos]); - $optionalArguments = []; - ++$pos; - } elseif ($callableParameter->isDefaultValueAvailable()) { - $optionalArguments[] = new ConstantExpression($callableParameter->getDefaultValue(), -1); - } elseif ($callableParameter->isOptional()) { - if (empty($parameters)) { - break; - } else { - $missingArguments[] = $name; - } - } else { - throw new SyntaxError(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); - } - } - - if ($isVariadic) { - $arbitraryArguments = $isPhpVariadic ? new VariadicExpression([], -1) : new ArrayExpression([], -1); - foreach ($parameters as $key => $value) { - if (\is_int($key)) { - $arbitraryArguments->addElement($value); - } else { - $arbitraryArguments->addElement($value, new ConstantExpression($key, -1)); - } - unset($parameters[$key]); - } - - if ($arbitraryArguments->count()) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $arbitraryArguments; - } - } - - if (!empty($parameters)) { - $unknownParameter = null; - foreach ($parameters as $parameter) { - if ($parameter instanceof Node) { - $unknownParameter = $parameter; - break; - } - } - - throw new SyntaxError( - sprintf( - 'Unknown argument%s "%s" for %s "%s(%s)".', - \count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names) - ), - $unknownParameter ? $unknownParameter->getTemplateLine() : $this->getTemplateLine(), - $unknownParameter ? $unknownParameter->getSourceContext() : $this->getSourceContext() - ); - } - - return $arguments; - } - - protected function normalizeName($name) - { - return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); - } - - private function getCallableParameters($callable, bool $isVariadic): array - { - list($r) = $this->reflectCallable($callable); - if (null === $r) { - return [[], false]; - } - - $parameters = $r->getParameters(); - if ($this->hasNode('node')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - array_shift($parameters); - } - if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - array_shift($parameters); - } - } - $isPhpVariadic = false; - if ($isVariadic) { - $argument = end($parameters); - if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { - array_pop($parameters); - } elseif ($argument && $argument->isVariadic()) { - array_pop($parameters); - $isPhpVariadic = true; - } else { - $callableName = $r->name; - if ($r instanceof \ReflectionMethod) { - $callableName = $r->getDeclaringClass()->name.'::'.$callableName; - } - - throw new \LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); - } - } - - return [$parameters, $isPhpVariadic]; - } - - private function reflectCallable($callable) - { - if (null !== $this->reflector) { - return $this->reflector; - } - - if (\is_array($callable)) { - if (!method_exists($callable[0], $callable[1])) { - // __call() - return [null, []]; - } - $r = new \ReflectionMethod($callable[0], $callable[1]); - } elseif (\is_object($callable) && !$callable instanceof \Closure) { - $r = new \ReflectionObject($callable); - $r = $r->getMethod('__invoke'); - $callable = [$callable, '__invoke']; - } elseif (\is_string($callable) && false !== $pos = strpos($callable, '::')) { - $class = substr($callable, 0, $pos); - $method = substr($callable, $pos + 2); - if (!method_exists($class, $method)) { - // __staticCall() - return [null, []]; - } - $r = new \ReflectionMethod($callable); - $callable = [$class, $method]; - } else { - $r = new \ReflectionFunction($callable); - } - - return $this->reflector = [$r, $callable]; - } -} - -class_alias('Twig\Node\Expression\CallExpression', 'Twig_Node_Expression_Call'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConditionalExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConditionalExpression.php deleted file mode 100644 index 8c367d3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConditionalExpression.php +++ /dev/null @@ -1,38 +0,0 @@ - $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ? (') - ->subcompile($this->getNode('expr2')) - ->raw(') : (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } -} - -class_alias('Twig\Node\Expression\ConditionalExpression', 'Twig_Node_Expression_Conditional'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConstantExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConstantExpression.php deleted file mode 100644 index 46e0ac3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ConstantExpression.php +++ /dev/null @@ -1,30 +0,0 @@ - $value], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler->repr($this->getAttribute('value')); - } -} - -class_alias('Twig\Node\Expression\ConstantExpression', 'Twig_Node_Expression_Constant'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php deleted file mode 100644 index 0dacae8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Filter/DefaultFilter.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class DefaultFilter extends FilterExpression -{ - public function __construct(Node $node, ConstantExpression $filterName, Node $arguments, int $lineno, string $tag = null) - { - $default = new FilterExpression($node, new ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); - - if ('default' === $filterName->getAttribute('value') && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) { - $test = new DefinedTest(clone $node, 'defined', new Node(), $node->getTemplateLine()); - $false = \count($arguments) ? $arguments->getNode(0) : new ConstantExpression('', $node->getTemplateLine()); - - $node = new ConditionalExpression($test, $default, $false, $node->getTemplateLine()); - } else { - $node = $default; - } - - parent::__construct($node, $filterName, $arguments, $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} - -class_alias('Twig\Node\Expression\Filter\DefaultFilter', 'Twig_Node_Expression_Filter_Default'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FilterExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FilterExpression.php deleted file mode 100644 index 41b0734..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FilterExpression.php +++ /dev/null @@ -1,42 +0,0 @@ - $node, 'filter' => $filterName, 'arguments' => $arguments], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $name = $this->getNode('filter')->getAttribute('value'); - $filter = $compiler->getEnvironment()->getFilter($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'filter'); - $this->setAttribute('needs_environment', $filter->needsEnvironment()); - $this->setAttribute('needs_context', $filter->needsContext()); - $this->setAttribute('arguments', $filter->getArguments()); - $this->setAttribute('callable', $filter->getCallable()); - $this->setAttribute('is_variadic', $filter->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig\Node\Expression\FilterExpression', 'Twig_Node_Expression_Filter'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FunctionExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FunctionExpression.php deleted file mode 100644 index 429dbb9..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/FunctionExpression.php +++ /dev/null @@ -1,45 +0,0 @@ - $arguments], ['name' => $name, 'is_defined_test' => false], $lineno); - } - - public function compile(Compiler $compiler) - { - $name = $this->getAttribute('name'); - $function = $compiler->getEnvironment()->getFunction($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'function'); - $this->setAttribute('needs_environment', $function->needsEnvironment()); - $this->setAttribute('needs_context', $function->needsContext()); - $this->setAttribute('arguments', $function->getArguments()); - $callable = $function->getCallable(); - if ('constant' === $name && $this->getAttribute('is_defined_test')) { - $callable = 'twig_constant_is_defined'; - } - $this->setAttribute('callable', $callable); - $this->setAttribute('is_variadic', $function->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig\Node\Expression\FunctionExpression', 'Twig_Node_Expression_Function'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/GetAttrExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/GetAttrExpression.php deleted file mode 100644 index 7b06617..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/GetAttrExpression.php +++ /dev/null @@ -1,89 +0,0 @@ - $node, 'attribute' => $attribute]; - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } - - parent::__construct($nodes, ['type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'optimizable' => true], $lineno); - } - - public function compile(Compiler $compiler) - { - $env = $compiler->getEnvironment(); - - // optimize array calls - if ( - $this->getAttribute('optimizable') - && (!$env->isStrictVariables() || $this->getAttribute('ignore_strict_check')) - && !$this->getAttribute('is_defined_test') - && Template::ARRAY_CALL === $this->getAttribute('type') - ) { - $var = '$'.$compiler->getVarName(); - $compiler - ->raw('(('.$var.' = ') - ->subcompile($this->getNode('node')) - ->raw(') && is_array(') - ->raw($var) - ->raw(') || ') - ->raw($var) - ->raw(' instanceof ArrayAccess ? (') - ->raw($var) - ->raw('[') - ->subcompile($this->getNode('attribute')) - ->raw('] ?? null) : null)') - ; - - return; - } - - $compiler->raw('twig_get_attribute($this->env, $this->source, '); - - if ($this->getAttribute('ignore_strict_check')) { - $this->getNode('node')->setAttribute('ignore_strict_check', true); - } - - $compiler - ->subcompile($this->getNode('node')) - ->raw(', ') - ->subcompile($this->getNode('attribute')) - ; - - if ($this->hasNode('arguments')) { - $compiler->raw(', ')->subcompile($this->getNode('arguments')); - } else { - $compiler->raw(', []'); - } - - $compiler->raw(', ') - ->repr($this->getAttribute('type')) - ->raw(', ')->repr($this->getAttribute('is_defined_test')) - ->raw(', ')->repr($this->getAttribute('ignore_strict_check')) - ->raw(', ')->repr($env->hasExtension(SandboxExtension::class)) - ->raw(', ')->repr($this->getNode('node')->getTemplateLine()) - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\GetAttrExpression', 'Twig_Node_Expression_GetAttr'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/InlinePrint.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/InlinePrint.php deleted file mode 100644 index 469e736..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/InlinePrint.php +++ /dev/null @@ -1,35 +0,0 @@ - $node], [], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('print (') - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/MethodCallExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/MethodCallExpression.php deleted file mode 100644 index d5287f8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/MethodCallExpression.php +++ /dev/null @@ -1,64 +0,0 @@ - $node, 'arguments' => $arguments], ['method' => $method, 'safe' => false, 'is_defined_test' => false], $lineno); - - if ($node instanceof NameExpression) { - $node->setAttribute('always_defined', true); - } - } - - public function compile(Compiler $compiler) - { - if ($this->getAttribute('is_defined_test')) { - $compiler - ->raw('method_exists($macros[') - ->repr($this->getNode('node')->getAttribute('name')) - ->raw('], ') - ->repr($this->getAttribute('method')) - ->raw(')') - ; - - return; - } - - $compiler - ->raw('twig_call_macro($macros[') - ->repr($this->getNode('node')->getAttribute('name')) - ->raw('], ') - ->repr($this->getAttribute('method')) - ->raw(', [') - ; - $first = true; - foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler->subcompile($pair['value']); - } - $compiler - ->raw('], ') - ->repr($this->getTemplateLine()) - ->raw(', $context, $this->getSourceContext())'); - } -} - -class_alias('Twig\Node\Expression\MethodCallExpression', 'Twig_Node_Expression_MethodCall'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NameExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NameExpression.php deleted file mode 100644 index ff7a046..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NameExpression.php +++ /dev/null @@ -1,99 +0,0 @@ - '$this->getTemplateName()', - '_context' => '$context', - '_charset' => '$this->env->getCharset()', - ]; - - public function __construct(string $name, int $lineno) - { - parent::__construct([], ['name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false], $lineno); - } - - public function compile(Compiler $compiler) - { - $name = $this->getAttribute('name'); - - $compiler->addDebugInfo($this); - - if ($this->getAttribute('is_defined_test')) { - if ($this->isSpecial()) { - $compiler->repr(true); - } elseif (\PHP_VERSION_ID >= 700400) { - $compiler - ->raw('array_key_exists(') - ->string($name) - ->raw(', $context)') - ; - } else { - $compiler - ->raw('(isset($context[') - ->string($name) - ->raw(']) || array_key_exists(') - ->string($name) - ->raw(', $context))') - ; - } - } elseif ($this->isSpecial()) { - $compiler->raw($this->specialVars[$name]); - } elseif ($this->getAttribute('always_defined')) { - $compiler - ->raw('$context[') - ->string($name) - ->raw(']') - ; - } else { - if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { - $compiler - ->raw('($context[') - ->string($name) - ->raw('] ?? null)') - ; - } else { - $compiler - ->raw('(isset($context[') - ->string($name) - ->raw(']) || array_key_exists(') - ->string($name) - ->raw(', $context) ? $context[') - ->string($name) - ->raw('] : (function () { throw new RuntimeError(\'Variable ') - ->string($name) - ->raw(' does not exist.\', ') - ->repr($this->lineno) - ->raw(', $this->source); })()') - ->raw(')') - ; - } - } - } - - public function isSpecial() - { - return isset($this->specialVars[$this->getAttribute('name')]); - } - - public function isSimple() - { - return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); - } -} - -class_alias('Twig\Node\Expression\NameExpression', 'Twig_Node_Expression_Name'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NullCoalesceExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NullCoalesceExpression.php deleted file mode 100644 index de03ff2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/NullCoalesceExpression.php +++ /dev/null @@ -1,62 +0,0 @@ -getTemplateLine()); - // for "block()", we don't need the null test as the return value is always a string - if (!$left instanceof BlockReferenceExpression) { - $test = new AndBinary( - $test, - new NotUnary(new NullTest($left, 'null', new Node(), $left->getTemplateLine()), $left->getTemplateLine()), - $left->getTemplateLine() - ); - } - - parent::__construct($test, $left, $right, $lineno); - } - - public function compile(Compiler $compiler) - { - /* - * This optimizes only one case. PHP 7 also supports more complex expressions - * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, - * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced - * cases might be implemented as an optimizer node visitor, but has not been done - * as benefits are probably not worth the added complexity. - */ - if ($this->getNode('expr2') instanceof NameExpression) { - $this->getNode('expr2')->setAttribute('always_defined', true); - $compiler - ->raw('((') - ->subcompile($this->getNode('expr2')) - ->raw(') ?? (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } else { - parent::compile($compiler); - } - } -} - -class_alias('Twig\Node\Expression\NullCoalesceExpression', 'Twig_Node_Expression_NullCoalesce'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ParentExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ParentExpression.php deleted file mode 100644 index 294ab39..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/ParentExpression.php +++ /dev/null @@ -1,48 +0,0 @@ - - */ -class ParentExpression extends AbstractExpression -{ - public function __construct(string $name, int $lineno, string $tag = null) - { - parent::__construct([], ['output' => false, 'name' => $name], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write('$this->displayParentBlock(') - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw('$this->renderParentBlock(') - ->string($this->getAttribute('name')) - ->raw(', $context, $blocks)') - ; - } - } -} - -class_alias('Twig\Node\Expression\ParentExpression', 'Twig_Node_Expression_Parent'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TempNameExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TempNameExpression.php deleted file mode 100644 index e7a1a89..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TempNameExpression.php +++ /dev/null @@ -1,33 +0,0 @@ - $name], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('$_') - ->raw($this->getAttribute('name')) - ->raw('_') - ; - } -} - -class_alias('Twig\Node\Expression\TempNameExpression', 'Twig_Node_Expression_TempName'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/ConstantTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/ConstantTest.php deleted file mode 100644 index 78353a8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/ConstantTest.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -class ConstantTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === constant(') - ; - - if ($this->getNode('arguments')->hasNode(1)) { - $compiler - ->raw('get_class(') - ->subcompile($this->getNode('arguments')->getNode(1)) - ->raw(')."::".') - ; - } - - $compiler - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw('))') - ; - } -} - -class_alias('Twig\Node\Expression\Test\ConstantTest', 'Twig_Node_Expression_Test_Constant'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DefinedTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DefinedTest.php deleted file mode 100644 index 7a89840..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DefinedTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - */ -class DefinedTest extends TestExpression -{ - public function __construct(Node $node, string $name, Node $arguments = null, int $lineno) - { - if ($node instanceof NameExpression) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof GetAttrExpression) { - $node->setAttribute('is_defined_test', true); - $this->changeIgnoreStrictCheck($node); - } elseif ($node instanceof BlockReferenceExpression) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof FunctionExpression && 'constant' === $node->getAttribute('name')) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof ConstantExpression || $node instanceof ArrayExpression) { - $node = new ConstantExpression(true, $node->getTemplateLine()); - } elseif ($node instanceof MethodCallExpression) { - $node->setAttribute('is_defined_test', true); - } else { - throw new SyntaxError('The "defined" test only works with simple variables.', $lineno); - } - - parent::__construct($node, $name, $arguments, $lineno); - } - - private function changeIgnoreStrictCheck(GetAttrExpression $node) - { - $node->setAttribute('optimizable', false); - $node->setAttribute('ignore_strict_check', true); - - if ($node->getNode('node') instanceof GetAttrExpression) { - $this->changeIgnoreStrictCheck($node->getNode('node')); - } - } - - public function compile(Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} - -class_alias('Twig\Node\Expression\Test\DefinedTest', 'Twig_Node_Expression_Test_Defined'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php deleted file mode 100644 index 05c8ad8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class DivisiblebyTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(0 == ') - ->subcompile($this->getNode('node')) - ->raw(' % ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\Test\DivisiblebyTest', 'Twig_Node_Expression_Test_Divisibleby'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/EvenTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/EvenTest.php deleted file mode 100644 index 3b955d2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/EvenTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class EvenTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 0') - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\Test\EvenTest', 'Twig_Node_Expression_Test_Even'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/NullTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/NullTest.php deleted file mode 100644 index 24d3997..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/NullTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class NullTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(null === ') - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\Test\NullTest', 'Twig_Node_Expression_Test_Null'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/OddTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/OddTest.php deleted file mode 100644 index 2dc693a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/OddTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class OddTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\Test\OddTest', 'Twig_Node_Expression_Test_Odd'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/SameasTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/SameasTest.php deleted file mode 100644 index 75f2b82..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Test/SameasTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class SameasTest extends TestExpression -{ - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} - -class_alias('Twig\Node\Expression\Test\SameasTest', 'Twig_Node_Expression_Test_Sameas'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TestExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TestExpression.php deleted file mode 100644 index 50aab05..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/TestExpression.php +++ /dev/null @@ -1,44 +0,0 @@ - $node]; - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } - - parent::__construct($nodes, ['name' => $name], $lineno); - } - - public function compile(Compiler $compiler) - { - $name = $this->getAttribute('name'); - $test = $compiler->getEnvironment()->getTest($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'test'); - $this->setAttribute('arguments', $test->getArguments()); - $this->setAttribute('callable', $test->getCallable()); - $this->setAttribute('is_variadic', $test->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig\Node\Expression\TestExpression', 'Twig_Node_Expression_Test'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php deleted file mode 100644 index 4896280..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/AbstractUnary.php +++ /dev/null @@ -1,36 +0,0 @@ - $node], [], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler->raw(' '); - $this->operator($compiler); - $compiler->subcompile($this->getNode('node')); - } - - abstract public function operator(Compiler $compiler); -} - -class_alias('Twig\Node\Expression\Unary\AbstractUnary', 'Twig_Node_Expression_Unary'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NegUnary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NegUnary.php deleted file mode 100644 index dfb6f54..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NegUnary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('-'); - } -} - -class_alias('Twig\Node\Expression\Unary\NegUnary', 'Twig_Node_Expression_Unary_Neg'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NotUnary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NotUnary.php deleted file mode 100644 index 7bdde96..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/NotUnary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('!'); - } -} - -class_alias('Twig\Node\Expression\Unary\NotUnary', 'Twig_Node_Expression_Unary_Not'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/PosUnary.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/PosUnary.php deleted file mode 100644 index 52d5d0c..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/Unary/PosUnary.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('+'); - } -} - -class_alias('Twig\Node\Expression\Unary\PosUnary', 'Twig_Node_Expression_Unary_Pos'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/VariadicExpression.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/VariadicExpression.php deleted file mode 100644 index 3351e1a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Expression/VariadicExpression.php +++ /dev/null @@ -1,24 +0,0 @@ -raw('...'); - - parent::compile($compiler); - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/FlushNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/FlushNode.php deleted file mode 100644 index b88f340..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/FlushNode.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class FlushNode extends Node -{ - public function __construct(int $lineno, string $tag) - { - parent::__construct([], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("flush();\n") - ; - } -} - -class_alias('Twig\Node\FlushNode', 'Twig_Node_Flush'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForLoopNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForLoopNode.php deleted file mode 100644 index 42aedd7..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForLoopNode.php +++ /dev/null @@ -1,56 +0,0 @@ - - */ -class ForLoopNode extends Node -{ - public function __construct(int $lineno, string $tag = null) - { - parent::__construct([], ['with_loop' => false, 'ifexpr' => false, 'else' => false], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - if ($this->getAttribute('else')) { - $compiler->write("\$context['_iterated'] = true;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("++\$context['loop']['index0'];\n") - ->write("++\$context['loop']['index'];\n") - ->write("\$context['loop']['first'] = false;\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (isset(\$context['loop']['length'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } - } -} - -class_alias('Twig\Node\ForLoopNode', 'Twig_Node_ForLoop'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForNode.php deleted file mode 100644 index 54afe93..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ForNode.php +++ /dev/null @@ -1,119 +0,0 @@ - - */ -class ForNode extends Node -{ - private $loop; - - public function __construct(AssignNameExpression $keyTarget, AssignNameExpression $valueTarget, AbstractExpression $seq, AbstractExpression $ifexpr = null, Node $body, Node $else = null, int $lineno, string $tag = null) - { - $body = new Node([$body, $this->loop = new ForLoopNode($lineno, $tag)]); - - if (null !== $ifexpr) { - $body = new IfNode(new Node([$ifexpr, $body]), null, $lineno, $tag); - } - - $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, ['with_loop' => true, 'ifexpr' => null !== $ifexpr], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("\$context['_parent'] = \$context;\n") - ->write("\$context['_seq'] = twig_ensure_traversable(") - ->subcompile($this->getNode('seq')) - ->raw(");\n") - ; - - if ($this->hasNode('else')) { - $compiler->write("\$context['_iterated'] = false;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("\$context['loop'] = [\n") - ->write(" 'parent' => \$context['_parent'],\n") - ->write(" 'index0' => 0,\n") - ->write(" 'index' => 1,\n") - ->write(" 'first' => true,\n") - ->write("];\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {\n") - ->indent() - ->write("\$length = count(\$context['_seq']);\n") - ->write("\$context['loop']['revindex0'] = \$length - 1;\n") - ->write("\$context['loop']['revindex'] = \$length;\n") - ->write("\$context['loop']['length'] = \$length;\n") - ->write("\$context['loop']['last'] = 1 === \$length;\n") - ->outdent() - ->write("}\n") - ; - } - } - - $this->loop->setAttribute('else', $this->hasNode('else')); - $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); - $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); - - $compiler - ->write("foreach (\$context['_seq'] as ") - ->subcompile($this->getNode('key_target')) - ->raw(' => ') - ->subcompile($this->getNode('value_target')) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n") - ; - - if ($this->hasNode('else')) { - $compiler - ->write("if (!\$context['_iterated']) {\n") - ->indent() - ->subcompile($this->getNode('else')) - ->outdent() - ->write("}\n") - ; - } - - $compiler->write("\$_parent = \$context['_parent'];\n"); - - // remove some "private" loop variables (needed for nested loops) - $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); - - // keep the values set in the inner context for variables defined in the outer context - $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); - } -} - -class_alias('Twig\Node\ForNode', 'Twig_Node_For'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IfNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IfNode.php deleted file mode 100644 index 814a6f3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IfNode.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class IfNode extends Node -{ - public function __construct(Node $tests, Node $else = null, int $lineno, string $tag = null) - { - $nodes = ['tests' => $tests]; - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (') - ; - } else { - $compiler - ->write('if (') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} - -class_alias('Twig\Node\IfNode', 'Twig_Node_If'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ImportNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ImportNode.php deleted file mode 100644 index b661f43..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ImportNode.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ -class ImportNode extends Node -{ - public function __construct(AbstractExpression $expr, AbstractExpression $var, int $lineno, string $tag = null, bool $global = true) - { - parent::__construct(['expr' => $expr, 'var' => $var], ['global' => $global], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('$macros[') - ->repr($this->getNode('var')->getAttribute('name')) - ->raw('] = ') - ; - - if ($this->getAttribute('global')) { - $compiler - ->raw('$this->macros[') - ->repr($this->getNode('var')->getAttribute('name')) - ->raw('] = ') - ; - } - - if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) { - $compiler->raw('$this'); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')->unwrap()') - ; - } - - $compiler->raw(";\n"); - } -} - -class_alias('Twig\Node\ImportNode', 'Twig_Node_Import'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IncludeNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IncludeNode.php deleted file mode 100644 index d453030..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/IncludeNode.php +++ /dev/null @@ -1,108 +0,0 @@ - - */ -class IncludeNode extends Node implements NodeOutputInterface -{ - public function __construct(AbstractExpression $expr, AbstractExpression $variables = null, bool $only = false, bool $ignoreMissing = false, int $lineno, string $tag = null) - { - $nodes = ['expr' => $expr]; - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, ['only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->getAttribute('ignore_missing')) { - $template = $compiler->getVarName(); - - $compiler - ->write(sprintf("$%s = null;\n", $template)) - ->write("try {\n") - ->indent() - ->write(sprintf('$%s = ', $template)) - ; - - $this->addGetTemplate($compiler); - - $compiler - ->raw(";\n") - ->outdent() - ->write("} catch (LoaderError \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n") - ->write(sprintf("if ($%s) {\n", $template)) - ->indent() - ->write(sprintf('$%s->display(', $template)) - ; - $this->addTemplateArguments($compiler); - $compiler - ->raw(");\n") - ->outdent() - ->write("}\n") - ; - } else { - $this->addGetTemplate($compiler); - $compiler->raw('->display('); - $this->addTemplateArguments($compiler); - $compiler->raw(");\n"); - } - } - - protected function addGetTemplate(Compiler $compiler) - { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - protected function addTemplateArguments(Compiler $compiler) - { - if (!$this->hasNode('variables')) { - $compiler->raw(false === $this->getAttribute('only') ? '$context' : '[]'); - } elseif (false === $this->getAttribute('only')) { - $compiler - ->raw('twig_array_merge($context, ') - ->subcompile($this->getNode('variables')) - ->raw(')') - ; - } else { - $compiler->raw('twig_to_array('); - $compiler->subcompile($this->getNode('variables')); - $compiler->raw(')'); - } - } -} - -class_alias('Twig\Node\IncludeNode', 'Twig_Node_Include'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/MacroNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/MacroNode.php deleted file mode 100644 index a133720..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/MacroNode.php +++ /dev/null @@ -1,115 +0,0 @@ - - */ -class MacroNode extends Node -{ - const VARARGS_NAME = 'varargs'; - - public function __construct(string $name, Node $body, Node $arguments, int $lineno, string $tag = null) - { - foreach ($arguments as $argumentName => $argument) { - if (self::VARARGS_NAME === $argumentName) { - throw new SyntaxError(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(), $argument->getSourceContext()); - } - } - - parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf('public function macro_%s(', $this->getAttribute('name'))) - ; - - $count = \count($this->getNode('arguments')); - $pos = 0; - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->raw('$__'.$name.'__ = ') - ->subcompile($default) - ; - - if (++$pos < $count) { - $compiler->raw(', '); - } - } - - if ($count) { - $compiler->raw(', '); - } - - $compiler - ->raw('...$__varargs__') - ->raw(")\n") - ->write("{\n") - ->indent() - ->write("\$macros = \$this->macros;\n") - ->write("\$context = \$this->env->mergeGlobals([\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $__'.$name.'__') - ->raw(",\n") - ; - } - - $compiler - ->write('') - ->string(self::VARARGS_NAME) - ->raw(' => ') - ; - - $compiler - ->raw("\$__varargs__,\n") - ->outdent() - ->write("]);\n\n") - ->write("\$blocks = [];\n\n") - ; - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->write("try {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->raw("\n") - ->write("return ('' === \$tmp = ob_get_contents()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n") - ->outdent() - ->write("} finally {\n") - ->indent() - ->write("ob_end_clean();\n") - ->outdent() - ->write("}\n") - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig\Node\MacroNode', 'Twig_Node_Macro'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ModuleNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ModuleNode.php deleted file mode 100644 index b23a342..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/ModuleNode.php +++ /dev/null @@ -1,472 +0,0 @@ - - * - * @final since Twig 2.4.0 - */ -class ModuleNode extends Node -{ - public function __construct(Node $body, AbstractExpression $parent = null, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) - { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $nodes = [ - 'body' => $body, - 'blocks' => $blocks, - 'macros' => $macros, - 'traits' => $traits, - 'display_start' => new Node(), - 'display_end' => new Node(), - 'constructor_start' => new Node(), - 'constructor_end' => new Node(), - 'class_end' => new Node(), - ]; - if (null !== $parent) { - $nodes['parent'] = $parent; - } - - // embedded templates are set as attributes so that they are only visited once by the visitors - parent::__construct($nodes, [ - 'index' => null, - 'embedded_templates' => $embeddedTemplates, - ], 1); - - // populate the template name of all node children - $this->setSourceContext($source); - } - - public function setIndex($index) - { - $this->setAttribute('index', $index); - } - - public function compile(Compiler $compiler) - { - $this->compileTemplate($compiler); - - foreach ($this->getAttribute('embedded_templates') as $template) { - $compiler->subcompile($template); - } - } - - protected function compileTemplate(Compiler $compiler) - { - if (!$this->getAttribute('index')) { - $compiler->write('compileClassHeader($compiler); - - $this->compileConstructor($compiler); - - $this->compileGetParent($compiler); - - $this->compileDisplay($compiler); - - $compiler->subcompile($this->getNode('blocks')); - - $this->compileMacros($compiler); - - $this->compileGetTemplateName($compiler); - - $this->compileIsTraitable($compiler); - - $this->compileDebugInfo($compiler); - - $this->compileGetSourceContext($compiler); - - $this->compileClassFooter($compiler); - } - - protected function compileGetParent(Compiler $compiler) - { - if (!$this->hasNode('parent')) { - return; - } - $parent = $this->getNode('parent'); - - $compiler - ->write("protected function doGetParent(array \$context)\n", "{\n") - ->indent() - ->addDebugInfo($parent) - ->write('return ') - ; - - if ($parent instanceof ConstantExpression) { - $compiler->subcompile($parent); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->getSourceContext()->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(')') - ; - } - - $compiler - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassHeader(Compiler $compiler) - { - $compiler - ->write("\n\n") - ; - if (!$this->getAttribute('index')) { - $compiler - ->write("use Twig\Environment;\n") - ->write("use Twig\Error\LoaderError;\n") - ->write("use Twig\Error\RuntimeError;\n") - ->write("use Twig\Extension\SandboxExtension;\n") - ->write("use Twig\Markup;\n") - ->write("use Twig\Sandbox\SecurityError;\n") - ->write("use Twig\Sandbox\SecurityNotAllowedTagError;\n") - ->write("use Twig\Sandbox\SecurityNotAllowedFilterError;\n") - ->write("use Twig\Sandbox\SecurityNotAllowedFunctionError;\n") - ->write("use Twig\Source;\n") - ->write("use Twig\Template;\n\n") - ; - } - $compiler - // if the template name contains */, add a blank to avoid a PHP parse error - ->write('/* '.str_replace('*/', '* /', $this->getSourceContext()->getName())." */\n") - ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getSourceContext()->getName(), $this->getAttribute('index'))) - ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass(false))) - ->write("{\n") - ->indent() - ->write("private \$source;\n") - ->write("private \$macros = [];\n\n") - ; - } - - protected function compileConstructor(Compiler $compiler) - { - $compiler - ->write("public function __construct(Environment \$env)\n", "{\n") - ->indent() - ->subcompile($this->getNode('constructor_start')) - ->write("parent::__construct(\$env);\n\n") - ->write("\$this->source = \$this->getSourceContext();\n\n") - ; - - // parent - if (!$this->hasNode('parent')) { - $compiler->write("\$this->parent = false;\n\n"); - } - - $countTraits = \count($this->getNode('traits')); - if ($countTraits) { - // traits - foreach ($this->getNode('traits') as $i => $trait) { - $node = $trait->getNode('template'); - - $compiler - ->addDebugInfo($node) - ->write(sprintf('$_trait_%s = $this->loadTemplate(', $i)) - ->subcompile($node) - ->raw(', ') - ->repr($node->getTemplateName()) - ->raw(', ') - ->repr($node->getTemplateLine()) - ->raw(");\n") - ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) - ->indent() - ->write("throw new RuntimeError('Template \"'.") - ->subcompile($trait->getNode('template')) - ->raw(".'\" cannot be used as a trait.', ") - ->repr($node->getTemplateLine()) - ->raw(", \$this->source);\n") - ->outdent() - ->write("}\n") - ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) - ; - - foreach ($trait->getNode('targets') as $key => $value) { - $compiler - ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("])) {\n") - ->indent() - ->write("throw new RuntimeError('Block ") - ->string($key) - ->raw(' is not defined in trait ') - ->subcompile($trait->getNode('template')) - ->raw(".', ") - ->repr($node->getTemplateLine()) - ->raw(", \$this->source);\n") - ->outdent() - ->write("}\n\n") - - ->write(sprintf('$_trait_%s_blocks[', $i)) - ->subcompile($value) - ->raw(sprintf('] = $_trait_%s_blocks[', $i)) - ->string($key) - ->raw(sprintf(']; unset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("]);\n\n") - ; - } - } - - if ($countTraits > 1) { - $compiler - ->write("\$this->traits = array_merge(\n") - ->indent() - ; - - for ($i = 0; $i < $countTraits; ++$i) { - $compiler - ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i)) - ; - } - - $compiler - ->outdent() - ->write(");\n\n") - ; - } else { - $compiler - ->write("\$this->traits = \$_trait_0_blocks;\n\n") - ; - } - - $compiler - ->write("\$this->blocks = array_merge(\n") - ->indent() - ->write("\$this->traits,\n") - ->write("[\n") - ; - } else { - $compiler - ->write("\$this->blocks = [\n") - ; - } - - // blocks - $compiler - ->indent() - ; - - foreach ($this->getNode('blocks') as $name => $node) { - $compiler - ->write(sprintf("'%s' => [\$this, 'block_%s'],\n", $name, $name)) - ; - } - - if ($countTraits) { - $compiler - ->outdent() - ->write("]\n") - ->outdent() - ->write(");\n") - ; - } else { - $compiler - ->outdent() - ->write("];\n") - ; - } - - $compiler - ->subcompile($this->getNode('constructor_end')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDisplay(Compiler $compiler) - { - $compiler - ->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n") - ->indent() - ->write("\$macros = \$this->macros;\n") - ->subcompile($this->getNode('display_start')) - ->subcompile($this->getNode('body')) - ; - - if ($this->hasNode('parent')) { - $parent = $this->getNode('parent'); - - $compiler->addDebugInfo($parent); - if ($parent instanceof ConstantExpression) { - $compiler - ->write('$this->parent = $this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->getSourceContext()->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(");\n") - ; - $compiler->write('$this->parent'); - } else { - $compiler->write('$this->getParent($context)'); - } - $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); - } - - $compiler - ->subcompile($this->getNode('display_end')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassFooter(Compiler $compiler) - { - $compiler - ->subcompile($this->getNode('class_end')) - ->outdent() - ->write("}\n") - ; - } - - protected function compileMacros(Compiler $compiler) - { - $compiler->subcompile($this->getNode('macros')); - } - - protected function compileGetTemplateName(Compiler $compiler) - { - $compiler - ->write("public function getTemplateName()\n", "{\n") - ->indent() - ->write('return ') - ->repr($this->getSourceContext()->getName()) - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileIsTraitable(Compiler $compiler) - { - // A template can be used as a trait if: - // * it has no parent - // * it has no macros - // * it has no body - // - // Put another way, a template can be used as a trait if it - // only contains blocks and use statements. - $traitable = !$this->hasNode('parent') && 0 === \count($this->getNode('macros')); - if ($traitable) { - if ($this->getNode('body') instanceof BodyNode) { - $nodes = $this->getNode('body')->getNode(0); - } else { - $nodes = $this->getNode('body'); - } - - if (!\count($nodes)) { - $nodes = new Node([$nodes]); - } - - foreach ($nodes as $node) { - if (!\count($node)) { - continue; - } - - if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { - continue; - } - - if ($node instanceof BlockReferenceNode) { - continue; - } - - $traitable = false; - break; - } - } - - if ($traitable) { - return; - } - - $compiler - ->write("public function isTraitable()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDebugInfo(Compiler $compiler) - { - $compiler - ->write("public function getDebugInfo()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileGetSourceContext(Compiler $compiler) - { - $compiler - ->write("public function getSourceContext()\n", "{\n") - ->indent() - ->write('return new Source(') - ->string($compiler->getEnvironment()->isDebug() ? $this->getSourceContext()->getCode() : '') - ->raw(', ') - ->string($this->getSourceContext()->getName()) - ->raw(', ') - ->string($this->getSourceContext()->getPath()) - ->raw(");\n") - ->outdent() - ->write("}\n") - ; - } - - protected function compileLoadTemplate(Compiler $compiler, $node, $var) - { - if ($node instanceof ConstantExpression) { - $compiler - ->write(sprintf('%s = $this->loadTemplate(', $var)) - ->subcompile($node) - ->raw(', ') - ->repr($node->getTemplateName()) - ->raw(', ') - ->repr($node->getTemplateLine()) - ->raw(");\n") - ; - } else { - throw new \LogicException('Trait templates can only be constant nodes.'); - } - } -} - -class_alias('Twig\Node\ModuleNode', 'Twig_Node_Module'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Node.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Node.php deleted file mode 100644 index 909a687..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/Node.php +++ /dev/null @@ -1,211 +0,0 @@ - - */ -class Node implements \Countable, \IteratorAggregate -{ - protected $nodes; - protected $attributes; - protected $lineno; - protected $tag; - - private $name; - private $sourceContext; - - /** - * @param array $nodes An array of named nodes - * @param array $attributes An array of attributes (should not be nodes) - * @param int $lineno The line number - * @param string $tag The tag name associated with the Node - */ - public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0, string $tag = null) - { - foreach ($nodes as $name => $node) { - if (!$node instanceof self) { - throw new \InvalidArgumentException(sprintf('Using "%s" for the value of node "%s" of "%s" is not supported. You must pass a \Twig\Node\Node instance.', \is_object($node) ? \get_class($node) : (null === $node ? 'null' : \gettype($node)), $name, \get_class($this))); - } - } - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - $this->tag = $tag; - } - - public function __toString() - { - $attributes = []; - foreach ($this->attributes as $name => $value) { - $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); - } - - $repr = [\get_class($this).'('.implode(', ', $attributes)]; - - if (\count($this->nodes)) { - foreach ($this->nodes as $name => $node) { - $len = \strlen($name) + 4; - $noderepr = []; - foreach (explode("\n", (string) $node) as $line) { - $noderepr[] = str_repeat(' ', $len).$line; - } - - $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); - } - - $repr[] = ')'; - } else { - $repr[0] .= ')'; - } - - return implode("\n", $repr); - } - - public function compile(Compiler $compiler) - { - foreach ($this->nodes as $node) { - $node->compile($compiler); - } - } - - public function getTemplateLine() - { - return $this->lineno; - } - - public function getNodeTag() - { - return $this->tag; - } - - /** - * @return bool - */ - public function hasAttribute($name) - { - return \array_key_exists($name, $this->attributes); - } - - /** - * @return mixed - */ - public function getAttribute($name) - { - if (!\array_key_exists($name, $this->attributes)) { - throw new \LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, \get_class($this))); - } - - return $this->attributes[$name]; - } - - /** - * @param string $name - * @param mixed $value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - public function removeAttribute($name) - { - unset($this->attributes[$name]); - } - - /** - * @return bool - */ - public function hasNode($name) - { - return isset($this->nodes[$name]); - } - - /** - * @return Node - */ - public function getNode($name) - { - if (!isset($this->nodes[$name])) { - throw new \LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, \get_class($this))); - } - - return $this->nodes[$name]; - } - - public function setNode($name, self $node) - { - $this->nodes[$name] = $node; - } - - public function removeNode($name) - { - unset($this->nodes[$name]); - } - - public function count() - { - return \count($this->nodes); - } - - public function getIterator() - { - return new \ArrayIterator($this->nodes); - } - - /** - * @deprecated since 2.8 (to be removed in 3.0) - */ - public function setTemplateName($name/*, $triggerDeprecation = true */) - { - $triggerDeprecation = 2 > \func_num_args() || \func_get_arg(1); - if ($triggerDeprecation) { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use setSourceContext() instead.', E_USER_DEPRECATED); - } - - $this->name = $name; - foreach ($this->nodes as $node) { - $node->setTemplateName($name, $triggerDeprecation); - } - } - - public function getTemplateName() - { - return $this->sourceContext ? $this->sourceContext->getName() : null; - } - - public function setSourceContext(Source $source) - { - $this->sourceContext = $source; - foreach ($this->nodes as $node) { - $node->setSourceContext($source); - } - - $this->setTemplateName($source->getName(), false); - } - - public function getSourceContext() - { - return $this->sourceContext; - } -} - -class_alias('Twig\Node\Node', 'Twig_Node'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Compiler'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeCaptureInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeCaptureInterface.php deleted file mode 100644 index 474003f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeCaptureInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - */ -interface NodeCaptureInterface -{ -} - -class_alias('Twig\Node\NodeCaptureInterface', 'Twig_NodeCaptureInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeOutputInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeOutputInterface.php deleted file mode 100644 index 8b046ee..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/NodeOutputInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - */ -interface NodeOutputInterface -{ -} - -class_alias('Twig\Node\NodeOutputInterface', 'Twig_NodeOutputInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/PrintNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/PrintNode.php deleted file mode 100644 index fcc086a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/PrintNode.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class PrintNode extends Node implements NodeOutputInterface -{ - public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) - { - parent::__construct(['expr' => $expr], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} - -class_alias('Twig\Node\PrintNode', 'Twig_Node_Print'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxNode.php deleted file mode 100644 index fe59313..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxNode.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class SandboxNode extends Node -{ - public function __construct(Node $body, int $lineno, string $tag = null) - { - parent::__construct(['body' => $body], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n") - ->indent() - ->write("\$this->sandbox->enableSandbox();\n") - ->outdent() - ->write("}\n") - ->subcompile($this->getNode('body')) - ->write("if (!\$alreadySandboxed) {\n") - ->indent() - ->write("\$this->sandbox->disableSandbox();\n") - ->outdent() - ->write("}\n") - ; - } -} - -class_alias('Twig\Node\SandboxNode', 'Twig_Node_Sandbox'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxedPrintNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxedPrintNode.php deleted file mode 100644 index 54e92e6..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SandboxedPrintNode.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class SandboxedPrintNode extends PrintNode -{ - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ; - $expr = $this->getNode('expr'); - if ($expr instanceof ConstantExpression) { - $compiler - ->subcompile($expr) - ->raw(";\n") - ; - } else { - $compiler - ->write('$this->extensions[SandboxExtension::class]->ensureToStringAllowed(') - ->subcompile($expr) - ->raw(', ') - ->repr($expr->getTemplateLine()) - ->raw(", \$this->source);\n") - ; - } - } -} - -class_alias('Twig\Node\SandboxedPrintNode', 'Twig_Node_SandboxedPrint'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SetNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SetNode.php deleted file mode 100644 index 3cf4615..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SetNode.php +++ /dev/null @@ -1,107 +0,0 @@ - - */ -class SetNode extends Node implements NodeCaptureInterface -{ - public function __construct(bool $capture, Node $names, Node $values, int $lineno, string $tag = null) - { - parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => false], $lineno, $tag); - - /* - * Optimizes the node when capture is used for a large block of text. - * - * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo"); - */ - if ($this->getAttribute('capture')) { - $this->setAttribute('safe', true); - - $values = $this->getNode('values'); - if ($values instanceof TextNode) { - $this->setNode('values', new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); - $this->setAttribute('capture', false); - } - } - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if (\count($this->getNode('names')) > 1) { - $compiler->write('list('); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('capture')) { - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->subcompile($this->getNode('values')) - ; - } - - $compiler->subcompile($this->getNode('names'), false); - - if ($this->getAttribute('capture')) { - $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); - } - } - - if (!$this->getAttribute('capture')) { - $compiler->raw(' = '); - - if (\count($this->getNode('names')) > 1) { - $compiler->write('['); - foreach ($this->getNode('values') as $idx => $value) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($value); - } - $compiler->raw(']'); - } else { - if ($this->getAttribute('safe')) { - $compiler - ->raw("('' === \$tmp = ") - ->subcompile($this->getNode('values')) - ->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())") - ; - } else { - $compiler->subcompile($this->getNode('values')); - } - } - } - - $compiler->raw(";\n"); - } -} - -class_alias('Twig\Node\SetNode', 'Twig_Node_Set'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SpacelessNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SpacelessNode.php deleted file mode 100644 index 8fc4a2d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/SpacelessNode.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ -class SpacelessNode extends Node implements NodeOutputInterface -{ - public function __construct(Node $body, int $lineno, string $tag = 'spaceless') - { - parent::__construct(['body' => $body], [], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ; - if ($compiler->getEnvironment()->isDebug()) { - $compiler->write("ob_start();\n"); - } else { - $compiler->write("ob_start(function () { return ''; });\n"); - } - $compiler - ->subcompile($this->getNode('body')) - ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") - ; - } -} - -class_alias('Twig\Node\SpacelessNode', 'Twig_Node_Spaceless'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/TextNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/TextNode.php deleted file mode 100644 index 85640a5..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/TextNode.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class TextNode extends Node implements NodeOutputInterface -{ - public function __construct(string $data, int $lineno) - { - parent::__construct([], ['data' => $data], $lineno); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->string($this->getAttribute('data')) - ->raw(";\n") - ; - } -} - -class_alias('Twig\Node\TextNode', 'Twig_Node_Text'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/WithNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/WithNode.php deleted file mode 100644 index 74d1ea0..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Node/WithNode.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class WithNode extends Node -{ - public function __construct(Node $body, Node $variables = null, bool $only = false, int $lineno, string $tag = null) - { - $nodes = ['body' => $body]; - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, ['only' => $only], $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->hasNode('variables')) { - $node = $this->getNode('variables'); - $varsName = $compiler->getVarName(); - $compiler - ->write(sprintf('$%s = ', $varsName)) - ->subcompile($node) - ->raw(";\n") - ->write(sprintf("if (!twig_test_iterable(\$%s)) {\n", $varsName)) - ->indent() - ->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a hash.', ") - ->repr($node->getTemplateLine()) - ->raw(", \$this->getSourceContext());\n") - ->outdent() - ->write("}\n") - ->write(sprintf("\$%s = twig_to_array(\$%s);\n", $varsName, $varsName)) - ; - - if ($this->getAttribute('only')) { - $compiler->write("\$context = ['_parent' => \$context];\n"); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler->write(sprintf("\$context = \$this->env->mergeGlobals(array_merge(\$context, \$%s));\n", $varsName)); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler - ->subcompile($this->getNode('body')) - ->write("\$context = \$context['_parent'];\n") - ; - } -} - -class_alias('Twig\Node\WithNode', 'Twig_Node_With'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeTraverser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeTraverser.php deleted file mode 100644 index 625b049..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeTraverser.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ -final class NodeTraverser -{ - private $env; - private $visitors = []; - - /** - * @param NodeVisitorInterface[] $visitors - */ - public function __construct(Environment $env, array $visitors = []) - { - $this->env = $env; - foreach ($visitors as $visitor) { - $this->addVisitor($visitor); - } - } - - public function addVisitor(NodeVisitorInterface $visitor) - { - $this->visitors[$visitor->getPriority()][] = $visitor; - } - - /** - * Traverses a node and calls the registered visitors. - */ - public function traverse(Node $node): Node - { - ksort($this->visitors); - foreach ($this->visitors as $visitors) { - foreach ($visitors as $visitor) { - $node = $this->traverseForVisitor($visitor, $node); - } - } - - return $node; - } - - /** - * @return Node|null - */ - private function traverseForVisitor(NodeVisitorInterface $visitor, Node $node) - { - $node = $visitor->enterNode($node, $this->env); - - foreach ($node as $k => $n) { - if (false !== ($m = $this->traverseForVisitor($visitor, $n)) && null !== $m) { - if ($m !== $n) { - $node->setNode($k, $m); - } - } else { - if (false === $m) { - @trigger_error('Returning "false" to remove a Node from NodeVisitorInterface::leaveNode() is deprecated since Twig version 2.9; return "null" instead.', E_USER_DEPRECATED); - } - - $node->removeNode($k); - } - } - - return $visitor->leaveNode($node, $this->env); - } -} - -class_alias('Twig\NodeTraverser', 'Twig_NodeTraverser'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php deleted file mode 100644 index 9c6cb12..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -abstract class AbstractNodeVisitor implements NodeVisitorInterface -{ - final public function enterNode(Node $node, Environment $env) - { - return $this->doEnterNode($node, $env); - } - - final public function leaveNode(Node $node, Environment $env) - { - return $this->doLeaveNode($node, $env); - } - - /** - * Called before child nodes are visited. - * - * @return Node The modified node - */ - abstract protected function doEnterNode(Node $node, Environment $env); - - /** - * Called after child nodes are visited. - * - * @return Node|null The modified node or null if the node must be removed - */ - abstract protected function doLeaveNode(Node $node, Environment $env); -} - -class_alias('Twig\NodeVisitor\AbstractNodeVisitor', 'Twig_BaseNodeVisitor'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php deleted file mode 100644 index bfbfdc9..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php +++ /dev/null @@ -1,208 +0,0 @@ - - */ -final class EscaperNodeVisitor extends AbstractNodeVisitor -{ - private $statusStack = []; - private $blocks = []; - private $safeAnalysis; - private $traverser; - private $defaultStrategy = false; - private $safeVars = []; - - public function __construct() - { - $this->safeAnalysis = new SafeAnalysisNodeVisitor(); - } - - protected function doEnterNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - if ($env->hasExtension(EscaperExtension::class) && $defaultStrategy = $env->getExtension(EscaperExtension::class)->getDefaultStrategy($node->getTemplateName())) { - $this->defaultStrategy = $defaultStrategy; - } - $this->safeVars = []; - $this->blocks = []; - } elseif ($node instanceof AutoEscapeNode) { - $this->statusStack[] = $node->getAttribute('value'); - } elseif ($node instanceof BlockNode) { - $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); - } elseif ($node instanceof ImportNode) { - $this->safeVars[] = $node->getNode('var')->getAttribute('name'); - } - - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->defaultStrategy = false; - $this->safeVars = []; - $this->blocks = []; - } elseif ($node instanceof FilterExpression) { - return $this->preEscapeFilterNode($node, $env); - } elseif ($node instanceof PrintNode && false !== $type = $this->needEscaping($env)) { - $expression = $node->getNode('expr'); - if ($expression instanceof ConditionalExpression && $this->shouldUnwrapConditional($expression, $env, $type)) { - return new DoNode($this->unwrapConditional($expression, $env, $type), $expression->getTemplateLine()); - } - - return $this->escapePrintNode($node, $env, $type); - } - - if ($node instanceof AutoEscapeNode || $node instanceof BlockNode) { - array_pop($this->statusStack); - } elseif ($node instanceof BlockReferenceNode) { - $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); - } - - return $node; - } - - private function shouldUnwrapConditional(ConditionalExpression $expression, Environment $env, $type) - { - $expr2Safe = $this->isSafeFor($type, $expression->getNode('expr2'), $env); - $expr3Safe = $this->isSafeFor($type, $expression->getNode('expr3'), $env); - - return $expr2Safe !== $expr3Safe; - } - - private function unwrapConditional(ConditionalExpression $expression, Environment $env, $type) - { - // convert "echo a ? b : c" to "a ? echo b : echo c" recursively - $expr2 = $expression->getNode('expr2'); - if ($expr2 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr2, $env, $type)) { - $expr2 = $this->unwrapConditional($expr2, $env, $type); - } else { - $expr2 = $this->escapeInlinePrintNode(new InlinePrint($expr2, $expr2->getTemplateLine()), $env, $type); - } - $expr3 = $expression->getNode('expr3'); - if ($expr3 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr3, $env, $type)) { - $expr3 = $this->unwrapConditional($expr3, $env, $type); - } else { - $expr3 = $this->escapeInlinePrintNode(new InlinePrint($expr3, $expr3->getTemplateLine()), $env, $type); - } - - return new ConditionalExpression($expression->getNode('expr1'), $expr2, $expr3, $expression->getTemplateLine()); - } - - private function escapeInlinePrintNode(InlinePrint $node, Environment $env, $type) - { - $expression = $node->getNode('node'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - return new InlinePrint($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); - } - - private function escapePrintNode(PrintNode $node, Environment $env, $type) - { - if (false === $type) { - return $node; - } - - $expression = $node->getNode('expr'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - $class = \get_class($node); - - return new $class($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); - } - - private function preEscapeFilterNode(FilterExpression $filter, Environment $env) - { - $name = $filter->getNode('filter')->getAttribute('value'); - - $type = $env->getFilter($name)->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); - - return $filter; - } - - private function isSafeFor($type, Node $expression, $env) - { - $safe = $this->safeAnalysis->getSafe($expression); - - if (null === $safe) { - if (null === $this->traverser) { - $this->traverser = new NodeTraverser($env, [$this->safeAnalysis]); - } - - $this->safeAnalysis->setSafeVars($this->safeVars); - - $this->traverser->traverse($expression); - $safe = $this->safeAnalysis->getSafe($expression); - } - - return \in_array($type, $safe) || \in_array('all', $safe); - } - - private function needEscaping(Environment $env) - { - if (\count($this->statusStack)) { - return $this->statusStack[\count($this->statusStack) - 1]; - } - - return $this->defaultStrategy ? $this->defaultStrategy : false; - } - - private function getEscaperFilter(string $type, Node $node): FilterExpression - { - $line = $node->getTemplateLine(); - $name = new ConstantExpression('escape', $line); - $args = new Node([new ConstantExpression((string) $type, $line), new ConstantExpression(null, $line), new ConstantExpression(true, $line)]); - - return new FilterExpression($node, $name, $args, $line); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig\NodeVisitor\EscaperNodeVisitor', 'Twig_NodeVisitor_Escaper'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php deleted file mode 100644 index f41d463..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -final class MacroAutoImportNodeVisitor implements NodeVisitorInterface -{ - private $inAModule = false; - private $hasMacroCalls = false; - - public function enterNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = true; - $this->hasMacroCalls = false; - } - - return $node; - } - - public function leaveNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = false; - if ($this->hasMacroCalls) { - $node->getNode('constructor_end')->setNode('_auto_macro_import', new ImportNode(new NameExpression('_self', 0), new AssignNameExpression('_self', 0), 0, 'import', true)); - } - } elseif ($this->inAModule) { - if ( - $node instanceof GetAttrExpression && - $node->getNode('node') instanceof NameExpression && - '_self' === $node->getNode('node')->getAttribute('name') && - $node->getNode('attribute') instanceof ConstantExpression - ) { - $this->hasMacroCalls = true; - - $name = $node->getNode('attribute')->getAttribute('value'); - $node = new MethodCallExpression($node->getNode('node'), 'macro_'.$name, $node->getNode('arguments'), $node->getTemplateLine()); - $node->setAttribute('safe', true); - } - } - - return $node; - } - - public function getPriority() - { - // we must be ran before auto-escaping - return -10; - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php deleted file mode 100644 index e0ffae2..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/NodeVisitorInterface.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -interface NodeVisitorInterface -{ - /** - * Called before child nodes are visited. - * - * @return Node The modified node - */ - public function enterNode(Node $node, Environment $env); - - /** - * Called after child nodes are visited. - * - * @return Node|null The modified node or null if the node must be removed - */ - public function leaveNode(Node $node, Environment $env); - - /** - * Returns the priority for this visitor. - * - * Priority should be between -10 and 10 (0 is the default). - * - * @return int The priority level - */ - public function getPriority(); -} - -class_alias('Twig\NodeVisitor\NodeVisitorInterface', 'Twig_NodeVisitorInterface'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Environment'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php deleted file mode 100644 index 9f7cae4..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php +++ /dev/null @@ -1,219 +0,0 @@ - - */ -final class OptimizerNodeVisitor extends AbstractNodeVisitor -{ - const OPTIMIZE_ALL = -1; - const OPTIMIZE_NONE = 0; - const OPTIMIZE_FOR = 2; - const OPTIMIZE_RAW_FILTER = 4; - // obsolete, does not do anything - const OPTIMIZE_VAR_ACCESS = 8; - - private $loops = []; - private $loopsTargets = []; - private $optimizers; - - /** - * @param int $optimizers The optimizer mode - */ - public function __construct(int $optimizers = -1) - { - if (!\is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) { - throw new \InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); - } - - $this->optimizers = $optimizers; - } - - protected function doEnterNode(Node $node, Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->enterOptimizeFor($node, $env); - } - - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->leaveOptimizeFor($node, $env); - } - - if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { - $node = $this->optimizeRawFilter($node, $env); - } - - $node = $this->optimizePrintNode($node, $env); - - return $node; - } - - /** - * Optimizes print nodes. - * - * It replaces: - * - * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" - */ - private function optimizePrintNode(Node $node, Environment $env): Node - { - if (!$node instanceof PrintNode) { - return $node; - } - - $exprNode = $node->getNode('expr'); - if ( - $exprNode instanceof BlockReferenceExpression || - $exprNode instanceof ParentExpression - ) { - $exprNode->setAttribute('output', true); - - return $exprNode; - } - - return $node; - } - - /** - * Removes "raw" filters. - */ - private function optimizeRawFilter(Node $node, Environment $env): Node - { - if ($node instanceof FilterExpression && 'raw' == $node->getNode('filter')->getAttribute('value')) { - return $node->getNode('node'); - } - - return $node; - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - private function enterOptimizeFor(Node $node, Environment $env) - { - if ($node instanceof ForNode) { - // disable the loop variable by default - $node->setAttribute('with_loop', false); - array_unshift($this->loops, $node); - array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); - array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); - } elseif (!$this->loops) { - // we are outside a loop - return; - } - - // when do we need to add the loop variable back? - - // the loop variable is referenced for the current loop - elseif ($node instanceof NameExpression && 'loop' === $node->getAttribute('name')) { - $node->setAttribute('always_defined', true); - $this->addLoopToCurrent(); - } - - // optimize access to loop targets - elseif ($node instanceof NameExpression && \in_array($node->getAttribute('name'), $this->loopsTargets)) { - $node->setAttribute('always_defined', true); - } - - // block reference - elseif ($node instanceof BlockReferenceNode || $node instanceof BlockReferenceExpression) { - $this->addLoopToCurrent(); - } - - // include without the only attribute - elseif ($node instanceof IncludeNode && !$node->getAttribute('only')) { - $this->addLoopToAll(); - } - - // include function without the with_context=false parameter - elseif ($node instanceof FunctionExpression - && 'include' === $node->getAttribute('name') - && (!$node->getNode('arguments')->hasNode('with_context') - || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value') - ) - ) { - $this->addLoopToAll(); - } - - // the loop variable is referenced via an attribute - elseif ($node instanceof GetAttrExpression - && (!$node->getNode('attribute') instanceof ConstantExpression - || 'parent' === $node->getNode('attribute')->getAttribute('value') - ) - && (true === $this->loops[0]->getAttribute('with_loop') - || ($node->getNode('node') instanceof NameExpression - && 'loop' === $node->getNode('node')->getAttribute('name') - ) - ) - ) { - $this->addLoopToAll(); - } - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - private function leaveOptimizeFor(Node $node, Environment $env) - { - if ($node instanceof ForNode) { - array_shift($this->loops); - array_shift($this->loopsTargets); - array_shift($this->loopsTargets); - } - } - - private function addLoopToCurrent() - { - $this->loops[0]->setAttribute('with_loop', true); - } - - private function addLoopToAll() - { - foreach ($this->loops as $loop) { - $loop->setAttribute('with_loop', true); - } - } - - public function getPriority() - { - return 255; - } -} - -class_alias('Twig\NodeVisitor\OptimizerNodeVisitor', 'Twig_NodeVisitor_Optimizer'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php deleted file mode 100644 index 02a2af4..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php +++ /dev/null @@ -1,160 +0,0 @@ -safeVars = $safeVars; - } - - public function getSafe(Node $node) - { - $hash = spl_object_hash($node); - if (!isset($this->data[$hash])) { - return; - } - - foreach ($this->data[$hash] as $bucket) { - if ($bucket['key'] !== $node) { - continue; - } - - if (\in_array('html_attr', $bucket['value'])) { - $bucket['value'][] = 'html'; - } - - return $bucket['value']; - } - } - - private function setSafe(Node $node, array $safe) - { - $hash = spl_object_hash($node); - if (isset($this->data[$hash])) { - foreach ($this->data[$hash] as &$bucket) { - if ($bucket['key'] === $node) { - $bucket['value'] = $safe; - - return; - } - } - } - $this->data[$hash][] = [ - 'key' => $node, - 'value' => $safe, - ]; - } - - protected function doEnterNode(Node $node, Environment $env) - { - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof ConstantExpression) { - // constants are marked safe for all - $this->setSafe($node, ['all']); - } elseif ($node instanceof BlockReferenceExpression) { - // blocks are safe by definition - $this->setSafe($node, ['all']); - } elseif ($node instanceof ParentExpression) { - // parent block is safe by definition - $this->setSafe($node, ['all']); - } elseif ($node instanceof ConditionalExpression) { - // intersect safeness of both operands - $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); - $this->setSafe($node, $safe); - } elseif ($node instanceof FilterExpression) { - // filter expression is safe when the filter is safe - $name = $node->getNode('filter')->getAttribute('value'); - $args = $node->getNode('arguments'); - if (false !== $filter = $env->getFilter($name)) { - $safe = $filter->getSafe($args); - if (null === $safe) { - $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); - } - $this->setSafe($node, $safe); - } else { - $this->setSafe($node, []); - } - } elseif ($node instanceof FunctionExpression) { - // function expression is safe when the function is safe - $name = $node->getAttribute('name'); - $args = $node->getNode('arguments'); - $function = $env->getFunction($name); - if (false !== $function) { - $this->setSafe($node, $function->getSafe($args)); - } else { - $this->setSafe($node, []); - } - } elseif ($node instanceof MethodCallExpression) { - if ($node->getAttribute('safe')) { - $this->setSafe($node, ['all']); - } else { - $this->setSafe($node, []); - } - } elseif ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression) { - $name = $node->getNode('node')->getAttribute('name'); - if (\in_array($name, $this->safeVars)) { - $this->setSafe($node, ['all']); - } else { - $this->setSafe($node, []); - } - } else { - $this->setSafe($node, []); - } - - return $node; - } - - private function intersectSafe(array $a = null, array $b = null): array - { - if (null === $a || null === $b) { - return []; - } - - if (\in_array('all', $a)) { - return $b; - } - - if (\in_array('all', $b)) { - return $a; - } - - return array_intersect($a, $b); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig\NodeVisitor\SafeAnalysisNodeVisitor', 'Twig_NodeVisitor_SafeAnalysis'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php deleted file mode 100644 index 3e8d0bc..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -final class SandboxNodeVisitor extends AbstractNodeVisitor -{ - private $inAModule = false; - private $tags; - private $filters; - private $functions; - - private $needsToStringWrap = false; - - protected function doEnterNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = true; - $this->tags = []; - $this->filters = []; - $this->functions = []; - - return $node; - } elseif ($this->inAModule) { - // look for tags - if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { - $this->tags[$node->getNodeTag()] = $node; - } - - // look for filters - if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { - $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; - } - - // look for functions - if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { - $this->functions[$node->getAttribute('name')] = $node; - } - - // the .. operator is equivalent to the range() function - if ($node instanceof RangeBinary && !isset($this->functions['range'])) { - $this->functions['range'] = $node; - } - - if ($node instanceof PrintNode) { - $this->needsToStringWrap = true; - $this->wrapNode($node, 'expr'); - } - - if ($node instanceof SetNode && !$node->getAttribute('capture')) { - $this->needsToStringWrap = true; - } - - // wrap outer nodes that can implicitly call __toString() - if ($this->needsToStringWrap) { - if ($node instanceof ConcatBinary) { - $this->wrapNode($node, 'left'); - $this->wrapNode($node, 'right'); - } - if ($node instanceof FilterExpression) { - $this->wrapNode($node, 'node'); - $this->wrapArrayNode($node, 'arguments'); - } - if ($node instanceof FunctionExpression) { - $this->wrapArrayNode($node, 'arguments'); - } - } - } - - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $this->inAModule = false; - - $node->getNode('constructor_end')->setNode('_security_check', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')])); - } elseif ($this->inAModule) { - if ($node instanceof PrintNode || $node instanceof SetNode) { - $this->needsToStringWrap = false; - } - } - - return $node; - } - - private function wrapNode(Node $node, string $name) - { - $expr = $node->getNode($name); - if ($expr instanceof NameExpression || $expr instanceof GetAttrExpression) { - $node->setNode($name, new CheckToStringNode($expr)); - } - } - - private function wrapArrayNode(Node $node, string $name) - { - $args = $node->getNode($name); - foreach ($args as $name => $_) { - $this->wrapNode($args, $name); - } - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig\NodeVisitor\SandboxNodeVisitor', 'Twig_NodeVisitor_Sandbox'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Parser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Parser.php deleted file mode 100644 index 8a937e3..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Parser.php +++ /dev/null @@ -1,394 +0,0 @@ - - */ -class Parser -{ - private $stack = []; - private $stream; - private $parent; - private $handlers; - private $visitors; - private $expressionParser; - private $blocks; - private $blockStack; - private $macros; - private $env; - private $importedSymbols; - private $traits; - private $embeddedTemplates = []; - private $varNameSalt = 0; - - public function __construct(Environment $env) - { - $this->env = $env; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); - } - - public function parse(TokenStream $stream, $test = null, $dropNeedle = false) - { - $vars = get_object_vars($this); - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); - $this->stack[] = $vars; - - // tag handlers - if (null === $this->handlers) { - $this->handlers = []; - foreach ($this->env->getTokenParsers() as $handler) { - $handler->setParser($this); - - $this->handlers[$handler->getTag()] = $handler; - } - } - - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); - } - - if (null === $this->expressionParser) { - $this->expressionParser = new ExpressionParser($this, $this->env); - } - - $this->stream = $stream; - $this->parent = null; - $this->blocks = []; - $this->macros = []; - $this->traits = []; - $this->blockStack = []; - $this->importedSymbols = [[]]; - $this->embeddedTemplates = []; - $this->varNameSalt = 0; - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { - $body = new Node(); - } - } catch (SyntaxError $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->stream->getSourceContext()); - } - - if (!$e->getTemplateLine()) { - $e->setTemplateLine($this->stream->getCurrent()->getLine()); - } - - throw $e; - } - - $node = new ModuleNode(new BodyNode([$body]), $this->parent, new Node($this->blocks), new Node($this->macros), new Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); - - $traverser = new NodeTraverser($this->env, $this->visitors); - - $node = $traverser->traverse($node); - - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } - - return $node; - } - - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = []; - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case /* Token::TEXT_TYPE */ 0: - $token = $this->stream->next(); - $rv[] = new TextNode($token->getValue(), $token->getLine()); - break; - - case /* Token::VAR_START_TYPE */ 2: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(/* Token::VAR_END_TYPE */ 4); - $rv[] = new PrintNode($expr, $token->getLine()); - break; - - case /* Token::BLOCK_START_TYPE */ 1: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if (/* Token::NAME_TYPE */ 5 !== $token->getType()) { - throw new SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); - } - - if (null !== $test && $test($token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === \count($rv)) { - return $rv[0]; - } - - return new Node($rv, [], $lineno); - } - - if (!isset($this->handlers[$token->getValue()])) { - if (null !== $test) { - $e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - - if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) { - $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); - } - } else { - $e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); - } - - throw $e; - } - - $this->stream->next(); - - $subparser = $this->handlers[$token->getValue()]; - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); - } - } - - if (1 === \count($rv)) { - return $rv[0]; - } - - return new Node($rv, [], $lineno); - } - - public function getBlockStack() - { - return $this->blockStack; - } - - public function peekBlockStack() - { - return isset($this->blockStack[\count($this->blockStack) - 1]) ? $this->blockStack[\count($this->blockStack) - 1] : null; - } - - public function popBlockStack() - { - array_pop($this->blockStack); - } - - public function pushBlockStack($name) - { - $this->blockStack[] = $name; - } - - public function hasBlock($name) - { - return isset($this->blocks[$name]); - } - - public function getBlock($name) - { - return $this->blocks[$name]; - } - - public function setBlock($name, BlockNode $value) - { - $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); - } - - public function hasMacro($name) - { - return isset($this->macros[$name]); - } - - public function setMacro($name, MacroNode $node) - { - $this->macros[$name] = $node; - } - - /** - * @deprecated since Twig 2.7 as there are no reserved macro names anymore, will be removed in 3.0. - */ - public function isReservedMacroName($name) - { - @trigger_error(sprintf('The "%s" method is deprecated since Twig 2.7 and will be removed in 3.0.', __METHOD__), E_USER_DEPRECATED); - - return false; - } - - public function addTrait($trait) - { - $this->traits[] = $trait; - } - - public function hasTraits() - { - return \count($this->traits) > 0; - } - - public function embedTemplate(ModuleNode $template) - { - $template->setIndex(mt_rand()); - - $this->embeddedTemplates[] = $template; - } - - public function addImportedSymbol($type, $alias, $name = null, AbstractExpression $node = null) - { - $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; - } - - public function getImportedSymbol($type, $alias) - { - // if the symbol does not exist in the current scope (0), try in the main/global scope (last index) - return $this->importedSymbols[0][$type][$alias] ?? ($this->importedSymbols[\count($this->importedSymbols) - 1][$type][$alias] ?? null); - } - - public function isMainScope() - { - return 1 === \count($this->importedSymbols); - } - - public function pushLocalScope() - { - array_unshift($this->importedSymbols, []); - } - - public function popLocalScope() - { - array_shift($this->importedSymbols); - } - - /** - * @return ExpressionParser - */ - public function getExpressionParser() - { - return $this->expressionParser; - } - - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return TokenStream - */ - public function getStream() - { - return $this->stream; - } - - /** - * @return Token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); - } - - private function filterBodyNodes(Node $node, bool $nested = false) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof TextNode && !ctype_space($node->getAttribute('data'))) - || - // the "&& !$node instanceof SpacelessNode" part of the condition must be removed in 3.0 - (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && ($node instanceof NodeOutputInterface && !$node instanceof SpacelessNode)) - ) { - if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) { - $t = substr($node->getAttribute('data'), 3); - if ('' === $t || ctype_space($t)) { - // bypass empty nodes starting with a BOM - return; - } - } - - throw new SyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - // bypass nodes that "capture" the output - if ($node instanceof NodeCaptureInterface) { - // a "block" tag in such a node will serve as a block definition AND be displayed in place as well - return $node; - } - - // to be removed completely in Twig 3.0 - if (!$nested && $node instanceof SpacelessNode) { - @trigger_error(sprintf('Using the spaceless tag at the root level of a child template in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED); - } - - // "block" tags that are not captured (see above) are only used for defining - // the content of the block. In such a case, nesting it does not work as - // expected as the definition is not part of the default template code flow. - if ($nested && ($node instanceof BlockReferenceNode || $node instanceof \Twig_Node_BlockReference)) { - //throw new SyntaxError('A block definition cannot be nested under non-capturing nodes.', $node->getTemplateLine(), $this->stream->getSourceContext()); - @trigger_error(sprintf('Nesting a block definition under a non-capturing node in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), E_USER_DEPRECATED); - - return; - } - - // the "&& !$node instanceof SpacelessNode" part of the condition must be removed in 3.0 - if ($node instanceof NodeOutputInterface && !$node instanceof SpacelessNode) { - return; - } - - // here, $nested means "being at the root level of a child template" - // we need to discard the wrapping "Twig_Node" for the "body" node - $nested = $nested || ('Twig_Node' !== \get_class($node) && Node::class !== \get_class($node)); - foreach ($node as $k => $n) { - if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { - $node->removeNode($k); - } - } - - return $node; - } -} - -class_alias('Twig\Parser', 'Twig_Parser'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BaseDumper.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BaseDumper.php deleted file mode 100644 index 1631987..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BaseDumper.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ -abstract class BaseDumper -{ - private $root; - - public function dump(Profile $profile) - { - return $this->dumpProfile($profile); - } - - abstract protected function formatTemplate(Profile $profile, $prefix); - - abstract protected function formatNonTemplate(Profile $profile, $prefix); - - abstract protected function formatTime(Profile $profile, $percent); - - private function dumpProfile(Profile $profile, $prefix = '', $sibling = false): string - { - if ($profile->isRoot()) { - $this->root = $profile->getDuration(); - $start = $profile->getName(); - } else { - if ($profile->isTemplate()) { - $start = $this->formatTemplate($profile, $prefix); - } else { - $start = $this->formatNonTemplate($profile, $prefix); - } - $prefix .= $sibling ? '│ ' : ' '; - } - - $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; - - if ($profile->getDuration() * 1000 < 1) { - $str = $start."\n"; - } else { - $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); - } - - $nCount = \count($profile->getProfiles()); - foreach ($profile as $i => $p) { - $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); - } - - return $str; - } -} - -class_alias('Twig\Profiler\Dumper\BaseDumper', 'Twig_Profiler_Dumper_Base'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php deleted file mode 100644 index f333429..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/BlackfireDumper.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ -final class BlackfireDumper -{ - public function dump(Profile $profile) - { - $data = []; - $this->dumpProfile('main()', $profile, $data); - $this->dumpChildren('main()', $profile, $data); - - $start = sprintf('%f', microtime(true)); - $str = << $values) { - $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; - } - - return $str; - } - - private function dumpChildren(string $parent, Profile $profile, &$data) - { - foreach ($profile as $p) { - if ($p->isTemplate()) { - $name = $p->getTemplate(); - } else { - $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); - } - $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); - $this->dumpChildren($name, $p, $data); - } - } - - private function dumpProfile(string $edge, Profile $profile, &$data) - { - if (isset($data[$edge])) { - ++$data[$edge]['ct']; - $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); - $data[$edge]['mu'] += $profile->getMemoryUsage(); - $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); - } else { - $data[$edge] = [ - 'ct' => 1, - 'wt' => floor($profile->getDuration() * 1000000), - 'mu' => $profile->getMemoryUsage(), - 'pmu' => $profile->getPeakMemoryUsage(), - ]; - } - } -} - -class_alias('Twig\Profiler\Dumper\BlackfireDumper', 'Twig_Profiler_Dumper_Blackfire'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/HtmlDumper.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/HtmlDumper.php deleted file mode 100644 index 5be5abe..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/HtmlDumper.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ -final class HtmlDumper extends BaseDumper -{ - private static $colors = [ - 'block' => '#dfd', - 'macro' => '#ddf', - 'template' => '#ffd', - 'big' => '#d44', - ]; - - public function dump(Profile $profile) - { - return '
    '.parent::dump($profile).'
    '; - } - - protected function formatTemplate(Profile $profile, $prefix) - { - return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); - } - - protected function formatNonTemplate(Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); - } - - protected function formatTime(Profile $profile, $percent) - { - return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); - } -} - -class_alias('Twig\Profiler\Dumper\HtmlDumper', 'Twig_Profiler_Dumper_Html'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/TextDumper.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/TextDumper.php deleted file mode 100644 index 395ef9d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Dumper/TextDumper.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -final class TextDumper extends BaseDumper -{ - protected function formatTemplate(Profile $profile, $prefix) - { - return sprintf('%s└ %s', $prefix, $profile->getTemplate()); - } - - protected function formatNonTemplate(Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); - } - - protected function formatTime(Profile $profile, $percent) - { - return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); - } -} - -class_alias('Twig\Profiler\Dumper\TextDumper', 'Twig_Profiler_Dumper_Text'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/EnterProfileNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/EnterProfileNode.php deleted file mode 100644 index 91de5ff..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/EnterProfileNode.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class EnterProfileNode extends Node -{ - public function __construct(string $extensionName, string $type, string $name, string $varName) - { - parent::__construct([], ['extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName]); - } - - public function compile(Compiler $compiler) - { - $compiler - ->write(sprintf('$%s = $this->extensions[', $this->getAttribute('var_name'))) - ->repr($this->getAttribute('extension_name')) - ->raw("];\n") - ->write(sprintf('$%s->enter($%s = new \Twig\Profiler\Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ->repr($this->getAttribute('type')) - ->raw(', ') - ->repr($this->getAttribute('name')) - ->raw("));\n\n") - ; - } -} - -class_alias('Twig\Profiler\Node\EnterProfileNode', 'Twig_Profiler_Node_EnterProfile'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/LeaveProfileNode.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/LeaveProfileNode.php deleted file mode 100644 index 7fbf435..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Node/LeaveProfileNode.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class LeaveProfileNode extends Node -{ - public function __construct(string $varName) - { - parent::__construct([], ['var_name' => $varName]); - } - - public function compile(Compiler $compiler) - { - $compiler - ->write("\n") - ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ; - } -} - -class_alias('Twig\Profiler\Node\LeaveProfileNode', 'Twig_Profiler_Node_LeaveProfile'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php deleted file mode 100644 index f19f6b7..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -final class ProfilerNodeVisitor extends AbstractNodeVisitor -{ - private $extensionName; - - public function __construct(string $extensionName) - { - $this->extensionName = $extensionName; - } - - protected function doEnterNode(Node $node, Environment $env) - { - return $node; - } - - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof ModuleNode) { - $varName = $this->getVarName(); - $node->setNode('display_start', new Node([new EnterProfileNode($this->extensionName, Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')])); - $node->setNode('display_end', new Node([new LeaveProfileNode($varName), $node->getNode('display_end')])); - } elseif ($node instanceof BlockNode) { - $varName = $this->getVarName(); - $node->setNode('body', new BodyNode([ - new EnterProfileNode($this->extensionName, Profile::BLOCK, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new LeaveProfileNode($varName), - ])); - } elseif ($node instanceof MacroNode) { - $varName = $this->getVarName(); - $node->setNode('body', new BodyNode([ - new EnterProfileNode($this->extensionName, Profile::MACRO, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new LeaveProfileNode($varName), - ])); - } - - return $node; - } - - private function getVarName(): string - { - return sprintf('__internal_%s', hash('sha256', $this->extensionName)); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig\Profiler\NodeVisitor\ProfilerNodeVisitor', 'Twig_Profiler_NodeVisitor_Profiler'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Profile.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Profile.php deleted file mode 100644 index e9726d6..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Profiler/Profile.php +++ /dev/null @@ -1,192 +0,0 @@ - - * - * @final since Twig 2.4.0 - */ -class Profile implements \IteratorAggregate, \Serializable -{ - const ROOT = 'ROOT'; - const BLOCK = 'block'; - const TEMPLATE = 'template'; - const MACRO = 'macro'; - - private $template; - private $name; - private $type; - private $starts = []; - private $ends = []; - private $profiles = []; - - public function __construct(string $template = 'main', string $type = self::ROOT, string $name = 'main') - { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->template = $template; - $this->type = $type; - $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; - $this->enter(); - } - - public function getTemplate() - { - return $this->template; - } - - public function getType() - { - return $this->type; - } - - public function getName() - { - return $this->name; - } - - public function isRoot() - { - return self::ROOT === $this->type; - } - - public function isTemplate() - { - return self::TEMPLATE === $this->type; - } - - public function isBlock() - { - return self::BLOCK === $this->type; - } - - public function isMacro() - { - return self::MACRO === $this->type; - } - - public function getProfiles() - { - return $this->profiles; - } - - public function addProfile(self $profile) - { - $this->profiles[] = $profile; - } - - /** - * Returns the duration in microseconds. - * - * @return float - */ - public function getDuration() - { - if ($this->isRoot() && $this->profiles) { - // for the root node with children, duration is the sum of all child durations - $duration = 0; - foreach ($this->profiles as $profile) { - $duration += $profile->getDuration(); - } - - return $duration; - } - - return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; - } - - /** - * Returns the memory usage in bytes. - * - * @return int - */ - public function getMemoryUsage() - { - return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; - } - - /** - * Returns the peak memory usage in bytes. - * - * @return int - */ - public function getPeakMemoryUsage() - { - return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; - } - - /** - * Starts the profiling. - */ - public function enter() - { - $this->starts = [ - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ]; - } - - /** - * Stops the profiling. - */ - public function leave() - { - $this->ends = [ - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ]; - } - - public function reset() - { - $this->starts = $this->ends = $this->profiles = []; - $this->enter(); - } - - public function getIterator() - { - return new \ArrayIterator($this->profiles); - } - - public function serialize() - { - return serialize($this->__serialize()); - } - - public function unserialize($data) - { - $this->__unserialize(unserialize($data)); - } - - /** - * @internal - */ - public function __serialize() - { - return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles]; - } - - /** - * @internal - */ - public function __unserialize(array $data) - { - list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data; - } -} - -class_alias('Twig\Profiler\Profile', 'Twig_Profiler_Profile'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php deleted file mode 100644 index 04a6602..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @author Robin Chalas - */ -class ContainerRuntimeLoader implements RuntimeLoaderInterface -{ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - public function load($class) - { - if ($this->container->has($class)) { - return $this->container->get($class); - } - } -} - -class_alias('Twig\RuntimeLoader\ContainerRuntimeLoader', 'Twig_ContainerRuntimeLoader'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php deleted file mode 100644 index e4676f7..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class FactoryRuntimeLoader implements RuntimeLoaderInterface -{ - private $map; - - /** - * @param array $map An array where keys are class names and values factory callables - */ - public function __construct(array $map = []) - { - $this->map = $map; - } - - public function load($class) - { - if (isset($this->map[$class])) { - $runtimeFactory = $this->map[$class]; - - return $runtimeFactory(); - } - } -} - -class_alias('Twig\RuntimeLoader\FactoryRuntimeLoader', 'Twig_FactoryRuntimeLoader'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php deleted file mode 100644 index 4eb5ad8..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -interface RuntimeLoaderInterface -{ - /** - * Creates the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class - * - * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class - */ - public function load($class); -} - -class_alias('Twig\RuntimeLoader\RuntimeLoaderInterface', 'Twig_RuntimeLoaderInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityError.php deleted file mode 100644 index 5f96d46..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityError.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ -class SecurityError extends Error -{ -} - -class_alias('Twig\Sandbox\SecurityError', 'Twig_Sandbox_SecurityError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php deleted file mode 100644 index 767ec5b..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * @final - */ -class SecurityNotAllowedFilterError extends SecurityError -{ - private $filterName; - - public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) - { - if (-1 !== $lineno) { - @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $filename) { - @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $previous) { - @trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - parent::__construct($message, $lineno, $filename, $previous); - $this->filterName = $functionName; - } - - public function getFilterName() - { - return $this->filterName; - } -} - -class_alias('Twig\Sandbox\SecurityNotAllowedFilterError', 'Twig_Sandbox_SecurityNotAllowedFilterError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php deleted file mode 100644 index 5a30139..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * @final - */ -class SecurityNotAllowedFunctionError extends SecurityError -{ - private $functionName; - - public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) - { - if (-1 !== $lineno) { - @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $filename) { - @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $previous) { - @trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - parent::__construct($message, $lineno, $filename, $previous); - $this->functionName = $functionName; - } - - public function getFunctionName() - { - return $this->functionName; - } -} - -class_alias('Twig\Sandbox\SecurityNotAllowedFunctionError', 'Twig_Sandbox_SecurityNotAllowedFunctionError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php deleted file mode 100644 index c8103ea..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * @final - */ -class SecurityNotAllowedMethodError extends SecurityError -{ - private $className; - private $methodName; - - public function __construct(string $message, string $className, string $methodName, int $lineno = -1, string $filename = null, \Exception $previous = null) - { - if (-1 !== $lineno) { - @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $filename) { - @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $previous) { - @trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->methodName = $methodName; - } - - public function getClassName() - { - return $this->className; - } - - public function getMethodName() - { - return $this->methodName; - } -} - -class_alias('Twig\Sandbox\SecurityNotAllowedMethodError', 'Twig_Sandbox_SecurityNotAllowedMethodError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php deleted file mode 100644 index d148f08..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * @final - */ -class SecurityNotAllowedPropertyError extends SecurityError -{ - private $className; - private $propertyName; - - public function __construct(string $message, string $className, string $propertyName, int $lineno = -1, string $filename = null, \Exception $previous = null) - { - if (-1 !== $lineno) { - @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $filename) { - @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $previous) { - @trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->propertyName = $propertyName; - } - - public function getClassName() - { - return $this->className; - } - - public function getPropertyName() - { - return $this->propertyName; - } -} - -class_alias('Twig\Sandbox\SecurityNotAllowedPropertyError', 'Twig_Sandbox_SecurityNotAllowedPropertyError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php deleted file mode 100644 index 25f6361..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * @final - */ -class SecurityNotAllowedTagError extends SecurityError -{ - private $tagName; - - public function __construct(string $message, string $tagName, int $lineno = -1, string $filename = null, \Exception $previous = null) - { - if (-1 !== $lineno) { - @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $filename) { - @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - if (null !== $previous) { - @trigger_error(sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); - } - parent::__construct($message, $lineno, $filename, $previous); - $this->tagName = $tagName; - } - - public function getTagName() - { - return $this->tagName; - } -} - -class_alias('Twig\Sandbox\SecurityNotAllowedTagError', 'Twig_Sandbox_SecurityNotAllowedTagError'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicy.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicy.php deleted file mode 100644 index 1406e80..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicy.php +++ /dev/null @@ -1,128 +0,0 @@ - - */ -final class SecurityPolicy implements SecurityPolicyInterface -{ - private $allowedTags; - private $allowedFilters; - private $allowedMethods; - private $allowedProperties; - private $allowedFunctions; - - public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) - { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; - $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; - } - - public function setAllowedTags(array $tags) - { - $this->allowedTags = $tags; - } - - public function setAllowedFilters(array $filters) - { - $this->allowedFilters = $filters; - } - - public function setAllowedMethods(array $methods) - { - $this->allowedMethods = []; - foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); - } - } - - public function setAllowedProperties(array $properties) - { - $this->allowedProperties = $properties; - } - - public function setAllowedFunctions(array $functions) - { - $this->allowedFunctions = $functions; - } - - public function checkSecurity($tags, $filters, $functions) - { - foreach ($tags as $tag) { - if (!\in_array($tag, $this->allowedTags)) { - throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); - } - } - - foreach ($filters as $filter) { - if (!\in_array($filter, $this->allowedFilters)) { - throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); - } - } - - foreach ($functions as $function) { - if (!\in_array($function, $this->allowedFunctions)) { - throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); - } - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($obj instanceof Template || $obj instanceof Markup) { - return; - } - - $allowed = false; - $method = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); - foreach ($this->allowedMethods as $class => $methods) { - if ($obj instanceof $class) { - $allowed = \in_array($method, $methods); - - break; - } - } - - if (!$allowed) { - $class = \get_class($obj); - throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); - } - } - - public function checkPropertyAllowed($obj, $property) - { - $allowed = false; - foreach ($this->allowedProperties as $class => $properties) { - if ($obj instanceof $class) { - $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); - - break; - } - } - - if (!$allowed) { - $class = \get_class($obj); - throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); - } - } -} - -class_alias('Twig\Sandbox\SecurityPolicy', 'Twig_Sandbox_SecurityPolicy'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicyInterface.php deleted file mode 100644 index 8b2ab4a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Sandbox/SecurityPolicyInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -interface SecurityPolicyInterface -{ - /** - * @throws SecurityError - */ - public function checkSecurity($tags, $filters, $functions); - - /** - * @throws SecurityNotAllowedMethodError - */ - public function checkMethodAllowed($obj, $method); - - /** - * @throws SecurityNotAllowedPropertyError - */ - public function checkPropertyAllowed($obj, $method); -} - -class_alias('Twig\Sandbox\SecurityPolicyInterface', 'Twig_Sandbox_SecurityPolicyInterface'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Source.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Source.php deleted file mode 100644 index a728778..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Source.php +++ /dev/null @@ -1,53 +0,0 @@ - - */ -final class Source -{ - private $code; - private $name; - private $path; - - /** - * @param string $code The template source code - * @param string $name The template logical name - * @param string $path The filesystem path of the template if any - */ - public function __construct(string $code, string $name, string $path = '') - { - $this->code = $code; - $this->name = $name; - $this->path = $path; - } - - public function getCode(): string - { - return $this->code; - } - - public function getName() - { - return $this->name; - } - - public function getPath(): string - { - return $this->path; - } -} - -class_alias('Twig\Source', 'Twig_Source'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Template.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Template.php deleted file mode 100644 index 0f09e19..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Template.php +++ /dev/null @@ -1,437 +0,0 @@ -load() - * instead, which returns an instance of \Twig\TemplateWrapper. - * - * @author Fabien Potencier - * - * @internal - */ -abstract class Template -{ - const ANY_CALL = 'any'; - const ARRAY_CALL = 'array'; - const METHOD_CALL = 'method'; - - protected $parent; - protected $parents = []; - protected $env; - protected $blocks = []; - protected $traits = []; - protected $extensions = []; - protected $sandbox; - - public function __construct(Environment $env) - { - $this->env = $env; - $this->extensions = $env->getExtensions(); - } - - /** - * @internal this method will be removed in 3.0 and is only used internally to provide an upgrade path from 1.x to 2.0 - */ - public function __toString() - { - return $this->getTemplateName(); - } - - /** - * Returns the template name. - * - * @return string The template name - */ - abstract public function getTemplateName(); - - /** - * Returns debug information about the template. - * - * @return array Debug information - */ - abstract public function getDebugInfo(); - - /** - * Returns information about the original template source code. - * - * @return Source - */ - public function getSourceContext() - { - return new Source('', $this->getTemplateName()); - } - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @param array $context - * - * @return Template|TemplateWrapper|false The parent template or false if there is no parent - */ - public function getParent(array $context) - { - if (null !== $this->parent) { - return $this->parent; - } - - try { - $parent = $this->doGetParent($context); - - if (false === $parent) { - return false; - } - - if ($parent instanceof self || $parent instanceof TemplateWrapper) { - return $this->parents[$parent->getSourceContext()->getName()] = $parent; - } - - if (!isset($this->parents[$parent])) { - $this->parents[$parent] = $this->loadTemplate($parent); - } - } catch (LoaderError $e) { - $e->setSourceContext(null); - $e->guess(); - - throw $e; - } - - return $this->parents[$parent]; - } - - protected function doGetParent(array $context) - { - return false; - } - - public function isTraitable() - { - return true; - } - - /** - * Displays a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - */ - public function displayParentBlock($name, array $context, array $blocks = []) - { - if (isset($this->traits[$name])) { - $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, $blocks, false); - } else { - throw new RuntimeError(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); - } - } - - /** - * Displays a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - */ - public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true, self $templateContext = null) - { - if ($useBlocks && isset($blocks[$name])) { - $template = $blocks[$name][0]; - $block = $blocks[$name][1]; - } elseif (isset($this->blocks[$name])) { - $template = $this->blocks[$name][0]; - $block = $this->blocks[$name][1]; - } else { - $template = null; - $block = null; - } - - // avoid RCEs when sandbox is enabled - if (null !== $template && !$template instanceof self) { - throw new \LogicException('A block must be a method on a \Twig\Template instance.'); - } - - if (null !== $template) { - try { - $template->$block($context, $blocks); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($template->getSourceContext()); - } - - // this is mostly useful for \Twig\Error\LoaderError exceptions - // see \Twig\Error\LoaderError - if (-1 === $e->getTemplateLine()) { - $e->guess(); - } - - throw $e; - } catch (\Exception $e) { - $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); - $e->guess(); - - throw $e; - } - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false, $templateContext ?? $this); - } elseif (isset($blocks[$name])) { - throw new RuntimeError(sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getSourceContext()); - } else { - throw new RuntimeError(sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, ($templateContext ?? $this)->getSourceContext()); - } - } - - /** - * Renders a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - */ - public function renderParentBlock($name, array $context, array $blocks = []) - { - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Renders a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @return string The rendered block - */ - public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true) - { - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - $this->displayBlock($name, $context, $blocks, $useBlocks); - - return ob_get_clean(); - } - - /** - * Returns whether a block exists or not in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param string $name The block name - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return bool true if the block exists, false otherwise - */ - public function hasBlock($name, array $context, array $blocks = []) - { - if (isset($blocks[$name])) { - return $blocks[$name][0] instanceof self; - } - - if (isset($this->blocks[$name])) { - return true; - } - - if (false !== $parent = $this->getParent($context)) { - return $parent->hasBlock($name, $context); - } - - return false; - } - - /** - * Returns all block names in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return array An array of block names - */ - public function getBlockNames(array $context, array $blocks = []) - { - $names = array_merge(array_keys($blocks), array_keys($this->blocks)); - - if (false !== $parent = $this->getParent($context)) { - $names = array_merge($names, $parent->getBlockNames($context)); - } - - return array_unique($names); - } - - /** - * @return Template|TemplateWrapper - */ - protected function loadTemplate($template, $templateName = null, $line = null, $index = null) - { - try { - if (\is_array($template)) { - return $this->env->resolveTemplate($template); - } - - if ($template instanceof self || $template instanceof TemplateWrapper) { - return $template; - } - - if ($template === $this->getTemplateName()) { - $class = \get_class($this); - if (false !== $pos = strrpos($class, '___', -1)) { - $class = substr($class, 0, $pos); - } - - return $this->env->loadClass($class, $template, $index); - } - - return $this->env->loadTemplate($template, $index); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); - } - - if ($e->getTemplateLine() > 0) { - throw $e; - } - - if (!$line) { - $e->guess(); - } else { - $e->setTemplateLine($line); - } - - throw $e; - } - } - - /** - * @internal - * - * @return Template - */ - protected function unwrap() - { - return $this; - } - - /** - * Returns all blocks. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of blocks - */ - public function getBlocks() - { - return $this->blocks; - } - - public function display(array $context, array $blocks = []) - { - $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); - } - - public function render(array $context) - { - $level = ob_get_level(); - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - try { - $this->display($context); - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - protected function displayWithErrorHandling(array $context, array $blocks = []) - { - try { - $this->doDisplay($context, $blocks); - } catch (Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->getSourceContext()); - } - - // this is mostly useful for \Twig\Error\LoaderError exceptions - // see \Twig\Error\LoaderError - if (-1 === $e->getTemplateLine()) { - $e->guess(); - } - - throw $e; - } catch (\Exception $e) { - $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); - $e->guess(); - - throw $e; - } - } - - /** - * Auto-generated method to display the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - abstract protected function doDisplay(array $context, array $blocks = []); -} - -class_alias('Twig\Template', 'Twig_Template'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TemplateWrapper.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TemplateWrapper.php deleted file mode 100644 index 8b44815..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TemplateWrapper.php +++ /dev/null @@ -1,145 +0,0 @@ - - */ -final class TemplateWrapper -{ - private $env; - private $template; - - /** - * This method is for internal use only and should never be called - * directly (use Twig\Environment::load() instead). - * - * @internal - */ - public function __construct(Environment $env, Template $template) - { - $this->env = $env; - $this->template = $template; - } - - /** - * Renders the template. - * - * @param array $context An array of parameters to pass to the template - */ - public function render(array $context = []): string - { - // using func_get_args() allows to not expose the blocks argument - // as it should only be used by internal code - return $this->template->render($context, \func_get_args()[1] ?? []); - } - - /** - * Displays the template. - * - * @param array $context An array of parameters to pass to the template - */ - public function display(array $context = []) - { - // using func_get_args() allows to not expose the blocks argument - // as it should only be used by internal code - $this->template->display($context, \func_get_args()[1] ?? []); - } - - /** - * Checks if a block is defined. - * - * @param string $name The block name - * @param array $context An array of parameters to pass to the template - */ - public function hasBlock(string $name, array $context = []): bool - { - return $this->template->hasBlock($name, $context); - } - - /** - * Returns defined block names in the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string[] An array of defined template block names - */ - public function getBlockNames(array $context = []): array - { - return $this->template->getBlockNames($context); - } - - /** - * Renders a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered block - */ - public function renderBlock(string $name, array $context = []): string - { - $context = $this->env->mergeGlobals($context); - $level = ob_get_level(); - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - try { - $this->template->displayBlock($name, $context); - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - /** - * Displays a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - */ - public function displayBlock(string $name, array $context = []) - { - $this->template->displayBlock($name, $this->env->mergeGlobals($context)); - } - - public function getSourceContext(): Source - { - return $this->template->getSourceContext(); - } - - public function getTemplateName(): string - { - return $this->template->getTemplateName(); - } - - /** - * @internal - * - * @return Template - */ - public function unwrap() - { - return $this->template; - } -} - -class_alias('Twig\TemplateWrapper', 'Twig_TemplateWrapper'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/IntegrationTestCase.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/IntegrationTestCase.php deleted file mode 100644 index d9c3290..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/IntegrationTestCase.php +++ /dev/null @@ -1,267 +0,0 @@ - - * @author Karma Dordrak - */ -abstract class IntegrationTestCase extends TestCase -{ - /** - * @return string - */ - abstract protected function getFixturesDir(); - - /** - * @return RuntimeLoaderInterface[] - */ - protected function getRuntimeLoaders() - { - return []; - } - - /** - * @return ExtensionInterface[] - */ - protected function getExtensions() - { - return []; - } - - /** - * @return TwigFilter[] - */ - protected function getTwigFilters() - { - return []; - } - - /** - * @return TwigFunction[] - */ - protected function getTwigFunctions() - { - return []; - } - - /** - * @return TwigTest[] - */ - protected function getTwigTests() - { - return []; - } - - /** - * @dataProvider getTests - */ - public function testIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); - } - - /** - * @dataProvider getLegacyTests - * @group legacy - */ - public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); - } - - public function getTests($name, $legacyTests = false) - { - $fixturesDir = realpath($this->getFixturesDir()); - $tests = []; - - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!preg_match('/\.test$/', $file)) { - continue; - } - - if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) { - continue; - } - - $test = file_get_contents($file->getRealpath()); - - if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*(?:--DEPRECATION--\s*(.*?))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $deprecation = $match[3]; - $templates = self::parseTemplates($match[4]); - $exception = $match[6]; - $outputs = [[null, $match[5], null, '']]; - } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*(?:--DEPRECATION--\s*(.*?))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $deprecation = $match[3]; - $templates = self::parseTemplates($match[4]); - $exception = false; - preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); - } else { - throw new \InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); - } - - $tests[] = [str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs, $deprecation]; - } - - if ($legacyTests && empty($tests)) { - // add a dummy test to avoid a PHPUnit message - return [['not', '-', '', [], '', []]]; - } - - return $tests; - } - - public function getLegacyTests() - { - return $this->getTests('testLegacyIntegration', true); - } - - protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') - { - if (!$outputs) { - $this->markTestSkipped('no tests to run'); - } - - if ($condition) { - eval('$ret = '.$condition.';'); - if (!$ret) { - $this->markTestSkipped($condition); - } - } - - $loader = new ArrayLoader($templates); - - foreach ($outputs as $i => $match) { - $config = array_merge([ - 'cache' => false, - 'strict_variables' => true, - ], $match[2] ? eval($match[2].';') : []); - $twig = new Environment($loader, $config); - $twig->addGlobal('global', 'global'); - foreach ($this->getRuntimeLoaders() as $runtimeLoader) { - $twig->addRuntimeLoader($runtimeLoader); - } - - foreach ($this->getExtensions() as $extension) { - $twig->addExtension($extension); - } - - foreach ($this->getTwigFilters() as $filter) { - $twig->addFilter($filter); - } - - foreach ($this->getTwigTests() as $test) { - $twig->addTest($test); - } - - foreach ($this->getTwigFunctions() as $function) { - $twig->addFunction($function); - } - - // avoid using the same PHP class name for different cases - $p = new \ReflectionProperty($twig, 'templateClassPrefix'); - $p->setAccessible(true); - $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); - - $deprecations = []; - try { - $prevHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$prevHandler) { - if (E_USER_DEPRECATED === $type) { - $deprecations[] = $msg; - - return true; - } - - return $prevHandler ? $prevHandler($type, $msg, $file, $line, $context) : false; - }); - - $template = $twig->load('index.twig'); - } catch (\Exception $e) { - if (false !== $exception) { - $message = $e->getMessage(); - $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $message))); - $last = substr($message, \strlen($message) - 1); - $this->assertTrue('.' === $last || '?' === $last, 'Exception message must end with a dot or a question mark.'); - - return; - } - - throw new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); - } finally { - restore_error_handler(); - } - - $this->assertSame($deprecation, implode("\n", $deprecations)); - - try { - $output = trim($template->render(eval($match[1].';')), "\n "); - } catch (\Exception $e) { - if (false !== $exception) { - $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $e->getMessage()))); - - return; - } - - $e = new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); - - $output = trim(sprintf('%s: %s', \get_class($e), $e->getMessage())); - } - - if (false !== $exception) { - list($class) = explode(':', $exception); - $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; - $this->assertThat(null, new $constraintClass($class)); - } - - $expected = trim($match[3], "\n "); - - if ($expected !== $output) { - printf("Compiled templates that failed on case %d:\n", $i + 1); - - foreach (array_keys($templates) as $name) { - echo "Template: $name\n"; - echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); - } - } - $this->assertEquals($expected, $output, $message.' (in '.$file.')'); - } - } - - protected static function parseTemplates($test) - { - $templates = []; - preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; - } - - return $templates; - } -} - -class_alias('Twig\Test\IntegrationTestCase', 'Twig_Test_IntegrationTestCase'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/NodeTestCase.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/NodeTestCase.php deleted file mode 100644 index 368ceb1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Test/NodeTestCase.php +++ /dev/null @@ -1,67 +0,0 @@ -assertNodeCompilation($source, $node, $environment, $isPattern); - } - - public function assertNodeCompilation($source, Node $node, Environment $environment = null, $isPattern = false) - { - $compiler = $this->getCompiler($environment); - $compiler->compile($node); - - if ($isPattern) { - $this->assertStringMatchesFormat($source, trim($compiler->getSource())); - } else { - $this->assertEquals($source, trim($compiler->getSource())); - } - } - - protected function getCompiler(Environment $environment = null) - { - return new Compiler(null === $environment ? $this->getEnvironment() : $environment); - } - - protected function getEnvironment() - { - return new Environment(new ArrayLoader([])); - } - - protected function getVariableGetter($name, $line = false) - { - $line = $line > 0 ? "// line {$line}\n" : ''; - - return sprintf('%s($context["%s"] ?? null)', $line, $name); - } - - protected function getAttributeGetter() - { - return 'twig_get_attribute($this->env, $this->source, '; - } -} - -class_alias('Twig\Test\NodeTestCase', 'Twig_Test_NodeTestCase'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Token.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Token.php deleted file mode 100644 index 262fa48..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Token.php +++ /dev/null @@ -1,213 +0,0 @@ - - */ -final class Token -{ - private $value; - private $type; - private $lineno; - - const EOF_TYPE = -1; - const TEXT_TYPE = 0; - const BLOCK_START_TYPE = 1; - const VAR_START_TYPE = 2; - const BLOCK_END_TYPE = 3; - const VAR_END_TYPE = 4; - const NAME_TYPE = 5; - const NUMBER_TYPE = 6; - const STRING_TYPE = 7; - const OPERATOR_TYPE = 8; - const PUNCTUATION_TYPE = 9; - const INTERPOLATION_START_TYPE = 10; - const INTERPOLATION_END_TYPE = 11; - const ARROW_TYPE = 12; - - /** - * @param int $type The type of the token - * @param string $value The token value - * @param int $lineno The line position in the source - */ - public function __construct($type, $value, $lineno) - { - $this->type = $type; - $this->value = $value; - $this->lineno = $lineno; - } - - public function __toString() - { - return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value); - } - - /** - * Tests the current token for a type and/or a value. - * - * Parameters may be: - * * just type - * * type and value (or array of possible values) - * * just value (or array of possible values) (NAME_TYPE is used as type) - * - * @param array|string|int $type The type to test - * @param array|string|null $values The token value - * - * @return bool - */ - public function test($type, $values = null) - { - if (null === $values && !\is_int($type)) { - $values = $type; - $type = self::NAME_TYPE; - } - - return ($this->type === $type) && ( - null === $values || - (\is_array($values) && \in_array($this->value, $values)) || - $this->value == $values - ); - } - - /** - * @return int - */ - public function getLine() - { - return $this->lineno; - } - - /** - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Returns the constant representation (internal) of a given type. - * - * @param int $type The type as an integer - * @param bool $short Whether to return a short representation or not - * - * @return string The string representation - */ - public static function typeToString($type, $short = false) - { - switch ($type) { - case self::EOF_TYPE: - $name = 'EOF_TYPE'; - break; - case self::TEXT_TYPE: - $name = 'TEXT_TYPE'; - break; - case self::BLOCK_START_TYPE: - $name = 'BLOCK_START_TYPE'; - break; - case self::VAR_START_TYPE: - $name = 'VAR_START_TYPE'; - break; - case self::BLOCK_END_TYPE: - $name = 'BLOCK_END_TYPE'; - break; - case self::VAR_END_TYPE: - $name = 'VAR_END_TYPE'; - break; - case self::NAME_TYPE: - $name = 'NAME_TYPE'; - break; - case self::NUMBER_TYPE: - $name = 'NUMBER_TYPE'; - break; - case self::STRING_TYPE: - $name = 'STRING_TYPE'; - break; - case self::OPERATOR_TYPE: - $name = 'OPERATOR_TYPE'; - break; - case self::PUNCTUATION_TYPE: - $name = 'PUNCTUATION_TYPE'; - break; - case self::INTERPOLATION_START_TYPE: - $name = 'INTERPOLATION_START_TYPE'; - break; - case self::INTERPOLATION_END_TYPE: - $name = 'INTERPOLATION_END_TYPE'; - break; - case self::ARROW_TYPE: - $name = 'ARROW_TYPE'; - break; - default: - throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - - return $short ? $name : 'Twig\Token::'.$name; - } - - /** - * Returns the English representation of a given type. - * - * @param int $type The type as an integer - * - * @return string The string representation - */ - public static function typeToEnglish($type) - { - switch ($type) { - case self::EOF_TYPE: - return 'end of template'; - case self::TEXT_TYPE: - return 'text'; - case self::BLOCK_START_TYPE: - return 'begin of statement block'; - case self::VAR_START_TYPE: - return 'begin of print statement'; - case self::BLOCK_END_TYPE: - return 'end of statement block'; - case self::VAR_END_TYPE: - return 'end of print statement'; - case self::NAME_TYPE: - return 'name'; - case self::NUMBER_TYPE: - return 'number'; - case self::STRING_TYPE: - return 'string'; - case self::OPERATOR_TYPE: - return 'operator'; - case self::PUNCTUATION_TYPE: - return 'punctuation'; - case self::INTERPOLATION_START_TYPE: - return 'begin of string interpolation'; - case self::INTERPOLATION_END_TYPE: - return 'end of string interpolation'; - case self::ARROW_TYPE: - return 'arrow function'; - default: - throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - } -} - -class_alias('Twig\Token', 'Twig_Token'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AbstractTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AbstractTokenParser.php deleted file mode 100644 index 2c2f90b..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AbstractTokenParser.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -abstract class AbstractTokenParser implements TokenParserInterface -{ - /** - * @var Parser - */ - protected $parser; - - public function setParser(Parser $parser) - { - $this->parser = $parser; - } -} - -class_alias('Twig\TokenParser\AbstractTokenParser', 'Twig_TokenParser'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ApplyTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ApplyTokenParser.php deleted file mode 100644 index 879879a..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ApplyTokenParser.php +++ /dev/null @@ -1,58 +0,0 @@ -getLine(); - $name = $this->parser->getVarName(); - - $ref = new TempNameExpression($name, $lineno); - $ref->setAttribute('always_defined', true); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse([$this, 'decideApplyEnd'], true); - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new Node([ - new SetNode(true, $ref, $body, $lineno, $this->getTag()), - new PrintNode($filter, $lineno, $this->getTag()), - ]); - } - - public function decideApplyEnd(Token $token) - { - return $token->test('endapply'); - } - - public function getTag() - { - return 'apply'; - } -} diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php deleted file mode 100644 index 10fdb81..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/AutoEscapeTokenParser.php +++ /dev/null @@ -1,57 +0,0 @@ -getLine(); - $stream = $this->parser->getStream(); - - if ($stream->test(/* Token::BLOCK_END_TYPE */ 3)) { - $value = 'html'; - } else { - $expr = $this->parser->getExpressionParser()->parseExpression(); - if (!$expr instanceof ConstantExpression) { - throw new SyntaxError('An escaping strategy must be a string or false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $value = $expr->getAttribute('value'); - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new AutoEscapeNode($value, $body, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endautoescape'); - } - - public function getTag() - { - return 'autoescape'; - } -} - -class_alias('Twig\TokenParser\AutoEscapeTokenParser', 'Twig_TokenParser_AutoEscape'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/BlockTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/BlockTokenParser.php deleted file mode 100644 index 449a2c0..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/BlockTokenParser.php +++ /dev/null @@ -1,78 +0,0 @@ - - * {% block title %}{% endblock %} - My Webpage - * {% endblock %} - */ -final class BlockTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - if ($this->parser->hasBlock($name)) { - throw new SyntaxError(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $this->parser->setBlock($name, $block = new BlockNode($name, new Node([]), $lineno)); - $this->parser->pushLocalScope(); - $this->parser->pushBlockStack($name); - - if ($stream->nextIf(/* Token::BLOCK_END_TYPE */ 3)) { - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new SyntaxError(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - } else { - $body = new Node([ - new PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno), - ]); - } - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $block->setNode('body', $body); - $this->parser->popBlockStack(); - $this->parser->popLocalScope(); - - return new BlockReferenceNode($name, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endblock'); - } - - public function getTag() - { - return 'block'; - } -} - -class_alias('Twig\TokenParser\BlockTokenParser', 'Twig_TokenParser_Block'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DeprecatedTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DeprecatedTokenParser.php deleted file mode 100644 index 6575cff..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DeprecatedTokenParser.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * @final - */ -class DeprecatedTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new DeprecatedNode($expr, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'deprecated'; - } -} - -class_alias('Twig\TokenParser\DeprecatedTokenParser', 'Twig_TokenParser_Deprecated'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DoTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DoTokenParser.php deleted file mode 100644 index e5a07d6..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/DoTokenParser.php +++ /dev/null @@ -1,37 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new DoNode($expr, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'do'; - } -} - -class_alias('Twig\TokenParser\DoTokenParser', 'Twig_TokenParser_Do'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/EmbedTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/EmbedTokenParser.php deleted file mode 100644 index 83a545e..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/EmbedTokenParser.php +++ /dev/null @@ -1,72 +0,0 @@ -parser->getStream(); - - $parent = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - $parentToken = $fakeParentToken = new Token(/* Token::STRING_TYPE */ 7, '__parent__', $token->getLine()); - if ($parent instanceof ConstantExpression) { - $parentToken = new Token(/* Token::STRING_TYPE */ 7, $parent->getAttribute('value'), $token->getLine()); - } elseif ($parent instanceof NameExpression) { - $parentToken = new Token(/* Token::NAME_TYPE */ 5, $parent->getAttribute('name'), $token->getLine()); - } - - // inject a fake parent to make the parent() function work - $stream->injectTokens([ - new Token(/* Token::BLOCK_START_TYPE */ 1, '', $token->getLine()), - new Token(/* Token::NAME_TYPE */ 5, 'extends', $token->getLine()), - $parentToken, - new Token(/* Token::BLOCK_END_TYPE */ 3, '', $token->getLine()), - ]); - - $module = $this->parser->parse($stream, [$this, 'decideBlockEnd'], true); - - // override the parent with the correct one - if ($fakeParentToken === $parentToken) { - $module->setNode('parent', $parent); - } - - $this->parser->embedTemplate($module); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endembed'); - } - - public function getTag() - { - return 'embed'; - } -} - -class_alias('Twig\TokenParser\EmbedTokenParser', 'Twig_TokenParser_Embed'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ExtendsTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ExtendsTokenParser.php deleted file mode 100644 index a44980f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ExtendsTokenParser.php +++ /dev/null @@ -1,52 +0,0 @@ -parser->getStream(); - - if ($this->parser->peekBlockStack()) { - throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); - } elseif (!$this->parser->isMainScope()) { - throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); - } - - if (null !== $this->parser->getParent()) { - throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); - } - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); - - $stream->expect(Token::BLOCK_END_TYPE); - - return new Node(); - } - - public function getTag() - { - return 'extends'; - } -} - -class_alias('Twig\TokenParser\ExtendsTokenParser', 'Twig_TokenParser_Extends'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FilterTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FilterTokenParser.php deleted file mode 100644 index e57fc90..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FilterTokenParser.php +++ /dev/null @@ -1,64 +0,0 @@ -parser->getStream(); - $lineno = $token->getLine(); - - @trigger_error(sprintf('The "filter" tag in "%s" at line %d is deprecated since Twig 2.9, use the "apply" tag instead.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); - - $name = $this->parser->getVarName(); - $ref = new BlockReferenceExpression(new ConstantExpression($name, $lineno), null, $lineno, $this->getTag()); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $block = new BlockNode($name, $body, $lineno); - $this->parser->setBlock($name, $block); - - return new PrintNode($filter, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endfilter'); - } - - public function getTag() - { - return 'filter'; - } -} - -class_alias('Twig\TokenParser\FilterTokenParser', 'Twig_TokenParser_Filter'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FlushTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FlushTokenParser.php deleted file mode 100644 index 70f4339..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FlushTokenParser.php +++ /dev/null @@ -1,37 +0,0 @@ -parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new FlushNode($token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'flush'; - } -} - -class_alias('Twig\TokenParser\FlushTokenParser', 'Twig_TokenParser_Flush'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ForTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ForTokenParser.php deleted file mode 100644 index 34430f0..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ForTokenParser.php +++ /dev/null @@ -1,137 +0,0 @@ - - * {% for user in users %} - *
  • {{ user.username|e }}
  • - * {% endfor %} - * - */ -final class ForTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); - $stream->expect(/* Token::OPERATOR_TYPE */ 8, 'in'); - $seq = $this->parser->getExpressionParser()->parseExpression(); - - $ifexpr = null; - if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'if')) { - @trigger_error(sprintf('Using an "if" condition on "for" tag in "%s" at line %d is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop).', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); - - $ifexpr = $this->parser->getExpressionParser()->parseExpression(); - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideForFork']); - if ('else' == $stream->next()->getValue()) { - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $else = $this->parser->subparse([$this, 'decideForEnd'], true); - } else { - $else = null; - } - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - if (\count($targets) > 1) { - $keyTarget = $targets->getNode(0); - $keyTarget = new AssignNameExpression($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); - $valueTarget = $targets->getNode(1); - $valueTarget = new AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } else { - $keyTarget = new AssignNameExpression('_key', $lineno); - $valueTarget = $targets->getNode(0); - $valueTarget = new AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } - - if ($ifexpr) { - $this->checkLoopUsageCondition($stream, $ifexpr); - $this->checkLoopUsageBody($stream, $body); - } - - return new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); - } - - public function decideForFork(Token $token) - { - return $token->test(['else', 'endfor']); - } - - public function decideForEnd(Token $token) - { - return $token->test('endfor'); - } - - // the loop variable cannot be used in the condition - private function checkLoopUsageCondition(TokenStream $stream, Node $node) - { - if ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { - throw new SyntaxError('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext()); - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageCondition($stream, $n); - } - } - - // check usage of non-defined loop-items - // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) - private function checkLoopUsageBody(TokenStream $stream, Node $node) - { - if ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { - $attribute = $node->getNode('attribute'); - if ($attribute instanceof ConstantExpression && \in_array($attribute->getAttribute('value'), ['length', 'revindex0', 'revindex', 'last'])) { - throw new SyntaxError(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext()); - } - } - - // should check for parent.loop.XXX usage - if ($node instanceof ForNode) { - return; - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageBody($stream, $n); - } - } - - public function getTag() - { - return 'for'; - } -} - -class_alias('Twig\TokenParser\ForTokenParser', 'Twig_TokenParser_For'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FromTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FromTokenParser.php deleted file mode 100644 index dd49f2f..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/FromTokenParser.php +++ /dev/null @@ -1,65 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(/* Token::NAME_TYPE */ 5, 'import'); - - $targets = []; - do { - $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - } while (true); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine()); - $node = new ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); - - foreach ($targets as $name => $alias) { - $this->parser->addImportedSymbol('function', $alias, 'macro_'.$name, $var); - } - - return $node; - } - - public function getTag() - { - return 'from'; - } -} - -class_alias('Twig\TokenParser\FromTokenParser', 'Twig_TokenParser_From'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IfTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IfTokenParser.php deleted file mode 100644 index 8ad99f0..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IfTokenParser.php +++ /dev/null @@ -1,89 +0,0 @@ - - * {% for user in users %} - *
  • {{ user.username|e }}
  • - * {% endfor %} - * - * {% endif %} - */ -final class IfTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideIfFork']); - $tests = [$expr, $body]; - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $else = $this->parser->subparse([$this, 'decideIfEnd']); - break; - - case 'elseif': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideIfFork']); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endif': - $end = true; - break; - - default: - throw new SyntaxError(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()); - } - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new IfNode(new Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Token $token) - { - return $token->test(['elseif', 'else', 'endif']); - } - - public function decideIfEnd(Token $token) - { - return $token->test(['endif']); - } - - public function getTag() - { - return 'if'; - } -} - -class_alias('Twig\TokenParser\IfTokenParser', 'Twig_TokenParser_If'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ImportTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ImportTokenParser.php deleted file mode 100644 index b5674c1..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/ImportTokenParser.php +++ /dev/null @@ -1,43 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5, 'as'); - $var = new AssignNameExpression($this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); - - return new ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); - } - - public function getTag() - { - return 'import'; - } -} - -class_alias('Twig\TokenParser\ImportTokenParser', 'Twig_TokenParser_Import'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IncludeTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IncludeTokenParser.php deleted file mode 100644 index e1e95da..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/IncludeTokenParser.php +++ /dev/null @@ -1,68 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - protected function parseArguments() - { - $stream = $this->parser->getStream(); - - $ignoreMissing = false; - if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'ignore')) { - $stream->expect(/* Token::NAME_TYPE */ 5, 'missing'); - - $ignoreMissing = true; - } - - $variables = null; - if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'with')) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - } - - $only = false; - if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'only')) { - $only = true; - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return [$variables, $only, $ignoreMissing]; - } - - public function getTag() - { - return 'include'; - } -} - -class_alias('Twig\TokenParser\IncludeTokenParser', 'Twig_TokenParser_Include'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/MacroTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/MacroTokenParser.php deleted file mode 100644 index d267387..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/MacroTokenParser.php +++ /dev/null @@ -1,66 +0,0 @@ - - * {% endmacro %} - */ -final class MacroTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - - $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $this->parser->pushLocalScope(); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new SyntaxError(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - $this->parser->popLocalScope(); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno, $this->getTag())); - - return new Node(); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endmacro'); - } - - public function getTag() - { - return 'macro'; - } -} - -class_alias('Twig\TokenParser\MacroTokenParser', 'Twig_TokenParser_Macro'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SandboxTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SandboxTokenParser.php deleted file mode 100644 index 1f57987..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SandboxTokenParser.php +++ /dev/null @@ -1,65 +0,0 @@ -parser->getStream(); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - // in a sandbox tag, only include tags are allowed - if (!$body instanceof IncludeNode) { - foreach ($body as $node) { - if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { - continue; - } - - if (!$node instanceof IncludeNode) { - throw new SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); - } - } - } - - return new SandboxNode($body, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endsandbox'); - } - - public function getTag() - { - return 'sandbox'; - } -} - -class_alias('Twig\TokenParser\SandboxTokenParser', 'Twig_TokenParser_Sandbox'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SetTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SetTokenParser.php deleted file mode 100644 index 82fee26..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SetTokenParser.php +++ /dev/null @@ -1,72 +0,0 @@ -getLine(); - $stream = $this->parser->getStream(); - $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); - - $capture = false; - if ($stream->nextIf(/* Token::OPERATOR_TYPE */ 8, '=')) { - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - if (\count($names) !== \count($values)) { - throw new SyntaxError('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } else { - $capture = true; - - if (\count($names) > 1) { - throw new SyntaxError('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $values = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - } - - return new SetNode($capture, $names, $values, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Token $token) - { - return $token->test('endset'); - } - - public function getTag() - { - return 'set'; - } -} - -class_alias('Twig\TokenParser\SetTokenParser', 'Twig_TokenParser_Set'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SpacelessTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SpacelessTokenParser.php deleted file mode 100644 index b58624d..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/SpacelessTokenParser.php +++ /dev/null @@ -1,56 +0,0 @@ - - * foo - * - * {% endspaceless %} - * {# output will be
    foo
    #} - * - * @deprecated since Twig 2.7, to be removed in 3.0 (use the "spaceless" filter with the "apply" tag instead) - */ -final class SpacelessTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $stream = $this->parser->getStream(); - $lineno = $token->getLine(); - - @trigger_error(sprintf('The spaceless tag in "%s" at line %d is deprecated since Twig 2.7, use the "spaceless" filter with the "apply" tag instead.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - $body = $this->parser->subparse([$this, 'decideSpacelessEnd'], true); - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new SpacelessNode($body, $lineno, $this->getTag()); - } - - public function decideSpacelessEnd(Token $token) - { - return $token->test('endspaceless'); - } - - public function getTag() - { - return 'spaceless'; - } -} - -class_alias('Twig\TokenParser\SpacelessTokenParser', 'Twig_TokenParser_Spaceless'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/TokenParserInterface.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/TokenParserInterface.php deleted file mode 100644 index 6f34106..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/TokenParserInterface.php +++ /dev/null @@ -1,52 +0,0 @@ - - */ -interface TokenParserInterface -{ - /** - * Sets the parser associated with this token parser. - */ - public function setParser(Parser $parser); - - /** - * Parses a token and returns a node. - * - * @return Node - * - * @throws SyntaxError - */ - public function parse(Token $token); - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag(); -} - -class_alias('Twig\TokenParser\TokenParserInterface', 'Twig_TokenParserInterface'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Token'); -class_exists('Twig\Parser'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/UseTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/UseTokenParser.php deleted file mode 100644 index 266efe5..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/UseTokenParser.php +++ /dev/null @@ -1,73 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - - if (!$template instanceof ConstantExpression) { - throw new SyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $targets = []; - if ($stream->nextIf('with')) { - do { - $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); - } - - $targets[$name] = new ConstantExpression($alias, -1); - - if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { - break; - } - } while (true); - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)])); - - return new Node(); - } - - public function getTag() - { - return 'use'; - } -} - -class_alias('Twig\TokenParser\UseTokenParser', 'Twig_TokenParser_Use'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/WithTokenParser.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/WithTokenParser.php deleted file mode 100644 index c184fd7..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenParser/WithTokenParser.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -final class WithTokenParser extends AbstractTokenParser -{ - public function parse(Token $token) - { - $stream = $this->parser->getStream(); - - $variables = null; - $only = false; - if (!$stream->test(/* Token::BLOCK_END_TYPE */ 3)) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - $only = (bool) $stream->nextIf(/* Token::NAME_TYPE */ 5, 'only'); - } - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - $body = $this->parser->subparse([$this, 'decideWithEnd'], true); - - $stream->expect(/* Token::BLOCK_END_TYPE */ 3); - - return new WithNode($body, $variables, $only, $token->getLine(), $this->getTag()); - } - - public function decideWithEnd(Token $token) - { - return $token->test('endwith'); - } - - public function getTag() - { - return 'with'; - } -} - -class_alias('Twig\TokenParser\WithTokenParser', 'Twig_TokenParser_With'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenStream.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenStream.php deleted file mode 100644 index 3fb9e86..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TokenStream.php +++ /dev/null @@ -1,134 +0,0 @@ - - */ -final class TokenStream -{ - private $tokens; - private $current = 0; - private $source; - - public function __construct(array $tokens, Source $source = null) - { - $this->tokens = $tokens; - $this->source = $source ?: new Source('', ''); - } - - public function __toString() - { - return implode("\n", $this->tokens); - } - - public function injectTokens(array $tokens) - { - $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); - } - - /** - * Sets the pointer to the next token and returns the old one. - */ - public function next(): Token - { - if (!isset($this->tokens[++$this->current])) { - throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current - 1]; - } - - /** - * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. - * - * @return Token|null The next token if the condition is true, null otherwise - */ - public function nextIf($primary, $secondary = null) - { - if ($this->tokens[$this->current]->test($primary, $secondary)) { - return $this->next(); - } - } - - /** - * Tests a token and returns it or throws a syntax error. - */ - public function expect($type, $value = null, string $message = null): Token - { - $token = $this->tokens[$this->current]; - if (!$token->test($type, $value)) { - $line = $token->getLine(); - throw new SyntaxError(sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', - $message ? $message.'. ' : '', - Token::typeToEnglish($token->getType()), - $token->getValue() ? sprintf(' of value "%s"', $token->getValue()) : '', - Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), - $line, - $this->source - ); - } - $this->next(); - - return $token; - } - - /** - * Looks at the next token. - */ - public function look(int $number = 1): Token - { - if (!isset($this->tokens[$this->current + $number])) { - throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current + $number]; - } - - /** - * Tests the current token. - */ - public function test($primary, $secondary = null): bool - { - return $this->tokens[$this->current]->test($primary, $secondary); - } - - /** - * Checks if end of stream was reached. - */ - public function isEOF(): bool - { - return /* Token::EOF_TYPE */ -1 === $this->tokens[$this->current]->getType(); - } - - public function getCurrent(): Token - { - return $this->tokens[$this->current]; - } - - /** - * Gets the source associated with this stream. - * - * @internal - */ - public function getSourceContext(): Source - { - return $this->source; - } -} - -class_alias('Twig\TokenStream', 'Twig_TokenStream'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFilter.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFilter.php deleted file mode 100644 index 9e7b838..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFilter.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#filters - */ -class TwigFilter -{ - private $name; - private $callable; - private $options; - private $arguments = []; - - /** - * Creates a template filter. - * - * @param string $name Name of this filter - * @param callable|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = []) - { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge([ - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'pre_escape' => null, - 'preserves_safety' => null, - 'node_class' => FilterExpression::class, - 'deprecated' => false, - 'alternative' => null, - ], $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this filter. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Node $filterArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return $this->options['is_safe_callback']($filterArgs); - } - } - - public function getPreservesSafety() - { - return $this->options['preserves_safety']; - } - - public function getPreEscape() - { - return $this->options['pre_escape']; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig\TwigFilter', 'Twig_SimpleFilter', false); - -class_alias('Twig\TwigFilter', 'Twig_Filter'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Node\Node'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFunction.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFunction.php deleted file mode 100644 index c5779af..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigFunction.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#functions - */ -class TwigFunction -{ - private $name; - private $callable; - private $options; - private $arguments = []; - - /** - * Creates a template function. - * - * @param string $name Name of this function - * @param callable|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = []) - { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge([ - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'node_class' => FunctionExpression::class, - 'deprecated' => false, - 'alternative' => null, - ], $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this function. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Node $functionArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return $this->options['is_safe_callback']($functionArgs); - } - - return []; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig\TwigFunction', 'Twig_SimpleFunction', false); - -class_alias('Twig\TwigFunction', 'Twig_Function'); - -// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. -class_exists('Twig\Node\Node'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigTest.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigTest.php deleted file mode 100644 index e15da41..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/TwigTest.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#test-operator - */ -class TwigTest -{ - private $name; - private $callable; - private $options; - private $arguments = []; - - /** - * Creates a template test. - * - * @param string $name Name of this test - * @param callable|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = []) - { - if (__CLASS__ !== \get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge([ - 'is_variadic' => false, - 'node_class' => TestExpression::class, - 'deprecated' => false, - 'alternative' => null, - ], $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this test. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig\TwigTest', 'Twig_SimpleTest', false); - -class_alias('Twig\TwigTest', 'Twig_Test'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/DeprecationCollector.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/DeprecationCollector.php deleted file mode 100644 index d373698..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/DeprecationCollector.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -final class DeprecationCollector -{ - private $twig; - - public function __construct(Environment $twig) - { - $this->twig = $twig; - } - - /** - * Returns deprecations for templates contained in a directory. - * - * @param string $dir A directory where templates are stored - * @param string $ext Limit the loaded templates by extension - * - * @return array An array of deprecations - */ - public function collectDir($dir, $ext = '.twig') - { - $iterator = new \RegexIterator( - new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY - ), '{'.preg_quote($ext).'$}' - ); - - return $this->collect(new TemplateDirIterator($iterator)); - } - - /** - * Returns deprecations for passed templates. - * - * @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template) - * - * @return array An array of deprecations - */ - public function collect(\Traversable $iterator) - { - $deprecations = []; - set_error_handler(function ($type, $msg) use (&$deprecations) { - if (E_USER_DEPRECATED === $type) { - $deprecations[] = $msg; - } - }); - - foreach ($iterator as $name => $contents) { - try { - $this->twig->parse($this->twig->tokenize(new Source($contents, $name))); - } catch (SyntaxError $e) { - // ignore templates containing syntax errors - } - } - - restore_error_handler(); - - return $deprecations; - } -} - -class_alias('Twig\Util\DeprecationCollector', 'Twig_Util_DeprecationCollector'); diff --git a/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/TemplateDirIterator.php b/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/TemplateDirIterator.php deleted file mode 100644 index 1ab0dac..0000000 --- a/system/templateEngines/Twig/Twig2x/twig/twig/src/Util/TemplateDirIterator.php +++ /dev/null @@ -1,30 +0,0 @@ - - */ -class TemplateDirIterator extends \IteratorIterator -{ - public function current() - { - return file_get_contents(parent::current()); - } - - public function key() - { - return (string) parent::key(); - } -} - -class_alias('Twig\Util\TemplateDirIterator', 'Twig_Util_TemplateDirIterator'); diff --git a/system/templateEngines/Twig/autoload.php b/system/templateEngines/Twig/autoload.php index f3d2b58..eda9031 100644 --- a/system/templateEngines/Twig/autoload.php +++ b/system/templateEngines/Twig/autoload.php @@ -1,6 +1,6 @@ ') == false) { + if (version_compare(phpversion(), '7.2.5', '>') == false) { define('TwigFolderLoad', 'Twig1x'); define('TwigLoaderFilesystem', 'Twig_Loader_Filesystem'); define('TwigEnvironment', 'Twig_Environment'); @@ -13,15 +13,11 @@ namespace { define('TwigSimpleFilter', '\Twig\TwigFilter'); define('TwigExtensionDebug', '\Twig\Extension\DebugExtension'); - if (version_compare(phpversion(), '7.2.5', '>') == false) { - define('TwigFolderLoad', 'Twig2x'); - } else { - //define('TwigFolderLoad', 'Twig3x'); - } + } if(defined('TwigFolderLoad')){ - include_once TwigFolderLoad."/autoload.php"; + include_once TwigFolderLoad."/vendor/autoload.php"; } diff --git a/system/url/seo_url.php b/system/url/seo_url.php index e963c0f..09b5812 100644 --- a/system/url/seo_url.php +++ b/system/url/seo_url.php @@ -172,7 +172,7 @@ class SystemUrlSeoUrl extends ControllerController { break; } } else { - $url .= '/' . (array_search($value, ROUTES)); + $url .= '/' . (array_search($value, Config::ROUTES())); } }