Version Description
- Removed some leftover development files.
- Fixed the count for parent product categories.
- Restored the filter hook
wcml_client_currency
outside the cached logic.
Download this release
Release Info
Developer | strategio |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 5.0.2 |
Comparing to | |
See all releases |
Code changes from version 5.0.1 to 5.0.2
- addons/load-standalone-dependencies.php +6 -6
- addons/vendor/composer/autoload_classmap.php +0 -506
- addons/vendor/composer/autoload_static.php +0 -545
- addons/vendor/composer/installed.json +0 -799
- addons/vendor/otgs/auryn/CONTRIBUTING.md +0 -28
- addons/vendor/otgs/auryn/phpunit.xml +0 -43
- addons/vendor/otgs/icons +0 -1
- addons/vendor/otgs/ui +0 -1
- addons/vendor/wpml/collect/phpunit.xml +0 -20
- addons/vendor/wpml/collect/readme.md +0 -19
- addons/vendor/wpml/collect/tests/Support/SupportCollectionTest.php +0 -1763
- addons/vendor/wpml/collect/tests/bootstrap.php +0 -5
- addons/vendor/wpml/core-api +0 -1
- addons/vendor/wpml/fp +0 -1
- addons/vendor/wpml/wp +0 -1
- addons/vendor/wpml/wpml-dependencies +0 -1
- addons/wpml-dependencies/lib/classes/ISitePress.php +5 -0
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-filter-loader.php +159 -0
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-type.php +75 -0
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-base-factory.php +33 -0
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-validation.php +29 -0
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-current-screen-loader-factory.php +44 -0
- addons/wpml-dependencies/lib/classes/block-editor/class-wpml-block-editor-helper.php +70 -0
- addons/wpml-dependencies/lib/classes/class-wpml-file.php +138 -0
- addons/wpml-dependencies/lib/classes/container/class-config.php +60 -0
- addons/wpml-dependencies/lib/classes/container/class-wpml-container.php +112 -0
- addons/wpml-dependencies/lib/classes/container/functions.php +97 -0
- addons/wpml-dependencies/lib/classes/cookie/class-wpml-cookie.php +80 -0
- addons/wpml-dependencies/lib/classes/languages/interface-iwpml-current-language.php +7 -0
- addons/wpml-dependencies/lib/classes/notices/DismissNotices.php +63 -0
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-action.php +89 -0
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-render.php +407 -0
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice.php +414 -0
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notices.php +489 -0
- addons/wpml-dependencies/lib/classes/notices/pages/class-wpml-notice-show-on-dashboard-and-wpml-pages.php +24 -0
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-core-privacy-content.php +25 -0
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content-factory.php +13 -0
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content.php +35 -0
- addons/wpml-dependencies/lib/classes/templates/class-wpml-twig-template.php +23 -0
- addons/wpml-dependencies/lib/classes/templates/interface-iwpml-template-service.php +8 -0
- addons/wpml-dependencies/lib/classes/templates/wpml-twig-template-loader.php +37 -0
- addons/wpml-dependencies/lib/classes/templating/class-wpml-templates-factory.php +207 -0
- addons/wpml-dependencies/lib/classes/twig-extensions/wpml-twig-wp-plugin-extension.php +25 -0
- addons/wpml-dependencies/lib/classes/utilities/class-wpml-wp-cache.php +117 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-api.php +1292 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-roles.php +130 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-taxonomy.php +30 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/iwpml-wp-element-type.php +12 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/wpml-php-functions.php +129 -0
- addons/wpml-dependencies/lib/classes/wpml-wp/wpml-wp-post-type.php +14 -0
- addons/wpml-dependencies/lib/dist/js/notices/app.js +1 -0
- addons/wpml-dependencies/lib/inc/icl-admin-notifier.php +814 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Autoloader.php +49 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/BaseNodeVisitor.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Filesystem.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Null.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/CacheInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Compiler.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/CompilerInterface.php +34 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ContainerRuntimeLoader.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Environment.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Loader.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Runtime.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Syntax.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExistsLoaderInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExpressionParser.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Core.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Debug.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Escaper.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/GlobalsInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/InitRuntimeInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Optimizer.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Profiler.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Sandbox.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Staging.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/StringLoader.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExtensionInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FactoryRuntimeLoader.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FileExtensionEscapingStrategy.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter.php +69 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Function.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Method.php +39 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Node.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterCallableInterface.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterInterface.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function.php +62 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Function.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Method.php +40 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Node.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionCallableInterface.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionInterface.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Lexer.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/LexerInterface.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Array.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Chain.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Filesystem.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/String.php +57 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/LoaderInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Markup.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/AutoEscape.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Block.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/BlockReference.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Body.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/CheckSecurity.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Deprecated.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Do.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Embed.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Array.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/AssignName.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Add.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/And.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Concat.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Div.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/EndsWith.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Equal.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Greater.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/In.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Less.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/LessEqual.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Matches.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mod.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mul.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotEqual.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotIn.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Or.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Power.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Range.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/StartsWith.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Sub.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/BlockReference.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Call.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Conditional.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Constant.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/ExtensionReference.php +33 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter/Default.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Function.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/GetAttr.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/MethodCall.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Name.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/NullCoalesce.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Parent.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/TempName.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Constant.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Defined.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Divisibleby.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Even.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Null.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Odd.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Sameas.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Neg.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Not.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Pos.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Flush.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/For.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/ForLoop.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/If.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Import.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Include.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Macro.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Module.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Print.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Sandbox.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SandboxedPrint.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Set.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SetTemp.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Spaceless.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Text.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/With.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeCaptureInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeInterface.php +32 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeOutputInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeTraverser.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Escaper.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Optimizer.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/SafeAnalysis.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Sandbox.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitorInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Parser.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ParserInterface.php +33 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Base.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Blackfire.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Html.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Text.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/EnterProfile.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/LeaveProfile.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Profile.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/RuntimeLoaderInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicy.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFilter.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFunction.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleTest.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Source.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SourceContextLoaderInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Template.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateInterface.php +47 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateWrapper.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test.php +33 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Function.php +34 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/IntegrationTestCase.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Method.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Node.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/NodeTestCase.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestCallableInterface.php +23 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestInterface.php +28 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Token.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/AutoEscape.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Block.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Deprecated.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Do.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Embed.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Extends.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Filter.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Flush.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/For.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/From.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/If.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Import.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Include.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Macro.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Sandbox.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Set.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Spaceless.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Use.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/With.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBroker.php +112 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBrokerInterface.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserInterface.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenStream.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/DeprecationCollector.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/TemplateDirIterator.php +11 -0
- addons/wpml-dependencies/lib/lib/twig/src/Cache/CacheInterface.php +55 -0
- addons/wpml-dependencies/lib/lib/twig/src/Cache/FilesystemCache.php +79 -0
- addons/wpml-dependencies/lib/lib/twig/src/Cache/NullCache.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/src/Compiler.php +247 -0
- addons/wpml-dependencies/lib/lib/twig/src/Environment.php +1407 -0
- addons/wpml-dependencies/lib/lib/twig/src/Error/Error.php +280 -0
- addons/wpml-dependencies/lib/lib/twig/src/Error/LoaderError.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Error/RuntimeError.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Error/SyntaxError.php +52 -0
- addons/wpml-dependencies/lib/lib/twig/src/ExpressionParser.php +684 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/AbstractExtension.php +61 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/CoreExtension.php +1393 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/DebugExtension.php +56 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/EscaperExtension.php +101 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/ExtensionInterface.php +89 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/GlobalsInterface.php +24 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/InitRuntimeInterface.php +24 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/OptimizerExtension.php +33 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/ProfilerExtension.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/RuntimeExtensionInterface.php +18 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/SandboxExtension.php +91 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/StagingExtension.php +97 -0
- addons/wpml-dependencies/lib/lib/twig/src/Extension/StringLoaderExtension.php +46 -0
- addons/wpml-dependencies/lib/lib/twig/src/FileExtensionEscapingStrategy.php +55 -0
- addons/wpml-dependencies/lib/lib/twig/src/Lexer.php +392 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ArrayLoader.php +87 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ChainLoader.php +137 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ExistsLoaderInterface.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/FilesystemLoader.php +261 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/LoaderInterface.php +56 -0
- addons/wpml-dependencies/lib/lib/twig/src/Loader/SourceContextLoaderInterface.php +35 -0
- addons/wpml-dependencies/lib/lib/twig/src/Markup.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/AutoEscapeNode.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/BlockNode.php +32 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/BlockReferenceNode.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/BodyNode.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/CheckSecurityNode.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/CheckToStringNode.php +35 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/DeprecatedNode.php +40 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/DoNode.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/EmbedNode.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AbstractExpression.php +23 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrayExpression.php +67 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrowFunctionExpression.php +41 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AssignNameExpression.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AbstractBinary.php +30 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AddBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AndBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseAndBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseOrBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseXorBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ConcatBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/DivBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EndsWithBinary.php +27 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EqualBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/FloorDivBinary.php +27 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterEqualBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/InBinary.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessEqualBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MatchesBinary.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ModBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MulBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotEqualBinary.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotInBinary.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/OrBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/PowerBinary.php +28 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/RangeBinary.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/StartsWithBinary.php +27 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/SubBinary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/BlockReferenceExpression.php +71 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/CallExpression.php +256 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConditionalExpression.php +26 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConstantExpression.php +26 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Filter/DefaultFilter.php +47 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FilterExpression.php +41 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FunctionExpression.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/GetAttrExpression.php +65 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/InlinePrint.php +28 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/MethodCallExpression.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NameExpression.php +73 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NullCoalesceExpression.php +47 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ParentExpression.php +35 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TempNameExpression.php +25 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/ConstantTest.php +35 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DefinedTest.php +64 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DivisiblebyTest.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/EvenTest.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/NullTest.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/OddTest.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/SameasTest.php +27 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TestExpression.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/AbstractUnary.php +30 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NegUnary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NotUnary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/PosUnary.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/FlushNode.php +30 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/ForLoopNode.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/ForNode.php +63 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/IfNode.php +47 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/ImportNode.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/IncludeNode.php +71 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/MacroNode.php +69 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/ModuleNode.php +237 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/Node.php +228 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/NodeCaptureInterface.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/NodeOutputInterface.php +21 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/PrintNode.php +32 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxNode.php +30 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxedPrintNode.php +54 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/SetNode.php +87 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/SetTempNode.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/SpacelessNode.php +38 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/TextNode.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Node/WithNode.php +48 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeTraverser.php +77 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/AbstractNodeVisitor.php +51 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/EscaperNodeVisitor.php +172 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/NodeVisitorInterface.php +44 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/OptimizerNodeVisitor.php +206 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php +143 -0
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SandboxNodeVisitor.php +118 -0
- addons/wpml-dependencies/lib/lib/twig/src/Parser.php +358 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BaseDumper.php +53 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BlackfireDumper.php +63 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/HtmlDumper.php +39 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/TextDumper.php +34 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/EnterProfileNode.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/LeaveProfileNode.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +63 -0
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Profile.php +154 -0
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/ContainerRuntimeLoader.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/FactoryRuntimeLoader.php +36 -0
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/RuntimeLoaderInterface.php +29 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityError.php +22 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFilterError.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFunctionError.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedMethodError.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedPropertyError.php +37 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedTagError.php +31 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicy.php +110 -0
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicyInterface.php +24 -0
- addons/wpml-dependencies/lib/lib/twig/src/Source.php +49 -0
- addons/wpml-dependencies/lib/lib/twig/src/Template.php +275 -0
addons/load-standalone-dependencies.php
CHANGED
@@ -10,10 +10,10 @@
|
|
10 |
* This constant `WCML_WPML_DEPENDENCY_URL` is used in several places inside
|
11 |
* the dependency files (it replaces hard-coded URL base).
|
12 |
*/
|
13 |
-
define( 'WCML_WPML_DEPENDENCY_URL', WCML_PLUGIN_URL . '/addons/
|
14 |
|
15 |
-
require_once WCML_PLUGIN_PATH . '/addons/vendor/autoload.php';
|
16 |
-
require_once WCML_PLUGIN_PATH . '/addons/
|
17 |
|
18 |
$setPartialDicConfigFromCore = function() {
|
19 |
\WPML\Container\share( \WCML\StandAlone\Container\Config::getSharedInstances() );
|
@@ -25,11 +25,11 @@ $setPartialDicConfigFromCore = function() {
|
|
25 |
$setPartialDicConfigFromCore();
|
26 |
|
27 |
if ( is_admin() ) {
|
28 |
-
require_once WCML_PLUGIN_PATH . '/addons/
|
29 |
|
30 |
$loadOtgsIconsStyles = function() {
|
31 |
-
$vendor_root_url = WCML_PLUGIN_URL . '/addons/vendor';
|
32 |
-
require_once WCML_PLUGIN_PATH . '/addons/vendor/otgs/icons/loader.php';
|
33 |
|
34 |
add_action( 'admin_init', function() {
|
35 |
wp_enqueue_style( OTGS_ASSETS_ICONS_STYLES );
|
10 |
* This constant `WCML_WPML_DEPENDENCY_URL` is used in several places inside
|
11 |
* the dependency files (it replaces hard-coded URL base).
|
12 |
*/
|
13 |
+
define( 'WCML_WPML_DEPENDENCY_URL', WCML_PLUGIN_URL . '/addons/wpml-dependencies/lib' );
|
14 |
|
15 |
+
require_once WCML_PLUGIN_PATH . '/addons/wpml-dependencies/vendor/autoload.php';
|
16 |
+
require_once WCML_PLUGIN_PATH . '/addons/wpml-dependencies/lib/missing-functions.php';
|
17 |
|
18 |
$setPartialDicConfigFromCore = function() {
|
19 |
\WPML\Container\share( \WCML\StandAlone\Container\Config::getSharedInstances() );
|
25 |
$setPartialDicConfigFromCore();
|
26 |
|
27 |
if ( is_admin() ) {
|
28 |
+
require_once WCML_PLUGIN_PATH . '/addons/wpml-dependencies/lib/inc/icl-admin-notifier.php';
|
29 |
|
30 |
$loadOtgsIconsStyles = function() {
|
31 |
+
$vendor_root_url = WCML_PLUGIN_URL . '/addons/wpml-dependencies/vendor';
|
32 |
+
require_once WCML_PLUGIN_PATH . '/addons/wpml-dependencies/vendor/otgs/icons/loader.php';
|
33 |
|
34 |
add_action( 'admin_init', function() {
|
35 |
wp_enqueue_style( OTGS_ASSETS_ICONS_STYLES );
|
addons/vendor/composer/autoload_classmap.php
DELETED
@@ -1,506 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_classmap.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'ICL_AdminNotifier' => $vendorDir . '/wpml/wpml-dependencies/lib/inc/icl-admin-notifier.php',
|
10 |
-
'IWPML_AJAX_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-ajax-action.php',
|
11 |
-
'IWPML_AJAX_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-ajax-action-loader.php',
|
12 |
-
'IWPML_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-action.php',
|
13 |
-
'IWPML_Action_Loader_Factory' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-action-loader-factory.php',
|
14 |
-
'IWPML_Backend_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-backend-action.php',
|
15 |
-
'IWPML_Backend_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-backend-action-loader.php',
|
16 |
-
'IWPML_CLI_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-cli-action.php',
|
17 |
-
'IWPML_CLI_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-cli-action-loader.php',
|
18 |
-
'IWPML_Current_Language' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/languages/interface-iwpml-current-language.php',
|
19 |
-
'IWPML_DIC_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-dic-action.php',
|
20 |
-
'IWPML_Deferred_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-deferred-action-loader.php',
|
21 |
-
'IWPML_Frontend_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-frontend-action.php',
|
22 |
-
'IWPML_Frontend_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-frontend-action-loader.php',
|
23 |
-
'IWPML_REST_Action' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-rest-action.php',
|
24 |
-
'IWPML_REST_Action_Loader' => $vendorDir . '/wpml/core-api/core/interfaces/actions/interface-iwpml-rest-action-loader.php',
|
25 |
-
'IWPML_Template_Service' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/templates/interface-iwpml-template-service.php',
|
26 |
-
'IWPML_WP_Element_Type' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/iwpml-wp-element-type.php',
|
27 |
-
'OTGS_Assets_Handles' => $vendorDir . '/otgs/ui/src/php/OTGS_Assets_Handles.php',
|
28 |
-
'OTGS_Assets_Store' => $vendorDir . '/otgs/ui/src/php/OTGS_Assets_Store.php',
|
29 |
-
'OTGS_UI_Assets' => $vendorDir . '/otgs/ui/src/php/OTGS_UI_Assets.php',
|
30 |
-
'OTGS_UI_Loader' => $vendorDir . '/otgs/ui/src/php/OTGS_UI_Loader.php',
|
31 |
-
'WPML\\API\\PostTypes' => $vendorDir . '/wpml/core-api/core/PostTypes.php',
|
32 |
-
'WPML\\API\\Settings' => $vendorDir . '/wpml/core-api/core/Settings.php',
|
33 |
-
'WPML\\API\\Version' => $vendorDir . '/wpml/core-api/core/Version.php',
|
34 |
-
'WPML\\Action\\Type' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-type.php',
|
35 |
-
'WPML\\Ajax\\IHandler' => $vendorDir . '/wpml/core-api/core/interfaces/ajax/Handler.php',
|
36 |
-
'WPML\\Container\\Config' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/container/class-config.php',
|
37 |
-
'WPML\\Container\\Container' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/container/class-wpml-container.php',
|
38 |
-
'WPML\\Core\\BackgroundTask' => $vendorDir . '/wpml/core-api/core/utility/BackgroundTask.php',
|
39 |
-
'WPML\\Core\\ISitePress' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/ISitePress.php',
|
40 |
-
'WPML\\Core\\Twig\\Cache\\CacheInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/CacheInterface.php',
|
41 |
-
'WPML\\Core\\Twig\\Cache\\FilesystemCache' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/FilesystemCache.php',
|
42 |
-
'WPML\\Core\\Twig\\Cache\\NullCache' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/NullCache.php',
|
43 |
-
'WPML\\Core\\Twig\\Compiler' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Compiler.php',
|
44 |
-
'WPML\\Core\\Twig\\Environment' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Environment.php',
|
45 |
-
'WPML\\Core\\Twig\\Error\\Error' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/Error.php',
|
46 |
-
'WPML\\Core\\Twig\\Error\\LoaderError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/LoaderError.php',
|
47 |
-
'WPML\\Core\\Twig\\Error\\RuntimeError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/RuntimeError.php',
|
48 |
-
'WPML\\Core\\Twig\\Error\\SyntaxError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/SyntaxError.php',
|
49 |
-
'WPML\\Core\\Twig\\ExpressionParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/ExpressionParser.php',
|
50 |
-
'WPML\\Core\\Twig\\Extension\\AbstractExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/AbstractExtension.php',
|
51 |
-
'WPML\\Core\\Twig\\Extension\\CoreExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/CoreExtension.php',
|
52 |
-
'WPML\\Core\\Twig\\Extension\\DebugExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/DebugExtension.php',
|
53 |
-
'WPML\\Core\\Twig\\Extension\\EscaperExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/EscaperExtension.php',
|
54 |
-
'WPML\\Core\\Twig\\Extension\\ExtensionInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/ExtensionInterface.php',
|
55 |
-
'WPML\\Core\\Twig\\Extension\\GlobalsInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/GlobalsInterface.php',
|
56 |
-
'WPML\\Core\\Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/InitRuntimeInterface.php',
|
57 |
-
'WPML\\Core\\Twig\\Extension\\OptimizerExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/OptimizerExtension.php',
|
58 |
-
'WPML\\Core\\Twig\\Extension\\ProfilerExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/ProfilerExtension.php',
|
59 |
-
'WPML\\Core\\Twig\\Extension\\RuntimeExtensionInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/RuntimeExtensionInterface.php',
|
60 |
-
'WPML\\Core\\Twig\\Extension\\SandboxExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/SandboxExtension.php',
|
61 |
-
'WPML\\Core\\Twig\\Extension\\StagingExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/StagingExtension.php',
|
62 |
-
'WPML\\Core\\Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/StringLoaderExtension.php',
|
63 |
-
'WPML\\Core\\Twig\\FileExtensionEscapingStrategy' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/FileExtensionEscapingStrategy.php',
|
64 |
-
'WPML\\Core\\Twig\\Lexer' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Lexer.php',
|
65 |
-
'WPML\\Core\\Twig\\Loader\\ArrayLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ArrayLoader.php',
|
66 |
-
'WPML\\Core\\Twig\\Loader\\ChainLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ChainLoader.php',
|
67 |
-
'WPML\\Core\\Twig\\Loader\\ExistsLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ExistsLoaderInterface.php',
|
68 |
-
'WPML\\Core\\Twig\\Loader\\FilesystemLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/FilesystemLoader.php',
|
69 |
-
'WPML\\Core\\Twig\\Loader\\LoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/LoaderInterface.php',
|
70 |
-
'WPML\\Core\\Twig\\Loader\\SourceContextLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/SourceContextLoaderInterface.php',
|
71 |
-
'WPML\\Core\\Twig\\Markup' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Markup.php',
|
72 |
-
'WPML\\Core\\Twig\\NodeTraverser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeTraverser.php',
|
73 |
-
'WPML\\Core\\Twig\\NodeVisitor\\AbstractNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/AbstractNodeVisitor.php',
|
74 |
-
'WPML\\Core\\Twig\\NodeVisitor\\EscaperNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/EscaperNodeVisitor.php',
|
75 |
-
'WPML\\Core\\Twig\\NodeVisitor\\NodeVisitorInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/NodeVisitorInterface.php',
|
76 |
-
'WPML\\Core\\Twig\\NodeVisitor\\OptimizerNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/OptimizerNodeVisitor.php',
|
77 |
-
'WPML\\Core\\Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php',
|
78 |
-
'WPML\\Core\\Twig\\NodeVisitor\\SandboxNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SandboxNodeVisitor.php',
|
79 |
-
'WPML\\Core\\Twig\\Node\\AutoEscapeNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/AutoEscapeNode.php',
|
80 |
-
'WPML\\Core\\Twig\\Node\\BlockNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BlockNode.php',
|
81 |
-
'WPML\\Core\\Twig\\Node\\BlockReferenceNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BlockReferenceNode.php',
|
82 |
-
'WPML\\Core\\Twig\\Node\\BodyNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BodyNode.php',
|
83 |
-
'WPML\\Core\\Twig\\Node\\CheckSecurityNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/CheckSecurityNode.php',
|
84 |
-
'WPML\\Core\\Twig\\Node\\CheckToStringNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/CheckToStringNode.php',
|
85 |
-
'WPML\\Core\\Twig\\Node\\DeprecatedNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/DeprecatedNode.php',
|
86 |
-
'WPML\\Core\\Twig\\Node\\DoNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/DoNode.php',
|
87 |
-
'WPML\\Core\\Twig\\Node\\EmbedNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/EmbedNode.php',
|
88 |
-
'WPML\\Core\\Twig\\Node\\Expression\\AbstractExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/AbstractExpression.php',
|
89 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ArrayExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrayExpression.php',
|
90 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ArrowFunctionExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrowFunctionExpression.php',
|
91 |
-
'WPML\\Core\\Twig\\Node\\Expression\\AssignNameExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/AssignNameExpression.php',
|
92 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AbstractBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AbstractBinary.php',
|
93 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AddBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AddBinary.php',
|
94 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AndBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AndBinary.php',
|
95 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseAndBinary.php',
|
96 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseOrBinary.php',
|
97 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseXorBinary.php',
|
98 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ConcatBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ConcatBinary.php',
|
99 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\DivBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/DivBinary.php',
|
100 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EndsWithBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EndsWithBinary.php',
|
101 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EqualBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EqualBinary.php',
|
102 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\FloorDivBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/FloorDivBinary.php',
|
103 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterBinary.php',
|
104 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterEqualBinary.php',
|
105 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\InBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/InBinary.php',
|
106 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessBinary.php',
|
107 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessEqualBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessEqualBinary.php',
|
108 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MatchesBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MatchesBinary.php',
|
109 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ModBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ModBinary.php',
|
110 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MulBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MulBinary.php',
|
111 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotEqualBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotEqualBinary.php',
|
112 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotInBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotInBinary.php',
|
113 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\OrBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/OrBinary.php',
|
114 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\PowerBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/PowerBinary.php',
|
115 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\RangeBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/RangeBinary.php',
|
116 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\StartsWithBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/StartsWithBinary.php',
|
117 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\SubBinary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/SubBinary.php',
|
118 |
-
'WPML\\Core\\Twig\\Node\\Expression\\BlockReferenceExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/BlockReferenceExpression.php',
|
119 |
-
'WPML\\Core\\Twig\\Node\\Expression\\CallExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/CallExpression.php',
|
120 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ConditionalExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConditionalExpression.php',
|
121 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ConstantExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConstantExpression.php',
|
122 |
-
'WPML\\Core\\Twig\\Node\\Expression\\FilterExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/FilterExpression.php',
|
123 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Filter\\DefaultFilter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Filter/DefaultFilter.php',
|
124 |
-
'WPML\\Core\\Twig\\Node\\Expression\\FunctionExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/FunctionExpression.php',
|
125 |
-
'WPML\\Core\\Twig\\Node\\Expression\\GetAttrExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/GetAttrExpression.php',
|
126 |
-
'WPML\\Core\\Twig\\Node\\Expression\\InlinePrint' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/InlinePrint.php',
|
127 |
-
'WPML\\Core\\Twig\\Node\\Expression\\MethodCallExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/MethodCallExpression.php',
|
128 |
-
'WPML\\Core\\Twig\\Node\\Expression\\NameExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/NameExpression.php',
|
129 |
-
'WPML\\Core\\Twig\\Node\\Expression\\NullCoalesceExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/NullCoalesceExpression.php',
|
130 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ParentExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ParentExpression.php',
|
131 |
-
'WPML\\Core\\Twig\\Node\\Expression\\TempNameExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/TempNameExpression.php',
|
132 |
-
'WPML\\Core\\Twig\\Node\\Expression\\TestExpression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/TestExpression.php',
|
133 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\ConstantTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/ConstantTest.php',
|
134 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\DefinedTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DefinedTest.php',
|
135 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DivisiblebyTest.php',
|
136 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\EvenTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/EvenTest.php',
|
137 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/NullTest.php',
|
138 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\OddTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/OddTest.php',
|
139 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/SameasTest.php',
|
140 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\AbstractUnary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/AbstractUnary.php',
|
141 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NegUnary.php',
|
142 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NotUnary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NotUnary.php',
|
143 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/PosUnary.php',
|
144 |
-
'WPML\\Core\\Twig\\Node\\FlushNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/FlushNode.php',
|
145 |
-
'WPML\\Core\\Twig\\Node\\ForLoopNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ForLoopNode.php',
|
146 |
-
'WPML\\Core\\Twig\\Node\\ForNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ForNode.php',
|
147 |
-
'WPML\\Core\\Twig\\Node\\IfNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/IfNode.php',
|
148 |
-
'WPML\\Core\\Twig\\Node\\ImportNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ImportNode.php',
|
149 |
-
'WPML\\Core\\Twig\\Node\\IncludeNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/IncludeNode.php',
|
150 |
-
'WPML\\Core\\Twig\\Node\\MacroNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/MacroNode.php',
|
151 |
-
'WPML\\Core\\Twig\\Node\\ModuleNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ModuleNode.php',
|
152 |
-
'WPML\\Core\\Twig\\Node\\Node' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Node.php',
|
153 |
-
'WPML\\Core\\Twig\\Node\\NodeCaptureInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/NodeCaptureInterface.php',
|
154 |
-
'WPML\\Core\\Twig\\Node\\NodeOutputInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/NodeOutputInterface.php',
|
155 |
-
'WPML\\Core\\Twig\\Node\\PrintNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/PrintNode.php',
|
156 |
-
'WPML\\Core\\Twig\\Node\\SandboxNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SandboxNode.php',
|
157 |
-
'WPML\\Core\\Twig\\Node\\SandboxedPrintNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SandboxedPrintNode.php',
|
158 |
-
'WPML\\Core\\Twig\\Node\\SetNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SetNode.php',
|
159 |
-
'WPML\\Core\\Twig\\Node\\SetTempNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SetTempNode.php',
|
160 |
-
'WPML\\Core\\Twig\\Node\\SpacelessNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SpacelessNode.php',
|
161 |
-
'WPML\\Core\\Twig\\Node\\TextNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/TextNode.php',
|
162 |
-
'WPML\\Core\\Twig\\Node\\WithNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/WithNode.php',
|
163 |
-
'WPML\\Core\\Twig\\Parser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Parser.php',
|
164 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\BaseDumper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BaseDumper.php',
|
165 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\BlackfireDumper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BlackfireDumper.php',
|
166 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\HtmlDumper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/HtmlDumper.php',
|
167 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\TextDumper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/TextDumper.php',
|
168 |
-
'WPML\\Core\\Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php',
|
169 |
-
'WPML\\Core\\Twig\\Profiler\\Node\\EnterProfileNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Node/EnterProfileNode.php',
|
170 |
-
'WPML\\Core\\Twig\\Profiler\\Node\\LeaveProfileNode' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Node/LeaveProfileNode.php',
|
171 |
-
'WPML\\Core\\Twig\\Profiler\\Profile' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Profile.php',
|
172 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\ContainerRuntimeLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/ContainerRuntimeLoader.php',
|
173 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\FactoryRuntimeLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/FactoryRuntimeLoader.php',
|
174 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\RuntimeLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/RuntimeLoaderInterface.php',
|
175 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityError.php',
|
176 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFilterError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFilterError.php',
|
177 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFunctionError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFunctionError.php',
|
178 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedMethodError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedMethodError.php',
|
179 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedPropertyError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedPropertyError.php',
|
180 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedTagError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedTagError.php',
|
181 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityPolicy' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicy.php',
|
182 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityPolicyInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicyInterface.php',
|
183 |
-
'WPML\\Core\\Twig\\Source' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Source.php',
|
184 |
-
'WPML\\Core\\Twig\\Template' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Template.php',
|
185 |
-
'WPML\\Core\\Twig\\TemplateWrapper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TemplateWrapper.php',
|
186 |
-
'WPML\\Core\\Twig\\Test\\IntegrationTestCase' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Test/IntegrationTestCase.php',
|
187 |
-
'WPML\\Core\\Twig\\Test\\NodeTestCase' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Test/NodeTestCase.php',
|
188 |
-
'WPML\\Core\\Twig\\Token' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Token.php',
|
189 |
-
'WPML\\Core\\Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/AbstractTokenParser.php',
|
190 |
-
'WPML\\Core\\Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ApplyTokenParser.php',
|
191 |
-
'WPML\\Core\\Twig\\TokenParser\\AutoEscapeTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/AutoEscapeTokenParser.php',
|
192 |
-
'WPML\\Core\\Twig\\TokenParser\\BlockTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/BlockTokenParser.php',
|
193 |
-
'WPML\\Core\\Twig\\TokenParser\\DeprecatedTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/DeprecatedTokenParser.php',
|
194 |
-
'WPML\\Core\\Twig\\TokenParser\\DoTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/DoTokenParser.php',
|
195 |
-
'WPML\\Core\\Twig\\TokenParser\\EmbedTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/EmbedTokenParser.php',
|
196 |
-
'WPML\\Core\\Twig\\TokenParser\\ExtendsTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ExtendsTokenParser.php',
|
197 |
-
'WPML\\Core\\Twig\\TokenParser\\FilterTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FilterTokenParser.php',
|
198 |
-
'WPML\\Core\\Twig\\TokenParser\\FlushTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FlushTokenParser.php',
|
199 |
-
'WPML\\Core\\Twig\\TokenParser\\ForTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ForTokenParser.php',
|
200 |
-
'WPML\\Core\\Twig\\TokenParser\\FromTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FromTokenParser.php',
|
201 |
-
'WPML\\Core\\Twig\\TokenParser\\IfTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/IfTokenParser.php',
|
202 |
-
'WPML\\Core\\Twig\\TokenParser\\ImportTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ImportTokenParser.php',
|
203 |
-
'WPML\\Core\\Twig\\TokenParser\\IncludeTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/IncludeTokenParser.php',
|
204 |
-
'WPML\\Core\\Twig\\TokenParser\\MacroTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/MacroTokenParser.php',
|
205 |
-
'WPML\\Core\\Twig\\TokenParser\\SandboxTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SandboxTokenParser.php',
|
206 |
-
'WPML\\Core\\Twig\\TokenParser\\SetTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SetTokenParser.php',
|
207 |
-
'WPML\\Core\\Twig\\TokenParser\\SpacelessTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SpacelessTokenParser.php',
|
208 |
-
'WPML\\Core\\Twig\\TokenParser\\TokenParserInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/TokenParserInterface.php',
|
209 |
-
'WPML\\Core\\Twig\\TokenParser\\UseTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/UseTokenParser.php',
|
210 |
-
'WPML\\Core\\Twig\\TokenParser\\WithTokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/WithTokenParser.php',
|
211 |
-
'WPML\\Core\\Twig\\TokenStream' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenStream.php',
|
212 |
-
'WPML\\Core\\Twig\\TwigFilter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigFilter.php',
|
213 |
-
'WPML\\Core\\Twig\\TwigFunction' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigFunction.php',
|
214 |
-
'WPML\\Core\\Twig\\TwigTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigTest.php',
|
215 |
-
'WPML\\Core\\Twig\\Util\\DeprecationCollector' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Util/DeprecationCollector.php',
|
216 |
-
'WPML\\Core\\Twig\\Util\\TemplateDirIterator' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/src/Util/TemplateDirIterator.php',
|
217 |
-
'WPML\\Core\\Twig_Autoloader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Autoloader.php',
|
218 |
-
'WPML\\Core\\Twig_BaseNodeVisitor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/BaseNodeVisitor.php',
|
219 |
-
'WPML\\Core\\Twig_CacheInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/CacheInterface.php',
|
220 |
-
'WPML\\Core\\Twig_Cache_Filesystem' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Filesystem.php',
|
221 |
-
'WPML\\Core\\Twig_Cache_Null' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Null.php',
|
222 |
-
'WPML\\Core\\Twig_Compiler' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Compiler.php',
|
223 |
-
'WPML\\Core\\Twig_CompilerInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/CompilerInterface.php',
|
224 |
-
'WPML\\Core\\Twig_ContainerRuntimeLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ContainerRuntimeLoader.php',
|
225 |
-
'WPML\\Core\\Twig_Environment' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Environment.php',
|
226 |
-
'WPML\\Core\\Twig_Error' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error.php',
|
227 |
-
'WPML\\Core\\Twig_Error_Loader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Loader.php',
|
228 |
-
'WPML\\Core\\Twig_Error_Runtime' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Runtime.php',
|
229 |
-
'WPML\\Core\\Twig_Error_Syntax' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Syntax.php',
|
230 |
-
'WPML\\Core\\Twig_ExistsLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExistsLoaderInterface.php',
|
231 |
-
'WPML\\Core\\Twig_ExpressionParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExpressionParser.php',
|
232 |
-
'WPML\\Core\\Twig_Extension' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension.php',
|
233 |
-
'WPML\\Core\\Twig_ExtensionInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExtensionInterface.php',
|
234 |
-
'WPML\\Core\\Twig_Extension_Core' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Core.php',
|
235 |
-
'WPML\\Core\\Twig_Extension_Debug' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Debug.php',
|
236 |
-
'WPML\\Core\\Twig_Extension_Escaper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Escaper.php',
|
237 |
-
'WPML\\Core\\Twig_Extension_GlobalsInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/GlobalsInterface.php',
|
238 |
-
'WPML\\Core\\Twig_Extension_InitRuntimeInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/InitRuntimeInterface.php',
|
239 |
-
'WPML\\Core\\Twig_Extension_Optimizer' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Optimizer.php',
|
240 |
-
'WPML\\Core\\Twig_Extension_Profiler' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Profiler.php',
|
241 |
-
'WPML\\Core\\Twig_Extension_Sandbox' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Sandbox.php',
|
242 |
-
'WPML\\Core\\Twig_Extension_Staging' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Staging.php',
|
243 |
-
'WPML\\Core\\Twig_Extension_StringLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/StringLoader.php',
|
244 |
-
'WPML\\Core\\Twig_FactoryRuntimeLoader' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FactoryRuntimeLoader.php',
|
245 |
-
'WPML\\Core\\Twig_FileExtensionEscapingStrategy' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FileExtensionEscapingStrategy.php',
|
246 |
-
'WPML\\Core\\Twig_Filter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter.php',
|
247 |
-
'WPML\\Core\\Twig_FilterCallableInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FilterCallableInterface.php',
|
248 |
-
'WPML\\Core\\Twig_FilterInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FilterInterface.php',
|
249 |
-
'WPML\\Core\\Twig_Filter_Function' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Function.php',
|
250 |
-
'WPML\\Core\\Twig_Filter_Method' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Method.php',
|
251 |
-
'WPML\\Core\\Twig_Filter_Node' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Node.php',
|
252 |
-
'WPML\\Core\\Twig_Function' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function.php',
|
253 |
-
'WPML\\Core\\Twig_FunctionCallableInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionCallableInterface.php',
|
254 |
-
'WPML\\Core\\Twig_FunctionInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionInterface.php',
|
255 |
-
'WPML\\Core\\Twig_Function_Function' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Function.php',
|
256 |
-
'WPML\\Core\\Twig_Function_Method' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Method.php',
|
257 |
-
'WPML\\Core\\Twig_Function_Node' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Node.php',
|
258 |
-
'WPML\\Core\\Twig_Lexer' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Lexer.php',
|
259 |
-
'WPML\\Core\\Twig_LexerInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/LexerInterface.php',
|
260 |
-
'WPML\\Core\\Twig_LoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/LoaderInterface.php',
|
261 |
-
'WPML\\Core\\Twig_Loader_Array' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Array.php',
|
262 |
-
'WPML\\Core\\Twig_Loader_Chain' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Chain.php',
|
263 |
-
'WPML\\Core\\Twig_Loader_Filesystem' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Filesystem.php',
|
264 |
-
'WPML\\Core\\Twig_Loader_String' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/String.php',
|
265 |
-
'WPML\\Core\\Twig_Markup' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Markup.php',
|
266 |
-
'WPML\\Core\\Twig_Node' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node.php',
|
267 |
-
'WPML\\Core\\Twig_NodeCaptureInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeCaptureInterface.php',
|
268 |
-
'WPML\\Core\\Twig_NodeInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeInterface.php',
|
269 |
-
'WPML\\Core\\Twig_NodeOutputInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeOutputInterface.php',
|
270 |
-
'WPML\\Core\\Twig_NodeTraverser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeTraverser.php',
|
271 |
-
'WPML\\Core\\Twig_NodeVisitorInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitorInterface.php',
|
272 |
-
'WPML\\Core\\Twig_NodeVisitor_Escaper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Escaper.php',
|
273 |
-
'WPML\\Core\\Twig_NodeVisitor_Optimizer' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Optimizer.php',
|
274 |
-
'WPML\\Core\\Twig_NodeVisitor_SafeAnalysis' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/SafeAnalysis.php',
|
275 |
-
'WPML\\Core\\Twig_NodeVisitor_Sandbox' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Sandbox.php',
|
276 |
-
'WPML\\Core\\Twig_Node_AutoEscape' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/AutoEscape.php',
|
277 |
-
'WPML\\Core\\Twig_Node_Block' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Block.php',
|
278 |
-
'WPML\\Core\\Twig_Node_BlockReference' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/BlockReference.php',
|
279 |
-
'WPML\\Core\\Twig_Node_Body' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Body.php',
|
280 |
-
'WPML\\Core\\Twig_Node_CheckSecurity' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/CheckSecurity.php',
|
281 |
-
'WPML\\Core\\Twig_Node_Deprecated' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Deprecated.php',
|
282 |
-
'WPML\\Core\\Twig_Node_Do' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Do.php',
|
283 |
-
'WPML\\Core\\Twig_Node_Embed' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Embed.php',
|
284 |
-
'WPML\\Core\\Twig_Node_Expression' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression.php',
|
285 |
-
'WPML\\Core\\Twig_Node_Expression_Array' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Array.php',
|
286 |
-
'WPML\\Core\\Twig_Node_Expression_AssignName' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/AssignName.php',
|
287 |
-
'WPML\\Core\\Twig_Node_Expression_Binary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary.php',
|
288 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Add' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Add.php',
|
289 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_And' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/And.php',
|
290 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseAnd' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php',
|
291 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseOr' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php',
|
292 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseXor' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php',
|
293 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Concat' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Concat.php',
|
294 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Div' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Div.php',
|
295 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_EndsWith' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/EndsWith.php',
|
296 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Equal' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Equal.php',
|
297 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_FloorDiv' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php',
|
298 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Greater' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Greater.php',
|
299 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_GreaterEqual' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php',
|
300 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_In' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/In.php',
|
301 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Less' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Less.php',
|
302 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_LessEqual' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/LessEqual.php',
|
303 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Matches' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Matches.php',
|
304 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Mod' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mod.php',
|
305 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Mul' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mul.php',
|
306 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_NotEqual' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotEqual.php',
|
307 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_NotIn' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotIn.php',
|
308 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Or' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Or.php',
|
309 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Power' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Power.php',
|
310 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Range' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Range.php',
|
311 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_StartsWith' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/StartsWith.php',
|
312 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Sub' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Sub.php',
|
313 |
-
'WPML\\Core\\Twig_Node_Expression_BlockReference' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/BlockReference.php',
|
314 |
-
'WPML\\Core\\Twig_Node_Expression_Call' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Call.php',
|
315 |
-
'WPML\\Core\\Twig_Node_Expression_Conditional' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Conditional.php',
|
316 |
-
'WPML\\Core\\Twig_Node_Expression_Constant' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Constant.php',
|
317 |
-
'WPML\\Core\\Twig_Node_Expression_ExtensionReference' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/ExtensionReference.php',
|
318 |
-
'WPML\\Core\\Twig_Node_Expression_Filter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter.php',
|
319 |
-
'WPML\\Core\\Twig_Node_Expression_Filter_Default' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter/Default.php',
|
320 |
-
'WPML\\Core\\Twig_Node_Expression_Function' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Function.php',
|
321 |
-
'WPML\\Core\\Twig_Node_Expression_GetAttr' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/GetAttr.php',
|
322 |
-
'WPML\\Core\\Twig_Node_Expression_MethodCall' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/MethodCall.php',
|
323 |
-
'WPML\\Core\\Twig_Node_Expression_Name' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Name.php',
|
324 |
-
'WPML\\Core\\Twig_Node_Expression_NullCoalesce' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/NullCoalesce.php',
|
325 |
-
'WPML\\Core\\Twig_Node_Expression_Parent' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Parent.php',
|
326 |
-
'WPML\\Core\\Twig_Node_Expression_TempName' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/TempName.php',
|
327 |
-
'WPML\\Core\\Twig_Node_Expression_Test' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test.php',
|
328 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Constant' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Constant.php',
|
329 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Defined' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Defined.php',
|
330 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Divisibleby' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Divisibleby.php',
|
331 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Even' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Even.php',
|
332 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Null' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Null.php',
|
333 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Odd' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Odd.php',
|
334 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Sameas' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Sameas.php',
|
335 |
-
'WPML\\Core\\Twig_Node_Expression_Unary' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary.php',
|
336 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Neg' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Neg.php',
|
337 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Not' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Not.php',
|
338 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Pos' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Pos.php',
|
339 |
-
'WPML\\Core\\Twig_Node_Flush' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Flush.php',
|
340 |
-
'WPML\\Core\\Twig_Node_For' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/For.php',
|
341 |
-
'WPML\\Core\\Twig_Node_ForLoop' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/ForLoop.php',
|
342 |
-
'WPML\\Core\\Twig_Node_If' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/If.php',
|
343 |
-
'WPML\\Core\\Twig_Node_Import' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Import.php',
|
344 |
-
'WPML\\Core\\Twig_Node_Include' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Include.php',
|
345 |
-
'WPML\\Core\\Twig_Node_Macro' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Macro.php',
|
346 |
-
'WPML\\Core\\Twig_Node_Module' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Module.php',
|
347 |
-
'WPML\\Core\\Twig_Node_Print' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Print.php',
|
348 |
-
'WPML\\Core\\Twig_Node_Sandbox' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Sandbox.php',
|
349 |
-
'WPML\\Core\\Twig_Node_SandboxedPrint' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SandboxedPrint.php',
|
350 |
-
'WPML\\Core\\Twig_Node_Set' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Set.php',
|
351 |
-
'WPML\\Core\\Twig_Node_SetTemp' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SetTemp.php',
|
352 |
-
'WPML\\Core\\Twig_Node_Spaceless' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Spaceless.php',
|
353 |
-
'WPML\\Core\\Twig_Node_Text' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Text.php',
|
354 |
-
'WPML\\Core\\Twig_Node_With' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/With.php',
|
355 |
-
'WPML\\Core\\Twig_Parser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Parser.php',
|
356 |
-
'WPML\\Core\\Twig_ParserInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ParserInterface.php',
|
357 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Base' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Base.php',
|
358 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Blackfire' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Blackfire.php',
|
359 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Html' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Html.php',
|
360 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Text' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Text.php',
|
361 |
-
'WPML\\Core\\Twig_Profiler_NodeVisitor_Profiler' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php',
|
362 |
-
'WPML\\Core\\Twig_Profiler_Node_EnterProfile' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/EnterProfile.php',
|
363 |
-
'WPML\\Core\\Twig_Profiler_Node_LeaveProfile' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/LeaveProfile.php',
|
364 |
-
'WPML\\Core\\Twig_Profiler_Profile' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Profile.php',
|
365 |
-
'WPML\\Core\\Twig_RuntimeLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/RuntimeLoaderInterface.php',
|
366 |
-
'WPML\\Core\\Twig_Sandbox_SecurityError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityError.php',
|
367 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFilterError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php',
|
368 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFunctionError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php',
|
369 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedMethodError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php',
|
370 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedPropertyError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php',
|
371 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedTagError' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php',
|
372 |
-
'WPML\\Core\\Twig_Sandbox_SecurityPolicy' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicy.php',
|
373 |
-
'WPML\\Core\\Twig_Sandbox_SecurityPolicyInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php',
|
374 |
-
'WPML\\Core\\Twig_SimpleFilter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFilter.php',
|
375 |
-
'WPML\\Core\\Twig_SimpleFunction' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFunction.php',
|
376 |
-
'WPML\\Core\\Twig_SimpleTest' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleTest.php',
|
377 |
-
'WPML\\Core\\Twig_Source' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Source.php',
|
378 |
-
'WPML\\Core\\Twig_SourceContextLoaderInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SourceContextLoaderInterface.php',
|
379 |
-
'WPML\\Core\\Twig_Template' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Template.php',
|
380 |
-
'WPML\\Core\\Twig_TemplateInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateInterface.php',
|
381 |
-
'WPML\\Core\\Twig_TemplateWrapper' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateWrapper.php',
|
382 |
-
'WPML\\Core\\Twig_Test' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test.php',
|
383 |
-
'WPML\\Core\\Twig_TestCallableInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TestCallableInterface.php',
|
384 |
-
'WPML\\Core\\Twig_TestInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TestInterface.php',
|
385 |
-
'WPML\\Core\\Twig_Test_Function' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Function.php',
|
386 |
-
'WPML\\Core\\Twig_Test_IntegrationTestCase' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/IntegrationTestCase.php',
|
387 |
-
'WPML\\Core\\Twig_Test_Method' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Method.php',
|
388 |
-
'WPML\\Core\\Twig_Test_Node' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Node.php',
|
389 |
-
'WPML\\Core\\Twig_Test_NodeTestCase' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/NodeTestCase.php',
|
390 |
-
'WPML\\Core\\Twig_Token' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Token.php',
|
391 |
-
'WPML\\Core\\Twig_TokenParser' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser.php',
|
392 |
-
'WPML\\Core\\Twig_TokenParserBroker' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBroker.php',
|
393 |
-
'WPML\\Core\\Twig_TokenParserBrokerInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBrokerInterface.php',
|
394 |
-
'WPML\\Core\\Twig_TokenParserInterface' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserInterface.php',
|
395 |
-
'WPML\\Core\\Twig_TokenParser_AutoEscape' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/AutoEscape.php',
|
396 |
-
'WPML\\Core\\Twig_TokenParser_Block' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Block.php',
|
397 |
-
'WPML\\Core\\Twig_TokenParser_Deprecated' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Deprecated.php',
|
398 |
-
'WPML\\Core\\Twig_TokenParser_Do' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Do.php',
|
399 |
-
'WPML\\Core\\Twig_TokenParser_Embed' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Embed.php',
|
400 |
-
'WPML\\Core\\Twig_TokenParser_Extends' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Extends.php',
|
401 |
-
'WPML\\Core\\Twig_TokenParser_Filter' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Filter.php',
|
402 |
-
'WPML\\Core\\Twig_TokenParser_Flush' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Flush.php',
|
403 |
-
'WPML\\Core\\Twig_TokenParser_For' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/For.php',
|
404 |
-
'WPML\\Core\\Twig_TokenParser_From' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/From.php',
|
405 |
-
'WPML\\Core\\Twig_TokenParser_If' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/If.php',
|
406 |
-
'WPML\\Core\\Twig_TokenParser_Import' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Import.php',
|
407 |
-
'WPML\\Core\\Twig_TokenParser_Include' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Include.php',
|
408 |
-
'WPML\\Core\\Twig_TokenParser_Macro' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Macro.php',
|
409 |
-
'WPML\\Core\\Twig_TokenParser_Sandbox' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Sandbox.php',
|
410 |
-
'WPML\\Core\\Twig_TokenParser_Set' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Set.php',
|
411 |
-
'WPML\\Core\\Twig_TokenParser_Spaceless' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Spaceless.php',
|
412 |
-
'WPML\\Core\\Twig_TokenParser_Use' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Use.php',
|
413 |
-
'WPML\\Core\\Twig_TokenParser_With' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/With.php',
|
414 |
-
'WPML\\Core\\Twig_TokenStream' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenStream.php',
|
415 |
-
'WPML\\Core\\Twig_Util_DeprecationCollector' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Util/DeprecationCollector.php',
|
416 |
-
'WPML\\Core\\Twig_Util_TemplateDirIterator' => $vendorDir . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Util/TemplateDirIterator.php',
|
417 |
-
'WPML\\DocPage' => $vendorDir . '/wpml/core-api/core/DocPage.php',
|
418 |
-
'WPML\\Element\\API\\Entity\\LanguageMapping' => $vendorDir . '/wpml/core-api/core/Entity/LanguageMapping.php',
|
419 |
-
'WPML\\Element\\API\\IfOriginalPost' => $vendorDir . '/wpml/core-api/core/IfOriginalPost.php',
|
420 |
-
'WPML\\Element\\API\\Languages' => $vendorDir . '/wpml/core-api/core/Languages.php',
|
421 |
-
'WPML\\Element\\API\\Post' => $vendorDir . '/wpml/core-api/core/Post.php',
|
422 |
-
'WPML\\Element\\API\\PostTranslations' => $vendorDir . '/wpml/core-api/core/PostTranslations.php',
|
423 |
-
'WPML\\Element\\API\\Translations' => $vendorDir . '/wpml/core-api/core/Translations.php',
|
424 |
-
'WPML\\Element\\API\\TranslationsRepository' => $vendorDir . '/wpml/core-api/core/TranslationsRepository.php',
|
425 |
-
'WPML\\FP\\Applicative' => $vendorDir . '/wpml/fp/core/Functor/Applicative.php',
|
426 |
-
'WPML\\FP\\Cast' => $vendorDir . '/wpml/fp/core/Cast.php',
|
427 |
-
'WPML\\FP\\ConstApplicative' => $vendorDir . '/wpml/fp/core/Functor/ConstApplicative.php',
|
428 |
-
'WPML\\FP\\Curryable' => $vendorDir . '/wpml/fp/core/traits/Curryable.php',
|
429 |
-
'WPML\\FP\\Debug' => $vendorDir . '/wpml/fp/core/Debug.php',
|
430 |
-
'WPML\\FP\\Either' => $vendorDir . '/wpml/fp/core/Either.php',
|
431 |
-
'WPML\\FP\\FP' => $vendorDir . '/wpml/fp/core/FP.php',
|
432 |
-
'WPML\\FP\\Fns' => $vendorDir . '/wpml/fp/core/Fns.php',
|
433 |
-
'WPML\\FP\\Functor\\ConstFunctor' => $vendorDir . '/wpml/fp/core/Functor/ConstFunctor.php',
|
434 |
-
'WPML\\FP\\Functor\\Functor' => $vendorDir . '/wpml/fp/core/Functor/Functor.php',
|
435 |
-
'WPML\\FP\\Functor\\IdentityFunctor' => $vendorDir . '/wpml/fp/core/Functor/IdentityFunctor.php',
|
436 |
-
'WPML\\FP\\Functor\\Pointed' => $vendorDir . '/wpml/fp/core/Functor/Pointed.php',
|
437 |
-
'WPML\\FP\\Json' => $vendorDir . '/wpml/fp/core/Json.php',
|
438 |
-
'WPML\\FP\\Just' => $vendorDir . '/wpml/fp/core/Maybe.php',
|
439 |
-
'WPML\\FP\\Left' => $vendorDir . '/wpml/fp/core/Either.php',
|
440 |
-
'WPML\\FP\\Logic' => $vendorDir . '/wpml/fp/core/Logic.php',
|
441 |
-
'WPML\\FP\\Lst' => $vendorDir . '/wpml/fp/core/Lst.php',
|
442 |
-
'WPML\\FP\\Math' => $vendorDir . '/wpml/fp/core/Math.php',
|
443 |
-
'WPML\\FP\\Maybe' => $vendorDir . '/wpml/fp/core/Maybe.php',
|
444 |
-
'WPML\\FP\\Nothing' => $vendorDir . '/wpml/fp/core/Maybe.php',
|
445 |
-
'WPML\\FP\\Obj' => $vendorDir . '/wpml/fp/core/Obj.php',
|
446 |
-
'WPML\\FP\\Promise' => $vendorDir . '/wpml/fp/core/Promise.php',
|
447 |
-
'WPML\\FP\\Relation' => $vendorDir . '/wpml/fp/core/Relation.php',
|
448 |
-
'WPML\\FP\\Right' => $vendorDir . '/wpml/fp/core/Either.php',
|
449 |
-
'WPML\\FP\\Str' => $vendorDir . '/wpml/fp/core/Strings.php',
|
450 |
-
'WPML\\FP\\System\\System' => $vendorDir . '/wpml/fp/core/SystemClass.php',
|
451 |
-
'WPML\\FP\\System\\_Filter' => $vendorDir . '/wpml/fp/core/Filter.php',
|
452 |
-
'WPML\\FP\\System\\_Validator' => $vendorDir . '/wpml/fp/core/Validator.php',
|
453 |
-
'WPML\\FP\\Undefined' => $vendorDir . '/wpml/fp/core/Undefined.php',
|
454 |
-
'WPML\\FP\\Wrapper' => $vendorDir . '/wpml/fp/core/Wrapper.php',
|
455 |
-
'WPML\\FP\\_Invoker' => $vendorDir . '/wpml/fp/core/Invoker.php',
|
456 |
-
'WPML\\LIB\\WP\\App\\Resources' => $vendorDir . '/wpml/wp/classes/Resources.php',
|
457 |
-
'WPML\\LIB\\WP\\Attachment' => $vendorDir . '/wpml/wp/classes/Attachment.php',
|
458 |
-
'WPML\\LIB\\WP\\Cache' => $vendorDir . '/wpml/wp/classes/Cache.php',
|
459 |
-
'WPML\\LIB\\WP\\Gutenberg' => $vendorDir . '/wpml/wp/classes/Gutenberg.php',
|
460 |
-
'WPML\\LIB\\WP\\Hooks' => $vendorDir . '/wpml/wp/classes/Hooks.php',
|
461 |
-
'WPML\\LIB\\WP\\Http' => $vendorDir . '/wpml/wp/classes/Http.php',
|
462 |
-
'WPML\\LIB\\WP\\Nonce' => $vendorDir . '/wpml/wp/classes/Nonce.php',
|
463 |
-
'WPML\\LIB\\WP\\Option' => $vendorDir . '/wpml/wp/classes/Option.php',
|
464 |
-
'WPML\\LIB\\WP\\Post' => $vendorDir . '/wpml/wp/classes/Post.php',
|
465 |
-
'WPML\\LIB\\WP\\PostType' => $vendorDir . '/wpml/wp/classes/PostType.php',
|
466 |
-
'WPML\\LIB\\WP\\Roles' => $vendorDir . '/wpml/wp/classes/Roles.php',
|
467 |
-
'WPML\\LIB\\WP\\Transient' => $vendorDir . '/wpml/wp/classes/Transient.php',
|
468 |
-
'WPML\\LIB\\WP\\User' => $vendorDir . '/wpml/wp/classes/User.php',
|
469 |
-
'WPML\\LIB\\WP\\WPDB' => $vendorDir . '/wpml/wp/classes/WPDB.php',
|
470 |
-
'WPML\\LIB\\WP\\WordPress' => $vendorDir . '/wpml/wp/classes/WP.php',
|
471 |
-
'WPML\\Media\\Option' => $vendorDir . '/wpml/core-api/core/media/Option.php',
|
472 |
-
'WPML\\Notices\\DismissNotices' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/DismissNotices.php',
|
473 |
-
'WPML\\Records\\Translations' => $vendorDir . '/wpml/core-api/core/Records/Translations.php',
|
474 |
-
'WPML\\Settings\\PostType\\Automatic' => $vendorDir . '/wpml/core-api/core/settings/Automatic.php',
|
475 |
-
'WPML\\Setup\\Option' => $vendorDir . '/wpml/core-api/core/setup/Option.php',
|
476 |
-
'WPML\\Timer' => $vendorDir . '/wpml/core-api/core/Timer.php',
|
477 |
-
'WPML\\UIPage' => $vendorDir . '/wpml/core-api/core/UIPage.php',
|
478 |
-
'WPML\\Utilities\\ILock' => $vendorDir . '/wpml/core-api/core/utility/ILock.php',
|
479 |
-
'WPML\\Utilities\\Lock' => $vendorDir . '/wpml/core-api/core/utility/Lock.php',
|
480 |
-
'WPML\\WP\\OptionManager' => $vendorDir . '/wpml/core-api/core/OptionManager.php',
|
481 |
-
'WPML_AJAX_Action_Validation' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-validation.php',
|
482 |
-
'WPML_AJAX_Base_Factory' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-base-factory.php',
|
483 |
-
'WPML_Action_Filter_Loader' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-filter-loader.php',
|
484 |
-
'WPML_Block_Editor_Helper' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/block-editor/class-wpml-block-editor-helper.php',
|
485 |
-
'WPML_Cookie' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/cookie/class-wpml-cookie.php',
|
486 |
-
'WPML_Core_Privacy_Content' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-core-privacy-content.php',
|
487 |
-
'WPML_Current_Screen_Loader_Factory' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-current-screen-loader-factory.php',
|
488 |
-
'WPML_File' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/class-wpml-file.php',
|
489 |
-
'WPML_Notice' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice.php',
|
490 |
-
'WPML_Notice_Action' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice-action.php',
|
491 |
-
'WPML_Notice_Render' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice-render.php',
|
492 |
-
'WPML_Notice_Show_On_Dashboard_And_WPML_Pages' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/pages/class-wpml-notice-show-on-dashboard-and-wpml-pages.php',
|
493 |
-
'WPML_Notices' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notices.php',
|
494 |
-
'WPML_PHP_Functions' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/wpml-php-functions.php',
|
495 |
-
'WPML_Privacy_Content' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content.php',
|
496 |
-
'WPML_Privacy_Content_Factory' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content-factory.php',
|
497 |
-
'WPML_Templates_Factory' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/templating/class-wpml-templates-factory.php',
|
498 |
-
'WPML_Twig_Template' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/templates/class-wpml-twig-template.php',
|
499 |
-
'WPML_Twig_Template_Loader' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/templates/wpml-twig-template-loader.php',
|
500 |
-
'WPML_Twig_WP_Plugin_Extension' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/twig-extensions/wpml-twig-wp-plugin-extension.php',
|
501 |
-
'WPML_WP_API' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-api.php',
|
502 |
-
'WPML_WP_Cache' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/utilities/class-wpml-wp-cache.php',
|
503 |
-
'WPML_WP_Post_Type' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/wpml-wp-post-type.php',
|
504 |
-
'WPML_WP_Roles' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-roles.php',
|
505 |
-
'WPML_WP_Taxonomy' => $vendorDir . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-taxonomy.php',
|
506 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/composer/autoload_static.php
DELETED
@@ -1,545 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_static.php @generated by Composer
|
4 |
-
|
5 |
-
namespace Composer\Autoload;
|
6 |
-
|
7 |
-
class ComposerStaticInit4821ed1a7ed1caf1298338b695908544
|
8 |
-
{
|
9 |
-
public static $files = array (
|
10 |
-
'5f5b8f7c1db2e892006e8805f0ed573c' => __DIR__ . '/..' . '/wpml/collect/src/Illuminate/Support/helpers.php',
|
11 |
-
'914c4a8cb7e06f7d6e1ddf6997c1785f' => __DIR__ . '/..' . '/wpml/fp/core/functions.php',
|
12 |
-
'348332d63f916da7598941d18c24311d' => __DIR__ . '/..' . '/wpml/fp/core/strings_functions.php',
|
13 |
-
'766b758ee51e52c53cf3312a1dba9e34' => __DIR__ . '/..' . '/wpml/fp/core/system.php',
|
14 |
-
'4f861be014c38ae526415a9a3c62913a' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/container/functions.php',
|
15 |
-
);
|
16 |
-
|
17 |
-
public static $prefixLengthsPsr4 = array (
|
18 |
-
'W' =>
|
19 |
-
array (
|
20 |
-
'WPML\\Collect\\' => 13,
|
21 |
-
'WPML\\Auryn\\' => 11,
|
22 |
-
),
|
23 |
-
);
|
24 |
-
|
25 |
-
public static $prefixDirsPsr4 = array (
|
26 |
-
'WPML\\Collect\\' =>
|
27 |
-
array (
|
28 |
-
0 => __DIR__ . '/..' . '/wpml/collect/src/Illuminate',
|
29 |
-
),
|
30 |
-
'WPML\\Auryn\\' =>
|
31 |
-
array (
|
32 |
-
0 => __DIR__ . '/..' . '/otgs/auryn/lib',
|
33 |
-
),
|
34 |
-
);
|
35 |
-
|
36 |
-
public static $classMap = array (
|
37 |
-
'ICL_AdminNotifier' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/inc/icl-admin-notifier.php',
|
38 |
-
'IWPML_AJAX_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-ajax-action.php',
|
39 |
-
'IWPML_AJAX_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-ajax-action-loader.php',
|
40 |
-
'IWPML_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-action.php',
|
41 |
-
'IWPML_Action_Loader_Factory' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-action-loader-factory.php',
|
42 |
-
'IWPML_Backend_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-backend-action.php',
|
43 |
-
'IWPML_Backend_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-backend-action-loader.php',
|
44 |
-
'IWPML_CLI_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-cli-action.php',
|
45 |
-
'IWPML_CLI_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-cli-action-loader.php',
|
46 |
-
'IWPML_Current_Language' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/languages/interface-iwpml-current-language.php',
|
47 |
-
'IWPML_DIC_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-dic-action.php',
|
48 |
-
'IWPML_Deferred_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-deferred-action-loader.php',
|
49 |
-
'IWPML_Frontend_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-frontend-action.php',
|
50 |
-
'IWPML_Frontend_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-frontend-action-loader.php',
|
51 |
-
'IWPML_REST_Action' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-rest-action.php',
|
52 |
-
'IWPML_REST_Action_Loader' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/actions/interface-iwpml-rest-action-loader.php',
|
53 |
-
'IWPML_Template_Service' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/templates/interface-iwpml-template-service.php',
|
54 |
-
'IWPML_WP_Element_Type' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/iwpml-wp-element-type.php',
|
55 |
-
'OTGS_Assets_Handles' => __DIR__ . '/..' . '/otgs/ui/src/php/OTGS_Assets_Handles.php',
|
56 |
-
'OTGS_Assets_Store' => __DIR__ . '/..' . '/otgs/ui/src/php/OTGS_Assets_Store.php',
|
57 |
-
'OTGS_UI_Assets' => __DIR__ . '/..' . '/otgs/ui/src/php/OTGS_UI_Assets.php',
|
58 |
-
'OTGS_UI_Loader' => __DIR__ . '/..' . '/otgs/ui/src/php/OTGS_UI_Loader.php',
|
59 |
-
'WPML\\API\\PostTypes' => __DIR__ . '/..' . '/wpml/core-api/core/PostTypes.php',
|
60 |
-
'WPML\\API\\Settings' => __DIR__ . '/..' . '/wpml/core-api/core/Settings.php',
|
61 |
-
'WPML\\API\\Version' => __DIR__ . '/..' . '/wpml/core-api/core/Version.php',
|
62 |
-
'WPML\\Action\\Type' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-type.php',
|
63 |
-
'WPML\\Ajax\\IHandler' => __DIR__ . '/..' . '/wpml/core-api/core/interfaces/ajax/Handler.php',
|
64 |
-
'WPML\\Container\\Config' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/container/class-config.php',
|
65 |
-
'WPML\\Container\\Container' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/container/class-wpml-container.php',
|
66 |
-
'WPML\\Core\\BackgroundTask' => __DIR__ . '/..' . '/wpml/core-api/core/utility/BackgroundTask.php',
|
67 |
-
'WPML\\Core\\ISitePress' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/ISitePress.php',
|
68 |
-
'WPML\\Core\\Twig\\Cache\\CacheInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/CacheInterface.php',
|
69 |
-
'WPML\\Core\\Twig\\Cache\\FilesystemCache' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/FilesystemCache.php',
|
70 |
-
'WPML\\Core\\Twig\\Cache\\NullCache' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Cache/NullCache.php',
|
71 |
-
'WPML\\Core\\Twig\\Compiler' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Compiler.php',
|
72 |
-
'WPML\\Core\\Twig\\Environment' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Environment.php',
|
73 |
-
'WPML\\Core\\Twig\\Error\\Error' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/Error.php',
|
74 |
-
'WPML\\Core\\Twig\\Error\\LoaderError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/LoaderError.php',
|
75 |
-
'WPML\\Core\\Twig\\Error\\RuntimeError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/RuntimeError.php',
|
76 |
-
'WPML\\Core\\Twig\\Error\\SyntaxError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Error/SyntaxError.php',
|
77 |
-
'WPML\\Core\\Twig\\ExpressionParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/ExpressionParser.php',
|
78 |
-
'WPML\\Core\\Twig\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/AbstractExtension.php',
|
79 |
-
'WPML\\Core\\Twig\\Extension\\CoreExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/CoreExtension.php',
|
80 |
-
'WPML\\Core\\Twig\\Extension\\DebugExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/DebugExtension.php',
|
81 |
-
'WPML\\Core\\Twig\\Extension\\EscaperExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/EscaperExtension.php',
|
82 |
-
'WPML\\Core\\Twig\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/ExtensionInterface.php',
|
83 |
-
'WPML\\Core\\Twig\\Extension\\GlobalsInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/GlobalsInterface.php',
|
84 |
-
'WPML\\Core\\Twig\\Extension\\InitRuntimeInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/InitRuntimeInterface.php',
|
85 |
-
'WPML\\Core\\Twig\\Extension\\OptimizerExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/OptimizerExtension.php',
|
86 |
-
'WPML\\Core\\Twig\\Extension\\ProfilerExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/ProfilerExtension.php',
|
87 |
-
'WPML\\Core\\Twig\\Extension\\RuntimeExtensionInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/RuntimeExtensionInterface.php',
|
88 |
-
'WPML\\Core\\Twig\\Extension\\SandboxExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/SandboxExtension.php',
|
89 |
-
'WPML\\Core\\Twig\\Extension\\StagingExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/StagingExtension.php',
|
90 |
-
'WPML\\Core\\Twig\\Extension\\StringLoaderExtension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Extension/StringLoaderExtension.php',
|
91 |
-
'WPML\\Core\\Twig\\FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/FileExtensionEscapingStrategy.php',
|
92 |
-
'WPML\\Core\\Twig\\Lexer' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Lexer.php',
|
93 |
-
'WPML\\Core\\Twig\\Loader\\ArrayLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ArrayLoader.php',
|
94 |
-
'WPML\\Core\\Twig\\Loader\\ChainLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ChainLoader.php',
|
95 |
-
'WPML\\Core\\Twig\\Loader\\ExistsLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/ExistsLoaderInterface.php',
|
96 |
-
'WPML\\Core\\Twig\\Loader\\FilesystemLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/FilesystemLoader.php',
|
97 |
-
'WPML\\Core\\Twig\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/LoaderInterface.php',
|
98 |
-
'WPML\\Core\\Twig\\Loader\\SourceContextLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Loader/SourceContextLoaderInterface.php',
|
99 |
-
'WPML\\Core\\Twig\\Markup' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Markup.php',
|
100 |
-
'WPML\\Core\\Twig\\NodeTraverser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeTraverser.php',
|
101 |
-
'WPML\\Core\\Twig\\NodeVisitor\\AbstractNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/AbstractNodeVisitor.php',
|
102 |
-
'WPML\\Core\\Twig\\NodeVisitor\\EscaperNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/EscaperNodeVisitor.php',
|
103 |
-
'WPML\\Core\\Twig\\NodeVisitor\\NodeVisitorInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/NodeVisitorInterface.php',
|
104 |
-
'WPML\\Core\\Twig\\NodeVisitor\\OptimizerNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/OptimizerNodeVisitor.php',
|
105 |
-
'WPML\\Core\\Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php',
|
106 |
-
'WPML\\Core\\Twig\\NodeVisitor\\SandboxNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SandboxNodeVisitor.php',
|
107 |
-
'WPML\\Core\\Twig\\Node\\AutoEscapeNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/AutoEscapeNode.php',
|
108 |
-
'WPML\\Core\\Twig\\Node\\BlockNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BlockNode.php',
|
109 |
-
'WPML\\Core\\Twig\\Node\\BlockReferenceNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BlockReferenceNode.php',
|
110 |
-
'WPML\\Core\\Twig\\Node\\BodyNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/BodyNode.php',
|
111 |
-
'WPML\\Core\\Twig\\Node\\CheckSecurityNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/CheckSecurityNode.php',
|
112 |
-
'WPML\\Core\\Twig\\Node\\CheckToStringNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/CheckToStringNode.php',
|
113 |
-
'WPML\\Core\\Twig\\Node\\DeprecatedNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/DeprecatedNode.php',
|
114 |
-
'WPML\\Core\\Twig\\Node\\DoNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/DoNode.php',
|
115 |
-
'WPML\\Core\\Twig\\Node\\EmbedNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/EmbedNode.php',
|
116 |
-
'WPML\\Core\\Twig\\Node\\Expression\\AbstractExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/AbstractExpression.php',
|
117 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ArrayExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrayExpression.php',
|
118 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ArrowFunctionExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrowFunctionExpression.php',
|
119 |
-
'WPML\\Core\\Twig\\Node\\Expression\\AssignNameExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/AssignNameExpression.php',
|
120 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AbstractBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AbstractBinary.php',
|
121 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AddBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AddBinary.php',
|
122 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AndBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AndBinary.php',
|
123 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseAndBinary.php',
|
124 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseOrBinary.php',
|
125 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseXorBinary.php',
|
126 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ConcatBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ConcatBinary.php',
|
127 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\DivBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/DivBinary.php',
|
128 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EndsWithBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EndsWithBinary.php',
|
129 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EqualBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EqualBinary.php',
|
130 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\FloorDivBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/FloorDivBinary.php',
|
131 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterBinary.php',
|
132 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterEqualBinary.php',
|
133 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\InBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/InBinary.php',
|
134 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessBinary.php',
|
135 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessEqualBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessEqualBinary.php',
|
136 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MatchesBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MatchesBinary.php',
|
137 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ModBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ModBinary.php',
|
138 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MulBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MulBinary.php',
|
139 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotEqualBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotEqualBinary.php',
|
140 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotInBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotInBinary.php',
|
141 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\OrBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/OrBinary.php',
|
142 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\PowerBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/PowerBinary.php',
|
143 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\RangeBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/RangeBinary.php',
|
144 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\StartsWithBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/StartsWithBinary.php',
|
145 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Binary\\SubBinary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/SubBinary.php',
|
146 |
-
'WPML\\Core\\Twig\\Node\\Expression\\BlockReferenceExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/BlockReferenceExpression.php',
|
147 |
-
'WPML\\Core\\Twig\\Node\\Expression\\CallExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/CallExpression.php',
|
148 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ConditionalExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConditionalExpression.php',
|
149 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ConstantExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConstantExpression.php',
|
150 |
-
'WPML\\Core\\Twig\\Node\\Expression\\FilterExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/FilterExpression.php',
|
151 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Filter\\DefaultFilter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Filter/DefaultFilter.php',
|
152 |
-
'WPML\\Core\\Twig\\Node\\Expression\\FunctionExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/FunctionExpression.php',
|
153 |
-
'WPML\\Core\\Twig\\Node\\Expression\\GetAttrExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/GetAttrExpression.php',
|
154 |
-
'WPML\\Core\\Twig\\Node\\Expression\\InlinePrint' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/InlinePrint.php',
|
155 |
-
'WPML\\Core\\Twig\\Node\\Expression\\MethodCallExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/MethodCallExpression.php',
|
156 |
-
'WPML\\Core\\Twig\\Node\\Expression\\NameExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/NameExpression.php',
|
157 |
-
'WPML\\Core\\Twig\\Node\\Expression\\NullCoalesceExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/NullCoalesceExpression.php',
|
158 |
-
'WPML\\Core\\Twig\\Node\\Expression\\ParentExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/ParentExpression.php',
|
159 |
-
'WPML\\Core\\Twig\\Node\\Expression\\TempNameExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/TempNameExpression.php',
|
160 |
-
'WPML\\Core\\Twig\\Node\\Expression\\TestExpression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/TestExpression.php',
|
161 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\ConstantTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/ConstantTest.php',
|
162 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\DefinedTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DefinedTest.php',
|
163 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DivisiblebyTest.php',
|
164 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\EvenTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/EvenTest.php',
|
165 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/NullTest.php',
|
166 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\OddTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/OddTest.php',
|
167 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/SameasTest.php',
|
168 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\AbstractUnary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/AbstractUnary.php',
|
169 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NegUnary.php',
|
170 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NotUnary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NotUnary.php',
|
171 |
-
'WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/PosUnary.php',
|
172 |
-
'WPML\\Core\\Twig\\Node\\FlushNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/FlushNode.php',
|
173 |
-
'WPML\\Core\\Twig\\Node\\ForLoopNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ForLoopNode.php',
|
174 |
-
'WPML\\Core\\Twig\\Node\\ForNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ForNode.php',
|
175 |
-
'WPML\\Core\\Twig\\Node\\IfNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/IfNode.php',
|
176 |
-
'WPML\\Core\\Twig\\Node\\ImportNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ImportNode.php',
|
177 |
-
'WPML\\Core\\Twig\\Node\\IncludeNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/IncludeNode.php',
|
178 |
-
'WPML\\Core\\Twig\\Node\\MacroNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/MacroNode.php',
|
179 |
-
'WPML\\Core\\Twig\\Node\\ModuleNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/ModuleNode.php',
|
180 |
-
'WPML\\Core\\Twig\\Node\\Node' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/Node.php',
|
181 |
-
'WPML\\Core\\Twig\\Node\\NodeCaptureInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/NodeCaptureInterface.php',
|
182 |
-
'WPML\\Core\\Twig\\Node\\NodeOutputInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/NodeOutputInterface.php',
|
183 |
-
'WPML\\Core\\Twig\\Node\\PrintNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/PrintNode.php',
|
184 |
-
'WPML\\Core\\Twig\\Node\\SandboxNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SandboxNode.php',
|
185 |
-
'WPML\\Core\\Twig\\Node\\SandboxedPrintNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SandboxedPrintNode.php',
|
186 |
-
'WPML\\Core\\Twig\\Node\\SetNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SetNode.php',
|
187 |
-
'WPML\\Core\\Twig\\Node\\SetTempNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SetTempNode.php',
|
188 |
-
'WPML\\Core\\Twig\\Node\\SpacelessNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/SpacelessNode.php',
|
189 |
-
'WPML\\Core\\Twig\\Node\\TextNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/TextNode.php',
|
190 |
-
'WPML\\Core\\Twig\\Node\\WithNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Node/WithNode.php',
|
191 |
-
'WPML\\Core\\Twig\\Parser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Parser.php',
|
192 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\BaseDumper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BaseDumper.php',
|
193 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\BlackfireDumper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BlackfireDumper.php',
|
194 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/HtmlDumper.php',
|
195 |
-
'WPML\\Core\\Twig\\Profiler\\Dumper\\TextDumper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/TextDumper.php',
|
196 |
-
'WPML\\Core\\Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php',
|
197 |
-
'WPML\\Core\\Twig\\Profiler\\Node\\EnterProfileNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Node/EnterProfileNode.php',
|
198 |
-
'WPML\\Core\\Twig\\Profiler\\Node\\LeaveProfileNode' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Node/LeaveProfileNode.php',
|
199 |
-
'WPML\\Core\\Twig\\Profiler\\Profile' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Profiler/Profile.php',
|
200 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\ContainerRuntimeLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/ContainerRuntimeLoader.php',
|
201 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\FactoryRuntimeLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/FactoryRuntimeLoader.php',
|
202 |
-
'WPML\\Core\\Twig\\RuntimeLoader\\RuntimeLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/RuntimeLoaderInterface.php',
|
203 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityError.php',
|
204 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFilterError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFilterError.php',
|
205 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFunctionError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFunctionError.php',
|
206 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedMethodError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedMethodError.php',
|
207 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedPropertyError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedPropertyError.php',
|
208 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedTagError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedTagError.php',
|
209 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityPolicy' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicy.php',
|
210 |
-
'WPML\\Core\\Twig\\Sandbox\\SecurityPolicyInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicyInterface.php',
|
211 |
-
'WPML\\Core\\Twig\\Source' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Source.php',
|
212 |
-
'WPML\\Core\\Twig\\Template' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Template.php',
|
213 |
-
'WPML\\Core\\Twig\\TemplateWrapper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TemplateWrapper.php',
|
214 |
-
'WPML\\Core\\Twig\\Test\\IntegrationTestCase' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Test/IntegrationTestCase.php',
|
215 |
-
'WPML\\Core\\Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Test/NodeTestCase.php',
|
216 |
-
'WPML\\Core\\Twig\\Token' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Token.php',
|
217 |
-
'WPML\\Core\\Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/AbstractTokenParser.php',
|
218 |
-
'WPML\\Core\\Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ApplyTokenParser.php',
|
219 |
-
'WPML\\Core\\Twig\\TokenParser\\AutoEscapeTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/AutoEscapeTokenParser.php',
|
220 |
-
'WPML\\Core\\Twig\\TokenParser\\BlockTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/BlockTokenParser.php',
|
221 |
-
'WPML\\Core\\Twig\\TokenParser\\DeprecatedTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/DeprecatedTokenParser.php',
|
222 |
-
'WPML\\Core\\Twig\\TokenParser\\DoTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/DoTokenParser.php',
|
223 |
-
'WPML\\Core\\Twig\\TokenParser\\EmbedTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/EmbedTokenParser.php',
|
224 |
-
'WPML\\Core\\Twig\\TokenParser\\ExtendsTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ExtendsTokenParser.php',
|
225 |
-
'WPML\\Core\\Twig\\TokenParser\\FilterTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FilterTokenParser.php',
|
226 |
-
'WPML\\Core\\Twig\\TokenParser\\FlushTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FlushTokenParser.php',
|
227 |
-
'WPML\\Core\\Twig\\TokenParser\\ForTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ForTokenParser.php',
|
228 |
-
'WPML\\Core\\Twig\\TokenParser\\FromTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/FromTokenParser.php',
|
229 |
-
'WPML\\Core\\Twig\\TokenParser\\IfTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/IfTokenParser.php',
|
230 |
-
'WPML\\Core\\Twig\\TokenParser\\ImportTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/ImportTokenParser.php',
|
231 |
-
'WPML\\Core\\Twig\\TokenParser\\IncludeTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/IncludeTokenParser.php',
|
232 |
-
'WPML\\Core\\Twig\\TokenParser\\MacroTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/MacroTokenParser.php',
|
233 |
-
'WPML\\Core\\Twig\\TokenParser\\SandboxTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SandboxTokenParser.php',
|
234 |
-
'WPML\\Core\\Twig\\TokenParser\\SetTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SetTokenParser.php',
|
235 |
-
'WPML\\Core\\Twig\\TokenParser\\SpacelessTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/SpacelessTokenParser.php',
|
236 |
-
'WPML\\Core\\Twig\\TokenParser\\TokenParserInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/TokenParserInterface.php',
|
237 |
-
'WPML\\Core\\Twig\\TokenParser\\UseTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/UseTokenParser.php',
|
238 |
-
'WPML\\Core\\Twig\\TokenParser\\WithTokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenParser/WithTokenParser.php',
|
239 |
-
'WPML\\Core\\Twig\\TokenStream' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TokenStream.php',
|
240 |
-
'WPML\\Core\\Twig\\TwigFilter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigFilter.php',
|
241 |
-
'WPML\\Core\\Twig\\TwigFunction' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigFunction.php',
|
242 |
-
'WPML\\Core\\Twig\\TwigTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/TwigTest.php',
|
243 |
-
'WPML\\Core\\Twig\\Util\\DeprecationCollector' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Util/DeprecationCollector.php',
|
244 |
-
'WPML\\Core\\Twig\\Util\\TemplateDirIterator' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/src/Util/TemplateDirIterator.php',
|
245 |
-
'WPML\\Core\\Twig_Autoloader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Autoloader.php',
|
246 |
-
'WPML\\Core\\Twig_BaseNodeVisitor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/BaseNodeVisitor.php',
|
247 |
-
'WPML\\Core\\Twig_CacheInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/CacheInterface.php',
|
248 |
-
'WPML\\Core\\Twig_Cache_Filesystem' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Filesystem.php',
|
249 |
-
'WPML\\Core\\Twig_Cache_Null' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Null.php',
|
250 |
-
'WPML\\Core\\Twig_Compiler' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Compiler.php',
|
251 |
-
'WPML\\Core\\Twig_CompilerInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/CompilerInterface.php',
|
252 |
-
'WPML\\Core\\Twig_ContainerRuntimeLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ContainerRuntimeLoader.php',
|
253 |
-
'WPML\\Core\\Twig_Environment' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Environment.php',
|
254 |
-
'WPML\\Core\\Twig_Error' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error.php',
|
255 |
-
'WPML\\Core\\Twig_Error_Loader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Loader.php',
|
256 |
-
'WPML\\Core\\Twig_Error_Runtime' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Runtime.php',
|
257 |
-
'WPML\\Core\\Twig_Error_Syntax' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Syntax.php',
|
258 |
-
'WPML\\Core\\Twig_ExistsLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExistsLoaderInterface.php',
|
259 |
-
'WPML\\Core\\Twig_ExpressionParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExpressionParser.php',
|
260 |
-
'WPML\\Core\\Twig_Extension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension.php',
|
261 |
-
'WPML\\Core\\Twig_ExtensionInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ExtensionInterface.php',
|
262 |
-
'WPML\\Core\\Twig_Extension_Core' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Core.php',
|
263 |
-
'WPML\\Core\\Twig_Extension_Debug' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Debug.php',
|
264 |
-
'WPML\\Core\\Twig_Extension_Escaper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Escaper.php',
|
265 |
-
'WPML\\Core\\Twig_Extension_GlobalsInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/GlobalsInterface.php',
|
266 |
-
'WPML\\Core\\Twig_Extension_InitRuntimeInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/InitRuntimeInterface.php',
|
267 |
-
'WPML\\Core\\Twig_Extension_Optimizer' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Optimizer.php',
|
268 |
-
'WPML\\Core\\Twig_Extension_Profiler' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Profiler.php',
|
269 |
-
'WPML\\Core\\Twig_Extension_Sandbox' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Sandbox.php',
|
270 |
-
'WPML\\Core\\Twig_Extension_Staging' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Staging.php',
|
271 |
-
'WPML\\Core\\Twig_Extension_StringLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/StringLoader.php',
|
272 |
-
'WPML\\Core\\Twig_FactoryRuntimeLoader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FactoryRuntimeLoader.php',
|
273 |
-
'WPML\\Core\\Twig_FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FileExtensionEscapingStrategy.php',
|
274 |
-
'WPML\\Core\\Twig_Filter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter.php',
|
275 |
-
'WPML\\Core\\Twig_FilterCallableInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FilterCallableInterface.php',
|
276 |
-
'WPML\\Core\\Twig_FilterInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FilterInterface.php',
|
277 |
-
'WPML\\Core\\Twig_Filter_Function' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Function.php',
|
278 |
-
'WPML\\Core\\Twig_Filter_Method' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Method.php',
|
279 |
-
'WPML\\Core\\Twig_Filter_Node' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Node.php',
|
280 |
-
'WPML\\Core\\Twig_Function' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function.php',
|
281 |
-
'WPML\\Core\\Twig_FunctionCallableInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionCallableInterface.php',
|
282 |
-
'WPML\\Core\\Twig_FunctionInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionInterface.php',
|
283 |
-
'WPML\\Core\\Twig_Function_Function' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Function.php',
|
284 |
-
'WPML\\Core\\Twig_Function_Method' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Method.php',
|
285 |
-
'WPML\\Core\\Twig_Function_Node' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Node.php',
|
286 |
-
'WPML\\Core\\Twig_Lexer' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Lexer.php',
|
287 |
-
'WPML\\Core\\Twig_LexerInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/LexerInterface.php',
|
288 |
-
'WPML\\Core\\Twig_LoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/LoaderInterface.php',
|
289 |
-
'WPML\\Core\\Twig_Loader_Array' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Array.php',
|
290 |
-
'WPML\\Core\\Twig_Loader_Chain' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Chain.php',
|
291 |
-
'WPML\\Core\\Twig_Loader_Filesystem' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Filesystem.php',
|
292 |
-
'WPML\\Core\\Twig_Loader_String' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/String.php',
|
293 |
-
'WPML\\Core\\Twig_Markup' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Markup.php',
|
294 |
-
'WPML\\Core\\Twig_Node' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node.php',
|
295 |
-
'WPML\\Core\\Twig_NodeCaptureInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeCaptureInterface.php',
|
296 |
-
'WPML\\Core\\Twig_NodeInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeInterface.php',
|
297 |
-
'WPML\\Core\\Twig_NodeOutputInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeOutputInterface.php',
|
298 |
-
'WPML\\Core\\Twig_NodeTraverser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeTraverser.php',
|
299 |
-
'WPML\\Core\\Twig_NodeVisitorInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitorInterface.php',
|
300 |
-
'WPML\\Core\\Twig_NodeVisitor_Escaper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Escaper.php',
|
301 |
-
'WPML\\Core\\Twig_NodeVisitor_Optimizer' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Optimizer.php',
|
302 |
-
'WPML\\Core\\Twig_NodeVisitor_SafeAnalysis' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/SafeAnalysis.php',
|
303 |
-
'WPML\\Core\\Twig_NodeVisitor_Sandbox' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Sandbox.php',
|
304 |
-
'WPML\\Core\\Twig_Node_AutoEscape' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/AutoEscape.php',
|
305 |
-
'WPML\\Core\\Twig_Node_Block' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Block.php',
|
306 |
-
'WPML\\Core\\Twig_Node_BlockReference' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/BlockReference.php',
|
307 |
-
'WPML\\Core\\Twig_Node_Body' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Body.php',
|
308 |
-
'WPML\\Core\\Twig_Node_CheckSecurity' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/CheckSecurity.php',
|
309 |
-
'WPML\\Core\\Twig_Node_Deprecated' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Deprecated.php',
|
310 |
-
'WPML\\Core\\Twig_Node_Do' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Do.php',
|
311 |
-
'WPML\\Core\\Twig_Node_Embed' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Embed.php',
|
312 |
-
'WPML\\Core\\Twig_Node_Expression' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression.php',
|
313 |
-
'WPML\\Core\\Twig_Node_Expression_Array' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Array.php',
|
314 |
-
'WPML\\Core\\Twig_Node_Expression_AssignName' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/AssignName.php',
|
315 |
-
'WPML\\Core\\Twig_Node_Expression_Binary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary.php',
|
316 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Add' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Add.php',
|
317 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_And' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/And.php',
|
318 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseAnd' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php',
|
319 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseOr' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php',
|
320 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseXor' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php',
|
321 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Concat' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Concat.php',
|
322 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Div' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Div.php',
|
323 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_EndsWith' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/EndsWith.php',
|
324 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Equal' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Equal.php',
|
325 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_FloorDiv' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php',
|
326 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Greater' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Greater.php',
|
327 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_GreaterEqual' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php',
|
328 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_In' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/In.php',
|
329 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Less' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Less.php',
|
330 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_LessEqual' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/LessEqual.php',
|
331 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Matches' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Matches.php',
|
332 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Mod' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mod.php',
|
333 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Mul' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mul.php',
|
334 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_NotEqual' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotEqual.php',
|
335 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_NotIn' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotIn.php',
|
336 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Or' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Or.php',
|
337 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Power' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Power.php',
|
338 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Range' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Range.php',
|
339 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_StartsWith' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/StartsWith.php',
|
340 |
-
'WPML\\Core\\Twig_Node_Expression_Binary_Sub' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Sub.php',
|
341 |
-
'WPML\\Core\\Twig_Node_Expression_BlockReference' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/BlockReference.php',
|
342 |
-
'WPML\\Core\\Twig_Node_Expression_Call' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Call.php',
|
343 |
-
'WPML\\Core\\Twig_Node_Expression_Conditional' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Conditional.php',
|
344 |
-
'WPML\\Core\\Twig_Node_Expression_Constant' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Constant.php',
|
345 |
-
'WPML\\Core\\Twig_Node_Expression_ExtensionReference' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/ExtensionReference.php',
|
346 |
-
'WPML\\Core\\Twig_Node_Expression_Filter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter.php',
|
347 |
-
'WPML\\Core\\Twig_Node_Expression_Filter_Default' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter/Default.php',
|
348 |
-
'WPML\\Core\\Twig_Node_Expression_Function' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Function.php',
|
349 |
-
'WPML\\Core\\Twig_Node_Expression_GetAttr' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/GetAttr.php',
|
350 |
-
'WPML\\Core\\Twig_Node_Expression_MethodCall' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/MethodCall.php',
|
351 |
-
'WPML\\Core\\Twig_Node_Expression_Name' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Name.php',
|
352 |
-
'WPML\\Core\\Twig_Node_Expression_NullCoalesce' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/NullCoalesce.php',
|
353 |
-
'WPML\\Core\\Twig_Node_Expression_Parent' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Parent.php',
|
354 |
-
'WPML\\Core\\Twig_Node_Expression_TempName' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/TempName.php',
|
355 |
-
'WPML\\Core\\Twig_Node_Expression_Test' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test.php',
|
356 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Constant' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Constant.php',
|
357 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Defined' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Defined.php',
|
358 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Divisibleby' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Divisibleby.php',
|
359 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Even' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Even.php',
|
360 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Null' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Null.php',
|
361 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Odd' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Odd.php',
|
362 |
-
'WPML\\Core\\Twig_Node_Expression_Test_Sameas' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Sameas.php',
|
363 |
-
'WPML\\Core\\Twig_Node_Expression_Unary' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary.php',
|
364 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Neg' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Neg.php',
|
365 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Not' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Not.php',
|
366 |
-
'WPML\\Core\\Twig_Node_Expression_Unary_Pos' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Pos.php',
|
367 |
-
'WPML\\Core\\Twig_Node_Flush' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Flush.php',
|
368 |
-
'WPML\\Core\\Twig_Node_For' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/For.php',
|
369 |
-
'WPML\\Core\\Twig_Node_ForLoop' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/ForLoop.php',
|
370 |
-
'WPML\\Core\\Twig_Node_If' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/If.php',
|
371 |
-
'WPML\\Core\\Twig_Node_Import' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Import.php',
|
372 |
-
'WPML\\Core\\Twig_Node_Include' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Include.php',
|
373 |
-
'WPML\\Core\\Twig_Node_Macro' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Macro.php',
|
374 |
-
'WPML\\Core\\Twig_Node_Module' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Module.php',
|
375 |
-
'WPML\\Core\\Twig_Node_Print' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Print.php',
|
376 |
-
'WPML\\Core\\Twig_Node_Sandbox' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Sandbox.php',
|
377 |
-
'WPML\\Core\\Twig_Node_SandboxedPrint' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SandboxedPrint.php',
|
378 |
-
'WPML\\Core\\Twig_Node_Set' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Set.php',
|
379 |
-
'WPML\\Core\\Twig_Node_SetTemp' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SetTemp.php',
|
380 |
-
'WPML\\Core\\Twig_Node_Spaceless' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Spaceless.php',
|
381 |
-
'WPML\\Core\\Twig_Node_Text' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Text.php',
|
382 |
-
'WPML\\Core\\Twig_Node_With' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Node/With.php',
|
383 |
-
'WPML\\Core\\Twig_Parser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Parser.php',
|
384 |
-
'WPML\\Core\\Twig_ParserInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/ParserInterface.php',
|
385 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Base' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Base.php',
|
386 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Blackfire' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Blackfire.php',
|
387 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Html' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Html.php',
|
388 |
-
'WPML\\Core\\Twig_Profiler_Dumper_Text' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Text.php',
|
389 |
-
'WPML\\Core\\Twig_Profiler_NodeVisitor_Profiler' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php',
|
390 |
-
'WPML\\Core\\Twig_Profiler_Node_EnterProfile' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/EnterProfile.php',
|
391 |
-
'WPML\\Core\\Twig_Profiler_Node_LeaveProfile' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/LeaveProfile.php',
|
392 |
-
'WPML\\Core\\Twig_Profiler_Profile' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Profile.php',
|
393 |
-
'WPML\\Core\\Twig_RuntimeLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/RuntimeLoaderInterface.php',
|
394 |
-
'WPML\\Core\\Twig_Sandbox_SecurityError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityError.php',
|
395 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFilterError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php',
|
396 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFunctionError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php',
|
397 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedMethodError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php',
|
398 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedPropertyError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php',
|
399 |
-
'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedTagError' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php',
|
400 |
-
'WPML\\Core\\Twig_Sandbox_SecurityPolicy' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicy.php',
|
401 |
-
'WPML\\Core\\Twig_Sandbox_SecurityPolicyInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php',
|
402 |
-
'WPML\\Core\\Twig_SimpleFilter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFilter.php',
|
403 |
-
'WPML\\Core\\Twig_SimpleFunction' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFunction.php',
|
404 |
-
'WPML\\Core\\Twig_SimpleTest' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleTest.php',
|
405 |
-
'WPML\\Core\\Twig_Source' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Source.php',
|
406 |
-
'WPML\\Core\\Twig_SourceContextLoaderInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/SourceContextLoaderInterface.php',
|
407 |
-
'WPML\\Core\\Twig_Template' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Template.php',
|
408 |
-
'WPML\\Core\\Twig_TemplateInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateInterface.php',
|
409 |
-
'WPML\\Core\\Twig_TemplateWrapper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateWrapper.php',
|
410 |
-
'WPML\\Core\\Twig_Test' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test.php',
|
411 |
-
'WPML\\Core\\Twig_TestCallableInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TestCallableInterface.php',
|
412 |
-
'WPML\\Core\\Twig_TestInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TestInterface.php',
|
413 |
-
'WPML\\Core\\Twig_Test_Function' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Function.php',
|
414 |
-
'WPML\\Core\\Twig_Test_IntegrationTestCase' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/IntegrationTestCase.php',
|
415 |
-
'WPML\\Core\\Twig_Test_Method' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Method.php',
|
416 |
-
'WPML\\Core\\Twig_Test_Node' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Node.php',
|
417 |
-
'WPML\\Core\\Twig_Test_NodeTestCase' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Test/NodeTestCase.php',
|
418 |
-
'WPML\\Core\\Twig_Token' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Token.php',
|
419 |
-
'WPML\\Core\\Twig_TokenParser' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser.php',
|
420 |
-
'WPML\\Core\\Twig_TokenParserBroker' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBroker.php',
|
421 |
-
'WPML\\Core\\Twig_TokenParserBrokerInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBrokerInterface.php',
|
422 |
-
'WPML\\Core\\Twig_TokenParserInterface' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserInterface.php',
|
423 |
-
'WPML\\Core\\Twig_TokenParser_AutoEscape' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/AutoEscape.php',
|
424 |
-
'WPML\\Core\\Twig_TokenParser_Block' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Block.php',
|
425 |
-
'WPML\\Core\\Twig_TokenParser_Deprecated' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Deprecated.php',
|
426 |
-
'WPML\\Core\\Twig_TokenParser_Do' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Do.php',
|
427 |
-
'WPML\\Core\\Twig_TokenParser_Embed' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Embed.php',
|
428 |
-
'WPML\\Core\\Twig_TokenParser_Extends' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Extends.php',
|
429 |
-
'WPML\\Core\\Twig_TokenParser_Filter' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Filter.php',
|
430 |
-
'WPML\\Core\\Twig_TokenParser_Flush' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Flush.php',
|
431 |
-
'WPML\\Core\\Twig_TokenParser_For' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/For.php',
|
432 |
-
'WPML\\Core\\Twig_TokenParser_From' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/From.php',
|
433 |
-
'WPML\\Core\\Twig_TokenParser_If' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/If.php',
|
434 |
-
'WPML\\Core\\Twig_TokenParser_Import' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Import.php',
|
435 |
-
'WPML\\Core\\Twig_TokenParser_Include' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Include.php',
|
436 |
-
'WPML\\Core\\Twig_TokenParser_Macro' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Macro.php',
|
437 |
-
'WPML\\Core\\Twig_TokenParser_Sandbox' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Sandbox.php',
|
438 |
-
'WPML\\Core\\Twig_TokenParser_Set' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Set.php',
|
439 |
-
'WPML\\Core\\Twig_TokenParser_Spaceless' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Spaceless.php',
|
440 |
-
'WPML\\Core\\Twig_TokenParser_Use' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Use.php',
|
441 |
-
'WPML\\Core\\Twig_TokenParser_With' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/With.php',
|
442 |
-
'WPML\\Core\\Twig_TokenStream' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/TokenStream.php',
|
443 |
-
'WPML\\Core\\Twig_Util_DeprecationCollector' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Util/DeprecationCollector.php',
|
444 |
-
'WPML\\Core\\Twig_Util_TemplateDirIterator' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/lib/twig/lib/Twig/Util/TemplateDirIterator.php',
|
445 |
-
'WPML\\DocPage' => __DIR__ . '/..' . '/wpml/core-api/core/DocPage.php',
|
446 |
-
'WPML\\Element\\API\\Entity\\LanguageMapping' => __DIR__ . '/..' . '/wpml/core-api/core/Entity/LanguageMapping.php',
|
447 |
-
'WPML\\Element\\API\\IfOriginalPost' => __DIR__ . '/..' . '/wpml/core-api/core/IfOriginalPost.php',
|
448 |
-
'WPML\\Element\\API\\Languages' => __DIR__ . '/..' . '/wpml/core-api/core/Languages.php',
|
449 |
-
'WPML\\Element\\API\\Post' => __DIR__ . '/..' . '/wpml/core-api/core/Post.php',
|
450 |
-
'WPML\\Element\\API\\PostTranslations' => __DIR__ . '/..' . '/wpml/core-api/core/PostTranslations.php',
|
451 |
-
'WPML\\Element\\API\\Translations' => __DIR__ . '/..' . '/wpml/core-api/core/Translations.php',
|
452 |
-
'WPML\\Element\\API\\TranslationsRepository' => __DIR__ . '/..' . '/wpml/core-api/core/TranslationsRepository.php',
|
453 |
-
'WPML\\FP\\Applicative' => __DIR__ . '/..' . '/wpml/fp/core/Functor/Applicative.php',
|
454 |
-
'WPML\\FP\\Cast' => __DIR__ . '/..' . '/wpml/fp/core/Cast.php',
|
455 |
-
'WPML\\FP\\ConstApplicative' => __DIR__ . '/..' . '/wpml/fp/core/Functor/ConstApplicative.php',
|
456 |
-
'WPML\\FP\\Curryable' => __DIR__ . '/..' . '/wpml/fp/core/traits/Curryable.php',
|
457 |
-
'WPML\\FP\\Debug' => __DIR__ . '/..' . '/wpml/fp/core/Debug.php',
|
458 |
-
'WPML\\FP\\Either' => __DIR__ . '/..' . '/wpml/fp/core/Either.php',
|
459 |
-
'WPML\\FP\\FP' => __DIR__ . '/..' . '/wpml/fp/core/FP.php',
|
460 |
-
'WPML\\FP\\Fns' => __DIR__ . '/..' . '/wpml/fp/core/Fns.php',
|
461 |
-
'WPML\\FP\\Functor\\ConstFunctor' => __DIR__ . '/..' . '/wpml/fp/core/Functor/ConstFunctor.php',
|
462 |
-
'WPML\\FP\\Functor\\Functor' => __DIR__ . '/..' . '/wpml/fp/core/Functor/Functor.php',
|
463 |
-
'WPML\\FP\\Functor\\IdentityFunctor' => __DIR__ . '/..' . '/wpml/fp/core/Functor/IdentityFunctor.php',
|
464 |
-
'WPML\\FP\\Functor\\Pointed' => __DIR__ . '/..' . '/wpml/fp/core/Functor/Pointed.php',
|
465 |
-
'WPML\\FP\\Json' => __DIR__ . '/..' . '/wpml/fp/core/Json.php',
|
466 |
-
'WPML\\FP\\Just' => __DIR__ . '/..' . '/wpml/fp/core/Maybe.php',
|
467 |
-
'WPML\\FP\\Left' => __DIR__ . '/..' . '/wpml/fp/core/Either.php',
|
468 |
-
'WPML\\FP\\Logic' => __DIR__ . '/..' . '/wpml/fp/core/Logic.php',
|
469 |
-
'WPML\\FP\\Lst' => __DIR__ . '/..' . '/wpml/fp/core/Lst.php',
|
470 |
-
'WPML\\FP\\Math' => __DIR__ . '/..' . '/wpml/fp/core/Math.php',
|
471 |
-
'WPML\\FP\\Maybe' => __DIR__ . '/..' . '/wpml/fp/core/Maybe.php',
|
472 |
-
'WPML\\FP\\Nothing' => __DIR__ . '/..' . '/wpml/fp/core/Maybe.php',
|
473 |
-
'WPML\\FP\\Obj' => __DIR__ . '/..' . '/wpml/fp/core/Obj.php',
|
474 |
-
'WPML\\FP\\Promise' => __DIR__ . '/..' . '/wpml/fp/core/Promise.php',
|
475 |
-
'WPML\\FP\\Relation' => __DIR__ . '/..' . '/wpml/fp/core/Relation.php',
|
476 |
-
'WPML\\FP\\Right' => __DIR__ . '/..' . '/wpml/fp/core/Either.php',
|
477 |
-
'WPML\\FP\\Str' => __DIR__ . '/..' . '/wpml/fp/core/Strings.php',
|
478 |
-
'WPML\\FP\\System\\System' => __DIR__ . '/..' . '/wpml/fp/core/SystemClass.php',
|
479 |
-
'WPML\\FP\\System\\_Filter' => __DIR__ . '/..' . '/wpml/fp/core/Filter.php',
|
480 |
-
'WPML\\FP\\System\\_Validator' => __DIR__ . '/..' . '/wpml/fp/core/Validator.php',
|
481 |
-
'WPML\\FP\\Undefined' => __DIR__ . '/..' . '/wpml/fp/core/Undefined.php',
|
482 |
-
'WPML\\FP\\Wrapper' => __DIR__ . '/..' . '/wpml/fp/core/Wrapper.php',
|
483 |
-
'WPML\\FP\\_Invoker' => __DIR__ . '/..' . '/wpml/fp/core/Invoker.php',
|
484 |
-
'WPML\\LIB\\WP\\App\\Resources' => __DIR__ . '/..' . '/wpml/wp/classes/Resources.php',
|
485 |
-
'WPML\\LIB\\WP\\Attachment' => __DIR__ . '/..' . '/wpml/wp/classes/Attachment.php',
|
486 |
-
'WPML\\LIB\\WP\\Cache' => __DIR__ . '/..' . '/wpml/wp/classes/Cache.php',
|
487 |
-
'WPML\\LIB\\WP\\Gutenberg' => __DIR__ . '/..' . '/wpml/wp/classes/Gutenberg.php',
|
488 |
-
'WPML\\LIB\\WP\\Hooks' => __DIR__ . '/..' . '/wpml/wp/classes/Hooks.php',
|
489 |
-
'WPML\\LIB\\WP\\Http' => __DIR__ . '/..' . '/wpml/wp/classes/Http.php',
|
490 |
-
'WPML\\LIB\\WP\\Nonce' => __DIR__ . '/..' . '/wpml/wp/classes/Nonce.php',
|
491 |
-
'WPML\\LIB\\WP\\Option' => __DIR__ . '/..' . '/wpml/wp/classes/Option.php',
|
492 |
-
'WPML\\LIB\\WP\\Post' => __DIR__ . '/..' . '/wpml/wp/classes/Post.php',
|
493 |
-
'WPML\\LIB\\WP\\PostType' => __DIR__ . '/..' . '/wpml/wp/classes/PostType.php',
|
494 |
-
'WPML\\LIB\\WP\\Roles' => __DIR__ . '/..' . '/wpml/wp/classes/Roles.php',
|
495 |
-
'WPML\\LIB\\WP\\Transient' => __DIR__ . '/..' . '/wpml/wp/classes/Transient.php',
|
496 |
-
'WPML\\LIB\\WP\\User' => __DIR__ . '/..' . '/wpml/wp/classes/User.php',
|
497 |
-
'WPML\\LIB\\WP\\WPDB' => __DIR__ . '/..' . '/wpml/wp/classes/WPDB.php',
|
498 |
-
'WPML\\LIB\\WP\\WordPress' => __DIR__ . '/..' . '/wpml/wp/classes/WP.php',
|
499 |
-
'WPML\\Media\\Option' => __DIR__ . '/..' . '/wpml/core-api/core/media/Option.php',
|
500 |
-
'WPML\\Notices\\DismissNotices' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/DismissNotices.php',
|
501 |
-
'WPML\\Records\\Translations' => __DIR__ . '/..' . '/wpml/core-api/core/Records/Translations.php',
|
502 |
-
'WPML\\Settings\\PostType\\Automatic' => __DIR__ . '/..' . '/wpml/core-api/core/settings/Automatic.php',
|
503 |
-
'WPML\\Setup\\Option' => __DIR__ . '/..' . '/wpml/core-api/core/setup/Option.php',
|
504 |
-
'WPML\\Timer' => __DIR__ . '/..' . '/wpml/core-api/core/Timer.php',
|
505 |
-
'WPML\\UIPage' => __DIR__ . '/..' . '/wpml/core-api/core/UIPage.php',
|
506 |
-
'WPML\\Utilities\\ILock' => __DIR__ . '/..' . '/wpml/core-api/core/utility/ILock.php',
|
507 |
-
'WPML\\Utilities\\Lock' => __DIR__ . '/..' . '/wpml/core-api/core/utility/Lock.php',
|
508 |
-
'WPML\\WP\\OptionManager' => __DIR__ . '/..' . '/wpml/core-api/core/OptionManager.php',
|
509 |
-
'WPML_AJAX_Action_Validation' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-validation.php',
|
510 |
-
'WPML_AJAX_Base_Factory' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-base-factory.php',
|
511 |
-
'WPML_Action_Filter_Loader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-filter-loader.php',
|
512 |
-
'WPML_Block_Editor_Helper' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/block-editor/class-wpml-block-editor-helper.php',
|
513 |
-
'WPML_Cookie' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/cookie/class-wpml-cookie.php',
|
514 |
-
'WPML_Core_Privacy_Content' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-core-privacy-content.php',
|
515 |
-
'WPML_Current_Screen_Loader_Factory' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-current-screen-loader-factory.php',
|
516 |
-
'WPML_File' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/class-wpml-file.php',
|
517 |
-
'WPML_Notice' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice.php',
|
518 |
-
'WPML_Notice_Action' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice-action.php',
|
519 |
-
'WPML_Notice_Render' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notice-render.php',
|
520 |
-
'WPML_Notice_Show_On_Dashboard_And_WPML_Pages' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/pages/class-wpml-notice-show-on-dashboard-and-wpml-pages.php',
|
521 |
-
'WPML_Notices' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/notices/class-wpml-notices.php',
|
522 |
-
'WPML_PHP_Functions' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/wpml-php-functions.php',
|
523 |
-
'WPML_Privacy_Content' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content.php',
|
524 |
-
'WPML_Privacy_Content_Factory' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content-factory.php',
|
525 |
-
'WPML_Templates_Factory' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/templating/class-wpml-templates-factory.php',
|
526 |
-
'WPML_Twig_Template' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/templates/class-wpml-twig-template.php',
|
527 |
-
'WPML_Twig_Template_Loader' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/templates/wpml-twig-template-loader.php',
|
528 |
-
'WPML_Twig_WP_Plugin_Extension' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/twig-extensions/wpml-twig-wp-plugin-extension.php',
|
529 |
-
'WPML_WP_API' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-api.php',
|
530 |
-
'WPML_WP_Cache' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/utilities/class-wpml-wp-cache.php',
|
531 |
-
'WPML_WP_Post_Type' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/wpml-wp-post-type.php',
|
532 |
-
'WPML_WP_Roles' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-roles.php',
|
533 |
-
'WPML_WP_Taxonomy' => __DIR__ . '/..' . '/wpml/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-taxonomy.php',
|
534 |
-
);
|
535 |
-
|
536 |
-
public static function getInitializer(ClassLoader $loader)
|
537 |
-
{
|
538 |
-
return \Closure::bind(function () use ($loader) {
|
539 |
-
$loader->prefixLengthsPsr4 = ComposerStaticInit4821ed1a7ed1caf1298338b695908544::$prefixLengthsPsr4;
|
540 |
-
$loader->prefixDirsPsr4 = ComposerStaticInit4821ed1a7ed1caf1298338b695908544::$prefixDirsPsr4;
|
541 |
-
$loader->classMap = ComposerStaticInit4821ed1a7ed1caf1298338b695908544::$classMap;
|
542 |
-
|
543 |
-
}, null, ClassLoader::class);
|
544 |
-
}
|
545 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/composer/installed.json
DELETED
@@ -1,799 +0,0 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"name": "otgs/auryn",
|
4 |
-
"version": "dev-master",
|
5 |
-
"version_normalized": "9999999-dev",
|
6 |
-
"source": {
|
7 |
-
"type": "git",
|
8 |
-
"url": "https://github.com/OnTheGoSystems/auryn.git",
|
9 |
-
"reference": "82dca7f4674d5a283947620892597c1f4325bb76"
|
10 |
-
},
|
11 |
-
"dist": {
|
12 |
-
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/OnTheGoSystems/auryn/zipball/82dca7f4674d5a283947620892597c1f4325bb76",
|
14 |
-
"reference": "82dca7f4674d5a283947620892597c1f4325bb76",
|
15 |
-
"shasum": ""
|
16 |
-
},
|
17 |
-
"require": {
|
18 |
-
"php": ">=5.3.0"
|
19 |
-
},
|
20 |
-
"require-dev": {
|
21 |
-
"athletic/athletic": "~0.1",
|
22 |
-
"fabpot/php-cs-fixer": "~1.9",
|
23 |
-
"phpunit/phpunit": "^4.8"
|
24 |
-
},
|
25 |
-
"time": "2020-10-29T12:28:42+00:00",
|
26 |
-
"type": "library",
|
27 |
-
"installation-source": "dist",
|
28 |
-
"autoload": {
|
29 |
-
"psr-4": {
|
30 |
-
"WPML\\Auryn\\": "lib/"
|
31 |
-
}
|
32 |
-
},
|
33 |
-
"notification-url": "https://packagist.org/downloads/",
|
34 |
-
"license": [
|
35 |
-
"MIT"
|
36 |
-
],
|
37 |
-
"authors": [
|
38 |
-
{
|
39 |
-
"name": "Daniel Lowrey",
|
40 |
-
"email": "rdlowrey@gmail.com",
|
41 |
-
"homepage": "https://github.com/rdlowrey",
|
42 |
-
"role": "Creator / Main Developer"
|
43 |
-
},
|
44 |
-
{
|
45 |
-
"name": "Levi Morrison",
|
46 |
-
"email": "levim@php.net",
|
47 |
-
"homepage": "http://morrisonlevi.github.com/",
|
48 |
-
"role": "Developer"
|
49 |
-
},
|
50 |
-
{
|
51 |
-
"name": "Dan Ackroyd",
|
52 |
-
"email": "Danack@basereality.com",
|
53 |
-
"homepage": "http://www.basereality.com",
|
54 |
-
"role": "Developer"
|
55 |
-
}
|
56 |
-
],
|
57 |
-
"description": "Auryn is a dependency injector for bootstrapping object-oriented PHP applications.",
|
58 |
-
"homepage": "https://github.com/rdlowrey/auryn",
|
59 |
-
"keywords": [
|
60 |
-
"dependency injection",
|
61 |
-
"dic",
|
62 |
-
"ioc"
|
63 |
-
],
|
64 |
-
"support": {
|
65 |
-
"source": "https://github.com/OnTheGoSystems/auryn/tree/master"
|
66 |
-
}
|
67 |
-
},
|
68 |
-
{
|
69 |
-
"name": "otgs/icons",
|
70 |
-
"version": "1.0.2",
|
71 |
-
"version_normalized": "1.0.2.0",
|
72 |
-
"source": {
|
73 |
-
"type": "git",
|
74 |
-
"url": "https://git.onthegosystems.com/otgs-public/otgs-icons.git",
|
75 |
-
"reference": "4dbce75c1ba493c7d4d2c86f318d2ad10fa4f24b"
|
76 |
-
},
|
77 |
-
"time": "2020-03-20T16:45:00+00:00",
|
78 |
-
"type": "library",
|
79 |
-
"installation-source": "source",
|
80 |
-
"notification-url": "https://packagist.org/downloads/",
|
81 |
-
"license": [
|
82 |
-
"GPL-2.0"
|
83 |
-
],
|
84 |
-
"description": "Toolset and WPML icons"
|
85 |
-
},
|
86 |
-
{
|
87 |
-
"name": "otgs/ui",
|
88 |
-
"version": "dev-master",
|
89 |
-
"version_normalized": "9999999-dev",
|
90 |
-
"source": {
|
91 |
-
"type": "git",
|
92 |
-
"url": "https://git.onthegosystems.com/otgs-public/otgs-ui.git",
|
93 |
-
"reference": "d8b11b073ba3247f25108b0dd88742ca3b0d4628"
|
94 |
-
},
|
95 |
-
"require": {
|
96 |
-
"roave/security-advisories": "dev-master"
|
97 |
-
},
|
98 |
-
"require-dev": {
|
99 |
-
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
100 |
-
"otgs/unit-tests-framework": "~1.2.0",
|
101 |
-
"phpcompatibility/php-compatibility": "*",
|
102 |
-
"phpunit/phpunit": "~5.7",
|
103 |
-
"sebastian/phpcpd": "^3.0",
|
104 |
-
"squizlabs/php_codesniffer": "~3",
|
105 |
-
"wp-coding-standards/wpcs": "^0"
|
106 |
-
},
|
107 |
-
"suggest": {
|
108 |
-
"otgs/icons": "Needed for displaying Company's glyphs and icons,"
|
109 |
-
},
|
110 |
-
"time": "2020-11-26T14:58:07+00:00",
|
111 |
-
"type": "library",
|
112 |
-
"installation-source": "source",
|
113 |
-
"autoload": {
|
114 |
-
"classmap": [
|
115 |
-
"src/php/"
|
116 |
-
]
|
117 |
-
},
|
118 |
-
"notification-url": "https://packagist.org/downloads/",
|
119 |
-
"license": [
|
120 |
-
"GPL-2.0-or-later"
|
121 |
-
],
|
122 |
-
"authors": [
|
123 |
-
{
|
124 |
-
"name": "Andrea Sciamanna",
|
125 |
-
"email": "andrea.s@onthegosystems.com",
|
126 |
-
"homepage": "https://onthegosystems.com"
|
127 |
-
},
|
128 |
-
{
|
129 |
-
"name": "Kasia Janoska",
|
130 |
-
"email": "kasia.j@onthegosystems.com",
|
131 |
-
"homepage": "https://onthegosystems.com"
|
132 |
-
}
|
133 |
-
],
|
134 |
-
"description": "UI library from OnTheGoSystems",
|
135 |
-
"homepage": "https://git.onthegosystems.com/otgs-public/otgs-ui",
|
136 |
-
"keywords": [
|
137 |
-
"ui"
|
138 |
-
]
|
139 |
-
},
|
140 |
-
{
|
141 |
-
"name": "roave/security-advisories",
|
142 |
-
"version": "dev-master",
|
143 |
-
"version_normalized": "9999999-dev",
|
144 |
-
"source": {
|
145 |
-
"type": "git",
|
146 |
-
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
147 |
-
"reference": "fa60732bcafd446e9ff858eefa06cdcbae8d9823"
|
148 |
-
},
|
149 |
-
"dist": {
|
150 |
-
"type": "zip",
|
151 |
-
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fa60732bcafd446e9ff858eefa06cdcbae8d9823",
|
152 |
-
"reference": "fa60732bcafd446e9ff858eefa06cdcbae8d9823",
|
153 |
-
"shasum": ""
|
154 |
-
},
|
155 |
-
"conflict": {
|
156 |
-
"3f/pygmentize": "<1.2",
|
157 |
-
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
|
158 |
-
"akaunting/akaunting": "<2.1.13",
|
159 |
-
"alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1",
|
160 |
-
"amazing/media2click": ">=1,<1.3.3",
|
161 |
-
"amphp/artax": "<1.0.6|>=2,<2.0.6",
|
162 |
-
"amphp/http": "<1.0.1",
|
163 |
-
"amphp/http-client": ">=4,<4.4",
|
164 |
-
"anchorcms/anchor-cms": "<=0.12.7",
|
165 |
-
"api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6",
|
166 |
-
"area17/twill": "<1.2.5|>=2,<2.5.3",
|
167 |
-
"asymmetricrypt/asymmetricrypt": ">=0,<9.9.99",
|
168 |
-
"aws/aws-sdk-php": ">=3,<3.2.1",
|
169 |
-
"bagisto/bagisto": "<0.1.5",
|
170 |
-
"barrelstrength/sprout-base-email": "<1.2.7",
|
171 |
-
"barrelstrength/sprout-forms": "<3.9",
|
172 |
-
"baserproject/basercms": "<4.5.4",
|
173 |
-
"billz/raspap-webgui": "<=2.6.6",
|
174 |
-
"bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3",
|
175 |
-
"bolt/bolt": "<3.7.2",
|
176 |
-
"bolt/core": "<4.1.13",
|
177 |
-
"bottelet/flarepoint": "<2.2.1",
|
178 |
-
"brightlocal/phpwhois": "<=4.2.5",
|
179 |
-
"buddypress/buddypress": "<7.2.1",
|
180 |
-
"bugsnag/bugsnag-laravel": ">=2,<2.0.2",
|
181 |
-
"bytefury/crater": "<6",
|
182 |
-
"cachethq/cachet": "<2.5.1",
|
183 |
-
"cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7",
|
184 |
-
"cardgate/magento2": "<2.0.33",
|
185 |
-
"cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4",
|
186 |
-
"cartalyst/sentry": "<=2.1.6",
|
187 |
-
"catfan/medoo": "<1.7.5",
|
188 |
-
"centreon/centreon": "<20.10.7",
|
189 |
-
"cesnet/simplesamlphp-module-proxystatistics": "<3.1",
|
190 |
-
"codeception/codeception": "<3.1.3|>=4,<4.1.22",
|
191 |
-
"codeigniter/framework": "<=3.0.6",
|
192 |
-
"codeigniter4/framework": "<4.1.8",
|
193 |
-
"codiad/codiad": "<=2.8.4",
|
194 |
-
"composer/composer": "<1.10.23|>=2-alpha.1,<2.1.9",
|
195 |
-
"concrete5/concrete5": "<8.5.5",
|
196 |
-
"concrete5/core": "<8.5.7",
|
197 |
-
"contao-components/mediaelement": ">=2.14.2,<2.21.1",
|
198 |
-
"contao/core": ">=2,<3.5.39",
|
199 |
-
"contao/core-bundle": ">=4,<4.4.56|>=4.5,<4.9.18|>=4.10,<4.11.7|= 4.10.0",
|
200 |
-
"contao/listing-bundle": ">=4,<4.4.8",
|
201 |
-
"craftcms/cms": "<3.7.14",
|
202 |
-
"croogo/croogo": "<3.0.7",
|
203 |
-
"datadog/dd-trace": ">=0.30,<0.30.2",
|
204 |
-
"david-garcia/phpwhois": "<=4.3.1",
|
205 |
-
"derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1",
|
206 |
-
"directmailteam/direct-mail": "<5.2.4",
|
207 |
-
"doctrine/annotations": ">=1,<1.2.7",
|
208 |
-
"doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2",
|
209 |
-
"doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1",
|
210 |
-
"doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4",
|
211 |
-
"doctrine/doctrine-bundle": "<1.5.2",
|
212 |
-
"doctrine/doctrine-module": "<=0.7.1",
|
213 |
-
"doctrine/mongodb-odm": ">=1,<1.0.2",
|
214 |
-
"doctrine/mongodb-odm-bundle": ">=2,<3.0.1",
|
215 |
-
"doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4",
|
216 |
-
"dolibarr/dolibarr": "<=14.0.5|>= 3.3.beta1, < 13.0.2",
|
217 |
-
"dompdf/dompdf": ">=0.6,<0.6.2",
|
218 |
-
"drupal/core": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4",
|
219 |
-
"drupal/drupal": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4",
|
220 |
-
"dweeves/magmi": "<=0.7.24",
|
221 |
-
"ecodev/newsletter": "<=4",
|
222 |
-
"elgg/elgg": "<3.3.24|>=4,<4.0.5",
|
223 |
-
"endroid/qr-code-bundle": "<3.4.2",
|
224 |
-
"enshrined/svg-sanitize": "<0.13.1",
|
225 |
-
"erusev/parsedown": "<1.7.2",
|
226 |
-
"ether/logs": "<3.0.4",
|
227 |
-
"ezsystems/demobundle": ">=5.4,<5.4.6.1",
|
228 |
-
"ezsystems/ez-support-tools": ">=2.2,<2.2.3",
|
229 |
-
"ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1",
|
230 |
-
"ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1",
|
231 |
-
"ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24",
|
232 |
-
"ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<=1.5.25",
|
233 |
-
"ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1",
|
234 |
-
"ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<=1.3.1",
|
235 |
-
"ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8",
|
236 |
-
"ezsystems/ezplatform-richtext": ">=2.3,<=2.3.7",
|
237 |
-
"ezsystems/ezplatform-user": ">=1,<1.0.1",
|
238 |
-
"ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.26",
|
239 |
-
"ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1",
|
240 |
-
"ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3",
|
241 |
-
"ezsystems/repository-forms": ">=2.3,<2.3.2.1",
|
242 |
-
"ezyang/htmlpurifier": "<4.1.1",
|
243 |
-
"facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2",
|
244 |
-
"feehi/cms": "<=2.1.1",
|
245 |
-
"feehi/feehicms": "<=0.1.3",
|
246 |
-
"firebase/php-jwt": "<2",
|
247 |
-
"flarum/core": ">=1,<=1.0.1",
|
248 |
-
"flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15",
|
249 |
-
"flarum/tags": "<=0.1-beta.13",
|
250 |
-
"fluidtypo3/vhs": "<5.1.1",
|
251 |
-
"fooman/tcpdf": "<6.2.22",
|
252 |
-
"forkcms/forkcms": "<=5.9.2",
|
253 |
-
"fossar/tcpdf-parser": "<6.2.22",
|
254 |
-
"francoisjacquet/rosariosis": "<8.1.1",
|
255 |
-
"friendsofsymfony/oauth2-php": "<1.3",
|
256 |
-
"friendsofsymfony/rest-bundle": ">=1.2,<1.2.2",
|
257 |
-
"friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
|
258 |
-
"friendsoftypo3/mediace": ">=7.6.2,<7.6.5",
|
259 |
-
"froala/wysiwyg-editor": "<3.2.7",
|
260 |
-
"fuel/core": "<1.8.1",
|
261 |
-
"gaoming13/wechat-php-sdk": "<=1.10.2",
|
262 |
-
"getgrav/grav": "<1.7.28",
|
263 |
-
"getkirby/cms": "<3.5.8",
|
264 |
-
"getkirby/panel": "<2.5.14",
|
265 |
-
"gilacms/gila": "<=1.11.4",
|
266 |
-
"globalpayments/php-sdk": "<2",
|
267 |
-
"gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3",
|
268 |
-
"gree/jose": "<=2.2",
|
269 |
-
"gregwar/rst": "<1.0.3",
|
270 |
-
"grumpydictator/firefly-iii": "<5.6.5",
|
271 |
-
"guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1",
|
272 |
-
"helloxz/imgurl": "<=2.31",
|
273 |
-
"hillelcoren/invoice-ninja": "<5.3.35",
|
274 |
-
"hjue/justwriting": "<=1",
|
275 |
-
"hov/jobfair": "<1.0.13|>=2,<2.0.2",
|
276 |
-
"ibexa/post-install": "<=1.0.4",
|
277 |
-
"icecoder/icecoder": "<=8.1",
|
278 |
-
"illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10",
|
279 |
-
"illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4",
|
280 |
-
"illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40",
|
281 |
-
"illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15",
|
282 |
-
"illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75",
|
283 |
-
"impresscms/impresscms": "<=1.4.2",
|
284 |
-
"in2code/femanager": "<5.5.1|>=6,<6.3.1",
|
285 |
-
"intelliants/subrion": "<=4.2.1",
|
286 |
-
"ivankristianto/phpwhois": "<=4.3",
|
287 |
-
"jackalope/jackalope-doctrine-dbal": "<1.7.4",
|
288 |
-
"james-heinrich/getid3": "<1.9.21",
|
289 |
-
"joomla/archive": "<1.1.10",
|
290 |
-
"joomla/session": "<1.3.1",
|
291 |
-
"jsmitty12/phpwhois": "<5.1",
|
292 |
-
"kazist/phpwhois": "<=4.2.6",
|
293 |
-
"kevinpapst/kimai2": "<1.16.7",
|
294 |
-
"kitodo/presentation": "<3.1.2",
|
295 |
-
"klaviyo/magento2-extension": ">=1,<3",
|
296 |
-
"kreait/firebase-php": ">=3.2,<3.8.1",
|
297 |
-
"la-haute-societe/tcpdf": "<6.2.22",
|
298 |
-
"laminas/laminas-form": "<2.17.2|>=3,<3.0.2|>=3.1,<3.1.1",
|
299 |
-
"laminas/laminas-http": "<2.14.2",
|
300 |
-
"laravel/framework": "<6.20.42|>=7,<7.30.6|>=8,<8.75",
|
301 |
-
"laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10",
|
302 |
-
"latte/latte": "<2.10.8",
|
303 |
-
"lavalite/cms": "<=5.8",
|
304 |
-
"lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5",
|
305 |
-
"league/commonmark": "<0.18.3",
|
306 |
-
"league/flysystem": "<1.1.4|>=2,<2.1.1",
|
307 |
-
"lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3",
|
308 |
-
"librenms/librenms": "<=21.11",
|
309 |
-
"limesurvey/limesurvey": "<3.27.19",
|
310 |
-
"livehelperchat/livehelperchat": "<=3.91",
|
311 |
-
"livewire/livewire": ">2.2.4,<2.2.6",
|
312 |
-
"lms/routes": "<2.1.1",
|
313 |
-
"localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2",
|
314 |
-
"magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3",
|
315 |
-
"magento/magento1ce": "<1.9.4.3",
|
316 |
-
"magento/magento1ee": ">=1,<1.14.4.3",
|
317 |
-
"magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2",
|
318 |
-
"marcwillmann/turn": "<0.3.3",
|
319 |
-
"mautic/core": "<4|= 2.13.1",
|
320 |
-
"mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35",
|
321 |
-
"microweber/microweber": "<1.2.11",
|
322 |
-
"miniorange/miniorange-saml": "<1.4.3",
|
323 |
-
"mittwald/typo3_forum": "<1.2.1",
|
324 |
-
"modx/revolution": "<2.8",
|
325 |
-
"monolog/monolog": ">=1.8,<1.12",
|
326 |
-
"moodle/moodle": "<3.9.11|>=3.10-beta,<3.10.8|>=3.11,<3.11.5",
|
327 |
-
"mustache/mustache": ">=2,<2.14.1",
|
328 |
-
"namshi/jose": "<2.2",
|
329 |
-
"neoan3-apps/template": "<1.1.1",
|
330 |
-
"neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6",
|
331 |
-
"neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3",
|
332 |
-
"neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3",
|
333 |
-
"neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5",
|
334 |
-
"netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15",
|
335 |
-
"nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6",
|
336 |
-
"nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13",
|
337 |
-
"nilsteampassnet/teampass": "<=2.1.27.36",
|
338 |
-
"nukeviet/nukeviet": "<4.3.4",
|
339 |
-
"nystudio107/craft-seomatic": "<3.3",
|
340 |
-
"nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1",
|
341 |
-
"october/backend": "<1.1.2",
|
342 |
-
"october/cms": "= 1.1.1|= 1.0.471|= 1.0.469|>=1.0.319,<1.0.469",
|
343 |
-
"october/october": ">=1.0.319,<1.0.466|>=2.1,<2.1.12",
|
344 |
-
"october/rain": "<1.0.472|>=1.1,<1.1.2",
|
345 |
-
"october/system": "<1.0.473|>=1.1,<1.1.6|>=2.1,<2.1.12",
|
346 |
-
"onelogin/php-saml": "<2.10.4",
|
347 |
-
"oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5",
|
348 |
-
"opencart/opencart": "<=3.0.3.2",
|
349 |
-
"openid/php-openid": "<2.3",
|
350 |
-
"openmage/magento-lts": "<19.4.15|>=20,<20.0.13",
|
351 |
-
"orchid/platform": ">=9,<9.4.4",
|
352 |
-
"oro/crm": ">=1.7,<1.7.4|>=3.1,<4.1.17|>=4.2,<4.2.7",
|
353 |
-
"oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<4.2.8",
|
354 |
-
"padraic/humbug_get_contents": "<1.1.2",
|
355 |
-
"pagarme/pagarme-php": ">=0,<3",
|
356 |
-
"pagekit/pagekit": "<=1.0.18",
|
357 |
-
"paragonie/random_compat": "<2",
|
358 |
-
"passbolt/passbolt_api": "<2.11",
|
359 |
-
"paypal/merchant-sdk-php": "<3.12",
|
360 |
-
"pear/archive_tar": "<1.4.14",
|
361 |
-
"pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1",
|
362 |
-
"personnummer/personnummer": "<3.0.2",
|
363 |
-
"phanan/koel": "<5.1.4",
|
364 |
-
"phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7",
|
365 |
-
"phpmailer/phpmailer": "<6.5",
|
366 |
-
"phpmussel/phpmussel": ">=1,<1.6",
|
367 |
-
"phpmyadmin/phpmyadmin": "<4.9.8|>=5,<5.0.3|>=5.1,<5.1.2",
|
368 |
-
"phpoffice/phpexcel": "<1.8.2",
|
369 |
-
"phpoffice/phpspreadsheet": "<1.16",
|
370 |
-
"phpseclib/phpseclib": "<2.0.31|>=3,<3.0.7",
|
371 |
-
"phpservermon/phpservermon": "<=3.5.2",
|
372 |
-
"phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3",
|
373 |
-
"phpwhois/phpwhois": "<=4.2.5",
|
374 |
-
"phpxmlrpc/extras": "<0.6.1",
|
375 |
-
"pimcore/pimcore": "<=10.2.9",
|
376 |
-
"pocketmine/pocketmine-mp": "<4.0.7",
|
377 |
-
"pressbooks/pressbooks": "<5.18",
|
378 |
-
"prestashop/autoupgrade": ">=4,<4.10.1",
|
379 |
-
"prestashop/contactform": ">1.0.1,<4.3",
|
380 |
-
"prestashop/gamification": "<2.3.2",
|
381 |
-
"prestashop/prestashop": ">=1.7,<=1.7.8.2",
|
382 |
-
"prestashop/productcomments": ">=4,<4.2.1",
|
383 |
-
"prestashop/ps_emailsubscription": "<2.6.1",
|
384 |
-
"prestashop/ps_facetedsearch": "<3.4.1",
|
385 |
-
"prestashop/ps_linklist": "<3.1",
|
386 |
-
"privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2",
|
387 |
-
"propel/propel": ">=2-alpha.1,<=2-alpha.7",
|
388 |
-
"propel/propel1": ">=1,<=1.7.1",
|
389 |
-
"pterodactyl/panel": "<1.7",
|
390 |
-
"pusher/pusher-php-server": "<2.2.1",
|
391 |
-
"pwweb/laravel-core": "<=0.3.6-beta",
|
392 |
-
"rainlab/debugbar-plugin": "<3.1",
|
393 |
-
"remdex/livehelperchat": "<3.93",
|
394 |
-
"rmccue/requests": ">=1.6,<1.8",
|
395 |
-
"robrichards/xmlseclibs": "<3.0.4",
|
396 |
-
"sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1",
|
397 |
-
"sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9",
|
398 |
-
"scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11",
|
399 |
-
"sensiolabs/connect": "<4.2.3",
|
400 |
-
"serluck/phpwhois": "<=4.2.6",
|
401 |
-
"shopware/core": "<=6.4.6",
|
402 |
-
"shopware/platform": "<=6.4.6",
|
403 |
-
"shopware/production": "<=6.3.5.2",
|
404 |
-
"shopware/shopware": "<5.7.7",
|
405 |
-
"showdoc/showdoc": "<2.10.2",
|
406 |
-
"silverstripe/admin": ">=1,<1.8.1",
|
407 |
-
"silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2",
|
408 |
-
"silverstripe/cms": "<4.3.6|>=4.4,<4.4.4",
|
409 |
-
"silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1",
|
410 |
-
"silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
|
411 |
-
"silverstripe/framework": "<4.7.4",
|
412 |
-
"silverstripe/graphql": "<3.5.2|>=4-alpha.1,<4-alpha.2",
|
413 |
-
"silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1",
|
414 |
-
"silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4",
|
415 |
-
"silverstripe/subsites": ">=2,<2.1.1",
|
416 |
-
"silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1",
|
417 |
-
"silverstripe/userforms": "<3",
|
418 |
-
"simple-updates/phpwhois": "<=1",
|
419 |
-
"simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4",
|
420 |
-
"simplesamlphp/simplesamlphp": "<1.18.6",
|
421 |
-
"simplesamlphp/simplesamlphp-module-infocard": "<1.0.1",
|
422 |
-
"simplito/elliptic-php": "<1.0.6",
|
423 |
-
"slim/slim": "<2.6",
|
424 |
-
"smarty/smarty": "<3.1.43|>=4,<4.0.3",
|
425 |
-
"snipe/snipe-it": "<=5.3.7",
|
426 |
-
"socalnick/scn-social-auth": "<1.15.2",
|
427 |
-
"socialiteproviders/steam": "<1.1",
|
428 |
-
"spipu/html2pdf": "<5.2.4",
|
429 |
-
"spoonity/tcpdf": "<6.2.22",
|
430 |
-
"squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1",
|
431 |
-
"ssddanbrown/bookstack": "<21.12.1",
|
432 |
-
"stormpath/sdk": ">=0,<9.9.99",
|
433 |
-
"studio-42/elfinder": "<2.1.59",
|
434 |
-
"subrion/cms": "<=4.2.1",
|
435 |
-
"sulu/sulu": "= 2.4.0-RC1|<1.6.44|>=2,<2.2.18|>=2.3,<2.3.8",
|
436 |
-
"swiftmailer/swiftmailer": ">=4,<5.4.5",
|
437 |
-
"sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2",
|
438 |
-
"sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1",
|
439 |
-
"sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1",
|
440 |
-
"sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1",
|
441 |
-
"sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4",
|
442 |
-
"sylius/sylius": "<1.6.9|>=1.7,<1.7.9|>=1.8,<1.8.3|>=1.9,<1.9.5",
|
443 |
-
"symbiote/silverstripe-multivaluefield": ">=3,<3.0.99",
|
444 |
-
"symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4",
|
445 |
-
"symbiote/silverstripe-versionedfiles": "<=2.0.3",
|
446 |
-
"symfont/process": ">=0,<4",
|
447 |
-
"symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8",
|
448 |
-
"symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7",
|
449 |
-
"symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4",
|
450 |
-
"symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1",
|
451 |
-
"symfony/framework-bundle": "<5.3.15|>=5.4,<5.4.4|>=6,<6.0.4",
|
452 |
-
"symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7",
|
453 |
-
"symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5|>=5.2,<5.3.12",
|
454 |
-
"symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
455 |
-
"symfony/maker-bundle": ">=1.27,<1.29.2|>=1.30,<1.31.1",
|
456 |
-
"symfony/mime": ">=4.3,<4.3.8",
|
457 |
-
"symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7",
|
458 |
-
"symfony/polyfill": ">=1,<1.10",
|
459 |
-
"symfony/polyfill-php55": ">=1,<1.10",
|
460 |
-
"symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7",
|
461 |
-
"symfony/routing": ">=2,<2.0.19",
|
462 |
-
"symfony/security": ">=2,<2.7.51|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.8",
|
463 |
-
"symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11|>=5.3,<5.3.12",
|
464 |
-
"symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.9",
|
465 |
-
"symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11",
|
466 |
-
"symfony/security-guard": ">=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8",
|
467 |
-
"symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8|>=5.3,<5.3.2",
|
468 |
-
"symfony/serializer": ">=2,<2.0.11|>=4.1,<4.4.35|>=5,<5.3.12",
|
469 |
-
"symfony/symfony": ">=2,<3.4.49|>=4,<4.4.35|>=5,<5.3.12|>=5.3.14,<=5.3.14|>=5.4.3,<=5.4.3|>=6.0.3,<=6.0.3",
|
470 |
-
"symfony/translation": ">=2,<2.0.17",
|
471 |
-
"symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3",
|
472 |
-
"symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8",
|
473 |
-
"symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4",
|
474 |
-
"symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7",
|
475 |
-
"t3/dce": ">=2.2,<2.6.2",
|
476 |
-
"t3g/svg-sanitizer": "<1.0.3",
|
477 |
-
"tecnickcom/tcpdf": "<6.2.22",
|
478 |
-
"thelia/backoffice-default-template": ">=2.1,<2.1.2",
|
479 |
-
"thelia/thelia": ">=2.1-beta.1,<2.1.3",
|
480 |
-
"theonedemon/phpwhois": "<=4.2.5",
|
481 |
-
"tinymce/tinymce": "<5.10",
|
482 |
-
"titon/framework": ">=0,<9.9.99",
|
483 |
-
"topthink/framework": "<6.0.9",
|
484 |
-
"topthink/think": "<=6.0.9",
|
485 |
-
"topthink/thinkphp": "<=3.2.3",
|
486 |
-
"tribalsystems/zenario": "<8.8.53370",
|
487 |
-
"truckersmp/phpwhois": "<=4.3.1",
|
488 |
-
"twig/twig": "<1.38|>=2,<2.7",
|
489 |
-
"typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5",
|
490 |
-
"typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1",
|
491 |
-
"typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.52|>=8,<=8.7.41|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5",
|
492 |
-
"typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1",
|
493 |
-
"typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6",
|
494 |
-
"typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3",
|
495 |
-
"typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1",
|
496 |
-
"typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5",
|
497 |
-
"typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10",
|
498 |
-
"ua-parser/uap-php": "<3.8",
|
499 |
-
"unisharp/laravel-filemanager": "<=2.3",
|
500 |
-
"userfrosting/userfrosting": ">=0.3.1,<4.6.3",
|
501 |
-
"usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2",
|
502 |
-
"vanilla/safecurl": "<0.9.2",
|
503 |
-
"verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4",
|
504 |
-
"vrana/adminer": "<4.7.9",
|
505 |
-
"wallabag/tcpdf": "<6.2.22",
|
506 |
-
"wanglelecc/laracms": "<=1.0.3",
|
507 |
-
"web-auth/webauthn-framework": ">=3.3,<3.3.4",
|
508 |
-
"webcoast/deferred-image-processing": "<1.0.2",
|
509 |
-
"wikimedia/parsoid": "<0.12.2",
|
510 |
-
"willdurand/js-translation-bundle": "<2.1.1",
|
511 |
-
"wp-cli/wp-cli": "<2.5",
|
512 |
-
"yetiforce/yetiforce-crm": "<=6.3",
|
513 |
-
"yidashi/yii2cmf": "<=2",
|
514 |
-
"yii2mod/yii2-cms": "<1.9.2",
|
515 |
-
"yiisoft/yii": ">=1.1.14,<1.1.15",
|
516 |
-
"yiisoft/yii2": "<2.0.38",
|
517 |
-
"yiisoft/yii2-bootstrap": "<2.0.4",
|
518 |
-
"yiisoft/yii2-dev": "<2.0.43",
|
519 |
-
"yiisoft/yii2-elasticsearch": "<2.0.5",
|
520 |
-
"yiisoft/yii2-gii": "<2.0.4",
|
521 |
-
"yiisoft/yii2-jui": "<2.0.4",
|
522 |
-
"yiisoft/yii2-redis": "<2.0.8",
|
523 |
-
"yoast-seo-for-typo3/yoast_seo": "<7.2.3",
|
524 |
-
"yourls/yourls": "<=1.8.2",
|
525 |
-
"zendesk/zendesk_api_client_php": "<2.2.11",
|
526 |
-
"zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3",
|
527 |
-
"zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2",
|
528 |
-
"zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2",
|
529 |
-
"zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5",
|
530 |
-
"zendframework/zend-developer-tools": ">=1.2.2,<1.2.3",
|
531 |
-
"zendframework/zend-diactoros": ">=1,<1.8.4",
|
532 |
-
"zendframework/zend-feed": ">=1,<2.10.3",
|
533 |
-
"zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1",
|
534 |
-
"zendframework/zend-http": ">=1,<2.8.1",
|
535 |
-
"zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6",
|
536 |
-
"zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3",
|
537 |
-
"zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2",
|
538 |
-
"zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1",
|
539 |
-
"zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4",
|
540 |
-
"zendframework/zend-validator": ">=2.3,<2.3.6",
|
541 |
-
"zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1",
|
542 |
-
"zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6",
|
543 |
-
"zendframework/zendframework": "<=3",
|
544 |
-
"zendframework/zendframework1": "<1.12.20",
|
545 |
-
"zendframework/zendopenid": ">=2,<2.0.2",
|
546 |
-
"zendframework/zendxml": ">=1,<1.0.1",
|
547 |
-
"zetacomponents/mail": "<1.8.2",
|
548 |
-
"zf-commons/zfc-user": "<1.2.2",
|
549 |
-
"zfcampus/zf-apigility-doctrine": ">=1,<1.0.3",
|
550 |
-
"zfr/zfr-oauth2-server-module": "<0.1.2",
|
551 |
-
"zoujingli/thinkadmin": "<6.0.22"
|
552 |
-
},
|
553 |
-
"time": "2022-02-01T15:19:50+00:00",
|
554 |
-
"type": "metapackage",
|
555 |
-
"notification-url": "https://packagist.org/downloads/",
|
556 |
-
"license": [
|
557 |
-
"MIT"
|
558 |
-
],
|
559 |
-
"authors": [
|
560 |
-
{
|
561 |
-
"name": "Marco Pivetta",
|
562 |
-
"email": "ocramius@gmail.com",
|
563 |
-
"role": "maintainer"
|
564 |
-
},
|
565 |
-
{
|
566 |
-
"name": "Ilya Tribusean",
|
567 |
-
"email": "slash3b@gmail.com",
|
568 |
-
"role": "maintainer"
|
569 |
-
}
|
570 |
-
],
|
571 |
-
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
|
572 |
-
"support": {
|
573 |
-
"issues": "https://github.com/Roave/SecurityAdvisories/issues",
|
574 |
-
"source": "https://github.com/Roave/SecurityAdvisories/tree/latest"
|
575 |
-
},
|
576 |
-
"funding": [
|
577 |
-
{
|
578 |
-
"url": "https://github.com/Ocramius",
|
579 |
-
"type": "github"
|
580 |
-
},
|
581 |
-
{
|
582 |
-
"url": "https://tidelift.com/funding/github/packagist/roave/security-advisories",
|
583 |
-
"type": "tidelift"
|
584 |
-
}
|
585 |
-
]
|
586 |
-
},
|
587 |
-
{
|
588 |
-
"name": "wpml/collect",
|
589 |
-
"version": "dev-wpml-collect-rename",
|
590 |
-
"version_normalized": "dev-wpml-collect-rename",
|
591 |
-
"source": {
|
592 |
-
"type": "git",
|
593 |
-
"url": "https://github.com/OnTheGoSystems/collect.git",
|
594 |
-
"reference": "c822762bb9dcc581b26e16cc19226d7a6087c23c"
|
595 |
-
},
|
596 |
-
"dist": {
|
597 |
-
"type": "zip",
|
598 |
-
"url": "https://api.github.com/repos/OnTheGoSystems/collect/zipball/c822762bb9dcc581b26e16cc19226d7a6087c23c",
|
599 |
-
"reference": "c822762bb9dcc581b26e16cc19226d7a6087c23c",
|
600 |
-
"shasum": ""
|
601 |
-
},
|
602 |
-
"require": {
|
603 |
-
"php": ">=5.5.9"
|
604 |
-
},
|
605 |
-
"require-dev": {
|
606 |
-
"mockery/mockery": "~0.9.4",
|
607 |
-
"phpunit/phpunit": "~4.1"
|
608 |
-
},
|
609 |
-
"time": "2020-10-28T08:07:38+00:00",
|
610 |
-
"type": "library",
|
611 |
-
"installation-source": "dist",
|
612 |
-
"autoload": {
|
613 |
-
"files": [
|
614 |
-
"src/Illuminate/Support/helpers.php"
|
615 |
-
],
|
616 |
-
"psr-4": {
|
617 |
-
"WPML\\Collect\\": "src/Illuminate"
|
618 |
-
}
|
619 |
-
},
|
620 |
-
"notification-url": "https://packagist.org/downloads/",
|
621 |
-
"license": [
|
622 |
-
"MIT"
|
623 |
-
],
|
624 |
-
"authors": [
|
625 |
-
{
|
626 |
-
"name": "Taylor Otwell",
|
627 |
-
"email": "taylorotwell@gmail.com"
|
628 |
-
}
|
629 |
-
],
|
630 |
-
"description": "Collect - Illuminate Collections as a separate package.",
|
631 |
-
"keywords": [
|
632 |
-
"collection",
|
633 |
-
"laravel"
|
634 |
-
],
|
635 |
-
"support": {
|
636 |
-
"source": "https://github.com/OnTheGoSystems/collect/tree/wpml-collect-rename"
|
637 |
-
}
|
638 |
-
},
|
639 |
-
{
|
640 |
-
"name": "wpml/core-api",
|
641 |
-
"version": "0.1.5",
|
642 |
-
"version_normalized": "0.1.5.0",
|
643 |
-
"source": {
|
644 |
-
"type": "git",
|
645 |
-
"url": "https://git.onthegosystems.com/wpml-packages/core-api.git",
|
646 |
-
"reference": "369cfd53dba15e4dceb55e0e0458c16a5a142eab"
|
647 |
-
},
|
648 |
-
"require-dev": {
|
649 |
-
"10up/wp_mock": "0.2.0",
|
650 |
-
"antecedent/patchwork": "^2.0",
|
651 |
-
"cvuorinen/phpdoc-markdown-public": "^0.2.0",
|
652 |
-
"otgs/unit-tests-framework": "~1.2.0",
|
653 |
-
"wpml/collect": "dev-wpml-collect-rename",
|
654 |
-
"wpml/fp": "dev-develop",
|
655 |
-
"wpml/wp": "dev-develop"
|
656 |
-
},
|
657 |
-
"time": "2021-11-16T12:50:12+00:00",
|
658 |
-
"type": "library",
|
659 |
-
"installation-source": "source",
|
660 |
-
"autoload": {
|
661 |
-
"classmap": [
|
662 |
-
"core"
|
663 |
-
],
|
664 |
-
"files": []
|
665 |
-
},
|
666 |
-
"notification-url": "https://packagist.org/downloads/",
|
667 |
-
"license": [
|
668 |
-
"MIT"
|
669 |
-
],
|
670 |
-
"authors": [
|
671 |
-
{
|
672 |
-
"name": "Bruce Pearson",
|
673 |
-
"email": "bruce@onthegosystems.com"
|
674 |
-
}
|
675 |
-
],
|
676 |
-
"description": "Class and utilities to interface with WPML core functionality"
|
677 |
-
},
|
678 |
-
{
|
679 |
-
"name": "wpml/fp",
|
680 |
-
"version": "0.1.8",
|
681 |
-
"version_normalized": "0.1.8.0",
|
682 |
-
"source": {
|
683 |
-
"type": "git",
|
684 |
-
"url": "https://git.onthegosystems.com/wpml-packages/fp.git",
|
685 |
-
"reference": "5f233620422988ca47f3180d2fc1c2aa18191bee"
|
686 |
-
},
|
687 |
-
"require-dev": {
|
688 |
-
"cvuorinen/phpdoc-markdown-public": "^0.2.0",
|
689 |
-
"lucatume/function-mocker": "~1.0",
|
690 |
-
"phpunit/phpunit": "^5",
|
691 |
-
"wpml/collect": "dev-wpml-collect-rename"
|
692 |
-
},
|
693 |
-
"time": "2021-10-19T01:39:15+00:00",
|
694 |
-
"type": "library",
|
695 |
-
"installation-source": "source",
|
696 |
-
"autoload": {
|
697 |
-
"classmap": [
|
698 |
-
"core"
|
699 |
-
],
|
700 |
-
"files": [
|
701 |
-
"core/functions.php",
|
702 |
-
"core/strings_functions.php",
|
703 |
-
"core/system.php"
|
704 |
-
]
|
705 |
-
},
|
706 |
-
"notification-url": "https://packagist.org/downloads/"
|
707 |
-
},
|
708 |
-
{
|
709 |
-
"name": "wpml/wp",
|
710 |
-
"version": "0.1.7",
|
711 |
-
"version_normalized": "0.1.7.0",
|
712 |
-
"source": {
|
713 |
-
"type": "git",
|
714 |
-
"url": "https://git.onthegosystems.com/wpml-packages/wp.git",
|
715 |
-
"reference": "dc2fbeb965133f5e569f51009b919a585a5fc1a9"
|
716 |
-
},
|
717 |
-
"require-dev": {
|
718 |
-
"antecedent/patchwork": "^2.0",
|
719 |
-
"otgs/unit-tests-framework": "~1.2.0",
|
720 |
-
"wpml/collect": "dev-wpml-collect-rename",
|
721 |
-
"wpml/fp": "dev-develop"
|
722 |
-
},
|
723 |
-
"time": "2021-10-08T07:51:31+00:00",
|
724 |
-
"type": "library",
|
725 |
-
"installation-source": "source",
|
726 |
-
"autoload": {
|
727 |
-
"classmap": [
|
728 |
-
"classes/"
|
729 |
-
],
|
730 |
-
"files": []
|
731 |
-
},
|
732 |
-
"notification-url": "https://packagist.org/downloads/",
|
733 |
-
"license": [
|
734 |
-
"MIT"
|
735 |
-
],
|
736 |
-
"authors": [
|
737 |
-
{
|
738 |
-
"name": "Bruce Pearson",
|
739 |
-
"email": "bruce@onthegosystems.com"
|
740 |
-
}
|
741 |
-
],
|
742 |
-
"description": "Class and utilities to interface with WordPress from WPML"
|
743 |
-
},
|
744 |
-
{
|
745 |
-
"name": "wpml/wpml-dependencies",
|
746 |
-
"version": "dev-master",
|
747 |
-
"version_normalized": "9999999-dev",
|
748 |
-
"source": {
|
749 |
-
"type": "git",
|
750 |
-
"url": "ssh://git@git.onthegosystems.com:10022/glue-plugins/wpml/packages/wpml-dependencies.git",
|
751 |
-
"reference": "bd11271851a380365a6d97c5920c4cd089a07427"
|
752 |
-
},
|
753 |
-
"require": {
|
754 |
-
"otgs/auryn": "dev-master",
|
755 |
-
"otgs/icons": "~1.0",
|
756 |
-
"otgs/ui": "dev-master",
|
757 |
-
"wpml/collect": "dev-wpml-collect-rename",
|
758 |
-
"wpml/core-api": "0.1.5",
|
759 |
-
"wpml/fp": "0.1.8",
|
760 |
-
"wpml/wp": "0.1.7"
|
761 |
-
},
|
762 |
-
"require-dev": {
|
763 |
-
"bamarni/composer-bin-plugin": "^1.4",
|
764 |
-
"composer/composer": "~2.0"
|
765 |
-
},
|
766 |
-
"time": "2022-04-22T19:51:13+00:00",
|
767 |
-
"type": "library",
|
768 |
-
"installation-source": "source",
|
769 |
-
"autoload": {
|
770 |
-
"classmap": [
|
771 |
-
"lib/"
|
772 |
-
],
|
773 |
-
"files": [
|
774 |
-
"lib/classes/container/functions.php"
|
775 |
-
]
|
776 |
-
},
|
777 |
-
"scripts": {
|
778 |
-
"make": [
|
779 |
-
"make githooks"
|
780 |
-
],
|
781 |
-
"post-install-cmd": [
|
782 |
-
"@make",
|
783 |
-
"@composer bin all install --ansi"
|
784 |
-
],
|
785 |
-
"post-update-cmd": [
|
786 |
-
"@composer bin all update --ansi"
|
787 |
-
]
|
788 |
-
},
|
789 |
-
"authors": [
|
790 |
-
{
|
791 |
-
"name": "WPML",
|
792 |
-
"email": "hello@wpml.com",
|
793 |
-
"homepage": "http://wpml.org"
|
794 |
-
}
|
795 |
-
],
|
796 |
-
"description": "WPML dependencies for running WCML independently.",
|
797 |
-
"homepage": "https://git.onthegosystems.com/glue-plugins/wpml/packages/wpml-dependencies"
|
798 |
-
}
|
799 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/otgs/auryn/CONTRIBUTING.md
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
## Submitting useful bug reports
|
2 |
-
|
3 |
-
Please search existing issues first to make sure this is not a duplicate.
|
4 |
-
Every issue report has a cost for the developers required to field it; be
|
5 |
-
respectful of others' time and ensure your report isn't spurious prior to
|
6 |
-
submission. Additionally, please do us all a favor by adhering to the
|
7 |
-
principles of sound bug reporting laid out by Simon Tatham here:
|
8 |
-
|
9 |
-
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
|
10 |
-
|
11 |
-
## Development ideology
|
12 |
-
|
13 |
-
Truths which we believe to be self-evident:
|
14 |
-
|
15 |
-
- **The answer is not more options.** If you feel compelled to expose
|
16 |
-
new preferences to the user it's very possible you've made a wrong
|
17 |
-
turn somewhere.
|
18 |
-
|
19 |
-
- **There are no power users.** The idea that some users "understand"
|
20 |
-
concepts better than others has proven to be, for the most part, false.
|
21 |
-
If anything, "power users" are more dangerous than the rest, and we
|
22 |
-
should avoid exposing dangerous functionality to them.
|
23 |
-
|
24 |
-
## Code style
|
25 |
-
|
26 |
-
Please ensure any submissions adhere to the PSR-2 code style standard:
|
27 |
-
|
28 |
-
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/otgs/auryn/phpunit.xml
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<phpunit backupGlobals="false"
|
2 |
-
backupStaticAttributes="false"
|
3 |
-
colors="true"
|
4 |
-
convertErrorsToExceptions="true"
|
5 |
-
convertNoticesToExceptions="true"
|
6 |
-
convertWarningsToExceptions="true"
|
7 |
-
processIsolation="false"
|
8 |
-
stopOnFailure="false"
|
9 |
-
syntaxCheck="false"
|
10 |
-
bootstrap="vendor/autoload.php"
|
11 |
-
>
|
12 |
-
<testsuites>
|
13 |
-
<testsuite name="Unit-Tests">
|
14 |
-
<directory>./test</directory>
|
15 |
-
</testsuite>
|
16 |
-
</testsuites>
|
17 |
-
<filter>
|
18 |
-
<whitelist addUncoveredFilesFromWhitelist="true">
|
19 |
-
<directory>./lib</directory>
|
20 |
-
</whitelist>
|
21 |
-
</filter>
|
22 |
-
|
23 |
-
<logging>
|
24 |
-
<log
|
25 |
-
type="coverage-text"
|
26 |
-
target="php://stdout"
|
27 |
-
lowUpperBound="35"
|
28 |
-
highLowerBound="75"
|
29 |
-
/>
|
30 |
-
<!-- uncomment below to generate HTML code coverage reports in ./test/coverage -->
|
31 |
-
<!--
|
32 |
-
<log
|
33 |
-
type="coverage-html"
|
34 |
-
target="./test/coverage"
|
35 |
-
charset="UTF-8"
|
36 |
-
yui="true"
|
37 |
-
lowUpperBound="35"
|
38 |
-
highLowerBound="70"
|
39 |
-
showUncoveredFiles="true"
|
40 |
-
/>
|
41 |
-
-->
|
42 |
-
</logging>
|
43 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/otgs/icons
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 4dbce75c1ba493c7d4d2c86f318d2ad10fa4f24b
|
|
addons/vendor/otgs/ui
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit d8b11b073ba3247f25108b0dd88742ca3b0d4628
|
|
addons/vendor/wpml/collect/phpunit.xml
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<phpunit backupGlobals="false"
|
3 |
-
backupStaticAttributes="false"
|
4 |
-
bootstrap="tests/bootstrap.php"
|
5 |
-
colors="true"
|
6 |
-
convertErrorsToExceptions="true"
|
7 |
-
convertNoticesToExceptions="true"
|
8 |
-
convertWarningsToExceptions="true"
|
9 |
-
processIsolation="false"
|
10 |
-
stopOnError="false"
|
11 |
-
stopOnFailure="false"
|
12 |
-
syntaxCheck="true"
|
13 |
-
verbose="true"
|
14 |
-
>
|
15 |
-
<testsuites>
|
16 |
-
<testsuite name="Laravel Test Suite">
|
17 |
-
<directory suffix="Test.php">./tests</directory>
|
18 |
-
</testsuite>
|
19 |
-
</testsuites>
|
20 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/wpml/collect/readme.md
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
[![Codeship Status for tightenco/collect](https://codeship.com/projects/7a88b780-04ee-0134-0d48-3e31f9e0f6b8/status?branch=master)](https://codeship.com/projects/154325)
|
2 |
-
|
3 |
-
![](https://raw.githubusercontent.com/tightenco/collect/master/collect-logo.png)
|
4 |
-
|
5 |
-
# Collect - Illuminate Collections
|
6 |
-
|
7 |
-
Import [Laravel's Collections](https://laravel.com/docs/collections) into non-Laravel packages easily, without needing to require the entire `Illuminate\Support` package. ([Why not pull `Illuminate\Support` in framework-agnostic packages](https://yuloh.github.io/2016/dont-use-illuminate-support/))
|
8 |
-
|
9 |
-
Written by Taylor Otwell as a part of Laravel's [Illuminate/Support](https://github.com/illuminate/support) package, Collect is just the code from Support needed in order to use Collections on their own.
|
10 |
-
|
11 |
-
Lovingly split by Matt Stauffer for [Tighten Co.](http://tighten.co/), with a kick in the butt to finally do it from [@assertchris](https://github.com/assertchris).
|
12 |
-
|
13 |
-
## FAQ
|
14 |
-
- **Will this develop independently from Illuminate's Collections?**
|
15 |
-
No. Right now it's split manually, but the goal is for it shortly to be split automatically to keep it in sync with Laravel's Collections, even mirroring the release numbers.
|
16 |
-
- **Why isn't this just under the Illuminate namespace?**
|
17 |
-
Because that would require adding a lot of complexity and duplication to Illuminate\Support's internal structure. One day Taylor may choose to do that, but right now he hasn't and doesn't have any immediate plans to do so. If he does, we'll deprecate this package and point to the core version.
|
18 |
-
- **Why not just use an array?**
|
19 |
-
What a great question. [Tightenite Adam Wathan has a book about that.](http://adamwathan.me/refactoring-to-collections/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/wpml/collect/tests/Support/SupportCollectionTest.php
DELETED
@@ -1,1763 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use Mockery as m;
|
4 |
-
use WPML\Collect\Support\Collection;
|
5 |
-
use WPML\Collect\Contracts\Support\Jsonable;
|
6 |
-
use WPML\Collect\Contracts\Support\Arrayable;
|
7 |
-
|
8 |
-
class SupportCollectionTest extends PHPUnit_Framework_TestCase
|
9 |
-
{
|
10 |
-
public function testFirstReturnsFirstItemInCollection()
|
11 |
-
{
|
12 |
-
$c = new Collection(['foo', 'bar']);
|
13 |
-
$this->assertEquals('foo', $c->first());
|
14 |
-
}
|
15 |
-
|
16 |
-
public function testLastReturnsLastItemInCollection()
|
17 |
-
{
|
18 |
-
$c = new Collection(['foo', 'bar']);
|
19 |
-
|
20 |
-
$this->assertEquals('bar', $c->last());
|
21 |
-
}
|
22 |
-
|
23 |
-
public function testLastWithCallback()
|
24 |
-
{
|
25 |
-
$data = new Collection([100, 200, 300]);
|
26 |
-
$result = $data->last(function ($value) {
|
27 |
-
return $value < 250;
|
28 |
-
});
|
29 |
-
$this->assertEquals(200, $result);
|
30 |
-
$result = $data->last(function ($value, $key) {
|
31 |
-
return $key < 2;
|
32 |
-
});
|
33 |
-
$this->assertEquals(200, $result);
|
34 |
-
}
|
35 |
-
|
36 |
-
public function testLastWithCallbackAndDefault()
|
37 |
-
{
|
38 |
-
$data = new Collection(['foo', 'bar']);
|
39 |
-
$result = $data->last(function ($value) {
|
40 |
-
return $value === 'baz';
|
41 |
-
}, 'default');
|
42 |
-
$this->assertEquals('default', $result);
|
43 |
-
}
|
44 |
-
|
45 |
-
public function testLastWithDefaultAndWithoutCallback()
|
46 |
-
{
|
47 |
-
$data = new Collection;
|
48 |
-
$result = $data->last(null, 'default');
|
49 |
-
$this->assertEquals('default', $result);
|
50 |
-
}
|
51 |
-
|
52 |
-
public function testPopReturnsAndRemovesLastItemInCollection()
|
53 |
-
{
|
54 |
-
$c = new Collection(['foo', 'bar']);
|
55 |
-
|
56 |
-
$this->assertEquals('bar', $c->pop());
|
57 |
-
$this->assertEquals('foo', $c->first());
|
58 |
-
}
|
59 |
-
|
60 |
-
public function testShiftReturnsAndRemovesFirstItemInCollection()
|
61 |
-
{
|
62 |
-
$c = new Collection(['foo', 'bar']);
|
63 |
-
|
64 |
-
$this->assertEquals('foo', $c->shift());
|
65 |
-
$this->assertEquals('bar', $c->first());
|
66 |
-
}
|
67 |
-
|
68 |
-
public function testEmptyCollectionIsEmpty()
|
69 |
-
{
|
70 |
-
$c = new Collection();
|
71 |
-
|
72 |
-
$this->assertTrue($c->isEmpty());
|
73 |
-
}
|
74 |
-
|
75 |
-
public function testNotEmptyCollectionIsNotEmpty()
|
76 |
-
{
|
77 |
-
$c = new Collection( [ 1, 2, 3 ]);
|
78 |
-
|
79 |
-
$this->assertTrue($c->isNotEmpty());
|
80 |
-
}
|
81 |
-
|
82 |
-
public function testCollectionIsConstructed()
|
83 |
-
{
|
84 |
-
$collection = new Collection('foo');
|
85 |
-
$this->assertSame(['foo'], $collection->all());
|
86 |
-
|
87 |
-
$collection = new Collection(2);
|
88 |
-
$this->assertSame([2], $collection->all());
|
89 |
-
|
90 |
-
$collection = new Collection(false);
|
91 |
-
$this->assertSame([false], $collection->all());
|
92 |
-
|
93 |
-
$collection = new Collection(null);
|
94 |
-
$this->assertSame([], $collection->all());
|
95 |
-
|
96 |
-
$collection = new Collection;
|
97 |
-
$this->assertSame([], $collection->all());
|
98 |
-
}
|
99 |
-
|
100 |
-
public function testGetArrayableItems()
|
101 |
-
{
|
102 |
-
$collection = new Collection;
|
103 |
-
|
104 |
-
$class = new ReflectionClass($collection);
|
105 |
-
$method = $class->getMethod('getArrayableItems');
|
106 |
-
$method->setAccessible(true);
|
107 |
-
|
108 |
-
$items = new TestArrayableObject;
|
109 |
-
$array = $method->invokeArgs($collection, [$items]);
|
110 |
-
$this->assertSame(['foo' => 'bar'], $array);
|
111 |
-
|
112 |
-
$items = new TestJsonableObject;
|
113 |
-
$array = $method->invokeArgs($collection, [$items]);
|
114 |
-
$this->assertSame(['foo' => 'bar'], $array);
|
115 |
-
|
116 |
-
$items = new TestJsonSerializeObject;
|
117 |
-
$array = $method->invokeArgs($collection, [$items]);
|
118 |
-
$this->assertSame(['foo' => 'bar'], $array);
|
119 |
-
|
120 |
-
$items = new Collection(['foo' => 'bar']);
|
121 |
-
$array = $method->invokeArgs($collection, [$items]);
|
122 |
-
$this->assertSame(['foo' => 'bar'], $array);
|
123 |
-
|
124 |
-
$items = ['foo' => 'bar'];
|
125 |
-
$array = $method->invokeArgs($collection, [$items]);
|
126 |
-
$this->assertSame(['foo' => 'bar'], $array);
|
127 |
-
}
|
128 |
-
|
129 |
-
public function testToArrayCallsToArrayOnEachItemInCollection()
|
130 |
-
{
|
131 |
-
$item1 = m::mock('WPML\Collect\Contracts\Support\Arrayable');
|
132 |
-
$item1->shouldReceive('toArray')->once()->andReturn('foo.array');
|
133 |
-
$item2 = m::mock('WPML\Collect\Contracts\Support\Arrayable');
|
134 |
-
$item2->shouldReceive('toArray')->once()->andReturn('bar.array');
|
135 |
-
$c = new Collection([$item1, $item2]);
|
136 |
-
$results = $c->toArray();
|
137 |
-
|
138 |
-
$this->assertEquals(['foo.array', 'bar.array'], $results);
|
139 |
-
}
|
140 |
-
|
141 |
-
public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollection()
|
142 |
-
{
|
143 |
-
$item1 = m::mock('JsonSerializable');
|
144 |
-
$item1->shouldReceive('jsonSerialize')->once()->andReturn('foo.json');
|
145 |
-
$item2 = m::mock('WPML\Collect\Contracts\Support\Arrayable');
|
146 |
-
$item2->shouldReceive('toArray')->once()->andReturn('bar.array');
|
147 |
-
$c = new Collection([$item1, $item2]);
|
148 |
-
$results = $c->jsonSerialize();
|
149 |
-
|
150 |
-
$this->assertEquals(['foo.json', 'bar.array'], $results);
|
151 |
-
}
|
152 |
-
|
153 |
-
public function testToJsonEncodesTheJsonSerializeResult()
|
154 |
-
{
|
155 |
-
$c = $this->getMockBuilder(Collection::class)->setMethods(['jsonSerialize'])->getMock();
|
156 |
-
$c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo'));
|
157 |
-
$results = $c->toJson();
|
158 |
-
|
159 |
-
$this->assertJsonStringEqualsJsonString(json_encode('foo'), $results);
|
160 |
-
}
|
161 |
-
|
162 |
-
public function testCastingToStringJsonEncodesTheToArrayResult()
|
163 |
-
{
|
164 |
-
$c = $this->getMockBuilder(Collection::class)->setMethods(['jsonSerialize'])->getMock();
|
165 |
-
$c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo'));
|
166 |
-
|
167 |
-
$this->assertJsonStringEqualsJsonString(json_encode('foo'), (string) $c);
|
168 |
-
}
|
169 |
-
|
170 |
-
public function testOffsetAccess()
|
171 |
-
{
|
172 |
-
$c = new Collection(['name' => 'taylor']);
|
173 |
-
$this->assertEquals('taylor', $c['name']);
|
174 |
-
$c['name'] = 'dayle';
|
175 |
-
$this->assertEquals('dayle', $c['name']);
|
176 |
-
$this->assertTrue(isset($c['name']));
|
177 |
-
unset($c['name']);
|
178 |
-
$this->assertFalse(isset($c['name']));
|
179 |
-
$c[] = 'jason';
|
180 |
-
$this->assertEquals('jason', $c[0]);
|
181 |
-
}
|
182 |
-
|
183 |
-
public function testArrayAccessOffsetExists()
|
184 |
-
{
|
185 |
-
$c = new Collection(['foo', 'bar']);
|
186 |
-
$this->assertTrue($c->offsetExists(0));
|
187 |
-
$this->assertTrue($c->offsetExists(1));
|
188 |
-
$this->assertFalse($c->offsetExists(1000));
|
189 |
-
}
|
190 |
-
|
191 |
-
public function testArrayAccessOffsetGet()
|
192 |
-
{
|
193 |
-
$c = new Collection(['foo', 'bar']);
|
194 |
-
$this->assertEquals('foo', $c->offsetGet(0));
|
195 |
-
$this->assertEquals('bar', $c->offsetGet(1));
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* @expectedException PHPUnit_Framework_Error_Notice
|
200 |
-
*/
|
201 |
-
public function testArrayAccessOffsetGetOnNonExist()
|
202 |
-
{
|
203 |
-
$c = new Collection(['foo', 'bar']);
|
204 |
-
$c->offsetGet(1000);
|
205 |
-
}
|
206 |
-
|
207 |
-
public function testArrayAccessOffsetSet()
|
208 |
-
{
|
209 |
-
$c = new Collection(['foo', 'foo']);
|
210 |
-
|
211 |
-
$c->offsetSet(1, 'bar');
|
212 |
-
$this->assertEquals('bar', $c[1]);
|
213 |
-
|
214 |
-
$c->offsetSet(null, 'qux');
|
215 |
-
$this->assertEquals('qux', $c[2]);
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* @expectedException PHPUnit_Framework_Error_Notice
|
220 |
-
*/
|
221 |
-
public function testArrayAccessOffsetUnset()
|
222 |
-
{
|
223 |
-
$c = new Collection(['foo', 'bar']);
|
224 |
-
|
225 |
-
$c->offsetUnset(1);
|
226 |
-
$c[1];
|
227 |
-
}
|
228 |
-
|
229 |
-
public function testForgetSingleKey()
|
230 |
-
{
|
231 |
-
$c = new Collection(['foo', 'bar']);
|
232 |
-
$c->forget(0);
|
233 |
-
$this->assertFalse(isset($c['foo']));
|
234 |
-
|
235 |
-
$c = new Collection(['foo' => 'bar', 'baz' => 'qux']);
|
236 |
-
$c->forget('foo');
|
237 |
-
$this->assertFalse(isset($c['foo']));
|
238 |
-
}
|
239 |
-
|
240 |
-
public function testForgetArrayOfKeys()
|
241 |
-
{
|
242 |
-
$c = new Collection(['foo', 'bar', 'baz']);
|
243 |
-
$c->forget([0, 2]);
|
244 |
-
$this->assertFalse(isset($c[0]));
|
245 |
-
$this->assertFalse(isset($c[2]));
|
246 |
-
$this->assertTrue(isset($c[1]));
|
247 |
-
|
248 |
-
$c = new Collection(['name' => 'taylor', 'foo' => 'bar', 'baz' => 'qux']);
|
249 |
-
$c->forget(['foo', 'baz']);
|
250 |
-
$this->assertFalse(isset($c['foo']));
|
251 |
-
$this->assertFalse(isset($c['baz']));
|
252 |
-
$this->assertTrue(isset($c['name']));
|
253 |
-
}
|
254 |
-
|
255 |
-
public function testCountable()
|
256 |
-
{
|
257 |
-
$c = new Collection(['foo', 'bar']);
|
258 |
-
$this->assertCount(2, $c);
|
259 |
-
}
|
260 |
-
|
261 |
-
public function testIterable()
|
262 |
-
{
|
263 |
-
$c = new Collection(['foo']);
|
264 |
-
$this->assertInstanceOf('ArrayIterator', $c->getIterator());
|
265 |
-
$this->assertEquals(['foo'], $c->getIterator()->getArrayCopy());
|
266 |
-
}
|
267 |
-
|
268 |
-
public function testCachingIterator()
|
269 |
-
{
|
270 |
-
$c = new Collection(['foo']);
|
271 |
-
$this->assertInstanceOf('CachingIterator', $c->getCachingIterator());
|
272 |
-
}
|
273 |
-
|
274 |
-
public function testFilter()
|
275 |
-
{
|
276 |
-
$c = new Collection([['id' => 1, 'name' => 'Hello'], ['id' => 2, 'name' => 'World']]);
|
277 |
-
$this->assertEquals([1 => ['id' => 2, 'name' => 'World']], $c->filter(function ($item) {
|
278 |
-
return $item['id'] == 2;
|
279 |
-
})->all());
|
280 |
-
|
281 |
-
$c = new Collection(['', 'Hello', '', 'World']);
|
282 |
-
$this->assertEquals(['Hello', 'World'], $c->filter()->values()->toArray());
|
283 |
-
|
284 |
-
$c = new Collection(['id' => 1, 'first' => 'Hello', 'second' => 'World']);
|
285 |
-
$this->assertEquals(['first' => 'Hello', 'second' => 'World'], $c->filter(function ($item, $key) {
|
286 |
-
return $key != 'id';
|
287 |
-
})->all());
|
288 |
-
}
|
289 |
-
|
290 |
-
public function testWhere()
|
291 |
-
{
|
292 |
-
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
|
293 |
-
|
294 |
-
$this->assertEquals(
|
295 |
-
[['v' => 3], ['v' => '3']],
|
296 |
-
$c->where('v', 3)->values()->all()
|
297 |
-
);
|
298 |
-
$this->assertEquals(
|
299 |
-
[['v' => 3], ['v' => '3']],
|
300 |
-
$c->where('v', '=', 3)->values()->all()
|
301 |
-
);
|
302 |
-
$this->assertEquals(
|
303 |
-
[['v' => 3], ['v' => '3']],
|
304 |
-
$c->where('v', '==', 3)->values()->all()
|
305 |
-
);
|
306 |
-
$this->assertEquals(
|
307 |
-
[['v' => 3], ['v' => '3']],
|
308 |
-
$c->where('v', 'garbage', 3)->values()->all()
|
309 |
-
);
|
310 |
-
$this->assertEquals(
|
311 |
-
[['v' => 3]],
|
312 |
-
$c->where('v', '===', 3)->values()->all()
|
313 |
-
);
|
314 |
-
|
315 |
-
$this->assertEquals(
|
316 |
-
[['v' => 1], ['v' => 2], ['v' => 4]],
|
317 |
-
$c->where('v', '<>', 3)->values()->all()
|
318 |
-
);
|
319 |
-
$this->assertEquals(
|
320 |
-
[['v' => 1], ['v' => 2], ['v' => 4]],
|
321 |
-
$c->where('v', '!=', 3)->values()->all()
|
322 |
-
);
|
323 |
-
$this->assertEquals(
|
324 |
-
[['v' => 1], ['v' => 2], ['v' => '3'], ['v' => 4]],
|
325 |
-
$c->where('v', '!==', 3)->values()->all()
|
326 |
-
);
|
327 |
-
$this->assertEquals(
|
328 |
-
[['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3']],
|
329 |
-
$c->where('v', '<=', 3)->values()->all()
|
330 |
-
);
|
331 |
-
$this->assertEquals(
|
332 |
-
[['v' => 3], ['v' => '3'], ['v' => 4]],
|
333 |
-
$c->where('v', '>=', 3)->values()->all()
|
334 |
-
);
|
335 |
-
$this->assertEquals(
|
336 |
-
[['v' => 1], ['v' => 2]],
|
337 |
-
$c->where('v', '<', 3)->values()->all()
|
338 |
-
);
|
339 |
-
$this->assertEquals(
|
340 |
-
[['v' => 4]],
|
341 |
-
$c->where('v', '>', 3)->values()->all()
|
342 |
-
);
|
343 |
-
}
|
344 |
-
|
345 |
-
public function testWhereStrict()
|
346 |
-
{
|
347 |
-
$c = new Collection([['v' => 3], ['v' => '3']]);
|
348 |
-
|
349 |
-
$this->assertEquals(
|
350 |
-
[['v' => 3]],
|
351 |
-
$c->whereStrict('v', 3)->values()->all()
|
352 |
-
);
|
353 |
-
}
|
354 |
-
|
355 |
-
public function testWhereIn()
|
356 |
-
{
|
357 |
-
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
|
358 |
-
$this->assertEquals([['v' => 1], ['v' => 3], ['v' => '3']], $c->whereIn('v', [1, 3])->values()->all());
|
359 |
-
}
|
360 |
-
|
361 |
-
public function testWhereInStrict()
|
362 |
-
{
|
363 |
-
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
|
364 |
-
$this->assertEquals([['v' => 1], ['v' => 3]], $c->whereInStrict('v', [1, 3])->values()->all());
|
365 |
-
}
|
366 |
-
|
367 |
-
public function testValues()
|
368 |
-
{
|
369 |
-
$c = new Collection([['id' => 1, 'name' => 'Hello'], ['id' => 2, 'name' => 'World']]);
|
370 |
-
$this->assertEquals([['id' => 2, 'name' => 'World']], $c->filter(function ($item) {
|
371 |
-
return $item['id'] == 2;
|
372 |
-
})->values()->all());
|
373 |
-
}
|
374 |
-
|
375 |
-
public function testFlatten()
|
376 |
-
{
|
377 |
-
// Flat arrays are unaffected
|
378 |
-
$c = new Collection(['#foo', '#bar', '#baz']);
|
379 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
380 |
-
|
381 |
-
// Nested arrays are flattened with existing flat items
|
382 |
-
$c = new Collection([['#foo', '#bar'], '#baz']);
|
383 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
384 |
-
|
385 |
-
// Sets of nested arrays are flattened
|
386 |
-
$c = new Collection([['#foo', '#bar'], ['#baz']]);
|
387 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
388 |
-
|
389 |
-
// Deeply nested arrays are flattened
|
390 |
-
$c = new Collection([['#foo', ['#bar']], ['#baz']]);
|
391 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
392 |
-
|
393 |
-
// Nested collections are flattened alongside arrays
|
394 |
-
$c = new Collection([new Collection(['#foo', '#bar']), ['#baz']]);
|
395 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
396 |
-
|
397 |
-
// Nested collections containing plain arrays are flattened
|
398 |
-
$c = new Collection([new Collection(['#foo', ['#bar']]), ['#baz']]);
|
399 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
400 |
-
|
401 |
-
// Nested arrays containing collections are flattened
|
402 |
-
$c = new Collection([['#foo', new Collection(['#bar'])], ['#baz']]);
|
403 |
-
$this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten()->all());
|
404 |
-
|
405 |
-
// Nested arrays containing collections containing arrays are flattened
|
406 |
-
$c = new Collection([['#foo', new Collection(['#bar', ['#zap']])], ['#baz']]);
|
407 |
-
$this->assertEquals(['#foo', '#bar', '#zap', '#baz'], $c->flatten()->all());
|
408 |
-
}
|
409 |
-
|
410 |
-
public function testFlattenWithDepth()
|
411 |
-
{
|
412 |
-
// No depth flattens recursively
|
413 |
-
$c = new Collection([['#foo', ['#bar', ['#baz']]], '#zap']);
|
414 |
-
$this->assertEquals(['#foo', '#bar', '#baz', '#zap'], $c->flatten()->all());
|
415 |
-
|
416 |
-
// Specifying a depth only flattens to that depth
|
417 |
-
$c = new Collection([['#foo', ['#bar', ['#baz']]], '#zap']);
|
418 |
-
$this->assertEquals(['#foo', ['#bar', ['#baz']], '#zap'], $c->flatten(1)->all());
|
419 |
-
|
420 |
-
$c = new Collection([['#foo', ['#bar', ['#baz']]], '#zap']);
|
421 |
-
$this->assertEquals(['#foo', '#bar', ['#baz'], '#zap'], $c->flatten(2)->all());
|
422 |
-
}
|
423 |
-
|
424 |
-
public function testFlattenIgnoresKeys()
|
425 |
-
{
|
426 |
-
// No depth ignores keys
|
427 |
-
$c = new Collection(['#foo', ['key' => '#bar'], ['key' => '#baz'], 'key' => '#zap']);
|
428 |
-
$this->assertEquals(['#foo', '#bar', '#baz', '#zap'], $c->flatten()->all());
|
429 |
-
|
430 |
-
// Depth of 1 ignores keys
|
431 |
-
$c = new Collection(['#foo', ['key' => '#bar'], ['key' => '#baz'], 'key' => '#zap']);
|
432 |
-
$this->assertEquals(['#foo', '#bar', '#baz', '#zap'], $c->flatten(1)->all());
|
433 |
-
}
|
434 |
-
|
435 |
-
public function testMergeNull()
|
436 |
-
{
|
437 |
-
$c = new Collection(['name' => 'Hello']);
|
438 |
-
$this->assertEquals(['name' => 'Hello'], $c->merge(null)->all());
|
439 |
-
}
|
440 |
-
|
441 |
-
public function testMergeArray()
|
442 |
-
{
|
443 |
-
$c = new Collection(['name' => 'Hello']);
|
444 |
-
$this->assertEquals(['name' => 'Hello', 'id' => 1], $c->merge(['id' => 1])->all());
|
445 |
-
}
|
446 |
-
|
447 |
-
public function testMergeCollection()
|
448 |
-
{
|
449 |
-
$c = new Collection(['name' => 'Hello']);
|
450 |
-
$this->assertEquals(['name' => 'World', 'id' => 1], $c->merge(new Collection(['name' => 'World', 'id' => 1]))->all());
|
451 |
-
}
|
452 |
-
|
453 |
-
public function testUnionNull()
|
454 |
-
{
|
455 |
-
$c = new Collection(['name' => 'Hello']);
|
456 |
-
$this->assertEquals(['name' => 'Hello'], $c->union(null)->all());
|
457 |
-
}
|
458 |
-
|
459 |
-
public function testUnionArray()
|
460 |
-
{
|
461 |
-
$c = new Collection(['name' => 'Hello']);
|
462 |
-
$this->assertEquals(['name' => 'Hello', 'id' => 1], $c->union(['id' => 1])->all());
|
463 |
-
}
|
464 |
-
|
465 |
-
public function testUnionCollection()
|
466 |
-
{
|
467 |
-
$c = new Collection(['name' => 'Hello']);
|
468 |
-
$this->assertEquals(['name' => 'Hello', 'id' => 1], $c->union(new Collection(['name' => 'World', 'id' => 1]))->all());
|
469 |
-
}
|
470 |
-
|
471 |
-
public function testDiffCollection()
|
472 |
-
{
|
473 |
-
$c = new Collection(['id' => 1, 'first_word' => 'Hello']);
|
474 |
-
$this->assertEquals(['id' => 1], $c->diff(new Collection(['first_word' => 'Hello', 'last_word' => 'World']))->all());
|
475 |
-
}
|
476 |
-
|
477 |
-
public function testDiffNull()
|
478 |
-
{
|
479 |
-
$c = new Collection(['id' => 1, 'first_word' => 'Hello']);
|
480 |
-
$this->assertEquals(['id' => 1, 'first_word' => 'Hello'], $c->diff(null)->all());
|
481 |
-
}
|
482 |
-
|
483 |
-
public function testDiffKeys()
|
484 |
-
{
|
485 |
-
$c1 = new Collection(['id' => 1, 'first_word' => 'Hello']);
|
486 |
-
$c2 = new Collection(['id' => 123, 'foo_bar' => 'Hello']);
|
487 |
-
$this->assertEquals(['first_word' => 'Hello'], $c1->diffKeys($c2)->all());
|
488 |
-
}
|
489 |
-
|
490 |
-
public function testEach()
|
491 |
-
{
|
492 |
-
$c = new Collection($original = [1, 2, 'foo' => 'bar', 'bam' => 'baz']);
|
493 |
-
|
494 |
-
$result = [];
|
495 |
-
$c->each(function ($item, $key) use (&$result) {
|
496 |
-
$result[$key] = $item;
|
497 |
-
});
|
498 |
-
$this->assertEquals($original, $result);
|
499 |
-
|
500 |
-
$result = [];
|
501 |
-
$c->each(function ($item, $key) use (&$result) {
|
502 |
-
$result[$key] = $item;
|
503 |
-
if (is_string($key)) {
|
504 |
-
return false;
|
505 |
-
}
|
506 |
-
});
|
507 |
-
$this->assertEquals([1, 2, 'foo' => 'bar'], $result);
|
508 |
-
}
|
509 |
-
|
510 |
-
public function testIntersectNull()
|
511 |
-
{
|
512 |
-
$c = new Collection(['id' => 1, 'first_word' => 'Hello']);
|
513 |
-
$this->assertEquals([], $c->intersect(null)->all());
|
514 |
-
}
|
515 |
-
|
516 |
-
public function testIntersectCollection()
|
517 |
-
{
|
518 |
-
$c = new Collection(['id' => 1, 'first_word' => 'Hello']);
|
519 |
-
$this->assertEquals(['first_word' => 'Hello'], $c->intersect(new Collection(['first_world' => 'Hello', 'last_word' => 'World']))->all());
|
520 |
-
}
|
521 |
-
|
522 |
-
public function testUnique()
|
523 |
-
{
|
524 |
-
$c = new Collection(['Hello', 'World', 'World']);
|
525 |
-
$this->assertEquals(['Hello', 'World'], $c->unique()->all());
|
526 |
-
|
527 |
-
$c = new Collection([[1, 2], [1, 2], [2, 3], [3, 4], [2, 3]]);
|
528 |
-
$this->assertEquals([[1, 2], [2, 3], [3, 4]], $c->unique()->values()->all());
|
529 |
-
}
|
530 |
-
|
531 |
-
public function testUniqueWithCallback()
|
532 |
-
{
|
533 |
-
$c = new Collection([
|
534 |
-
1 => ['id' => 1, 'first' => 'Taylor', 'last' => 'Otwell'], 2 => ['id' => 2, 'first' => 'Taylor', 'last' => 'Otwell'],
|
535 |
-
3 => ['id' => 3, 'first' => 'Abigail', 'last' => 'Otwell'], 4 => ['id' => 4, 'first' => 'Abigail', 'last' => 'Otwell'],
|
536 |
-
5 => ['id' => 5, 'first' => 'Taylor', 'last' => 'Swift'], 6 => ['id' => 6, 'first' => 'Taylor', 'last' => 'Swift'],
|
537 |
-
]);
|
538 |
-
|
539 |
-
$this->assertEquals([
|
540 |
-
1 => ['id' => 1, 'first' => 'Taylor', 'last' => 'Otwell'],
|
541 |
-
3 => ['id' => 3, 'first' => 'Abigail', 'last' => 'Otwell'],
|
542 |
-
], $c->unique('first')->all());
|
543 |
-
|
544 |
-
$this->assertEquals([
|
545 |
-
1 => ['id' => 1, 'first' => 'Taylor', 'last' => 'Otwell'],
|
546 |
-
3 => ['id' => 3, 'first' => 'Abigail', 'last' => 'Otwell'],
|
547 |
-
5 => ['id' => 5, 'first' => 'Taylor', 'last' => 'Swift'],
|
548 |
-
], $c->unique(function ($item) {
|
549 |
-
return $item['first'].$item['last'];
|
550 |
-
})->all());
|
551 |
-
}
|
552 |
-
|
553 |
-
public function testUniqueStrict()
|
554 |
-
{
|
555 |
-
$c = new Collection([
|
556 |
-
[
|
557 |
-
'id' => '0',
|
558 |
-
'name' => 'zero',
|
559 |
-
],
|
560 |
-
[
|
561 |
-
'id' => '00',
|
562 |
-
'name' => 'double zero',
|
563 |
-
],
|
564 |
-
[
|
565 |
-
'id' => '0',
|
566 |
-
'name' => 'again zero',
|
567 |
-
],
|
568 |
-
]);
|
569 |
-
|
570 |
-
$this->assertEquals([
|
571 |
-
[
|
572 |
-
'id' => '0',
|
573 |
-
'name' => 'zero',
|
574 |
-
],
|
575 |
-
[
|
576 |
-
'id' => '00',
|
577 |
-
'name' => 'double zero',
|
578 |
-
],
|
579 |
-
], $c->uniqueStrict('id')->all());
|
580 |
-
}
|
581 |
-
|
582 |
-
public function testCollapse()
|
583 |
-
{
|
584 |
-
$data = new Collection([[$object1 = new StdClass], [$object2 = new StdClass]]);
|
585 |
-
$this->assertEquals([$object1, $object2], $data->collapse()->all());
|
586 |
-
}
|
587 |
-
|
588 |
-
public function testCollapseWithNestedCollactions()
|
589 |
-
{
|
590 |
-
$data = new Collection([new Collection([1, 2, 3]), new Collection([4, 5, 6])]);
|
591 |
-
$this->assertEquals([1, 2, 3, 4, 5, 6], $data->collapse()->all());
|
592 |
-
}
|
593 |
-
|
594 |
-
public function testSort()
|
595 |
-
{
|
596 |
-
$data = (new Collection([5, 3, 1, 2, 4]))->sort();
|
597 |
-
$this->assertEquals([1, 2, 3, 4, 5], $data->values()->all());
|
598 |
-
|
599 |
-
$data = (new Collection([-1, -3, -2, -4, -5, 0, 5, 3, 1, 2, 4]))->sort();
|
600 |
-
$this->assertEquals([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], $data->values()->all());
|
601 |
-
|
602 |
-
$data = (new Collection(['foo', 'bar-10', 'bar-1']))->sort();
|
603 |
-
$this->assertEquals(['bar-1', 'bar-10', 'foo'], $data->values()->all());
|
604 |
-
}
|
605 |
-
|
606 |
-
public function testSortWithCallback()
|
607 |
-
{
|
608 |
-
$data = (new Collection([5, 3, 1, 2, 4]))->sort(function ($a, $b) {
|
609 |
-
if ($a === $b) {
|
610 |
-
return 0;
|
611 |
-
}
|
612 |
-
|
613 |
-
return ($a < $b) ? -1 : 1;
|
614 |
-
});
|
615 |
-
|
616 |
-
$this->assertEquals(range(1, 5), array_values($data->all()));
|
617 |
-
}
|
618 |
-
|
619 |
-
public function testSortBy()
|
620 |
-
{
|
621 |
-
$data = new Collection(['taylor', 'dayle']);
|
622 |
-
$data = $data->sortBy(function ($x) {
|
623 |
-
return $x;
|
624 |
-
});
|
625 |
-
|
626 |
-
$this->assertEquals(['dayle', 'taylor'], array_values($data->all()));
|
627 |
-
|
628 |
-
$data = new Collection(['dayle', 'taylor']);
|
629 |
-
$data = $data->sortByDesc(function ($x) {
|
630 |
-
return $x;
|
631 |
-
});
|
632 |
-
|
633 |
-
$this->assertEquals(['taylor', 'dayle'], array_values($data->all()));
|
634 |
-
}
|
635 |
-
|
636 |
-
public function testSortByString()
|
637 |
-
{
|
638 |
-
$data = new Collection([['name' => 'taylor'], ['name' => 'dayle']]);
|
639 |
-
$data = $data->sortBy('name');
|
640 |
-
|
641 |
-
$this->assertEquals([['name' => 'dayle'], ['name' => 'taylor']], array_values($data->all()));
|
642 |
-
}
|
643 |
-
|
644 |
-
public function testReverse()
|
645 |
-
{
|
646 |
-
$data = new Collection(['zaeed', 'alan']);
|
647 |
-
$reversed = $data->reverse();
|
648 |
-
|
649 |
-
$this->assertSame([1 => 'alan', 0 => 'zaeed'], $reversed->all());
|
650 |
-
|
651 |
-
$data = new Collection(['name' => 'taylor', 'framework' => 'laravel']);
|
652 |
-
$reversed = $data->reverse();
|
653 |
-
|
654 |
-
$this->assertSame(['framework' => 'laravel', 'name' => 'taylor'], $reversed->all());
|
655 |
-
}
|
656 |
-
|
657 |
-
public function testFlip()
|
658 |
-
{
|
659 |
-
$data = new Collection(['name' => 'taylor', 'framework' => 'laravel']);
|
660 |
-
$this->assertEquals(['taylor' => 'name', 'laravel' => 'framework'], $data->flip()->toArray());
|
661 |
-
}
|
662 |
-
|
663 |
-
public function testChunk()
|
664 |
-
{
|
665 |
-
$data = new Collection([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
666 |
-
$data = $data->chunk(3);
|
667 |
-
|
668 |
-
$this->assertInstanceOf(Collection::class, $data);
|
669 |
-
$this->assertInstanceOf(Collection::class, $data[0]);
|
670 |
-
$this->assertCount(4, $data);
|
671 |
-
$this->assertEquals([1, 2, 3], $data[0]->toArray());
|
672 |
-
$this->assertEquals([9 => 10], $data[3]->toArray());
|
673 |
-
}
|
674 |
-
|
675 |
-
public function testEvery()
|
676 |
-
{
|
677 |
-
$data = new Collection([
|
678 |
-
6 => 'a',
|
679 |
-
4 => 'b',
|
680 |
-
7 => 'c',
|
681 |
-
1 => 'd',
|
682 |
-
5 => 'e',
|
683 |
-
3 => 'f',
|
684 |
-
]);
|
685 |
-
|
686 |
-
$this->assertEquals(['a', 'e'], $data->every(4)->all());
|
687 |
-
$this->assertEquals(['b', 'f'], $data->every(4, 1)->all());
|
688 |
-
$this->assertEquals(['c'], $data->every(4, 2)->all());
|
689 |
-
$this->assertEquals(['d'], $data->every(4, 3)->all());
|
690 |
-
}
|
691 |
-
|
692 |
-
public function testExcept()
|
693 |
-
{
|
694 |
-
$data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']);
|
695 |
-
|
696 |
-
$this->assertEquals(['first' => 'Taylor'], $data->except(['last', 'email', 'missing'])->all());
|
697 |
-
$this->assertEquals(['first' => 'Taylor'], $data->except('last', 'email', 'missing')->all());
|
698 |
-
|
699 |
-
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(['last'])->all());
|
700 |
-
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except('last')->all());
|
701 |
-
}
|
702 |
-
|
703 |
-
public function testPluckWithArrayAndObjectValues()
|
704 |
-
{
|
705 |
-
$data = new Collection([(object) ['name' => 'taylor', 'email' => 'foo'], ['name' => 'dayle', 'email' => 'bar']]);
|
706 |
-
$this->assertEquals(['taylor' => 'foo', 'dayle' => 'bar'], $data->pluck('email', 'name')->all());
|
707 |
-
$this->assertEquals(['foo', 'bar'], $data->pluck('email')->all());
|
708 |
-
}
|
709 |
-
|
710 |
-
public function testPluckWithArrayAccessValues()
|
711 |
-
{
|
712 |
-
$data = new Collection([
|
713 |
-
new TestArrayAccessImplementation(['name' => 'taylor', 'email' => 'foo']),
|
714 |
-
new TestArrayAccessImplementation(['name' => 'dayle', 'email' => 'bar']),
|
715 |
-
]);
|
716 |
-
|
717 |
-
$this->assertEquals(['taylor' => 'foo', 'dayle' => 'bar'], $data->pluck('email', 'name')->all());
|
718 |
-
$this->assertEquals(['foo', 'bar'], $data->pluck('email')->all());
|
719 |
-
}
|
720 |
-
|
721 |
-
public function testImplode()
|
722 |
-
{
|
723 |
-
$data = new Collection([['name' => 'taylor', 'email' => 'foo'], ['name' => 'dayle', 'email' => 'bar']]);
|
724 |
-
$this->assertEquals('foobar', $data->implode('email'));
|
725 |
-
$this->assertEquals('foo,bar', $data->implode('email', ','));
|
726 |
-
|
727 |
-
$data = new Collection(['taylor', 'dayle']);
|
728 |
-
$this->assertEquals('taylordayle', $data->implode(''));
|
729 |
-
$this->assertEquals('taylor,dayle', $data->implode(','));
|
730 |
-
}
|
731 |
-
|
732 |
-
public function testTake()
|
733 |
-
{
|
734 |
-
$data = new Collection(['taylor', 'dayle', 'shawn']);
|
735 |
-
$data = $data->take(2);
|
736 |
-
$this->assertEquals(['taylor', 'dayle'], $data->all());
|
737 |
-
}
|
738 |
-
|
739 |
-
public function testRandom()
|
740 |
-
{
|
741 |
-
$data = new Collection([1, 2, 3, 4, 5, 6]);
|
742 |
-
|
743 |
-
$random = $data->random();
|
744 |
-
$this->assertInternalType('integer', $random);
|
745 |
-
$this->assertContains($random, $data->all());
|
746 |
-
|
747 |
-
$random = $data->random(3);
|
748 |
-
$this->assertInstanceOf(Collection::class, $random);
|
749 |
-
$this->assertCount(3, $random);
|
750 |
-
}
|
751 |
-
|
752 |
-
/**
|
753 |
-
* @expectedException InvalidArgumentException
|
754 |
-
*/
|
755 |
-
public function testRandomThrowsAnErrorWhenRequestingMoreItemsThanAreAvailable()
|
756 |
-
{
|
757 |
-
(new Collection)->random();
|
758 |
-
}
|
759 |
-
|
760 |
-
public function testTakeLast()
|
761 |
-
{
|
762 |
-
$data = new Collection(['taylor', 'dayle', 'shawn']);
|
763 |
-
$data = $data->take(-2);
|
764 |
-
$this->assertEquals([1 => 'dayle', 2 => 'shawn'], $data->all());
|
765 |
-
}
|
766 |
-
|
767 |
-
public function testMacroable()
|
768 |
-
{
|
769 |
-
// Foo() macro : unique values starting with A
|
770 |
-
Collection::macro('foo', function () {
|
771 |
-
return $this->filter(function ($item) {
|
772 |
-
return strpos($item, 'a') === 0;
|
773 |
-
})
|
774 |
-
->unique()
|
775 |
-
->values();
|
776 |
-
});
|
777 |
-
|
778 |
-
$c = new Collection(['a', 'a', 'aa', 'aaa', 'bar']);
|
779 |
-
|
780 |
-
$this->assertSame(['a', 'aa', 'aaa'], $c->foo()->all());
|
781 |
-
}
|
782 |
-
|
783 |
-
public function testMakeMethod()
|
784 |
-
{
|
785 |
-
$collection = Collection::make('foo');
|
786 |
-
$this->assertEquals(['foo'], $collection->all());
|
787 |
-
}
|
788 |
-
|
789 |
-
public function testMakeMethodFromNull()
|
790 |
-
{
|
791 |
-
$collection = Collection::make(null);
|
792 |
-
$this->assertEquals([], $collection->all());
|
793 |
-
|
794 |
-
$collection = Collection::make();
|
795 |
-
$this->assertEquals([], $collection->all());
|
796 |
-
}
|
797 |
-
|
798 |
-
public function testMakeMethodFromCollection()
|
799 |
-
{
|
800 |
-
$firstCollection = Collection::make(['foo' => 'bar']);
|
801 |
-
$secondCollection = Collection::make($firstCollection);
|
802 |
-
$this->assertEquals(['foo' => 'bar'], $secondCollection->all());
|
803 |
-
}
|
804 |
-
|
805 |
-
public function testMakeMethodFromArray()
|
806 |
-
{
|
807 |
-
$collection = Collection::make(['foo' => 'bar']);
|
808 |
-
$this->assertEquals(['foo' => 'bar'], $collection->all());
|
809 |
-
}
|
810 |
-
|
811 |
-
public function testConstructMakeFromObject()
|
812 |
-
{
|
813 |
-
$object = new stdClass();
|
814 |
-
$object->foo = 'bar';
|
815 |
-
$collection = Collection::make($object);
|
816 |
-
$this->assertEquals(['foo' => 'bar'], $collection->all());
|
817 |
-
}
|
818 |
-
|
819 |
-
public function testConstructMethod()
|
820 |
-
{
|
821 |
-
$collection = new Collection('foo');
|
822 |
-
$this->assertEquals(['foo'], $collection->all());
|
823 |
-
}
|
824 |
-
|
825 |
-
public function testConstructMethodFromNull()
|
826 |
-
{
|
827 |
-
$collection = new Collection(null);
|
828 |
-
$this->assertEquals([], $collection->all());
|
829 |
-
|
830 |
-
$collection = new Collection();
|
831 |
-
$this->assertEquals([], $collection->all());
|
832 |
-
}
|
833 |
-
|
834 |
-
public function testConstructMethodFromCollection()
|
835 |
-
{
|
836 |
-
$firstCollection = new Collection(['foo' => 'bar']);
|
837 |
-
$secondCollection = new Collection($firstCollection);
|
838 |
-
$this->assertEquals(['foo' => 'bar'], $secondCollection->all());
|
839 |
-
}
|
840 |
-
|
841 |
-
public function testConstructMethodFromArray()
|
842 |
-
{
|
843 |
-
$collection = new Collection(['foo' => 'bar']);
|
844 |
-
$this->assertEquals(['foo' => 'bar'], $collection->all());
|
845 |
-
}
|
846 |
-
|
847 |
-
public function testConstructMethodFromObject()
|
848 |
-
{
|
849 |
-
$object = new stdClass();
|
850 |
-
$object->foo = 'bar';
|
851 |
-
$collection = new Collection($object);
|
852 |
-
$this->assertEquals(['foo' => 'bar'], $collection->all());
|
853 |
-
}
|
854 |
-
|
855 |
-
public function testSplice()
|
856 |
-
{
|
857 |
-
$data = new Collection(['foo', 'baz']);
|
858 |
-
$data->splice(1);
|
859 |
-
$this->assertEquals(['foo'], $data->all());
|
860 |
-
|
861 |
-
$data = new Collection(['foo', 'baz']);
|
862 |
-
$data->splice(1, 0, 'bar');
|
863 |
-
$this->assertEquals(['foo', 'bar', 'baz'], $data->all());
|
864 |
-
|
865 |
-
$data = new Collection(['foo', 'baz']);
|
866 |
-
$data->splice(1, 1);
|
867 |
-
$this->assertEquals(['foo'], $data->all());
|
868 |
-
|
869 |
-
$data = new Collection(['foo', 'baz']);
|
870 |
-
$cut = $data->splice(1, 1, 'bar');
|
871 |
-
$this->assertEquals(['foo', 'bar'], $data->all());
|
872 |
-
$this->assertEquals(['baz'], $cut->all());
|
873 |
-
}
|
874 |
-
|
875 |
-
public function testGetPluckValueWithAccessors()
|
876 |
-
{
|
877 |
-
$model = new TestAccessorEloquentTestStub(['some' => 'foo']);
|
878 |
-
$modelTwo = new TestAccessorEloquentTestStub(['some' => 'bar']);
|
879 |
-
$data = new Collection([$model, $modelTwo]);
|
880 |
-
|
881 |
-
$this->assertEquals(['foo', 'bar'], $data->pluck('some')->all());
|
882 |
-
}
|
883 |
-
|
884 |
-
public function testMap()
|
885 |
-
{
|
886 |
-
$data = new Collection(['first' => 'taylor', 'last' => 'otwell']);
|
887 |
-
$data = $data->map(function ($item, $key) {
|
888 |
-
return $key.'-'.strrev($item);
|
889 |
-
});
|
890 |
-
$this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $data->all());
|
891 |
-
}
|
892 |
-
|
893 |
-
public function testFlatMap()
|
894 |
-
{
|
895 |
-
$data = new Collection([
|
896 |
-
['name' => 'taylor', 'hobbies' => ['programming', 'basketball']],
|
897 |
-
['name' => 'adam', 'hobbies' => ['music', 'powerlifting']],
|
898 |
-
]);
|
899 |
-
$data = $data->flatMap(function ($person) {
|
900 |
-
return $person['hobbies'];
|
901 |
-
});
|
902 |
-
$this->assertEquals(['programming', 'basketball', 'music', 'powerlifting'], $data->all());
|
903 |
-
}
|
904 |
-
|
905 |
-
public function testMapWithKeys()
|
906 |
-
{
|
907 |
-
$data = new Collection([
|
908 |
-
['name' => 'Blastoise', 'type' => 'Water', 'idx' => 9],
|
909 |
-
['name' => 'Charmander', 'type' => 'Fire', 'idx' => 4],
|
910 |
-
['name' => 'Dragonair', 'type' => 'Dragon', 'idx' => 148],
|
911 |
-
]);
|
912 |
-
$data = $data->mapWithKeys(function ($pokemon) {
|
913 |
-
return [$pokemon['name'] => $pokemon['type']];
|
914 |
-
});
|
915 |
-
$this->assertEquals(
|
916 |
-
['Blastoise' => 'Water', 'Charmander' => 'Fire', 'Dragonair' => 'Dragon'],
|
917 |
-
$data->all()
|
918 |
-
);
|
919 |
-
}
|
920 |
-
|
921 |
-
public function testTransform()
|
922 |
-
{
|
923 |
-
$data = new Collection(['first' => 'taylor', 'last' => 'otwell']);
|
924 |
-
$data->transform(function ($item, $key) {
|
925 |
-
return $key.'-'.strrev($item);
|
926 |
-
});
|
927 |
-
$this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $data->all());
|
928 |
-
}
|
929 |
-
|
930 |
-
public function testFirstWithCallback()
|
931 |
-
{
|
932 |
-
$data = new Collection(['foo', 'bar', 'baz']);
|
933 |
-
$result = $data->first(function ($value) {
|
934 |
-
return $value === 'bar';
|
935 |
-
});
|
936 |
-
$this->assertEquals('bar', $result);
|
937 |
-
}
|
938 |
-
|
939 |
-
public function testFirstWithCallbackAndDefault()
|
940 |
-
{
|
941 |
-
$data = new Collection(['foo', 'bar']);
|
942 |
-
$result = $data->first(function ($value) {
|
943 |
-
return $value === 'baz';
|
944 |
-
}, 'default');
|
945 |
-
$this->assertEquals('default', $result);
|
946 |
-
}
|
947 |
-
|
948 |
-
public function testFirstWithDefaultAndWithoutCallback()
|
949 |
-
{
|
950 |
-
$data = new Collection;
|
951 |
-
$result = $data->first(null, 'default');
|
952 |
-
$this->assertEquals('default', $result);
|
953 |
-
}
|
954 |
-
|
955 |
-
public function testGroupByAttribute()
|
956 |
-
{
|
957 |
-
$data = new Collection([['rating' => 1, 'url' => '1'], ['rating' => 1, 'url' => '1'], ['rating' => 2, 'url' => '2']]);
|
958 |
-
|
959 |
-
$result = $data->groupBy('rating');
|
960 |
-
$this->assertEquals([1 => [['rating' => 1, 'url' => '1'], ['rating' => 1, 'url' => '1']], 2 => [['rating' => 2, 'url' => '2']]], $result->toArray());
|
961 |
-
|
962 |
-
$result = $data->groupBy('url');
|
963 |
-
$this->assertEquals([1 => [['rating' => 1, 'url' => '1'], ['rating' => 1, 'url' => '1']], 2 => [['rating' => 2, 'url' => '2']]], $result->toArray());
|
964 |
-
}
|
965 |
-
|
966 |
-
public function testGroupByAttributePreservingKeys()
|
967 |
-
{
|
968 |
-
$data = new Collection([10 => ['rating' => 1, 'url' => '1'], 20 => ['rating' => 1, 'url' => '1'], 30 => ['rating' => 2, 'url' => '2']]);
|
969 |
-
|
970 |
-
$result = $data->groupBy('rating', true);
|
971 |
-
|
972 |
-
$expected_result = [
|
973 |
-
1 => [10 => ['rating' => 1, 'url' => '1'], 20 => ['rating' => 1, 'url' => '1']],
|
974 |
-
2 => [30 => ['rating' => 2, 'url' => '2']],
|
975 |
-
];
|
976 |
-
|
977 |
-
$this->assertEquals($expected_result, $result->toArray());
|
978 |
-
}
|
979 |
-
|
980 |
-
public function testGroupByClosureWhereItemsHaveSingleGroup()
|
981 |
-
{
|
982 |
-
$data = new Collection([['rating' => 1, 'url' => '1'], ['rating' => 1, 'url' => '1'], ['rating' => 2, 'url' => '2']]);
|
983 |
-
|
984 |
-
$result = $data->groupBy(function ($item) {
|
985 |
-
return $item['rating'];
|
986 |
-
});
|
987 |
-
|
988 |
-
$this->assertEquals([1 => [['rating' => 1, 'url' => '1'], ['rating' => 1, 'url' => '1']], 2 => [['rating' => 2, 'url' => '2']]], $result->toArray());
|
989 |
-
}
|
990 |
-
|
991 |
-
public function testGroupByClosureWhereItemsHaveSingleGroupPreservingKeys()
|
992 |
-
{
|
993 |
-
$data = new Collection([10 => ['rating' => 1, 'url' => '1'], 20 => ['rating' => 1, 'url' => '1'], 30 => ['rating' => 2, 'url' => '2']]);
|
994 |
-
|
995 |
-
$result = $data->groupBy(function ($item) {
|
996 |
-
return $item['rating'];
|
997 |
-
}, true);
|
998 |
-
|
999 |
-
$expected_result = [
|
1000 |
-
1 => [10 => ['rating' => 1, 'url' => '1'], 20 => ['rating' => 1, 'url' => '1']],
|
1001 |
-
2 => [30 => ['rating' => 2, 'url' => '2']],
|
1002 |
-
];
|
1003 |
-
|
1004 |
-
$this->assertEquals($expected_result, $result->toArray());
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
public function testGroupByClosureWhereItemsHaveMultipleGroups()
|
1008 |
-
{
|
1009 |
-
$data = new Collection([
|
1010 |
-
['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1011 |
-
['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1012 |
-
['user' => 3, 'roles' => ['Role_1']],
|
1013 |
-
]);
|
1014 |
-
|
1015 |
-
$result = $data->groupBy(function ($item) {
|
1016 |
-
return $item['roles'];
|
1017 |
-
});
|
1018 |
-
|
1019 |
-
$expected_result = [
|
1020 |
-
'Role_1' => [
|
1021 |
-
['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1022 |
-
['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1023 |
-
['user' => 3, 'roles' => ['Role_1']],
|
1024 |
-
],
|
1025 |
-
'Role_2' => [
|
1026 |
-
['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1027 |
-
],
|
1028 |
-
'Role_3' => [
|
1029 |
-
['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1030 |
-
],
|
1031 |
-
];
|
1032 |
-
|
1033 |
-
$this->assertEquals($expected_result, $result->toArray());
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
public function testGroupByClosureWhereItemsHaveMultipleGroupsPreservingKeys()
|
1037 |
-
{
|
1038 |
-
$data = new Collection([
|
1039 |
-
10 => ['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1040 |
-
20 => ['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1041 |
-
30 => ['user' => 3, 'roles' => ['Role_1']],
|
1042 |
-
]);
|
1043 |
-
|
1044 |
-
$result = $data->groupBy(function ($item) {
|
1045 |
-
return $item['roles'];
|
1046 |
-
}, true);
|
1047 |
-
|
1048 |
-
$expected_result = [
|
1049 |
-
'Role_1' => [
|
1050 |
-
10 => ['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1051 |
-
20 => ['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1052 |
-
30 => ['user' => 3, 'roles' => ['Role_1']],
|
1053 |
-
],
|
1054 |
-
'Role_2' => [
|
1055 |
-
20 => ['user' => 2, 'roles' => ['Role_1', 'Role_2']],
|
1056 |
-
],
|
1057 |
-
'Role_3' => [
|
1058 |
-
10 => ['user' => 1, 'roles' => ['Role_1', 'Role_3']],
|
1059 |
-
],
|
1060 |
-
];
|
1061 |
-
|
1062 |
-
$this->assertEquals($expected_result, $result->toArray());
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
public function testKeyByAttribute()
|
1066 |
-
{
|
1067 |
-
$data = new Collection([['rating' => 1, 'name' => '1'], ['rating' => 2, 'name' => '2'], ['rating' => 3, 'name' => '3']]);
|
1068 |
-
|
1069 |
-
$result = $data->keyBy('rating');
|
1070 |
-
$this->assertEquals([1 => ['rating' => 1, 'name' => '1'], 2 => ['rating' => 2, 'name' => '2'], 3 => ['rating' => 3, 'name' => '3']], $result->all());
|
1071 |
-
|
1072 |
-
$result = $data->keyBy(function ($item) {
|
1073 |
-
return $item['rating'] * 2;
|
1074 |
-
});
|
1075 |
-
$this->assertEquals([2 => ['rating' => 1, 'name' => '1'], 4 => ['rating' => 2, 'name' => '2'], 6 => ['rating' => 3, 'name' => '3']], $result->all());
|
1076 |
-
}
|
1077 |
-
|
1078 |
-
public function testKeyByClosure()
|
1079 |
-
{
|
1080 |
-
$data = new Collection([
|
1081 |
-
['firstname' => 'Taylor', 'lastname' => 'Otwell', 'locale' => 'US'],
|
1082 |
-
['firstname' => 'Lucas', 'lastname' => 'Michot', 'locale' => 'FR'],
|
1083 |
-
]);
|
1084 |
-
$result = $data->keyBy(function ($item, $key) {
|
1085 |
-
return strtolower($key.'-'.$item['firstname'].$item['lastname']);
|
1086 |
-
});
|
1087 |
-
$this->assertEquals([
|
1088 |
-
'0-taylorotwell' => ['firstname' => 'Taylor', 'lastname' => 'Otwell', 'locale' => 'US'],
|
1089 |
-
'1-lucasmichot' => ['firstname' => 'Lucas', 'lastname' => 'Michot', 'locale' => 'FR'],
|
1090 |
-
], $result->all());
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
public function testContains()
|
1094 |
-
{
|
1095 |
-
$c = new Collection([1, 3, 5]);
|
1096 |
-
|
1097 |
-
$this->assertTrue($c->contains(1));
|
1098 |
-
$this->assertFalse($c->contains(2));
|
1099 |
-
$this->assertTrue($c->contains(function ($value) {
|
1100 |
-
return $value < 5;
|
1101 |
-
}));
|
1102 |
-
$this->assertFalse($c->contains(function ($value) {
|
1103 |
-
return $value > 5;
|
1104 |
-
}));
|
1105 |
-
|
1106 |
-
$c = new Collection([['v' => 1], ['v' => 3], ['v' => 5]]);
|
1107 |
-
|
1108 |
-
$this->assertTrue($c->contains('v', 1));
|
1109 |
-
$this->assertFalse($c->contains('v', 2));
|
1110 |
-
|
1111 |
-
$c = new Collection(['date', 'class', (object) ['foo' => 50]]);
|
1112 |
-
|
1113 |
-
$this->assertTrue($c->contains('date'));
|
1114 |
-
$this->assertTrue($c->contains('class'));
|
1115 |
-
$this->assertFalse($c->contains('foo'));
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
public function testContainsStrict()
|
1119 |
-
{
|
1120 |
-
$c = new Collection([1, 3, 5, '02']);
|
1121 |
-
|
1122 |
-
$this->assertTrue($c->containsStrict(1));
|
1123 |
-
$this->assertFalse($c->containsStrict(2));
|
1124 |
-
$this->assertTrue($c->containsStrict('02'));
|
1125 |
-
$this->assertTrue($c->containsStrict(function ($value) {
|
1126 |
-
return $value < 5;
|
1127 |
-
}));
|
1128 |
-
$this->assertFalse($c->containsStrict(function ($value) {
|
1129 |
-
return $value > 5;
|
1130 |
-
}));
|
1131 |
-
|
1132 |
-
$c = new Collection([['v' => 1], ['v' => 3], ['v' => '04'], ['v' => 5]]);
|
1133 |
-
|
1134 |
-
$this->assertTrue($c->containsStrict('v', 1));
|
1135 |
-
$this->assertFalse($c->containsStrict('v', 2));
|
1136 |
-
$this->assertFalse($c->containsStrict('v', 4));
|
1137 |
-
$this->assertTrue($c->containsStrict('v', '04'));
|
1138 |
-
|
1139 |
-
$c = new Collection(['date', 'class', (object) ['foo' => 50], '']);
|
1140 |
-
|
1141 |
-
$this->assertTrue($c->containsStrict('date'));
|
1142 |
-
$this->assertTrue($c->containsStrict('class'));
|
1143 |
-
$this->assertFalse($c->containsStrict('foo'));
|
1144 |
-
$this->assertFalse($c->containsStrict(null));
|
1145 |
-
$this->assertTrue($c->containsStrict(''));
|
1146 |
-
}
|
1147 |
-
|
1148 |
-
public function testGettingSumFromCollection()
|
1149 |
-
{
|
1150 |
-
$c = new Collection([(object) ['foo' => 50], (object) ['foo' => 50]]);
|
1151 |
-
$this->assertEquals(100, $c->sum('foo'));
|
1152 |
-
|
1153 |
-
$c = new Collection([(object) ['foo' => 50], (object) ['foo' => 50]]);
|
1154 |
-
$this->assertEquals(100, $c->sum(function ($i) {
|
1155 |
-
return $i->foo;
|
1156 |
-
}));
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
public function testCanSumValuesWithoutACallback()
|
1160 |
-
{
|
1161 |
-
$c = new Collection([1, 2, 3, 4, 5]);
|
1162 |
-
$this->assertEquals(15, $c->sum());
|
1163 |
-
}
|
1164 |
-
|
1165 |
-
public function testGettingSumFromEmptyCollection()
|
1166 |
-
{
|
1167 |
-
$c = new Collection();
|
1168 |
-
$this->assertEquals(0, $c->sum('foo'));
|
1169 |
-
}
|
1170 |
-
|
1171 |
-
public function testValueRetrieverAcceptsDotNotation()
|
1172 |
-
{
|
1173 |
-
$c = new Collection([
|
1174 |
-
(object) ['id' => 1, 'foo' => ['bar' => 'B']], (object) ['id' => 2, 'foo' => ['bar' => 'A']],
|
1175 |
-
]);
|
1176 |
-
|
1177 |
-
$c = $c->sortBy('foo.bar');
|
1178 |
-
$this->assertEquals([2, 1], $c->pluck('id')->all());
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
public function testPullRetrievesItemFromCollection()
|
1182 |
-
{
|
1183 |
-
$c = new Collection(['foo', 'bar']);
|
1184 |
-
|
1185 |
-
$this->assertEquals('foo', $c->pull(0));
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
public function testPullRemovesItemFromCollection()
|
1189 |
-
{
|
1190 |
-
$c = new Collection(['foo', 'bar']);
|
1191 |
-
$c->pull(0);
|
1192 |
-
$this->assertEquals([1 => 'bar'], $c->all());
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
public function testPullReturnsDefault()
|
1196 |
-
{
|
1197 |
-
$c = new Collection([]);
|
1198 |
-
$value = $c->pull(0, 'foo');
|
1199 |
-
$this->assertEquals('foo', $value);
|
1200 |
-
}
|
1201 |
-
|
1202 |
-
public function testRejectRemovesElementsPassingTruthTest()
|
1203 |
-
{
|
1204 |
-
$c = new Collection(['foo', 'bar']);
|
1205 |
-
$this->assertEquals(['foo'], $c->reject('bar')->values()->all());
|
1206 |
-
|
1207 |
-
$c = new Collection(['foo', 'bar']);
|
1208 |
-
$this->assertEquals(['foo'], $c->reject(function ($v) {
|
1209 |
-
return $v == 'bar';
|
1210 |
-
})->values()->all());
|
1211 |
-
|
1212 |
-
$c = new Collection(['foo', null]);
|
1213 |
-
$this->assertEquals(['foo'], $c->reject(null)->values()->all());
|
1214 |
-
|
1215 |
-
$c = new Collection(['foo', 'bar']);
|
1216 |
-
$this->assertEquals(['foo', 'bar'], $c->reject('baz')->values()->all());
|
1217 |
-
|
1218 |
-
$c = new Collection(['foo', 'bar']);
|
1219 |
-
$this->assertEquals(['foo', 'bar'], $c->reject(function ($v) {
|
1220 |
-
return $v == 'baz';
|
1221 |
-
})->values()->all());
|
1222 |
-
|
1223 |
-
$c = new Collection(['id' => 1, 'primary' => 'foo', 'secondary' => 'bar']);
|
1224 |
-
$this->assertEquals(['primary' => 'foo', 'secondary' => 'bar'], $c->reject(function ($item, $key) {
|
1225 |
-
return $key == 'id';
|
1226 |
-
})->all());
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
public function testSearchReturnsIndexOfFirstFoundItem()
|
1230 |
-
{
|
1231 |
-
$c = new Collection([1, 2, 3, 4, 5, 2, 5, 'foo' => 'bar']);
|
1232 |
-
|
1233 |
-
$this->assertEquals(1, $c->search(2));
|
1234 |
-
$this->assertEquals('foo', $c->search('bar'));
|
1235 |
-
$this->assertEquals(4, $c->search(function ($value) {
|
1236 |
-
return $value > 4;
|
1237 |
-
}));
|
1238 |
-
$this->assertEquals('foo', $c->search(function ($value) {
|
1239 |
-
return ! is_numeric($value);
|
1240 |
-
}));
|
1241 |
-
}
|
1242 |
-
|
1243 |
-
public function testSearchReturnsFalseWhenItemIsNotFound()
|
1244 |
-
{
|
1245 |
-
$c = new Collection([1, 2, 3, 4, 5, 'foo' => 'bar']);
|
1246 |
-
|
1247 |
-
$this->assertFalse($c->search(6));
|
1248 |
-
$this->assertFalse($c->search('foo'));
|
1249 |
-
$this->assertFalse($c->search(function ($value) {
|
1250 |
-
return $value < 1 && is_numeric($value);
|
1251 |
-
}));
|
1252 |
-
$this->assertFalse($c->search(function ($value) {
|
1253 |
-
return $value == 'nope';
|
1254 |
-
}));
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
public function testKeys()
|
1258 |
-
{
|
1259 |
-
$c = new Collection(['name' => 'taylor', 'framework' => 'laravel']);
|
1260 |
-
$this->assertEquals(['name', 'framework'], $c->keys()->all());
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
public function testPaginate()
|
1264 |
-
{
|
1265 |
-
$c = new Collection(['one', 'two', 'three', 'four']);
|
1266 |
-
$this->assertEquals(['one', 'two'], $c->forPage(1, 2)->all());
|
1267 |
-
$this->assertEquals([2 => 'three', 3 => 'four'], $c->forPage(2, 2)->all());
|
1268 |
-
$this->assertEquals([], $c->forPage(3, 2)->all());
|
1269 |
-
}
|
1270 |
-
|
1271 |
-
public function testPrepend()
|
1272 |
-
{
|
1273 |
-
$c = new Collection(['one', 'two', 'three', 'four']);
|
1274 |
-
$this->assertEquals(['zero', 'one', 'two', 'three', 'four'], $c->prepend('zero')->all());
|
1275 |
-
|
1276 |
-
$c = new Collection(['one' => 1, 'two' => 2]);
|
1277 |
-
$this->assertEquals(['zero' => 0, 'one' => 1, 'two' => 2], $c->prepend(0, 'zero')->all());
|
1278 |
-
}
|
1279 |
-
|
1280 |
-
public function testZip()
|
1281 |
-
{
|
1282 |
-
$c = new Collection([1, 2, 3]);
|
1283 |
-
$c = $c->zip(new Collection([4, 5, 6]));
|
1284 |
-
$this->assertInstanceOf(Collection::class, $c);
|
1285 |
-
$this->assertInstanceOf(Collection::class, $c[0]);
|
1286 |
-
$this->assertInstanceOf(Collection::class, $c[1]);
|
1287 |
-
$this->assertInstanceOf(Collection::class, $c[2]);
|
1288 |
-
$this->assertCount(3, $c);
|
1289 |
-
$this->assertEquals([1, 4], $c[0]->all());
|
1290 |
-
$this->assertEquals([2, 5], $c[1]->all());
|
1291 |
-
$this->assertEquals([3, 6], $c[2]->all());
|
1292 |
-
|
1293 |
-
$c = new Collection([1, 2, 3]);
|
1294 |
-
$c = $c->zip([4, 5, 6], [7, 8, 9]);
|
1295 |
-
$this->assertCount(3, $c);
|
1296 |
-
$this->assertEquals([1, 4, 7], $c[0]->all());
|
1297 |
-
$this->assertEquals([2, 5, 8], $c[1]->all());
|
1298 |
-
$this->assertEquals([3, 6, 9], $c[2]->all());
|
1299 |
-
|
1300 |
-
$c = new Collection([1, 2, 3]);
|
1301 |
-
$c = $c->zip([4, 5, 6], [7]);
|
1302 |
-
$this->assertCount(3, $c);
|
1303 |
-
$this->assertEquals([1, 4, 7], $c[0]->all());
|
1304 |
-
$this->assertEquals([2, 5, null], $c[1]->all());
|
1305 |
-
$this->assertEquals([3, 6, null], $c[2]->all());
|
1306 |
-
}
|
1307 |
-
|
1308 |
-
public function testGettingMaxItemsFromCollection()
|
1309 |
-
{
|
1310 |
-
$c = new Collection([(object) ['foo' => 10], (object) ['foo' => 20]]);
|
1311 |
-
$this->assertEquals(20, $c->max(function ($item) {
|
1312 |
-
return $item->foo;
|
1313 |
-
}));
|
1314 |
-
$this->assertEquals(20, $c->max('foo'));
|
1315 |
-
|
1316 |
-
$c = new Collection([['foo' => 10], ['foo' => 20]]);
|
1317 |
-
$this->assertEquals(20, $c->max('foo'));
|
1318 |
-
|
1319 |
-
$c = new Collection([1, 2, 3, 4, 5]);
|
1320 |
-
$this->assertEquals(5, $c->max());
|
1321 |
-
|
1322 |
-
$c = new Collection();
|
1323 |
-
$this->assertNull($c->max());
|
1324 |
-
}
|
1325 |
-
|
1326 |
-
public function testGettingMinItemsFromCollection()
|
1327 |
-
{
|
1328 |
-
$c = new Collection([(object) ['foo' => 10], (object) ['foo' => 20]]);
|
1329 |
-
$this->assertEquals(10, $c->min(function ($item) {
|
1330 |
-
return $item->foo;
|
1331 |
-
}));
|
1332 |
-
$this->assertEquals(10, $c->min('foo'));
|
1333 |
-
|
1334 |
-
$c = new Collection([['foo' => 10], ['foo' => 20]]);
|
1335 |
-
$this->assertEquals(10, $c->min('foo'));
|
1336 |
-
|
1337 |
-
$c = new Collection([1, 2, 3, 4, 5]);
|
1338 |
-
$this->assertEquals(1, $c->min());
|
1339 |
-
|
1340 |
-
$c = new Collection();
|
1341 |
-
$this->assertNull($c->min());
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
public function testOnly()
|
1345 |
-
{
|
1346 |
-
$data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']);
|
1347 |
-
|
1348 |
-
$this->assertEquals($data->all(), $data->only(null)->all());
|
1349 |
-
$this->assertEquals(['first' => 'Taylor'], $data->only(['first', 'missing'])->all());
|
1350 |
-
$this->assertEquals(['first' => 'Taylor'], $data->only('first', 'missing')->all());
|
1351 |
-
|
1352 |
-
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only(['first', 'email'])->all());
|
1353 |
-
$this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only('first', 'email')->all());
|
1354 |
-
}
|
1355 |
-
|
1356 |
-
public function testGettingAvgItemsFromCollection()
|
1357 |
-
{
|
1358 |
-
$c = new Collection([(object) ['foo' => 10], (object) ['foo' => 20]]);
|
1359 |
-
$this->assertEquals(15, $c->avg(function ($item) {
|
1360 |
-
return $item->foo;
|
1361 |
-
}));
|
1362 |
-
$this->assertEquals(15, $c->avg('foo'));
|
1363 |
-
|
1364 |
-
$c = new Collection([['foo' => 10], ['foo' => 20]]);
|
1365 |
-
$this->assertEquals(15, $c->avg('foo'));
|
1366 |
-
|
1367 |
-
$c = new Collection([1, 2, 3, 4, 5]);
|
1368 |
-
$this->assertEquals(3, $c->avg());
|
1369 |
-
|
1370 |
-
$c = new Collection();
|
1371 |
-
$this->assertNull($c->avg());
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
public function testJsonSerialize()
|
1375 |
-
{
|
1376 |
-
$c = new Collection([
|
1377 |
-
new TestArrayableObject(),
|
1378 |
-
new TestJsonableObject(),
|
1379 |
-
new TestJsonSerializeObject(),
|
1380 |
-
'baz',
|
1381 |
-
]);
|
1382 |
-
|
1383 |
-
$this->assertSame([
|
1384 |
-
['foo' => 'bar'],
|
1385 |
-
['foo' => 'bar'],
|
1386 |
-
['foo' => 'bar'],
|
1387 |
-
'baz',
|
1388 |
-
], $c->jsonSerialize());
|
1389 |
-
}
|
1390 |
-
|
1391 |
-
public function testCombineWithArray()
|
1392 |
-
{
|
1393 |
-
$expected = [
|
1394 |
-
1 => 4,
|
1395 |
-
2 => 5,
|
1396 |
-
3 => 6,
|
1397 |
-
];
|
1398 |
-
|
1399 |
-
$c = new Collection(array_keys($expected));
|
1400 |
-
$actual = $c->combine(array_values($expected))->toArray();
|
1401 |
-
|
1402 |
-
$this->assertSame($expected, $actual);
|
1403 |
-
}
|
1404 |
-
|
1405 |
-
public function testCombineWithCollection()
|
1406 |
-
{
|
1407 |
-
$expected = [
|
1408 |
-
1 => 4,
|
1409 |
-
2 => 5,
|
1410 |
-
3 => 6,
|
1411 |
-
];
|
1412 |
-
|
1413 |
-
$keyCollection = new Collection(array_keys($expected));
|
1414 |
-
$valueCollection = new Collection(array_values($expected));
|
1415 |
-
$actual = $keyCollection->combine($valueCollection)->toArray();
|
1416 |
-
|
1417 |
-
$this->assertSame($expected, $actual);
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
public function testReduce()
|
1421 |
-
{
|
1422 |
-
$data = new Collection([1, 2, 3]);
|
1423 |
-
$this->assertEquals(6, $data->reduce(function ($carry, $element) {
|
1424 |
-
return $carry += $element;
|
1425 |
-
}));
|
1426 |
-
}
|
1427 |
-
|
1428 |
-
/**
|
1429 |
-
* @expectedException InvalidArgumentException
|
1430 |
-
*/
|
1431 |
-
public function testRandomThrowsAnExceptionUsingAmountBiggerThanCollectionSize()
|
1432 |
-
{
|
1433 |
-
$data = new Collection([1, 2, 3]);
|
1434 |
-
$data->random(4);
|
1435 |
-
}
|
1436 |
-
|
1437 |
-
public function testPipe()
|
1438 |
-
{
|
1439 |
-
$collection = new Collection([1, 2, 3]);
|
1440 |
-
|
1441 |
-
$this->assertEquals(6, $collection->pipe(function ($collection) {
|
1442 |
-
return $collection->sum();
|
1443 |
-
}));
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
public function testMedianValueWithArrayCollection()
|
1447 |
-
{
|
1448 |
-
$collection = new Collection([1, 2, 2, 4]);
|
1449 |
-
|
1450 |
-
$this->assertEquals(2, $collection->median());
|
1451 |
-
}
|
1452 |
-
|
1453 |
-
public function testMedianValueByKey()
|
1454 |
-
{
|
1455 |
-
$collection = new Collection([
|
1456 |
-
(object) ['foo' => 1],
|
1457 |
-
(object) ['foo' => 2],
|
1458 |
-
(object) ['foo' => 2],
|
1459 |
-
(object) ['foo' => 4],
|
1460 |
-
]);
|
1461 |
-
$this->assertEquals(2, $collection->median('foo'));
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
public function testEvenMedianCollection()
|
1465 |
-
{
|
1466 |
-
$collection = new Collection([
|
1467 |
-
(object) ['foo' => 0],
|
1468 |
-
(object) ['foo' => 3],
|
1469 |
-
]);
|
1470 |
-
$this->assertEquals(1.5, $collection->median('foo'));
|
1471 |
-
}
|
1472 |
-
|
1473 |
-
public function testMedianOutOfOrderCollection()
|
1474 |
-
{
|
1475 |
-
$collection = new Collection([
|
1476 |
-
(object) ['foo' => 0],
|
1477 |
-
(object) ['foo' => 5],
|
1478 |
-
(object) ['foo' => 3],
|
1479 |
-
]);
|
1480 |
-
$this->assertEquals(3, $collection->median('foo'));
|
1481 |
-
}
|
1482 |
-
|
1483 |
-
public function testMedianOnEmptyCollectionReturnsNull()
|
1484 |
-
{
|
1485 |
-
$collection = new Collection();
|
1486 |
-
$this->assertNull($collection->median());
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
public function testModeOnNullCollection()
|
1490 |
-
{
|
1491 |
-
$collection = new Collection();
|
1492 |
-
$this->assertNull($collection->mode());
|
1493 |
-
}
|
1494 |
-
|
1495 |
-
public function testMode()
|
1496 |
-
{
|
1497 |
-
$collection = new Collection([1, 2, 3, 4, 4, 5]);
|
1498 |
-
$this->assertEquals([4], $collection->mode());
|
1499 |
-
}
|
1500 |
-
|
1501 |
-
public function testModeValueByKey()
|
1502 |
-
{
|
1503 |
-
$collection = new Collection([
|
1504 |
-
(object) ['foo' => 1],
|
1505 |
-
(object) ['foo' => 1],
|
1506 |
-
(object) ['foo' => 2],
|
1507 |
-
(object) ['foo' => 4],
|
1508 |
-
]);
|
1509 |
-
$this->assertEquals([1], $collection->mode('foo'));
|
1510 |
-
}
|
1511 |
-
|
1512 |
-
public function testWithMultipleModeValues()
|
1513 |
-
{
|
1514 |
-
$collection = new Collection([1, 2, 2, 1]);
|
1515 |
-
$this->assertEquals([1, 2], $collection->mode());
|
1516 |
-
}
|
1517 |
-
|
1518 |
-
public function testSliceOffset()
|
1519 |
-
{
|
1520 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1521 |
-
$this->assertEquals([4, 5, 6, 7, 8], $collection->slice(3)->values()->toArray());
|
1522 |
-
}
|
1523 |
-
|
1524 |
-
public function testSliceNegativeOffset()
|
1525 |
-
{
|
1526 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1527 |
-
$this->assertEquals([6, 7, 8], $collection->slice(-3)->values()->toArray());
|
1528 |
-
}
|
1529 |
-
|
1530 |
-
public function testSliceOffsetAndLength()
|
1531 |
-
{
|
1532 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1533 |
-
$this->assertEquals([4, 5, 6], $collection->slice(3, 3)->values()->toArray());
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
public function testSliceOffsetAndNegativeLength()
|
1537 |
-
{
|
1538 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1539 |
-
$this->assertEquals([4, 5, 6, 7], $collection->slice(3, -1)->values()->toArray());
|
1540 |
-
}
|
1541 |
-
|
1542 |
-
public function testSliceNegativeOffsetAndLength()
|
1543 |
-
{
|
1544 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1545 |
-
$this->assertEquals([4, 5, 6], $collection->slice(-5, 3)->values()->toArray());
|
1546 |
-
}
|
1547 |
-
|
1548 |
-
public function testSliceNegativeOffsetAndNegativeLength()
|
1549 |
-
{
|
1550 |
-
$collection = new Collection([1, 2, 3, 4, 5, 6, 7, 8]);
|
1551 |
-
$this->assertEquals([3, 4, 5, 6], $collection->slice(-6, -2)->values()->toArray());
|
1552 |
-
}
|
1553 |
-
|
1554 |
-
public function testCollectonFromTraversable()
|
1555 |
-
{
|
1556 |
-
$collection = new Collection(new \ArrayObject([1, 2, 3]));
|
1557 |
-
$this->assertEquals([1, 2, 3], $collection->toArray());
|
1558 |
-
}
|
1559 |
-
|
1560 |
-
public function testCollectonFromTraversableWithKeys()
|
1561 |
-
{
|
1562 |
-
$collection = new Collection(new \ArrayObject(['foo' => 1, 'bar' => 2, 'baz' => 3]));
|
1563 |
-
$this->assertEquals(['foo' => 1, 'bar' => 2, 'baz' => 3], $collection->toArray());
|
1564 |
-
}
|
1565 |
-
|
1566 |
-
public function testSplitCollectionWithADivisableCount()
|
1567 |
-
{
|
1568 |
-
$collection = new Collection(['a', 'b', 'c', 'd']);
|
1569 |
-
|
1570 |
-
$this->assertEquals(
|
1571 |
-
[['a', 'b'], ['c', 'd']],
|
1572 |
-
$collection->split(2)->map(function (Collection $chunk) {
|
1573 |
-
return $chunk->values()->toArray();
|
1574 |
-
})->toArray()
|
1575 |
-
);
|
1576 |
-
}
|
1577 |
-
|
1578 |
-
public function testSplitCollectionWithAnUndivisableCount()
|
1579 |
-
{
|
1580 |
-
$collection = new Collection(['a', 'b', 'c']);
|
1581 |
-
|
1582 |
-
$this->assertEquals(
|
1583 |
-
[['a', 'b'], ['c']],
|
1584 |
-
$collection->split(2)->map(function (Collection $chunk) {
|
1585 |
-
return $chunk->values()->toArray();
|
1586 |
-
})->toArray()
|
1587 |
-
);
|
1588 |
-
}
|
1589 |
-
|
1590 |
-
public function testSplitCollectionWithCountLessThenDivisor()
|
1591 |
-
{
|
1592 |
-
$collection = new Collection(['a']);
|
1593 |
-
|
1594 |
-
$this->assertEquals(
|
1595 |
-
[['a']],
|
1596 |
-
$collection->split(2)->map(function (Collection $chunk) {
|
1597 |
-
return $chunk->values()->toArray();
|
1598 |
-
})->toArray()
|
1599 |
-
);
|
1600 |
-
}
|
1601 |
-
|
1602 |
-
public function testSplitEmptyCollection()
|
1603 |
-
{
|
1604 |
-
$collection = new Collection();
|
1605 |
-
|
1606 |
-
$this->assertEquals(
|
1607 |
-
[],
|
1608 |
-
$collection->split(2)->map(function (Collection $chunk) {
|
1609 |
-
return $chunk->values()->toArray();
|
1610 |
-
})->toArray()
|
1611 |
-
);
|
1612 |
-
}
|
1613 |
-
|
1614 |
-
public function testPrioritize() {
|
1615 |
-
$collection = new Collection( [ 1, 2, 3, 4, 5 ] );
|
1616 |
-
|
1617 |
-
$filter = function( $item ) { return $item > 3; };
|
1618 |
-
|
1619 |
-
$this->assertEquals(
|
1620 |
-
[ 4, 5, 1, 2, 3 ],
|
1621 |
-
$collection->prioritize( $filter )->toArray()
|
1622 |
-
);
|
1623 |
-
|
1624 |
-
$collection = new Collection( [ 'first', 'second', 'third' ] );
|
1625 |
-
|
1626 |
-
$filter = function( $item ) { return $item === 'second'; };
|
1627 |
-
|
1628 |
-
$this->assertEquals(
|
1629 |
-
[ 'second', 'first', 'third' ],
|
1630 |
-
$collection->prioritize( $filter )->toArray()
|
1631 |
-
);
|
1632 |
-
}
|
1633 |
-
|
1634 |
-
public function testAssocToPair() {
|
1635 |
-
$collection = new Collection ( [ 'name' => 'wpml', 'type' => 'plugin' ] );
|
1636 |
-
|
1637 |
-
$this->assertEquals(
|
1638 |
-
[ [ 'name', 'wpml' ], [ 'type', 'plugin' ] ],
|
1639 |
-
$collection->assocToPair()->toArray()
|
1640 |
-
);
|
1641 |
-
}
|
1642 |
-
|
1643 |
-
public function testPairToAssoc() {
|
1644 |
-
$collection = new Collection ( [ [ 'name', 'wpml' ], [ 'type', 'plugin' ] ] );
|
1645 |
-
|
1646 |
-
$this->assertEquals(
|
1647 |
-
[ 'name' => 'wpml', 'type' => 'plugin' ],
|
1648 |
-
$collection->pairToAssoc()->toArray()
|
1649 |
-
);
|
1650 |
-
}
|
1651 |
-
|
1652 |
-
public function testEachWithTimeout() {
|
1653 |
-
$timeout = 10;
|
1654 |
-
|
1655 |
-
$c = new Collection( $original = [ 1, 2, 'bar', 'baz' ] );
|
1656 |
-
|
1657 |
-
$result = [];
|
1658 |
-
$unProcessed = $c->eachWithTimeout( function ( $item ) use ( &$result ) {
|
1659 |
-
$result[] = $item;
|
1660 |
-
}, $timeout );
|
1661 |
-
$this->assertEquals( $original, $result );
|
1662 |
-
$this->assertTrue( $unProcessed->isEmpty() );
|
1663 |
-
|
1664 |
-
$timeout = - 1; // force a timeout
|
1665 |
-
$result = [];
|
1666 |
-
$unProcessed = $c->eachWithTimeout( function ( $item ) use ( &$result ) {
|
1667 |
-
$result[] = $item;
|
1668 |
-
}, $timeout );
|
1669 |
-
$this->assertCount( 0, $result );
|
1670 |
-
$this->assertEquals( $original, $unProcessed->toArray() );
|
1671 |
-
}
|
1672 |
-
|
1673 |
-
}
|
1674 |
-
|
1675 |
-
class TestAccessorEloquentTestStub
|
1676 |
-
{
|
1677 |
-
protected $attributes = [];
|
1678 |
-
|
1679 |
-
public function __construct($attributes)
|
1680 |
-
{
|
1681 |
-
$this->attributes = $attributes;
|
1682 |
-
}
|
1683 |
-
|
1684 |
-
public function __get($attribute)
|
1685 |
-
{
|
1686 |
-
$accessor = 'get'.lcfirst($attribute).'Attribute';
|
1687 |
-
if (method_exists($this, $accessor)) {
|
1688 |
-
return $this->$accessor();
|
1689 |
-
}
|
1690 |
-
|
1691 |
-
return $this->$attribute;
|
1692 |
-
}
|
1693 |
-
|
1694 |
-
public function __isset($attribute)
|
1695 |
-
{
|
1696 |
-
$accessor = 'get'.lcfirst($attribute).'Attribute';
|
1697 |
-
|
1698 |
-
if (method_exists($this, $accessor)) {
|
1699 |
-
return ! is_null($this->$accessor());
|
1700 |
-
}
|
1701 |
-
|
1702 |
-
return isset($this->$attribute);
|
1703 |
-
}
|
1704 |
-
|
1705 |
-
public function getSomeAttribute()
|
1706 |
-
{
|
1707 |
-
return $this->attributes['some'];
|
1708 |
-
}
|
1709 |
-
}
|
1710 |
-
|
1711 |
-
class TestArrayAccessImplementation implements ArrayAccess
|
1712 |
-
{
|
1713 |
-
private $arr;
|
1714 |
-
|
1715 |
-
public function __construct($arr)
|
1716 |
-
{
|
1717 |
-
$this->arr = $arr;
|
1718 |
-
}
|
1719 |
-
|
1720 |
-
public function offsetExists($offset)
|
1721 |
-
{
|
1722 |
-
return isset($this->arr[$offset]);
|
1723 |
-
}
|
1724 |
-
|
1725 |
-
public function offsetGet($offset)
|
1726 |
-
{
|
1727 |
-
return $this->arr[$offset];
|
1728 |
-
}
|
1729 |
-
|
1730 |
-
public function offsetSet($offset, $value)
|
1731 |
-
{
|
1732 |
-
$this->arr[$offset] = $value;
|
1733 |
-
}
|
1734 |
-
|
1735 |
-
public function offsetUnset($offset)
|
1736 |
-
{
|
1737 |
-
unset($this->arr[$offset]);
|
1738 |
-
}
|
1739 |
-
}
|
1740 |
-
|
1741 |
-
class TestArrayableObject implements Arrayable
|
1742 |
-
{
|
1743 |
-
public function toArray()
|
1744 |
-
{
|
1745 |
-
return ['foo' => 'bar'];
|
1746 |
-
}
|
1747 |
-
}
|
1748 |
-
|
1749 |
-
class TestJsonableObject implements Jsonable
|
1750 |
-
{
|
1751 |
-
public function toJson($options = 0)
|
1752 |
-
{
|
1753 |
-
return '{"foo":"bar"}';
|
1754 |
-
}
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
class TestJsonSerializeObject implements JsonSerializable
|
1758 |
-
{
|
1759 |
-
public function jsonSerialize()
|
1760 |
-
{
|
1761 |
-
return ['foo' => 'bar'];
|
1762 |
-
}
|
1763 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/vendor/wpml/collect/tests/bootstrap.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require __DIR__.'/../vendor/autoload.php';
|
4 |
-
|
5 |
-
date_default_timezone_set('UTC');
|
|
|
|
|
|
|
|
|
|
addons/vendor/wpml/core-api
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 369cfd53dba15e4dceb55e0e0458c16a5a142eab
|
|
addons/vendor/wpml/fp
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 5f233620422988ca47f3180d2fc1c2aa18191bee
|
|
addons/vendor/wpml/wp
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit dc2fbeb965133f5e569f51009b919a585a5fc1a9
|
|
addons/vendor/wpml/wpml-dependencies
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit bd11271851a380365a6d97c5920c4cd089a07427
|
|
addons/wpml-dependencies/lib/classes/ISitePress.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
interface ISitePress {}
|
addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-filter-loader.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPML_Action_Filter_Loader class file
|
4 |
+
*
|
5 |
+
* @package WPML\Core
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class WPML_Action_Filter_Loader
|
10 |
+
*/
|
11 |
+
class WPML_Action_Filter_Loader {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Deferred actions
|
15 |
+
*
|
16 |
+
* @var array $defered_actions
|
17 |
+
*/
|
18 |
+
private $defered_actions = array();
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Ajax action validation
|
22 |
+
*
|
23 |
+
* @var WPML_AJAX_Action_Validation $ajax_action_validation
|
24 |
+
*/
|
25 |
+
private $ajax_action_validation;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Load action filter
|
29 |
+
*
|
30 |
+
* @param string[] $loaders Action loaders.
|
31 |
+
*/
|
32 |
+
public function load( $loaders ) {
|
33 |
+
|
34 |
+
foreach ( $loaders as $loader ) {
|
35 |
+
$loader_type = new WPML\Action\Type( $loader );
|
36 |
+
|
37 |
+
$backend = $loader_type->is( 'backend' );
|
38 |
+
$frontend = $loader_type->is( 'frontend' );
|
39 |
+
$ajax = $loader_type->is( 'ajax' );
|
40 |
+
$rest = $loader_type->is( 'rest' );
|
41 |
+
$cli = $loader_type->is( 'cli' );
|
42 |
+
$dic = $loader_type->is( 'dic' );
|
43 |
+
|
44 |
+
if ( $backend && $frontend ) {
|
45 |
+
$this->load_factory_or_action( $loader, $dic );
|
46 |
+
} elseif ( $backend && is_admin() ) {
|
47 |
+
$this->load_factory_or_action( $loader, $dic );
|
48 |
+
} elseif ( $frontend && ! is_admin() ) {
|
49 |
+
$this->load_factory_or_action( $loader, $dic );
|
50 |
+
} elseif ( $ajax && wpml_is_ajax() ) {
|
51 |
+
$this->load_factory_or_action( $loader, $dic );
|
52 |
+
} elseif ( $rest ) {
|
53 |
+
$this->load_factory_or_action( $loader, $dic );
|
54 |
+
} elseif ( $cli && wpml_is_cli() ) {
|
55 |
+
$this->load_factory_or_action( $loader, $dic );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Load factory
|
62 |
+
*
|
63 |
+
* @param string $loader Action loader.
|
64 |
+
* @param bool $use_dic
|
65 |
+
*/
|
66 |
+
private function load_factory_or_action( $loader, $use_dic ) {
|
67 |
+
if ( $use_dic ) {
|
68 |
+
$action_or_factory = WPML\Container\make( $loader );
|
69 |
+
} else {
|
70 |
+
$action_or_factory = new $loader();
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( $action_or_factory instanceof IWPML_Action ) {
|
74 |
+
$action_or_factory->add_hooks();
|
75 |
+
} else {
|
76 |
+
$this->load_factory( $action_or_factory );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @param IWPML_Action_Loader_Factory $factory
|
82 |
+
*/
|
83 |
+
private function load_factory( IWPML_Action_Loader_Factory $factory ) {
|
84 |
+
if ( $factory instanceof WPML_AJAX_Base_Factory ) {
|
85 |
+
/** @var WPML_AJAX_Base_Factory $factory */
|
86 |
+
$factory->set_ajax_action_validation( $this->get_ajax_action_validation() );
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( $factory instanceof IWPML_Deferred_Action_Loader ) {
|
90 |
+
$this->add_deferred_action( $factory );
|
91 |
+
} else {
|
92 |
+
$this->run_factory( $factory );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Add deferred action
|
98 |
+
*
|
99 |
+
* @param IWPML_Deferred_Action_Loader $factory Action factory.
|
100 |
+
*/
|
101 |
+
private function add_deferred_action( IWPML_Deferred_Action_Loader $factory ) {
|
102 |
+
$action = $factory->get_load_action();
|
103 |
+
if ( ! isset( $this->defered_actions[ $action ] ) ) {
|
104 |
+
$this->defered_actions[ $action ] = array();
|
105 |
+
add_action( $action, array( $this, 'deferred_loader' ) );
|
106 |
+
}
|
107 |
+
$this->defered_actions[ $action ][] = $factory;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Deferred action loader
|
112 |
+
*/
|
113 |
+
public function deferred_loader() {
|
114 |
+
$action = current_action();
|
115 |
+
foreach ( $this->defered_actions[ $action ] as $factory ) {
|
116 |
+
/**
|
117 |
+
* Deferred action loader factory
|
118 |
+
*
|
119 |
+
* @var IWPML_Deferred_Action_Loader $factory
|
120 |
+
*/
|
121 |
+
$this->run_factory( $factory );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Get ajax action validation
|
127 |
+
*
|
128 |
+
* @return WPML_AJAX_Action_Validation
|
129 |
+
*/
|
130 |
+
private function get_ajax_action_validation() {
|
131 |
+
if ( ! $this->ajax_action_validation ) {
|
132 |
+
$this->ajax_action_validation = new WPML_AJAX_Action_Validation();
|
133 |
+
}
|
134 |
+
|
135 |
+
return $this->ajax_action_validation;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Run factory
|
140 |
+
*
|
141 |
+
* @param IWPML_Action_Loader_Factory $factory Action loader factory.
|
142 |
+
*/
|
143 |
+
private function run_factory( IWPML_Action_Loader_Factory $factory ) {
|
144 |
+
$load_handlers = $factory->create();
|
145 |
+
|
146 |
+
if ( $load_handlers ) {
|
147 |
+
if ( ! is_array( $load_handlers ) || is_callable( $load_handlers ) ) {
|
148 |
+
$load_handlers = array( $load_handlers );
|
149 |
+
}
|
150 |
+
foreach ( $load_handlers as $load_handler ) {
|
151 |
+
if ( is_callable( $load_handler ) ) {
|
152 |
+
$load_handler();
|
153 |
+
} else {
|
154 |
+
$load_handler->add_hooks();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-type.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Action;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Type
|
7 |
+
*
|
8 |
+
* @package WPML\Action
|
9 |
+
*
|
10 |
+
* Determines the type of action that a class implements. Can be
|
11 |
+
* one or more of:
|
12 |
+
* backend, frontend, ajax, rest, cli or dic
|
13 |
+
*
|
14 |
+
* dic means that the class can be loaded via Dependency Injection Container
|
15 |
+
*/
|
16 |
+
|
17 |
+
class Type {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
21 |
+
*/
|
22 |
+
private $backend_actions = [ 'IWPML_Backend_Action_Loader', 'IWPML_Backend_Action' ];
|
23 |
+
/**
|
24 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
25 |
+
*/
|
26 |
+
private $frontend_actions = [ 'IWPML_Frontend_Action_Loader', 'IWPML_Frontend_Action' ];
|
27 |
+
/**
|
28 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
29 |
+
*/
|
30 |
+
private $ajax_actions = [ 'IWPML_AJAX_Action_Loader', 'IWPML_AJAX_Action' ];
|
31 |
+
/**
|
32 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
33 |
+
*/
|
34 |
+
private $rest_actions = [ 'IWPML_REST_Action_Loader', 'IWPML_REST_Action' ];
|
35 |
+
/**
|
36 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
37 |
+
*/
|
38 |
+
private $cli_actions = [ 'IWPML_CLI_Action_Loader', 'IWPML_CLI_Action' ];
|
39 |
+
/**
|
40 |
+
* @var string[] Resolved by \WPML\Action\Type::is
|
41 |
+
*/
|
42 |
+
private $dic_actions = [ 'IWPML_DIC_Action' ];
|
43 |
+
|
44 |
+
/** @var array */
|
45 |
+
private $implementations;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Info constructor.
|
49 |
+
*
|
50 |
+
* @param string $class_name The class name of the action or action loader
|
51 |
+
*/
|
52 |
+
public function __construct( $class_name ) {
|
53 |
+
$this->implementations = class_implements( $class_name );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param string $type The type of action 'backend', 'frontend', 'ajax', 'rest', 'cli' or 'dic'
|
58 |
+
*
|
59 |
+
* @return bool
|
60 |
+
*/
|
61 |
+
public function is( $type ) {
|
62 |
+
$action_type = $type . '_actions';
|
63 |
+
return $this->has_implementation( $this->$action_type );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param array $interfaces
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
private function has_implementation( $interfaces ) {
|
72 |
+
return count( array_intersect( $this->implementations, $interfaces ) ) > 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-base-factory.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class WPML_AJAX_Base_Factory
|
5 |
+
*
|
6 |
+
* @author OnTheGoSystems
|
7 |
+
*/
|
8 |
+
abstract class WPML_AJAX_Base_Factory implements IWPML_AJAX_Action_Loader, IWPML_Deferred_Action_Loader {
|
9 |
+
|
10 |
+
/** @var WPML_AJAX_Action_Validation $ajax_action_check */
|
11 |
+
private $ajax_action_validation;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* This loader must be deferred at least to 'plugins_loaded' to make sure
|
15 |
+
* all the WP functions needed to validate the request are already loaded
|
16 |
+
*
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public function get_load_action() {
|
20 |
+
return 'plugins_loaded';
|
21 |
+
}
|
22 |
+
|
23 |
+
public function is_valid_action( $ajax_action ) {
|
24 |
+
return $this->ajax_action_validation->is_valid( $ajax_action );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param WPML_AJAX_Action_Validation $ajax_action_validation
|
29 |
+
*/
|
30 |
+
public function set_ajax_action_validation( WPML_AJAX_Action_Validation $ajax_action_validation ) {
|
31 |
+
$this->ajax_action_validation = $ajax_action_validation;
|
32 |
+
}
|
33 |
+
}
|
addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-validation.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class WPML_AJAX_Action_Validation
|
5 |
+
*
|
6 |
+
* @author OnTheGoSystems
|
7 |
+
*/
|
8 |
+
class WPML_AJAX_Action_Validation {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $action_name
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function is_valid( $action_name ) {
|
16 |
+
$is_valid = false;
|
17 |
+
|
18 |
+
if ( array_key_exists( 'action', $_POST ) && $action_name === $_POST['action'] ) {
|
19 |
+
|
20 |
+
if ( array_key_exists( 'nonce', $_POST ) && wp_verify_nonce( $_POST['nonce'], $action_name ) ) {
|
21 |
+
$is_valid = true;
|
22 |
+
} else {
|
23 |
+
wp_send_json_error( esc_html__( 'Invalid request!', 'sitepress' ) );
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
return $is_valid;
|
28 |
+
}
|
29 |
+
}
|
addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-current-screen-loader-factory.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class WPML_Current_Screen_Loader_Factory
|
5 |
+
*
|
6 |
+
* @author OnTheGoSystems
|
7 |
+
*/
|
8 |
+
abstract class WPML_Current_Screen_Loader_Factory implements IWPML_Backend_Action_Loader, IWPML_Deferred_Action_Loader {
|
9 |
+
|
10 |
+
/** @return string */
|
11 |
+
public function get_load_action() {
|
12 |
+
return 'current_screen';
|
13 |
+
}
|
14 |
+
|
15 |
+
/** @return string */
|
16 |
+
abstract protected function get_screen_regex();
|
17 |
+
|
18 |
+
/** @return null|IWPML_Action */
|
19 |
+
abstract protected function create_hooks();
|
20 |
+
|
21 |
+
/** @return null|IWPML_Action */
|
22 |
+
public function create() {
|
23 |
+
if ( $this->is_on_matching_screen() ) {
|
24 |
+
return $this->create_hooks();
|
25 |
+
}
|
26 |
+
|
27 |
+
return null;
|
28 |
+
}
|
29 |
+
|
30 |
+
/** return bool */
|
31 |
+
private function is_on_matching_screen() {
|
32 |
+
$current_screen = get_current_screen();
|
33 |
+
|
34 |
+
foreach ( array( 'id', 'base' ) as $property ) {
|
35 |
+
if ( isset( $current_screen->{$property} )
|
36 |
+
&& preg_match( $this->get_screen_regex(), $current_screen->{$property} )
|
37 |
+
) {
|
38 |
+
return true;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
}
|
addons/wpml-dependencies/lib/classes/block-editor/class-wpml-block-editor-helper.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class WPML_Block_Editor_Helper
|
5 |
+
*/
|
6 |
+
class WPML_Block_Editor_Helper {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Check if Block Editor is active.
|
10 |
+
* Must only be used after plugins_loaded action is fired.
|
11 |
+
*
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
public static function is_active() {
|
15 |
+
// Gutenberg plugin is installed and activated.
|
16 |
+
$gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
|
17 |
+
|
18 |
+
// Block editor since 5.0.
|
19 |
+
$block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
|
20 |
+
|
21 |
+
if ( ! $gutenberg && ! $block_editor ) {
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( self::is_classic_editor_plugin_active() ) {
|
26 |
+
$editor_option = get_option( 'classic-editor-replace' );
|
27 |
+
$block_editor_active = array( 'no-replace', 'block' );
|
28 |
+
|
29 |
+
return in_array( $editor_option, $block_editor_active, true );
|
30 |
+
}
|
31 |
+
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Check if it is admin page to edit any type of post with Block Editor.
|
37 |
+
* Must be used not earlier than plugins_loaded action fired.
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public static function is_edit_post() {
|
42 |
+
$current_screen = get_current_screen();
|
43 |
+
return $current_screen && 'post' === $current_screen->base && self::is_active() && self::is_block_editor( $current_screen );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Check if Classic Editor plugin is active.
|
48 |
+
*
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
public static function is_classic_editor_plugin_active() {
|
52 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
53 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
|
57 |
+
return true;
|
58 |
+
}
|
59 |
+
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
public static function is_block_editor( $current_screen ) {
|
64 |
+
if ( version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ) ) {
|
65 |
+
return $current_screen->is_block_editor();
|
66 |
+
} else {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
addons/wpml-dependencies/lib/classes/class-wpml-file.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPML_File class file.
|
4 |
+
*
|
5 |
+
* @package wpml-core
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class WPML_File
|
10 |
+
*/
|
11 |
+
class WPML_File {
|
12 |
+
/**
|
13 |
+
* WPML WP API instance.
|
14 |
+
*
|
15 |
+
* @var WPML_WP_API $wp_api
|
16 |
+
*/
|
17 |
+
private $wp_api;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* WP_Filesystem_Direct instance.
|
21 |
+
*
|
22 |
+
* @var WP_Filesystem_Direct
|
23 |
+
*/
|
24 |
+
private $filesystem;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* WPML_File constructor.
|
28 |
+
*
|
29 |
+
* @param WPML_WP_API|null $wp_api WPML WP API instance.
|
30 |
+
* @param WP_Filesystem_Direct|null $filesystem WP_Filesystem_Direct instance.
|
31 |
+
*/
|
32 |
+
public function __construct( WPML_WP_API $wp_api = null, WP_Filesystem_Direct $filesystem = null ) {
|
33 |
+
if ( ! $wp_api ) {
|
34 |
+
$wp_api = new WPML_WP_API();
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->wp_api = $wp_api;
|
38 |
+
|
39 |
+
if ( ! $filesystem ) {
|
40 |
+
$filesystem = new WP_Filesystem_Direct( null );
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->filesystem = $filesystem;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Fix directory separator if backslash is used.
|
48 |
+
*
|
49 |
+
* @param string $path Path to fix.
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function fix_dir_separator( $path ) {
|
54 |
+
$directory_separator = $this->wp_api->constant( 'DIRECTORY_SEPARATOR' );
|
55 |
+
|
56 |
+
return ( '\\' === $directory_separator ) ? str_replace( '/', '\\', $path ) : str_replace( '\\', '/', $path );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get uri from file path.
|
61 |
+
*
|
62 |
+
* @param string $path File path.
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function get_uri_from_path( $path ) {
|
67 |
+
$base = null;
|
68 |
+
|
69 |
+
if ( $this->wp_api->defined( 'WP_CONTENT_DIR' ) && $this->wp_api->defined( 'WP_CONTENT_URL' ) ) {
|
70 |
+
$base_path = $this->fix_dir_separator( $this->wp_api->constant( 'WP_CONTENT_DIR' ) );
|
71 |
+
|
72 |
+
if ( 0 === strpos( $path, $base_path ) ) {
|
73 |
+
$base = array(
|
74 |
+
'path' => $base_path,
|
75 |
+
'uri' => $this->wp_api->constant( 'WP_CONTENT_URL' ),
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( ! $base ) {
|
81 |
+
$base = array(
|
82 |
+
'path' => $this->wp_api->constant( 'ABSPATH' ),
|
83 |
+
'uri' => site_url(),
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
$base['uri'] = preg_replace( '/(^https?:)/', '', $base['uri'] );
|
88 |
+
$relative_path = substr( $path, strlen( $base['path'] ) );
|
89 |
+
$relative_path = str_replace( array( '/', '\\' ), '/', $relative_path );
|
90 |
+
$relative_path = ltrim( $relative_path, '/' );
|
91 |
+
|
92 |
+
return trailingslashit( $base['uri'] ) . $relative_path;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get path relative to ABSPATH.
|
97 |
+
*
|
98 |
+
* @param string $path File path.
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function get_relative_path( $path ) {
|
103 |
+
return str_replace( $this->fix_dir_separator( ABSPATH ), '', $this->fix_dir_separator( $path ) );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get full file path.
|
108 |
+
*
|
109 |
+
* @param string $path File path.
|
110 |
+
*
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
public function get_full_path( $path ) {
|
114 |
+
return ABSPATH . $this->get_relative_path( $path );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Check if file exists.
|
119 |
+
*
|
120 |
+
* @param string $path File path.
|
121 |
+
*
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
public function file_exists( $path ) {
|
125 |
+
return $this->filesystem->is_readable( $this->get_full_path( $path ) );
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get file modification time.
|
130 |
+
*
|
131 |
+
* @param string $path File path.
|
132 |
+
*
|
133 |
+
* @return int
|
134 |
+
*/
|
135 |
+
public function get_file_modified_timestamp( $path ) {
|
136 |
+
return $this->filesystem->mtime( $this->get_full_path( $path ) );
|
137 |
+
}
|
138 |
+
}
|
addons/wpml-dependencies/lib/classes/container/class-config.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Container;
|
4 |
+
|
5 |
+
class Config {
|
6 |
+
|
7 |
+
public static function getSharedInstances() {
|
8 |
+
global $wpdb;
|
9 |
+
|
10 |
+
return [
|
11 |
+
$wpdb,
|
12 |
+
];
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function getSharedClasses() {
|
16 |
+
return [
|
17 |
+
'\SitePress',
|
18 |
+
'\WPML\WP\OptionManager',
|
19 |
+
'\WP_Http',
|
20 |
+
'\WPML_WP_User_Query_Factory',
|
21 |
+
'\WPML_WP_User_Factory',
|
22 |
+
'\WPML_Notices',
|
23 |
+
\WPML_Locale::class,
|
24 |
+
\WPML_URL_Filters::class,
|
25 |
+
];
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function getAliases() {
|
29 |
+
global $wpdb;
|
30 |
+
|
31 |
+
$aliases = [];
|
32 |
+
|
33 |
+
$wpdb_class = get_class( $wpdb );
|
34 |
+
|
35 |
+
if ( 'wpdb' !== $wpdb_class ) {
|
36 |
+
$aliases['wpdb'] = $wpdb_class;
|
37 |
+
}
|
38 |
+
|
39 |
+
return $aliases;
|
40 |
+
}
|
41 |
+
|
42 |
+
public static function getDelegated() {
|
43 |
+
return [
|
44 |
+
'\WPML_Notices' => 'wpml_get_admin_notices',
|
45 |
+
\WPML_REST_Request_Analyze::class => [ \WPML_REST_Request_Analyze_Factory::class, 'create' ],
|
46 |
+
\WP_Filesystem_Direct::class => 'wpml_get_filesystem_direct',
|
47 |
+
\WPML_Locale::class => [ \WPML_Locale::class, 'get_instance_from_sitepress' ],
|
48 |
+
\WPML_Post_Translation::class => [ \WPML_Post_Translation::class, 'getGlobalInstance' ],
|
49 |
+
\WPML_Term_Translation::class => [ \WPML_Term_Translation::class, 'getGlobalInstance' ],
|
50 |
+
\WPML_URL_Converter::class => [ \WPML_URL_Converter::class, 'getGlobalInstance' ],
|
51 |
+
\WPML_Post_Status::class => 'wpml_get_post_status_helper',
|
52 |
+
'\WPML_Language_Resolution' => function () {
|
53 |
+
global $wpml_language_resolution;
|
54 |
+
|
55 |
+
return $wpml_language_resolution;
|
56 |
+
},
|
57 |
+
\TranslationManagement::class => 'wpml_load_core_tm',
|
58 |
+
];
|
59 |
+
}
|
60 |
+
}
|
addons/wpml-dependencies/lib/classes/container/class-wpml-container.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Container;
|
4 |
+
|
5 |
+
use WPML\Auryn\Injector as AurynInjector;
|
6 |
+
|
7 |
+
class Container {
|
8 |
+
|
9 |
+
/** @var Container $instance */
|
10 |
+
private static $instance = null;
|
11 |
+
|
12 |
+
/** @var AurynInjector|null */
|
13 |
+
private $injector = null;
|
14 |
+
|
15 |
+
private function __construct() {
|
16 |
+
$this->injector = new AurynInjector();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return Container
|
21 |
+
*/
|
22 |
+
public static function get_instance() {
|
23 |
+
if ( ! self::$instance ) {
|
24 |
+
self::$instance = new Container();
|
25 |
+
}
|
26 |
+
|
27 |
+
return self::$instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* class names or instances that should be shared.
|
32 |
+
* Shared means that only one instance is ever created when calling the make function.
|
33 |
+
*
|
34 |
+
* @param array $names_or_instances
|
35 |
+
*
|
36 |
+
* @throws \WPML\Auryn\ConfigException
|
37 |
+
*/
|
38 |
+
public static function share( array $names_or_instances ) {
|
39 |
+
$injector = self::get_instance()->injector;
|
40 |
+
|
41 |
+
wpml_collect( $names_or_instances )->each(
|
42 |
+
function ( $name_or_instance ) use ( $injector ) {
|
43 |
+
$injector->share( $name_or_instance );
|
44 |
+
}
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* This allows to define aliases classes to be used in place of type hints.
|
50 |
+
* e.g. [
|
51 |
+
* // generic => specific
|
52 |
+
* 'wpdb' => 'QM_DB',
|
53 |
+
* ]
|
54 |
+
*
|
55 |
+
* @param array $aliases
|
56 |
+
*
|
57 |
+
* @throws \WPML\Auryn\ConfigException
|
58 |
+
*/
|
59 |
+
public static function alias( array $aliases ) {
|
60 |
+
$injector = self::get_instance()->injector;
|
61 |
+
|
62 |
+
wpml_collect( $aliases )->each(
|
63 |
+
function ( $alias, $original ) use ( $injector ) {
|
64 |
+
$injector->alias( $original, $alias );
|
65 |
+
}
|
66 |
+
);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* This allows to delegate the object instantiation to a factory.
|
71 |
+
* It can be any kind of callable (class or function).
|
72 |
+
*
|
73 |
+
* @param array $delegated [ $class_name => $instantiator ]
|
74 |
+
*
|
75 |
+
* @throws \WPML\Auryn\ConfigException
|
76 |
+
*/
|
77 |
+
public static function delegate( array $delegated ) {
|
78 |
+
$injector = self::get_instance()->injector;
|
79 |
+
|
80 |
+
wpml_collect( $delegated )->each(
|
81 |
+
function ( $instantiator, $class_name ) use ( $injector ) {
|
82 |
+
$injector->delegate( $class_name, $instantiator );
|
83 |
+
}
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Make returns a new instance otherwise returns a shared instance if the
|
89 |
+
* class_name or an instance is set as shared using the share function
|
90 |
+
*
|
91 |
+
* @param string $class_name
|
92 |
+
* @param array $args
|
93 |
+
*
|
94 |
+
* @return mixed
|
95 |
+
* @throws \WPML\Auryn\InjectionException
|
96 |
+
*/
|
97 |
+
public static function make( $class_name, array $args = array() ) {
|
98 |
+
return self::get_instance()->injector->make( $class_name, $args );
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Invoke the specified callable or class::method string, provisioning dependencies along the way
|
103 |
+
*
|
104 |
+
* @param mixed $callableOrMethodStr A valid PHP callable or a provisionable ClassName::methodName string
|
105 |
+
* @param array $args Optional array specifying params with which to invoke the provisioned callable
|
106 |
+
* @throws \WPML\Auryn\InjectionException
|
107 |
+
* @return mixed Returns the invocation result returned from calling the generated executable
|
108 |
+
*/
|
109 |
+
public static function execute( $callableOrMethodStr, array $args = [] ) {
|
110 |
+
return self::get_instance()->injector->execute( $callableOrMethodStr, $args );
|
111 |
+
}
|
112 |
+
}
|
addons/wpml-dependencies/lib/classes/container/functions.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Container;
|
4 |
+
|
5 |
+
use function WPML\FP\curryN;
|
6 |
+
|
7 |
+
if ( ! function_exists( 'WPML\Container\make' ) ) {
|
8 |
+
/**
|
9 |
+
* Curried function
|
10 |
+
*
|
11 |
+
* Make returns a new instance otherwise returns a shared instance if the
|
12 |
+
* class_name or an instance is set as shared using the share function
|
13 |
+
*
|
14 |
+
* @param string $class_name
|
15 |
+
* @param array $args
|
16 |
+
*
|
17 |
+
* @return mixed
|
18 |
+
* @throws \WPML\Auryn\InjectionException
|
19 |
+
*/
|
20 |
+
function make( $class_name = null, array $args = null ) {
|
21 |
+
$make = function ( $class_name, $args = [] ) {
|
22 |
+
if ( class_exists( $class_name ) || interface_exists( $class_name ) ) {
|
23 |
+
return Container::make( $class_name, $args );
|
24 |
+
}
|
25 |
+
|
26 |
+
return null;
|
27 |
+
};
|
28 |
+
|
29 |
+
return call_user_func_array( curryN( 1, $make ), func_get_args() );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( ! function_exists( 'WPML\Container\share' ) ) {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* class names or instances that should be shared.
|
37 |
+
* Shared means that only one instance is ever created when calling the make function.
|
38 |
+
*
|
39 |
+
* @param array $names_or_instances
|
40 |
+
*
|
41 |
+
* @throws \WPML\Auryn\ConfigException
|
42 |
+
*/
|
43 |
+
function share( array $names_or_instances ) {
|
44 |
+
Container::share( $names_or_instances );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( ! function_exists( 'WPML\Container\alias' ) ) {
|
49 |
+
|
50 |
+
/**
|
51 |
+
* This allows to define aliases classes to be used in place of type hints.
|
52 |
+
* e.g. [
|
53 |
+
* // generic => specific
|
54 |
+
* 'wpdb' => 'QM_DB',
|
55 |
+
* ]
|
56 |
+
*
|
57 |
+
* @param array $aliases
|
58 |
+
*
|
59 |
+
* @throws \WPML\Auryn\ConfigException
|
60 |
+
*/
|
61 |
+
function alias( array $aliases ) {
|
62 |
+
Container::alias( $aliases );
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( ! function_exists( 'WPML\Container\delegate' ) ) {
|
67 |
+
|
68 |
+
/**
|
69 |
+
* This allows to delegate the object instantiation to a factory.
|
70 |
+
* It can be any kind of callable (class or function).
|
71 |
+
*
|
72 |
+
* @param array $delegated [ $class_name => $instantiator ]
|
73 |
+
*
|
74 |
+
* @throws \WPML\Auryn\ConfigException
|
75 |
+
*/
|
76 |
+
function delegate( array $delegated ) {
|
77 |
+
Container::delegate( $delegated );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( ! function_exists( 'WPML\Container\execute' ) ) {
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Curried function
|
85 |
+
*
|
86 |
+
* Invoke the specified callable or class::method string, provisioning dependencies along the way
|
87 |
+
*
|
88 |
+
* @param mixed $callableOrMethodStr A valid PHP callable or a provisionable ClassName::methodName string
|
89 |
+
* @param array $args array specifying params with which to invoke the provisioned callable
|
90 |
+
*
|
91 |
+
* @return mixed Returns the invocation result returned from calling the generated executable
|
92 |
+
* @throws \WPML\Auryn\InjectionException
|
93 |
+
*/
|
94 |
+
function execute( $callableOrMethodStr = null, $args = null ) {
|
95 |
+
return call_user_func_array( curryN( 1, [ Container::class, 'execute' ] ), func_get_args() );
|
96 |
+
}
|
97 |
+
}
|
addons/wpml-dependencies/lib/classes/cookie/class-wpml-cookie.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPML_Cookie {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @param string $name
|
7 |
+
* @param string $value
|
8 |
+
* @param int $expires
|
9 |
+
* @param string $path
|
10 |
+
* @param string $domain
|
11 |
+
* @param bool $HTTPOnly
|
12 |
+
* @param string|null $sameSite
|
13 |
+
*/
|
14 |
+
public function set_cookie( $name, $value, $expires, $path, $domain, $HTTPOnly = false, $sameSite = null ) {
|
15 |
+
wp_cache_add_non_persistent_groups( __CLASS__ );
|
16 |
+
|
17 |
+
$entryHash = md5( wp_json_encode( [ $name, $value, $path, $domain, $HTTPOnly, $sameSite ] ) );
|
18 |
+
|
19 |
+
if ( wp_cache_get( $name, __CLASS__ ) !== $entryHash ) {
|
20 |
+
$this->handle_cache_plugins( $name );
|
21 |
+
if ($sameSite) {
|
22 |
+
header(
|
23 |
+
'Set-Cookie: ' . rawurlencode( $name ) . '=' . rawurlencode( $value )
|
24 |
+
. ( $domain ? '; Domain=' . $domain : '' )
|
25 |
+
. ( $expires ? '; expires=' . gmdate( 'D, d-M-Y H:i:s', $expires ) . ' GMT' : '' )
|
26 |
+
. ( $path ? '; Path=' . $path : '' )
|
27 |
+
. ( $this->is_secure_connection() ? '; Secure' : '')
|
28 |
+
. ( $HTTPOnly ? '; HttpOnly' : '' )
|
29 |
+
. '; SameSite=' . $sameSite,
|
30 |
+
false
|
31 |
+
);
|
32 |
+
} else {
|
33 |
+
setcookie( $name, $value, $expires, $path, $domain, $this->is_secure_connection(), $HTTPOnly );
|
34 |
+
}
|
35 |
+
|
36 |
+
wp_cache_set( $name, $entryHash, __CLASS__ );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @param string $name
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function get_cookie( $name ) {
|
46 |
+
if ( isset( $_COOKIE[ $name ] ) ) {
|
47 |
+
return $_COOKIE[ $name ];
|
48 |
+
}
|
49 |
+
return '';
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* simple wrapper for \headers_sent
|
54 |
+
*
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function headers_sent() {
|
58 |
+
return headers_sent();
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param string $name
|
63 |
+
*/
|
64 |
+
private function handle_cache_plugins( $name ) {
|
65 |
+
// @todo uncomment or delete when #wpmlcore-5796 is resolved
|
66 |
+
// do_action( 'wpsc_add_cookie', $name );
|
67 |
+
}
|
68 |
+
|
69 |
+
private function is_secure_connection() {
|
70 |
+
if (
|
71 |
+
\WPML\FP\Obj::prop( 'HTTPS', $_SERVER ) === 'on' ||
|
72 |
+
\WPML\FP\Obj::prop( 'HTTP_X_FORWARDED_PROTO', $_SERVER ) === 'https' ||
|
73 |
+
\WPML\FP\Obj::prop( 'HTTP_X_FORWARDED_SSL', $_SERVER ) === 'on'
|
74 |
+
) {
|
75 |
+
return true;
|
76 |
+
}
|
77 |
+
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
}
|
addons/wpml-dependencies/lib/classes/languages/interface-iwpml-current-language.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface IWPML_Current_Language {
|
4 |
+
public function get_current_language();
|
5 |
+
public function get_default_language();
|
6 |
+
public function get_admin_language();
|
7 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/DismissNotices.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Notices;
|
4 |
+
|
5 |
+
class DismissNotices implements \IWPML_Backend_Action {
|
6 |
+
|
7 |
+
const OPTION = 'wpml_dismiss_notice';
|
8 |
+
const CSS_CLASS = 'wpml_dismiss_notice';
|
9 |
+
|
10 |
+
public function add_hooks() {
|
11 |
+
add_action( 'wp_ajax_wpml_dismiss_notice', [ $this, 'toggleDismiss' ] );
|
12 |
+
|
13 |
+
add_action(
|
14 |
+
'admin_enqueue_scripts',
|
15 |
+
function () {
|
16 |
+
wp_enqueue_script(
|
17 |
+
'wpml-dismiss-notice',
|
18 |
+
WCML_WPML_DEPENDENCY_URL . '/dist/js/notices/app.js',
|
19 |
+
[],
|
20 |
+
'4.5.0'
|
21 |
+
);
|
22 |
+
}
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function toggleDismiss() {
|
27 |
+
$postData = wpml_collect( $_POST );
|
28 |
+
$id = $postData->get( 'id', null );
|
29 |
+
if ( ! $id ) {
|
30 |
+
return wp_send_json_error( 'ID of notice is not defined' );
|
31 |
+
}
|
32 |
+
|
33 |
+
$options = get_option( self::OPTION, [] );
|
34 |
+
$options[ $id ] = $postData->get( 'dismiss', false ) === 'true';
|
35 |
+
|
36 |
+
update_option( self::OPTION, $options );
|
37 |
+
|
38 |
+
return wp_send_json_success();
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param int $id
|
44 |
+
*
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public function isDismissed( $id ) {
|
48 |
+
return wpml_collect( get_option( self::OPTION, [] ) )->get( $id, false );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param int $id
|
53 |
+
*
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
public function renderCheckbox( $id ) {
|
57 |
+
return sprintf(
|
58 |
+
'<input type="checkbox" class="%s" data-id="%s" />',
|
59 |
+
self::CSS_CLASS,
|
60 |
+
$id
|
61 |
+
);
|
62 |
+
}
|
63 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-action.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Notice_Action {
|
7 |
+
private $dismiss;
|
8 |
+
private $display_as_button;
|
9 |
+
private $hide;
|
10 |
+
private $text;
|
11 |
+
private $url;
|
12 |
+
private $group_to_dismiss;
|
13 |
+
private $js_callback;
|
14 |
+
private $dismiss_different_text;
|
15 |
+
private $link_target;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* WPML_Admin_Notice_Action constructor.
|
19 |
+
*
|
20 |
+
* @param string $text
|
21 |
+
* @param string $url
|
22 |
+
* @param bool $dismiss
|
23 |
+
* @param bool $hide
|
24 |
+
* @param bool|string $display_as_button
|
25 |
+
* @param bool $dismiss_different_text
|
26 |
+
*/
|
27 |
+
public function __construct( $text, $url = '#', $dismiss = false, $hide = false, $display_as_button = false, $dismiss_different_text = true ) {
|
28 |
+
$this->text = $text;
|
29 |
+
$this->url = $url;
|
30 |
+
$this->dismiss = $dismiss;
|
31 |
+
$this->hide = $hide;
|
32 |
+
$this->display_as_button = $display_as_button;
|
33 |
+
$this->dismiss_different_text = $dismiss_different_text;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function get_text() {
|
37 |
+
return $this->text;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function get_url() {
|
41 |
+
return $this->url;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function can_dismiss() {
|
45 |
+
return $this->dismiss;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function can_dismiss_different_text() {
|
49 |
+
return $this->dismiss_different_text;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function can_hide() {
|
53 |
+
return $this->hide;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function must_display_as_button() {
|
57 |
+
return $this->display_as_button;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function set_group_to_dismiss( $group_name ) {
|
61 |
+
$this->group_to_dismiss = $group_name;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function get_group_to_dismiss() {
|
65 |
+
return $this->group_to_dismiss;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function set_js_callback( $js_callback ) {
|
69 |
+
$this->js_callback = $js_callback;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function get_js_callback() {
|
73 |
+
return $this->js_callback;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @return mixed
|
78 |
+
*/
|
79 |
+
public function get_link_target() {
|
80 |
+
return $this->link_target;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @param mixed $link_target
|
85 |
+
*/
|
86 |
+
public function set_link_target( $link_target ) {
|
87 |
+
$this->link_target = $link_target;
|
88 |
+
}
|
89 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-render.php
ADDED
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Notice_Render {
|
7 |
+
private $dismiss_html_added;
|
8 |
+
private $hide_html_added;
|
9 |
+
private $collapse_html_added;
|
10 |
+
|
11 |
+
public function render( WPML_Notice $notice ) {
|
12 |
+
echo $this->get_html( $notice );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param WPML_Notice $notice
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function get_html( WPML_Notice $notice ) {
|
21 |
+
$result = '';
|
22 |
+
|
23 |
+
if ( $this->must_display_notice( $notice ) ) {
|
24 |
+
if ( $notice->should_be_text_only() ) {
|
25 |
+
return $notice->get_text();
|
26 |
+
}
|
27 |
+
|
28 |
+
$actions_html = $this->get_actions_html( $notice );
|
29 |
+
|
30 |
+
$temp_types = $notice->get_css_class_types();
|
31 |
+
foreach ( $temp_types as $temp_type ) {
|
32 |
+
if ( strpos( $temp_type, 'notice-' ) === false ) {
|
33 |
+
$temp_types[] = 'notice-' . $temp_type;
|
34 |
+
}
|
35 |
+
if ( strpos( $temp_type, 'notice-' ) === 0 ) {
|
36 |
+
$temp_types[] = substr( $temp_type, 0, strlen( 'notice-' ) );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
$temp_classes = $notice->get_css_classes();
|
40 |
+
|
41 |
+
$classes = array_merge( $temp_classes, $temp_types );
|
42 |
+
|
43 |
+
if ( $this->hide_html_added || $this->dismiss_html_added || $notice->can_be_hidden() || $notice->can_be_dismissed() ) {
|
44 |
+
$classes[] = 'is-dismissible';
|
45 |
+
}
|
46 |
+
$classes[] = 'notice';
|
47 |
+
$classes[] = 'otgs-notice';
|
48 |
+
|
49 |
+
$classes = array_unique( $classes );
|
50 |
+
|
51 |
+
$class = implode( ' ', $classes );
|
52 |
+
|
53 |
+
$result .= '<div class="' . $class . '" data-id="' . esc_attr( $notice->get_id() ) . '" data-group="' . esc_attr( $notice->get_group() ) . '"';
|
54 |
+
$result .= $this->get_data_nonce_attribute();
|
55 |
+
|
56 |
+
if ( $this->hide_html_added || $notice->can_be_hidden() ) {
|
57 |
+
$result .= ' data-hide-text="' . __( 'Hide', 'sitepress' ) . '" ';
|
58 |
+
}
|
59 |
+
$result .= '>';
|
60 |
+
|
61 |
+
if ( $notice->can_be_collapsed() ) {
|
62 |
+
$result .= $this->sanitize_and_format_text( $this->get_collapsed_html( $notice ) );
|
63 |
+
} else {
|
64 |
+
$result .= '<p>' . $this->sanitize_and_format_text( $notice->get_text() ) . '</p>';
|
65 |
+
}
|
66 |
+
|
67 |
+
$this->dismiss_html_added = false;
|
68 |
+
$this->hide_html_added = false;
|
69 |
+
$this->collapse_html_added = false;
|
70 |
+
|
71 |
+
$result .= $actions_html;
|
72 |
+
|
73 |
+
if ( $notice->can_be_hidden() ) {
|
74 |
+
$result .= $this->get_hide_html();
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( $notice->can_be_dismissed() ) {
|
78 |
+
$result .= $this->get_dismiss_html();
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( $notice->can_be_collapsed() ) {
|
82 |
+
$result .= $this->get_collapse_html();
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( $notice->get_nonce_action() ) {
|
86 |
+
$result .= $this->add_nonce( $notice );
|
87 |
+
}
|
88 |
+
|
89 |
+
$result .= '</div>';
|
90 |
+
}
|
91 |
+
|
92 |
+
return $result;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param WPML_Notice $notice
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
private function add_nonce( $notice ) {
|
101 |
+
return wp_nonce_field( $notice->get_nonce_action(), $notice->get_nonce_action(), true, false );
|
102 |
+
}
|
103 |
+
|
104 |
+
public function must_display_notice( WPML_Notice $notice ) {
|
105 |
+
if ( ! $notice->is_for_current_user() || ! $notice->is_user_cap_allowed() ) {
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $this->is_current_page_allowed( $notice ) && $this->is_allowed_by_callback( $notice );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param WPML_Notice $notice
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
private function get_actions_html( WPML_Notice $notice ) {
|
118 |
+
$actions_html = '';
|
119 |
+
if ( $notice->get_actions() ) {
|
120 |
+
$actions_html .= '<div class="otgs-notice-actions">';
|
121 |
+
foreach ( $notice->get_actions() as $action ) {
|
122 |
+
$actions_html .= $this->get_action_html( $action );
|
123 |
+
}
|
124 |
+
|
125 |
+
$actions_html .= '</div>';
|
126 |
+
|
127 |
+
return $actions_html;
|
128 |
+
}
|
129 |
+
|
130 |
+
return $actions_html;
|
131 |
+
}
|
132 |
+
|
133 |
+
private function sanitize_and_format_text( $text ) {
|
134 |
+
$backticks_pattern = '|`(.*)`|U';
|
135 |
+
preg_match_all( $backticks_pattern, $text, $matches );
|
136 |
+
|
137 |
+
$sanitized_notice = $text;
|
138 |
+
if ( 2 === count( $matches ) ) {
|
139 |
+
/** @var array<string> $matches_to_sanitize */
|
140 |
+
$matches_to_sanitize = $matches[1];
|
141 |
+
|
142 |
+
foreach ( $matches_to_sanitize as &$match_to_sanitize ) {
|
143 |
+
$match_to_sanitize = '<pre>' . esc_html( $match_to_sanitize ) . '</pre>';
|
144 |
+
}
|
145 |
+
unset( $match_to_sanitize );
|
146 |
+
|
147 |
+
$sanitized_notice = str_replace( $matches[0], $matches_to_sanitize, $sanitized_notice );
|
148 |
+
}
|
149 |
+
|
150 |
+
return stripslashes( $sanitized_notice );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @param null|string $localized_text
|
155 |
+
*
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
+
private function get_hide_html( $localized_text = null ) {
|
159 |
+
$hide_html = '';
|
160 |
+
$hide_html .= '<span class="otgs-notice-hide notice-hide"><span class="screen-reader-text">';
|
161 |
+
if ( $localized_text ) {
|
162 |
+
$hide_html .= esc_html( $localized_text );
|
163 |
+
} else {
|
164 |
+
$hide_html .= esc_html__( 'Hide this notice.', 'sitepress' );
|
165 |
+
}
|
166 |
+
$hide_html .= '</span></span>';
|
167 |
+
|
168 |
+
return $hide_html;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @param null|string $localized_text
|
173 |
+
*
|
174 |
+
* @return string
|
175 |
+
*/
|
176 |
+
private function get_dismiss_html( $localized_text = null ) {
|
177 |
+
$dismiss_html = '';
|
178 |
+
$dismiss_html .= '<span class="otgs-notice-dismiss notice-dismiss">';
|
179 |
+
$dismiss_html .= '<span class="screen-reader-text"><input class="otgs-notice-dismiss-check" type="checkbox" value="1" />';
|
180 |
+
if ( $localized_text ) {
|
181 |
+
$dismiss_html .= esc_html( $localized_text );
|
182 |
+
} else {
|
183 |
+
$dismiss_html .= esc_html__( 'Dismiss this notice.', 'sitepress' );
|
184 |
+
}
|
185 |
+
$dismiss_html .= '</span></span>';
|
186 |
+
|
187 |
+
return $dismiss_html;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @param string|null $localized_text
|
192 |
+
*
|
193 |
+
* @return string
|
194 |
+
*/
|
195 |
+
private function get_collapse_html( $localized_text = null ) {
|
196 |
+
$hide_html = '<span class="otgs-notice-collapse-hide"><span class="screen-reader-text">';
|
197 |
+
if ( $localized_text ) {
|
198 |
+
$hide_html .= esc_html( $localized_text );
|
199 |
+
} else {
|
200 |
+
$hide_html .= esc_html__( 'Hide this notice.', 'sitepress' );
|
201 |
+
}
|
202 |
+
$hide_html .= '</span></span>';
|
203 |
+
|
204 |
+
return $hide_html;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* @param WPML_Notice $notice
|
209 |
+
* @param string|null $localized_text
|
210 |
+
*
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
private function get_collapsed_html( WPML_Notice $notice, $localized_text = null ) {
|
214 |
+
$content = '
|
215 |
+
<div class="otgs-notice-collapsed-text">
|
216 |
+
<p>%s
|
217 |
+
<span class="otgs-notice-collapse-show notice-collapse"><span class="screen-reader-text">
|
218 |
+
%s
|
219 |
+
</span></span>
|
220 |
+
</p>
|
221 |
+
</div>
|
222 |
+
<div class="otgs-notice-collapse-text">
|
223 |
+
%s
|
224 |
+
</div>
|
225 |
+
';
|
226 |
+
|
227 |
+
$content = sprintf(
|
228 |
+
$content,
|
229 |
+
$notice->get_collapsed_text(),
|
230 |
+
$localized_text ? esc_html( $localized_text ) : esc_html__( 'Show this notice.', 'sitepress' ),
|
231 |
+
$notice->get_text()
|
232 |
+
);
|
233 |
+
|
234 |
+
return $content;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* @param WPML_Notice_Action $action
|
239 |
+
*
|
240 |
+
* @return string
|
241 |
+
*/
|
242 |
+
private function get_action_html( $action ) {
|
243 |
+
$action_html = '';
|
244 |
+
if ( $action->can_hide() ) {
|
245 |
+
$action_html .= $this->get_hide_html( $action->get_text() );
|
246 |
+
$this->hide_html_added = true;
|
247 |
+
} elseif ( $action->can_dismiss() ) {
|
248 |
+
$action_html .= $this->get_dismiss_html( $action->get_text() );
|
249 |
+
$this->dismiss_html_added = true;
|
250 |
+
} else {
|
251 |
+
if ( $action->get_url() ) {
|
252 |
+
$action_html .= $this->get_action_anchor( $action );
|
253 |
+
} else {
|
254 |
+
$action_html .= $action->get_text();
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
return $action_html;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* @param WPML_Notice_Action $action
|
263 |
+
*
|
264 |
+
* @return string
|
265 |
+
*/
|
266 |
+
private function get_action_anchor( WPML_Notice_Action $action ) {
|
267 |
+
$anchor_attributes = array();
|
268 |
+
|
269 |
+
$action_url = '<a';
|
270 |
+
|
271 |
+
$anchor_attributes['href'] = esc_url_raw( $action->get_url() );
|
272 |
+
if ( $action->get_link_target() ) {
|
273 |
+
$anchor_attributes['target'] = $action->get_link_target();
|
274 |
+
}
|
275 |
+
|
276 |
+
$action_url_classes = array( 'notice-action' );
|
277 |
+
if ( $action->must_display_as_button() ) {
|
278 |
+
$button_style = 'button-secondary';
|
279 |
+
if ( is_string( $action->must_display_as_button() ) ) {
|
280 |
+
$button_style = $action->must_display_as_button();
|
281 |
+
}
|
282 |
+
$action_url_classes[] = esc_attr( $button_style );
|
283 |
+
$action_url_classes[] = 'notice-action-' . esc_attr( $button_style );
|
284 |
+
} else {
|
285 |
+
$action_url_classes[] = 'notice-action-link';
|
286 |
+
}
|
287 |
+
$anchor_attributes['class'] = implode( ' ', $action_url_classes );
|
288 |
+
|
289 |
+
if ( $action->get_group_to_dismiss() ) {
|
290 |
+
$anchor_attributes['data-dismiss-group'] = esc_attr( $action->get_group_to_dismiss() );
|
291 |
+
}
|
292 |
+
if ( $action->get_js_callback() ) {
|
293 |
+
$anchor_attributes['data-js-callback'] = esc_attr( $action->get_js_callback() )
|
294 |
+
. '"';
|
295 |
+
}
|
296 |
+
|
297 |
+
foreach ( $anchor_attributes as $name => $value ) {
|
298 |
+
$action_url .= ' ' . $name . '="' . $value . '"';
|
299 |
+
}
|
300 |
+
|
301 |
+
$action_url .= $this->get_data_nonce_attribute();
|
302 |
+
$action_url .= '>';
|
303 |
+
$action_url .= $action->get_text();
|
304 |
+
$action_url .= '</a>';
|
305 |
+
|
306 |
+
return $action_url;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* @return string
|
311 |
+
*/
|
312 |
+
private function get_data_nonce_attribute() {
|
313 |
+
return ' data-nonce="' . wp_create_nonce( WPML_Notices::NONCE_NAME ) . '"';
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* @param WPML_Notice $notice
|
318 |
+
*
|
319 |
+
* @return bool
|
320 |
+
*/
|
321 |
+
private function is_current_screen_allowed( WPML_Notice $notice ) {
|
322 |
+
$allow_current_screen = true;
|
323 |
+
$restrict_to_screen_ids = $notice->get_restrict_to_screen_ids();
|
324 |
+
if ( $restrict_to_screen_ids && function_exists( 'get_current_screen' ) ) {
|
325 |
+
$screen = get_current_screen();
|
326 |
+
$allow_current_screen = $screen && in_array( $screen->id, $restrict_to_screen_ids, true );
|
327 |
+
}
|
328 |
+
|
329 |
+
return $allow_current_screen;
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* @param WPML_Notice $notice
|
334 |
+
* @param string $current_page
|
335 |
+
*
|
336 |
+
* @return bool
|
337 |
+
*/
|
338 |
+
private function is_current_page_prefix_allowed( WPML_Notice $notice, $current_page ) {
|
339 |
+
$restrict_to_page_prefixes = $notice->get_restrict_to_page_prefixes();
|
340 |
+
if ( $current_page && $restrict_to_page_prefixes ) {
|
341 |
+
$allow_current_page_prefix = false;
|
342 |
+
foreach ( $restrict_to_page_prefixes as $restrict_to_prefix ) {
|
343 |
+
if ( stripos( $current_page, $restrict_to_prefix ) === 0 ) {
|
344 |
+
$allow_current_page_prefix = true;
|
345 |
+
break;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
return $allow_current_page_prefix;
|
350 |
+
}
|
351 |
+
|
352 |
+
return true;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* @param WPML_Notice $notice
|
357 |
+
*
|
358 |
+
* @return bool
|
359 |
+
*/
|
360 |
+
private function is_current_page_allowed( WPML_Notice $notice ) {
|
361 |
+
$current_page = array_key_exists( 'page', $_GET ) ? $_GET['page'] : null;
|
362 |
+
|
363 |
+
if ( ! $this->is_current_screen_allowed( $notice ) ) {
|
364 |
+
return false;
|
365 |
+
}
|
366 |
+
|
367 |
+
if ( $current_page ) {
|
368 |
+
|
369 |
+
$exclude_from_pages = $notice->get_exclude_from_pages();
|
370 |
+
if ( $exclude_from_pages && in_array( $current_page, $exclude_from_pages, true ) ) {
|
371 |
+
return false;
|
372 |
+
}
|
373 |
+
|
374 |
+
if ( ! $this->is_current_page_prefix_allowed( $notice, $current_page ) ) {
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
|
378 |
+
$restrict_to_pages = $notice->get_restrict_to_pages();
|
379 |
+
if ( $restrict_to_pages && ! in_array( $current_page, $restrict_to_pages, true ) ) {
|
380 |
+
return false;
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
return true;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* @param WPML_Notice $notice
|
389 |
+
*
|
390 |
+
* @return bool
|
391 |
+
*/
|
392 |
+
private function is_allowed_by_callback( WPML_Notice $notice ) {
|
393 |
+
$allow_by_callback = true;
|
394 |
+
$display_callbacks = $notice->get_display_callbacks();
|
395 |
+
if ( $display_callbacks ) {
|
396 |
+
$allow_by_callback = false;
|
397 |
+
foreach ( $display_callbacks as $callback ) {
|
398 |
+
if ( is_callable( $callback ) && call_user_func( $callback ) ) {
|
399 |
+
$allow_by_callback = true;
|
400 |
+
break;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
return $allow_by_callback;
|
406 |
+
}
|
407 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/class-wpml-notice.php
ADDED
@@ -0,0 +1,414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Notice {
|
7 |
+
private $display_callbacks = array();
|
8 |
+
private $id;
|
9 |
+
private $text;
|
10 |
+
private $collapsed_text;
|
11 |
+
private $group = 'default';
|
12 |
+
private $restricted_to_user_ids = array();
|
13 |
+
|
14 |
+
private $actions = array();
|
15 |
+
/**
|
16 |
+
* @see \WPML_Notice::set_css_class_types
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
private $css_class_types = array();
|
20 |
+
private $css_classes = array();
|
21 |
+
private $dismissible = false;
|
22 |
+
private $exclude_from_pages = array();
|
23 |
+
private $hideable = false;
|
24 |
+
private $collapsable = false;
|
25 |
+
private $restrict_to_pages = array();
|
26 |
+
private $restrict_to_page_prefixes = array();
|
27 |
+
private $restrict_to_screen_ids = array();
|
28 |
+
private $hide_if_notice_exists = null;
|
29 |
+
private $dismissible_for_different_text = true;
|
30 |
+
|
31 |
+
private $default_group_name = 'default';
|
32 |
+
|
33 |
+
private $capabilities = array();
|
34 |
+
|
35 |
+
private $dismiss_reset = false;
|
36 |
+
|
37 |
+
/*
|
38 |
+
* @var bool
|
39 |
+
* @since 4.1.0
|
40 |
+
*/
|
41 |
+
private $flash = false;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
private $nonce_action;
|
47 |
+
|
48 |
+
/** @var bool */
|
49 |
+
private $text_only = false;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* WPML_Admin_Notification constructor.
|
53 |
+
*
|
54 |
+
* @param int|string $id
|
55 |
+
* @param string $text
|
56 |
+
* @param string $group
|
57 |
+
*/
|
58 |
+
public function __construct( $id, $text, $group = 'default' ) {
|
59 |
+
$this->id = $id;
|
60 |
+
$this->text = $text;
|
61 |
+
$this->group = $group ? $group : $this->default_group_name;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function add_action( WPML_Notice_Action $action ) {
|
65 |
+
$this->actions[] = $action;
|
66 |
+
|
67 |
+
if ( $action->can_dismiss() ) {
|
68 |
+
$this->dismissible = true;
|
69 |
+
}
|
70 |
+
if ( ! $action->can_dismiss_different_text() ) {
|
71 |
+
$this->dismissible_for_different_text = false;
|
72 |
+
}
|
73 |
+
if ( $action->can_hide() ) {
|
74 |
+
$this->hideable = true;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
public function add_exclude_from_page( $page ) {
|
79 |
+
$this->exclude_from_pages[] = $page;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function add_restrict_to_page( $page ) {
|
83 |
+
$this->restrict_to_pages[] = $page;
|
84 |
+
}
|
85 |
+
|
86 |
+
/** @param int $user_id */
|
87 |
+
public function add_user_restriction( $user_id ) {
|
88 |
+
$user_id = (int) $user_id;
|
89 |
+
$this->restricted_to_user_ids[ $user_id ] = $user_id;
|
90 |
+
}
|
91 |
+
|
92 |
+
/** @param int $user_id */
|
93 |
+
public function remove_user_restriction( $user_id ) {
|
94 |
+
unset( $this->restricted_to_user_ids[ (int) $user_id ] );
|
95 |
+
}
|
96 |
+
|
97 |
+
/** @return array */
|
98 |
+
public function get_restricted_user_ids() {
|
99 |
+
return $this->restricted_to_user_ids;
|
100 |
+
}
|
101 |
+
|
102 |
+
/** @return bool */
|
103 |
+
public function is_user_restricted() {
|
104 |
+
return (bool) $this->restricted_to_user_ids;
|
105 |
+
}
|
106 |
+
|
107 |
+
/** @return bool */
|
108 |
+
public function is_for_current_user() {
|
109 |
+
return ! $this->restricted_to_user_ids
|
110 |
+
|| array_key_exists( get_current_user_id(), $this->restricted_to_user_ids );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @return bool
|
115 |
+
*/
|
116 |
+
public function is_user_cap_allowed() {
|
117 |
+
$user_can = true;
|
118 |
+
foreach ( $this->capabilities as $cap ) {
|
119 |
+
$user_can = current_user_can( $cap );
|
120 |
+
|
121 |
+
if ( $user_can ) {
|
122 |
+
break;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
return $user_can;
|
127 |
+
}
|
128 |
+
|
129 |
+
public function can_be_dismissed() {
|
130 |
+
return $this->dismissible;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function can_be_dismissed_for_different_text() {
|
134 |
+
return $this->dismissible_for_different_text;
|
135 |
+
}
|
136 |
+
|
137 |
+
public function can_be_hidden() {
|
138 |
+
return $this->hideable;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @return bool
|
143 |
+
*/
|
144 |
+
public function can_be_collapsed() {
|
145 |
+
return $this->collapsable;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* As the notice is supposed to be serialized and stored into the DB,
|
150 |
+
* the callback should be only a function or a static method.
|
151 |
+
*
|
152 |
+
* Before to use a callback, please check the existing options with:
|
153 |
+
* - add_exclude_from_page
|
154 |
+
* - add_restrict_to_page
|
155 |
+
* - add_user_restriction
|
156 |
+
* - add_capability_check
|
157 |
+
*
|
158 |
+
* @param callable $callback
|
159 |
+
*/
|
160 |
+
public function add_display_callback( $callback ) {
|
161 |
+
if ( ! is_callable( $callback ) ) {
|
162 |
+
throw new UnexpectedValueException( '\WPML_Notice::add_display_callback expects a callable', 1 );
|
163 |
+
}
|
164 |
+
$this->display_callbacks[] = $callback;
|
165 |
+
}
|
166 |
+
|
167 |
+
public function add_capability_check( array $cap ) {
|
168 |
+
$this->capabilities = $cap;
|
169 |
+
}
|
170 |
+
|
171 |
+
public function get_display_callbacks() {
|
172 |
+
/**
|
173 |
+
* ADDED MANUALLY
|
174 |
+
*
|
175 |
+
* @see https://onthegosystems.myjetbrains.com/youtrack/issue/wcml-3944#focus=Comments-102-507459.0-0
|
176 |
+
*
|
177 |
+
* @param string|array $callback
|
178 |
+
*
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
+
$isNotIncompleteObject = function( $callback ) {
|
182 |
+
return ! ( isset( $callback[0] ) && $callback[0] instanceof __PHP_Incomplete_Class );
|
183 |
+
};
|
184 |
+
|
185 |
+
return array_filter( $this->display_callbacks, $isNotIncompleteObject );
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @return array<\WPML_Notice_Action>
|
190 |
+
*/
|
191 |
+
public function get_actions() {
|
192 |
+
return $this->actions;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function get_css_classes() {
|
196 |
+
return $this->css_classes;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* @param string|array $css_classes
|
201 |
+
*/
|
202 |
+
public function set_css_classes( $css_classes ) {
|
203 |
+
if ( ! is_array( $css_classes ) ) {
|
204 |
+
$css_classes = explode( ' ', $css_classes );
|
205 |
+
}
|
206 |
+
$this->css_classes = $css_classes;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function get_exclude_from_pages() {
|
210 |
+
return $this->exclude_from_pages;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
public function get_group() {
|
217 |
+
return $this->group;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* @return int|string
|
222 |
+
*/
|
223 |
+
public function get_id() {
|
224 |
+
return $this->id;
|
225 |
+
}
|
226 |
+
|
227 |
+
public function set_restrict_to_page_prefixes( array $page_prefixes ) {
|
228 |
+
$this->restrict_to_page_prefixes = $page_prefixes;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @return array
|
233 |
+
*/
|
234 |
+
public function get_restrict_to_page_prefixes() {
|
235 |
+
return $this->restrict_to_page_prefixes;
|
236 |
+
}
|
237 |
+
|
238 |
+
public function get_restrict_to_pages() {
|
239 |
+
return $this->restrict_to_pages;
|
240 |
+
}
|
241 |
+
|
242 |
+
public function set_restrict_to_screen_ids( array $screens ) {
|
243 |
+
$this->restrict_to_screen_ids = $screens;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* @return array
|
248 |
+
*/
|
249 |
+
public function get_restrict_to_screen_ids() {
|
250 |
+
return $this->restrict_to_screen_ids;
|
251 |
+
}
|
252 |
+
|
253 |
+
public function get_nonce_action() {
|
254 |
+
return $this->nonce_action;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @return string
|
259 |
+
*/
|
260 |
+
public function get_text() {
|
261 |
+
$notice = array(
|
262 |
+
'id' => $this->get_id(),
|
263 |
+
'group' => $this->get_group(),
|
264 |
+
);
|
265 |
+
$this->text = apply_filters( 'wpml_notice_text', $this->text, $notice );
|
266 |
+
|
267 |
+
return $this->text;
|
268 |
+
}
|
269 |
+
|
270 |
+
public function get_css_class_types() {
|
271 |
+
return $this->css_class_types;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* @return string
|
276 |
+
*/
|
277 |
+
public function get_collapsed_text() {
|
278 |
+
return $this->collapsed_text;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Use this to set the look of the notice.
|
283 |
+
* WordPress recognize these values:
|
284 |
+
* - notice-error
|
285 |
+
* - notice-warning
|
286 |
+
* - notice-success
|
287 |
+
* - notice-info
|
288 |
+
* You can use the above values with or without the "notice-" prefix:
|
289 |
+
* the prefix will be added automatically in the HTML, if missing.
|
290 |
+
*
|
291 |
+
* @see https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices for more details
|
292 |
+
*
|
293 |
+
* @param string|array $types Accepts either a space separated values string, or an array of values.
|
294 |
+
* @return WPML_Notice
|
295 |
+
*/
|
296 |
+
public function set_css_class_types( $types ) {
|
297 |
+
$this->css_class_types = is_array( $types ) ? $types : explode( ' ', $types );
|
298 |
+
|
299 |
+
return $this;
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* @param bool $dismissible
|
304 |
+
*/
|
305 |
+
public function set_dismissible( $dismissible ) {
|
306 |
+
$this->dismissible = $dismissible;
|
307 |
+
}
|
308 |
+
|
309 |
+
public function set_exclude_from_pages( array $pages ) {
|
310 |
+
$this->exclude_from_pages = $pages;
|
311 |
+
}
|
312 |
+
|
313 |
+
public function set_hide_if_notice_exists( $notice_id, $notice_group = null ) {
|
314 |
+
$this->hide_if_notice_exists = array(
|
315 |
+
'id' => $notice_id,
|
316 |
+
'group' => $notice_group,
|
317 |
+
);
|
318 |
+
}
|
319 |
+
|
320 |
+
public function get_hide_if_notice_exists() {
|
321 |
+
return $this->hide_if_notice_exists;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* @param bool $hideable
|
326 |
+
*/
|
327 |
+
public function set_hideable( $hideable ) {
|
328 |
+
$this->hideable = $hideable;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* @param bool $collapsable
|
333 |
+
*/
|
334 |
+
public function set_collapsable( $collapsable ) {
|
335 |
+
$this->collapsable = $collapsable;
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* @param string $action
|
340 |
+
*/
|
341 |
+
public function set_nonce_action( $action ) {
|
342 |
+
$this->nonce_action = $action;
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* @param string $collapsed_text
|
347 |
+
*/
|
348 |
+
public function set_collapsed_text( $collapsed_text ) {
|
349 |
+
$this->collapsed_text = $collapsed_text;
|
350 |
+
}
|
351 |
+
|
352 |
+
public function set_restrict_to_pages( array $pages ) {
|
353 |
+
$this->restrict_to_pages = $pages;
|
354 |
+
}
|
355 |
+
|
356 |
+
public function reset_dismiss() {
|
357 |
+
$this->dismiss_reset = true;
|
358 |
+
}
|
359 |
+
|
360 |
+
public function must_reset_dismiss() {
|
361 |
+
return $this->dismiss_reset;
|
362 |
+
}
|
363 |
+
|
364 |
+
public function is_different( WPML_Notice $other_notice ) {
|
365 |
+
return serialize( $this ) !== serialize( $other_notice );
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Set notice to only display once.
|
370 |
+
*
|
371 |
+
* @param bool $flash
|
372 |
+
*
|
373 |
+
* @return WPML_Notice
|
374 |
+
* @since 4.1.0
|
375 |
+
*/
|
376 |
+
public function set_flash( $flash = true ) {
|
377 |
+
$this->flash = (bool) $flash;
|
378 |
+
|
379 |
+
return $this;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* @return bool
|
384 |
+
* @since 4.1.0
|
385 |
+
*/
|
386 |
+
public function is_flash() {
|
387 |
+
return $this->flash;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* @return bool
|
392 |
+
*/
|
393 |
+
public function should_be_text_only() {
|
394 |
+
return $this->text_only;
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* @param bool $text_only
|
399 |
+
*/
|
400 |
+
public function set_text_only( $text_only ) {
|
401 |
+
$this->text_only = $text_only;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* @param int|string $id
|
406 |
+
* @param string $text
|
407 |
+
* @param string $group
|
408 |
+
*
|
409 |
+
* @return WPML_Notice
|
410 |
+
*/
|
411 |
+
public static function make( $id, $text, $group = 'default' ) {
|
412 |
+
return new WPML_Notice( $id, $text, $group );
|
413 |
+
}
|
414 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/class-wpml-notices.php
ADDED
@@ -0,0 +1,489 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Notices {
|
7 |
+
|
8 |
+
const NOTICES_OPTION_KEY = 'wpml_notices';
|
9 |
+
const DISMISSED_OPTION_KEY = '_wpml_dismissed_notices';
|
10 |
+
const USER_DISMISSED_KEY = '_wpml_user_dismissed_notices';
|
11 |
+
const NONCE_NAME = 'wpml-notices';
|
12 |
+
const DEFAULT_GROUP = 'default';
|
13 |
+
|
14 |
+
private $notice_render;
|
15 |
+
/**
|
16 |
+
* @var array<string,array<\WPML_Notice>>
|
17 |
+
*/
|
18 |
+
private $notices;
|
19 |
+
/**
|
20 |
+
* @var array<string,array<int>>
|
21 |
+
*/
|
22 |
+
private $notices_to_remove = array();
|
23 |
+
private $dismissed;
|
24 |
+
private $user_dismissed;
|
25 |
+
private $original_notices_md5;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WPML_Notices constructor.
|
29 |
+
*
|
30 |
+
* @param WPML_Notice_Render $notice_render
|
31 |
+
*/
|
32 |
+
public function __construct( WPML_Notice_Render $notice_render ) {
|
33 |
+
$this->notice_render = $notice_render;
|
34 |
+
$this->notices = $this->filter_invalid_notices( $this->get_all_notices() );
|
35 |
+
$this->dismissed = $this->get_all_dismissed();
|
36 |
+
$this->original_notices_md5 = md5( maybe_serialize( $this->notices ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return int
|
41 |
+
*/
|
42 |
+
public function count() {
|
43 |
+
$all_notices = $this->get_all_notices();
|
44 |
+
$count = 0;
|
45 |
+
foreach ( $all_notices as $group => $group_notices ) {
|
46 |
+
$count += count( $group_notices );
|
47 |
+
}
|
48 |
+
|
49 |
+
return $count;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function get_all_notices() {
|
56 |
+
$all_notices = get_option( self::NOTICES_OPTION_KEY );
|
57 |
+
if ( ! is_array( $all_notices ) ) {
|
58 |
+
$all_notices = array();
|
59 |
+
}
|
60 |
+
return $all_notices;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return array
|
65 |
+
*/
|
66 |
+
private function get_all_dismissed() {
|
67 |
+
$dismissed = get_option( self::DISMISSED_OPTION_KEY );
|
68 |
+
if ( ! is_array( $dismissed ) ) {
|
69 |
+
$dismissed = array();
|
70 |
+
}
|
71 |
+
return $dismissed;
|
72 |
+
}
|
73 |
+
|
74 |
+
private function init_all_user_dismissed() {
|
75 |
+
if ( null === $this->user_dismissed ) {
|
76 |
+
$this->user_dismissed = get_user_meta( get_current_user_id(), self::USER_DISMISSED_KEY, true );
|
77 |
+
|
78 |
+
if ( ! is_array( $this->user_dismissed ) ) {
|
79 |
+
$this->user_dismissed = array();
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param string $id
|
86 |
+
* @param string $group
|
87 |
+
*
|
88 |
+
* @return null|WPML_Notice
|
89 |
+
*/
|
90 |
+
public function get_notice( $id, $group = 'default' ) {
|
91 |
+
$notice = null;
|
92 |
+
|
93 |
+
if ( isset( $this->notices[ $group ][ $id ] ) ) {
|
94 |
+
$notice = $this->notices[ $group ][ $id ];
|
95 |
+
}
|
96 |
+
|
97 |
+
return $notice;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @param string $id
|
102 |
+
* @param string $text
|
103 |
+
* @param string $group
|
104 |
+
*
|
105 |
+
* @return WPML_Notice
|
106 |
+
*/
|
107 |
+
public function create_notice( $id, $text, $group = 'default' ) {
|
108 |
+
return new WPML_Notice( $id, $text, $group );
|
109 |
+
}
|
110 |
+
|
111 |
+
public function add_notice( WPML_Notice $notice, $force_update = false ) {
|
112 |
+
$existing_notice = $this->notice_exists( $notice ) ? $this->notices[ $notice->get_group() ][ $notice->get_id() ] : null;
|
113 |
+
|
114 |
+
$new_notice_is_different = null === $existing_notice || $notice->is_different( $existing_notice );
|
115 |
+
|
116 |
+
if ( $notice->must_reset_dismiss() && $this->is_notice_dismissed( $notice ) ) {
|
117 |
+
$this->undismiss_notice( $notice );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! $existing_notice || ( $new_notice_is_different || $force_update ) ) {
|
121 |
+
$this->notices[ $notice->get_group() ][ $notice->get_id() ] = $notice;
|
122 |
+
$this->save_notices();
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @param string $id
|
128 |
+
* @param string $text
|
129 |
+
* @param string $group
|
130 |
+
*
|
131 |
+
* @return WPML_Notice
|
132 |
+
*/
|
133 |
+
public function get_new_notice( $id, $text, $group = 'default' ) {
|
134 |
+
return new WPML_Notice( $id, $text, $group );
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @param string $text
|
139 |
+
* @param string $url
|
140 |
+
* @param bool $dismiss
|
141 |
+
* @param bool $hide
|
142 |
+
* @param bool $display_as_button
|
143 |
+
*
|
144 |
+
* @return WPML_Notice_Action
|
145 |
+
*/
|
146 |
+
public function get_new_notice_action( $text, $url = '#', $dismiss = false, $hide = false, $display_as_button = false ) {
|
147 |
+
return new WPML_Notice_Action( $text, $url, $dismiss, $hide, $display_as_button );
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @param WPML_Notice $notice
|
152 |
+
*
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
private function notice_exists( WPML_Notice $notice ) {
|
156 |
+
$notice_id = $notice->get_id();
|
157 |
+
$notice_group = $notice->get_group();
|
158 |
+
|
159 |
+
return $this->group_and_id_exist( $notice_group, $notice_id );
|
160 |
+
}
|
161 |
+
|
162 |
+
private function get_notices_for_group( $group ) {
|
163 |
+
if ( array_key_exists( $group, $this->notices ) ) {
|
164 |
+
return $this->notices[ $group ];
|
165 |
+
}
|
166 |
+
|
167 |
+
return array();
|
168 |
+
}
|
169 |
+
|
170 |
+
private function save_notices() {
|
171 |
+
$this->remove_notices();
|
172 |
+
if ( ! has_action( 'shutdown', array( $this, 'save_to_option' ) ) ) {
|
173 |
+
add_action( 'shutdown', array( $this, 'save_to_option' ), 1000 );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
public function save_to_option() {
|
178 |
+
if ( $this->original_notices_md5 !== md5( maybe_serialize( $this->notices ) ) ) {
|
179 |
+
update_option( self::NOTICES_OPTION_KEY, $this->notices, false );
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
private function save_dismissed() {
|
184 |
+
update_user_meta( get_current_user_id(), self::USER_DISMISSED_KEY, $this->user_dismissed );
|
185 |
+
update_option( self::DISMISSED_OPTION_KEY, $this->dismissed, false );
|
186 |
+
}
|
187 |
+
|
188 |
+
public function remove_notices() {
|
189 |
+
if ( $this->notices_to_remove ) {
|
190 |
+
foreach ( $this->notices_to_remove as $group => &$group_notices ) {
|
191 |
+
foreach ( $group_notices as $id ) {
|
192 |
+
if ( array_key_exists( $group, $this->notices ) && array_key_exists( $id, $this->notices[ $group ] ) ) {
|
193 |
+
unset( $this->notices[ $group ][ $id ] );
|
194 |
+
$group_notices = array_diff( $this->notices_to_remove[ $group ], array( $id ) );
|
195 |
+
}
|
196 |
+
}
|
197 |
+
if ( array_key_exists( $group, $this->notices_to_remove ) && ! $this->notices_to_remove[ $group ] ) {
|
198 |
+
unset( $this->notices_to_remove[ $group ] );
|
199 |
+
}
|
200 |
+
if ( array_key_exists( $group, $this->notices ) && ! $this->notices[ $group ] ) {
|
201 |
+
unset( $this->notices[ $group ] );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
public function admin_enqueue_scripts() {
|
208 |
+
if ( WPML_Block_Editor_Helper::is_edit_post() ) {
|
209 |
+
wp_enqueue_script(
|
210 |
+
'block-editor-notices',
|
211 |
+
WCML_WPML_DEPENDENCY_URL . '/dist/js/blockEditorNotices/app.js',
|
212 |
+
array( 'wp-edit-post' ),
|
213 |
+
'4.5.0',
|
214 |
+
true
|
215 |
+
);
|
216 |
+
}
|
217 |
+
if ( $this->must_display_notices() ) {
|
218 |
+
wp_enqueue_style( 'sitepress-style', WCML_WPML_DEPENDENCY_URL . '/res/css/style.css', array(), '4.5.0' ); // Added manually as it's a dependency.
|
219 |
+
wp_enqueue_style( 'otgs-notices', WCML_WPML_DEPENDENCY_URL . '/res/css/otgs-notices.css', array( 'sitepress-style' ) );
|
220 |
+
wp_enqueue_script(
|
221 |
+
'otgs-notices',
|
222 |
+
WCML_WPML_DEPENDENCY_URL . '/res/js/otgs-notices.js',
|
223 |
+
array( 'underscore' ),
|
224 |
+
'4.5.0',
|
225 |
+
true
|
226 |
+
);
|
227 |
+
|
228 |
+
do_action( 'wpml-notices-scripts-enqueued' );
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
private function must_display_notices() {
|
233 |
+
if ( $this->notices ) {
|
234 |
+
foreach ( $this->notices as $group => $notices ) {
|
235 |
+
foreach ( $notices as $notice ) {
|
236 |
+
if ( $this->notice_render->must_display_notice( $notice ) && ! $this->must_hide_if_notice_exists( $notice ) ) {
|
237 |
+
return true;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
return false;
|
244 |
+
}
|
245 |
+
|
246 |
+
private function must_hide_if_notice_exists( WPML_Notice $notice ) {
|
247 |
+
$hide_if_notice_exists = $notice->get_hide_if_notice_exists();
|
248 |
+
if ( $hide_if_notice_exists ) {
|
249 |
+
$other_notice = $this->get_notice( $hide_if_notice_exists['id'], $hide_if_notice_exists['group'] );
|
250 |
+
|
251 |
+
return $other_notice;
|
252 |
+
}
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
|
256 |
+
public function admin_notices() {
|
257 |
+
if ( $this->notices && $this->must_display_notices() ) {
|
258 |
+
foreach ( $this->notices as $group => $notices ) {
|
259 |
+
foreach ( $notices as $notice ) {
|
260 |
+
if ( $notice instanceof WPML_Notice && ! $this->is_notice_dismissed( $notice ) ) {
|
261 |
+
$this->notice_render->render( $notice );
|
262 |
+
if ( $notice->is_flash() ) {
|
263 |
+
$this->remove_notice( $notice->get_group(), $notice->get_id() );
|
264 |
+
}
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
public function wp_ajax_hide_notice() {
|
272 |
+
list( $notice_group, $notice_id ) = $this->parse_group_and_id();
|
273 |
+
|
274 |
+
if ( ! $notice_group ) {
|
275 |
+
$notice_group = self::DEFAULT_GROUP;
|
276 |
+
}
|
277 |
+
|
278 |
+
if ( $this->has_valid_nonce() && $this->group_and_id_exist( $notice_group, $notice_id ) ) {
|
279 |
+
$this->remove_notice( $notice_group, $notice_id );
|
280 |
+
wp_send_json_success( true );
|
281 |
+
}
|
282 |
+
|
283 |
+
wp_send_json_error( __( 'Notice does not exists.', 'sitepress' ) );
|
284 |
+
}
|
285 |
+
|
286 |
+
public function wp_ajax_dismiss_notice() {
|
287 |
+
list( $notice_group, $notice_id ) = $this->parse_group_and_id();
|
288 |
+
|
289 |
+
if ( $this->has_valid_nonce() && $this->dismiss_notice_by_id( $notice_id, $notice_group ) ) {
|
290 |
+
wp_send_json_success( true );
|
291 |
+
}
|
292 |
+
|
293 |
+
wp_send_json_error( __( 'Notice does not exist.', 'sitepress' ) );
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* @param string $notice_id
|
298 |
+
* @param null|string $notice_group
|
299 |
+
*
|
300 |
+
* @return bool
|
301 |
+
*/
|
302 |
+
private function dismiss_notice_by_id( $notice_id, $notice_group = null ) {
|
303 |
+
if ( ! $notice_group ) {
|
304 |
+
$notice_group = self::DEFAULT_GROUP;
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( $this->group_and_id_exist( $notice_group, $notice_id ) ) {
|
308 |
+
$notice = $this->get_notice( $notice_id, $notice_group );
|
309 |
+
|
310 |
+
if ( $notice ) {
|
311 |
+
$this->dismiss_notice( $notice );
|
312 |
+
$this->remove_notice( $notice_group, $notice_id );
|
313 |
+
|
314 |
+
return true;
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
public function wp_ajax_dismiss_group() {
|
322 |
+
list( $notice_group ) = $this->parse_group_and_id();
|
323 |
+
|
324 |
+
if ( $notice_group && $this->has_valid_nonce() && $this->dismiss_notice_group( $notice_group ) ) {
|
325 |
+
wp_send_json_success( true );
|
326 |
+
}
|
327 |
+
wp_send_json_error( __( 'Group does not exist.', 'sitepress' ) );
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* @param null|string $notice_group
|
332 |
+
*
|
333 |
+
* @return bool
|
334 |
+
*/
|
335 |
+
private function dismiss_notice_group( $notice_group ) {
|
336 |
+
if ( $notice_group ) {
|
337 |
+
$notices = $this->get_notices_for_group( $notice_group );
|
338 |
+
|
339 |
+
if ( $notices ) {
|
340 |
+
/** @var WPML_Notice $notice */
|
341 |
+
foreach ( $notices as $notice ) {
|
342 |
+
$this->dismiss_notice( $notice, false );
|
343 |
+
$this->remove_notice( $notice_group, $notice->get_id() );
|
344 |
+
}
|
345 |
+
|
346 |
+
$this->save_dismissed();
|
347 |
+
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* @return array
|
357 |
+
*/
|
358 |
+
private function parse_group_and_id() {
|
359 |
+
$group = isset( $_POST['group'] ) ? sanitize_text_field( $_POST['group'] ) : false;
|
360 |
+
$id = isset( $_POST['id'] ) ? sanitize_text_field( $_POST['id'] ) : false;
|
361 |
+
|
362 |
+
return array( $group, $id );
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* @return false|int
|
367 |
+
*/
|
368 |
+
private function has_valid_nonce() {
|
369 |
+
$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : null;
|
370 |
+
return wp_verify_nonce( $nonce, self::NONCE_NAME );
|
371 |
+
}
|
372 |
+
|
373 |
+
private function group_and_id_exist( $group, $id ) {
|
374 |
+
return array_key_exists( $group, $this->notices ) && array_key_exists( $id, $this->notices[ $group ] );
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* @param string $notice_group
|
379 |
+
* @param string|int $notice_id
|
380 |
+
*/
|
381 |
+
public function remove_notice( $notice_group, $notice_id ) {
|
382 |
+
$this->notices_to_remove[ $notice_group ][] = $notice_id;
|
383 |
+
$this->notices_to_remove[ $notice_group ] = array_unique( $this->notices_to_remove[ $notice_group ] );
|
384 |
+
$this->save_notices();
|
385 |
+
|
386 |
+
if ( ! is_array( $this->notices_to_remove ) ) {
|
387 |
+
$this->notices_to_remove = array();
|
388 |
+
}
|
389 |
+
|
390 |
+
if ( isset( $this->notices_to_remove[ $notice_group ] ) ) {
|
391 |
+
foreach ( $this->notices_to_remove[ $notice_group ] as $key => $notice ) {
|
392 |
+
if ( $notice === $notice_id ) {
|
393 |
+
unset( $this->notices_to_remove[ $notice_group ][ $key ] );
|
394 |
+
}
|
395 |
+
}
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* @param string $notice_group
|
401 |
+
*/
|
402 |
+
public function remove_notice_group( $notice_group ) {
|
403 |
+
$notices = $this->get_notices_for_group( $notice_group );
|
404 |
+
$notices_ids = array_keys( $notices );
|
405 |
+
foreach ( $notices_ids as $notices_id ) {
|
406 |
+
$this->remove_notice( $notice_group, $notices_id );
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* @param WPML_Notice $notice
|
412 |
+
* @param bool $persist
|
413 |
+
*/
|
414 |
+
public function dismiss_notice( WPML_Notice $notice, $persist = true ) {
|
415 |
+
if ( method_exists( $notice, 'is_user_restricted' ) && $notice->is_user_restricted() ) {
|
416 |
+
$this->init_all_user_dismissed();
|
417 |
+
$this->user_dismissed[ $notice->get_group() ][ $notice->get_id() ] = md5( $notice->get_text() );
|
418 |
+
} else {
|
419 |
+
$this->dismissed[ $notice->get_group() ][ $notice->get_id() ] = md5( $notice->get_text() );
|
420 |
+
}
|
421 |
+
|
422 |
+
if ( $persist ) {
|
423 |
+
$this->save_dismissed();
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* @param WPML_Notice $notice
|
429 |
+
* @param bool $persist
|
430 |
+
*/
|
431 |
+
public function undismiss_notice( WPML_Notice $notice, $persist = true ) {
|
432 |
+
if ( method_exists( $notice, 'is_user_restricted' ) && $notice->is_user_restricted() ) {
|
433 |
+
$this->init_all_user_dismissed();
|
434 |
+
unset( $this->user_dismissed[ $notice->get_group() ][ $notice->get_id() ] );
|
435 |
+
} else {
|
436 |
+
unset( $this->dismissed[ $notice->get_group() ][ $notice->get_id() ] );
|
437 |
+
}
|
438 |
+
|
439 |
+
if ( $persist ) {
|
440 |
+
$this->save_dismissed();
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* @param WPML_Notice $notice
|
446 |
+
*
|
447 |
+
* @return bool
|
448 |
+
*/
|
449 |
+
public function is_notice_dismissed( WPML_Notice $notice ) {
|
450 |
+
$group = $notice->get_group();
|
451 |
+
$id = $notice->get_id();
|
452 |
+
|
453 |
+
$is_dismissed = isset( $this->dismissed[ $group ][ $id ] ) && $this->dismissed[ $group ][ $id ];
|
454 |
+
|
455 |
+
if ( ! $is_dismissed ) {
|
456 |
+
$this->init_all_user_dismissed();
|
457 |
+
$is_dismissed = isset( $this->user_dismissed[ $group ][ $id ] ) && $this->user_dismissed[ $group ][ $id ];
|
458 |
+
}
|
459 |
+
|
460 |
+
if ( $is_dismissed && method_exists( $notice, 'can_be_dismissed_for_different_text' )
|
461 |
+
&& ! $notice->can_be_dismissed_for_different_text() ) {
|
462 |
+
$is_dismissed = md5( $notice->get_text() ) === $this->dismissed[ $group ][ $id ];
|
463 |
+
}
|
464 |
+
|
465 |
+
return $is_dismissed;
|
466 |
+
}
|
467 |
+
|
468 |
+
public function init_hooks() {
|
469 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
470 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 11 ); // \WPML_Admin_Scripts_Setup::PRIORITY_ENQUEUE_SCRIPTS + 1
|
471 |
+
add_action( 'wp_ajax_otgs-hide-notice', array( $this, 'wp_ajax_hide_notice' ) );
|
472 |
+
add_action( 'wp_ajax_otgs-dismiss-notice', array( $this, 'wp_ajax_dismiss_notice' ) );
|
473 |
+
add_action( 'wp_ajax_otgs-dismiss-group', array( $this, 'wp_ajax_dismiss_group' ) );
|
474 |
+
add_action( 'otgs_add_notice', array( $this, 'add_notice' ), 10, 2 );
|
475 |
+
add_action( 'otgs_remove_notice', array( $this, 'remove_notice' ), 10, 2 );
|
476 |
+
add_action( 'otgs_remove_notice_group', array( $this, 'remove_notice_group' ), 10, 1 );
|
477 |
+
}
|
478 |
+
|
479 |
+
private function filter_invalid_notices( $notices ) {
|
480 |
+
foreach ( $notices as $group => $notices_in_group ) {
|
481 |
+
foreach ( $notices_in_group as $index => $notice ) {
|
482 |
+
if ( ! $notice instanceof WPML_Notice ) {
|
483 |
+
unset( $notices[ $group ][ $index ] );
|
484 |
+
}
|
485 |
+
}
|
486 |
+
}
|
487 |
+
return $notices;
|
488 |
+
}
|
489 |
+
}
|
addons/wpml-dependencies/lib/classes/notices/pages/class-wpml-notice-show-on-dashboard-and-wpml-pages.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPML_Notice_Show_On_Dashboard_And_WPML_Pages {
|
4 |
+
|
5 |
+
public static function is_on_page() {
|
6 |
+
if ( function_exists( 'get_current_screen' ) ) {
|
7 |
+
$screen = get_current_screen();
|
8 |
+
if ( 'dashboard' === $screen->id ) {
|
9 |
+
return true;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
$current_page = array_key_exists( 'page', $_GET ) ? $_GET['page'] : null;
|
14 |
+
|
15 |
+
foreach ( array( 'sitepress-multilingual-cms', 'wpml-translation-management' ) as $page ) {
|
16 |
+
if ( strpos( $current_page, $page ) === 0 ) {
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
addons/wpml-dependencies/lib/classes/privacy/class-wpml-core-privacy-content.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Core_Privacy_Content extends WPML_Privacy_Content {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
protected function get_plugin_name() {
|
12 |
+
return 'WPML';
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @return string|array
|
17 |
+
*/
|
18 |
+
protected function get_privacy_policy() {
|
19 |
+
return array(
|
20 |
+
__( 'WPML uses cookies to identify the visitor’s current language, the last visited language and the language of users who have logged in.', 'sitepress' ),
|
21 |
+
__( 'While you use the plugin, WPML will share data regarding the site through Installer. No data from the user itself will be shared.', 'sitepress' ),
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content-factory.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
class WPML_Privacy_Content_Factory implements IWPML_Backend_Action_Loader {
|
7 |
+
/**
|
8 |
+
* @return IWPML_Action
|
9 |
+
*/
|
10 |
+
public function create() {
|
11 |
+
return new WPML_Core_Privacy_Content();
|
12 |
+
}
|
13 |
+
}
|
addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
abstract class WPML_Privacy_Content implements IWPML_Action {
|
7 |
+
|
8 |
+
public function add_hooks() {
|
9 |
+
add_action( 'admin_init', array( $this, 'privacy_policy' ) );
|
10 |
+
}
|
11 |
+
|
12 |
+
public function privacy_policy() {
|
13 |
+
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
$policy_text_content = $this->get_privacy_policy();
|
18 |
+
if ( $policy_text_content ) {
|
19 |
+
if ( is_array( $policy_text_content ) ) {
|
20 |
+
$policy_text_content = '<p>' . implode( '</p><p>', $policy_text_content ) . '</p>';
|
21 |
+
}
|
22 |
+
wp_add_privacy_policy_content( $this->get_plugin_name(), $policy_text_content );
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
abstract protected function get_plugin_name();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return string|array a single or an array of strings (plain text or HTML). Array items will be wrapped by a paragraph tag.
|
33 |
+
*/
|
34 |
+
abstract protected function get_privacy_policy();
|
35 |
+
}
|
addons/wpml-dependencies/lib/classes/templates/class-wpml-twig-template.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use WPML\Core\Twig_Environment;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @author OnTheGo Systems
|
7 |
+
*/
|
8 |
+
class WPML_Twig_Template implements IWPML_Template_Service {
|
9 |
+
private $twig;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* WPML_Twig_Template constructor.
|
13 |
+
*
|
14 |
+
* @param Twig_Environment $twig
|
15 |
+
*/
|
16 |
+
public function __construct( Twig_Environment $twig ) {
|
17 |
+
$this->twig = $twig;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function show( $model, $template ) {
|
21 |
+
return $this->twig->render( $template, $model );
|
22 |
+
}
|
23 |
+
}
|
addons/wpml-dependencies/lib/classes/templates/interface-iwpml-template-service.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author OnTheGo Systems
|
5 |
+
*/
|
6 |
+
interface IWPML_Template_Service {
|
7 |
+
public function show( $model, $template );
|
8 |
+
}
|
addons/wpml-dependencies/lib/classes/templates/wpml-twig-template-loader.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use WPML\Core\Twig_Loader_Filesystem;
|
4 |
+
use WPML\Core\Twig_Environment;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class WPML_Twig_Template_Loader
|
8 |
+
*/
|
9 |
+
class WPML_Twig_Template_Loader {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
private $paths;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* WPML_Twig_Template_Loader constructor.
|
18 |
+
*
|
19 |
+
* @param array $paths
|
20 |
+
*/
|
21 |
+
public function __construct( array $paths ) {
|
22 |
+
$this->paths = $paths;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @return WPML_Twig_Template
|
27 |
+
*/
|
28 |
+
public function get_template() {
|
29 |
+
$twig_loader = new Twig_Loader_Filesystem( $this->paths );
|
30 |
+
$environment_args = array();
|
31 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
32 |
+
$environment_args['debug'] = true;
|
33 |
+
}
|
34 |
+
$twig = new Twig_Environment( $twig_loader, $environment_args );
|
35 |
+
return new WPML_Twig_Template( $twig );
|
36 |
+
}
|
37 |
+
}
|
addons/wpml-dependencies/lib/classes/templating/class-wpml-templates-factory.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
use WPML\FP\Obj;
|
3 |
+
|
4 |
+
use WPML\Core\Twig_Environment;
|
5 |
+
use WPML\Core\Twig_Error_Syntax;
|
6 |
+
|
7 |
+
abstract class WPML_Templates_Factory {
|
8 |
+
const NOTICE_GROUP = 'template_factory';
|
9 |
+
const OTGS_TWIG_CACHE_DISABLED_KEY = '_otgs_twig_cache_disabled';
|
10 |
+
|
11 |
+
/** @var array */
|
12 |
+
protected $custom_filters;
|
13 |
+
|
14 |
+
/** @var array */
|
15 |
+
protected $custom_functions;
|
16 |
+
|
17 |
+
/** @var string|array */
|
18 |
+
protected $template_paths;
|
19 |
+
|
20 |
+
/** @var string|bool */
|
21 |
+
protected $cache_directory;
|
22 |
+
|
23 |
+
protected $template_string;
|
24 |
+
|
25 |
+
/** @var WPML_WP_API $wp_api */
|
26 |
+
private $wp_api;
|
27 |
+
|
28 |
+
/** @var Twig_Environment */
|
29 |
+
protected $twig;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* WPML_Templates_Factory constructor.
|
33 |
+
*
|
34 |
+
* @param array $custom_functions
|
35 |
+
* @param array $custom_filters
|
36 |
+
* @param WPML_WP_API $wp_api
|
37 |
+
*/
|
38 |
+
public function __construct( array $custom_functions = array(), array $custom_filters = array(), $wp_api = null ) {
|
39 |
+
$this->init_template_base_dir();
|
40 |
+
$this->custom_functions = $custom_functions;
|
41 |
+
$this->custom_filters = $custom_filters;
|
42 |
+
|
43 |
+
if ( $wp_api ) {
|
44 |
+
$this->wp_api = $wp_api;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
abstract protected function init_template_base_dir();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @param null $template
|
52 |
+
* @param null $model
|
53 |
+
*
|
54 |
+
* @throws \WPML\Core\Twig\Error\LoaderError
|
55 |
+
* @throws \WPML\Core\Twig\Error\RuntimeError
|
56 |
+
* @throws \WPML\Core\Twig\Error\SyntaxError
|
57 |
+
*/
|
58 |
+
public function show( $template = null, $model = null ) {
|
59 |
+
echo $this->get_view( $template, $model );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param string $template
|
64 |
+
* @param array<string,mixed> $model
|
65 |
+
*
|
66 |
+
* @return string
|
67 |
+
* @throws \WPML\Core\Twig\Error\LoaderError
|
68 |
+
* @throws \WPML\Core\Twig\Error\RuntimeError
|
69 |
+
* @throws \WPML\Core\Twig\Error\SyntaxError
|
70 |
+
*/
|
71 |
+
public function get_view( $template = null, $model = null ) {
|
72 |
+
$output = '';
|
73 |
+
$this->maybe_init_twig();
|
74 |
+
|
75 |
+
if ( null === $model ) {
|
76 |
+
$model = $this->get_model();
|
77 |
+
}
|
78 |
+
if ( null === $template ) {
|
79 |
+
$template = $this->get_template();
|
80 |
+
}
|
81 |
+
|
82 |
+
try {
|
83 |
+
$output = $this->twig->render( $template, $model );
|
84 |
+
} catch ( RuntimeException $e ) {
|
85 |
+
if ( $this->is_caching_enabled() ) {
|
86 |
+
$this->disable_twig_cache();
|
87 |
+
$this->twig = null;
|
88 |
+
$this->maybe_init_twig();
|
89 |
+
$output = $this->get_view( $template, $model );
|
90 |
+
} else {
|
91 |
+
$this->add_exception_notice( $e );
|
92 |
+
}
|
93 |
+
} catch ( Twig_Error_Syntax $e ) {
|
94 |
+
$message = 'Invalid Twig template string: ' . $e->getRawMessage() . "\n" . $template;
|
95 |
+
$this->get_wp_api()->error_log( $message );
|
96 |
+
}
|
97 |
+
|
98 |
+
return $output;
|
99 |
+
}
|
100 |
+
|
101 |
+
protected function maybe_init_twig() {
|
102 |
+
if ( ! $this->twig ) {
|
103 |
+
$loader = $this->get_twig_loader();
|
104 |
+
|
105 |
+
$environment_args = array();
|
106 |
+
|
107 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
108 |
+
$environment_args['debug'] = true;
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( $this->is_caching_enabled() ) {
|
112 |
+
$wpml_cache_directory = new WPML_Cache_Directory( $this->get_wp_api() );
|
113 |
+
$this->cache_directory = $wpml_cache_directory->get( 'twig' );
|
114 |
+
|
115 |
+
if ( $this->cache_directory ) {
|
116 |
+
$environment_args['cache'] = $this->cache_directory;
|
117 |
+
$environment_args['auto_reload'] = true;
|
118 |
+
} else {
|
119 |
+
$this->disable_twig_cache();
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
$this->twig = $this->get_wp_api()->get_twig_environment( $loader, $environment_args );
|
124 |
+
if ( $this->custom_functions && count( $this->custom_functions ) > 0 ) {
|
125 |
+
foreach ( $this->custom_functions as $custom_function ) {
|
126 |
+
$this->twig->addFunction( $custom_function );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
if ( $this->custom_filters && count( $this->custom_filters ) > 0 ) {
|
130 |
+
foreach ( $this->custom_filters as $custom_filter ) {
|
131 |
+
$this->twig->addFilter( $custom_filter );
|
132 |
+
}
|
133 |
+
}
|
134 |
+
if ( Obj::propOr( false, 'debug', $environment_args ) ) {
|
135 |
+
$this->twig->addExtension( new \WPML\Core\Twig\Extension\DebugExtension() );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
abstract public function get_template();
|
141 |
+
|
142 |
+
abstract public function get_model();
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return Twig_Environment
|
146 |
+
*/
|
147 |
+
protected function get_twig() {
|
148 |
+
return $this->twig;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @param RuntimeException $e
|
153 |
+
*/
|
154 |
+
protected function add_exception_notice( RuntimeException $e ) {
|
155 |
+
if ( false !== strpos( $e->getMessage(), 'create' ) ) {
|
156 |
+
/* translators: %s: Cache directory path */
|
157 |
+
$text = sprintf( __( 'WPML could not create a cache directory in %s', 'sitepress' ), $this->cache_directory );
|
158 |
+
} else {
|
159 |
+
/* translators: %s: Cache directory path */
|
160 |
+
$text = sprintf( __( 'WPML could not write in the cache directory: %s', 'sitepress' ), $this->cache_directory );
|
161 |
+
}
|
162 |
+
$notice = new WPML_Notice( 'exception', $text, self::NOTICE_GROUP );
|
163 |
+
$notice->set_dismissible( true );
|
164 |
+
$notice->set_css_class_types( 'notice-error' );
|
165 |
+
$admin_notices = $this->get_wp_api()->get_admin_notices();
|
166 |
+
$admin_notices->add_notice( $notice );
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* @return WPML_WP_API
|
171 |
+
*/
|
172 |
+
protected function get_wp_api() {
|
173 |
+
if ( ! $this->wp_api ) {
|
174 |
+
$this->wp_api = new WPML_WP_API();
|
175 |
+
}
|
176 |
+
|
177 |
+
return $this->wp_api;
|
178 |
+
}
|
179 |
+
|
180 |
+
protected function disable_twig_cache() {
|
181 |
+
update_option( self::OTGS_TWIG_CACHE_DISABLED_KEY, true, 'no' );
|
182 |
+
}
|
183 |
+
|
184 |
+
protected function is_caching_enabled() {
|
185 |
+
return ! (bool) get_option( self::OTGS_TWIG_CACHE_DISABLED_KEY, false );
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @return bool
|
190 |
+
*/
|
191 |
+
protected function is_string_template() {
|
192 |
+
return isset( $this->template_string );
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @return \WPML\Core\Twig_LoaderInterface
|
197 |
+
*/
|
198 |
+
protected function get_twig_loader() {
|
199 |
+
if ( $this->is_string_template() ) {
|
200 |
+
$loader = $this->get_wp_api()->get_twig_loader_string();
|
201 |
+
} else {
|
202 |
+
$loader = $this->get_wp_api()->get_twig_loader_filesystem( $this->template_paths );
|
203 |
+
}
|
204 |
+
|
205 |
+
return $loader;
|
206 |
+
}
|
207 |
+
}
|
addons/wpml-dependencies/lib/classes/twig-extensions/wpml-twig-wp-plugin-extension.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use WPML\Core\Twig_Extension;
|
4 |
+
use WPML\Core\Twig_SimpleFilter;
|
5 |
+
|
6 |
+
class WPML_Twig_WP_Plugin_Extension extends Twig_Extension {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Returns the name of the extension.
|
10 |
+
* @return string The extension name
|
11 |
+
*/
|
12 |
+
public function getName() {
|
13 |
+
return 'wp_plugin';
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getFilters() {
|
17 |
+
return array(
|
18 |
+
new Twig_SimpleFilter( 'wp_do_action', array( $this, 'wp_do_action_filter' ) ),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
public function wp_do_action_filter( $tag ) {
|
23 |
+
do_action( $tag );
|
24 |
+
}
|
25 |
+
}
|
addons/wpml-dependencies/lib/classes/utilities/class-wpml-wp-cache.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPML_WP_Cache {
|
4 |
+
|
5 |
+
/** @var string Key name under which array of all group keys is stored */
|
6 |
+
const KEYS = 'WPML_WP_Cache__group_keys';
|
7 |
+
|
8 |
+
/** @var string Group name */
|
9 |
+
private $group;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* WPML_WP_Cache constructor.
|
13 |
+
*
|
14 |
+
* @param string $group Optional. Where the cache contents are grouped. Default empty.
|
15 |
+
*/
|
16 |
+
public function __construct( $group = '' ) {
|
17 |
+
$this->group = $group;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Retrieves the cache contents from the cache by key and group.
|
22 |
+
*
|
23 |
+
* @param int|string $key The key under which the cache contents are stored.
|
24 |
+
* @param bool $found Optional. Whether the key was found in the cache (passed by reference).
|
25 |
+
* Disambiguates a return of false, a storable value. Default null.
|
26 |
+
*
|
27 |
+
* @return bool|mixed False on failure to retrieve contents or the cache
|
28 |
+
* contents on success
|
29 |
+
*/
|
30 |
+
public function get( $key, &$found = null ) {
|
31 |
+
$value = wp_cache_get( $key, $this->group, false, $found );
|
32 |
+
if ( is_array( $value ) && array_key_exists( 'data', $value ) ) {
|
33 |
+
// We know that we have set something in the cache.
|
34 |
+
$found = true;
|
35 |
+
|
36 |
+
return $value['data'];
|
37 |
+
} else {
|
38 |
+
$found = false;
|
39 |
+
|
40 |
+
return $value;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Saves the data to the cache.
|
46 |
+
*
|
47 |
+
* @param int|string $key The cache key to use for retrieval later.
|
48 |
+
* @param mixed $data The contents to store in the cache.
|
49 |
+
* @param int $expire Optional. When to expire the cache contents, in seconds.
|
50 |
+
* Default 0 (no expiration).
|
51 |
+
*
|
52 |
+
* @return bool False on failure, true on success
|
53 |
+
*/
|
54 |
+
public function set( $key, $data, $expire = 0 ) {
|
55 |
+
$keys = $this->get_keys();
|
56 |
+
if ( ! in_array( $key, $keys, true ) ) {
|
57 |
+
$keys[] = $key;
|
58 |
+
wp_cache_set( self::KEYS, $keys, $this->group );
|
59 |
+
}
|
60 |
+
|
61 |
+
// Save $value in an array. We need to do this because W3TC and Redis have bug with saving null.
|
62 |
+
return wp_cache_set( $key, [ 'data' => $data ], $this->group, $expire );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Removes the cache contents matching key and group.
|
67 |
+
*/
|
68 |
+
public function flush_group_cache() {
|
69 |
+
$keys = $this->get_keys();
|
70 |
+
|
71 |
+
foreach ( $keys as $key ) {
|
72 |
+
wp_cache_delete( $key, $this->group );
|
73 |
+
}
|
74 |
+
|
75 |
+
wp_cache_delete( self::KEYS, $this->group );
|
76 |
+
}
|
77 |
+
|
78 |
+
public function execute_and_cache( $key, $callback ) {
|
79 |
+
list( $result, $found ) = $this->get_with_found( $key );
|
80 |
+
if ( ! $found ) {
|
81 |
+
$result = $callback();
|
82 |
+
$this->set( $key, $result );
|
83 |
+
}
|
84 |
+
|
85 |
+
return $result;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param string $key
|
90 |
+
*
|
91 |
+
* @return array {
|
92 |
+
* @type mixed $result @see Return value of \wp_cache_get.
|
93 |
+
* @type bool $found @see `$found` argument of \wp_cache_get.
|
94 |
+
* }
|
95 |
+
*/
|
96 |
+
public function get_with_found( $key ) {
|
97 |
+
$found = false;
|
98 |
+
$result = $this->get( $key, $found );
|
99 |
+
|
100 |
+
return [ $result, $found ];
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Get stored group keys.
|
105 |
+
*
|
106 |
+
* @return array
|
107 |
+
*/
|
108 |
+
private function get_keys() {
|
109 |
+
$found = false;
|
110 |
+
$keys = wp_cache_get( self::KEYS, $this->group, false, $found );
|
111 |
+
if ( $found && is_array( $keys ) ) {
|
112 |
+
return $keys;
|
113 |
+
}
|
114 |
+
|
115 |
+
return [];
|
116 |
+
}
|
117 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-api.php
ADDED
@@ -0,0 +1,1292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use WPML\Core\Twig_Environment;
|
4 |
+
use WPML\Core\Twig_Loader_Filesystem;
|
5 |
+
use WPML\Core\Twig_Loader_String;
|
6 |
+
use WPML\Core\Twig_LoaderInterface;
|
7 |
+
use function WPML\Container\make;
|
8 |
+
|
9 |
+
class WPML_WP_API extends WPML_PHP_Functions {
|
10 |
+
/**
|
11 |
+
* @param string $file
|
12 |
+
* @param string $filename
|
13 |
+
*
|
14 |
+
* @return false | string
|
15 |
+
*/
|
16 |
+
public function get_file_mime_type( $file, $filename ) {
|
17 |
+
|
18 |
+
$mime_type = false;
|
19 |
+
if ( file_exists( $file ) ) {
|
20 |
+
$file_info = wp_check_filetype_and_ext( $file, $filename );
|
21 |
+
$mime_type = $file_info['type'];
|
22 |
+
}
|
23 |
+
|
24 |
+
return $mime_type;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Wrapper for \get_option
|
29 |
+
*
|
30 |
+
* @param string $option
|
31 |
+
* @param bool|false $default
|
32 |
+
*
|
33 |
+
* @return mixed
|
34 |
+
*/
|
35 |
+
public function get_option( $option, $default = false ) {
|
36 |
+
|
37 |
+
return get_option( $option, $default );
|
38 |
+
}
|
39 |
+
|
40 |
+
public function is_url( $value ) {
|
41 |
+
$regex = '((https?|ftp)\:\/\/)?'; // SCHEME
|
42 |
+
$regex .= '([a-z0-9+!*(),;?&=$_.-]+(\:[a-z0-9+!*(),;?&=$_.-]+)?@)?'; // User and Pass
|
43 |
+
$regex .= '([a-z0-9-.]*)\.([a-z]{2,3})'; // Host or IP
|
44 |
+
$regex .= '(\:[0-9]{2,5})?'; // Port
|
45 |
+
$regex .= '(\/([a-z0-9+$_-]\.?)+)*\/?'; // Path
|
46 |
+
$regex .= '(\?[a-z+&$_.-][a-z0-9;:@&%=+\/$_.-]*)?'; // GET Query
|
47 |
+
$regex .= '(#[a-z_.-][a-z0-9+$_.-]*)?'; // Anchor
|
48 |
+
|
49 |
+
return preg_match( "/^$regex$/", $value );
|
50 |
+
}
|
51 |
+
|
52 |
+
public function get_transient( $transient ) {
|
53 |
+
return get_transient( $transient );
|
54 |
+
}
|
55 |
+
|
56 |
+
public function set_transient( $transient, $value, $expiration = 0 ) {
|
57 |
+
set_transient( $transient, $value, $expiration );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param string $option
|
62 |
+
* @param mixed $value
|
63 |
+
* @param string|bool $autoload
|
64 |
+
*
|
65 |
+
* @return bool False if value was not updated and true if value was updated.
|
66 |
+
*/
|
67 |
+
public function update_option( $option, $value, $autoload = null ) {
|
68 |
+
return update_option( $option, $value, $autoload );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param string|int|WP_Post $ID Optional. Post ID or post object. Default empty.
|
73 |
+
*
|
74 |
+
* @return false|string
|
75 |
+
*/
|
76 |
+
public function get_post_status( $ID = '' ) {
|
77 |
+
return get_post_status( $ID );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Wrapper for \get_term_link
|
82 |
+
*
|
83 |
+
* @param object|int|string $term
|
84 |
+
* @param string $taxonomy
|
85 |
+
*
|
86 |
+
* @return string|WP_Error
|
87 |
+
*/
|
88 |
+
public function get_term_link( $term, $taxonomy = '' ) {
|
89 |
+
|
90 |
+
return get_term_link( $term, $taxonomy );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Wrapper for \get_term_by
|
95 |
+
*
|
96 |
+
* @param string $field
|
97 |
+
* @param string|int $value
|
98 |
+
* @param string $taxonomy
|
99 |
+
* @param string $output
|
100 |
+
* @param string $filter
|
101 |
+
*
|
102 |
+
* @return bool|WP_Term
|
103 |
+
*/
|
104 |
+
public function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
|
105 |
+
return get_term_by( $field, $value, $taxonomy, $output, $filter );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Wrapper for \add_submenu_page
|
110 |
+
*
|
111 |
+
* @param string $parent_slug
|
112 |
+
* @param string $page_title
|
113 |
+
* @param string $menu_title
|
114 |
+
* @param string $capability
|
115 |
+
* @param string $menu_slug
|
116 |
+
* @param array|string $function
|
117 |
+
*
|
118 |
+
* @return false|string
|
119 |
+
*/
|
120 |
+
public function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
|
121 |
+
|
122 |
+
return add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @param string $page_title
|
127 |
+
* @param string $menu_title
|
128 |
+
* @param string $capability
|
129 |
+
* @param string $menu_slug
|
130 |
+
* @param array|string $function
|
131 |
+
* @param string $icon_url
|
132 |
+
* @param null $position
|
133 |
+
*
|
134 |
+
* @return string
|
135 |
+
*/
|
136 |
+
public function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = null ) {
|
137 |
+
|
138 |
+
return add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Wrapper for \get_post_type_archive_link
|
143 |
+
*
|
144 |
+
* @param string $post_type
|
145 |
+
*
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function get_post_type_archive_link( $post_type ) {
|
149 |
+
|
150 |
+
return get_post_type_archive_link( $post_type );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Wrapper for \get_edit_post_link
|
155 |
+
*
|
156 |
+
* @param int $id
|
157 |
+
* @param string $context
|
158 |
+
*
|
159 |
+
* @return null|string|void
|
160 |
+
*/
|
161 |
+
public function get_edit_post_link( $id = 0, $context = 'display' ) {
|
162 |
+
|
163 |
+
return get_edit_post_link( $id, $context );
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Wrapper for get_the_title
|
168 |
+
*
|
169 |
+
* @param int|WP_Post $post
|
170 |
+
*
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function get_the_title( $post ) {
|
174 |
+
|
175 |
+
return get_the_title( $post );
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Wrapper for \get_day_link
|
180 |
+
*
|
181 |
+
* @param int $year
|
182 |
+
* @param int $month
|
183 |
+
* @param int $day
|
184 |
+
*
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function get_day_link( $year, $month, $day ) {
|
188 |
+
|
189 |
+
return get_day_link( $year, $month, $day );
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Wrapper for \get_month_link
|
194 |
+
*
|
195 |
+
* @param int $year
|
196 |
+
* @param int $month
|
197 |
+
*
|
198 |
+
* @return string
|
199 |
+
*/
|
200 |
+
public function get_month_link( $year, $month ) {
|
201 |
+
|
202 |
+
return get_month_link( $year, $month );
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Wrapper for \get_year_link
|
207 |
+
*
|
208 |
+
* @param int $year
|
209 |
+
*
|
210 |
+
* @return string
|
211 |
+
*/
|
212 |
+
public function get_year_link( $year ) {
|
213 |
+
|
214 |
+
return get_year_link( $year );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Wrapper for \get_author_posts_url
|
219 |
+
*
|
220 |
+
* @param int $author_id
|
221 |
+
* @param string $author_nicename
|
222 |
+
*
|
223 |
+
* @return string
|
224 |
+
*/
|
225 |
+
public function get_author_posts_url( $author_id, $author_nicename = '' ) {
|
226 |
+
|
227 |
+
return get_author_posts_url( $author_id, $author_nicename );
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Wrapper for \current_user_can
|
232 |
+
*
|
233 |
+
* @param string $capability
|
234 |
+
*
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
public function current_user_can( $capability ) {
|
238 |
+
|
239 |
+
return current_user_can( $capability );
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @param int $user_id
|
244 |
+
* @param string $key
|
245 |
+
* @param bool $single
|
246 |
+
*
|
247 |
+
* @return mixed
|
248 |
+
*/
|
249 |
+
public function get_user_meta( $user_id, $key = '', $single = false ) {
|
250 |
+
|
251 |
+
return get_user_meta( $user_id, $key, $single );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Wrapper for \get_post_type
|
256 |
+
*
|
257 |
+
* @param null|int|WP_Post $post
|
258 |
+
*
|
259 |
+
* @return false|string
|
260 |
+
*/
|
261 |
+
public function get_post_type( $post = null ) {
|
262 |
+
|
263 |
+
return get_post_type( $post );
|
264 |
+
}
|
265 |
+
|
266 |
+
public function is_archive() {
|
267 |
+
return is_archive();
|
268 |
+
}
|
269 |
+
|
270 |
+
public function is_front_page() {
|
271 |
+
return is_front_page();
|
272 |
+
}
|
273 |
+
|
274 |
+
public function is_home() {
|
275 |
+
return is_home();
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
|
280 |
+
*
|
281 |
+
* @return bool
|
282 |
+
*/
|
283 |
+
public function is_page( $page = '' ) {
|
284 |
+
return is_page( $page );
|
285 |
+
}
|
286 |
+
|
287 |
+
public function is_paged() {
|
288 |
+
return is_paged();
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @param string $post
|
293 |
+
*
|
294 |
+
* @return int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
|
295 |
+
*/
|
296 |
+
public function is_single( $post = '' ) {
|
297 |
+
return is_single( $post );
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* @param string|array $post_types
|
302 |
+
*
|
303 |
+
* @return bool
|
304 |
+
*/
|
305 |
+
public function is_singular( $post_types = '' ) {
|
306 |
+
return is_singular( $post_types );
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* @param int|WP_User $user
|
311 |
+
* @param string $capability
|
312 |
+
*
|
313 |
+
* @return bool
|
314 |
+
*/
|
315 |
+
public function user_can( $user, $capability ) {
|
316 |
+
|
317 |
+
return user_can( $user, $capability );
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Wrapper for add_filter
|
322 |
+
*
|
323 |
+
* @param string $tag
|
324 |
+
* @param callable $function_to_add
|
325 |
+
* @param int $priority
|
326 |
+
* @param int $accepted_args
|
327 |
+
*
|
328 |
+
* @return bool|mixed|true|void
|
329 |
+
*/
|
330 |
+
public function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
|
331 |
+
|
332 |
+
return add_filter( $tag, $function_to_add, $priority, $accepted_args );
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Wrapper for remove_filter
|
337 |
+
*
|
338 |
+
* @param string $tag
|
339 |
+
* @param callable $function_to_remove
|
340 |
+
* @param int $priority
|
341 |
+
*
|
342 |
+
* @return bool
|
343 |
+
*/
|
344 |
+
public function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
|
345 |
+
|
346 |
+
return remove_filter( $tag, $function_to_remove, $priority );
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Wrapper for current_filter
|
351 |
+
*/
|
352 |
+
public function current_filter() {
|
353 |
+
return current_filter();
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* @param null|string $tab
|
358 |
+
* @param null|string $hash
|
359 |
+
*
|
360 |
+
* @return string
|
361 |
+
*/
|
362 |
+
public function get_tm_url( $tab = null, $hash = null ) {
|
363 |
+
$tm_url = menu_page_url( $this->constant( 'WPML_TM_FOLDER' ) . '/menu/main.php', false );
|
364 |
+
|
365 |
+
$query_vars = array();
|
366 |
+
if ( $tab ) {
|
367 |
+
$query_vars['sm'] = $tab;
|
368 |
+
}
|
369 |
+
|
370 |
+
$tm_url = add_query_arg( $query_vars, $tm_url );
|
371 |
+
|
372 |
+
if ( $hash ) {
|
373 |
+
if ( strpos( $hash, '#' ) !== 0 ) {
|
374 |
+
$hash = '#' . $hash;
|
375 |
+
}
|
376 |
+
$tm_url .= $hash;
|
377 |
+
}
|
378 |
+
|
379 |
+
return $tm_url;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Wrapper for \is_admin()
|
384 |
+
*
|
385 |
+
* @return bool
|
386 |
+
*/
|
387 |
+
public function is_admin() {
|
388 |
+
|
389 |
+
return is_admin();
|
390 |
+
}
|
391 |
+
|
392 |
+
public function is_jobs_tab() {
|
393 |
+
return $this->is_tm_page( 'jobs' );
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* @param string|null $tab
|
398 |
+
* @param string|null $page_type
|
399 |
+
*
|
400 |
+
* @return bool
|
401 |
+
*/
|
402 |
+
public function is_tm_page( $tab = null, $page_type = 'management' ) {
|
403 |
+
if ( 'settings' === $page_type ) {
|
404 |
+
$page_suffix = '/menu/settings';
|
405 |
+
$default_tab = 'mcsetup';
|
406 |
+
} else {
|
407 |
+
$page_suffix = '/menu/main.php';
|
408 |
+
$default_tab = 'dashboard';
|
409 |
+
}
|
410 |
+
|
411 |
+
$result = is_admin()
|
412 |
+
&& isset( $_GET['page'] )
|
413 |
+
&& $_GET['page'] == $this->constant( 'WPML_TM_FOLDER' ) . $page_suffix;
|
414 |
+
|
415 |
+
if ( $tab ) {
|
416 |
+
if ( $tab == $default_tab && ! isset( $_GET['sm'] ) ) {
|
417 |
+
$result = $result && true;
|
418 |
+
} else {
|
419 |
+
$result = $result && isset( $_GET['sm'] ) && $_GET['sm'] == $tab;
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
return $result;
|
424 |
+
}
|
425 |
+
|
426 |
+
public function is_translation_queue_page() {
|
427 |
+
return is_admin() && isset( $_GET['page'] ) && $this->constant( 'WPML_TM_FOLDER' ) . '/menu/translations-queue.php' == $_GET['page'];
|
428 |
+
}
|
429 |
+
|
430 |
+
public function is_string_translation_page() {
|
431 |
+
return is_admin() && isset( $_GET['page'] ) && $this->constant( 'WPML_ST_FOLDER' ) . '/menu/string-translation.php' == $_GET['page'];
|
432 |
+
}
|
433 |
+
|
434 |
+
public function is_support_page() {
|
435 |
+
return $this->is_core_page( 'support.php' );
|
436 |
+
}
|
437 |
+
|
438 |
+
public function is_troubleshooting_page() {
|
439 |
+
return $this->is_core_page( 'troubleshooting.php' );
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* @param string $page
|
444 |
+
*
|
445 |
+
* @return bool
|
446 |
+
*/
|
447 |
+
public function is_core_page( $page = '' ) {
|
448 |
+
$result = is_admin()
|
449 |
+
&& isset( $_GET['page'] )
|
450 |
+
&& stripos( $_GET['page'], 'sitepress-multilingual-cms/menu/' . $page ) !== false;
|
451 |
+
return $result;
|
452 |
+
}
|
453 |
+
|
454 |
+
public function is_back_end() {
|
455 |
+
return is_admin() && ! $this->is_ajax() && ! $this->is_cron_job();
|
456 |
+
}
|
457 |
+
|
458 |
+
public function is_front_end() {
|
459 |
+
return ! is_admin() &&
|
460 |
+
! $this->is_ajax() &&
|
461 |
+
! $this->is_cron_job() &&
|
462 |
+
! wpml_is_rest_request();
|
463 |
+
}
|
464 |
+
|
465 |
+
public function is_ajax() {
|
466 |
+
|
467 |
+
$result = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
468 |
+
|
469 |
+
if ( $this->function_exists( 'wpml_is_ajax' ) ) {
|
470 |
+
/** @noinspection PhpUndefinedFunctionInspection */
|
471 |
+
$result = $result || wpml_is_ajax();
|
472 |
+
}
|
473 |
+
|
474 |
+
return $result;
|
475 |
+
}
|
476 |
+
|
477 |
+
public function is_cron_job() {
|
478 |
+
return defined( 'DOING_CRON' ) && DOING_CRON;
|
479 |
+
}
|
480 |
+
|
481 |
+
public function is_heartbeat() {
|
482 |
+
$action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING );
|
483 |
+
|
484 |
+
return 'heartbeat' === $action;
|
485 |
+
}
|
486 |
+
|
487 |
+
public function is_post_edit_page() {
|
488 |
+
global $pagenow;
|
489 |
+
|
490 |
+
return 'post.php' === $pagenow && isset( $_GET['action'], $_GET['post'] ) && 'edit' === filter_var( $_GET['action'] );
|
491 |
+
}
|
492 |
+
|
493 |
+
public function is_new_post_page() {
|
494 |
+
global $pagenow;
|
495 |
+
|
496 |
+
return 'post-new.php' === $pagenow;
|
497 |
+
}
|
498 |
+
|
499 |
+
public function is_term_edit_page() {
|
500 |
+
global $pagenow;
|
501 |
+
|
502 |
+
return 'term.php' === $pagenow || ( 'edit-tags.php' === $pagenow && isset( $_GET['action'] ) && 'edit' === filter_var( $_GET['action'] ) );
|
503 |
+
}
|
504 |
+
|
505 |
+
public function is_customize_page() {
|
506 |
+
global $pagenow;
|
507 |
+
|
508 |
+
return 'customize.php' === $pagenow;
|
509 |
+
}
|
510 |
+
|
511 |
+
public function is_comments_post_page() {
|
512 |
+
global $pagenow;
|
513 |
+
|
514 |
+
return 'wp-comments-post.php' === $pagenow;
|
515 |
+
}
|
516 |
+
|
517 |
+
public function is_plugins_page() {
|
518 |
+
global $pagenow;
|
519 |
+
|
520 |
+
return 'plugins.php' === $pagenow;
|
521 |
+
}
|
522 |
+
|
523 |
+
public function is_themes_page() {
|
524 |
+
global $pagenow;
|
525 |
+
|
526 |
+
return 'themes.php' === $pagenow;
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Wrapper for \is_feed that returns false if called before the loop
|
531 |
+
*
|
532 |
+
* @param string $feeds
|
533 |
+
*
|
534 |
+
* @return bool
|
535 |
+
*/
|
536 |
+
public function is_feed( $feeds = '' ) {
|
537 |
+
global $wp_query;
|
538 |
+
|
539 |
+
return isset( $wp_query ) && is_feed( $feeds );
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* Wrapper for \wp_update_term_count
|
544 |
+
*
|
545 |
+
* @param int[] $terms given by their term_taxonomy_ids
|
546 |
+
* @param string $taxonomy
|
547 |
+
* @param bool|false $do_deferred
|
548 |
+
*
|
549 |
+
* @return bool
|
550 |
+
*/
|
551 |
+
public function wp_update_term_count( $terms, $taxonomy, $do_deferred = false ) {
|
552 |
+
|
553 |
+
return wp_update_term_count( $terms, $taxonomy, $do_deferred );
|
554 |
+
}
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Wrapper for \get_taxonomy
|
558 |
+
*
|
559 |
+
* @param string $taxonomy
|
560 |
+
*
|
561 |
+
* @return bool|object
|
562 |
+
*/
|
563 |
+
public function get_taxonomy( $taxonomy ) {
|
564 |
+
|
565 |
+
return get_taxonomy( $taxonomy );
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* Wrapper for \wp_set_object_terms
|
570 |
+
*
|
571 |
+
* @param int $object_id The object to relate to.
|
572 |
+
* @param array|int|string $terms A single term slug, single term id, or array of either term slugs or ids.
|
573 |
+
* Will replace all existing related terms in this taxonomy.
|
574 |
+
* @param string $taxonomy The context in which to relate the term to the object.
|
575 |
+
* @param bool $append Optional. If false will delete difference of terms. Default false.
|
576 |
+
*
|
577 |
+
* @return array|WP_Error Affected Term IDs.
|
578 |
+
*/
|
579 |
+
public function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
580 |
+
|
581 |
+
return wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
|
582 |
+
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Wrapper for \get_post_types
|
586 |
+
*
|
587 |
+
* @param array $args
|
588 |
+
* @param string $output
|
589 |
+
* @param string $operator
|
590 |
+
*
|
591 |
+
* @return array
|
592 |
+
*/
|
593 |
+
public function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) {
|
594 |
+
|
595 |
+
return get_post_types( $args, $output, $operator );
|
596 |
+
}
|
597 |
+
|
598 |
+
public function wp_send_json( $response ) {
|
599 |
+
wp_send_json( $response );
|
600 |
+
|
601 |
+
return $response;
|
602 |
+
}
|
603 |
+
|
604 |
+
public function wp_send_json_success( $data = null ) {
|
605 |
+
wp_send_json_success( $data );
|
606 |
+
|
607 |
+
return $data;
|
608 |
+
}
|
609 |
+
|
610 |
+
public function wp_send_json_error( $data = null ) {
|
611 |
+
wp_send_json_error( $data );
|
612 |
+
|
613 |
+
return $data;
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Wrapper for \get_current_user_id
|
618 |
+
*
|
619 |
+
* @return int
|
620 |
+
*/
|
621 |
+
public function get_current_user_id() {
|
622 |
+
|
623 |
+
return get_current_user_id();
|
624 |
+
}
|
625 |
+
|
626 |
+
/**
|
627 |
+
* Wrapper for \get_post
|
628 |
+
*
|
629 |
+
* @param null|int|WP_Post $post
|
630 |
+
* @param string $output
|
631 |
+
* @param string $filter
|
632 |
+
*
|
633 |
+
* @return array|null|WP_Post
|
634 |
+
*/
|
635 |
+
public function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
|
636 |
+
|
637 |
+
return get_post( $post, $output, $filter );
|
638 |
+
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Wrapper for \get_post_meta
|
642 |
+
*
|
643 |
+
* @param int $post_id Post ID.
|
644 |
+
* @param string $key Optional. The meta key to retrieve. By default, returns
|
645 |
+
* data for all keys. Default empty.
|
646 |
+
* @param bool $single Optional. Whether to return a single value. Default false.
|
647 |
+
*
|
648 |
+
* @return mixed Will be an array if $single is false. Will be value of meta data
|
649 |
+
* field if $single is true.
|
650 |
+
*/
|
651 |
+
public function get_post_meta( $post_id, $key = '', $single = false ) {
|
652 |
+
|
653 |
+
return get_post_meta( $post_id, $key, $single );
|
654 |
+
}
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Wrapper for \update_post_meta
|
658 |
+
*
|
659 |
+
* @param int $post_id Post ID.
|
660 |
+
* @param string $key
|
661 |
+
* @param mixed $value
|
662 |
+
* @param mixed $prev_value
|
663 |
+
*
|
664 |
+
* @return int|bool
|
665 |
+
*/
|
666 |
+
public function update_post_meta(
|
667 |
+
$post_id,
|
668 |
+
$key,
|
669 |
+
$value,
|
670 |
+
$prev_value = ''
|
671 |
+
) {
|
672 |
+
|
673 |
+
return update_post_meta( $post_id, $key, $value, $prev_value );
|
674 |
+
}
|
675 |
+
|
676 |
+
/**
|
677 |
+
* Wrapper for add_post_meta
|
678 |
+
*
|
679 |
+
* @param int $post_id Post ID.
|
680 |
+
* @param string $meta_key Metadata name.
|
681 |
+
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
|
682 |
+
* @param bool $unique Optional. Whether the same key should not be added.
|
683 |
+
* Default false.
|
684 |
+
* @return int|false Meta ID on success, false on failure.
|
685 |
+
*/
|
686 |
+
public function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
|
687 |
+
return add_post_meta( $post_id, $meta_key, $meta_value, $unique );
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Wrapper for delete_post_meta
|
692 |
+
*
|
693 |
+
* @param int $post_id Post ID.
|
694 |
+
* @param string $meta_key Metadata name.
|
695 |
+
* @param mixed $meta_value Optional. Metadata value. Must be serializable if
|
696 |
+
* non-scalar. Default empty.
|
697 |
+
* @return bool True on success, false on failure.
|
698 |
+
*/
|
699 |
+
public function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
|
700 |
+
return delete_post_meta( $post_id, $meta_key, $meta_value );
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* Wrapper for \get_term_meta
|
705 |
+
*
|
706 |
+
* @param int $term_id
|
707 |
+
* @param string $key
|
708 |
+
* @param bool $single
|
709 |
+
*
|
710 |
+
* @return mixed
|
711 |
+
*/
|
712 |
+
public function get_term_meta( $term_id, $key = '', $single = false ) {
|
713 |
+
|
714 |
+
return get_term_meta( $term_id, $key, $single );
|
715 |
+
}
|
716 |
+
|
717 |
+
/**
|
718 |
+
* Wrapper for \get_permalink
|
719 |
+
*
|
720 |
+
* @param int $id
|
721 |
+
* @param bool|false $leavename
|
722 |
+
*
|
723 |
+
* @return bool|string
|
724 |
+
*/
|
725 |
+
public function get_permalink( $id = 0, $leavename = false ) {
|
726 |
+
|
727 |
+
return get_permalink( $id, $leavename );
|
728 |
+
}
|
729 |
+
|
730 |
+
/**
|
731 |
+
* Wrapper for \wp_mail
|
732 |
+
*
|
733 |
+
* @param string $to
|
734 |
+
* @param string $subject
|
735 |
+
* @param string $message
|
736 |
+
* @param string|array $headers
|
737 |
+
* @param array|array $attachments
|
738 |
+
*
|
739 |
+
* @return bool
|
740 |
+
*/
|
741 |
+
public function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
|
742 |
+
|
743 |
+
return wp_mail( $to, $subject, $message, $headers, $attachments );
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Wrapper for \get_post_custom
|
748 |
+
*
|
749 |
+
* @param int $post_id
|
750 |
+
*
|
751 |
+
* @return array
|
752 |
+
*/
|
753 |
+
public function get_post_custom( $post_id = 0 ) {
|
754 |
+
|
755 |
+
return get_post_custom( $post_id );
|
756 |
+
}
|
757 |
+
|
758 |
+
public function is_dashboard_tab() {
|
759 |
+
return $this->is_tm_page( 'dashboard' );
|
760 |
+
}
|
761 |
+
|
762 |
+
public function wp_safe_redirect( $redir_target, $status = 302 ) {
|
763 |
+
if ( wp_safe_redirect( $redir_target, $status, 'WPML' ) ) {
|
764 |
+
exit;
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
+
/**
|
769 |
+
* Wrapper for \load_textdomain
|
770 |
+
*
|
771 |
+
* @param string $domain
|
772 |
+
* @param string $mofile
|
773 |
+
*
|
774 |
+
* @return bool
|
775 |
+
*/
|
776 |
+
public function load_textdomain( $domain, $mofile ) {
|
777 |
+
|
778 |
+
return load_textdomain( $domain, $mofile );
|
779 |
+
}
|
780 |
+
|
781 |
+
/**
|
782 |
+
* Wrapper for \get_home_url
|
783 |
+
*
|
784 |
+
* @param null|int $blog_id
|
785 |
+
* @param string $path
|
786 |
+
* @param null|string $scheme
|
787 |
+
*
|
788 |
+
* @return string
|
789 |
+
*/
|
790 |
+
public function get_home_url(
|
791 |
+
$blog_id = null,
|
792 |
+
$path = '',
|
793 |
+
$scheme = null
|
794 |
+
) {
|
795 |
+
|
796 |
+
return get_home_url( $blog_id, $path, $scheme );
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Wrapper for \get_site_url
|
801 |
+
*
|
802 |
+
* @param null|int $blog_id
|
803 |
+
* @param string $path
|
804 |
+
* @param null|string $scheme
|
805 |
+
*
|
806 |
+
* @return string
|
807 |
+
*/
|
808 |
+
public function get_site_url(
|
809 |
+
$blog_id = null,
|
810 |
+
$path = '',
|
811 |
+
$scheme = null
|
812 |
+
) {
|
813 |
+
|
814 |
+
return get_site_url( $blog_id, $path, $scheme );
|
815 |
+
}
|
816 |
+
|
817 |
+
/**
|
818 |
+
* Wrapper for \is_multisite
|
819 |
+
*
|
820 |
+
* @return bool
|
821 |
+
*/
|
822 |
+
public function is_multisite() {
|
823 |
+
|
824 |
+
return is_multisite();
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Wrapper for \is_main_site
|
829 |
+
*
|
830 |
+
* @param null|int $site_id
|
831 |
+
*
|
832 |
+
* @return bool
|
833 |
+
*/
|
834 |
+
public function is_main_site( $site_id = null ) {
|
835 |
+
return is_main_site( $site_id );
|
836 |
+
}
|
837 |
+
|
838 |
+
/**
|
839 |
+
* Wrapper for \ms_is_switched
|
840 |
+
*
|
841 |
+
* @return bool
|
842 |
+
*/
|
843 |
+
public function ms_is_switched() {
|
844 |
+
|
845 |
+
return ms_is_switched();
|
846 |
+
}
|
847 |
+
|
848 |
+
/**
|
849 |
+
* Wrapper for \get_current_blog_id
|
850 |
+
*
|
851 |
+
* @return int
|
852 |
+
*/
|
853 |
+
public function get_current_blog_id() {
|
854 |
+
|
855 |
+
return get_current_blog_id();
|
856 |
+
}
|
857 |
+
|
858 |
+
/**
|
859 |
+
* Wrapper for wp_get_post_terms
|
860 |
+
*
|
861 |
+
* @param int $post_id
|
862 |
+
* @param string $taxonomy
|
863 |
+
* @param array $args
|
864 |
+
*
|
865 |
+
* @return array|WP_Error
|
866 |
+
*/
|
867 |
+
public function wp_get_post_terms(
|
868 |
+
$post_id = 0,
|
869 |
+
$taxonomy = 'post_tag',
|
870 |
+
$args = array()
|
871 |
+
) {
|
872 |
+
|
873 |
+
return wp_get_post_terms( $post_id, $taxonomy, $args );
|
874 |
+
}
|
875 |
+
|
876 |
+
/**
|
877 |
+
* Wrapper for get_taxonomies
|
878 |
+
*
|
879 |
+
* @param array $args
|
880 |
+
* @param string $output
|
881 |
+
* @param string $operator
|
882 |
+
*
|
883 |
+
* @return array
|
884 |
+
*/
|
885 |
+
public function get_taxonomies(
|
886 |
+
$args = array(),
|
887 |
+
$output = 'names',
|
888 |
+
$operator = 'and'
|
889 |
+
) {
|
890 |
+
|
891 |
+
return get_taxonomies( $args, $output, $operator );
|
892 |
+
}
|
893 |
+
|
894 |
+
/**
|
895 |
+
* Wrapper for \wp_get_theme
|
896 |
+
*
|
897 |
+
* @param string $stylesheet
|
898 |
+
* @param string $theme_root
|
899 |
+
*
|
900 |
+
* @return WP_Theme
|
901 |
+
*/
|
902 |
+
public function wp_get_theme( $stylesheet = null, $theme_root = null ) {
|
903 |
+
|
904 |
+
return wp_get_theme( $stylesheet, $theme_root );
|
905 |
+
}
|
906 |
+
|
907 |
+
/**
|
908 |
+
* Wrapper for \wp_get_theme->get('Name')
|
909 |
+
*
|
910 |
+
* @return string
|
911 |
+
*/
|
912 |
+
public function get_theme_name() {
|
913 |
+
|
914 |
+
return wp_get_theme()->get( 'Name' );
|
915 |
+
}
|
916 |
+
|
917 |
+
/**
|
918 |
+
* Wrapper for \wp_get_theme->parent_theme
|
919 |
+
*
|
920 |
+
* @return string
|
921 |
+
*/
|
922 |
+
public function get_theme_parent_name() {
|
923 |
+
|
924 |
+
return wp_get_theme()->parent_theme;
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Wrapper for \wp_get_theme->get('URI')
|
929 |
+
*
|
930 |
+
* @return string
|
931 |
+
*/
|
932 |
+
public function get_theme_URI() {
|
933 |
+
|
934 |
+
return wp_get_theme()->get( 'URI' );
|
935 |
+
}
|
936 |
+
|
937 |
+
/**
|
938 |
+
* Wrapper for \wp_get_theme->get('Author')
|
939 |
+
*
|
940 |
+
* @return string
|
941 |
+
*/
|
942 |
+
public function get_theme_author() {
|
943 |
+
|
944 |
+
return wp_get_theme()->get( 'Author' );
|
945 |
+
}
|
946 |
+
|
947 |
+
/**
|
948 |
+
* Wrapper for \wp_get_theme->get('AuthorURI')
|
949 |
+
*
|
950 |
+
* @return string
|
951 |
+
*/
|
952 |
+
public function get_theme_authorURI() {
|
953 |
+
|
954 |
+
return wp_get_theme()->get( 'AuthorURI' );
|
955 |
+
}
|
956 |
+
|
957 |
+
/**
|
958 |
+
* Wrapper for \wp_get_theme->get('Template')
|
959 |
+
*
|
960 |
+
* @return string
|
961 |
+
*/
|
962 |
+
public function get_theme_template() {
|
963 |
+
|
964 |
+
return wp_get_theme()->get( 'Template' );
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
* Wrapper for \wp_get_theme->get('Version')
|
969 |
+
*
|
970 |
+
* @return string
|
971 |
+
*/
|
972 |
+
public function get_theme_version() {
|
973 |
+
|
974 |
+
return wp_get_theme()->get( 'Version' );
|
975 |
+
}
|
976 |
+
|
977 |
+
/**
|
978 |
+
* Wrapper for \wp_get_theme->get('TextDomain')
|
979 |
+
*
|
980 |
+
* @return string
|
981 |
+
*/
|
982 |
+
public function get_theme_textdomain() {
|
983 |
+
|
984 |
+
return wp_get_theme()->get( 'TextDomain' );
|
985 |
+
}
|
986 |
+
|
987 |
+
/**
|
988 |
+
* Wrapper for \wp_get_theme->get('DomainPath')
|
989 |
+
*
|
990 |
+
* @return string
|
991 |
+
*/
|
992 |
+
public function get_theme_domainpath() {
|
993 |
+
|
994 |
+
return wp_get_theme()->get( 'DomainPath' );
|
995 |
+
}
|
996 |
+
|
997 |
+
/**
|
998 |
+
* Wrapper for \get_plugins()
|
999 |
+
*
|
1000 |
+
* @return array
|
1001 |
+
*/
|
1002 |
+
public function get_plugins() {
|
1003 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
1004 |
+
|
1005 |
+
return get_plugins();
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
/**
|
1009 |
+
* Wrapper for \get_post_custom_keys
|
1010 |
+
*
|
1011 |
+
* @param int $post_id
|
1012 |
+
*
|
1013 |
+
* @return array|void
|
1014 |
+
*/
|
1015 |
+
public function get_post_custom_keys( $post_id ) {
|
1016 |
+
|
1017 |
+
return get_post_custom_keys( $post_id );
|
1018 |
+
}
|
1019 |
+
|
1020 |
+
/**
|
1021 |
+
* Wrapper for \get_bloginfo
|
1022 |
+
*
|
1023 |
+
* @param string $show (optional)
|
1024 |
+
* @param string $filter (optional)
|
1025 |
+
*
|
1026 |
+
* @return string
|
1027 |
+
*/
|
1028 |
+
public function get_bloginfo( $show = '', $filter = 'raw' ) {
|
1029 |
+
|
1030 |
+
return get_bloginfo( $show, $filter );
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* Compare version in their "naked" form
|
1035 |
+
*
|
1036 |
+
* @see \WPML_WP_API::get_naked_version
|
1037 |
+
* @see \WPML_WP_API::version_compare
|
1038 |
+
* @see \version_compare
|
1039 |
+
*
|
1040 |
+
* @param string $version1
|
1041 |
+
* @param string $version2
|
1042 |
+
* @param null $operator
|
1043 |
+
*
|
1044 |
+
* @return mixed
|
1045 |
+
*/
|
1046 |
+
public function version_compare_naked( $version1, $version2, $operator = null ) {
|
1047 |
+
return $this->version_compare( $this->get_naked_version( $version1 ), $this->get_naked_version( $version2 ), $operator );
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
/**
|
1051 |
+
* Returns only the first 3 numeric elements of a version (assuming to use MAJOR.MINOR.PATCH
|
1052 |
+
*
|
1053 |
+
* @param string $version
|
1054 |
+
*
|
1055 |
+
* @return string
|
1056 |
+
*/
|
1057 |
+
public function get_naked_version( $version ) {
|
1058 |
+
|
1059 |
+
$elements = explode( '.', str_replace( '..', '.', preg_replace( '/([^0-9\.]+)/', '.$1.', str_replace( array( '-', '_', '+' ), '.', trim( $version ) ) ) ) );
|
1060 |
+
|
1061 |
+
$naked_elements = array( '0', '0', '0' );
|
1062 |
+
|
1063 |
+
$elements_count = 0;
|
1064 |
+
foreach ( $elements as $element ) {
|
1065 |
+
if ( $elements_count === 3 || ! is_numeric( $element ) ) {
|
1066 |
+
break;
|
1067 |
+
}
|
1068 |
+
$naked_elements[ $elements_count ] = $element;
|
1069 |
+
$elements_count ++;
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
return implode( $naked_elements );
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
public function has_filter( $tag, $function_to_check = false ) {
|
1076 |
+
return has_filter( $tag, $function_to_check );
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
public function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
|
1080 |
+
return add_action( $tag, $function_to_add, $priority, $accepted_args );
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
public function get_current_screen() {
|
1084 |
+
return get_current_screen();
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
/**
|
1088 |
+
* Wrapper for \get_query_var
|
1089 |
+
*
|
1090 |
+
* @param string $var
|
1091 |
+
* @param mixed $default
|
1092 |
+
*
|
1093 |
+
* @return mixed
|
1094 |
+
*/
|
1095 |
+
public function get_query_var( $var, $default = '' ) {
|
1096 |
+
return get_query_var( $var, $default );
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
/**
|
1100 |
+
* Wrapper for \get_queried_object
|
1101 |
+
*/
|
1102 |
+
public function get_queried_object() {
|
1103 |
+
return get_queried_object();
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
public function get_raw_post_data() {
|
1107 |
+
$raw_post_data = @file_get_contents( 'php://input' );
|
1108 |
+
if ( ! $raw_post_data && array_key_exists( 'HTTP_RAW_POST_DATA', $GLOBALS ) ) {
|
1109 |
+
$raw_post_data = $GLOBALS['HTTP_RAW_POST_DATA'];
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
return $raw_post_data;
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
public function wp_verify_nonce( $nonce, $action = -1 ) {
|
1116 |
+
return wp_verify_nonce( $nonce, $action );
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
/**
|
1120 |
+
* @param string $action
|
1121 |
+
*
|
1122 |
+
* @return int The number of times action hook $tag is fired.
|
1123 |
+
*/
|
1124 |
+
public function did_action( $action ) {
|
1125 |
+
return did_action( $action );
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* @return string
|
1130 |
+
*/
|
1131 |
+
public function current_action() {
|
1132 |
+
return current_action();
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
public function get_wp_post_types_global() {
|
1136 |
+
global $wp_post_types;
|
1137 |
+
return $wp_post_types;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
/**
|
1141 |
+
* @return wp_xmlrpc_server
|
1142 |
+
*/
|
1143 |
+
public function get_wp_xmlrpc_server() {
|
1144 |
+
global $wp_xmlrpc_server;
|
1145 |
+
|
1146 |
+
return $wp_xmlrpc_server;
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
/**
|
1150 |
+
* Wrapper for $wp_taxonomies global variable
|
1151 |
+
*/
|
1152 |
+
public function get_wp_taxonomies() {
|
1153 |
+
global $wp_taxonomies;
|
1154 |
+
|
1155 |
+
return $wp_taxonomies;
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* Wrapper for get_category_link function
|
1160 |
+
*
|
1161 |
+
* @param int $category_id
|
1162 |
+
*
|
1163 |
+
* @return string
|
1164 |
+
*/
|
1165 |
+
public function get_category_link( $category_id ) {
|
1166 |
+
return get_category_link( $category_id );
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
/**
|
1170 |
+
* Wrapper for is_wp_error function
|
1171 |
+
*
|
1172 |
+
* @param mixed $thing
|
1173 |
+
*
|
1174 |
+
* @return bool
|
1175 |
+
*/
|
1176 |
+
public function is_wp_error( $thing ) {
|
1177 |
+
return is_wp_error( $thing );
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* @param int $limit
|
1182 |
+
* @param bool $provide_object
|
1183 |
+
* @param bool $ignore_args
|
1184 |
+
*
|
1185 |
+
* @return array
|
1186 |
+
*/
|
1187 |
+
public function get_backtrace( $limit = 0, $provide_object = false, $ignore_args = true ) {
|
1188 |
+
$options = false;
|
1189 |
+
|
1190 |
+
if ( version_compare( $this->phpversion(), '5.3.6' ) < 0 ) {
|
1191 |
+
// Before 5.3.6, the only values recognized are TRUE or FALSE,
|
1192 |
+
// which are the same as setting or not setting the DEBUG_BACKTRACE_PROVIDE_OBJECT option respectively.
|
1193 |
+
$options = $provide_object;
|
1194 |
+
} else {
|
1195 |
+
// As of 5.3.6, 'options' parameter is a bitmask for the following options:
|
1196 |
+
if ( $provide_object ) {
|
1197 |
+
$options |= DEBUG_BACKTRACE_PROVIDE_OBJECT;
|
1198 |
+
}
|
1199 |
+
if ( $ignore_args ) {
|
1200 |
+
// phpcs:disable PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound -- It has a version check
|
1201 |
+
$options |= DEBUG_BACKTRACE_IGNORE_ARGS;
|
1202 |
+
// phpcs:enable PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
// phpcs:disable PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection -- It has a version check
|
1207 |
+
// phpcs:disable PHPCompatibility.FunctionUse.NewFunctionParameters.debug_backtrace_limitFound -- It has a version check
|
1208 |
+
if ( version_compare( $this->phpversion(), '5.4.0' ) >= 0 ) {
|
1209 |
+
$debug_backtrace = debug_backtrace( $options, $limit ); // add one item to include the current frame
|
1210 |
+
} elseif ( version_compare( $this->phpversion(), '5.2.4' ) >= 0 ) {
|
1211 |
+
// @link https://core.trac.wordpress.org/ticket/20953
|
1212 |
+
$debug_backtrace = debug_backtrace();
|
1213 |
+
} else {
|
1214 |
+
$debug_backtrace = debug_backtrace( $options );
|
1215 |
+
}
|
1216 |
+
// phpcs:enable PHPCompatibility.FunctionUse.NewFunctionParameters.debug_backtrace_limitFound
|
1217 |
+
// phpcs:enable PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
|
1218 |
+
|
1219 |
+
// Remove the current frame
|
1220 |
+
if ( $debug_backtrace ) {
|
1221 |
+
array_shift( $debug_backtrace );
|
1222 |
+
}
|
1223 |
+
return $debug_backtrace;
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
/**
|
1227 |
+
* @return WP_Filesystem_Direct
|
1228 |
+
*/
|
1229 |
+
public function get_wp_filesystem_direct() {
|
1230 |
+
global $wp_filesystem;
|
1231 |
+
|
1232 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
1233 |
+
|
1234 |
+
/**
|
1235 |
+
* We need to make sure that `WP_Filesystem` has been called
|
1236 |
+
* at least once so that some constants are defined with
|
1237 |
+
* default values.
|
1238 |
+
*/
|
1239 |
+
if ( ! $wp_filesystem ) {
|
1240 |
+
WP_Filesystem();
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
|
1244 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
|
1245 |
+
|
1246 |
+
return new WP_Filesystem_Direct( null );
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
/**
|
1250 |
+
* @return WPML_Notices
|
1251 |
+
*/
|
1252 |
+
public function get_admin_notices() {
|
1253 |
+
global $wpml_admin_notices;
|
1254 |
+
|
1255 |
+
if ( ! $wpml_admin_notices ) {
|
1256 |
+
$wpml_admin_notices = new WPML_Notices( new WPML_Notice_Render() );
|
1257 |
+
$wpml_admin_notices->init_hooks();
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
return $wpml_admin_notices;
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/**
|
1264 |
+
* @param Twig_LoaderInterface $loader
|
1265 |
+
* @param array $environment_args
|
1266 |
+
*
|
1267 |
+
* @return Twig_Environment
|
1268 |
+
*/
|
1269 |
+
public function get_twig_environment( $loader, $environment_args ) {
|
1270 |
+
return new Twig_Environment( $loader, $environment_args );
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
/**
|
1274 |
+
* @param array $template_paths
|
1275 |
+
*
|
1276 |
+
* @return Twig_Loader_Filesystem|\WPML\Core\Twig_LoaderInterface
|
1277 |
+
*/
|
1278 |
+
public function get_twig_loader_filesystem( $template_paths ) {
|
1279 |
+
return new Twig_Loader_Filesystem( $template_paths );
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
/**
|
1283 |
+
* @return \WPML\Core\Twig_Loader_String|\WPML\Core\Twig_LoaderInterface
|
1284 |
+
*/
|
1285 |
+
public function get_twig_loader_string() {
|
1286 |
+
return new Twig_Loader_String();
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
public function is_a_REST_request() {
|
1290 |
+
return defined( 'REST_REQUEST' ) && REST_REQUEST;
|
1291 |
+
}
|
1292 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-roles.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPML_WP_Roles {
|
4 |
+
const ROLES_ADMINISTRATOR = 'administrator';
|
5 |
+
const ROLES_EDITOR = 'editor';
|
6 |
+
const ROLES_CONTRIBUTOR = 'contributor';
|
7 |
+
const ROLES_SUBSCRIBER = 'subscriber';
|
8 |
+
|
9 |
+
const EDITOR_LEVEL = 'level_7';
|
10 |
+
const CONTRIBUTOR_LEVEL = 'level_1';
|
11 |
+
const SUBSCRIBER_LEVEL = 'level_0';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Returns an array of roles which meet the capability level set in \WPML_WP_Roles::EDITOR_LEVEL.
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public static function get_editor_roles() {
|
19 |
+
return self::get_roles_for_level( self::EDITOR_LEVEL, self::ROLES_EDITOR );
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns an array of roles which meet the capability level set in \WPML_WP_Roles::CONTRIBUTOR_LEVEL.
|
24 |
+
*
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public static function get_contributor_roles() {
|
28 |
+
return self::get_roles_for_level( self::CONTRIBUTOR_LEVEL, self::ROLES_CONTRIBUTOR );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns an array of roles wich meet the capability level set in \WPML_WP_Roles::SUBSCRIBER_LEVEL.
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public static function get_subscriber_roles() {
|
37 |
+
return self::get_roles_for_level( self::SUBSCRIBER_LEVEL, self::ROLES_SUBSCRIBER );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public static function get_roles_up_to_user_level( WP_User $user ) {
|
44 |
+
return self::get_roles_with_max_level( self::get_user_max_level( $user ), self::ROLES_SUBSCRIBER );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param WP_User $user
|
49 |
+
*
|
50 |
+
* @return int
|
51 |
+
*/
|
52 |
+
public static function get_user_max_level( WP_User $user ) {
|
53 |
+
return self::get_highest_level( $user->get_role_caps() );
|
54 |
+
}
|
55 |
+
|
56 |
+
public static function get_highest_level( array $capabilities ) {
|
57 |
+
$capabilitiesWithLevel = function ( $has, $cap ) {
|
58 |
+
return $has && strpos( $cap, 'level_' ) === 0;
|
59 |
+
};
|
60 |
+
$levelToNumber = function ( $cap ) {
|
61 |
+
return (int) substr( $cap, strlen( 'level_' ) );
|
62 |
+
};
|
63 |
+
|
64 |
+
return \wpml_collect( $capabilities )
|
65 |
+
->filter( $capabilitiesWithLevel )
|
66 |
+
->keys()
|
67 |
+
->map( $levelToNumber )
|
68 |
+
->sort()
|
69 |
+
->last();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* It returns a filtered array of roles.
|
74 |
+
*
|
75 |
+
* @param string $level The capability level that the role must meet.
|
76 |
+
* @param null|string $default The role ID to use as a default.
|
77 |
+
*
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
private static function get_roles_for_level( $level, $default = null ) {
|
81 |
+
return \wpml_collect( get_editable_roles() )
|
82 |
+
->filter(
|
83 |
+
function ( $role ) use ( $level ) {
|
84 |
+
return isset( $role['capabilities'][ $level ] ) && $role['capabilities'][ $level ];
|
85 |
+
}
|
86 |
+
)
|
87 |
+
->map( self::create_build_role_entity( $level, $default ) )
|
88 |
+
->values()
|
89 |
+
->toArray();
|
90 |
+
}
|
91 |
+
|
92 |
+
private static function get_roles_with_max_level( $level, $default = null ) {
|
93 |
+
$isRoleLowerThanLevel = function ( $role ) use ( $level ) {
|
94 |
+
return self::get_highest_level( $role['capabilities'] ) <= $level;
|
95 |
+
};
|
96 |
+
|
97 |
+
return \wpml_collect( get_editable_roles() )
|
98 |
+
->filter( $isRoleLowerThanLevel )
|
99 |
+
->map( self::create_build_role_entity( $level, $default ) )
|
100 |
+
->values()
|
101 |
+
->toArray();
|
102 |
+
}
|
103 |
+
|
104 |
+
private static function create_build_role_entity( $level, $default = null ) {
|
105 |
+
$is_default = self::create_is_default( $level, $default );
|
106 |
+
|
107 |
+
return function ( $role, $id ) use ( $is_default ) {
|
108 |
+
return [
|
109 |
+
'id' => $id,
|
110 |
+
'name' => $role['name'],
|
111 |
+
'default' => $is_default( $id ),
|
112 |
+
];
|
113 |
+
};
|
114 |
+
}
|
115 |
+
|
116 |
+
private static function create_is_default( $level, $default = null ) {
|
117 |
+
/**
|
118 |
+
* Filters the role ID to use as a default.
|
119 |
+
*
|
120 |
+
* @param string $default The role ID to use as a default.
|
121 |
+
* @param string $level The capability level required for this role (@see \WPML_WP_Roles::get_roles_for_level).
|
122 |
+
*
|
123 |
+
* @since 2.8.0
|
124 |
+
*/
|
125 |
+
$default = apply_filters( 'wpml_role_for_level_default', $default, $level );
|
126 |
+
return function ( $id ) use ( $default ) {
|
127 |
+
return $default && ( $default === $id );
|
128 |
+
};
|
129 |
+
}
|
130 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-taxonomy.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: bruce
|
5 |
+
* Date: 30/10/17
|
6 |
+
* Time: 9:09 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
class WPML_WP_Taxonomy implements IWPML_WP_Element_Type {
|
10 |
+
|
11 |
+
public static function get_linked_post_types( $taxonomy ) {
|
12 |
+
global $wp_taxonomies;
|
13 |
+
|
14 |
+
$post_types = array();
|
15 |
+
if ( isset( $wp_taxonomies[ $taxonomy ] ) && isset( $wp_taxonomies[ $taxonomy ]->object_type ) ) {
|
16 |
+
$post_types = $wp_taxonomies[ $taxonomy ]->object_type;
|
17 |
+
}
|
18 |
+
|
19 |
+
return $post_types;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param string $taxonomy
|
24 |
+
*
|
25 |
+
* @return false|WP_Taxonomy
|
26 |
+
*/
|
27 |
+
public function get_wp_element_type_object( $taxonomy ) {
|
28 |
+
return get_taxonomy( $taxonomy );
|
29 |
+
}
|
30 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/iwpml-wp-element-type.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface IWPML_WP_Element_Type {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @param string $element_name
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function get_wp_element_type_object( $element_name );
|
11 |
+
|
12 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/wpml-php-functions.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Wrapper class for basic PHP functions
|
5 |
+
*/
|
6 |
+
class WPML_PHP_Functions {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Wrapper around PHP constant defined
|
10 |
+
*
|
11 |
+
* @param string $constant_name
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
+
public function defined( $constant_name ) {
|
16 |
+
return defined( $constant_name );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Wrapper around PHP constant lookup
|
21 |
+
*
|
22 |
+
* @param string $constant_name
|
23 |
+
*
|
24 |
+
* @return string|int
|
25 |
+
*/
|
26 |
+
public function constant( $constant_name ) {
|
27 |
+
return $this->defined( $constant_name ) ? constant( $constant_name ) : null;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param string $function_name The function name, as a string.
|
32 |
+
*
|
33 |
+
* @return bool true if <i>function_name</i> exists and is a function, false otherwise.
|
34 |
+
* This function will return false for constructs, such as <b>include_once</b> and <b>echo</b>.
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
public function function_exists( $function_name ) {
|
38 |
+
return function_exists( $function_name );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param string $class_name The class name. The name is matched in a case-insensitive manner.
|
43 |
+
* @param bool $autoload [optional] Whether or not to call &link.autoload; by default.
|
44 |
+
*
|
45 |
+
* @return bool true if <i>class_name</i> is a defined class, false otherwise.
|
46 |
+
* @return bool
|
47 |
+
*/
|
48 |
+
public function class_exists( $class_name, $autoload = true ) {
|
49 |
+
return class_exists( $class_name, $autoload );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @param string $name The extension name
|
54 |
+
*
|
55 |
+
* @return bool true if the extension identified by <i>name</i> is loaded, false otherwise.
|
56 |
+
*/
|
57 |
+
public function extension_loaded( $name ) {
|
58 |
+
return extension_loaded( $name );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param string $string
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function mb_strtolower( $string ) {
|
67 |
+
if ( function_exists( 'mb_strtolower' ) ) {
|
68 |
+
return mb_strtolower( $string );
|
69 |
+
}
|
70 |
+
|
71 |
+
return strtolower( $string );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Wrapper for \phpversion()
|
76 |
+
*
|
77 |
+
* * @param string $extension (optional)
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function phpversion( $extension = null ) {
|
82 |
+
if ( defined( 'PHP_VERSION' ) ) {
|
83 |
+
return PHP_VERSION;
|
84 |
+
} else {
|
85 |
+
return phpversion( $extension );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Compares two "PHP-standardized" version number strings
|
91 |
+
*
|
92 |
+
* @see \WPML_WP_API::version_compare
|
93 |
+
*
|
94 |
+
* @param string $version1
|
95 |
+
* @param string $version2
|
96 |
+
* @param null $operator
|
97 |
+
*
|
98 |
+
* @return mixed
|
99 |
+
*/
|
100 |
+
public function version_compare( $version1, $version2, $operator = null ) {
|
101 |
+
return version_compare( $version1, $version2, $operator );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @param array $array
|
106 |
+
* @param int $sort_flags
|
107 |
+
*
|
108 |
+
* @return array
|
109 |
+
*/
|
110 |
+
public function array_unique( $array, $sort_flags = SORT_REGULAR ) {
|
111 |
+
return wpml_array_unique( $array, $sort_flags );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @param string $message
|
116 |
+
* @param int $message_type
|
117 |
+
* @param string $destination
|
118 |
+
* @param string $extra_headers
|
119 |
+
*
|
120 |
+
* @return bool
|
121 |
+
*/
|
122 |
+
public function error_log( $message, $message_type = null, $destination = null, $extra_headers = null ) {
|
123 |
+
return error_log( $message, $message_type, $destination, $extra_headers );
|
124 |
+
}
|
125 |
+
|
126 |
+
public function exit_php() {
|
127 |
+
exit();
|
128 |
+
}
|
129 |
+
}
|
addons/wpml-dependencies/lib/classes/wpml-wp/wpml-wp-post-type.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPML_WP_Post_Type implements IWPML_WP_Element_Type {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @param string $post_type
|
7 |
+
*
|
8 |
+
* @return null|WP_Post_Type
|
9 |
+
*/
|
10 |
+
public function get_wp_element_type_object( $post_type ) {
|
11 |
+
return get_post_type_object( $post_type );
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
addons/wpml-dependencies/lib/dist/js/notices/app.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";n.r(t);var r=function(e,t){var n=t.target,r=n.checked,o=n.dataset.id;return n.disabled=!0,function(e,t){var n=new FormData;return n.append("action","wpml_dismiss_notice"),n.append("id",e),n.append("dismiss",t),fetch(ajaxurl,{method:"POST",body:n}).then((function(e){if(!e.ok)throw new Error("Notice dismiss action has failed!.");return e.json()}))}(o,r).catch((function(t){e.log(t)})).finally((function(){n.disabled=!1}))};document.addEventListener("DOMContentLoaded",(function(){!function(e,t){e.addEventListener("change",(function(e){e.target.matches(".wpml_dismiss_notice")&&r(t,e)}))}(document,console)}))}]);
|
addons/wpml-dependencies/lib/inc/icl-admin-notifier.php
ADDED
@@ -0,0 +1,814 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package wpml-core
|
4 |
+
*/
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Admin Notifier Class
|
8 |
+
*
|
9 |
+
* Manages Admin Notices
|
10 |
+
*/
|
11 |
+
|
12 |
+
add_action( 'init', array( 'ICL_AdminNotifier', 'init' ) );
|
13 |
+
|
14 |
+
if ( ! class_exists( 'ICL_AdminNotifier' ) ) {
|
15 |
+
class ICL_AdminNotifier {
|
16 |
+
public static function init() {
|
17 |
+
if ( is_admin() ) {
|
18 |
+
add_action( 'wp_ajax_icl-hide-admin-message', array( __CLASS__, 'hide_message' ) );
|
19 |
+
add_action( 'wp_ajax_icl-show-admin-message', array( __CLASS__, 'show_message' ) );
|
20 |
+
if ( ! defined( 'DOING_AJAX' ) ) {
|
21 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_script' ) );
|
22 |
+
|
23 |
+
add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
|
24 |
+
}
|
25 |
+
|
26 |
+
add_filter( 'troubleshooting_js_data', array( __CLASS__, 'troubleshooting_js_data' ) );
|
27 |
+
add_action( 'wpml_troubleshooting_cleanup', array( __CLASS__, 'troubleshooting' ) );
|
28 |
+
add_action( 'wp_ajax_icl_restore_notifications', array( __CLASS__, 'restore_notifications' ) );
|
29 |
+
add_action( 'wp_ajax_icl_remove_notifications', array( __CLASS__, 'remove_notifications' ) );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
public static function add_script() {
|
34 |
+
wp_enqueue_script( 'icl-admin-notifier', WCML_WPML_DEPENDENCY_URL . '/res/js/icl-admin-notifier.js', array( 'jquery' ), '4.5.0' );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @param string $message
|
39 |
+
* @param string $type
|
40 |
+
*/
|
41 |
+
public static function add_instant_message( $message, $type = '' ) {
|
42 |
+
$messages = self::get_messages();
|
43 |
+
$messages['instant_messages'][] = array(
|
44 |
+
'text' => $message,
|
45 |
+
'type' => $type,
|
46 |
+
);
|
47 |
+
self::save_messages( $messages );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @param int $message_id
|
52 |
+
*
|
53 |
+
* @return bool|array
|
54 |
+
*/
|
55 |
+
public static function get_message( $message_id ) {
|
56 |
+
$messages = self::get_messages();
|
57 |
+
|
58 |
+
return isset( $messages['messages'][ $message_id ] ) ? $messages['messages'][ $message_id ] : false;
|
59 |
+
}
|
60 |
+
|
61 |
+
public static function message_id_exists( $message_id ) {
|
62 |
+
$message = self::get_message( $message_id );
|
63 |
+
|
64 |
+
return $message !== false;
|
65 |
+
}
|
66 |
+
|
67 |
+
private static function get_messages() {
|
68 |
+
$messages = get_option( 'icl_admin_messages' );
|
69 |
+
if ( ! ( isset( $messages ) && $messages != false ) ) {
|
70 |
+
return array(
|
71 |
+
'messages' => array(),
|
72 |
+
'instant_messages' => array(),
|
73 |
+
);
|
74 |
+
}
|
75 |
+
if ( ! isset( $messages['messages'] ) || ! isset( $messages['instant_messages'] ) ) {
|
76 |
+
$messages = array(
|
77 |
+
'messages' => array(),
|
78 |
+
'instant_messages' => array(),
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
return (array) $messages;
|
83 |
+
}
|
84 |
+
|
85 |
+
private static function save_messages( $messages ) {
|
86 |
+
if ( isset( $messages ) ) {
|
87 |
+
update_option( 'icl_admin_messages', (array) $messages );
|
88 |
+
}
|
89 |
+
self::get_messages();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @param array<mixed> $args
|
94 |
+
* Args attributes:
|
95 |
+
* string id - An unique identifier for the message
|
96 |
+
* string msg - The actual message
|
97 |
+
* string type (optional) - Any string: it will be used as css class fro the message container. A typical value is 'error', but the following strings can be also used: icl-admin-message-information, icl-admin-message-warning
|
98 |
+
* array classes (optional) - Display the notice only on specific url(s)
|
99 |
+
* bool hide (optional) - Enable the toggle link to permanently hide the notice
|
100 |
+
* bool hide_per_user (optional) - Enable the toggle link per user basis (overrides hide option)
|
101 |
+
* bool dismiss (optional) - Enable the dismiss option
|
102 |
+
* bool dismiss_per_user (optional) - Enable the dismiss option per user basis (overrides dismiss option)
|
103 |
+
* bool|string fallback_text (optional) - A message to show when the notice gets hidden
|
104 |
+
* bool|string fallback_type (optional) - The message type to use in the fallback message (@see $type)
|
105 |
+
* array fallback_classes (optional) - The message type to use in the fallback message (@see $type)
|
106 |
+
* bool|string group (optional) - A way to group messages: when displaying messages stored with this method, it's possible to filter them by group (@see ICL_AdminNotifier::displayMessages)
|
107 |
+
* bool admin_notice (optional) - Hook the rendering to the 'admin_notice' action
|
108 |
+
* string|array limit_to_page (optional) - Display the notice only on specific page(s)
|
109 |
+
*/
|
110 |
+
public static function add_message( $args ) {
|
111 |
+
$defaults = array(
|
112 |
+
'type' => '',
|
113 |
+
'classes' => array(),
|
114 |
+
'hide' => false,
|
115 |
+
'hide_per_user' => false,
|
116 |
+
'dismiss' => false,
|
117 |
+
'dismiss_per_user' => false,
|
118 |
+
'fallback_text' => false,
|
119 |
+
'fallback_type' => false,
|
120 |
+
'fallback_classes' => array(),
|
121 |
+
'group' => false,
|
122 |
+
'admin_notice' => false,
|
123 |
+
'hidden' => false,
|
124 |
+
'dismissed' => false,
|
125 |
+
'limit_to_page' => false,
|
126 |
+
'show_once' => false,
|
127 |
+
'capability' => '',
|
128 |
+
);
|
129 |
+
|
130 |
+
$args = self::sanitize_message_args( $args );
|
131 |
+
|
132 |
+
$args = array_merge( $defaults, $args );
|
133 |
+
|
134 |
+
$id = $args['id'];
|
135 |
+
|
136 |
+
// Check if existing message has been set as dismissed or hidden
|
137 |
+
if ( self::message_id_exists( $id ) ) {
|
138 |
+
$temp_msg = self::get_message( $id );
|
139 |
+
|
140 |
+
if ( $temp_msg ) {
|
141 |
+
$current_user_id = get_current_user_id();
|
142 |
+
$message_user_data = isset( $temp_msg['users'][ $current_user_id ] ) ? $temp_msg['users'][ $current_user_id ] : false;
|
143 |
+
|
144 |
+
if ( self::is_user_dismissed( $temp_msg ) || self::is_globally_dismissed( $temp_msg ) || self::is_globally_hidden( $temp_msg ) ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
if ( isset( $message_user_data['hidden'] ) ) {
|
149 |
+
$args['hidden'] = $message_user_data['hidden'] ? false : $args['hidden'];
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
$id = $id ? $id : md5( wp_json_encode( $args ) );
|
155 |
+
$messages = self::get_messages();
|
156 |
+
|
157 |
+
$message = array(
|
158 |
+
'id' => $id,
|
159 |
+
'text' => $args['text'],
|
160 |
+
'type' => $args['type'],
|
161 |
+
'classes' => $args['classes'],
|
162 |
+
'hide' => $args['hide'],
|
163 |
+
'hide_per_user' => $args['hide_per_user'],
|
164 |
+
'dismiss' => $args['dismiss'],
|
165 |
+
'dismiss_per_user' => $args['dismiss_per_user'],
|
166 |
+
'fallback_text' => $args['fallback_text'],
|
167 |
+
'fallback_type' => $args['fallback_type'],
|
168 |
+
'fallback_classes' => $args['classes'],
|
169 |
+
'group' => $args['group'],
|
170 |
+
'admin_notice' => $args['admin_notice'],
|
171 |
+
'hidden' => false,
|
172 |
+
'dismissed' => false,
|
173 |
+
'limit_to_page' => $args['limit_to_page'],
|
174 |
+
'show_once' => $args['show_once'],
|
175 |
+
'capability' => $args['capability'],
|
176 |
+
);
|
177 |
+
|
178 |
+
$message_md5 = md5( wp_json_encode( $message ) );
|
179 |
+
|
180 |
+
if ( isset( $messages['messages'][ $id ] ) ) {
|
181 |
+
$existing_message_md5 = md5( wp_json_encode( $messages['messages'][ $id ] ) );
|
182 |
+
if ( $message_md5 != $existing_message_md5 ) {
|
183 |
+
unset( $messages['messages'][ $id ] );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
if ( ! isset( $messages['messages'][ $id ] ) ) {
|
188 |
+
$messages['messages'][ $id ] = $message;
|
189 |
+
self::save_messages( $messages );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
public static function is_user_dismissed( $message_data ) {
|
194 |
+
$current_user_id = get_current_user_id();
|
195 |
+
$message_user_data = isset( $message_data['users'][ $current_user_id ] ) ? $message_data['users'][ $current_user_id ] : false;
|
196 |
+
|
197 |
+
return ! empty( $message_data['dismiss_per_user'] ) && ! empty( $message_user_data['dismissed'] );
|
198 |
+
}
|
199 |
+
|
200 |
+
public static function is_globally_dismissed( $message_data ) {
|
201 |
+
return ! empty( $message_data['dismiss'] ) && $message_data['dismissed'];
|
202 |
+
}
|
203 |
+
|
204 |
+
public static function is_globally_hidden( $message_data ) {
|
205 |
+
return ! empty( $message_data['hide'] ) && $message_data['hidden'];
|
206 |
+
}
|
207 |
+
|
208 |
+
public static function hide_message() {
|
209 |
+
|
210 |
+
$message_id = self::get_message_id();
|
211 |
+
$dismiss = isset( $_POST['dismiss'] ) ? $_POST['dismiss'] : false;
|
212 |
+
if ( ! self::message_id_exists( $message_id ) ) {
|
213 |
+
exit;
|
214 |
+
}
|
215 |
+
|
216 |
+
self::set_message_display( $message_id, false, 'hide', 'hidden', 'hide_per_user' );
|
217 |
+
|
218 |
+
if ( $dismiss ) {
|
219 |
+
self::set_message_display( $message_id, false, 'dismiss', 'dismissed', 'dismiss_per_user' );
|
220 |
+
} else {
|
221 |
+
$messages = self::get_messages();
|
222 |
+
$message = $messages['messages'][ $message_id ];
|
223 |
+
if ( $message && isset( $message['fallback_text'] ) && $message['fallback_text'] ) {
|
224 |
+
echo self::display_message( $message_id, $message['fallback_text'], $message['fallback_type'], $message['fallback_classes'], false, false, true, true );
|
225 |
+
}
|
226 |
+
}
|
227 |
+
exit;
|
228 |
+
}
|
229 |
+
|
230 |
+
public static function get_message_id() {
|
231 |
+
$message_id = '';
|
232 |
+
if ( isset( $_POST['icl-admin-message-id'] ) ) {
|
233 |
+
$message_id = filter_var( $_POST['icl-admin-message-id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
234 |
+
}
|
235 |
+
$message_id = $message_id ? $message_id : '';
|
236 |
+
$message_id = preg_replace( '/^icl-id-/', '', $message_id );
|
237 |
+
|
238 |
+
return $message_id;
|
239 |
+
}
|
240 |
+
|
241 |
+
public static function show_message() {
|
242 |
+
$message_id = self::get_message_id();
|
243 |
+
if ( ! self::message_id_exists( $message_id ) ) {
|
244 |
+
exit;
|
245 |
+
}
|
246 |
+
|
247 |
+
self::set_message_display( $message_id, true, 'hide', 'hidden', 'hide_per_user' );
|
248 |
+
|
249 |
+
$messages = self::get_messages();
|
250 |
+
$message = $messages['messages'][ $message_id ];
|
251 |
+
if ( $message ) {
|
252 |
+
echo self::display_message( $message_id, $message['text'], $message['type'], $message['classes'], $message['hide'] || $message['hide_per_user'], $message['dismiss'] || $message['dismiss_per_user'], true, true );
|
253 |
+
}
|
254 |
+
exit;
|
255 |
+
}
|
256 |
+
|
257 |
+
public static function engage_message() {
|
258 |
+
$message_id = self::get_message_id();
|
259 |
+
if ( ! self::message_id_exists( $message_id ) ) {
|
260 |
+
exit;
|
261 |
+
}
|
262 |
+
|
263 |
+
self::set_message_display( $message_id, true, 'dismiss', 'dismissed', 'dismiss_per_user' );
|
264 |
+
}
|
265 |
+
|
266 |
+
private static function set_message_display( $message_id, $show, $action, $action_past, $action_user ) {
|
267 |
+
if ( $message_id === null ) {
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
|
271 |
+
$messages = self::get_messages();
|
272 |
+
|
273 |
+
if ( ! isset( $messages['messages'][ $message_id ] ) ) {
|
274 |
+
return;
|
275 |
+
}
|
276 |
+
$message = $messages['messages'][ $message_id ];
|
277 |
+
$current_user_id = get_current_user_id();
|
278 |
+
if ( $message[ $action_user ] && $current_user_id ) {
|
279 |
+
$message['users'][ $current_user_id ][ $action_past ] = ! $show;
|
280 |
+
} elseif ( $message[ $action ] ) {
|
281 |
+
$message[ $action_past ] = ! $show;
|
282 |
+
}
|
283 |
+
$messages['messages'][ $message_id ] = $message;
|
284 |
+
self::save_messages( $messages );
|
285 |
+
}
|
286 |
+
|
287 |
+
public static function remove_message( $message_id ) {
|
288 |
+
if ( ! $message_id ) {
|
289 |
+
return false;
|
290 |
+
}
|
291 |
+
|
292 |
+
$messages = self::get_messages();
|
293 |
+
|
294 |
+
if ( ! isset( $messages['messages'][ $message_id ] ) ) {
|
295 |
+
return false;
|
296 |
+
}
|
297 |
+
|
298 |
+
unset( $messages['messages'][ $message_id ] );
|
299 |
+
|
300 |
+
self::save_messages( $messages );
|
301 |
+
|
302 |
+
return false;
|
303 |
+
}
|
304 |
+
|
305 |
+
public static function remove_message_group( $message_group ) {
|
306 |
+
if ( ! $message_group ) {
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
|
310 |
+
$all_messages = self::get_messages();
|
311 |
+
|
312 |
+
if ( ! isset( $all_messages['messages'] ) ) {
|
313 |
+
return;
|
314 |
+
}
|
315 |
+
|
316 |
+
$messages = $all_messages['messages'];
|
317 |
+
|
318 |
+
$ids_to_remove = array();
|
319 |
+
foreach ( $messages as $id => $message_data ) {
|
320 |
+
if ( isset( $message_data['group'] ) && $message_data['group'] == $message_group ) {
|
321 |
+
$ids_to_remove[] = $id;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
foreach ( $ids_to_remove as $id_to_remove ) {
|
326 |
+
self::remove_message( $id_to_remove );
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
public static function display_messages( $group = false ) {
|
331 |
+
if ( is_admin() ) {
|
332 |
+
$messages = self::get_messages();
|
333 |
+
|
334 |
+
foreach ( $messages['messages'] as $id => $msg ) {
|
335 |
+
if ( ! $group || ( isset( $msg['group'] ) && $msg['group'] == $group ) ) {
|
336 |
+
if ( isset( $msg['admin_notice'] ) && ! $msg['admin_notice'] ) {
|
337 |
+
if ( ! isset( $msg['capability'] ) || ( $msg['capability'] == '' ) || current_user_can( $msg['capability'] ) ) {
|
338 |
+
if ( array_key_exists( 'limit_to_page', $msg ) ) {
|
339 |
+
foreach ( $msg['limit_to_page'] as $page ) {
|
340 |
+
if ( array_key_exists( 'page', $_GET ) && $_GET['page'] === $page ) {
|
341 |
+
self::display_message( $id, $msg['text'], $msg['type'], $msg['classes'], $msg['hide'] || $msg['hide_per_user'], $msg['dismiss'] || $msg['dismiss_per_user'], true );
|
342 |
+
}
|
343 |
+
}
|
344 |
+
} else {
|
345 |
+
self::display_message( $id, $msg['text'], $msg['type'], $msg['classes'], $msg['hide'] || $msg['hide_per_user'], $msg['dismiss'] || $msg['dismiss_per_user'], true );
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
foreach ( $messages['instant_messages'] as $msg ) {
|
353 |
+
self::display_instant_message( $msg['text'], $msg['type'] );
|
354 |
+
}
|
355 |
+
// delete instant messages
|
356 |
+
$messages['instant_messages'] = array();
|
357 |
+
self::save_messages( $messages );
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* @deprecated deprecated @since version 3.2. Use ICL_AdminNotifier::display_message()
|
363 |
+
*
|
364 |
+
* @param bool $group
|
365 |
+
*/
|
366 |
+
public static function displayMessages( $group = false ) {
|
367 |
+
self::display_messages( $group );
|
368 |
+
}
|
369 |
+
|
370 |
+
public static function admin_notices() {
|
371 |
+
$messages = self::get_messages();
|
372 |
+
if ( isset( $messages['messages'] ) ) {
|
373 |
+
foreach ( $messages['messages'] as $id => $msg ) {
|
374 |
+
|
375 |
+
if ( isset( $msg['limit_to_page'] ) && $msg['limit_to_page'] ) {
|
376 |
+
if ( ! is_array( $msg['limit_to_page'] ) ) {
|
377 |
+
$msg['limit_to_page'] = (array) $msg['limit_to_page'];
|
378 |
+
}
|
379 |
+
if ( ! isset( $_REQUEST['page'] ) || ! in_array( $_REQUEST['page'], $msg['limit_to_page'] ) ) {
|
380 |
+
continue;
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
if ( $msg['admin_notice'] ) {
|
385 |
+
$current_user_id = get_current_user_id();
|
386 |
+
$display = true;
|
387 |
+
$display_fallback = false;
|
388 |
+
|
389 |
+
$message_user_data = isset( $msg['users'][ $current_user_id ] ) ? $msg['users'][ $current_user_id ] : false;
|
390 |
+
|
391 |
+
if ( $msg['dismiss_per_user'] && isset( $message_user_data['dismissed'] ) && $message_user_data['dismissed'] ) {
|
392 |
+
$display = false;
|
393 |
+
} elseif ( $msg['dismiss'] && isset( $msg['dismissed'] ) && $msg['dismissed'] ) {
|
394 |
+
$display = false;
|
395 |
+
}
|
396 |
+
|
397 |
+
if ( $display ) {
|
398 |
+
if ( $msg['hide_per_user'] && isset( $message_user_data['hidden'] ) && $message_user_data['hidden'] ) {
|
399 |
+
$display = false;
|
400 |
+
$display_fallback = $msg['fallback_text'];
|
401 |
+
} elseif ( $msg['hide'] && isset( $msg['hidden'] ) && $msg['hidden'] ) {
|
402 |
+
$display = false;
|
403 |
+
$display_fallback = $msg['fallback_text'];
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
+
$msg['classes'] = isset( $msg['classes'] ) ? $msg['classes'] : array();
|
408 |
+
$msg['fallback_classes'] = isset( $msg['fallback_classes'] ) ? $msg['fallback_classes'] : array();
|
409 |
+
if ( $display ) {
|
410 |
+
self::display_message( $id, $msg['text'], $msg['type'], $msg['classes'], $msg['hide'] || $msg['hide_per_user'], $msg['dismiss'] || $msg['dismiss_per_user'], true );
|
411 |
+
if ( $msg['show_once'] && ! $display_fallback ) {
|
412 |
+
self::remove_message( $msg['id'] );
|
413 |
+
}
|
414 |
+
} elseif ( $display_fallback ) {
|
415 |
+
self::display_message( $id, $msg['fallback_text'], $msg['fallback_type'], $msg['fallback_classes'], false, false, true );
|
416 |
+
if ( $msg['show_once'] ) {
|
417 |
+
self::remove_message( $msg['id'] );
|
418 |
+
}
|
419 |
+
}
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* @param string $id
|
427 |
+
* @param string $message
|
428 |
+
* @param string $type
|
429 |
+
* @param string|array $classes
|
430 |
+
* @param bool $hide
|
431 |
+
* @param bool $dismiss
|
432 |
+
* @param bool $admin_notice
|
433 |
+
* @param bool $echo
|
434 |
+
*
|
435 |
+
* @return string
|
436 |
+
*/
|
437 |
+
private static function display_message( $id, $message, $type = '', $classes = array(), $hide = true, $dismiss = false, $admin_notice = false, $echo = false ) {
|
438 |
+
$result = '';
|
439 |
+
$temp_classes = array();
|
440 |
+
if ( strpos( $type, 'icl-admin-message' ) ) {
|
441 |
+
$type = str_replace( 'icl-admin-message-', '', $type );
|
442 |
+
}
|
443 |
+
if ( $admin_notice ) {
|
444 |
+
$temp_classes[] = 'icl-admin-message';
|
445 |
+
}
|
446 |
+
$temp_types = explode( ' ', $type );
|
447 |
+
$temp_types = array_unique( $temp_types );
|
448 |
+
foreach ( $temp_types as $temp_type ) {
|
449 |
+
if ( $admin_notice ) {
|
450 |
+
$temp_classes[] = 'icl-admin-message-' . $temp_type;
|
451 |
+
}
|
452 |
+
$temp_classes[] = $temp_type;
|
453 |
+
}
|
454 |
+
|
455 |
+
if ( $classes ) {
|
456 |
+
if ( ! is_array( $classes ) ) {
|
457 |
+
$classes = explode( ' ', $classes );
|
458 |
+
}
|
459 |
+
foreach ( $classes as $class ) {
|
460 |
+
$temp_classes[] = $class;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
if ( $hide or $dismiss ) {
|
464 |
+
$temp_classes[] = 'otgs-is-dismissible';
|
465 |
+
}
|
466 |
+
|
467 |
+
$temp_classes = array_unique( $temp_classes );
|
468 |
+
|
469 |
+
$class = implode( ' ', $temp_classes );
|
470 |
+
|
471 |
+
$result .= '<div class="' . $class . '" id="icl-id-' . $id . '"';
|
472 |
+
|
473 |
+
if ( $hide ) {
|
474 |
+
$result .= ' data-hide-text="' . __( 'Hide', 'sitepress' ) . '" ';
|
475 |
+
}
|
476 |
+
$result .= '>';
|
477 |
+
|
478 |
+
$result .= '<p>' . self::sanitize_and_format_message( $message ) . '</p>';
|
479 |
+
if ( $hide ) {
|
480 |
+
$result .= ' <span class="icl-admin-message-hide notice-dismiss"><span class="screen-reader-text">' . __( 'Hide this notice.', 'sitepress' ) . '</span></span>';
|
481 |
+
}
|
482 |
+
|
483 |
+
if ( $dismiss ) {
|
484 |
+
$result .= ' <span class="icl-admin-message-dismiss notice-dismiss">';
|
485 |
+
$result .= '<span class="screen-reader-text"><input class="icl-admin-message-dismiss-check" type="checkbox" value="1" />';
|
486 |
+
$result .= __( 'Dismiss this notice.', 'sitepress' );
|
487 |
+
$result .= '</span></span>';
|
488 |
+
}
|
489 |
+
|
490 |
+
$result .= '</div>';
|
491 |
+
|
492 |
+
if ( ! $echo ) {
|
493 |
+
echo $result;
|
494 |
+
}
|
495 |
+
|
496 |
+
return $result;
|
497 |
+
}
|
498 |
+
|
499 |
+
public static function display_instant_message( $message, $type = 'information', $class = false, $return = false, $fadeout = false ) {
|
500 |
+
$classes = array();
|
501 |
+
if ( ! $class && $type ) {
|
502 |
+
$classes[] = $type;
|
503 |
+
}
|
504 |
+
$classes[] = 'instant-message';
|
505 |
+
$classes[] = 'message';
|
506 |
+
$classes[] = 'message-' . $type;
|
507 |
+
|
508 |
+
foreach ( $classes as $class ) {
|
509 |
+
$classes[] = 'icl-admin-' . $class;
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( $fadeout ) {
|
513 |
+
$classes[] = 'js-icl-fadeout';
|
514 |
+
}
|
515 |
+
|
516 |
+
$classes = array_unique( $classes );
|
517 |
+
|
518 |
+
if ( in_array( 'error', $classes ) ) {
|
519 |
+
$key = array_search( 'error', $classes );
|
520 |
+
if ( $key !== false ) {
|
521 |
+
unset( $classes[ $key ] );
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
$result = '<div class="' . implode( ' ', $classes ) . '">';
|
526 |
+
$result .= self::sanitize_and_format_message( $message );
|
527 |
+
$result .= '</div>';
|
528 |
+
|
529 |
+
if ( ! $return ) {
|
530 |
+
echo $result;
|
531 |
+
}
|
532 |
+
|
533 |
+
return $result;
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* @param array<mixed> $args
|
538 |
+
*
|
539 |
+
* @return mixed
|
540 |
+
*/
|
541 |
+
private static function sanitize_message_args( $args ) {
|
542 |
+
if ( isset( $args['msg'] ) ) {
|
543 |
+
$args['text'] = $args['msg'];
|
544 |
+
unset( $args['msg'] );
|
545 |
+
}
|
546 |
+
|
547 |
+
if ( isset( $args['fallback'] ) ) {
|
548 |
+
$args['fallback_message'] = $args['fallback'];
|
549 |
+
unset( $args['fallback'] );
|
550 |
+
}
|
551 |
+
|
552 |
+
if ( isset( $args['message_fallback'] ) ) {
|
553 |
+
$args['fallback_message'] = $args['message_fallback'];
|
554 |
+
unset( $args['message_fallback'] );
|
555 |
+
}
|
556 |
+
|
557 |
+
if ( isset( $args['type_fallback'] ) ) {
|
558 |
+
$args['fallback_type'] = $args['type_fallback'];
|
559 |
+
unset( $args['type_fallback'] );
|
560 |
+
|
561 |
+
return $args;
|
562 |
+
}
|
563 |
+
|
564 |
+
if ( ! isset( $args['classes'] ) ) {
|
565 |
+
$args['classes'] = array();
|
566 |
+
} elseif ( ! is_array( $args['classes'] ) ) {
|
567 |
+
$args['classes'] = (array) $args['classes'];
|
568 |
+
}
|
569 |
+
|
570 |
+
if ( ! isset( $args['limit_to_page'] ) ) {
|
571 |
+
$args['limit_to_page'] = array();
|
572 |
+
} elseif ( ! is_array( $args['limit_to_page'] ) ) {
|
573 |
+
$args['limit_to_page'] = (array) $args['limit_to_page'];
|
574 |
+
}
|
575 |
+
|
576 |
+
return $args;
|
577 |
+
}
|
578 |
+
|
579 |
+
static function troubleshooting_js_data( $data ) {
|
580 |
+
$data['nonce']['icl_restore_notifications'] = wp_create_nonce( 'icl_restore_notifications' );
|
581 |
+
$data['nonce']['icl_remove_notifications'] = wp_create_nonce( 'icl_remove_notifications' );
|
582 |
+
|
583 |
+
return $data;
|
584 |
+
}
|
585 |
+
|
586 |
+
static function has_hidden_messages() {
|
587 |
+
$messages = self::get_messages();
|
588 |
+
$no_hidden_messages = true;
|
589 |
+
foreach ( $messages as $group => $message_group ) {
|
590 |
+
foreach ( $message_group as $id => $msg ) {
|
591 |
+
if ( ( isset( $msg['hidden'] ) && $msg['hidden'] ) || ( isset( $msg['dismissed'] ) && $msg['dismissed'] ) ) {
|
592 |
+
$no_hidden_messages = false;
|
593 |
+
} else {
|
594 |
+
$current_user_id = get_current_user_id();
|
595 |
+
$message_user_data = isset( $msg['users'][ $current_user_id ] ) ? $msg['users'][ $current_user_id ] : false;
|
596 |
+
if ( $message_user_data && $msg['dismiss_per_user'] && isset( $message_user_data['dismissed'] ) && $message_user_data['dismissed'] ) {
|
597 |
+
$no_hidden_messages = false;
|
598 |
+
} elseif ( $message_user_data && $msg['dismiss'] && isset( $msg['dismissed'] ) && $msg['dismissed'] ) {
|
599 |
+
$no_hidden_messages = false;
|
600 |
+
}
|
601 |
+
|
602 |
+
if ( $no_hidden_messages ) {
|
603 |
+
if ( isset( $msg['hide_per_user'] ) && $msg['hide_per_user'] && isset( $message_user_data['hidden'] ) && $message_user_data['hidden'] ) {
|
604 |
+
$no_hidden_messages = ! $msg['fallback_text'];
|
605 |
+
} elseif ( $msg['hide'] && isset( $msg['hidden'] ) && $msg['hidden'] ) {
|
606 |
+
$no_hidden_messages = ! $msg['fallback_text'];
|
607 |
+
}
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
+
if ( ! $no_hidden_messages ) {
|
612 |
+
return true;
|
613 |
+
}
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
return false;
|
618 |
+
}
|
619 |
+
|
620 |
+
static function troubleshooting() {
|
621 |
+
?>
|
622 |
+
<h4><?php _e( 'Messages and notifications', 'sitepress' ); ?></h4>
|
623 |
+
<?php
|
624 |
+
if ( self::has_hidden_messages() ) {
|
625 |
+
|
626 |
+
?>
|
627 |
+
<p>
|
628 |
+
<input id="icl_restore_notifications" type="button" class="button-secondary" value="<?php echo __( 'Restore messages and notification', 'sitepress' ); ?>"/>
|
629 |
+
<br/>
|
630 |
+
<br/>
|
631 |
+
<input id="icl_restore_notifications_all_users" name="icl_restore_notifications_all_users" type="checkbox" value="1"/><label for="icl_restore_notifications_all_users"><?php echo __( 'Apply to all users', 'sitepress' ); ?></label>
|
632 |
+
<br/>
|
633 |
+
<br/>
|
634 |
+
<small style="margin-left:10px;"><?php echo __( 'Restore dismissed and hidden messages and notifications.', 'sitepress' ); ?></small>
|
635 |
+
</p>
|
636 |
+
<?php
|
637 |
+
}
|
638 |
+
?>
|
639 |
+
<p>
|
640 |
+
<input id="icl_remove_notifications" type="button" class="button-secondary" value="<?php echo __( 'Remove all messages and notifications', 'sitepress' ); ?>"/>
|
641 |
+
<br/>
|
642 |
+
<small style="margin-left:10px;"><?php echo __( 'Remove all messages and notifications, for all users.', 'sitepress' ); ?></small>
|
643 |
+
</p>
|
644 |
+
<?php
|
645 |
+
}
|
646 |
+
|
647 |
+
static function remove_notifications() {
|
648 |
+
self::save_messages( array() );
|
649 |
+
echo wp_json_encode(
|
650 |
+
array(
|
651 |
+
'errors' => 0,
|
652 |
+
'message' => __( 'Done', 'sitepress' ),
|
653 |
+
'cont' => 0,
|
654 |
+
'reload' => 1,
|
655 |
+
)
|
656 |
+
);
|
657 |
+
die();
|
658 |
+
}
|
659 |
+
|
660 |
+
static function restore_notifications() {
|
661 |
+
$all_users = $_POST['all_users'];
|
662 |
+
|
663 |
+
$messages = self::get_messages();
|
664 |
+
$dirty = 0;
|
665 |
+
foreach ( $messages as $group => $message_group ) {
|
666 |
+
foreach ( $message_group as $id => $msg ) {
|
667 |
+
if ( $msg['hidden'] ) {
|
668 |
+
$msg['hidden'] = false;
|
669 |
+
$dirty ++;
|
670 |
+
}
|
671 |
+
if ( $msg['dismissed'] ) {
|
672 |
+
$msg['dismissed'] = false;
|
673 |
+
$dirty ++;
|
674 |
+
}
|
675 |
+
|
676 |
+
$current_user_id = get_current_user_id();
|
677 |
+
foreach ( $msg['users'] as $user_id => $message_user_data ) {
|
678 |
+
if ( $current_user_id == $user_id || $all_users ) {
|
679 |
+
if ( $message_user_data['hidden'] ) {
|
680 |
+
$message_user_data['hidden'] = false;
|
681 |
+
$dirty ++;
|
682 |
+
}
|
683 |
+
if ( $message_user_data['dismissed'] ) {
|
684 |
+
$message_user_data['dismissed'] = false;
|
685 |
+
$dirty ++;
|
686 |
+
}
|
687 |
+
}
|
688 |
+
$msg['users'][ $user_id ] = $message_user_data;
|
689 |
+
}
|
690 |
+
|
691 |
+
$message_group[ $id ] = $msg;
|
692 |
+
}
|
693 |
+
$messages[ $group ] = $message_group;
|
694 |
+
}
|
695 |
+
|
696 |
+
if ( $dirty ) {
|
697 |
+
self::save_messages( $messages );
|
698 |
+
}
|
699 |
+
|
700 |
+
echo wp_json_encode(
|
701 |
+
array(
|
702 |
+
'errors' => 0,
|
703 |
+
'message' => __( 'Done', 'sitepress' ),
|
704 |
+
'cont' => $dirty,
|
705 |
+
'reload' => 1,
|
706 |
+
)
|
707 |
+
);
|
708 |
+
die();
|
709 |
+
}
|
710 |
+
|
711 |
+
/** Deprecated methods */
|
712 |
+
|
713 |
+
/**
|
714 |
+
* @param int $message_id
|
715 |
+
*
|
716 |
+
* @return bool
|
717 |
+
* @deprecated deprecated @since version 3.2. Use ICL_AdminNotifier::remove_message()
|
718 |
+
*
|
719 |
+
*/
|
720 |
+
public static function removeMessage( $message_id ) {
|
721 |
+
return self::remove_message( $message_id );
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* @deprecated deprecated @since version 3.2
|
726 |
+
*/
|
727 |
+
public static function hideMessage() {
|
728 |
+
self::hide_message();
|
729 |
+
}
|
730 |
+
|
731 |
+
/**
|
732 |
+
* @deprecated deprecated @since version 3.2
|
733 |
+
*
|
734 |
+
* @param string $message
|
735 |
+
* @param string $type
|
736 |
+
*/
|
737 |
+
public static function addInstantMessage( $message, $type = '' ) {
|
738 |
+
self::add_instant_message( $message, $type );
|
739 |
+
}
|
740 |
+
|
741 |
+
/**
|
742 |
+
* @deprecated deprecated @since version 3.2
|
743 |
+
*/
|
744 |
+
public static function addScript() {
|
745 |
+
self::add_script();
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* @deprecated deprecated @since version 3.2
|
750 |
+
*
|
751 |
+
* @param string $id An unique identifier for the message
|
752 |
+
* @param string $msg The actual message
|
753 |
+
* @param string $type (optional) Any string: it will be used as css class fro the message container. A typical value is 'error', but the following strings can be also used: icl-admin-message-information, icl-admin-message-warning
|
754 |
+
* @param bool $hide (optional) Enable the toggle link to permanently hide the notice
|
755 |
+
* @param bool $fallback_message (optional) A message to show when the notice gets hidden
|
756 |
+
* @param bool $fallback_type (optional) The message type to use in the fallback message (@see $type)
|
757 |
+
* @param bool $group (optional) A way to group messages: when displaying messages stored with this method, it's possible to filter them by group (@see ICL_AdminNotifier::displayMessages)
|
758 |
+
* @param bool $admin_notice (optional) Hook the rendering to the 'admin_notice' action
|
759 |
+
*/
|
760 |
+
public static function addMessage( $id, $msg, $type = '', $hide = true, $fallback_message = false, $fallback_type = false, $group = false, $admin_notice = false ) {
|
761 |
+
$args = array(
|
762 |
+
'id' => $id,
|
763 |
+
'msg' => $msg,
|
764 |
+
'type' => $type,
|
765 |
+
'hide' => $hide,
|
766 |
+
'message_fallback' => $fallback_message,
|
767 |
+
'fallback_type' => $fallback_type,
|
768 |
+
'group' => $group,
|
769 |
+
'admin_notice' => $admin_notice,
|
770 |
+
);
|
771 |
+
|
772 |
+
self::add_message( $args );
|
773 |
+
}
|
774 |
+
|
775 |
+
/**
|
776 |
+
* @param string $message
|
777 |
+
* @param string $type
|
778 |
+
* @param bool $class
|
779 |
+
* @param bool $return
|
780 |
+
*
|
781 |
+
* @return string
|
782 |
+
* @deprecated deprecated @since version 3.2. Use ICL_AdminNotifier::display_instant_message()
|
783 |
+
*
|
784 |
+
*/
|
785 |
+
public static function displayInstantMessage( $message, $type = 'information', $class = false, $return = false ) {
|
786 |
+
return self::display_instant_message( $message, $type, $class, $return );
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* @param string $message
|
791 |
+
*
|
792 |
+
* @return string
|
793 |
+
*/
|
794 |
+
public static function sanitize_and_format_message( $message ) {
|
795 |
+
// return preg_replace( '/`(.*?)`/s', '<pre>$1</pre>', stripslashes( $message ) );
|
796 |
+
$backticks_pattern = '|`(.*)`|U';
|
797 |
+
preg_match_all( $backticks_pattern, $message, $matches );
|
798 |
+
|
799 |
+
$sanitized_message = $message;
|
800 |
+
if ( 2 === count( $matches ) ) {
|
801 |
+
$matches_to_sanitize = $matches[1];
|
802 |
+
|
803 |
+
foreach ( $matches_to_sanitize as &$match_to_sanitize ) {
|
804 |
+
$match_to_sanitize = '<pre>' . esc_html( $match_to_sanitize ) . '</pre>';
|
805 |
+
}
|
806 |
+
unset( $match_to_sanitize );
|
807 |
+
|
808 |
+
$sanitized_message = str_replace( $matches[0], $matches_to_sanitize, $sanitized_message );
|
809 |
+
}
|
810 |
+
|
811 |
+
return stripslashes( $sanitized_message );
|
812 |
+
}
|
813 |
+
}
|
814 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Autoloader.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Autoloads Twig classes.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
|
20 |
+
*/
|
21 |
+
class Twig_Autoloader
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Registers Twig_Autoloader as an SPL autoloader.
|
25 |
+
*
|
26 |
+
* @param bool $prepend whether to prepend the autoloader or not
|
27 |
+
*/
|
28 |
+
public static function register($prepend = \false)
|
29 |
+
{
|
30 |
+
@\trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', \E_USER_DEPRECATED);
|
31 |
+
\spl_autoload_register([__CLASS__, 'autoload'], \true, $prepend);
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* Handles autoloading of classes.
|
35 |
+
*
|
36 |
+
* @param string $class a class name
|
37 |
+
*/
|
38 |
+
public static function autoload($class)
|
39 |
+
{
|
40 |
+
if (0 !== \strpos($class, 'Twig')) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
if (\is_file($file = __DIR__ . '/../' . \str_replace(['_', "\0"], ['/', ''], $class) . '.php')) {
|
44 |
+
require $file;
|
45 |
+
} elseif (\is_file($file = __DIR__ . '/../../src/' . \str_replace(['Twig\\', '\\', "\0"], ['', '/', ''], $class) . '.php')) {
|
46 |
+
require $file;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/BaseNodeVisitor.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\AbstractNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_BaseNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Filesystem.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Cache\FilesystemCache;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Cache\\FilesystemCache');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Cache_Filesystem extends \WPML\Core\Twig\Cache\FilesystemCache
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Null.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Cache\NullCache;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Cache\\NullCache');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Cache_Null extends \WPML\Core\Twig\Cache\NullCache
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/CacheInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Cache\CacheInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Cache\\CacheInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_CacheInterface extends \WPML\Core\Twig\Cache\CacheInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Compiler.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Compiler;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Compiler');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Compiler extends \WPML\Core\Twig\Compiler
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/CompilerInterface.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
/**
|
14 |
+
* Interface implemented by compiler classes.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*
|
18 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
19 |
+
*/
|
20 |
+
interface Twig_CompilerInterface
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Compiles a node.
|
24 |
+
*
|
25 |
+
* @return $this
|
26 |
+
*/
|
27 |
+
public function compile(\WPML\Core\Twig_NodeInterface $node);
|
28 |
+
/**
|
29 |
+
* Gets the current PHP code after compilation.
|
30 |
+
*
|
31 |
+
* @return string The PHP code
|
32 |
+
*/
|
33 |
+
public function getSource();
|
34 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/ContainerRuntimeLoader.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\RuntimeLoader\ContainerRuntimeLoader;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\RuntimeLoader\\ContainerRuntimeLoader');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_ContainerRuntimeLoader extends \WPML\Core\Twig\RuntimeLoader\ContainerRuntimeLoader
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Environment.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Environment;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Environment');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Environment extends \WPML\Core\Twig\Environment
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Error\Error;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Error\\Error');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Error extends \WPML\Core\Twig\Error\Error
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Loader.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Error\LoaderError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Error\\LoaderError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Error_Loader extends \WPML\Core\Twig\Error\LoaderError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Runtime.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Error\RuntimeError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Error\\RuntimeError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Error_Runtime extends \WPML\Core\Twig\Error\RuntimeError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Syntax.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Error\\SyntaxError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Error_Syntax extends \WPML\Core\Twig\Error\SyntaxError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExistsLoaderInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\ExistsLoaderInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\ExistsLoaderInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_ExistsLoaderInterface extends \WPML\Core\Twig\Loader\ExistsLoaderInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExpressionParser.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\ExpressionParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\ExpressionParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_ExpressionParser extends \WPML\Core\Twig\ExpressionParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\AbstractExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\AbstractExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension extends \WPML\Core\Twig\Extension\AbstractExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Core.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\CoreExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\CoreExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Core extends \WPML\Core\Twig\Extension\CoreExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Debug.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\DebugExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\DebugExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Debug extends \WPML\Core\Twig\Extension\DebugExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Escaper.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\EscaperExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\EscaperExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Escaper extends \WPML\Core\Twig\Extension\EscaperExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/GlobalsInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\GlobalsInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\GlobalsInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_GlobalsInterface extends \WPML\Core\Twig\Extension\GlobalsInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/InitRuntimeInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\InitRuntimeInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\InitRuntimeInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_InitRuntimeInterface extends \WPML\Core\Twig\Extension\InitRuntimeInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Optimizer.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\OptimizerExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\OptimizerExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Optimizer extends \WPML\Core\Twig\Extension\OptimizerExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Profiler.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\ProfilerExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\ProfilerExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Profiler extends \WPML\Core\Twig\Extension\ProfilerExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Sandbox.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\SandboxExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\SandboxExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Sandbox extends \WPML\Core\Twig\Extension\SandboxExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Staging.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\StagingExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\StagingExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_Staging extends \WPML\Core\Twig\Extension\StagingExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/StringLoader.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\StringLoaderExtension;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\StringLoaderExtension');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Extension_StringLoader extends \WPML\Core\Twig\Extension\StringLoaderExtension
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExtensionInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Extension\\ExtensionInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_ExtensionInterface extends \WPML\Core\Twig\Extension\ExtensionInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FactoryRuntimeLoader.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\RuntimeLoader\FactoryRuntimeLoader;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\RuntimeLoader\\FactoryRuntimeLoader');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_FactoryRuntimeLoader extends \WPML\Core\Twig\RuntimeLoader\FactoryRuntimeLoader
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FileExtensionEscapingStrategy.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\FileExtensionEscapingStrategy;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\FileExtensionEscapingStrategy');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_FileExtensionEscapingStrategy extends \WPML\Core\Twig\FileExtensionEscapingStrategy
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Node\Node;
|
14 |
+
@\trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFilter instead.', \E_USER_DEPRECATED);
|
15 |
+
/**
|
16 |
+
* Represents a template filter.
|
17 |
+
*
|
18 |
+
* Use \Twig\TwigFilter instead.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
abstract class Twig_Filter implements \WPML\Core\Twig_FilterInterface, \WPML\Core\Twig_FilterCallableInterface
|
25 |
+
{
|
26 |
+
protected $options;
|
27 |
+
protected $arguments = [];
|
28 |
+
public function __construct(array $options = [])
|
29 |
+
{
|
30 |
+
$this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'pre_escape' => null, 'preserves_safety' => null, 'callable' => null], $options);
|
31 |
+
}
|
32 |
+
public function setArguments($arguments)
|
33 |
+
{
|
34 |
+
$this->arguments = $arguments;
|
35 |
+
}
|
36 |
+
public function getArguments()
|
37 |
+
{
|
38 |
+
return $this->arguments;
|
39 |
+
}
|
40 |
+
public function needsEnvironment()
|
41 |
+
{
|
42 |
+
return $this->options['needs_environment'];
|
43 |
+
}
|
44 |
+
public function needsContext()
|
45 |
+
{
|
46 |
+
return $this->options['needs_context'];
|
47 |
+
}
|
48 |
+
public function getSafe(\WPML\Core\Twig\Node\Node $filterArgs)
|
49 |
+
{
|
50 |
+
if (isset($this->options['is_safe'])) {
|
51 |
+
return $this->options['is_safe'];
|
52 |
+
}
|
53 |
+
if (isset($this->options['is_safe_callback'])) {
|
54 |
+
return \call_user_func($this->options['is_safe_callback'], $filterArgs);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
public function getPreservesSafety()
|
58 |
+
{
|
59 |
+
return $this->options['preserves_safety'];
|
60 |
+
}
|
61 |
+
public function getPreEscape()
|
62 |
+
{
|
63 |
+
return $this->options['pre_escape'];
|
64 |
+
}
|
65 |
+
public function getCallable()
|
66 |
+
{
|
67 |
+
return $this->options['callable'];
|
68 |
+
}
|
69 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Function.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFilter instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a function template filter.
|
16 |
+
*
|
17 |
+
* Use \Twig\TwigFilter instead.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
+
*/
|
23 |
+
class Twig_Filter_Function extends \WPML\Core\Twig_Filter
|
24 |
+
{
|
25 |
+
protected $function;
|
26 |
+
public function __construct($function, array $options = [])
|
27 |
+
{
|
28 |
+
$options['callable'] = $function;
|
29 |
+
parent::__construct($options);
|
30 |
+
$this->function = $function;
|
31 |
+
}
|
32 |
+
public function compile()
|
33 |
+
{
|
34 |
+
return $this->function;
|
35 |
+
}
|
36 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Method.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
14 |
+
@\trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFilter instead.', \E_USER_DEPRECATED);
|
15 |
+
/**
|
16 |
+
* Represents a method template filter.
|
17 |
+
*
|
18 |
+
* Use \Twig\TwigFilter instead.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
class Twig_Filter_Method extends \WPML\Core\Twig_Filter
|
25 |
+
{
|
26 |
+
protected $extension;
|
27 |
+
protected $method;
|
28 |
+
public function __construct(\WPML\Core\Twig\Extension\ExtensionInterface $extension, $method, array $options = [])
|
29 |
+
{
|
30 |
+
$options['callable'] = [$extension, $method];
|
31 |
+
parent::__construct($options);
|
32 |
+
$this->extension = $extension;
|
33 |
+
$this->method = $method;
|
34 |
+
}
|
35 |
+
public function compile()
|
36 |
+
{
|
37 |
+
return \sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method);
|
38 |
+
}
|
39 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Node.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFilter instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a template filter as a node.
|
16 |
+
*
|
17 |
+
* Use \Twig\TwigFilter instead.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
+
*/
|
23 |
+
class Twig_Filter_Node extends \WPML\Core\Twig_Filter
|
24 |
+
{
|
25 |
+
protected $class;
|
26 |
+
public function __construct($class, array $options = [])
|
27 |
+
{
|
28 |
+
parent::__construct($options);
|
29 |
+
$this->class = $class;
|
30 |
+
}
|
31 |
+
public function getClass()
|
32 |
+
{
|
33 |
+
return $this->class;
|
34 |
+
}
|
35 |
+
public function compile()
|
36 |
+
{
|
37 |
+
}
|
38 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterCallableInterface.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
/**
|
14 |
+
* Represents a callable template filter.
|
15 |
+
*
|
16 |
+
* Use \Twig\TwigFilter instead.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*
|
20 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
21 |
+
*/
|
22 |
+
interface Twig_FilterCallableInterface
|
23 |
+
{
|
24 |
+
public function getCallable();
|
25 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterInterface.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Node\Node;
|
14 |
+
/**
|
15 |
+
* Represents a template filter.
|
16 |
+
*
|
17 |
+
* Use \Twig\TwigFilter instead.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
+
*/
|
23 |
+
interface Twig_FilterInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Compiles a filter.
|
27 |
+
*
|
28 |
+
* @return string The PHP code for the filter
|
29 |
+
*/
|
30 |
+
public function compile();
|
31 |
+
public function needsEnvironment();
|
32 |
+
public function needsContext();
|
33 |
+
public function getSafe(\WPML\Core\Twig\Node\Node $filterArgs);
|
34 |
+
public function getPreservesSafety();
|
35 |
+
public function getPreEscape();
|
36 |
+
public function setArguments($arguments);
|
37 |
+
public function getArguments();
|
38 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Node\Node;
|
14 |
+
@\trigger_error('The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFunction instead.', \E_USER_DEPRECATED);
|
15 |
+
/**
|
16 |
+
* Represents a template function.
|
17 |
+
*
|
18 |
+
* Use \Twig\TwigFunction instead.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
abstract class Twig_Function implements \WPML\Core\Twig_FunctionInterface, \WPML\Core\Twig_FunctionCallableInterface
|
25 |
+
{
|
26 |
+
protected $options;
|
27 |
+
protected $arguments = [];
|
28 |
+
public function __construct(array $options = [])
|
29 |
+
{
|
30 |
+
$this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'callable' => null], $options);
|
31 |
+
}
|
32 |
+
public function setArguments($arguments)
|
33 |
+
{
|
34 |
+
$this->arguments = $arguments;
|
35 |
+
}
|
36 |
+
public function getArguments()
|
37 |
+
{
|
38 |
+
return $this->arguments;
|
39 |
+
}
|
40 |
+
public function needsEnvironment()
|
41 |
+
{
|
42 |
+
return $this->options['needs_environment'];
|
43 |
+
}
|
44 |
+
public function needsContext()
|
45 |
+
{
|
46 |
+
return $this->options['needs_context'];
|
47 |
+
}
|
48 |
+
public function getSafe(\WPML\Core\Twig\Node\Node $functionArgs)
|
49 |
+
{
|
50 |
+
if (isset($this->options['is_safe'])) {
|
51 |
+
return $this->options['is_safe'];
|
52 |
+
}
|
53 |
+
if (isset($this->options['is_safe_callback'])) {
|
54 |
+
return \call_user_func($this->options['is_safe_callback'], $functionArgs);
|
55 |
+
}
|
56 |
+
return [];
|
57 |
+
}
|
58 |
+
public function getCallable()
|
59 |
+
{
|
60 |
+
return $this->options['callable'];
|
61 |
+
}
|
62 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Function.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
* (c) Arnaud Le Blanc
|
10 |
+
*
|
11 |
+
* For the full copyright and license information, please view the LICENSE
|
12 |
+
* file that was distributed with this source code.
|
13 |
+
*/
|
14 |
+
@\trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFunction instead.', \E_USER_DEPRECATED);
|
15 |
+
/**
|
16 |
+
* Represents a function template function.
|
17 |
+
*
|
18 |
+
* Use \Twig\TwigFunction instead.
|
19 |
+
*
|
20 |
+
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
class Twig_Function_Function extends \WPML\Core\Twig_Function
|
25 |
+
{
|
26 |
+
protected $function;
|
27 |
+
public function __construct($function, array $options = [])
|
28 |
+
{
|
29 |
+
$options['callable'] = $function;
|
30 |
+
parent::__construct($options);
|
31 |
+
$this->function = $function;
|
32 |
+
}
|
33 |
+
public function compile()
|
34 |
+
{
|
35 |
+
return $this->function;
|
36 |
+
}
|
37 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Method.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
* (c) Arnaud Le Blanc
|
10 |
+
*
|
11 |
+
* For the full copyright and license information, please view the LICENSE
|
12 |
+
* file that was distributed with this source code.
|
13 |
+
*/
|
14 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
15 |
+
@\trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFunction instead.', \E_USER_DEPRECATED);
|
16 |
+
/**
|
17 |
+
* Represents a method template function.
|
18 |
+
*
|
19 |
+
* Use \Twig\TwigFunction instead.
|
20 |
+
*
|
21 |
+
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
22 |
+
*
|
23 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
24 |
+
*/
|
25 |
+
class Twig_Function_Method extends \WPML\Core\Twig_Function
|
26 |
+
{
|
27 |
+
protected $extension;
|
28 |
+
protected $method;
|
29 |
+
public function __construct(\WPML\Core\Twig\Extension\ExtensionInterface $extension, $method, array $options = [])
|
30 |
+
{
|
31 |
+
$options['callable'] = [$extension, $method];
|
32 |
+
parent::__construct($options);
|
33 |
+
$this->extension = $extension;
|
34 |
+
$this->method = $method;
|
35 |
+
}
|
36 |
+
public function compile()
|
37 |
+
{
|
38 |
+
return \sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method);
|
39 |
+
}
|
40 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Node.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigFunction instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a template function as a node.
|
16 |
+
*
|
17 |
+
* Use \Twig\TwigFunction instead.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
22 |
+
*/
|
23 |
+
class Twig_Function_Node extends \WPML\Core\Twig_Function
|
24 |
+
{
|
25 |
+
protected $class;
|
26 |
+
public function __construct($class, array $options = [])
|
27 |
+
{
|
28 |
+
parent::__construct($options);
|
29 |
+
$this->class = $class;
|
30 |
+
}
|
31 |
+
public function getClass()
|
32 |
+
{
|
33 |
+
return $this->class;
|
34 |
+
}
|
35 |
+
public function compile()
|
36 |
+
{
|
37 |
+
}
|
38 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionCallableInterface.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
/**
|
14 |
+
* Represents a callable template function.
|
15 |
+
*
|
16 |
+
* Use \Twig\TwigFunction instead.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*
|
20 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
21 |
+
*/
|
22 |
+
interface Twig_FunctionCallableInterface
|
23 |
+
{
|
24 |
+
public function getCallable();
|
25 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionInterface.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
* (c) Arnaud Le Blanc
|
10 |
+
*
|
11 |
+
* For the full copyright and license information, please view the LICENSE
|
12 |
+
* file that was distributed with this source code.
|
13 |
+
*/
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Represents a template function.
|
17 |
+
*
|
18 |
+
* Use \Twig\TwigFunction instead.
|
19 |
+
*
|
20 |
+
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
interface Twig_FunctionInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Compiles a function.
|
28 |
+
*
|
29 |
+
* @return string The PHP code for the function
|
30 |
+
*/
|
31 |
+
public function compile();
|
32 |
+
public function needsEnvironment();
|
33 |
+
public function needsContext();
|
34 |
+
public function getSafe(\WPML\Core\Twig\Node\Node $filterArgs);
|
35 |
+
public function setArguments($arguments);
|
36 |
+
public function getArguments();
|
37 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Lexer.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Lexer;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Lexer');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Lexer extends \WPML\Core\Twig\Lexer
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/LexerInterface.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
+
use WPML\Core\Twig\Source;
|
15 |
+
use WPML\Core\Twig\TokenStream;
|
16 |
+
/**
|
17 |
+
* Interface implemented by lexer classes.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
22 |
+
*/
|
23 |
+
interface Twig_LexerInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Tokenizes a source code.
|
27 |
+
*
|
28 |
+
* @param string|Source $code The source code
|
29 |
+
* @param string $name A unique identifier for the source code
|
30 |
+
*
|
31 |
+
* @return TokenStream
|
32 |
+
*
|
33 |
+
* @throws SyntaxError When the code is syntactically wrong
|
34 |
+
*/
|
35 |
+
public function tokenize($code, $name = null);
|
36 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Array.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\ArrayLoader;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\ArrayLoader');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Loader_Array extends \WPML\Core\Twig\Loader\ArrayLoader
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Chain.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\ChainLoader;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\ChainLoader');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Loader_Chain extends \WPML\Core\Twig\Loader\ChainLoader
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Filesystem.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\FilesystemLoader;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\FilesystemLoader');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Loader_Filesystem extends \WPML\Core\Twig\Loader\FilesystemLoader
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/String.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Loader\ExistsLoaderInterface;
|
14 |
+
use WPML\Core\Twig\Loader\LoaderInterface;
|
15 |
+
use WPML\Core\Twig\Loader\SourceContextLoaderInterface;
|
16 |
+
use WPML\Core\Twig\Source;
|
17 |
+
@\trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use "Twig\\Loader\\ArrayLoader" instead or "Twig\\Environment::createTemplate()".', \E_USER_DEPRECATED);
|
18 |
+
/**
|
19 |
+
* Loads a template from a string.
|
20 |
+
*
|
21 |
+
* This loader should NEVER be used. It only exists for Twig internal purposes.
|
22 |
+
*
|
23 |
+
* When using this loader with a cache mechanism, you should know that a new cache
|
24 |
+
* key is generated each time a template content "changes" (the cache key being the
|
25 |
+
* source code of the template). If you don't want to see your cache grows out of
|
26 |
+
* control, you need to take care of clearing the old cache file by yourself.
|
27 |
+
*
|
28 |
+
* @deprecated since 1.18.1 (to be removed in 2.0)
|
29 |
+
*
|
30 |
+
* @internal
|
31 |
+
*
|
32 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
33 |
+
*/
|
34 |
+
class Twig_Loader_String implements \WPML\Core\Twig\Loader\LoaderInterface, \WPML\Core\Twig\Loader\ExistsLoaderInterface, \WPML\Core\Twig\Loader\SourceContextLoaderInterface
|
35 |
+
{
|
36 |
+
public function getSource($name)
|
37 |
+
{
|
38 |
+
@\trigger_error(\sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), \E_USER_DEPRECATED);
|
39 |
+
return $name;
|
40 |
+
}
|
41 |
+
public function getSourceContext($name)
|
42 |
+
{
|
43 |
+
return new \WPML\Core\Twig\Source($name, $name);
|
44 |
+
}
|
45 |
+
public function exists($name)
|
46 |
+
{
|
47 |
+
return \true;
|
48 |
+
}
|
49 |
+
public function getCacheKey($name)
|
50 |
+
{
|
51 |
+
return $name;
|
52 |
+
}
|
53 |
+
public function isFresh($name, $time)
|
54 |
+
{
|
55 |
+
return \true;
|
56 |
+
}
|
57 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/LoaderInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\LoaderInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\LoaderInterface');
|
7 |
+
if (\false) {
|
8 |
+
interface Twig_LoaderInterface extends \WPML\Core\Twig\Loader\LoaderInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Markup.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Markup;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Markup');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Markup extends \WPML\Core\Twig\Markup
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Node;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Node');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node extends \WPML\Core\Twig\Node\Node
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/AutoEscape.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\AutoEscapeNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\AutoEscapeNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_AutoEscape extends \WPML\Core\Twig\Node\AutoEscapeNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Block.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\BlockNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\BlockNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Block extends \WPML\Core\Twig\Node\BlockNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/BlockReference.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\BlockReferenceNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\BlockReferenceNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_BlockReference extends \WPML\Core\Twig\Node\BlockReferenceNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Body.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\BodyNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\BodyNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Body extends \WPML\Core\Twig\Node\BodyNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/CheckSecurity.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\CheckSecurityNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\CheckSecurityNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_CheckSecurity extends \WPML\Core\Twig\Node\CheckSecurityNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Deprecated.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\DeprecatedNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\DeprecatedNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Deprecated extends \WPML\Core\Twig\Node\DeprecatedNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Do.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\DoNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\DoNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Do extends \WPML\Core\Twig\Node\DoNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Embed.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\EmbedNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\EmbedNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Embed extends \WPML\Core\Twig\Node\EmbedNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\AbstractExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Array.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\ArrayExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\ArrayExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Array extends \WPML\Core\Twig\Node\Expression\ArrayExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/AssignName.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\AssignNameExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_AssignName extends \WPML\Core\Twig\Node\Expression\AssignNameExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\AbstractBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AbstractBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Add.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\AddBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AddBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Add extends \WPML\Core\Twig\Node\Expression\Binary\AddBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/And.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\AndBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AndBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_And extends \WPML\Core\Twig\Node\Expression\Binary\AndBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\BitwiseAndBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_BitwiseAnd extends \WPML\Core\Twig\Node\Expression\Binary\BitwiseAndBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\BitwiseOrBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_BitwiseOr extends \WPML\Core\Twig\Node\Expression\Binary\BitwiseOrBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\BitwiseXorBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_BitwiseXor extends \WPML\Core\Twig\Node\Expression\Binary\BitwiseXorBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Concat.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\ConcatBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\ConcatBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Concat extends \WPML\Core\Twig\Node\Expression\Binary\ConcatBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Div.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\DivBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\DivBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Div extends \WPML\Core\Twig\Node\Expression\Binary\DivBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/EndsWith.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\EndsWithBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\EndsWithBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_EndsWith extends \WPML\Core\Twig\Node\Expression\Binary\EndsWithBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Equal.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\EqualBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\EqualBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Equal extends \WPML\Core\Twig\Node\Expression\Binary\EqualBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\FloorDivBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\FloorDivBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_FloorDiv extends \WPML\Core\Twig\Node\Expression\Binary\FloorDivBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Greater.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\GreaterBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Greater extends \WPML\Core\Twig\Node\Expression\Binary\GreaterBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\GreaterEqualBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_GreaterEqual extends \WPML\Core\Twig\Node\Expression\Binary\GreaterEqualBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/In.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\InBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\InBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_In extends \WPML\Core\Twig\Node\Expression\Binary\InBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Less.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\LessBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Less extends \WPML\Core\Twig\Node\Expression\Binary\LessBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/LessEqual.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\LessEqualBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessEqualBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_LessEqual extends \WPML\Core\Twig\Node\Expression\Binary\LessEqualBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Matches.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\MatchesBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\MatchesBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Matches extends \WPML\Core\Twig\Node\Expression\Binary\MatchesBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mod.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\ModBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\ModBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Mod extends \WPML\Core\Twig\Node\Expression\Binary\ModBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mul.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\MulBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\MulBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Mul extends \WPML\Core\Twig\Node\Expression\Binary\MulBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotEqual.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\NotEqualBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotEqualBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_NotEqual extends \WPML\Core\Twig\Node\Expression\Binary\NotEqualBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotIn.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\NotInBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotInBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_NotIn extends \WPML\Core\Twig\Node\Expression\Binary\NotInBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Or.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\OrBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\OrBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Or extends \WPML\Core\Twig\Node\Expression\Binary\OrBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Power.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\PowerBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\PowerBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Power extends \WPML\Core\Twig\Node\Expression\Binary\PowerBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Range.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\RangeBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\RangeBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Range extends \WPML\Core\Twig\Node\Expression\Binary\RangeBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/StartsWith.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\StartsWithBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\StartsWithBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_StartsWith extends \WPML\Core\Twig\Node\Expression\Binary\StartsWithBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Sub.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Binary\SubBinary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Binary\\SubBinary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Binary_Sub extends \WPML\Core\Twig\Node\Expression\Binary\SubBinary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/BlockReference.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\BlockReferenceExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_BlockReference extends \WPML\Core\Twig\Node\Expression\BlockReferenceExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Call.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\CallExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\CallExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Call extends \WPML\Core\Twig\Node\Expression\CallExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Conditional.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\ConditionalExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\ConditionalExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Conditional extends \WPML\Core\Twig\Node\Expression\ConditionalExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Constant.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\ConstantExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Constant extends \WPML\Core\Twig\Node\Expression\ConstantExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/ExtensionReference.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
@\trigger_error('The Twig_Node_Expression_ExtensionReference class is deprecated since version 1.23 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
16 |
+
/**
|
17 |
+
* Represents an extension call node.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.23 and will be removed in 2.0.
|
22 |
+
*/
|
23 |
+
class Twig_Node_Expression_ExtensionReference extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
24 |
+
{
|
25 |
+
public function __construct($name, $lineno, $tag = null)
|
26 |
+
{
|
27 |
+
parent::__construct([], ['name' => $name], $lineno, $tag);
|
28 |
+
}
|
29 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
30 |
+
{
|
31 |
+
$compiler->raw(\sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name')));
|
32 |
+
}
|
33 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\FilterExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Filter extends \WPML\Core\Twig\Node\Expression\FilterExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter/Default.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Filter\DefaultFilter;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Filter\\DefaultFilter');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Filter_Default extends \WPML\Core\Twig\Node\Expression\Filter\DefaultFilter
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Function.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\FunctionExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\FunctionExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Function extends \WPML\Core\Twig\Node\Expression\FunctionExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/GetAttr.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\GetAttrExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_GetAttr extends \WPML\Core\Twig\Node\Expression\GetAttrExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/MethodCall.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\MethodCallExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\MethodCallExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_MethodCall extends \WPML\Core\Twig\Node\Expression\MethodCallExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Name.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\NameExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Name extends \WPML\Core\Twig\Node\Expression\NameExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/NullCoalesce.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\NullCoalesceExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\NullCoalesceExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_NullCoalesce extends \WPML\Core\Twig\Node\Expression\NullCoalesceExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Parent.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\ParentExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\ParentExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Parent extends \WPML\Core\Twig\Node\Expression\ParentExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/TempName.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\TempNameExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\TempNameExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_TempName extends \WPML\Core\Twig\Node\Expression\TempNameExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\TestExpression');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test extends \WPML\Core\Twig\Node\Expression\TestExpression
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Constant.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\ConstantTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\ConstantTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Constant extends \WPML\Core\Twig\Node\Expression\Test\ConstantTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Defined.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\DefinedTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\DefinedTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Defined extends \WPML\Core\Twig\Node\Expression\Test\DefinedTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Divisibleby.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\DivisiblebyTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Divisibleby extends \WPML\Core\Twig\Node\Expression\Test\DivisiblebyTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Even.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\EvenTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\EvenTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Even extends \WPML\Core\Twig\Node\Expression\Test\EvenTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Null.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\NullTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Null extends \WPML\Core\Twig\Node\Expression\Test\NullTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Odd.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\OddTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\OddTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Odd extends \WPML\Core\Twig\Node\Expression\Test\OddTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Sameas.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Test\SameasTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Test_Sameas extends \WPML\Core\Twig\Node\Expression\Test\SameasTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Unary\AbstractUnary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Unary\\AbstractUnary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Unary extends \WPML\Core\Twig\Node\Expression\Unary\AbstractUnary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Neg.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Unary\NegUnary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Unary_Neg extends \WPML\Core\Twig\Node\Expression\Unary\NegUnary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Not.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Unary\NotUnary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Unary\\NotUnary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Unary_Not extends \WPML\Core\Twig\Node\Expression\Unary\NotUnary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Pos.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\Expression\Unary\PosUnary;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Expression_Unary_Pos extends \WPML\Core\Twig\Node\Expression\Unary\PosUnary
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Flush.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\FlushNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\FlushNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Flush extends \WPML\Core\Twig\Node\FlushNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/For.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\ForNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\ForNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_For extends \WPML\Core\Twig\Node\ForNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/ForLoop.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\ForLoopNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\ForLoopNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_ForLoop extends \WPML\Core\Twig\Node\ForLoopNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/If.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\IfNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\IfNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_If extends \WPML\Core\Twig\Node\IfNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Import.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\ImportNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\ImportNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Import extends \WPML\Core\Twig\Node\ImportNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Include.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\IncludeNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\IncludeNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Include extends \WPML\Core\Twig\Node\IncludeNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Macro.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\MacroNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\MacroNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Macro extends \WPML\Core\Twig\Node\MacroNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Module.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\ModuleNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Module extends \WPML\Core\Twig\Node\ModuleNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Print.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\PrintNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\PrintNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Print extends \WPML\Core\Twig\Node\PrintNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Sandbox.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\SandboxNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\SandboxNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Sandbox extends \WPML\Core\Twig\Node\SandboxNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SandboxedPrint.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\SandboxedPrintNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\SandboxedPrintNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_SandboxedPrint extends \WPML\Core\Twig\Node\SandboxedPrintNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Set.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\SetNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\SetNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Set extends \WPML\Core\Twig\Node\SetNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SetTemp.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\SetTempNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\SetTempNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_SetTemp extends \WPML\Core\Twig\Node\SetTempNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Spaceless.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\SpacelessNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\SpacelessNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Spaceless extends \WPML\Core\Twig\Node\SpacelessNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Text.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\TextNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\TextNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_Text extends \WPML\Core\Twig\Node\TextNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/With.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\WithNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\WithNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Node_With extends \WPML\Core\Twig\Node\WithNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeCaptureInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\NodeCaptureInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\NodeCaptureInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeCaptureInterface extends \WPML\Core\Twig\Node\NodeCaptureInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeInterface.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents a node in the AST.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
20 |
+
*/
|
21 |
+
interface Twig_NodeInterface extends \Countable, \IteratorAggregate
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Compiles the node to PHP.
|
25 |
+
*/
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler);
|
27 |
+
/**
|
28 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
29 |
+
*/
|
30 |
+
public function getLine();
|
31 |
+
public function getNodeTag();
|
32 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeOutputInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Node\NodeOutputInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Node\\NodeOutputInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeOutputInterface extends \WPML\Core\Twig\Node\NodeOutputInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeTraverser.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeTraverser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeTraverser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeTraverser extends \WPML\Core\Twig\NodeTraverser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Escaper.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\EscaperNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\EscaperNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeVisitor_Escaper extends \WPML\Core\Twig\NodeVisitor\EscaperNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Optimizer.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\OptimizerNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\OptimizerNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeVisitor_Optimizer extends \WPML\Core\Twig\NodeVisitor\OptimizerNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/SafeAnalysis.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\SafeAnalysisNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\SafeAnalysisNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeVisitor_SafeAnalysis extends \WPML\Core\Twig\NodeVisitor\SafeAnalysisNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Sandbox.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\SandboxNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeVisitor_Sandbox extends \WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitorInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\NodeVisitor\\NodeVisitorInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_NodeVisitorInterface extends \WPML\Core\Twig\NodeVisitor\NodeVisitorInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Parser.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Parser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Parser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Parser extends \WPML\Core\Twig\Parser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/ParserInterface.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
15 |
+
use WPML\Core\Twig\TokenStream;
|
16 |
+
/**
|
17 |
+
* Interface implemented by parser classes.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*
|
21 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
22 |
+
*/
|
23 |
+
interface Twig_ParserInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Converts a token stream to a node tree.
|
27 |
+
*
|
28 |
+
* @return ModuleNode
|
29 |
+
*
|
30 |
+
* @throws SyntaxError When the token stream is syntactically or semantically wrong
|
31 |
+
*/
|
32 |
+
public function parse(\WPML\Core\Twig\TokenStream $stream);
|
33 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Base.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Dumper\BaseDumper;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Dumper\\BaseDumper');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Dumper_Base extends \WPML\Core\Twig\Profiler\Dumper\BaseDumper
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Blackfire.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Dumper\BlackfireDumper;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Dumper\\BlackfireDumper');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Dumper_Blackfire extends \WPML\Core\Twig\Profiler\Dumper\BlackfireDumper
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Html.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Dumper\HtmlDumper;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Dumper\\HtmlDumper');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Dumper_Html extends \WPML\Core\Twig\Profiler\Dumper\HtmlDumper
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Text.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Dumper\TextDumper;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Dumper\\TextDumper');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Dumper_Text extends \WPML\Core\Twig\Profiler\Dumper\TextDumper
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/EnterProfile.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Node\EnterProfileNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Node\\EnterProfileNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Node_EnterProfile extends \WPML\Core\Twig\Profiler\Node\EnterProfileNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/LeaveProfile.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Node\LeaveProfileNode;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Node\\LeaveProfileNode');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Node_LeaveProfile extends \WPML\Core\Twig\Profiler\Node\LeaveProfileNode
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_NodeVisitor_Profiler extends \WPML\Core\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Profile.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Profiler\Profile;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Profiler\\Profile');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Profiler_Profile extends \WPML\Core\Twig\Profiler\Profile
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/RuntimeLoaderInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\RuntimeLoader\\RuntimeLoaderInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_RuntimeLoaderInterface extends \WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityError extends \WPML\Core\Twig\Sandbox\SecurityError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityNotAllowedFilterError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFilterError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityNotAllowedFilterError extends \WPML\Core\Twig\Sandbox\SecurityNotAllowedFilterError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityNotAllowedFunctionError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFunctionError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityNotAllowedFunctionError extends \WPML\Core\Twig\Sandbox\SecurityNotAllowedFunctionError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityNotAllowedMethodError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedMethodError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityNotAllowedMethodError extends \WPML\Core\Twig\Sandbox\SecurityNotAllowedMethodError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityNotAllowedPropertyError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedPropertyError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityNotAllowedPropertyError extends \WPML\Core\Twig\Sandbox\SecurityNotAllowedPropertyError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityNotAllowedTagError;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedTagError');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityNotAllowedTagError extends \WPML\Core\Twig\Sandbox\SecurityNotAllowedTagError
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicy.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityPolicy;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityPolicy');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityPolicy extends \WPML\Core\Twig\Sandbox\SecurityPolicy
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Sandbox\SecurityPolicyInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Sandbox\\SecurityPolicyInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Sandbox_SecurityPolicyInterface extends \WPML\Core\Twig\Sandbox\SecurityPolicyInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFilter.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TwigFilter;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TwigFilter');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_SimpleFilter extends \WPML\Core\Twig\TwigFilter
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFunction.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TwigFunction;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TwigFunction');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_SimpleFunction extends \WPML\Core\Twig\TwigFunction
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleTest.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TwigTest;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TwigTest');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_SimpleTest extends \WPML\Core\Twig\TwigTest
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Source.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Source;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Source');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Source extends \WPML\Core\Twig\Source
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/SourceContextLoaderInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Loader\SourceContextLoaderInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Loader\\SourceContextLoaderInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_SourceContextLoaderInterface extends \WPML\Core\Twig\Loader\SourceContextLoaderInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Template.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Template;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Template');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Template extends \WPML\Core\Twig\Template
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateInterface.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
/**
|
15 |
+
* Interface implemented by all compiled templates.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
20 |
+
*/
|
21 |
+
interface Twig_TemplateInterface
|
22 |
+
{
|
23 |
+
const ANY_CALL = 'any';
|
24 |
+
const ARRAY_CALL = 'array';
|
25 |
+
const METHOD_CALL = 'method';
|
26 |
+
/**
|
27 |
+
* Renders the template with the given context and returns it as string.
|
28 |
+
*
|
29 |
+
* @param array $context An array of parameters to pass to the template
|
30 |
+
*
|
31 |
+
* @return string The rendered template
|
32 |
+
*/
|
33 |
+
public function render(array $context);
|
34 |
+
/**
|
35 |
+
* Displays the template with the given context.
|
36 |
+
*
|
37 |
+
* @param array $context An array of parameters to pass to the template
|
38 |
+
* @param array $blocks An array of blocks to pass to the template
|
39 |
+
*/
|
40 |
+
public function display(array $context, array $blocks = []);
|
41 |
+
/**
|
42 |
+
* Returns the bound environment for this template.
|
43 |
+
*
|
44 |
+
* @return Environment
|
45 |
+
*/
|
46 |
+
public function getEnvironment();
|
47 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateWrapper.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TemplateWrapper;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TemplateWrapper');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TemplateWrapper extends \WPML\Core\Twig\TemplateWrapper
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Test class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigTest instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a template test.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
+
*/
|
21 |
+
abstract class Twig_Test implements \WPML\Core\Twig_TestInterface, \WPML\Core\Twig_TestCallableInterface
|
22 |
+
{
|
23 |
+
protected $options;
|
24 |
+
protected $arguments = [];
|
25 |
+
public function __construct(array $options = [])
|
26 |
+
{
|
27 |
+
$this->options = \array_merge(['callable' => null], $options);
|
28 |
+
}
|
29 |
+
public function getCallable()
|
30 |
+
{
|
31 |
+
return $this->options['callable'];
|
32 |
+
}
|
33 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Function.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigTest instead.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a function template test.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
+
*/
|
21 |
+
class Twig_Test_Function extends \WPML\Core\Twig_Test
|
22 |
+
{
|
23 |
+
protected $function;
|
24 |
+
public function __construct($function, array $options = [])
|
25 |
+
{
|
26 |
+
$options['callable'] = $function;
|
27 |
+
parent::__construct($options);
|
28 |
+
$this->function = $function;
|
29 |
+
}
|
30 |
+
public function compile()
|
31 |
+
{
|
32 |
+
return $this->function;
|
33 |
+
}
|
34 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/IntegrationTestCase.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Test\IntegrationTestCase;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Test\\IntegrationTestCase');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Test_IntegrationTestCase extends \WPML\Core\Twig\Test\IntegrationTestCase
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Method.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
14 |
+
@\trigger_error('The Twig_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \\Twig\\TwigTest instead.', \E_USER_DEPRECATED);
|
15 |
+
/**
|
16 |
+
* Represents a method template test.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*
|
20 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
21 |
+
*/
|
22 |
+
class Twig_Test_Method extends \WPML\Core\Twig_Test
|
23 |
+
{
|
24 |
+
protected $extension;
|
25 |
+
protected $method;
|
26 |
+
public function __construct(\WPML\Core\Twig\Extension\ExtensionInterface $extension, $method, array $options = [])
|
27 |
+
{
|
28 |
+
$options['callable'] = [$extension, $method];
|
29 |
+
parent::__construct($options);
|
30 |
+
$this->extension = $extension;
|
31 |
+
$this->method = $method;
|
32 |
+
}
|
33 |
+
public function compile()
|
34 |
+
{
|
35 |
+
return \sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method);
|
36 |
+
}
|
37 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Node.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
@\trigger_error('The Twig_Test_Node class is deprecated since version 1.12 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
14 |
+
/**
|
15 |
+
* Represents a template test as a Node.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*
|
19 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
20 |
+
*/
|
21 |
+
class Twig_Test_Node extends \WPML\Core\Twig_Test
|
22 |
+
{
|
23 |
+
protected $class;
|
24 |
+
public function __construct($class, array $options = [])
|
25 |
+
{
|
26 |
+
parent::__construct($options);
|
27 |
+
$this->class = $class;
|
28 |
+
}
|
29 |
+
public function getClass()
|
30 |
+
{
|
31 |
+
return $this->class;
|
32 |
+
}
|
33 |
+
public function compile()
|
34 |
+
{
|
35 |
+
}
|
36 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/NodeTestCase.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Test\NodeTestCase;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Test\\NodeTestCase');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Test_NodeTestCase extends \WPML\Core\Twig\Test\NodeTestCase
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestCallableInterface.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
/**
|
14 |
+
* Represents a callable template test.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*
|
18 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
19 |
+
*/
|
20 |
+
interface Twig_TestCallableInterface
|
21 |
+
{
|
22 |
+
public function getCallable();
|
23 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestInterface.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
*
|
10 |
+
* For the full copyright and license information, please view the LICENSE
|
11 |
+
* file that was distributed with this source code.
|
12 |
+
*/
|
13 |
+
/**
|
14 |
+
* Represents a template test.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*
|
18 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
19 |
+
*/
|
20 |
+
interface Twig_TestInterface
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Compiles a test.
|
24 |
+
*
|
25 |
+
* @return string The PHP code for the test
|
26 |
+
*/
|
27 |
+
public function compile();
|
28 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Token.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Token;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Token');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Token extends \WPML\Core\Twig\Token
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\AbstractTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\AbstractTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/AutoEscape.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\AutoEscapeTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\AutoEscapeTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_AutoEscape extends \WPML\Core\Twig\TokenParser\AutoEscapeTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Block.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\BlockTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\BlockTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Block extends \WPML\Core\Twig\TokenParser\BlockTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Deprecated.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\DeprecatedTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\DeprecatedTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Deprecated extends \WPML\Core\Twig\TokenParser\DeprecatedTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Do.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\DoTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\DoTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Do extends \WPML\Core\Twig\TokenParser\DoTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Embed.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\EmbedTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\EmbedTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Embed extends \WPML\Core\Twig\TokenParser\EmbedTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Extends.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\ExtendsTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\ExtendsTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Extends extends \WPML\Core\Twig\TokenParser\ExtendsTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Filter.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\FilterTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\FilterTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Filter extends \WPML\Core\Twig\TokenParser\FilterTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Flush.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\FlushTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\FlushTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Flush extends \WPML\Core\Twig\TokenParser\FlushTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/For.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\ForTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\ForTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_For extends \WPML\Core\Twig\TokenParser\ForTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/From.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\FromTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\FromTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_From extends \WPML\Core\Twig\TokenParser\FromTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/If.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\IfTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\IfTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_If extends \WPML\Core\Twig\TokenParser\IfTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Import.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\ImportTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\ImportTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Import extends \WPML\Core\Twig\TokenParser\ImportTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Include.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\IncludeTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\IncludeTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Include extends \WPML\Core\Twig\TokenParser\IncludeTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Macro.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\MacroTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\MacroTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Macro extends \WPML\Core\Twig\TokenParser\MacroTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Sandbox.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\SandboxTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\SandboxTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Sandbox extends \WPML\Core\Twig\TokenParser\SandboxTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Set.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\SetTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\SetTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Set extends \WPML\Core\Twig\TokenParser\SetTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Spaceless.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\SpacelessTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\SpacelessTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Spaceless extends \WPML\Core\Twig\TokenParser\SpacelessTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Use.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\UseTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\UseTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_Use extends \WPML\Core\Twig\TokenParser\UseTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/With.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\WithTokenParser;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\WithTokenParser');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParser_With extends \WPML\Core\Twig\TokenParser\WithTokenParser
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBroker.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
* (c) Arnaud Le Blanc
|
10 |
+
*
|
11 |
+
* For the full copyright and license information, please view the LICENSE
|
12 |
+
* file that was distributed with this source code.
|
13 |
+
*/
|
14 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
15 |
+
/**
|
16 |
+
* Default implementation of a token parser broker.
|
17 |
+
*
|
18 |
+
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
19 |
+
*
|
20 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
21 |
+
*/
|
22 |
+
class Twig_TokenParserBroker implements \WPML\Core\Twig_TokenParserBrokerInterface
|
23 |
+
{
|
24 |
+
protected $parser;
|
25 |
+
protected $parsers = [];
|
26 |
+
protected $brokers = [];
|
27 |
+
/**
|
28 |
+
* @param array|\Traversable $parsers A \Traversable of Twig_TokenParserInterface instances
|
29 |
+
* @param array|\Traversable $brokers A \Traversable of Twig_TokenParserBrokerInterface instances
|
30 |
+
* @param bool $triggerDeprecationError
|
31 |
+
*/
|
32 |
+
public function __construct($parsers = [], $brokers = [], $triggerDeprecationError = \true)
|
33 |
+
{
|
34 |
+
if ($triggerDeprecationError) {
|
35 |
+
@\trigger_error('The ' . __CLASS__ . ' class is deprecated since version 1.12 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
36 |
+
}
|
37 |
+
foreach ($parsers as $parser) {
|
38 |
+
if (!$parser instanceof \WPML\Core\Twig\TokenParser\TokenParserInterface) {
|
39 |
+
throw new \LogicException('$parsers must a an array of Twig_TokenParserInterface.');
|
40 |
+
}
|
41 |
+
$this->parsers[$parser->getTag()] = $parser;
|
42 |
+
}
|
43 |
+
foreach ($brokers as $broker) {
|
44 |
+
if (!$broker instanceof \WPML\Core\Twig_TokenParserBrokerInterface) {
|
45 |
+
throw new \LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface.');
|
46 |
+
}
|
47 |
+
$this->brokers[] = $broker;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
public function addTokenParser(\WPML\Core\Twig\TokenParser\TokenParserInterface $parser)
|
51 |
+
{
|
52 |
+
$this->parsers[$parser->getTag()] = $parser;
|
53 |
+
}
|
54 |
+
public function removeTokenParser(\WPML\Core\Twig\TokenParser\TokenParserInterface $parser)
|
55 |
+
{
|
56 |
+
$name = $parser->getTag();
|
57 |
+
if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) {
|
58 |
+
unset($this->parsers[$name]);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
public function addTokenParserBroker(self $broker)
|
62 |
+
{
|
63 |
+
$this->brokers[] = $broker;
|
64 |
+
}
|
65 |
+
public function removeTokenParserBroker(self $broker)
|
66 |
+
{
|
67 |
+
if (\false !== ($pos = \array_search($broker, $this->brokers))) {
|
68 |
+
unset($this->brokers[$pos]);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
/**
|
72 |
+
* Gets a suitable TokenParser for a tag.
|
73 |
+
*
|
74 |
+
* First looks in parsers, then in brokers.
|
75 |
+
*
|
76 |
+
* @param string $tag A tag name
|
77 |
+
*
|
78 |
+
* @return TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found
|
79 |
+
*/
|
80 |
+
public function getTokenParser($tag)
|
81 |
+
{
|
82 |
+
if (isset($this->parsers[$tag])) {
|
83 |
+
return $this->parsers[$tag];
|
84 |
+
}
|
85 |
+
$broker = \end($this->brokers);
|
86 |
+
while (\false !== $broker) {
|
87 |
+
$parser = $broker->getTokenParser($tag);
|
88 |
+
if (null !== $parser) {
|
89 |
+
return $parser;
|
90 |
+
}
|
91 |
+
$broker = \prev($this->brokers);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
public function getParsers()
|
95 |
+
{
|
96 |
+
return $this->parsers;
|
97 |
+
}
|
98 |
+
public function getParser()
|
99 |
+
{
|
100 |
+
return $this->parser;
|
101 |
+
}
|
102 |
+
public function setParser(\WPML\Core\Twig_ParserInterface $parser)
|
103 |
+
{
|
104 |
+
$this->parser = $parser;
|
105 |
+
foreach ($this->parsers as $tokenParser) {
|
106 |
+
$tokenParser->setParser($parser);
|
107 |
+
}
|
108 |
+
foreach ($this->brokers as $broker) {
|
109 |
+
$broker->setParser($parser);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBrokerInterface.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* This file is part of Twig.
|
7 |
+
*
|
8 |
+
* (c) Fabien Potencier
|
9 |
+
* (c) Arnaud Le Blanc
|
10 |
+
*
|
11 |
+
* For the full copyright and license information, please view the LICENSE
|
12 |
+
* file that was distributed with this source code.
|
13 |
+
*/
|
14 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
15 |
+
/**
|
16 |
+
* Interface implemented by token parser brokers.
|
17 |
+
*
|
18 |
+
* Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name.
|
19 |
+
*
|
20 |
+
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
21 |
+
*
|
22 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
23 |
+
*/
|
24 |
+
interface Twig_TokenParserBrokerInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Gets a TokenParser suitable for a tag.
|
28 |
+
*
|
29 |
+
* @param string $tag A tag name
|
30 |
+
*
|
31 |
+
* @return TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found
|
32 |
+
*/
|
33 |
+
public function getTokenParser($tag);
|
34 |
+
/**
|
35 |
+
* Calls Twig\TokenParser\TokenParserInterface::setParser on all parsers the implementation knows of.
|
36 |
+
*/
|
37 |
+
public function setParser(\WPML\Core\Twig_ParserInterface $parser);
|
38 |
+
/**
|
39 |
+
* Gets the Twig_ParserInterface.
|
40 |
+
*
|
41 |
+
* @return Twig_ParserInterface|null A Twig_ParserInterface instance or null
|
42 |
+
*/
|
43 |
+
public function getParser();
|
44 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserInterface.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenParser\\TokenParserInterface');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenParserInterface extends \WPML\Core\Twig\TokenParser\TokenParserInterface
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenStream.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\TokenStream;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\TokenStream');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_TokenStream extends \WPML\Core\Twig\TokenStream
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/DeprecationCollector.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Util\DeprecationCollector;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Util\\DeprecationCollector');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Util_DeprecationCollector extends \WPML\Core\Twig\Util\DeprecationCollector
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/TemplateDirIterator.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPML\Core;
|
4 |
+
|
5 |
+
use WPML\Core\Twig\Util\TemplateDirIterator;
|
6 |
+
\class_exists('WPML\\Core\\Twig\\Util\\TemplateDirIterator');
|
7 |
+
if (\false) {
|
8 |
+
class Twig_Util_TemplateDirIterator extends \WPML\Core\Twig\Util\TemplateDirIterator
|
9 |
+
{
|
10 |
+
}
|
11 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Cache/CacheInterface.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Cache;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Interface implemented by cache classes.
|
15 |
+
*
|
16 |
+
* It is highly recommended to always store templates on the filesystem to
|
17 |
+
* benefit from the PHP opcode cache. This interface is mostly useful if you
|
18 |
+
* need to implement a custom strategy for storing templates on the filesystem.
|
19 |
+
*
|
20 |
+
* @author Andrew Tch <andrew@noop.lv>
|
21 |
+
*/
|
22 |
+
interface CacheInterface
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Generates a cache key for the given template class name.
|
26 |
+
*
|
27 |
+
* @param string $name The template name
|
28 |
+
* @param string $className The template class name
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function generateKey($name, $className);
|
33 |
+
/**
|
34 |
+
* Writes the compiled template to cache.
|
35 |
+
*
|
36 |
+
* @param string $key The cache key
|
37 |
+
* @param string $content The template representation as a PHP class
|
38 |
+
*/
|
39 |
+
public function write($key, $content);
|
40 |
+
/**
|
41 |
+
* Loads a template from the cache.
|
42 |
+
*
|
43 |
+
* @param string $key The cache key
|
44 |
+
*/
|
45 |
+
public function load($key);
|
46 |
+
/**
|
47 |
+
* Returns the modification timestamp of a key.
|
48 |
+
*
|
49 |
+
* @param string $key The cache key
|
50 |
+
*
|
51 |
+
* @return int
|
52 |
+
*/
|
53 |
+
public function getTimestamp($key);
|
54 |
+
}
|
55 |
+
\class_alias('WPML\\Core\\Twig\\Cache\\CacheInterface', 'WPML\\Core\\Twig_CacheInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Cache/FilesystemCache.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Cache;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Implements a cache on the filesystem.
|
15 |
+
*
|
16 |
+
* @author Andrew Tch <andrew@noop.lv>
|
17 |
+
*/
|
18 |
+
class FilesystemCache implements \WPML\Core\Twig\Cache\CacheInterface
|
19 |
+
{
|
20 |
+
const FORCE_BYTECODE_INVALIDATION = 1;
|
21 |
+
private $directory;
|
22 |
+
private $options;
|
23 |
+
/**
|
24 |
+
* @param string $directory The root cache directory
|
25 |
+
* @param int $options A set of options
|
26 |
+
*/
|
27 |
+
public function __construct($directory, $options = 0)
|
28 |
+
{
|
29 |
+
$this->directory = \rtrim($directory, '\\/') . '/';
|
30 |
+
$this->options = $options;
|
31 |
+
}
|
32 |
+
public function generateKey($name, $className)
|
33 |
+
{
|
34 |
+
$hash = \hash('sha256', $className);
|
35 |
+
return $this->directory . $hash[0] . $hash[1] . '/' . $hash . '.php';
|
36 |
+
}
|
37 |
+
public function load($key)
|
38 |
+
{
|
39 |
+
if (\file_exists($key)) {
|
40 |
+
@(include_once $key);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
public function write($key, $content)
|
44 |
+
{
|
45 |
+
$dir = \dirname($key);
|
46 |
+
if (!\is_dir($dir)) {
|
47 |
+
if (\false === @\mkdir($dir, 0777, \true)) {
|
48 |
+
\clearstatcache(\true, $dir);
|
49 |
+
if (!\is_dir($dir)) {
|
50 |
+
throw new \RuntimeException(\sprintf('Unable to create the cache directory (%s).', $dir));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
} elseif (!\is_writable($dir)) {
|
54 |
+
throw new \RuntimeException(\sprintf('Unable to write in the cache directory (%s).', $dir));
|
55 |
+
}
|
56 |
+
$tmpFile = \tempnam($dir, \basename($key));
|
57 |
+
if (\false !== @\file_put_contents($tmpFile, $content) && @\rename($tmpFile, $key)) {
|
58 |
+
@\chmod($key, 0666 & ~\umask());
|
59 |
+
if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
|
60 |
+
// Compile cached file into bytecode cache
|
61 |
+
if (\function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
|
62 |
+
@\opcache_invalidate($key, \true);
|
63 |
+
} elseif (\function_exists('apc_compile_file')) {
|
64 |
+
\apc_compile_file($key);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $key));
|
70 |
+
}
|
71 |
+
public function getTimestamp($key)
|
72 |
+
{
|
73 |
+
if (!\file_exists($key)) {
|
74 |
+
return 0;
|
75 |
+
}
|
76 |
+
return (int) @\filemtime($key);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
\class_alias('WPML\\Core\\Twig\\Cache\\FilesystemCache', 'WPML\\Core\\Twig_Cache_Filesystem');
|
addons/wpml-dependencies/lib/lib/twig/src/Cache/NullCache.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Cache;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Implements a no-cache strategy.
|
15 |
+
*
|
16 |
+
* @final
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class NullCache implements \WPML\Core\Twig\Cache\CacheInterface
|
21 |
+
{
|
22 |
+
public function generateKey($name, $className)
|
23 |
+
{
|
24 |
+
return '';
|
25 |
+
}
|
26 |
+
public function write($key, $content)
|
27 |
+
{
|
28 |
+
}
|
29 |
+
public function load($key)
|
30 |
+
{
|
31 |
+
}
|
32 |
+
public function getTimestamp($key)
|
33 |
+
{
|
34 |
+
return 0;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
\class_alias('WPML\\Core\\Twig\\Cache\\NullCache', 'WPML\\Core\\Twig_Cache_Null');
|
addons/wpml-dependencies/lib/lib/twig/src/Compiler.php
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
15 |
+
/**
|
16 |
+
* Compiles a node to PHP code.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class Compiler implements \WPML\Core\Twig_CompilerInterface
|
21 |
+
{
|
22 |
+
protected $lastLine;
|
23 |
+
protected $source;
|
24 |
+
protected $indentation;
|
25 |
+
protected $env;
|
26 |
+
protected $debugInfo = [];
|
27 |
+
protected $sourceOffset;
|
28 |
+
protected $sourceLine;
|
29 |
+
protected $filename;
|
30 |
+
private $varNameSalt = 0;
|
31 |
+
public function __construct(\WPML\Core\Twig\Environment $env)
|
32 |
+
{
|
33 |
+
$this->env = $env;
|
34 |
+
}
|
35 |
+
/**
|
36 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
37 |
+
*/
|
38 |
+
public function getFilename()
|
39 |
+
{
|
40 |
+
@\trigger_error(\sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), \E_USER_DEPRECATED);
|
41 |
+
return $this->filename;
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Returns the environment instance related to this compiler.
|
45 |
+
*
|
46 |
+
* @return Environment
|
47 |
+
*/
|
48 |
+
public function getEnvironment()
|
49 |
+
{
|
50 |
+
return $this->env;
|
51 |
+
}
|
52 |
+
/**
|
53 |
+
* Gets the current PHP code after compilation.
|
54 |
+
*
|
55 |
+
* @return string The PHP code
|
56 |
+
*/
|
57 |
+
public function getSource()
|
58 |
+
{
|
59 |
+
return $this->source;
|
60 |
+
}
|
61 |
+
/**
|
62 |
+
* Compiles a node.
|
63 |
+
*
|
64 |
+
* @param int $indentation The current indentation
|
65 |
+
*
|
66 |
+
* @return $this
|
67 |
+
*/
|
68 |
+
public function compile(\WPML\Core\Twig_NodeInterface $node, $indentation = 0)
|
69 |
+
{
|
70 |
+
$this->lastLine = null;
|
71 |
+
$this->source = '';
|
72 |
+
$this->debugInfo = [];
|
73 |
+
$this->sourceOffset = 0;
|
74 |
+
// source code starts at 1 (as we then increment it when we encounter new lines)
|
75 |
+
$this->sourceLine = 1;
|
76 |
+
$this->indentation = $indentation;
|
77 |
+
$this->varNameSalt = 0;
|
78 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
79 |
+
// to be removed in 2.0
|
80 |
+
$this->filename = $node->getTemplateName();
|
81 |
+
}
|
82 |
+
$node->compile($this);
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
public function subcompile(\WPML\Core\Twig_NodeInterface $node, $raw = \true)
|
86 |
+
{
|
87 |
+
if (\false === $raw) {
|
88 |
+
$this->source .= \str_repeat(' ', $this->indentation * 4);
|
89 |
+
}
|
90 |
+
$node->compile($this);
|
91 |
+
return $this;
|
92 |
+
}
|
93 |
+
/**
|
94 |
+
* Adds a raw string to the compiled code.
|
95 |
+
*
|
96 |
+
* @param string $string The string
|
97 |
+
*
|
98 |
+
* @return $this
|
99 |
+
*/
|
100 |
+
public function raw($string)
|
101 |
+
{
|
102 |
+
$this->source .= $string;
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
+
/**
|
106 |
+
* Writes a string to the compiled code by adding indentation.
|
107 |
+
*
|
108 |
+
* @return $this
|
109 |
+
*/
|
110 |
+
public function write()
|
111 |
+
{
|
112 |
+
$strings = \func_get_args();
|
113 |
+
foreach ($strings as $string) {
|
114 |
+
$this->source .= \str_repeat(' ', $this->indentation * 4) . $string;
|
115 |
+
}
|
116 |
+
return $this;
|
117 |
+
}
|
118 |
+
/**
|
119 |
+
* Appends an indentation to the current PHP code after compilation.
|
120 |
+
*
|
121 |
+
* @return $this
|
122 |
+
*
|
123 |
+
* @deprecated since 1.27 (to be removed in 2.0).
|
124 |
+
*/
|
125 |
+
public function addIndentation()
|
126 |
+
{
|
127 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0. Use write(\'\') instead.', \E_USER_DEPRECATED);
|
128 |
+
$this->source .= \str_repeat(' ', $this->indentation * 4);
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
/**
|
132 |
+
* Adds a quoted string to the compiled code.
|
133 |
+
*
|
134 |
+
* @param string $value The string
|
135 |
+
*
|
136 |
+
* @return $this
|
137 |
+
*/
|
138 |
+
public function string($value)
|
139 |
+
{
|
140 |
+
$this->source .= \sprintf('"%s"', \addcslashes($value, "\0\t\"\$\\"));
|
141 |
+
return $this;
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* Returns a PHP representation of a given value.
|
145 |
+
*
|
146 |
+
* @param mixed $value The value to convert
|
147 |
+
*
|
148 |
+
* @return $this
|
149 |
+
*/
|
150 |
+
public function repr($value)
|
151 |
+
{
|
152 |
+
if (\is_int($value) || \is_float($value)) {
|
153 |
+
if (\false !== ($locale = \setlocale(\LC_NUMERIC, '0'))) {
|
154 |
+
\setlocale(\LC_NUMERIC, 'C');
|
155 |
+
}
|
156 |
+
$this->raw(\var_export($value, \true));
|
157 |
+
if (\false !== $locale) {
|
158 |
+
\setlocale(\LC_NUMERIC, $locale);
|
159 |
+
}
|
160 |
+
} elseif (null === $value) {
|
161 |
+
$this->raw('null');
|
162 |
+
} elseif (\is_bool($value)) {
|
163 |
+
$this->raw($value ? 'true' : 'false');
|
164 |
+
} elseif (\is_array($value)) {
|
165 |
+
$this->raw('[');
|
166 |
+
$first = \true;
|
167 |
+
foreach ($value as $key => $v) {
|
168 |
+
if (!$first) {
|
169 |
+
$this->raw(', ');
|
170 |
+
}
|
171 |
+
$first = \false;
|
172 |
+
$this->repr($key);
|
173 |
+
$this->raw(' => ');
|
174 |
+
$this->repr($v);
|
175 |
+
}
|
176 |
+
$this->raw(']');
|
177 |
+
} else {
|
178 |
+
$this->string($value);
|
179 |
+
}
|
180 |
+
return $this;
|
181 |
+
}
|
182 |
+
/**
|
183 |
+
* Adds debugging information.
|
184 |
+
*
|
185 |
+
* @return $this
|
186 |
+
*/
|
187 |
+
public function addDebugInfo(\WPML\Core\Twig_NodeInterface $node)
|
188 |
+
{
|
189 |
+
if ($node->getTemplateLine() != $this->lastLine) {
|
190 |
+
$this->write(\sprintf("// line %d\n", $node->getTemplateLine()));
|
191 |
+
// when mbstring.func_overload is set to 2
|
192 |
+
// mb_substr_count() replaces substr_count()
|
193 |
+
// but they have different signatures!
|
194 |
+
if ((int) \ini_get('mbstring.func_overload') & 2) {
|
195 |
+
@\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);
|
196 |
+
// this is much slower than the "right" version
|
197 |
+
$this->sourceLine += \mb_substr_count(\mb_substr($this->source, $this->sourceOffset), "\n");
|
198 |
+
} else {
|
199 |
+
$this->sourceLine += \substr_count($this->source, "\n", $this->sourceOffset);
|
200 |
+
}
|
201 |
+
$this->sourceOffset = \strlen($this->source);
|
202 |
+
$this->debugInfo[$this->sourceLine] = $node->getTemplateLine();
|
203 |
+
$this->lastLine = $node->getTemplateLine();
|
204 |
+
}
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
+
public function getDebugInfo()
|
208 |
+
{
|
209 |
+
\ksort($this->debugInfo);
|
210 |
+
return $this->debugInfo;
|
211 |
+
}
|
212 |
+
/**
|
213 |
+
* Indents the generated code.
|
214 |
+
*
|
215 |
+
* @param int $step The number of indentation to add
|
216 |
+
*
|
217 |
+
* @return $this
|
218 |
+
*/
|
219 |
+
public function indent($step = 1)
|
220 |
+
{
|
221 |
+
$this->indentation += $step;
|
222 |
+
return $this;
|
223 |
+
}
|
224 |
+
/**
|
225 |
+
* Outdents the generated code.
|
226 |
+
*
|
227 |
+
* @param int $step The number of indentation to remove
|
228 |
+
*
|
229 |
+
* @return $this
|
230 |
+
*
|
231 |
+
* @throws \LogicException When trying to outdent too much so the indentation would become negative
|
232 |
+
*/
|
233 |
+
public function outdent($step = 1)
|
234 |
+
{
|
235 |
+
// can't outdent by more steps than the current indentation level
|
236 |
+
if ($this->indentation < $step) {
|
237 |
+
throw new \LogicException('Unable to call outdent() as the indentation would become negative.');
|
238 |
+
}
|
239 |
+
$this->indentation -= $step;
|
240 |
+
return $this;
|
241 |
+
}
|
242 |
+
public function getVarName()
|
243 |
+
{
|
244 |
+
return \sprintf('__internal_%s', \hash('sha256', __METHOD__ . $this->varNameSalt++));
|
245 |
+
}
|
246 |
+
}
|
247 |
+
\class_alias('WPML\\Core\\Twig\\Compiler', 'WPML\\Core\\Twig_Compiler');
|
addons/wpml-dependencies/lib/lib/twig/src/Environment.php
ADDED
@@ -0,0 +1,1407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Cache\CacheInterface;
|
14 |
+
use WPML\Core\Twig\Cache\FilesystemCache;
|
15 |
+
use WPML\Core\Twig\Cache\NullCache;
|
16 |
+
use WPML\Core\Twig\Error\Error;
|
17 |
+
use WPML\Core\Twig\Error\LoaderError;
|
18 |
+
use WPML\Core\Twig\Error\RuntimeError;
|
19 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
20 |
+
use WPML\Core\Twig\Extension\CoreExtension;
|
21 |
+
use WPML\Core\Twig\Extension\EscaperExtension;
|
22 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
23 |
+
use WPML\Core\Twig\Extension\GlobalsInterface;
|
24 |
+
use WPML\Core\Twig\Extension\InitRuntimeInterface;
|
25 |
+
use WPML\Core\Twig\Extension\OptimizerExtension;
|
26 |
+
use WPML\Core\Twig\Extension\StagingExtension;
|
27 |
+
use WPML\Core\Twig\Loader\ArrayLoader;
|
28 |
+
use WPML\Core\Twig\Loader\ChainLoader;
|
29 |
+
use WPML\Core\Twig\Loader\LoaderInterface;
|
30 |
+
use WPML\Core\Twig\Loader\SourceContextLoaderInterface;
|
31 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
32 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
33 |
+
use WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface;
|
34 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
35 |
+
/**
|
36 |
+
* Stores the Twig configuration.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
*/
|
40 |
+
class Environment
|
41 |
+
{
|
42 |
+
const VERSION = '1.42.4';
|
43 |
+
const VERSION_ID = 14204;
|
44 |
+
const MAJOR_VERSION = 1;
|
45 |
+
const MINOR_VERSION = 42;
|
46 |
+
const RELEASE_VERSION = 4;
|
47 |
+
const EXTRA_VERSION = '';
|
48 |
+
protected $charset;
|
49 |
+
protected $loader;
|
50 |
+
protected $debug;
|
51 |
+
protected $autoReload;
|
52 |
+
protected $cache;
|
53 |
+
protected $lexer;
|
54 |
+
protected $parser;
|
55 |
+
protected $compiler;
|
56 |
+
protected $baseTemplateClass;
|
57 |
+
protected $extensions;
|
58 |
+
protected $parsers;
|
59 |
+
protected $visitors;
|
60 |
+
protected $filters;
|
61 |
+
protected $tests;
|
62 |
+
protected $functions;
|
63 |
+
protected $globals;
|
64 |
+
protected $runtimeInitialized = \false;
|
65 |
+
protected $extensionInitialized = \false;
|
66 |
+
protected $loadedTemplates;
|
67 |
+
protected $strictVariables;
|
68 |
+
protected $unaryOperators;
|
69 |
+
protected $binaryOperators;
|
70 |
+
protected $templateClassPrefix = '\\WPML\\Core\\__TwigTemplate_';
|
71 |
+
protected $functionCallbacks = [];
|
72 |
+
protected $filterCallbacks = [];
|
73 |
+
protected $staging;
|
74 |
+
private $originalCache;
|
75 |
+
private $bcWriteCacheFile = \false;
|
76 |
+
private $bcGetCacheFilename = \false;
|
77 |
+
private $lastModifiedExtension = 0;
|
78 |
+
private $extensionsByClass = [];
|
79 |
+
private $runtimeLoaders = [];
|
80 |
+
private $runtimes = [];
|
81 |
+
private $optionsHash;
|
82 |
+
/**
|
83 |
+
* Constructor.
|
84 |
+
*
|
85 |
+
* Available options:
|
86 |
+
*
|
87 |
+
* * debug: When set to true, it automatically set "auto_reload" to true as
|
88 |
+
* well (default to false).
|
89 |
+
*
|
90 |
+
* * charset: The charset used by the templates (default to UTF-8).
|
91 |
+
*
|
92 |
+
* * base_template_class: The base template class to use for generated
|
93 |
+
* templates (default to \Twig\Template).
|
94 |
+
*
|
95 |
+
* * cache: An absolute path where to store the compiled templates,
|
96 |
+
* a \Twig\Cache\CacheInterface implementation,
|
97 |
+
* or false to disable compilation cache (default).
|
98 |
+
*
|
99 |
+
* * auto_reload: Whether to reload the template if the original source changed.
|
100 |
+
* If you don't provide the auto_reload option, it will be
|
101 |
+
* determined automatically based on the debug value.
|
102 |
+
*
|
103 |
+
* * strict_variables: Whether to ignore invalid variables in templates
|
104 |
+
* (default to false).
|
105 |
+
*
|
106 |
+
* * autoescape: Whether to enable auto-escaping (default to html):
|
107 |
+
* * false: disable auto-escaping
|
108 |
+
* * true: equivalent to html
|
109 |
+
* * html, js: set the autoescaping to one of the supported strategies
|
110 |
+
* * name: set the autoescaping strategy based on the template name extension
|
111 |
+
* * PHP callback: a PHP callback that returns an escaping strategy based on the template "name"
|
112 |
+
*
|
113 |
+
* * optimizations: A flag that indicates which optimizations to apply
|
114 |
+
* (default to -1 which means that all optimizations are enabled;
|
115 |
+
* set it to 0 to disable).
|
116 |
+
*/
|
117 |
+
public function __construct(\WPML\Core\Twig\Loader\LoaderInterface $loader = null, $options = [])
|
118 |
+
{
|
119 |
+
if (null !== $loader) {
|
120 |
+
$this->setLoader($loader);
|
121 |
+
} else {
|
122 |
+
@\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);
|
123 |
+
}
|
124 |
+
$options = \array_merge(['debug' => \false, 'charset' => 'UTF-8', 'base_template_class' => '\\WPML\\Core\\Twig\\Template', 'strict_variables' => \false, 'autoescape' => 'html', 'cache' => \false, 'auto_reload' => null, 'optimizations' => -1], $options);
|
125 |
+
$this->debug = (bool) $options['debug'];
|
126 |
+
$this->charset = \strtoupper($options['charset']);
|
127 |
+
$this->baseTemplateClass = $options['base_template_class'];
|
128 |
+
$this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
|
129 |
+
$this->strictVariables = (bool) $options['strict_variables'];
|
130 |
+
$this->setCache($options['cache']);
|
131 |
+
$this->addExtension(new \WPML\Core\Twig\Extension\CoreExtension());
|
132 |
+
$this->addExtension(new \WPML\Core\Twig\Extension\EscaperExtension($options['autoescape']));
|
133 |
+
$this->addExtension(new \WPML\Core\Twig\Extension\OptimizerExtension($options['optimizations']));
|
134 |
+
$this->staging = new \WPML\Core\Twig\Extension\StagingExtension();
|
135 |
+
// For BC
|
136 |
+
if (\is_string($this->originalCache)) {
|
137 |
+
$r = new \ReflectionMethod($this, 'writeCacheFile');
|
138 |
+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
139 |
+
@\trigger_error('The Twig\\Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', \E_USER_DEPRECATED);
|
140 |
+
$this->bcWriteCacheFile = \true;
|
141 |
+
}
|
142 |
+
$r = new \ReflectionMethod($this, 'getCacheFilename');
|
143 |
+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
144 |
+
@\trigger_error('The Twig\\Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', \E_USER_DEPRECATED);
|
145 |
+
$this->bcGetCacheFilename = \true;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
/**
|
150 |
+
* Gets the base template class for compiled templates.
|
151 |
+
*
|
152 |
+
* @return string The base template class name
|
153 |
+
*/
|
154 |
+
public function getBaseTemplateClass()
|
155 |
+
{
|
156 |
+
return $this->baseTemplateClass;
|
157 |
+
}
|
158 |
+
/**
|
159 |
+
* Sets the base template class for compiled templates.
|
160 |
+
*
|
161 |
+
* @param string $class The base template class name
|
162 |
+
*/
|
163 |
+
public function setBaseTemplateClass($class)
|
164 |
+
{
|
165 |
+
$this->baseTemplateClass = $class;
|
166 |
+
$this->updateOptionsHash();
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* Enables debugging mode.
|
170 |
+
*/
|
171 |
+
public function enableDebug()
|
172 |
+
{
|
173 |
+
$this->debug = \true;
|
174 |
+
$this->updateOptionsHash();
|
175 |
+
}
|
176 |
+
/**
|
177 |
+
* Disables debugging mode.
|
178 |
+
*/
|
179 |
+
public function disableDebug()
|
180 |
+
{
|
181 |
+
$this->debug = \false;
|
182 |
+
$this->updateOptionsHash();
|
183 |
+
}
|
184 |
+
/**
|
185 |
+
* Checks if debug mode is enabled.
|
186 |
+
*
|
187 |
+
* @return bool true if debug mode is enabled, false otherwise
|
188 |
+
*/
|
189 |
+
public function isDebug()
|
190 |
+
{
|
191 |
+
return $this->debug;
|
192 |
+
}
|
193 |
+
/**
|
194 |
+
* Enables the auto_reload option.
|
195 |
+
*/
|
196 |
+
public function enableAutoReload()
|
197 |
+
{
|
198 |
+
$this->autoReload = \true;
|
199 |
+
}
|
200 |
+
/**
|
201 |
+
* Disables the auto_reload option.
|
202 |
+
*/
|
203 |
+
public function disableAutoReload()
|
204 |
+
{
|
205 |
+
$this->autoReload = \false;
|
206 |
+
}
|
207 |
+
/**
|
208 |
+
* Checks if the auto_reload option is enabled.
|
209 |
+
*
|
210 |
+
* @return bool true if auto_reload is enabled, false otherwise
|
211 |
+
*/
|
212 |
+
public function isAutoReload()
|
213 |
+
{
|
214 |
+
return $this->autoReload;
|
215 |
+
}
|
216 |
+
/**
|
217 |
+
* Enables the strict_variables option.
|
218 |
+
*/
|
219 |
+
public function enableStrictVariables()
|
220 |
+
{
|
221 |
+
$this->strictVariables = \true;
|
222 |
+
$this->updateOptionsHash();
|
223 |
+
}
|
224 |
+
/**
|
225 |
+
* Disables the strict_variables option.
|
226 |
+
*/
|
227 |
+
public function disableStrictVariables()
|
228 |
+
{
|
229 |
+
$this->strictVariables = \false;
|
230 |
+
$this->updateOptionsHash();
|
231 |
+
}
|
232 |
+
/**
|
233 |
+
* Checks if the strict_variables option is enabled.
|
234 |
+
*
|
235 |
+
* @return bool true if strict_variables is enabled, false otherwise
|
236 |
+
*/
|
237 |
+
public function isStrictVariables()
|
238 |
+
{
|
239 |
+
return $this->strictVariables;
|
240 |
+
}
|
241 |
+
/**
|
242 |
+
* Gets the current cache implementation.
|
243 |
+
*
|
244 |
+
* @param bool $original Whether to return the original cache option or the real cache instance
|
245 |
+
*
|
246 |
+
* @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation,
|
247 |
+
* an absolute path to the compiled templates,
|
248 |
+
* or false to disable cache
|
249 |
+
*/
|
250 |
+
public function getCache($original = \true)
|
251 |
+
{
|
252 |
+
return $original ? $this->originalCache : $this->cache;
|
253 |
+
}
|
254 |
+
/**
|
255 |
+
* Sets the current cache implementation.
|
256 |
+
*
|
257 |
+
* @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation,
|
258 |
+
* an absolute path to the compiled templates,
|
259 |
+
* or false to disable cache
|
260 |
+
*/
|
261 |
+
public function setCache($cache)
|
262 |
+
{
|
263 |
+
if (\is_string($cache)) {
|
264 |
+
$this->originalCache = $cache;
|
265 |
+
$this->cache = new \WPML\Core\Twig\Cache\FilesystemCache($cache);
|
266 |
+
} elseif (\false === $cache) {
|
267 |
+
$this->originalCache = $cache;
|
268 |
+
$this->cache = new \WPML\Core\Twig\Cache\NullCache();
|
269 |
+
} elseif (null === $cache) {
|
270 |
+
@\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);
|
271 |
+
$this->originalCache = \false;
|
272 |
+
$this->cache = new \WPML\Core\Twig\Cache\NullCache();
|
273 |
+
} elseif ($cache instanceof \WPML\Core\Twig\Cache\CacheInterface) {
|
274 |
+
$this->originalCache = $this->cache = $cache;
|
275 |
+
} else {
|
276 |
+
throw new \LogicException(\sprintf('Cache can only be a string, false, or a \\Twig\\Cache\\CacheInterface implementation.'));
|
277 |
+
}
|
278 |
+
}
|
279 |
+
/**
|
280 |
+
* Gets the cache filename for a given template.
|
281 |
+
*
|
282 |
+
* @param string $name The template name
|
283 |
+
*
|
284 |
+
* @return string|false The cache file name or false when caching is disabled
|
285 |
+
*
|
286 |
+
* @deprecated since 1.22 (to be removed in 2.0)
|
287 |
+
*/
|
288 |
+
public function getCacheFilename($name)
|
289 |
+
{
|
290 |
+
@\trigger_error(\sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
291 |
+
$key = $this->cache->generateKey($name, $this->getTemplateClass($name));
|
292 |
+
return !$key ? \false : $key;
|
293 |
+
}
|
294 |
+
/**
|
295 |
+
* Gets the template class associated with the given string.
|
296 |
+
*
|
297 |
+
* The generated template class is based on the following parameters:
|
298 |
+
*
|
299 |
+
* * The cache key for the given template;
|
300 |
+
* * The currently enabled extensions;
|
301 |
+
* * Whether the Twig C extension is available or not;
|
302 |
+
* * PHP version;
|
303 |
+
* * Twig version;
|
304 |
+
* * Options with what environment was created.
|
305 |
+
*
|
306 |
+
* @param string $name The name for which to calculate the template class name
|
307 |
+
* @param int|null $index The index if it is an embedded template
|
308 |
+
*
|
309 |
+
* @return string The template class name
|
310 |
+
*/
|
311 |
+
public function getTemplateClass($name, $index = null)
|
312 |
+
{
|
313 |
+
$key = $this->getLoader()->getCacheKey($name) . $this->optionsHash;
|
314 |
+
return $this->templateClassPrefix . \hash('sha256', $key) . (null === $index ? '' : '___' . $index);
|
315 |
+
}
|
316 |
+
/**
|
317 |
+
* Gets the template class prefix.
|
318 |
+
*
|
319 |
+
* @return string The template class prefix
|
320 |
+
*
|
321 |
+
* @deprecated since 1.22 (to be removed in 2.0)
|
322 |
+
*/
|
323 |
+
public function getTemplateClassPrefix()
|
324 |
+
{
|
325 |
+
@\trigger_error(\sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
326 |
+
return $this->templateClassPrefix;
|
327 |
+
}
|
328 |
+
/**
|
329 |
+
* Renders a template.
|
330 |
+
*
|
331 |
+
* @param string|TemplateWrapper $name The template name
|
332 |
+
* @param array $context An array of parameters to pass to the template
|
333 |
+
*
|
334 |
+
* @return string The rendered template
|
335 |
+
*
|
336 |
+
* @throws LoaderError When the template cannot be found
|
337 |
+
* @throws SyntaxError When an error occurred during compilation
|
338 |
+
* @throws RuntimeError When an error occurred during rendering
|
339 |
+
*/
|
340 |
+
public function render($name, array $context = [])
|
341 |
+
{
|
342 |
+
return $this->load($name)->render($context);
|
343 |
+
}
|
344 |
+
/**
|
345 |
+
* Displays a template.
|
346 |
+
*
|
347 |
+
* @param string|TemplateWrapper $name The template name
|
348 |
+
* @param array $context An array of parameters to pass to the template
|
349 |
+
*
|
350 |
+
* @throws LoaderError When the template cannot be found
|
351 |
+
* @throws SyntaxError When an error occurred during compilation
|
352 |
+
* @throws RuntimeError When an error occurred during rendering
|
353 |
+
*/
|
354 |
+
public function display($name, array $context = [])
|
355 |
+
{
|
356 |
+
$this->load($name)->display($context);
|
357 |
+
}
|
358 |
+
/**
|
359 |
+
* Loads a template.
|
360 |
+
*
|
361 |
+
* @param string|TemplateWrapper|\Twig\Template $name The template name
|
362 |
+
*
|
363 |
+
* @throws LoaderError When the template cannot be found
|
364 |
+
* @throws RuntimeError When a previously generated cache is corrupted
|
365 |
+
* @throws SyntaxError When an error occurred during compilation
|
366 |
+
*
|
367 |
+
* @return TemplateWrapper
|
368 |
+
*/
|
369 |
+
public function load($name)
|
370 |
+
{
|
371 |
+
if ($name instanceof \WPML\Core\Twig\TemplateWrapper) {
|
372 |
+
return $name;
|
373 |
+
}
|
374 |
+
if ($name instanceof \WPML\Core\Twig\Template) {
|
375 |
+
return new \WPML\Core\Twig\TemplateWrapper($this, $name);
|
376 |
+
}
|
377 |
+
return new \WPML\Core\Twig\TemplateWrapper($this, $this->loadTemplate($name));
|
378 |
+
}
|
379 |
+
/**
|
380 |
+
* Loads a template internal representation.
|
381 |
+
*
|
382 |
+
* This method is for internal use only and should never be called
|
383 |
+
* directly.
|
384 |
+
*
|
385 |
+
* @param string $name The template name
|
386 |
+
* @param int $index The index if it is an embedded template
|
387 |
+
*
|
388 |
+
* @return \Twig_TemplateInterface A template instance representing the given template name
|
389 |
+
*
|
390 |
+
* @throws LoaderError When the template cannot be found
|
391 |
+
* @throws RuntimeError When a previously generated cache is corrupted
|
392 |
+
* @throws SyntaxError When an error occurred during compilation
|
393 |
+
*
|
394 |
+
* @internal
|
395 |
+
*/
|
396 |
+
public function loadTemplate($name, $index = null)
|
397 |
+
{
|
398 |
+
return $this->loadClass($this->getTemplateClass($name), $name, $index);
|
399 |
+
}
|
400 |
+
/**
|
401 |
+
* @internal
|
402 |
+
*/
|
403 |
+
public function loadClass($cls, $name, $index = null)
|
404 |
+
{
|
405 |
+
$mainCls = $cls;
|
406 |
+
if (null !== $index) {
|
407 |
+
$cls .= '___' . $index;
|
408 |
+
}
|
409 |
+
if (isset($this->loadedTemplates[$cls])) {
|
410 |
+
return $this->loadedTemplates[$cls];
|
411 |
+
}
|
412 |
+
if (!\class_exists($cls, \false)) {
|
413 |
+
if ($this->bcGetCacheFilename) {
|
414 |
+
$key = $this->getCacheFilename($name);
|
415 |
+
} else {
|
416 |
+
$key = $this->cache->generateKey($name, $mainCls);
|
417 |
+
}
|
418 |
+
if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
|
419 |
+
$this->cache->load($key);
|
420 |
+
}
|
421 |
+
$source = null;
|
422 |
+
if (!\class_exists($cls, \false)) {
|
423 |
+
$loader = $this->getLoader();
|
424 |
+
if (!$loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface) {
|
425 |
+
$source = new \WPML\Core\Twig\Source($loader->getSource($name), $name);
|
426 |
+
} else {
|
427 |
+
$source = $loader->getSourceContext($name);
|
428 |
+
}
|
429 |
+
$content = $this->compileSource($source);
|
430 |
+
if ($this->bcWriteCacheFile) {
|
431 |
+
$this->writeCacheFile($key, $content);
|
432 |
+
} else {
|
433 |
+
$this->cache->write($key, $content);
|
434 |
+
$this->cache->load($key);
|
435 |
+
}
|
436 |
+
if (!\class_exists($mainCls, \false)) {
|
437 |
+
/* Last line of defense if either $this->bcWriteCacheFile was used,
|
438 |
+
* $this->cache is implemented as a no-op or we have a race condition
|
439 |
+
* where the cache was cleared between the above calls to write to and load from
|
440 |
+
* the cache.
|
441 |
+
*/
|
442 |
+
eval('?>' . $content);
|
443 |
+
}
|
444 |
+
}
|
445 |
+
if (!\class_exists($cls, \false)) {
|
446 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
|
447 |
+
}
|
448 |
+
}
|
449 |
+
if (!$this->runtimeInitialized) {
|
450 |
+
$this->initRuntime();
|
451 |
+
}
|
452 |
+
return $this->loadedTemplates[$cls] = new $cls($this);
|
453 |
+
}
|
454 |
+
/**
|
455 |
+
* Creates a template from source.
|
456 |
+
*
|
457 |
+
* This method should not be used as a generic way to load templates.
|
458 |
+
*
|
459 |
+
* @param string $template The template source
|
460 |
+
* @param string $name An optional name of the template to be used in error messages
|
461 |
+
*
|
462 |
+
* @return TemplateWrapper A template instance representing the given template name
|
463 |
+
*
|
464 |
+
* @throws LoaderError When the template cannot be found
|
465 |
+
* @throws SyntaxError When an error occurred during compilation
|
466 |
+
*/
|
467 |
+
public function createTemplate($template, $name = null)
|
468 |
+
{
|
469 |
+
$hash = \hash('sha256', $template, \false);
|
470 |
+
if (null !== $name) {
|
471 |
+
$name = \sprintf('%s (string template %s)', $name, $hash);
|
472 |
+
} else {
|
473 |
+
$name = \sprintf('__string_template__%s', $hash);
|
474 |
+
}
|
475 |
+
$loader = new \WPML\Core\Twig\Loader\ChainLoader([new \WPML\Core\Twig\Loader\ArrayLoader([$name => $template]), $current = $this->getLoader()]);
|
476 |
+
$this->setLoader($loader);
|
477 |
+
try {
|
478 |
+
$template = new \WPML\Core\Twig\TemplateWrapper($this, $this->loadTemplate($name));
|
479 |
+
} catch (\Exception $e) {
|
480 |
+
$this->setLoader($current);
|
481 |
+
throw $e;
|
482 |
+
} catch (\Throwable $e) {
|
483 |
+
$this->setLoader($current);
|
484 |
+
throw $e;
|
485 |
+
}
|
486 |
+
$this->setLoader($current);
|
487 |
+
return $template;
|
488 |
+
}
|
489 |
+
/**
|
490 |
+
* Returns true if the template is still fresh.
|
491 |
+
*
|
492 |
+
* Besides checking the loader for freshness information,
|
493 |
+
* this method also checks if the enabled extensions have
|
494 |
+
* not changed.
|
495 |
+
*
|
496 |
+
* @param string $name The template name
|
497 |
+
* @param int $time The last modification time of the cached template
|
498 |
+
*
|
499 |
+
* @return bool true if the template is fresh, false otherwise
|
500 |
+
*/
|
501 |
+
public function isTemplateFresh($name, $time)
|
502 |
+
{
|
503 |
+
if (0 === $this->lastModifiedExtension) {
|
504 |
+
foreach ($this->extensions as $extension) {
|
505 |
+
$r = new \ReflectionObject($extension);
|
506 |
+
if (\file_exists($r->getFileName()) && ($extensionTime = \filemtime($r->getFileName())) > $this->lastModifiedExtension) {
|
507 |
+
$this->lastModifiedExtension = $extensionTime;
|
508 |
+
}
|
509 |
+
}
|
510 |
+
}
|
511 |
+
return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time);
|
512 |
+
}
|
513 |
+
/**
|
514 |
+
* Tries to load a template consecutively from an array.
|
515 |
+
*
|
516 |
+
* Similar to load() but it also accepts instances of \Twig\Template and
|
517 |
+
* \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded.
|
518 |
+
*
|
519 |
+
* @param string|Template|\Twig\TemplateWrapper|array $names A template or an array of templates to try consecutively
|
520 |
+
*
|
521 |
+
* @return TemplateWrapper|Template
|
522 |
+
*
|
523 |
+
* @throws LoaderError When none of the templates can be found
|
524 |
+
* @throws SyntaxError When an error occurred during compilation
|
525 |
+
*/
|
526 |
+
public function resolveTemplate($names)
|
527 |
+
{
|
528 |
+
if (!\is_array($names)) {
|
529 |
+
$names = [$names];
|
530 |
+
}
|
531 |
+
foreach ($names as $name) {
|
532 |
+
if ($name instanceof \WPML\Core\Twig\Template) {
|
533 |
+
return $name;
|
534 |
+
}
|
535 |
+
if ($name instanceof \WPML\Core\Twig\TemplateWrapper) {
|
536 |
+
return $name;
|
537 |
+
}
|
538 |
+
try {
|
539 |
+
return $this->loadTemplate($name);
|
540 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
541 |
+
if (1 === \count($names)) {
|
542 |
+
throw $e;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
}
|
546 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Unable to find one of the following templates: "%s".', \implode('", "', $names)));
|
547 |
+
}
|
548 |
+
/**
|
549 |
+
* Clears the internal template cache.
|
550 |
+
*
|
551 |
+
* @deprecated since 1.18.3 (to be removed in 2.0)
|
552 |
+
*/
|
553 |
+
public function clearTemplateCache()
|
554 |
+
{
|
555 |
+
@\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);
|
556 |
+
$this->loadedTemplates = [];
|
557 |
+
}
|
558 |
+
/**
|
559 |
+
* Clears the template cache files on the filesystem.
|
560 |
+
*
|
561 |
+
* @deprecated since 1.22 (to be removed in 2.0)
|
562 |
+
*/
|
563 |
+
public function clearCacheFiles()
|
564 |
+
{
|
565 |
+
@\trigger_error(\sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
566 |
+
if (\is_string($this->originalCache)) {
|
567 |
+
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->originalCache), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
|
568 |
+
if ($file->isFile()) {
|
569 |
+
@\unlink($file->getPathname());
|
570 |
+
}
|
571 |
+
}
|
572 |
+
}
|
573 |
+
}
|
574 |
+
/**
|
575 |
+
* Gets the Lexer instance.
|
576 |
+
*
|
577 |
+
* @return \Twig_LexerInterface
|
578 |
+
*
|
579 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
580 |
+
*/
|
581 |
+
public function getLexer()
|
582 |
+
{
|
583 |
+
@\trigger_error(\sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), \E_USER_DEPRECATED);
|
584 |
+
if (null === $this->lexer) {
|
585 |
+
$this->lexer = new \WPML\Core\Twig\Lexer($this);
|
586 |
+
}
|
587 |
+
return $this->lexer;
|
588 |
+
}
|
589 |
+
public function setLexer(\WPML\Core\Twig_LexerInterface $lexer)
|
590 |
+
{
|
591 |
+
$this->lexer = $lexer;
|
592 |
+
}
|
593 |
+
/**
|
594 |
+
* Tokenizes a source code.
|
595 |
+
*
|
596 |
+
* @param string|Source $source The template source code
|
597 |
+
* @param string $name The template name (deprecated)
|
598 |
+
*
|
599 |
+
* @return TokenStream
|
600 |
+
*
|
601 |
+
* @throws SyntaxError When the code is syntactically wrong
|
602 |
+
*/
|
603 |
+
public function tokenize($source, $name = null)
|
604 |
+
{
|
605 |
+
if (!$source instanceof \WPML\Core\Twig\Source) {
|
606 |
+
@\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);
|
607 |
+
$source = new \WPML\Core\Twig\Source($source, $name);
|
608 |
+
}
|
609 |
+
if (null === $this->lexer) {
|
610 |
+
$this->lexer = new \WPML\Core\Twig\Lexer($this);
|
611 |
+
}
|
612 |
+
return $this->lexer->tokenize($source);
|
613 |
+
}
|
614 |
+
/**
|
615 |
+
* Gets the Parser instance.
|
616 |
+
*
|
617 |
+
* @return \Twig_ParserInterface
|
618 |
+
*
|
619 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
620 |
+
*/
|
621 |
+
public function getParser()
|
622 |
+
{
|
623 |
+
@\trigger_error(\sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), \E_USER_DEPRECATED);
|
624 |
+
if (null === $this->parser) {
|
625 |
+
$this->parser = new \WPML\Core\Twig\Parser($this);
|
626 |
+
}
|
627 |
+
return $this->parser;
|
628 |
+
}
|
629 |
+
public function setParser(\WPML\Core\Twig_ParserInterface $parser)
|
630 |
+
{
|
631 |
+
$this->parser = $parser;
|
632 |
+
}
|
633 |
+
/**
|
634 |
+
* Converts a token stream to a node tree.
|
635 |
+
*
|
636 |
+
* @return ModuleNode
|
637 |
+
*
|
638 |
+
* @throws SyntaxError When the token stream is syntactically or semantically wrong
|
639 |
+
*/
|
640 |
+
public function parse(\WPML\Core\Twig\TokenStream $stream)
|
641 |
+
{
|
642 |
+
if (null === $this->parser) {
|
643 |
+
$this->parser = new \WPML\Core\Twig\Parser($this);
|
644 |
+
}
|
645 |
+
return $this->parser->parse($stream);
|
646 |
+
}
|
647 |
+
/**
|
648 |
+
* Gets the Compiler instance.
|
649 |
+
*
|
650 |
+
* @return \Twig_CompilerInterface
|
651 |
+
*
|
652 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
653 |
+
*/
|
654 |
+
public function getCompiler()
|
655 |
+
{
|
656 |
+
@\trigger_error(\sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), \E_USER_DEPRECATED);
|
657 |
+
if (null === $this->compiler) {
|
658 |
+
$this->compiler = new \WPML\Core\Twig\Compiler($this);
|
659 |
+
}
|
660 |
+
return $this->compiler;
|
661 |
+
}
|
662 |
+
public function setCompiler(\WPML\Core\Twig_CompilerInterface $compiler)
|
663 |
+
{
|
664 |
+
$this->compiler = $compiler;
|
665 |
+
}
|
666 |
+
/**
|
667 |
+
* Compiles a node and returns the PHP code.
|
668 |
+
*
|
669 |
+
* @return string The compiled PHP source code
|
670 |
+
*/
|
671 |
+
public function compile(\WPML\Core\Twig_NodeInterface $node)
|
672 |
+
{
|
673 |
+
if (null === $this->compiler) {
|
674 |
+
$this->compiler = new \WPML\Core\Twig\Compiler($this);
|
675 |
+
}
|
676 |
+
return $this->compiler->compile($node)->getSource();
|
677 |
+
}
|
678 |
+
/**
|
679 |
+
* Compiles a template source code.
|
680 |
+
*
|
681 |
+
* @param string|Source $source The template source code
|
682 |
+
* @param string $name The template name (deprecated)
|
683 |
+
*
|
684 |
+
* @return string The compiled PHP source code
|
685 |
+
*
|
686 |
+
* @throws SyntaxError When there was an error during tokenizing, parsing or compiling
|
687 |
+
*/
|
688 |
+
public function compileSource($source, $name = null)
|
689 |
+
{
|
690 |
+
if (!$source instanceof \WPML\Core\Twig\Source) {
|
691 |
+
@\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);
|
692 |
+
$source = new \WPML\Core\Twig\Source($source, $name);
|
693 |
+
}
|
694 |
+
try {
|
695 |
+
return $this->compile($this->parse($this->tokenize($source)));
|
696 |
+
} catch (\WPML\Core\Twig\Error\Error $e) {
|
697 |
+
$e->setSourceContext($source);
|
698 |
+
throw $e;
|
699 |
+
} catch (\Exception $e) {
|
700 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e);
|
701 |
+
}
|
702 |
+
}
|
703 |
+
public function setLoader(\WPML\Core\Twig\Loader\LoaderInterface $loader)
|
704 |
+
{
|
705 |
+
if (!$loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface && 0 !== \strpos(\get_class($loader), 'Mock_')) {
|
706 |
+
@\trigger_error(\sprintf('Twig loader "%s" should implement Twig\\Loader\\SourceContextLoaderInterface since version 1.27.', \get_class($loader)), \E_USER_DEPRECATED);
|
707 |
+
}
|
708 |
+
$this->loader = $loader;
|
709 |
+
}
|
710 |
+
/**
|
711 |
+
* Gets the Loader instance.
|
712 |
+
*
|
713 |
+
* @return LoaderInterface
|
714 |
+
*/
|
715 |
+
public function getLoader()
|
716 |
+
{
|
717 |
+
if (null === $this->loader) {
|
718 |
+
throw new \LogicException('You must set a loader first.');
|
719 |
+
}
|
720 |
+
return $this->loader;
|
721 |
+
}
|
722 |
+
/**
|
723 |
+
* Sets the default template charset.
|
724 |
+
*
|
725 |
+
* @param string $charset The default charset
|
726 |
+
*/
|
727 |
+
public function setCharset($charset)
|
728 |
+
{
|
729 |
+
$this->charset = \strtoupper($charset);
|
730 |
+
}
|
731 |
+
/**
|
732 |
+
* Gets the default template charset.
|
733 |
+
*
|
734 |
+
* @return string The default charset
|
735 |
+
*/
|
736 |
+
public function getCharset()
|
737 |
+
{
|
738 |
+
return $this->charset;
|
739 |
+
}
|
740 |
+
/**
|
741 |
+
* Initializes the runtime environment.
|
742 |
+
*
|
743 |
+
* @deprecated since 1.23 (to be removed in 2.0)
|
744 |
+
*/
|
745 |
+
public function initRuntime()
|
746 |
+
{
|
747 |
+
$this->runtimeInitialized = \true;
|
748 |
+
foreach ($this->getExtensions() as $name => $extension) {
|
749 |
+
if (!$extension instanceof \WPML\Core\Twig\Extension\InitRuntimeInterface) {
|
750 |
+
$m = new \ReflectionMethod($extension, 'initRuntime');
|
751 |
+
$parentClass = $m->getDeclaringClass()->getName();
|
752 |
+
if ('Twig_Extension' !== $parentClass && 'WPML\\Core\\Twig\\Extension\\AbstractExtension' !== $parentClass) {
|
753 |
+
@\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);
|
754 |
+
}
|
755 |
+
}
|
756 |
+
$extension->initRuntime($this);
|
757 |
+
}
|
758 |
+
}
|
759 |
+
/**
|
760 |
+
* Returns true if the given extension is registered.
|
761 |
+
*
|
762 |
+
* @param string $class The extension class name
|
763 |
+
*
|
764 |
+
* @return bool Whether the extension is registered or not
|
765 |
+
*/
|
766 |
+
public function hasExtension($class)
|
767 |
+
{
|
768 |
+
$class = \ltrim($class, '\\');
|
769 |
+
if (!isset($this->extensionsByClass[$class]) && \class_exists($class, \false)) {
|
770 |
+
// For BC/FC with namespaced aliases
|
771 |
+
$class = new \ReflectionClass($class);
|
772 |
+
$class = $class->name;
|
773 |
+
}
|
774 |
+
if (isset($this->extensions[$class])) {
|
775 |
+
if ($class !== \get_class($this->extensions[$class])) {
|
776 |
+
@\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);
|
777 |
+
}
|
778 |
+
return \true;
|
779 |
+
}
|
780 |
+
return isset($this->extensionsByClass[$class]);
|
781 |
+
}
|
782 |
+
/**
|
783 |
+
* Adds a runtime loader.
|
784 |
+
*/
|
785 |
+
public function addRuntimeLoader(\WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface $loader)
|
786 |
+
{
|
787 |
+
$this->runtimeLoaders[] = $loader;
|
788 |
+
}
|
789 |
+
/**
|
790 |
+
* Gets an extension by class name.
|
791 |
+
*
|
792 |
+
* @param string $class The extension class name
|
793 |
+
*
|
794 |
+
* @return ExtensionInterface
|
795 |
+
*/
|
796 |
+
public function getExtension($class)
|
797 |
+
{
|
798 |
+
$class = \ltrim($class, '\\');
|
799 |
+
if (!isset($this->extensionsByClass[$class]) && \class_exists($class, \false)) {
|
800 |
+
// For BC/FC with namespaced aliases
|
801 |
+
$class = new \ReflectionClass($class);
|
802 |
+
$class = $class->name;
|
803 |
+
}
|
804 |
+
if (isset($this->extensions[$class])) {
|
805 |
+
if ($class !== \get_class($this->extensions[$class])) {
|
806 |
+
@\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);
|
807 |
+
}
|
808 |
+
return $this->extensions[$class];
|
809 |
+
}
|
810 |
+
if (!isset($this->extensionsByClass[$class])) {
|
811 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The "%s" extension is not enabled.', $class));
|
812 |
+
}
|
813 |
+
return $this->extensionsByClass[$class];
|
814 |
+
}
|
815 |
+
/**
|
816 |
+
* Returns the runtime implementation of a Twig element (filter/function/test).
|
817 |
+
*
|
818 |
+
* @param string $class A runtime class name
|
819 |
+
*
|
820 |
+
* @return object The runtime implementation
|
821 |
+
*
|
822 |
+
* @throws RuntimeError When the template cannot be found
|
823 |
+
*/
|
824 |
+
public function getRuntime($class)
|
825 |
+
{
|
826 |
+
if (isset($this->runtimes[$class])) {
|
827 |
+
return $this->runtimes[$class];
|
828 |
+
}
|
829 |
+
foreach ($this->runtimeLoaders as $loader) {
|
830 |
+
if (null !== ($runtime = $loader->load($class))) {
|
831 |
+
return $this->runtimes[$class] = $runtime;
|
832 |
+
}
|
833 |
+
}
|
834 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('Unable to load the "%s" runtime.', $class));
|
835 |
+
}
|
836 |
+
public function addExtension(\WPML\Core\Twig\Extension\ExtensionInterface $extension)
|
837 |
+
{
|
838 |
+
if ($this->extensionInitialized) {
|
839 |
+
throw new \LogicException(\sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
|
840 |
+
}
|
841 |
+
$class = \get_class($extension);
|
842 |
+
if ($class !== $extension->getName()) {
|
843 |
+
if (isset($this->extensions[$extension->getName()])) {
|
844 |
+
unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]);
|
845 |
+
@\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);
|
846 |
+
}
|
847 |
+
}
|
848 |
+
$this->lastModifiedExtension = 0;
|
849 |
+
$this->extensionsByClass[$class] = $extension;
|
850 |
+
$this->extensions[$extension->getName()] = $extension;
|
851 |
+
$this->updateOptionsHash();
|
852 |
+
}
|
853 |
+
/**
|
854 |
+
* Removes an extension by name.
|
855 |
+
*
|
856 |
+
* This method is deprecated and you should not use it.
|
857 |
+
*
|
858 |
+
* @param string $name The extension name
|
859 |
+
*
|
860 |
+
* @deprecated since 1.12 (to be removed in 2.0)
|
861 |
+
*/
|
862 |
+
public function removeExtension($name)
|
863 |
+
{
|
864 |
+
@\trigger_error(\sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
865 |
+
if ($this->extensionInitialized) {
|
866 |
+
throw new \LogicException(\sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
|
867 |
+
}
|
868 |
+
$class = \ltrim($name, '\\');
|
869 |
+
if (!isset($this->extensionsByClass[$class]) && \class_exists($class, \false)) {
|
870 |
+
// For BC/FC with namespaced aliases
|
871 |
+
$class = new \ReflectionClass($class);
|
872 |
+
$class = $class->name;
|
873 |
+
}
|
874 |
+
if (isset($this->extensions[$class])) {
|
875 |
+
if ($class !== \get_class($this->extensions[$class])) {
|
876 |
+
@\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);
|
877 |
+
}
|
878 |
+
unset($this->extensions[$class]);
|
879 |
+
}
|
880 |
+
unset($this->extensions[$class]);
|
881 |
+
$this->updateOptionsHash();
|
882 |
+
}
|
883 |
+
/**
|
884 |
+
* Registers an array of extensions.
|
885 |
+
*
|
886 |
+
* @param array $extensions An array of extensions
|
887 |
+
*/
|
888 |
+
public function setExtensions(array $extensions)
|
889 |
+
{
|
890 |
+
foreach ($extensions as $extension) {
|
891 |
+
$this->addExtension($extension);
|
892 |
+
}
|
893 |
+
}
|
894 |
+
/**
|
895 |
+
* Returns all registered extensions.
|
896 |
+
*
|
897 |
+
* @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on)
|
898 |
+
*/
|
899 |
+
public function getExtensions()
|
900 |
+
{
|
901 |
+
return $this->extensions;
|
902 |
+
}
|
903 |
+
public function addTokenParser(\WPML\Core\Twig\TokenParser\TokenParserInterface $parser)
|
904 |
+
{
|
905 |
+
if ($this->extensionInitialized) {
|
906 |
+
throw new \LogicException('Unable to add a token parser as extensions have already been initialized.');
|
907 |
+
}
|
908 |
+
$this->staging->addTokenParser($parser);
|
909 |
+
}
|
910 |
+
/**
|
911 |
+
* Gets the registered Token Parsers.
|
912 |
+
*
|
913 |
+
* @return \Twig_TokenParserBrokerInterface
|
914 |
+
*
|
915 |
+
* @internal
|
916 |
+
*/
|
917 |
+
public function getTokenParsers()
|
918 |
+
{
|
919 |
+
if (!$this->extensionInitialized) {
|
920 |
+
$this->initExtensions();
|
921 |
+
}
|
922 |
+
return $this->parsers;
|
923 |
+
}
|
924 |
+
/**
|
925 |
+
* Gets registered tags.
|
926 |
+
*
|
927 |
+
* Be warned that this method cannot return tags defined by \Twig_TokenParserBrokerInterface classes.
|
928 |
+
*
|
929 |
+
* @return TokenParserInterface[]
|
930 |
+
*
|
931 |
+
* @internal
|
932 |
+
*/
|
933 |
+
public function getTags()
|
934 |
+
{
|
935 |
+
$tags = [];
|
936 |
+
foreach ($this->getTokenParsers()->getParsers() as $parser) {
|
937 |
+
if ($parser instanceof \WPML\Core\Twig\TokenParser\TokenParserInterface) {
|
938 |
+
$tags[$parser->getTag()] = $parser;
|
939 |
+
}
|
940 |
+
}
|
941 |
+
return $tags;
|
942 |
+
}
|
943 |
+
public function addNodeVisitor(\WPML\Core\Twig\NodeVisitor\NodeVisitorInterface $visitor)
|
944 |
+
{
|
945 |
+
if ($this->extensionInitialized) {
|
946 |
+
throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.');
|
947 |
+
}
|
948 |
+
$this->staging->addNodeVisitor($visitor);
|
949 |
+
}
|
950 |
+
/**
|
951 |
+
* Gets the registered Node Visitors.
|
952 |
+
*
|
953 |
+
* @return NodeVisitorInterface[]
|
954 |
+
*
|
955 |
+
* @internal
|
956 |
+
*/
|
957 |
+
public function getNodeVisitors()
|
958 |
+
{
|
959 |
+
if (!$this->extensionInitialized) {
|
960 |
+
$this->initExtensions();
|
961 |
+
}
|
962 |
+
return $this->visitors;
|
963 |
+
}
|
964 |
+
/**
|
965 |
+
* Registers a Filter.
|
966 |
+
*
|
967 |
+
* @param string|TwigFilter $name The filter name or a \Twig_SimpleFilter instance
|
968 |
+
* @param \Twig_FilterInterface|TwigFilter $filter
|
969 |
+
*/
|
970 |
+
public function addFilter($name, $filter = null)
|
971 |
+
{
|
972 |
+
if (!$name instanceof \WPML\Core\Twig\TwigFilter && !($filter instanceof \WPML\Core\Twig\TwigFilter || $filter instanceof \WPML\Core\Twig_FilterInterface)) {
|
973 |
+
throw new \LogicException('A filter must be an instance of \\Twig_FilterInterface or \\Twig_SimpleFilter.');
|
974 |
+
}
|
975 |
+
if ($name instanceof \WPML\Core\Twig\TwigFilter) {
|
976 |
+
$filter = $name;
|
977 |
+
$name = $filter->getName();
|
978 |
+
} else {
|
979 |
+
@\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);
|
980 |
+
}
|
981 |
+
if ($this->extensionInitialized) {
|
982 |
+
throw new \LogicException(\sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name));
|
983 |
+
}
|
984 |
+
$this->staging->addFilter($name, $filter);
|
985 |
+
}
|
986 |
+
/**
|
987 |
+
* Get a filter by name.
|
988 |
+
*
|
989 |
+
* Subclasses may override this method and load filters differently;
|
990 |
+
* so no list of filters is available.
|
991 |
+
*
|
992 |
+
* @param string $name The filter name
|
993 |
+
*
|
994 |
+
* @return \Twig_Filter|false
|
995 |
+
*
|
996 |
+
* @internal
|
997 |
+
*/
|
998 |
+
public function getFilter($name)
|
999 |
+
{
|
1000 |
+
if (!$this->extensionInitialized) {
|
1001 |
+
$this->initExtensions();
|
1002 |
+
}
|
1003 |
+
if (isset($this->filters[$name])) {
|
1004 |
+
return $this->filters[$name];
|
1005 |
+
}
|
1006 |
+
foreach ($this->filters as $pattern => $filter) {
|
1007 |
+
$pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count);
|
1008 |
+
if ($count) {
|
1009 |
+
if (\preg_match('#^' . $pattern . '$#', $name, $matches)) {
|
1010 |
+
\array_shift($matches);
|
1011 |
+
$filter->setArguments($matches);
|
1012 |
+
return $filter;
|
1013 |
+
}
|
1014 |
+
}
|
1015 |
+
}
|
1016 |
+
foreach ($this->filterCallbacks as $callback) {
|
1017 |
+
if (\false !== ($filter = \call_user_func($callback, $name))) {
|
1018 |
+
return $filter;
|
1019 |
+
}
|
1020 |
+
}
|
1021 |
+
return \false;
|
1022 |
+
}
|
1023 |
+
public function registerUndefinedFilterCallback($callable)
|
1024 |
+
{
|
1025 |
+
$this->filterCallbacks[] = $callable;
|
1026 |
+
}
|
1027 |
+
/**
|
1028 |
+
* Gets the registered Filters.
|
1029 |
+
*
|
1030 |
+
* Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
|
1031 |
+
*
|
1032 |
+
* @return \Twig_FilterInterface[]
|
1033 |
+
*
|
1034 |
+
* @see registerUndefinedFilterCallback
|
1035 |
+
*
|
1036 |
+
* @internal
|
1037 |
+
*/
|
1038 |
+
public function getFilters()
|
1039 |
+
{
|
1040 |
+
if (!$this->extensionInitialized) {
|
1041 |
+
$this->initExtensions();
|
1042 |
+
}
|
1043 |
+
return $this->filters;
|
1044 |
+
}
|
1045 |
+
/**
|
1046 |
+
* Registers a Test.
|
1047 |
+
*
|
1048 |
+
* @param string|TwigTest $name The test name or a \Twig_SimpleTest instance
|
1049 |
+
* @param \Twig_TestInterface|TwigTest $test A \Twig_TestInterface instance or a \Twig_SimpleTest instance
|
1050 |
+
*/
|
1051 |
+
public function addTest($name, $test = null)
|
1052 |
+
{
|
1053 |
+
if (!$name instanceof \WPML\Core\Twig\TwigTest && !($test instanceof \WPML\Core\Twig\TwigTest || $test instanceof \WPML\Core\Twig_TestInterface)) {
|
1054 |
+
throw new \LogicException('A test must be an instance of \\Twig_TestInterface or \\Twig_SimpleTest.');
|
1055 |
+
}
|
1056 |
+
if ($name instanceof \WPML\Core\Twig\TwigTest) {
|
1057 |
+
$test = $name;
|
1058 |
+
$name = $test->getName();
|
1059 |
+
} else {
|
1060 |
+
@\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);
|
1061 |
+
}
|
1062 |
+
if ($this->extensionInitialized) {
|
1063 |
+
throw new \LogicException(\sprintf('Unable to add test "%s" as extensions have already been initialized.', $name));
|
1064 |
+
}
|
1065 |
+
$this->staging->addTest($name, $test);
|
1066 |
+
}
|
1067 |
+
/**
|
1068 |
+
* Gets the registered Tests.
|
1069 |
+
*
|
1070 |
+
* @return \Twig_TestInterface[]
|
1071 |
+
*
|
1072 |
+
* @internal
|
1073 |
+
*/
|
1074 |
+
public function getTests()
|
1075 |
+
{
|
1076 |
+
if (!$this->extensionInitialized) {
|
1077 |
+
$this->initExtensions();
|
1078 |
+
}
|
1079 |
+
return $this->tests;
|
1080 |
+
}
|
1081 |
+
/**
|
1082 |
+
* Gets a test by name.
|
1083 |
+
*
|
1084 |
+
* @param string $name The test name
|
1085 |
+
*
|
1086 |
+
* @return \Twig_Test|false
|
1087 |
+
*
|
1088 |
+
* @internal
|
1089 |
+
*/
|
1090 |
+
public function getTest($name)
|
1091 |
+
{
|
1092 |
+
if (!$this->extensionInitialized) {
|
1093 |
+
$this->initExtensions();
|
1094 |
+
}
|
1095 |
+
if (isset($this->tests[$name])) {
|
1096 |
+
return $this->tests[$name];
|
1097 |
+
}
|
1098 |
+
foreach ($this->tests as $pattern => $test) {
|
1099 |
+
$pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count);
|
1100 |
+
if ($count) {
|
1101 |
+
if (\preg_match('#^' . $pattern . '$#', $name, $matches)) {
|
1102 |
+
\array_shift($matches);
|
1103 |
+
$test->setArguments($matches);
|
1104 |
+
return $test;
|
1105 |
+
}
|
1106 |
+
}
|
1107 |
+
}
|
1108 |
+
return \false;
|
1109 |
+
}
|
1110 |
+
/**
|
1111 |
+
* Registers a Function.
|
1112 |
+
*
|
1113 |
+
* @param string|TwigFunction $name The function name or a \Twig_SimpleFunction instance
|
1114 |
+
* @param \Twig_FunctionInterface|TwigFunction $function
|
1115 |
+
*/
|
1116 |
+
public function addFunction($name, $function = null)
|
1117 |
+
{
|
1118 |
+
if (!$name instanceof \WPML\Core\Twig\TwigFunction && !($function instanceof \WPML\Core\Twig\TwigFunction || $function instanceof \WPML\Core\Twig_FunctionInterface)) {
|
1119 |
+
throw new \LogicException('A function must be an instance of \\Twig_FunctionInterface or \\Twig_SimpleFunction.');
|
1120 |
+
}
|
1121 |
+
if ($name instanceof \WPML\Core\Twig\TwigFunction) {
|
1122 |
+
$function = $name;
|
1123 |
+
$name = $function->getName();
|
1124 |
+
} else {
|
1125 |
+
@\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);
|
1126 |
+
}
|
1127 |
+
if ($this->extensionInitialized) {
|
1128 |
+
throw new \LogicException(\sprintf('Unable to add function "%s" as extensions have already been initialized.', $name));
|
1129 |
+
}
|
1130 |
+
$this->staging->addFunction($name, $function);
|
1131 |
+
}
|
1132 |
+
/**
|
1133 |
+
* Get a function by name.
|
1134 |
+
*
|
1135 |
+
* Subclasses may override this method and load functions differently;
|
1136 |
+
* so no list of functions is available.
|
1137 |
+
*
|
1138 |
+
* @param string $name function name
|
1139 |
+
*
|
1140 |
+
* @return \Twig_Function|false
|
1141 |
+
*
|
1142 |
+
* @internal
|
1143 |
+
*/
|
1144 |
+
public function getFunction($name)
|
1145 |
+
{
|
1146 |
+
if (!$this->extensionInitialized) {
|
1147 |
+
$this->initExtensions();
|
1148 |
+
}
|
1149 |
+
if (isset($this->functions[$name])) {
|
1150 |
+
return $this->functions[$name];
|
1151 |
+
}
|
1152 |
+
foreach ($this->functions as $pattern => $function) {
|
1153 |
+
$pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count);
|
1154 |
+
if ($count) {
|
1155 |
+
if (\preg_match('#^' . $pattern . '$#', $name, $matches)) {
|
1156 |
+
\array_shift($matches);
|
1157 |
+
$function->setArguments($matches);
|
1158 |
+
return $function;
|
1159 |
+
}
|
1160 |
+
}
|
1161 |
+
}
|
1162 |
+
foreach ($this->functionCallbacks as $callback) {
|
1163 |
+
if (\false !== ($function = \call_user_func($callback, $name))) {
|
1164 |
+
return $function;
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
+
return \false;
|
1168 |
+
}
|
1169 |
+
public function registerUndefinedFunctionCallback($callable)
|
1170 |
+
{
|
1171 |
+
$this->functionCallbacks[] = $callable;
|
1172 |
+
}
|
1173 |
+
/**
|
1174 |
+
* Gets registered functions.
|
1175 |
+
*
|
1176 |
+
* Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
|
1177 |
+
*
|
1178 |
+
* @return \Twig_FunctionInterface[]
|
1179 |
+
*
|
1180 |
+
* @see registerUndefinedFunctionCallback
|
1181 |
+
*
|
1182 |
+
* @internal
|
1183 |
+
*/
|
1184 |
+
public function getFunctions()
|
1185 |
+
{
|
1186 |
+
if (!$this->extensionInitialized) {
|
1187 |
+
$this->initExtensions();
|
1188 |
+
}
|
1189 |
+
return $this->functions;
|
1190 |
+
}
|
1191 |
+
/**
|
1192 |
+
* Registers a Global.
|
1193 |
+
*
|
1194 |
+
* New globals can be added before compiling or rendering a template;
|
1195 |
+
* but after, you can only update existing globals.
|
1196 |
+
*
|
1197 |
+
* @param string $name The global name
|
1198 |
+
* @param mixed $value The global value
|
1199 |
+
*/
|
1200 |
+
public function addGlobal($name, $value)
|
1201 |
+
{
|
1202 |
+
if ($this->extensionInitialized || $this->runtimeInitialized) {
|
1203 |
+
if (null === $this->globals) {
|
1204 |
+
$this->globals = $this->initGlobals();
|
1205 |
+
}
|
1206 |
+
if (!\array_key_exists($name, $this->globals)) {
|
1207 |
+
// The deprecation notice must be turned into the following exception in Twig 2.0
|
1208 |
+
@\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);
|
1209 |
+
//throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
|
1210 |
+
}
|
1211 |
+
}
|
1212 |
+
if ($this->extensionInitialized || $this->runtimeInitialized) {
|
1213 |
+
// update the value
|
1214 |
+
$this->globals[$name] = $value;
|
1215 |
+
} else {
|
1216 |
+
$this->staging->addGlobal($name, $value);
|
1217 |
+
}
|
1218 |
+
}
|
1219 |
+
/**
|
1220 |
+
* Gets the registered Globals.
|
1221 |
+
*
|
1222 |
+
* @return array An array of globals
|
1223 |
+
*
|
1224 |
+
* @internal
|
1225 |
+
*/
|
1226 |
+
public function getGlobals()
|
1227 |
+
{
|
1228 |
+
if (!$this->runtimeInitialized && !$this->extensionInitialized) {
|
1229 |
+
return $this->initGlobals();
|
1230 |
+
}
|
1231 |
+
if (null === $this->globals) {
|
1232 |
+
$this->globals = $this->initGlobals();
|
1233 |
+
}
|
1234 |
+
return $this->globals;
|
1235 |
+
}
|
1236 |
+
/**
|
1237 |
+
* Merges a context with the defined globals.
|
1238 |
+
*
|
1239 |
+
* @param array $context An array representing the context
|
1240 |
+
*
|
1241 |
+
* @return array The context merged with the globals
|
1242 |
+
*/
|
1243 |
+
public function mergeGlobals(array $context)
|
1244 |
+
{
|
1245 |
+
// we don't use array_merge as the context being generally
|
1246 |
+
// bigger than globals, this code is faster.
|
1247 |
+
foreach ($this->getGlobals() as $key => $value) {
|
1248 |
+
if (!\array_key_exists($key, $context)) {
|
1249 |
+
$context[$key] = $value;
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
+
return $context;
|
1253 |
+
}
|
1254 |
+
/**
|
1255 |
+
* Gets the registered unary Operators.
|
1256 |
+
*
|
1257 |
+
* @return array An array of unary operators
|
1258 |
+
*
|
1259 |
+
* @internal
|
1260 |
+
*/
|
1261 |
+
public function getUnaryOperators()
|
1262 |
+
{
|
1263 |
+
if (!$this->extensionInitialized) {
|
1264 |
+
$this->initExtensions();
|
1265 |
+
}
|
1266 |
+
return $this->unaryOperators;
|
1267 |
+
}
|
1268 |
+
/**
|
1269 |
+
* Gets the registered binary Operators.
|
1270 |
+
*
|
1271 |
+
* @return array An array of binary operators
|
1272 |
+
*
|
1273 |
+
* @internal
|
1274 |
+
*/
|
1275 |
+
public function getBinaryOperators()
|
1276 |
+
{
|
1277 |
+
if (!$this->extensionInitialized) {
|
1278 |
+
$this->initExtensions();
|
1279 |
+
}
|
1280 |
+
return $this->binaryOperators;
|
1281 |
+
}
|
1282 |
+
/**
|
1283 |
+
* @deprecated since 1.23 (to be removed in 2.0)
|
1284 |
+
*/
|
1285 |
+
public function computeAlternatives($name, $items)
|
1286 |
+
{
|
1287 |
+
@\trigger_error(\sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
1288 |
+
return \WPML\Core\Twig\Error\SyntaxError::computeAlternatives($name, $items);
|
1289 |
+
}
|
1290 |
+
/**
|
1291 |
+
* @internal
|
1292 |
+
*/
|
1293 |
+
protected function initGlobals()
|
1294 |
+
{
|
1295 |
+
$globals = [];
|
1296 |
+
foreach ($this->extensions as $name => $extension) {
|
1297 |
+
if (!$extension instanceof \WPML\Core\Twig\Extension\GlobalsInterface) {
|
1298 |
+
$m = new \ReflectionMethod($extension, 'getGlobals');
|
1299 |
+
$parentClass = $m->getDeclaringClass()->getName();
|
1300 |
+
if ('Twig_Extension' !== $parentClass && 'WPML\\Core\\Twig\\Extension\\AbstractExtension' !== $parentClass) {
|
1301 |
+
@\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);
|
1302 |
+
}
|
1303 |
+
}
|
1304 |
+
$extGlob = $extension->getGlobals();
|
1305 |
+
if (!\is_array($extGlob)) {
|
1306 |
+
throw new \UnexpectedValueException(\sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension)));
|
1307 |
+
}
|
1308 |
+
$globals[] = $extGlob;
|
1309 |
+
}
|
1310 |
+
$globals[] = $this->staging->getGlobals();
|
1311 |
+
return \call_user_func_array('array_merge', $globals);
|
1312 |
+
}
|
1313 |
+
/**
|
1314 |
+
* @internal
|
1315 |
+
*/
|
1316 |
+
protected function initExtensions()
|
1317 |
+
{
|
1318 |
+
if ($this->extensionInitialized) {
|
1319 |
+
return;
|
1320 |
+
}
|
1321 |
+
$this->parsers = new \WPML\Core\Twig_TokenParserBroker([], [], \false);
|
1322 |
+
$this->filters = [];
|
1323 |
+
$this->functions = [];
|
1324 |
+
$this->tests = [];
|
1325 |
+
$this->visitors = [];
|
1326 |
+
$this->unaryOperators = [];
|
1327 |
+
$this->binaryOperators = [];
|
1328 |
+
foreach ($this->extensions as $extension) {
|
1329 |
+
$this->initExtension($extension);
|
1330 |
+
}
|
1331 |
+
$this->initExtension($this->staging);
|
1332 |
+
// Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception
|
1333 |
+
$this->extensionInitialized = \true;
|
1334 |
+
}
|
1335 |
+
/**
|
1336 |
+
* @internal
|
1337 |
+
*/
|
1338 |
+
protected function initExtension(\WPML\Core\Twig\Extension\ExtensionInterface $extension)
|
1339 |
+
{
|
1340 |
+
// filters
|
1341 |
+
foreach ($extension->getFilters() as $name => $filter) {
|
1342 |
+
if ($filter instanceof \WPML\Core\Twig\TwigFilter) {
|
1343 |
+
$name = $filter->getName();
|
1344 |
+
} else {
|
1345 |
+
@\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);
|
1346 |
+
}
|
1347 |
+
$this->filters[$name] = $filter;
|
1348 |
+
}
|
1349 |
+
// functions
|
1350 |
+
foreach ($extension->getFunctions() as $name => $function) {
|
1351 |
+
if ($function instanceof \WPML\Core\Twig\TwigFunction) {
|
1352 |
+
$name = $function->getName();
|
1353 |
+
} else {
|
1354 |
+
@\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);
|
1355 |
+
}
|
1356 |
+
$this->functions[$name] = $function;
|
1357 |
+
}
|
1358 |
+
// tests
|
1359 |
+
foreach ($extension->getTests() as $name => $test) {
|
1360 |
+
if ($test instanceof \WPML\Core\Twig\TwigTest) {
|
1361 |
+
$name = $test->getName();
|
1362 |
+
} else {
|
1363 |
+
@\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);
|
1364 |
+
}
|
1365 |
+
$this->tests[$name] = $test;
|
1366 |
+
}
|
1367 |
+
// token parsers
|
1368 |
+
foreach ($extension->getTokenParsers() as $parser) {
|
1369 |
+
if ($parser instanceof \WPML\Core\Twig\TokenParser\TokenParserInterface) {
|
1370 |
+
$this->parsers->addTokenParser($parser);
|
1371 |
+
} elseif ($parser instanceof \WPML\Core\Twig_TokenParserBrokerInterface) {
|
1372 |
+
@\trigger_error('Registering a \\Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', \E_USER_DEPRECATED);
|
1373 |
+
$this->parsers->addTokenParserBroker($parser);
|
1374 |
+
} else {
|
1375 |
+
throw new \LogicException('getTokenParsers() must return an array of \\Twig_TokenParserInterface or \\Twig_TokenParserBrokerInterface instances.');
|
1376 |
+
}
|
1377 |
+
}
|
1378 |
+
// node visitors
|
1379 |
+
foreach ($extension->getNodeVisitors() as $visitor) {
|
1380 |
+
$this->visitors[] = $visitor;
|
1381 |
+
}
|
1382 |
+
// operators
|
1383 |
+
if ($operators = $extension->getOperators()) {
|
1384 |
+
if (!\is_array($operators)) {
|
1385 |
+
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)));
|
1386 |
+
}
|
1387 |
+
if (2 !== \count($operators)) {
|
1388 |
+
throw new \InvalidArgumentException(\sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators)));
|
1389 |
+
}
|
1390 |
+
$this->unaryOperators = \array_merge($this->unaryOperators, $operators[0]);
|
1391 |
+
$this->binaryOperators = \array_merge($this->binaryOperators, $operators[1]);
|
1392 |
+
}
|
1393 |
+
}
|
1394 |
+
/**
|
1395 |
+
* @deprecated since 1.22 (to be removed in 2.0)
|
1396 |
+
*/
|
1397 |
+
protected function writeCacheFile($file, $content)
|
1398 |
+
{
|
1399 |
+
$this->cache->write($file, $content);
|
1400 |
+
}
|
1401 |
+
private function updateOptionsHash()
|
1402 |
+
{
|
1403 |
+
$hashParts = \array_merge(\array_keys($this->extensions), [(int) \function_exists('WPML\\Core\\twig_template_get_attributes'), \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, self::VERSION, (int) $this->debug, $this->baseTemplateClass, (int) $this->strictVariables]);
|
1404 |
+
$this->optionsHash = \implode(':', $hashParts);
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
\class_alias('WPML\\Core\\Twig\\Environment', 'WPML\\Core\\Twig_Environment');
|
addons/wpml-dependencies/lib/lib/twig/src/Error/Error.php
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Error;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Source;
|
14 |
+
use WPML\Core\Twig\Template;
|
15 |
+
/**
|
16 |
+
* Twig base exception.
|
17 |
+
*
|
18 |
+
* This exception class and its children must only be used when
|
19 |
+
* an error occurs during the loading of a template, when a syntax error
|
20 |
+
* is detected in a template, or when rendering a template. Other
|
21 |
+
* errors must use regular PHP exception classes (like when the template
|
22 |
+
* cache directory is not writable for instance).
|
23 |
+
*
|
24 |
+
* To help debugging template issues, this class tracks the original template
|
25 |
+
* name and line where the error occurred.
|
26 |
+
*
|
27 |
+
* Whenever possible, you must set these information (original template name
|
28 |
+
* and line number) yourself by passing them to the constructor. If some or all
|
29 |
+
* these information are not available from where you throw the exception, then
|
30 |
+
* this class will guess them automatically (when the line number is set to -1
|
31 |
+
* and/or the name is set to null). As this is a costly operation, this
|
32 |
+
* can be disabled by passing false for both the name and the line number
|
33 |
+
* when creating a new instance of this class.
|
34 |
+
*
|
35 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
36 |
+
*/
|
37 |
+
class Error extends \Exception
|
38 |
+
{
|
39 |
+
protected $lineno;
|
40 |
+
// to be renamed to name in 2.0
|
41 |
+
protected $filename;
|
42 |
+
protected $rawMessage;
|
43 |
+
private $sourcePath;
|
44 |
+
private $sourceCode;
|
45 |
+
/**
|
46 |
+
* Constructor.
|
47 |
+
*
|
48 |
+
* Set the line number to -1 to enable its automatic guessing.
|
49 |
+
* Set the name to null to enable its automatic guessing.
|
50 |
+
*
|
51 |
+
* @param string $message The error message
|
52 |
+
* @param int $lineno The template line where the error occurred
|
53 |
+
* @param Source|string|null $source The source context where the error occurred
|
54 |
+
* @param \Exception $previous The previous exception
|
55 |
+
*/
|
56 |
+
public function __construct($message, $lineno = -1, $source = null, \Exception $previous = null)
|
57 |
+
{
|
58 |
+
if (null === $source) {
|
59 |
+
$name = null;
|
60 |
+
} elseif (!$source instanceof \WPML\Core\Twig\Source) {
|
61 |
+
// for compat with the Twig C ext., passing the template name as string is accepted
|
62 |
+
$name = $source;
|
63 |
+
} else {
|
64 |
+
$name = $source->getName();
|
65 |
+
$this->sourceCode = $source->getCode();
|
66 |
+
$this->sourcePath = $source->getPath();
|
67 |
+
}
|
68 |
+
parent::__construct('', 0, $previous);
|
69 |
+
$this->lineno = $lineno;
|
70 |
+
$this->filename = $name;
|
71 |
+
$this->rawMessage = $message;
|
72 |
+
$this->updateRepr();
|
73 |
+
}
|
74 |
+
/**
|
75 |
+
* Gets the raw message.
|
76 |
+
*
|
77 |
+
* @return string The raw message
|
78 |
+
*/
|
79 |
+
public function getRawMessage()
|
80 |
+
{
|
81 |
+
return $this->rawMessage;
|
82 |
+
}
|
83 |
+
/**
|
84 |
+
* Gets the logical name where the error occurred.
|
85 |
+
*
|
86 |
+
* @return string The name
|
87 |
+
*
|
88 |
+
* @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead.
|
89 |
+
*/
|
90 |
+
public function getTemplateFile()
|
91 |
+
{
|
92 |
+
@\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);
|
93 |
+
return $this->filename;
|
94 |
+
}
|
95 |
+
/**
|
96 |
+
* Sets the logical name where the error occurred.
|
97 |
+
*
|
98 |
+
* @param string $name The name
|
99 |
+
*
|
100 |
+
* @deprecated since 1.27 (to be removed in 2.0). Use setSourceContext() instead.
|
101 |
+
*/
|
102 |
+
public function setTemplateFile($name)
|
103 |
+
{
|
104 |
+
@\trigger_error(\sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), \E_USER_DEPRECATED);
|
105 |
+
$this->filename = $name;
|
106 |
+
$this->updateRepr();
|
107 |
+
}
|
108 |
+
/**
|
109 |
+
* Gets the logical name where the error occurred.
|
110 |
+
*
|
111 |
+
* @return string The name
|
112 |
+
*
|
113 |
+
* @deprecated since 1.29 (to be removed in 2.0). Use getSourceContext() instead.
|
114 |
+
*/
|
115 |
+
public function getTemplateName()
|
116 |
+
{
|
117 |
+
@\trigger_error(\sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), \E_USER_DEPRECATED);
|
118 |
+
return $this->filename;
|
119 |
+
}
|
120 |
+
/**
|
121 |
+
* Sets the logical name where the error occurred.
|
122 |
+
*
|
123 |
+
* @param string $name The name
|
124 |
+
*
|
125 |
+
* @deprecated since 1.29 (to be removed in 2.0). Use setSourceContext() instead.
|
126 |
+
*/
|
127 |
+
public function setTemplateName($name)
|
128 |
+
{
|
129 |
+
@\trigger_error(\sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), \E_USER_DEPRECATED);
|
130 |
+
$this->filename = $name;
|
131 |
+
$this->sourceCode = $this->sourcePath = null;
|
132 |
+
$this->updateRepr();
|
133 |
+
}
|
134 |
+
/**
|
135 |
+
* Gets the template line where the error occurred.
|
136 |
+
*
|
137 |
+
* @return int The template line
|
138 |
+
*/
|
139 |
+
public function getTemplateLine()
|
140 |
+
{
|
141 |
+
return $this->lineno;
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* Sets the template line where the error occurred.
|
145 |
+
*
|
146 |
+
* @param int $lineno The template line
|
147 |
+
*/
|
148 |
+
public function setTemplateLine($lineno)
|
149 |
+
{
|
150 |
+
$this->lineno = $lineno;
|
151 |
+
$this->updateRepr();
|
152 |
+
}
|
153 |
+
/**
|
154 |
+
* Gets the source context of the Twig template where the error occurred.
|
155 |
+
*
|
156 |
+
* @return Source|null
|
157 |
+
*/
|
158 |
+
public function getSourceContext()
|
159 |
+
{
|
160 |
+
return $this->filename ? new \WPML\Core\Twig\Source($this->sourceCode, $this->filename, $this->sourcePath) : null;
|
161 |
+
}
|
162 |
+
/**
|
163 |
+
* Sets the source context of the Twig template where the error occurred.
|
164 |
+
*/
|
165 |
+
public function setSourceContext(\WPML\Core\Twig\Source $source = null)
|
166 |
+
{
|
167 |
+
if (null === $source) {
|
168 |
+
$this->sourceCode = $this->filename = $this->sourcePath = null;
|
169 |
+
} else {
|
170 |
+
$this->sourceCode = $source->getCode();
|
171 |
+
$this->filename = $source->getName();
|
172 |
+
$this->sourcePath = $source->getPath();
|
173 |
+
}
|
174 |
+
$this->updateRepr();
|
175 |
+
}
|
176 |
+
public function guess()
|
177 |
+
{
|
178 |
+
$this->guessTemplateInfo();
|
179 |
+
$this->updateRepr();
|
180 |
+
}
|
181 |
+
public function appendMessage($rawMessage)
|
182 |
+
{
|
183 |
+
$this->rawMessage .= $rawMessage;
|
184 |
+
$this->updateRepr();
|
185 |
+
}
|
186 |
+
/**
|
187 |
+
* @internal
|
188 |
+
*/
|
189 |
+
protected function updateRepr()
|
190 |
+
{
|
191 |
+
$this->message = $this->rawMessage;
|
192 |
+
if ($this->sourcePath && $this->lineno > 0) {
|
193 |
+
$this->file = $this->sourcePath;
|
194 |
+
$this->line = $this->lineno;
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
$dot = \false;
|
198 |
+
if ('.' === \substr($this->message, -1)) {
|
199 |
+
$this->message = \substr($this->message, 0, -1);
|
200 |
+
$dot = \true;
|
201 |
+
}
|
202 |
+
$questionMark = \false;
|
203 |
+
if ('?' === \substr($this->message, -1)) {
|
204 |
+
$this->message = \substr($this->message, 0, -1);
|
205 |
+
$questionMark = \true;
|
206 |
+
}
|
207 |
+
if ($this->filename) {
|
208 |
+
if (\is_string($this->filename) || \is_object($this->filename) && \method_exists($this->filename, '__toString')) {
|
209 |
+
$name = \sprintf('"%s"', $this->filename);
|
210 |
+
} else {
|
211 |
+
$name = \json_encode($this->filename);
|
212 |
+
}
|
213 |
+
$this->message .= \sprintf(' in %s', $name);
|
214 |
+
}
|
215 |
+
if ($this->lineno && $this->lineno >= 0) {
|
216 |
+
$this->message .= \sprintf(' at line %d', $this->lineno);
|
217 |
+
}
|
218 |
+
if ($dot) {
|
219 |
+
$this->message .= '.';
|
220 |
+
}
|
221 |
+
if ($questionMark) {
|
222 |
+
$this->message .= '?';
|
223 |
+
}
|
224 |
+
}
|
225 |
+
/**
|
226 |
+
* @internal
|
227 |
+
*/
|
228 |
+
protected function guessTemplateInfo()
|
229 |
+
{
|
230 |
+
$template = null;
|
231 |
+
$templateClass = null;
|
232 |
+
$backtrace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
233 |
+
foreach ($backtrace as $trace) {
|
234 |
+
if (isset($trace['object']) && $trace['object'] instanceof \WPML\Core\Twig\Template && 'Twig_Template' !== \get_class($trace['object'])) {
|
235 |
+
$currentClass = \get_class($trace['object']);
|
236 |
+
$isEmbedContainer = 0 === \strpos($templateClass, $currentClass);
|
237 |
+
if (null === $this->filename || $this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer) {
|
238 |
+
$template = $trace['object'];
|
239 |
+
$templateClass = \get_class($trace['object']);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
// update template name
|
244 |
+
if (null !== $template && null === $this->filename) {
|
245 |
+
$this->filename = $template->getTemplateName();
|
246 |
+
}
|
247 |
+
// update template path if any
|
248 |
+
if (null !== $template && null === $this->sourcePath) {
|
249 |
+
$src = $template->getSourceContext();
|
250 |
+
$this->sourceCode = $src->getCode();
|
251 |
+
$this->sourcePath = $src->getPath();
|
252 |
+
}
|
253 |
+
if (null === $template || $this->lineno > -1) {
|
254 |
+
return;
|
255 |
+
}
|
256 |
+
$r = new \ReflectionObject($template);
|
257 |
+
$file = $r->getFileName();
|
258 |
+
$exceptions = [$e = $this];
|
259 |
+
while ($e instanceof self && ($e = $e->getPrevious())) {
|
260 |
+
$exceptions[] = $e;
|
261 |
+
}
|
262 |
+
while ($e = \array_pop($exceptions)) {
|
263 |
+
$traces = $e->getTrace();
|
264 |
+
\array_unshift($traces, ['file' => $e->getFile(), 'line' => $e->getLine()]);
|
265 |
+
while ($trace = \array_shift($traces)) {
|
266 |
+
if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) {
|
267 |
+
continue;
|
268 |
+
}
|
269 |
+
foreach ($template->getDebugInfo() as $codeLine => $templateLine) {
|
270 |
+
if ($codeLine <= $trace['line']) {
|
271 |
+
// update template line
|
272 |
+
$this->lineno = $templateLine;
|
273 |
+
return;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
\class_alias('WPML\\Core\\Twig\\Error\\Error', 'WPML\\Core\\Twig_Error');
|
addons/wpml-dependencies/lib/lib/twig/src/Error/LoaderError.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Error;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when an error occurs during template loading.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
class LoaderError extends \WPML\Core\Twig\Error\Error
|
19 |
+
{
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Error\\LoaderError', 'WPML\\Core\\Twig_Error_Loader');
|
addons/wpml-dependencies/lib/lib/twig/src/Error/RuntimeError.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Error;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Exception thrown when an error occurs at runtime.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class RuntimeError extends \WPML\Core\Twig\Error\Error
|
20 |
+
{
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Error\\RuntimeError', 'WPML\\Core\\Twig_Error_Runtime');
|
addons/wpml-dependencies/lib/lib/twig/src/Error/SyntaxError.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Error;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* \Exception thrown when a syntax error occurs during lexing or parsing of a template.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class SyntaxError extends \WPML\Core\Twig\Error\Error
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Tweaks the error message to include suggestions.
|
23 |
+
*
|
24 |
+
* @param string $name The original name of the item that does not exist
|
25 |
+
* @param array $items An array of possible items
|
26 |
+
*/
|
27 |
+
public function addSuggestions($name, array $items)
|
28 |
+
{
|
29 |
+
if (!($alternatives = self::computeAlternatives($name, $items))) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
$this->appendMessage(\sprintf(' Did you mean "%s"?', \implode('", "', $alternatives)));
|
33 |
+
}
|
34 |
+
/**
|
35 |
+
* @internal
|
36 |
+
*
|
37 |
+
* To be merged with the addSuggestions() method in 2.0.
|
38 |
+
*/
|
39 |
+
public static function computeAlternatives($name, $items)
|
40 |
+
{
|
41 |
+
$alternatives = [];
|
42 |
+
foreach ($items as $item) {
|
43 |
+
$lev = \levenshtein($name, $item);
|
44 |
+
if ($lev <= \strlen($name) / 3 || \false !== \strpos($item, $name)) {
|
45 |
+
$alternatives[$item] = $lev;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
\asort($alternatives);
|
49 |
+
return \array_keys($alternatives);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
\class_alias('WPML\\Core\\Twig\\Error\\SyntaxError', 'WPML\\Core\\Twig_Error_Syntax');
|
addons/wpml-dependencies/lib/lib/twig/src/ExpressionParser.php
ADDED
@@ -0,0 +1,684 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ArrayExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\ArrowFunctionExpression;
|
17 |
+
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
18 |
+
use WPML\Core\Twig\Node\Expression\Binary\ConcatBinary;
|
19 |
+
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\ConditionalExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
22 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
23 |
+
use WPML\Core\Twig\Node\Expression\MethodCallExpression;
|
24 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
25 |
+
use WPML\Core\Twig\Node\Expression\ParentExpression;
|
26 |
+
use WPML\Core\Twig\Node\Expression\Unary\NegUnary;
|
27 |
+
use WPML\Core\Twig\Node\Expression\Unary\NotUnary;
|
28 |
+
use WPML\Core\Twig\Node\Expression\Unary\PosUnary;
|
29 |
+
use WPML\Core\Twig\Node\Node;
|
30 |
+
/**
|
31 |
+
* Parses expressions.
|
32 |
+
*
|
33 |
+
* This parser implements a "Precedence climbing" algorithm.
|
34 |
+
*
|
35 |
+
* @see https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
|
36 |
+
* @see https://en.wikipedia.org/wiki/Operator-precedence_parser
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
*
|
40 |
+
* @internal
|
41 |
+
*/
|
42 |
+
class ExpressionParser
|
43 |
+
{
|
44 |
+
const OPERATOR_LEFT = 1;
|
45 |
+
const OPERATOR_RIGHT = 2;
|
46 |
+
protected $parser;
|
47 |
+
protected $unaryOperators;
|
48 |
+
protected $binaryOperators;
|
49 |
+
private $env;
|
50 |
+
public function __construct(\WPML\Core\Twig\Parser $parser, $env = null)
|
51 |
+
{
|
52 |
+
$this->parser = $parser;
|
53 |
+
if ($env instanceof \WPML\Core\Twig\Environment) {
|
54 |
+
$this->env = $env;
|
55 |
+
$this->unaryOperators = $env->getUnaryOperators();
|
56 |
+
$this->binaryOperators = $env->getBinaryOperators();
|
57 |
+
} else {
|
58 |
+
@\trigger_error('Passing the operators as constructor arguments to ' . __METHOD__ . ' is deprecated since version 1.27. Pass the environment instead.', \E_USER_DEPRECATED);
|
59 |
+
$this->env = $parser->getEnvironment();
|
60 |
+
$this->unaryOperators = \func_get_arg(1);
|
61 |
+
$this->binaryOperators = \func_get_arg(2);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
public function parseExpression($precedence = 0, $allowArrow = \false)
|
65 |
+
{
|
66 |
+
if ($allowArrow && ($arrow = $this->parseArrow())) {
|
67 |
+
return $arrow;
|
68 |
+
}
|
69 |
+
$expr = $this->getPrimary();
|
70 |
+
$token = $this->parser->getCurrentToken();
|
71 |
+
while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) {
|
72 |
+
$op = $this->binaryOperators[$token->getValue()];
|
73 |
+
$this->parser->getStream()->next();
|
74 |
+
if ('is not' === $token->getValue()) {
|
75 |
+
$expr = $this->parseNotTestExpression($expr);
|
76 |
+
} elseif ('is' === $token->getValue()) {
|
77 |
+
$expr = $this->parseTestExpression($expr);
|
78 |
+
} elseif (isset($op['callable'])) {
|
79 |
+
$expr = \call_user_func($op['callable'], $this->parser, $expr);
|
80 |
+
} else {
|
81 |
+
$expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']);
|
82 |
+
$class = $op['class'];
|
83 |
+
$expr = new $class($expr, $expr1, $token->getLine());
|
84 |
+
}
|
85 |
+
$token = $this->parser->getCurrentToken();
|
86 |
+
}
|
87 |
+
if (0 === $precedence) {
|
88 |
+
return $this->parseConditionalExpression($expr);
|
89 |
+
}
|
90 |
+
return $expr;
|
91 |
+
}
|
92 |
+
/**
|
93 |
+
* @return ArrowFunctionExpression|null
|
94 |
+
*/
|
95 |
+
private function parseArrow()
|
96 |
+
{
|
97 |
+
$stream = $this->parser->getStream();
|
98 |
+
// short array syntax (one argument, no parentheses)?
|
99 |
+
if ($stream->look(1)->test(\WPML\Core\Twig\Token::ARROW_TYPE)) {
|
100 |
+
$line = $stream->getCurrent()->getLine();
|
101 |
+
$token = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE);
|
102 |
+
$names = [new \WPML\Core\Twig\Node\Expression\AssignNameExpression($token->getValue(), $token->getLine())];
|
103 |
+
$stream->expect(\WPML\Core\Twig\Token::ARROW_TYPE);
|
104 |
+
return new \WPML\Core\Twig\Node\Expression\ArrowFunctionExpression($this->parseExpression(0), new \WPML\Core\Twig\Node\Node($names), $line);
|
105 |
+
}
|
106 |
+
// first, determine if we are parsing an arrow function by finding => (long form)
|
107 |
+
$i = 0;
|
108 |
+
if (!$stream->look($i)->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
109 |
+
return null;
|
110 |
+
}
|
111 |
+
++$i;
|
112 |
+
while (\true) {
|
113 |
+
// variable name
|
114 |
+
++$i;
|
115 |
+
if (!$stream->look($i)->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
++$i;
|
119 |
+
}
|
120 |
+
if (!$stream->look($i)->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ')')) {
|
121 |
+
return null;
|
122 |
+
}
|
123 |
+
++$i;
|
124 |
+
if (!$stream->look($i)->test(\WPML\Core\Twig\Token::ARROW_TYPE)) {
|
125 |
+
return null;
|
126 |
+
}
|
127 |
+
// yes, let's parse it properly
|
128 |
+
$token = $stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(');
|
129 |
+
$line = $token->getLine();
|
130 |
+
$names = [];
|
131 |
+
while (\true) {
|
132 |
+
$token = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE);
|
133 |
+
$names[] = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($token->getValue(), $token->getLine());
|
134 |
+
if (!$stream->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
135 |
+
break;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ')');
|
139 |
+
$stream->expect(\WPML\Core\Twig\Token::ARROW_TYPE);
|
140 |
+
return new \WPML\Core\Twig\Node\Expression\ArrowFunctionExpression($this->parseExpression(0), new \WPML\Core\Twig\Node\Node($names), $line);
|
141 |
+
}
|
142 |
+
protected function getPrimary()
|
143 |
+
{
|
144 |
+
$token = $this->parser->getCurrentToken();
|
145 |
+
if ($this->isUnary($token)) {
|
146 |
+
$operator = $this->unaryOperators[$token->getValue()];
|
147 |
+
$this->parser->getStream()->next();
|
148 |
+
$expr = $this->parseExpression($operator['precedence']);
|
149 |
+
$class = $operator['class'];
|
150 |
+
return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
|
151 |
+
} elseif ($token->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
152 |
+
$this->parser->getStream()->next();
|
153 |
+
$expr = $this->parseExpression();
|
154 |
+
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed');
|
155 |
+
return $this->parsePostfixExpression($expr);
|
156 |
+
}
|
157 |
+
return $this->parsePrimaryExpression();
|
158 |
+
}
|
159 |
+
protected function parseConditionalExpression($expr)
|
160 |
+
{
|
161 |
+
while ($this->parser->getStream()->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '?')) {
|
162 |
+
if (!$this->parser->getStream()->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ':')) {
|
163 |
+
$expr2 = $this->parseExpression();
|
164 |
+
if ($this->parser->getStream()->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ':')) {
|
165 |
+
$expr3 = $this->parseExpression();
|
166 |
+
} else {
|
167 |
+
$expr3 = new \WPML\Core\Twig\Node\Expression\ConstantExpression('', $this->parser->getCurrentToken()->getLine());
|
168 |
+
}
|
169 |
+
} else {
|
170 |
+
$expr2 = $expr;
|
171 |
+
$expr3 = $this->parseExpression();
|
172 |
+
}
|
173 |
+
$expr = new \WPML\Core\Twig\Node\Expression\ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine());
|
174 |
+
}
|
175 |
+
return $expr;
|
176 |
+
}
|
177 |
+
protected function isUnary(\WPML\Core\Twig\Token $token)
|
178 |
+
{
|
179 |
+
return $token->test(\WPML\Core\Twig\Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]);
|
180 |
+
}
|
181 |
+
protected function isBinary(\WPML\Core\Twig\Token $token)
|
182 |
+
{
|
183 |
+
return $token->test(\WPML\Core\Twig\Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]);
|
184 |
+
}
|
185 |
+
public function parsePrimaryExpression()
|
186 |
+
{
|
187 |
+
$token = $this->parser->getCurrentToken();
|
188 |
+
switch ($token->getType()) {
|
189 |
+
case \WPML\Core\Twig\Token::NAME_TYPE:
|
190 |
+
$this->parser->getStream()->next();
|
191 |
+
switch ($token->getValue()) {
|
192 |
+
case 'true':
|
193 |
+
case 'TRUE':
|
194 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConstantExpression(\true, $token->getLine());
|
195 |
+
break;
|
196 |
+
case 'false':
|
197 |
+
case 'FALSE':
|
198 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConstantExpression(\false, $token->getLine());
|
199 |
+
break;
|
200 |
+
case 'none':
|
201 |
+
case 'NONE':
|
202 |
+
case 'null':
|
203 |
+
case 'NULL':
|
204 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConstantExpression(null, $token->getLine());
|
205 |
+
break;
|
206 |
+
default:
|
207 |
+
if ('(' === $this->parser->getCurrentToken()->getValue()) {
|
208 |
+
$node = $this->getFunctionNode($token->getValue(), $token->getLine());
|
209 |
+
} else {
|
210 |
+
$node = new \WPML\Core\Twig\Node\Expression\NameExpression($token->getValue(), $token->getLine());
|
211 |
+
}
|
212 |
+
}
|
213 |
+
break;
|
214 |
+
case \WPML\Core\Twig\Token::NUMBER_TYPE:
|
215 |
+
$this->parser->getStream()->next();
|
216 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine());
|
217 |
+
break;
|
218 |
+
case \WPML\Core\Twig\Token::STRING_TYPE:
|
219 |
+
case \WPML\Core\Twig\Token::INTERPOLATION_START_TYPE:
|
220 |
+
$node = $this->parseStringExpression();
|
221 |
+
break;
|
222 |
+
case \WPML\Core\Twig\Token::OPERATOR_TYPE:
|
223 |
+
if (\preg_match(\WPML\Core\Twig\Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) {
|
224 |
+
// in this context, string operators are variable names
|
225 |
+
$this->parser->getStream()->next();
|
226 |
+
$node = new \WPML\Core\Twig\Node\Expression\NameExpression($token->getValue(), $token->getLine());
|
227 |
+
break;
|
228 |
+
} elseif (isset($this->unaryOperators[$token->getValue()])) {
|
229 |
+
$class = $this->unaryOperators[$token->getValue()]['class'];
|
230 |
+
$ref = new \ReflectionClass($class);
|
231 |
+
$negClass = 'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary';
|
232 |
+
$posClass = 'WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary';
|
233 |
+
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'))) {
|
234 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
|
235 |
+
}
|
236 |
+
$this->parser->getStream()->next();
|
237 |
+
$expr = $this->parsePrimaryExpression();
|
238 |
+
$node = new $class($expr, $token->getLine());
|
239 |
+
break;
|
240 |
+
}
|
241 |
+
// no break
|
242 |
+
default:
|
243 |
+
if ($token->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '[')) {
|
244 |
+
$node = $this->parseArrayExpression();
|
245 |
+
} elseif ($token->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '{')) {
|
246 |
+
$node = $this->parseHashExpression();
|
247 |
+
} elseif ($token->test(\WPML\Core\Twig\Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) {
|
248 |
+
throw new \WPML\Core\Twig\Error\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());
|
249 |
+
} else {
|
250 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected token "%s" of value "%s".', \WPML\Core\Twig\Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
|
251 |
+
}
|
252 |
+
}
|
253 |
+
return $this->parsePostfixExpression($node);
|
254 |
+
}
|
255 |
+
public function parseStringExpression()
|
256 |
+
{
|
257 |
+
$stream = $this->parser->getStream();
|
258 |
+
$nodes = [];
|
259 |
+
// a string cannot be followed by another string in a single expression
|
260 |
+
$nextCanBeString = \true;
|
261 |
+
while (\true) {
|
262 |
+
if ($nextCanBeString && ($token = $stream->nextIf(\WPML\Core\Twig\Token::STRING_TYPE))) {
|
263 |
+
$nodes[] = new \WPML\Core\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine());
|
264 |
+
$nextCanBeString = \false;
|
265 |
+
} elseif ($stream->nextIf(\WPML\Core\Twig\Token::INTERPOLATION_START_TYPE)) {
|
266 |
+
$nodes[] = $this->parseExpression();
|
267 |
+
$stream->expect(\WPML\Core\Twig\Token::INTERPOLATION_END_TYPE);
|
268 |
+
$nextCanBeString = \true;
|
269 |
+
} else {
|
270 |
+
break;
|
271 |
+
}
|
272 |
+
}
|
273 |
+
$expr = \array_shift($nodes);
|
274 |
+
foreach ($nodes as $node) {
|
275 |
+
$expr = new \WPML\Core\Twig\Node\Expression\Binary\ConcatBinary($expr, $node, $node->getTemplateLine());
|
276 |
+
}
|
277 |
+
return $expr;
|
278 |
+
}
|
279 |
+
public function parseArrayExpression()
|
280 |
+
{
|
281 |
+
$stream = $this->parser->getStream();
|
282 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
|
283 |
+
$node = new \WPML\Core\Twig\Node\Expression\ArrayExpression([], $stream->getCurrent()->getLine());
|
284 |
+
$first = \true;
|
285 |
+
while (!$stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']')) {
|
286 |
+
if (!$first) {
|
287 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma');
|
288 |
+
// trailing ,?
|
289 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']')) {
|
290 |
+
break;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
$first = \false;
|
294 |
+
$node->addElement($this->parseExpression());
|
295 |
+
}
|
296 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed');
|
297 |
+
return $node;
|
298 |
+
}
|
299 |
+
public function parseHashExpression()
|
300 |
+
{
|
301 |
+
$stream = $this->parser->getStream();
|
302 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '{', 'A hash element was expected');
|
303 |
+
$node = new \WPML\Core\Twig\Node\Expression\ArrayExpression([], $stream->getCurrent()->getLine());
|
304 |
+
$first = \true;
|
305 |
+
while (!$stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '}')) {
|
306 |
+
if (!$first) {
|
307 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma');
|
308 |
+
// trailing ,?
|
309 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '}')) {
|
310 |
+
break;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
$first = \false;
|
314 |
+
// a hash key can be:
|
315 |
+
//
|
316 |
+
// * a number -- 12
|
317 |
+
// * a string -- 'a'
|
318 |
+
// * a name, which is equivalent to a string -- a
|
319 |
+
// * an expression, which must be enclosed in parentheses -- (1 + 2)
|
320 |
+
if (($token = $stream->nextIf(\WPML\Core\Twig\Token::STRING_TYPE)) || ($token = $stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE)) || ($token = $stream->nextIf(\WPML\Core\Twig\Token::NUMBER_TYPE))) {
|
321 |
+
$key = new \WPML\Core\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine());
|
322 |
+
} elseif ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
323 |
+
$key = $this->parseExpression();
|
324 |
+
} else {
|
325 |
+
$current = $stream->getCurrent();
|
326 |
+
throw new \WPML\Core\Twig\Error\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".', \WPML\Core\Twig\Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
|
327 |
+
}
|
328 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)');
|
329 |
+
$value = $this->parseExpression();
|
330 |
+
$node->addElement($value, $key);
|
331 |
+
}
|
332 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed');
|
333 |
+
return $node;
|
334 |
+
}
|
335 |
+
public function parsePostfixExpression($node)
|
336 |
+
{
|
337 |
+
while (\true) {
|
338 |
+
$token = $this->parser->getCurrentToken();
|
339 |
+
if (\WPML\Core\Twig\Token::PUNCTUATION_TYPE == $token->getType()) {
|
340 |
+
if ('.' == $token->getValue() || '[' == $token->getValue()) {
|
341 |
+
$node = $this->parseSubscriptExpression($node);
|
342 |
+
} elseif ('|' == $token->getValue()) {
|
343 |
+
$node = $this->parseFilterExpression($node);
|
344 |
+
} else {
|
345 |
+
break;
|
346 |
+
}
|
347 |
+
} else {
|
348 |
+
break;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
return $node;
|
352 |
+
}
|
353 |
+
public function getFunctionNode($name, $line)
|
354 |
+
{
|
355 |
+
switch ($name) {
|
356 |
+
case 'parent':
|
357 |
+
$this->parseArguments();
|
358 |
+
if (!\count($this->parser->getBlockStack())) {
|
359 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext());
|
360 |
+
}
|
361 |
+
if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
|
362 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext());
|
363 |
+
}
|
364 |
+
return new \WPML\Core\Twig\Node\Expression\ParentExpression($this->parser->peekBlockStack(), $line);
|
365 |
+
case 'block':
|
366 |
+
$args = $this->parseArguments();
|
367 |
+
if (\count($args) < 1) {
|
368 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext());
|
369 |
+
}
|
370 |
+
return new \WPML\Core\Twig\Node\Expression\BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line);
|
371 |
+
case 'attribute':
|
372 |
+
$args = $this->parseArguments();
|
373 |
+
if (\count($args) < 2) {
|
374 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext());
|
375 |
+
}
|
376 |
+
return new \WPML\Core\Twig\Node\Expression\GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, \WPML\Core\Twig\Template::ANY_CALL, $line);
|
377 |
+
default:
|
378 |
+
if (null !== ($alias = $this->parser->getImportedSymbol('function', $name))) {
|
379 |
+
$arguments = new \WPML\Core\Twig\Node\Expression\ArrayExpression([], $line);
|
380 |
+
foreach ($this->parseArguments() as $n) {
|
381 |
+
$arguments->addElement($n);
|
382 |
+
}
|
383 |
+
$node = new \WPML\Core\Twig\Node\Expression\MethodCallExpression($alias['node'], $alias['name'], $arguments, $line);
|
384 |
+
$node->setAttribute('safe', \true);
|
385 |
+
return $node;
|
386 |
+
}
|
387 |
+
$args = $this->parseArguments(\true);
|
388 |
+
$class = $this->getFunctionNodeClass($name, $line);
|
389 |
+
return new $class($name, $args, $line);
|
390 |
+
}
|
391 |
+
}
|
392 |
+
public function parseSubscriptExpression($node)
|
393 |
+
{
|
394 |
+
$stream = $this->parser->getStream();
|
395 |
+
$token = $stream->next();
|
396 |
+
$lineno = $token->getLine();
|
397 |
+
$arguments = new \WPML\Core\Twig\Node\Expression\ArrayExpression([], $lineno);
|
398 |
+
$type = \WPML\Core\Twig\Template::ANY_CALL;
|
399 |
+
if ('.' == $token->getValue()) {
|
400 |
+
$token = $stream->next();
|
401 |
+
if (\WPML\Core\Twig\Token::NAME_TYPE == $token->getType() || \WPML\Core\Twig\Token::NUMBER_TYPE == $token->getType() || \WPML\Core\Twig\Token::OPERATOR_TYPE == $token->getType() && \preg_match(\WPML\Core\Twig\Lexer::REGEX_NAME, $token->getValue())) {
|
402 |
+
$arg = new \WPML\Core\Twig\Node\Expression\ConstantExpression($token->getValue(), $lineno);
|
403 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
404 |
+
$type = \WPML\Core\Twig\Template::METHOD_CALL;
|
405 |
+
foreach ($this->parseArguments() as $n) {
|
406 |
+
$arguments->addElement($n);
|
407 |
+
}
|
408 |
+
}
|
409 |
+
} else {
|
410 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext());
|
411 |
+
}
|
412 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {
|
413 |
+
if (!$arg instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
414 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext());
|
415 |
+
}
|
416 |
+
$name = $arg->getAttribute('value');
|
417 |
+
if ($this->parser->isReservedMacroName($name)) {
|
418 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
|
419 |
+
}
|
420 |
+
$node = new \WPML\Core\Twig\Node\Expression\MethodCallExpression($node, 'get' . $name, $arguments, $lineno);
|
421 |
+
$node->setAttribute('safe', \true);
|
422 |
+
return $node;
|
423 |
+
}
|
424 |
+
} else {
|
425 |
+
$type = \WPML\Core\Twig\Template::ARRAY_CALL;
|
426 |
+
// slice?
|
427 |
+
$slice = \false;
|
428 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ':')) {
|
429 |
+
$slice = \true;
|
430 |
+
$arg = new \WPML\Core\Twig\Node\Expression\ConstantExpression(0, $token->getLine());
|
431 |
+
} else {
|
432 |
+
$arg = $this->parseExpression();
|
433 |
+
}
|
434 |
+
if ($stream->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ':')) {
|
435 |
+
$slice = \true;
|
436 |
+
}
|
437 |
+
if ($slice) {
|
438 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']')) {
|
439 |
+
$length = new \WPML\Core\Twig\Node\Expression\ConstantExpression(null, $token->getLine());
|
440 |
+
} else {
|
441 |
+
$length = $this->parseExpression();
|
442 |
+
}
|
443 |
+
$class = $this->getFilterNodeClass('slice', $token->getLine());
|
444 |
+
$arguments = new \WPML\Core\Twig\Node\Node([$arg, $length]);
|
445 |
+
$filter = new $class($node, new \WPML\Core\Twig\Node\Expression\ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine());
|
446 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']');
|
447 |
+
return $filter;
|
448 |
+
}
|
449 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ']');
|
450 |
+
}
|
451 |
+
return new \WPML\Core\Twig\Node\Expression\GetAttrExpression($node, $arg, $arguments, $type, $lineno);
|
452 |
+
}
|
453 |
+
public function parseFilterExpression($node)
|
454 |
+
{
|
455 |
+
$this->parser->getStream()->next();
|
456 |
+
return $this->parseFilterExpressionRaw($node);
|
457 |
+
}
|
458 |
+
public function parseFilterExpressionRaw($node, $tag = null)
|
459 |
+
{
|
460 |
+
while (\true) {
|
461 |
+
$token = $this->parser->getStream()->expect(\WPML\Core\Twig\Token::NAME_TYPE);
|
462 |
+
$name = new \WPML\Core\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine());
|
463 |
+
if (!$this->parser->getStream()->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
464 |
+
$arguments = new \WPML\Core\Twig\Node\Node();
|
465 |
+
} else {
|
466 |
+
$arguments = $this->parseArguments(\true, \false, \true);
|
467 |
+
}
|
468 |
+
$class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine());
|
469 |
+
$node = new $class($node, $name, $arguments, $token->getLine(), $tag);
|
470 |
+
if (!$this->parser->getStream()->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '|')) {
|
471 |
+
break;
|
472 |
+
}
|
473 |
+
$this->parser->getStream()->next();
|
474 |
+
}
|
475 |
+
return $node;
|
476 |
+
}
|
477 |
+
/**
|
478 |
+
* Parses arguments.
|
479 |
+
*
|
480 |
+
* @param bool $namedArguments Whether to allow named arguments or not
|
481 |
+
* @param bool $definition Whether we are parsing arguments for a function definition
|
482 |
+
*
|
483 |
+
* @return Node
|
484 |
+
*
|
485 |
+
* @throws SyntaxError
|
486 |
+
*/
|
487 |
+
public function parseArguments($namedArguments = \false, $definition = \false, $allowArrow = \false)
|
488 |
+
{
|
489 |
+
$args = [];
|
490 |
+
$stream = $this->parser->getStream();
|
491 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
|
492 |
+
while (!$stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ')')) {
|
493 |
+
if (!empty($args)) {
|
494 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
|
495 |
+
}
|
496 |
+
if ($definition) {
|
497 |
+
$token = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE, null, 'An argument must be a name');
|
498 |
+
$value = new \WPML\Core\Twig\Node\Expression\NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine());
|
499 |
+
} else {
|
500 |
+
$value = $this->parseExpression(0, $allowArrow);
|
501 |
+
}
|
502 |
+
$name = null;
|
503 |
+
if ($namedArguments && ($token = $stream->nextIf(\WPML\Core\Twig\Token::OPERATOR_TYPE, '='))) {
|
504 |
+
if (!$value instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
505 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext());
|
506 |
+
}
|
507 |
+
$name = $value->getAttribute('name');
|
508 |
+
if ($definition) {
|
509 |
+
$value = $this->parsePrimaryExpression();
|
510 |
+
if (!$this->checkConstantExpression($value)) {
|
511 |
+
throw new \WPML\Core\Twig\Error\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());
|
512 |
+
}
|
513 |
+
} else {
|
514 |
+
$value = $this->parseExpression(0, $allowArrow);
|
515 |
+
}
|
516 |
+
}
|
517 |
+
if ($definition) {
|
518 |
+
if (null === $name) {
|
519 |
+
$name = $value->getAttribute('name');
|
520 |
+
$value = new \WPML\Core\Twig\Node\Expression\ConstantExpression(null, $this->parser->getCurrentToken()->getLine());
|
521 |
+
}
|
522 |
+
$args[$name] = $value;
|
523 |
+
} else {
|
524 |
+
if (null === $name) {
|
525 |
+
$args[] = $value;
|
526 |
+
} else {
|
527 |
+
$args[$name] = $value;
|
528 |
+
}
|
529 |
+
}
|
530 |
+
}
|
531 |
+
$stream->expect(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis');
|
532 |
+
return new \WPML\Core\Twig\Node\Node($args);
|
533 |
+
}
|
534 |
+
public function parseAssignmentExpression()
|
535 |
+
{
|
536 |
+
$stream = $this->parser->getStream();
|
537 |
+
$targets = [];
|
538 |
+
while (\true) {
|
539 |
+
$token = $this->parser->getCurrentToken();
|
540 |
+
if ($stream->test(\WPML\Core\Twig\Token::OPERATOR_TYPE) && \preg_match(\WPML\Core\Twig\Lexer::REGEX_NAME, $token->getValue())) {
|
541 |
+
// in this context, string operators are variable names
|
542 |
+
$this->parser->getStream()->next();
|
543 |
+
} else {
|
544 |
+
$stream->expect(\WPML\Core\Twig\Token::NAME_TYPE, null, 'Only variables can be assigned to');
|
545 |
+
}
|
546 |
+
$value = $token->getValue();
|
547 |
+
if (\in_array(\strtolower($value), ['true', 'false', 'none', 'null'])) {
|
548 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
|
549 |
+
}
|
550 |
+
$targets[] = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($value, $token->getLine());
|
551 |
+
if (!$stream->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
552 |
+
break;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
return new \WPML\Core\Twig\Node\Node($targets);
|
556 |
+
}
|
557 |
+
public function parseMultitargetExpression()
|
558 |
+
{
|
559 |
+
$targets = [];
|
560 |
+
while (\true) {
|
561 |
+
$targets[] = $this->parseExpression();
|
562 |
+
if (!$this->parser->getStream()->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
563 |
+
break;
|
564 |
+
}
|
565 |
+
}
|
566 |
+
return new \WPML\Core\Twig\Node\Node($targets);
|
567 |
+
}
|
568 |
+
private function parseNotTestExpression(\WPML\Core\Twig_NodeInterface $node)
|
569 |
+
{
|
570 |
+
return new \WPML\Core\Twig\Node\Expression\Unary\NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine());
|
571 |
+
}
|
572 |
+
private function parseTestExpression(\WPML\Core\Twig_NodeInterface $node)
|
573 |
+
{
|
574 |
+
$stream = $this->parser->getStream();
|
575 |
+
list($name, $test) = $this->getTest($node->getTemplateLine());
|
576 |
+
$class = $this->getTestNodeClass($test);
|
577 |
+
$arguments = null;
|
578 |
+
if ($stream->test(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, '(')) {
|
579 |
+
$arguments = $this->parseArguments(\true);
|
580 |
+
}
|
581 |
+
return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine());
|
582 |
+
}
|
583 |
+
private function getTest($line)
|
584 |
+
{
|
585 |
+
$stream = $this->parser->getStream();
|
586 |
+
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
587 |
+
if ($test = $this->env->getTest($name)) {
|
588 |
+
return [$name, $test];
|
589 |
+
}
|
590 |
+
if ($stream->test(\WPML\Core\Twig\Token::NAME_TYPE)) {
|
591 |
+
// try 2-words tests
|
592 |
+
$name = $name . ' ' . $this->parser->getCurrentToken()->getValue();
|
593 |
+
if ($test = $this->env->getTest($name)) {
|
594 |
+
$stream->next();
|
595 |
+
return [$name, $test];
|
596 |
+
}
|
597 |
+
}
|
598 |
+
$e = new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext());
|
599 |
+
$e->addSuggestions($name, \array_keys($this->env->getTests()));
|
600 |
+
throw $e;
|
601 |
+
}
|
602 |
+
private function getTestNodeClass($test)
|
603 |
+
{
|
604 |
+
if ($test instanceof \WPML\Core\Twig\TwigTest && $test->isDeprecated()) {
|
605 |
+
$stream = $this->parser->getStream();
|
606 |
+
$message = \sprintf('Twig Test "%s" is deprecated', $test->getName());
|
607 |
+
if (!\is_bool($test->getDeprecatedVersion())) {
|
608 |
+
$message .= \sprintf(' since version %s', $test->getDeprecatedVersion());
|
609 |
+
}
|
610 |
+
if ($test->getAlternative()) {
|
611 |
+
$message .= \sprintf('. Use "%s" instead', $test->getAlternative());
|
612 |
+
}
|
613 |
+
$src = $stream->getSourceContext();
|
614 |
+
$message .= \sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine());
|
615 |
+
@\trigger_error($message, \E_USER_DEPRECATED);
|
616 |
+
}
|
617 |
+
if ($test instanceof \WPML\Core\Twig\TwigTest) {
|
618 |
+
return $test->getNodeClass();
|
619 |
+
}
|
620 |
+
return $test instanceof \WPML\Core\Twig_Test_Node ? $test->getClass() : 'Twig\\Node\\Expression\\TestExpression';
|
621 |
+
}
|
622 |
+
protected function getFunctionNodeClass($name, $line)
|
623 |
+
{
|
624 |
+
if (\false === ($function = $this->env->getFunction($name))) {
|
625 |
+
$e = new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext());
|
626 |
+
$e->addSuggestions($name, \array_keys($this->env->getFunctions()));
|
627 |
+
throw $e;
|
628 |
+
}
|
629 |
+
if ($function instanceof \WPML\Core\Twig\TwigFunction && $function->isDeprecated()) {
|
630 |
+
$message = \sprintf('Twig Function "%s" is deprecated', $function->getName());
|
631 |
+
if (!\is_bool($function->getDeprecatedVersion())) {
|
632 |
+
$message .= \sprintf(' since version %s', $function->getDeprecatedVersion());
|
633 |
+
}
|
634 |
+
if ($function->getAlternative()) {
|
635 |
+
$message .= \sprintf('. Use "%s" instead', $function->getAlternative());
|
636 |
+
}
|
637 |
+
$src = $this->parser->getStream()->getSourceContext();
|
638 |
+
$message .= \sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
639 |
+
@\trigger_error($message, \E_USER_DEPRECATED);
|
640 |
+
}
|
641 |
+
if ($function instanceof \WPML\Core\Twig\TwigFunction) {
|
642 |
+
return $function->getNodeClass();
|
643 |
+
}
|
644 |
+
return $function instanceof \WPML\Core\Twig_Function_Node ? $function->getClass() : 'Twig\\Node\\Expression\\FunctionExpression';
|
645 |
+
}
|
646 |
+
protected function getFilterNodeClass($name, $line)
|
647 |
+
{
|
648 |
+
if (\false === ($filter = $this->env->getFilter($name))) {
|
649 |
+
$e = new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext());
|
650 |
+
$e->addSuggestions($name, \array_keys($this->env->getFilters()));
|
651 |
+
throw $e;
|
652 |
+
}
|
653 |
+
if ($filter instanceof \WPML\Core\Twig\TwigFilter && $filter->isDeprecated()) {
|
654 |
+
$message = \sprintf('Twig Filter "%s" is deprecated', $filter->getName());
|
655 |
+
if (!\is_bool($filter->getDeprecatedVersion())) {
|
656 |
+
$message .= \sprintf(' since version %s', $filter->getDeprecatedVersion());
|
657 |
+
}
|
658 |
+
if ($filter->getAlternative()) {
|
659 |
+
$message .= \sprintf('. Use "%s" instead', $filter->getAlternative());
|
660 |
+
}
|
661 |
+
$src = $this->parser->getStream()->getSourceContext();
|
662 |
+
$message .= \sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line);
|
663 |
+
@\trigger_error($message, \E_USER_DEPRECATED);
|
664 |
+
}
|
665 |
+
if ($filter instanceof \WPML\Core\Twig\TwigFilter) {
|
666 |
+
return $filter->getNodeClass();
|
667 |
+
}
|
668 |
+
return $filter instanceof \WPML\Core\Twig_Filter_Node ? $filter->getClass() : 'Twig\\Node\\Expression\\FilterExpression';
|
669 |
+
}
|
670 |
+
// checks that the node only contains "constant" elements
|
671 |
+
protected function checkConstantExpression(\WPML\Core\Twig_NodeInterface $node)
|
672 |
+
{
|
673 |
+
if (!($node instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression || $node instanceof \WPML\Core\Twig\Node\Expression\ArrayExpression || $node instanceof \WPML\Core\Twig\Node\Expression\Unary\NegUnary || $node instanceof \WPML\Core\Twig\Node\Expression\Unary\PosUnary)) {
|
674 |
+
return \false;
|
675 |
+
}
|
676 |
+
foreach ($node as $n) {
|
677 |
+
if (!$this->checkConstantExpression($n)) {
|
678 |
+
return \false;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
return \true;
|
682 |
+
}
|
683 |
+
}
|
684 |
+
\class_alias('WPML\\Core\\Twig\\ExpressionParser', 'WPML\\Core\\Twig_ExpressionParser');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/AbstractExtension.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
abstract class AbstractExtension implements \WPML\Core\Twig\Extension\ExtensionInterface
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_InitRuntimeInterface instead
|
18 |
+
*/
|
19 |
+
public function initRuntime(\WPML\Core\Twig\Environment $environment)
|
20 |
+
{
|
21 |
+
}
|
22 |
+
public function getTokenParsers()
|
23 |
+
{
|
24 |
+
return [];
|
25 |
+
}
|
26 |
+
public function getNodeVisitors()
|
27 |
+
{
|
28 |
+
return [];
|
29 |
+
}
|
30 |
+
public function getFilters()
|
31 |
+
{
|
32 |
+
return [];
|
33 |
+
}
|
34 |
+
public function getTests()
|
35 |
+
{
|
36 |
+
return [];
|
37 |
+
}
|
38 |
+
public function getFunctions()
|
39 |
+
{
|
40 |
+
return [];
|
41 |
+
}
|
42 |
+
public function getOperators()
|
43 |
+
{
|
44 |
+
return [];
|
45 |
+
}
|
46 |
+
/**
|
47 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_GlobalsInterface instead
|
48 |
+
*/
|
49 |
+
public function getGlobals()
|
50 |
+
{
|
51 |
+
return [];
|
52 |
+
}
|
53 |
+
/**
|
54 |
+
* @deprecated since 1.26 (to be removed in 2.0), not used anymore internally
|
55 |
+
*/
|
56 |
+
public function getName()
|
57 |
+
{
|
58 |
+
return \get_class($this);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\AbstractExtension', 'WPML\\Core\\Twig_Extension');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/CoreExtension.php
ADDED
@@ -0,0 +1,1393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\ExpressionParser;
|
14 |
+
use WPML\Core\Twig\TokenParser\ApplyTokenParser;
|
15 |
+
use WPML\Core\Twig\TokenParser\BlockTokenParser;
|
16 |
+
use WPML\Core\Twig\TokenParser\DeprecatedTokenParser;
|
17 |
+
use WPML\Core\Twig\TokenParser\DoTokenParser;
|
18 |
+
use WPML\Core\Twig\TokenParser\EmbedTokenParser;
|
19 |
+
use WPML\Core\Twig\TokenParser\ExtendsTokenParser;
|
20 |
+
use WPML\Core\Twig\TokenParser\FilterTokenParser;
|
21 |
+
use WPML\Core\Twig\TokenParser\FlushTokenParser;
|
22 |
+
use WPML\Core\Twig\TokenParser\ForTokenParser;
|
23 |
+
use WPML\Core\Twig\TokenParser\FromTokenParser;
|
24 |
+
use WPML\Core\Twig\TokenParser\IfTokenParser;
|
25 |
+
use WPML\Core\Twig\TokenParser\ImportTokenParser;
|
26 |
+
use WPML\Core\Twig\TokenParser\IncludeTokenParser;
|
27 |
+
use WPML\Core\Twig\TokenParser\MacroTokenParser;
|
28 |
+
use WPML\Core\Twig\TokenParser\SetTokenParser;
|
29 |
+
use WPML\Core\Twig\TokenParser\SpacelessTokenParser;
|
30 |
+
use WPML\Core\Twig\TokenParser\UseTokenParser;
|
31 |
+
use WPML\Core\Twig\TokenParser\WithTokenParser;
|
32 |
+
use WPML\Core\Twig\TwigFilter;
|
33 |
+
use WPML\Core\Twig\TwigFunction;
|
34 |
+
use WPML\Core\Twig\TwigTest;
|
35 |
+
/**
|
36 |
+
* @final
|
37 |
+
*/
|
38 |
+
class CoreExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
39 |
+
{
|
40 |
+
protected $dateFormats = ['F j, Y H:i', '%d days'];
|
41 |
+
protected $numberFormat = [0, '.', ','];
|
42 |
+
protected $timezone = null;
|
43 |
+
protected $escapers = [];
|
44 |
+
/**
|
45 |
+
* Defines a new escaper to be used via the escape filter.
|
46 |
+
*
|
47 |
+
* @param string $strategy The strategy name that should be used as a strategy in the escape call
|
48 |
+
* @param callable $callable A valid PHP callable
|
49 |
+
*/
|
50 |
+
public function setEscaper($strategy, $callable)
|
51 |
+
{
|
52 |
+
$this->escapers[$strategy] = $callable;
|
53 |
+
}
|
54 |
+
/**
|
55 |
+
* Gets all defined escapers.
|
56 |
+
*
|
57 |
+
* @return array An array of escapers
|
58 |
+
*/
|
59 |
+
public function getEscapers()
|
60 |
+
{
|
61 |
+
return $this->escapers;
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* Sets the default format to be used by the date filter.
|
65 |
+
*
|
66 |
+
* @param string $format The default date format string
|
67 |
+
* @param string $dateIntervalFormat The default date interval format string
|
68 |
+
*/
|
69 |
+
public function setDateFormat($format = null, $dateIntervalFormat = null)
|
70 |
+
{
|
71 |
+
if (null !== $format) {
|
72 |
+
$this->dateFormats[0] = $format;
|
73 |
+
}
|
74 |
+
if (null !== $dateIntervalFormat) {
|
75 |
+
$this->dateFormats[1] = $dateIntervalFormat;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
/**
|
79 |
+
* Gets the default format to be used by the date filter.
|
80 |
+
*
|
81 |
+
* @return array The default date format string and the default date interval format string
|
82 |
+
*/
|
83 |
+
public function getDateFormat()
|
84 |
+
{
|
85 |
+
return $this->dateFormats;
|
86 |
+
}
|
87 |
+
/**
|
88 |
+
* Sets the default timezone to be used by the date filter.
|
89 |
+
*
|
90 |
+
* @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object
|
91 |
+
*/
|
92 |
+
public function setTimezone($timezone)
|
93 |
+
{
|
94 |
+
$this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone);
|
95 |
+
}
|
96 |
+
/**
|
97 |
+
* Gets the default timezone to be used by the date filter.
|
98 |
+
*
|
99 |
+
* @return \DateTimeZone The default timezone currently in use
|
100 |
+
*/
|
101 |
+
public function getTimezone()
|
102 |
+
{
|
103 |
+
if (null === $this->timezone) {
|
104 |
+
$this->timezone = new \DateTimeZone(\date_default_timezone_get());
|
105 |
+
}
|
106 |
+
return $this->timezone;
|
107 |
+
}
|
108 |
+
/**
|
109 |
+
* Sets the default format to be used by the number_format filter.
|
110 |
+
*
|
111 |
+
* @param int $decimal the number of decimal places to use
|
112 |
+
* @param string $decimalPoint the character(s) to use for the decimal point
|
113 |
+
* @param string $thousandSep the character(s) to use for the thousands separator
|
114 |
+
*/
|
115 |
+
public function setNumberFormat($decimal, $decimalPoint, $thousandSep)
|
116 |
+
{
|
117 |
+
$this->numberFormat = [$decimal, $decimalPoint, $thousandSep];
|
118 |
+
}
|
119 |
+
/**
|
120 |
+
* Get the default format used by the number_format filter.
|
121 |
+
*
|
122 |
+
* @return array The arguments for number_format()
|
123 |
+
*/
|
124 |
+
public function getNumberFormat()
|
125 |
+
{
|
126 |
+
return $this->numberFormat;
|
127 |
+
}
|
128 |
+
public function getTokenParsers()
|
129 |
+
{
|
130 |
+
return [new \WPML\Core\Twig\TokenParser\ApplyTokenParser(), new \WPML\Core\Twig\TokenParser\ForTokenParser(), new \WPML\Core\Twig\TokenParser\IfTokenParser(), new \WPML\Core\Twig\TokenParser\ExtendsTokenParser(), new \WPML\Core\Twig\TokenParser\IncludeTokenParser(), new \WPML\Core\Twig\TokenParser\BlockTokenParser(), new \WPML\Core\Twig\TokenParser\UseTokenParser(), new \WPML\Core\Twig\TokenParser\FilterTokenParser(), new \WPML\Core\Twig\TokenParser\MacroTokenParser(), new \WPML\Core\Twig\TokenParser\ImportTokenParser(), new \WPML\Core\Twig\TokenParser\FromTokenParser(), new \WPML\Core\Twig\TokenParser\SetTokenParser(), new \WPML\Core\Twig\TokenParser\SpacelessTokenParser(), new \WPML\Core\Twig\TokenParser\FlushTokenParser(), new \WPML\Core\Twig\TokenParser\DoTokenParser(), new \WPML\Core\Twig\TokenParser\EmbedTokenParser(), new \WPML\Core\Twig\TokenParser\WithTokenParser(), new \WPML\Core\Twig\TokenParser\DeprecatedTokenParser()];
|
131 |
+
}
|
132 |
+
public function getFilters()
|
133 |
+
{
|
134 |
+
$filters = [
|
135 |
+
// formatting filters
|
136 |
+
new \WPML\Core\Twig\TwigFilter('date', '\\WPML\\Core\\twig_date_format_filter', ['needs_environment' => \true]),
|
137 |
+
new \WPML\Core\Twig\TwigFilter('date_modify', '\\WPML\\Core\\twig_date_modify_filter', ['needs_environment' => \true]),
|
138 |
+
new \WPML\Core\Twig\TwigFilter('format', 'sprintf'),
|
139 |
+
new \WPML\Core\Twig\TwigFilter('replace', '\\WPML\\Core\\twig_replace_filter'),
|
140 |
+
new \WPML\Core\Twig\TwigFilter('number_format', '\\WPML\\Core\\twig_number_format_filter', ['needs_environment' => \true]),
|
141 |
+
new \WPML\Core\Twig\TwigFilter('abs', 'abs'),
|
142 |
+
new \WPML\Core\Twig\TwigFilter('round', '\\WPML\\Core\\twig_round'),
|
143 |
+
// encoding
|
144 |
+
new \WPML\Core\Twig\TwigFilter('url_encode', '\\WPML\\Core\\twig_urlencode_filter'),
|
145 |
+
new \WPML\Core\Twig\TwigFilter('json_encode', '\\WPML\\Core\\twig_jsonencode_filter'),
|
146 |
+
new \WPML\Core\Twig\TwigFilter('convert_encoding', '\\WPML\\Core\\twig_convert_encoding'),
|
147 |
+
// string filters
|
148 |
+
new \WPML\Core\Twig\TwigFilter('title', '\\WPML\\Core\\twig_title_string_filter', ['needs_environment' => \true]),
|
149 |
+
new \WPML\Core\Twig\TwigFilter('capitalize', '\\WPML\\Core\\twig_capitalize_string_filter', ['needs_environment' => \true]),
|
150 |
+
new \WPML\Core\Twig\TwigFilter('upper', 'strtoupper'),
|
151 |
+
new \WPML\Core\Twig\TwigFilter('lower', 'strtolower'),
|
152 |
+
new \WPML\Core\Twig\TwigFilter('striptags', 'strip_tags'),
|
153 |
+
new \WPML\Core\Twig\TwigFilter('trim', '\\WPML\\Core\\twig_trim_filter'),
|
154 |
+
new \WPML\Core\Twig\TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]),
|
155 |
+
new \WPML\Core\Twig\TwigFilter('spaceless', '\\WPML\\Core\\twig_spaceless', ['is_safe' => ['html']]),
|
156 |
+
// array helpers
|
157 |
+
new \WPML\Core\Twig\TwigFilter('join', '\\WPML\\Core\\twig_join_filter'),
|
158 |
+
new \WPML\Core\Twig\TwigFilter('split', '\\WPML\\Core\\twig_split_filter', ['needs_environment' => \true]),
|
159 |
+
new \WPML\Core\Twig\TwigFilter('sort', '\\WPML\\Core\\twig_sort_filter'),
|
160 |
+
new \WPML\Core\Twig\TwigFilter('merge', '\\WPML\\Core\\twig_array_merge'),
|
161 |
+
new \WPML\Core\Twig\TwigFilter('batch', '\\WPML\\Core\\twig_array_batch'),
|
162 |
+
new \WPML\Core\Twig\TwigFilter('filter', '\\WPML\\Core\\twig_array_filter'),
|
163 |
+
new \WPML\Core\Twig\TwigFilter('map', '\\WPML\\Core\\twig_array_map'),
|
164 |
+
new \WPML\Core\Twig\TwigFilter('reduce', '\\WPML\\Core\\twig_array_reduce'),
|
165 |
+
// string/array filters
|
166 |
+
new \WPML\Core\Twig\TwigFilter('reverse', '\\WPML\\Core\\twig_reverse_filter', ['needs_environment' => \true]),
|
167 |
+
new \WPML\Core\Twig\TwigFilter('length', '\\WPML\\Core\\twig_length_filter', ['needs_environment' => \true]),
|
168 |
+
new \WPML\Core\Twig\TwigFilter('slice', '\\WPML\\Core\\twig_slice', ['needs_environment' => \true]),
|
169 |
+
new \WPML\Core\Twig\TwigFilter('first', '\\WPML\\Core\\twig_first', ['needs_environment' => \true]),
|
170 |
+
new \WPML\Core\Twig\TwigFilter('last', '\\WPML\\Core\\twig_last', ['needs_environment' => \true]),
|
171 |
+
// iteration and runtime
|
172 |
+
new \WPML\Core\Twig\TwigFilter('default', '\\WPML\\Core\\_twig_default_filter', ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Filter\\DefaultFilter']),
|
173 |
+
new \WPML\Core\Twig\TwigFilter('keys', '\\WPML\\Core\\twig_get_array_keys_filter'),
|
174 |
+
// escaping
|
175 |
+
new \WPML\Core\Twig\TwigFilter('escape', '\\WPML\\Core\\twig_escape_filter', ['needs_environment' => \true, 'is_safe_callback' => '\\WPML\\Core\\twig_escape_filter_is_safe']),
|
176 |
+
new \WPML\Core\Twig\TwigFilter('e', '\\WPML\\Core\\twig_escape_filter', ['needs_environment' => \true, 'is_safe_callback' => '\\WPML\\Core\\twig_escape_filter_is_safe']),
|
177 |
+
];
|
178 |
+
if (\function_exists('mb_get_info')) {
|
179 |
+
$filters[] = new \WPML\Core\Twig\TwigFilter('upper', '\\WPML\\Core\\twig_upper_filter', ['needs_environment' => \true]);
|
180 |
+
$filters[] = new \WPML\Core\Twig\TwigFilter('lower', '\\WPML\\Core\\twig_lower_filter', ['needs_environment' => \true]);
|
181 |
+
}
|
182 |
+
return $filters;
|
183 |
+
}
|
184 |
+
public function getFunctions()
|
185 |
+
{
|
186 |
+
return [new \WPML\Core\Twig\TwigFunction('max', 'max'), new \WPML\Core\Twig\TwigFunction('min', 'min'), new \WPML\Core\Twig\TwigFunction('range', 'range'), new \WPML\Core\Twig\TwigFunction('constant', 'twig_constant'), new \WPML\Core\Twig\TwigFunction('cycle', 'twig_cycle'), new \WPML\Core\Twig\TwigFunction('random', 'twig_random', ['needs_environment' => \true]), new \WPML\Core\Twig\TwigFunction('date', 'twig_date_converter', ['needs_environment' => \true]), new \WPML\Core\Twig\TwigFunction('include', 'twig_include', ['needs_environment' => \true, 'needs_context' => \true, 'is_safe' => ['all']]), new \WPML\Core\Twig\TwigFunction('source', 'twig_source', ['needs_environment' => \true, 'is_safe' => ['all']])];
|
187 |
+
}
|
188 |
+
public function getTests()
|
189 |
+
{
|
190 |
+
return [new \WPML\Core\Twig\TwigTest('even', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\EvenTest']), new \WPML\Core\Twig\TwigTest('odd', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\OddTest']), new \WPML\Core\Twig\TwigTest('defined', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\DefinedTest']), new \WPML\Core\Twig\TwigTest('sameas', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest', 'deprecated' => '1.21', 'alternative' => 'same as']), new \WPML\Core\Twig\TwigTest('same as', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest']), new \WPML\Core\Twig\TwigTest('none', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest']), new \WPML\Core\Twig\TwigTest('null', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest']), new \WPML\Core\Twig\TwigTest('divisibleby', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest', 'deprecated' => '1.21', 'alternative' => 'divisible by']), new \WPML\Core\Twig\TwigTest('divisible by', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest']), new \WPML\Core\Twig\TwigTest('constant', null, ['node_class' => 'WPML\\Core\\Twig\\Node\\Expression\\Test\\ConstantTest']), new \WPML\Core\Twig\TwigTest('empty', 'twig_test_empty'), new \WPML\Core\Twig\TwigTest('iterable', 'twig_test_iterable')];
|
191 |
+
}
|
192 |
+
public function getOperators()
|
193 |
+
{
|
194 |
+
return [['not' => ['precedence' => 50, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NotUnary'], '-' => ['precedence' => 500, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary'], '+' => ['precedence' => 500, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary']], ['or' => ['precedence' => 10, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\OrBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'and' => ['precedence' => 15, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AndBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'b-or' => ['precedence' => 16, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'b-xor' => ['precedence' => 17, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'b-and' => ['precedence' => 18, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '==' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EqualBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '!=' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotEqualBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '<' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '>' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '>=' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '<=' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessEqualBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'not in' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotInBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'in' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\InBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'matches' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MatchesBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'starts with' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\StartsWithBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'ends with' => ['precedence' => 20, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\EndsWithBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '..' => ['precedence' => 25, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\RangeBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '+' => ['precedence' => 30, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\AddBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '-' => ['precedence' => 30, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\SubBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '~' => ['precedence' => 40, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ConcatBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '*' => ['precedence' => 60, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\MulBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '/' => ['precedence' => 60, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\DivBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '//' => ['precedence' => 60, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\FloorDivBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '%' => ['precedence' => 60, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\ModBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'is' => ['precedence' => 100, 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], 'is not' => ['precedence' => 100, 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_LEFT], '**' => ['precedence' => 200, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\Binary\\PowerBinary', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_RIGHT], '??' => ['precedence' => 300, 'class' => 'WPML\\Core\\Twig\\Node\\Expression\\NullCoalesceExpression', 'associativity' => \WPML\Core\Twig\ExpressionParser::OPERATOR_RIGHT]]];
|
195 |
+
}
|
196 |
+
public function getName()
|
197 |
+
{
|
198 |
+
return 'core';
|
199 |
+
}
|
200 |
+
}
|
201 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\CoreExtension', 'WPML\\Core\\Twig_Extension_Core');
|
202 |
+
namespace WPML\Core;
|
203 |
+
|
204 |
+
use WPML\Core\Twig\Environment;
|
205 |
+
use WPML\Core\Twig\Error\LoaderError;
|
206 |
+
use WPML\Core\Twig\Error\RuntimeError;
|
207 |
+
use WPML\Core\Twig\Loader\SourceContextLoaderInterface;
|
208 |
+
use WPML\Core\Twig\Markup;
|
209 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
210 |
+
use WPML\Core\Twig\Node\Node;
|
211 |
+
/**
|
212 |
+
* Cycles over a value.
|
213 |
+
*
|
214 |
+
* @param \ArrayAccess|array $values
|
215 |
+
* @param int $position The cycle position
|
216 |
+
*
|
217 |
+
* @return string The next value in the cycle
|
218 |
+
*/
|
219 |
+
function twig_cycle($values, $position)
|
220 |
+
{
|
221 |
+
if (!\is_array($values) && !$values instanceof \ArrayAccess) {
|
222 |
+
return $values;
|
223 |
+
}
|
224 |
+
return $values[$position % \count($values)];
|
225 |
+
}
|
226 |
+
/**
|
227 |
+
* Returns a random value depending on the supplied parameter type:
|
228 |
+
* - a random item from a \Traversable or array
|
229 |
+
* - a random character from a string
|
230 |
+
* - a random integer between 0 and the integer parameter.
|
231 |
+
*
|
232 |
+
* @param \Traversable|array|int|float|string $values The values to pick a random item from
|
233 |
+
* @param int|null $max Maximum value used when $values is an int
|
234 |
+
*
|
235 |
+
* @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is)
|
236 |
+
*
|
237 |
+
* @return mixed A random value from the given sequence
|
238 |
+
*/
|
239 |
+
function twig_random(\WPML\Core\Twig\Environment $env, $values = null, $max = null)
|
240 |
+
{
|
241 |
+
if (null === $values) {
|
242 |
+
return null === $max ? \mt_rand() : \mt_rand(0, $max);
|
243 |
+
}
|
244 |
+
if (\is_int($values) || \is_float($values)) {
|
245 |
+
if (null === $max) {
|
246 |
+
if ($values < 0) {
|
247 |
+
$max = 0;
|
248 |
+
$min = $values;
|
249 |
+
} else {
|
250 |
+
$max = $values;
|
251 |
+
$min = 0;
|
252 |
+
}
|
253 |
+
} else {
|
254 |
+
$min = $values;
|
255 |
+
$max = $max;
|
256 |
+
}
|
257 |
+
return \mt_rand($min, $max);
|
258 |
+
}
|
259 |
+
if (\is_string($values)) {
|
260 |
+
if ('' === $values) {
|
261 |
+
return '';
|
262 |
+
}
|
263 |
+
if (null !== ($charset = $env->getCharset())) {
|
264 |
+
if ('UTF-8' !== $charset) {
|
265 |
+
$values = \WPML\Core\twig_convert_encoding($values, 'UTF-8', $charset);
|
266 |
+
}
|
267 |
+
// unicode version of str_split()
|
268 |
+
// split at all positions, but not after the start and not before the end
|
269 |
+
$values = \preg_split('/(?<!^)(?!$)/u', $values);
|
270 |
+
if ('UTF-8' !== $charset) {
|
271 |
+
foreach ($values as $i => $value) {
|
272 |
+
$values[$i] = \WPML\Core\twig_convert_encoding($value, $charset, 'UTF-8');
|
273 |
+
}
|
274 |
+
}
|
275 |
+
} else {
|
276 |
+
return $values[\mt_rand(0, \strlen($values) - 1)];
|
277 |
+
}
|
278 |
+
}
|
279 |
+
if (!\WPML\Core\twig_test_iterable($values)) {
|
280 |
+
return $values;
|
281 |
+
}
|
282 |
+
$values = \WPML\Core\twig_to_array($values);
|
283 |
+
if (0 === \count($values)) {
|
284 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('The random function cannot pick from an empty array.');
|
285 |
+
}
|
286 |
+
return $values[\array_rand($values, 1)];
|
287 |
+
}
|
288 |
+
/**
|
289 |
+
* Converts a date to the given format.
|
290 |
+
*
|
291 |
+
* {{ post.published_at|date("m/d/Y") }}
|
292 |
+
*
|
293 |
+
* @param \DateTime|\DateTimeInterface|\DateInterval|string $date A date
|
294 |
+
* @param string|null $format The target format, null to use the default
|
295 |
+
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
|
296 |
+
*
|
297 |
+
* @return string The formatted date
|
298 |
+
*/
|
299 |
+
function twig_date_format_filter(\WPML\Core\Twig\Environment $env, $date, $format = null, $timezone = null)
|
300 |
+
{
|
301 |
+
if (null === $format) {
|
302 |
+
$formats = $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getDateFormat();
|
303 |
+
$format = $date instanceof \DateInterval ? $formats[1] : $formats[0];
|
304 |
+
}
|
305 |
+
if ($date instanceof \DateInterval) {
|
306 |
+
return $date->format($format);
|
307 |
+
}
|
308 |
+
return \WPML\Core\twig_date_converter($env, $date, $timezone)->format($format);
|
309 |
+
}
|
310 |
+
/**
|
311 |
+
* Returns a new date object modified.
|
312 |
+
*
|
313 |
+
* {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
|
314 |
+
*
|
315 |
+
* @param \DateTime|string $date A date
|
316 |
+
* @param string $modifier A modifier string
|
317 |
+
*
|
318 |
+
* @return \DateTime
|
319 |
+
*/
|
320 |
+
function twig_date_modify_filter(\WPML\Core\Twig\Environment $env, $date, $modifier)
|
321 |
+
{
|
322 |
+
$date = \WPML\Core\twig_date_converter($env, $date, \false);
|
323 |
+
$resultDate = $date->modify($modifier);
|
324 |
+
// This is a hack to ensure PHP 5.2 support and support for \DateTimeImmutable
|
325 |
+
// \DateTime::modify does not return the modified \DateTime object < 5.3.0
|
326 |
+
// and \DateTimeImmutable does not modify $date.
|
327 |
+
return null === $resultDate ? $date : $resultDate;
|
328 |
+
}
|
329 |
+
/**
|
330 |
+
* Converts an input to a \DateTime instance.
|
331 |
+
*
|
332 |
+
* {% if date(user.created_at) < date('+2days') %}
|
333 |
+
* {# do something #}
|
334 |
+
* {% endif %}
|
335 |
+
*
|
336 |
+
* @param \DateTime|\DateTimeInterface|string|null $date A date
|
337 |
+
* @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged
|
338 |
+
*
|
339 |
+
* @return \DateTime
|
340 |
+
*/
|
341 |
+
function twig_date_converter(\WPML\Core\Twig\Environment $env, $date = null, $timezone = null)
|
342 |
+
{
|
343 |
+
// determine the timezone
|
344 |
+
if (\false !== $timezone) {
|
345 |
+
if (null === $timezone) {
|
346 |
+
$timezone = $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getTimezone();
|
347 |
+
} elseif (!$timezone instanceof \DateTimeZone) {
|
348 |
+
$timezone = new \DateTimeZone($timezone);
|
349 |
+
}
|
350 |
+
}
|
351 |
+
// immutable dates
|
352 |
+
if ($date instanceof \DateTimeImmutable) {
|
353 |
+
return \false !== $timezone ? $date->setTimezone($timezone) : $date;
|
354 |
+
}
|
355 |
+
if ($date instanceof \DateTime || $date instanceof \DateTimeInterface) {
|
356 |
+
$date = clone $date;
|
357 |
+
if (\false !== $timezone) {
|
358 |
+
$date->setTimezone($timezone);
|
359 |
+
}
|
360 |
+
return $date;
|
361 |
+
}
|
362 |
+
if (null === $date || 'now' === $date) {
|
363 |
+
return new \DateTime($date, \false !== $timezone ? $timezone : $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getTimezone());
|
364 |
+
}
|
365 |
+
$asString = (string) $date;
|
366 |
+
if (\ctype_digit($asString) || !empty($asString) && '-' === $asString[0] && \ctype_digit(\substr($asString, 1))) {
|
367 |
+
$date = new \DateTime('@' . $date);
|
368 |
+
} else {
|
369 |
+
$date = new \DateTime($date, $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getTimezone());
|
370 |
+
}
|
371 |
+
if (\false !== $timezone) {
|
372 |
+
$date->setTimezone($timezone);
|
373 |
+
}
|
374 |
+
return $date;
|
375 |
+
}
|
376 |
+
/**
|
377 |
+
* Replaces strings within a string.
|
378 |
+
*
|
379 |
+
* @param string $str String to replace in
|
380 |
+
* @param array|\Traversable $from Replace values
|
381 |
+
* @param string|null $to Replace to, deprecated (@see https://secure.php.net/manual/en/function.strtr.php)
|
382 |
+
*
|
383 |
+
* @return string
|
384 |
+
*/
|
385 |
+
function twig_replace_filter($str, $from, $to = null)
|
386 |
+
{
|
387 |
+
if (\is_string($from) && \is_string($to)) {
|
388 |
+
@\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);
|
389 |
+
return \strtr($str, $from, $to);
|
390 |
+
}
|
391 |
+
if (!\WPML\Core\twig_test_iterable($from)) {
|
392 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from)));
|
393 |
+
}
|
394 |
+
return \strtr($str, \WPML\Core\twig_to_array($from));
|
395 |
+
}
|
396 |
+
/**
|
397 |
+
* Rounds a number.
|
398 |
+
*
|
399 |
+
* @param int|float $value The value to round
|
400 |
+
* @param int|float $precision The rounding precision
|
401 |
+
* @param string $method The method to use for rounding
|
402 |
+
*
|
403 |
+
* @return int|float The rounded number
|
404 |
+
*/
|
405 |
+
function twig_round($value, $precision = 0, $method = 'common')
|
406 |
+
{
|
407 |
+
if ('common' == $method) {
|
408 |
+
return \round($value, $precision);
|
409 |
+
}
|
410 |
+
if ('ceil' != $method && 'floor' != $method) {
|
411 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.');
|
412 |
+
}
|
413 |
+
return $method($value * \pow(10, $precision)) / \pow(10, $precision);
|
414 |
+
}
|
415 |
+
/**
|
416 |
+
* Number format filter.
|
417 |
+
*
|
418 |
+
* All of the formatting options can be left null, in that case the defaults will
|
419 |
+
* be used. Supplying any of the parameters will override the defaults set in the
|
420 |
+
* environment object.
|
421 |
+
*
|
422 |
+
* @param mixed $number A float/int/string of the number to format
|
423 |
+
* @param int $decimal the number of decimal points to display
|
424 |
+
* @param string $decimalPoint the character(s) to use for the decimal point
|
425 |
+
* @param string $thousandSep the character(s) to use for the thousands separator
|
426 |
+
*
|
427 |
+
* @return string The formatted number
|
428 |
+
*/
|
429 |
+
function twig_number_format_filter(\WPML\Core\Twig\Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null)
|
430 |
+
{
|
431 |
+
$defaults = $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getNumberFormat();
|
432 |
+
if (null === $decimal) {
|
433 |
+
$decimal = $defaults[0];
|
434 |
+
}
|
435 |
+
if (null === $decimalPoint) {
|
436 |
+
$decimalPoint = $defaults[1];
|
437 |
+
}
|
438 |
+
if (null === $thousandSep) {
|
439 |
+
$thousandSep = $defaults[2];
|
440 |
+
}
|
441 |
+
return \number_format((float) $number, $decimal, $decimalPoint, $thousandSep);
|
442 |
+
}
|
443 |
+
/**
|
444 |
+
* URL encodes (RFC 3986) a string as a path segment or an array as a query string.
|
445 |
+
*
|
446 |
+
* @param string|array $url A URL or an array of query parameters
|
447 |
+
*
|
448 |
+
* @return string The URL encoded value
|
449 |
+
*/
|
450 |
+
function twig_urlencode_filter($url)
|
451 |
+
{
|
452 |
+
if (\is_array($url)) {
|
453 |
+
if (\defined('PHP_QUERY_RFC3986')) {
|
454 |
+
return \http_build_query($url, '', '&', \PHP_QUERY_RFC3986);
|
455 |
+
}
|
456 |
+
return \http_build_query($url, '', '&');
|
457 |
+
}
|
458 |
+
return \rawurlencode($url);
|
459 |
+
}
|
460 |
+
/**
|
461 |
+
* JSON encodes a variable.
|
462 |
+
*
|
463 |
+
* @param mixed $value the value to encode
|
464 |
+
* @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
|
465 |
+
*
|
466 |
+
* @return mixed The JSON encoded value
|
467 |
+
*/
|
468 |
+
function twig_jsonencode_filter($value, $options = 0)
|
469 |
+
{
|
470 |
+
if ($value instanceof \WPML\Core\Twig\Markup) {
|
471 |
+
$value = (string) $value;
|
472 |
+
} elseif (\is_array($value)) {
|
473 |
+
\array_walk_recursive($value, '\\WPML\\Core\\_twig_markup2string');
|
474 |
+
}
|
475 |
+
return \json_encode($value, $options);
|
476 |
+
}
|
477 |
+
function _twig_markup2string(&$value)
|
478 |
+
{
|
479 |
+
if ($value instanceof \WPML\Core\Twig\Markup) {
|
480 |
+
$value = (string) $value;
|
481 |
+
}
|
482 |
+
}
|
483 |
+
/**
|
484 |
+
* Merges an array with another one.
|
485 |
+
*
|
486 |
+
* {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
|
487 |
+
*
|
488 |
+
* {% set items = items|merge({ 'peugeot': 'car' }) %}
|
489 |
+
*
|
490 |
+
* {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
|
491 |
+
*
|
492 |
+
* @param array|\Traversable $arr1 An array
|
493 |
+
* @param array|\Traversable $arr2 An array
|
494 |
+
*
|
495 |
+
* @return array The merged array
|
496 |
+
*/
|
497 |
+
function twig_array_merge($arr1, $arr2)
|
498 |
+
{
|
499 |
+
if (!\WPML\Core\twig_test_iterable($arr1)) {
|
500 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1)));
|
501 |
+
}
|
502 |
+
if (!\WPML\Core\twig_test_iterable($arr2)) {
|
503 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2)));
|
504 |
+
}
|
505 |
+
return \array_merge(\WPML\Core\twig_to_array($arr1), \WPML\Core\twig_to_array($arr2));
|
506 |
+
}
|
507 |
+
/**
|
508 |
+
* Slices a variable.
|
509 |
+
*
|
510 |
+
* @param mixed $item A variable
|
511 |
+
* @param int $start Start of the slice
|
512 |
+
* @param int $length Size of the slice
|
513 |
+
* @param bool $preserveKeys Whether to preserve key or not (when the input is an array)
|
514 |
+
*
|
515 |
+
* @return mixed The sliced variable
|
516 |
+
*/
|
517 |
+
function twig_slice(\WPML\Core\Twig\Environment $env, $item, $start, $length = null, $preserveKeys = \false)
|
518 |
+
{
|
519 |
+
if ($item instanceof \Traversable) {
|
520 |
+
while ($item instanceof \IteratorAggregate) {
|
521 |
+
$item = $item->getIterator();
|
522 |
+
}
|
523 |
+
if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) {
|
524 |
+
try {
|
525 |
+
return \iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys);
|
526 |
+
} catch (\OutOfBoundsException $e) {
|
527 |
+
return [];
|
528 |
+
}
|
529 |
+
}
|
530 |
+
$item = \iterator_to_array($item, $preserveKeys);
|
531 |
+
}
|
532 |
+
if (\is_array($item)) {
|
533 |
+
return \array_slice($item, $start, $length, $preserveKeys);
|
534 |
+
}
|
535 |
+
$item = (string) $item;
|
536 |
+
if (\function_exists('mb_get_info') && null !== ($charset = $env->getCharset())) {
|
537 |
+
return (string) \mb_substr($item, $start, null === $length ? \mb_strlen($item, $charset) - $start : $length, $charset);
|
538 |
+
}
|
539 |
+
return (string) (null === $length ? \substr($item, $start) : \substr($item, $start, $length));
|
540 |
+
}
|
541 |
+
/**
|
542 |
+
* Returns the first element of the item.
|
543 |
+
*
|
544 |
+
* @param mixed $item A variable
|
545 |
+
*
|
546 |
+
* @return mixed The first element of the item
|
547 |
+
*/
|
548 |
+
function twig_first(\WPML\Core\Twig\Environment $env, $item)
|
549 |
+
{
|
550 |
+
$elements = \WPML\Core\twig_slice($env, $item, 0, 1, \false);
|
551 |
+
return \is_string($elements) ? $elements : \current($elements);
|
552 |
+
}
|
553 |
+
/**
|
554 |
+
* Returns the last element of the item.
|
555 |
+
*
|
556 |
+
* @param mixed $item A variable
|
557 |
+
*
|
558 |
+
* @return mixed The last element of the item
|
559 |
+
*/
|
560 |
+
function twig_last(\WPML\Core\Twig\Environment $env, $item)
|
561 |
+
{
|
562 |
+
$elements = \WPML\Core\twig_slice($env, $item, -1, 1, \false);
|
563 |
+
return \is_string($elements) ? $elements : \current($elements);
|
564 |
+
}
|
565 |
+
/**
|
566 |
+
* Joins the values to a string.
|
567 |
+
*
|
568 |
+
* The separators between elements are empty strings per default, you can define them with the optional parameters.
|
569 |
+
*
|
570 |
+
* {{ [1, 2, 3]|join(', ', ' and ') }}
|
571 |
+
* {# returns 1, 2 and 3 #}
|
572 |
+
*
|
573 |
+
* {{ [1, 2, 3]|join('|') }}
|
574 |
+
* {# returns 1|2|3 #}
|
575 |
+
*
|
576 |
+
* {{ [1, 2, 3]|join }}
|
577 |
+
* {# returns 123 #}
|
578 |
+
*
|
579 |
+
* @param array $value An array
|
580 |
+
* @param string $glue The separator
|
581 |
+
* @param string|null $and The separator for the last pair
|
582 |
+
*
|
583 |
+
* @return string The concatenated string
|
584 |
+
*/
|
585 |
+
function twig_join_filter($value, $glue = '', $and = null)
|
586 |
+
{
|
587 |
+
if (!\WPML\Core\twig_test_iterable($value)) {
|
588 |
+
$value = (array) $value;
|
589 |
+
}
|
590 |
+
$value = \WPML\Core\twig_to_array($value, \false);
|
591 |
+
if (0 === \count($value)) {
|
592 |
+
return '';
|
593 |
+
}
|
594 |
+
if (null === $and || $and === $glue) {
|
595 |
+
return \implode($glue, $value);
|
596 |
+
}
|
597 |
+
if (1 === \count($value)) {
|
598 |
+
return $value[0];
|
599 |
+
}
|
600 |
+
return \implode($glue, \array_slice($value, 0, -1)) . $and . $value[\count($value) - 1];
|
601 |
+
}
|
602 |
+
/**
|
603 |
+
* Splits the string into an array.
|
604 |
+
*
|
605 |
+
* {{ "one,two,three"|split(',') }}
|
606 |
+
* {# returns [one, two, three] #}
|
607 |
+
*
|
608 |
+
* {{ "one,two,three,four,five"|split(',', 3) }}
|
609 |
+
* {# returns [one, two, "three,four,five"] #}
|
610 |
+
*
|
611 |
+
* {{ "123"|split('') }}
|
612 |
+
* {# returns [1, 2, 3] #}
|
613 |
+
*
|
614 |
+
* {{ "aabbcc"|split('', 2) }}
|
615 |
+
* {# returns [aa, bb, cc] #}
|
616 |
+
*
|
617 |
+
* @param string $value A string
|
618 |
+
* @param string $delimiter The delimiter
|
619 |
+
* @param int $limit The limit
|
620 |
+
*
|
621 |
+
* @return array The split string as an array
|
622 |
+
*/
|
623 |
+
function twig_split_filter(\WPML\Core\Twig\Environment $env, $value, $delimiter, $limit = null)
|
624 |
+
{
|
625 |
+
if (\strlen($delimiter) > 0) {
|
626 |
+
return null === $limit ? \explode($delimiter, $value) : \explode($delimiter, $value, $limit);
|
627 |
+
}
|
628 |
+
if (!\function_exists('mb_get_info') || null === ($charset = $env->getCharset())) {
|
629 |
+
return \str_split($value, null === $limit ? 1 : $limit);
|
630 |
+
}
|
631 |
+
if ($limit <= 1) {
|
632 |
+
return \preg_split('/(?<!^)(?!$)/u', $value);
|
633 |
+
}
|
634 |
+
$length = \mb_strlen($value, $charset);
|
635 |
+
if ($length < $limit) {
|
636 |
+
return [$value];
|
637 |
+
}
|
638 |
+
$r = [];
|
639 |
+
for ($i = 0; $i < $length; $i += $limit) {
|
640 |
+
$r[] = \mb_substr($value, $i, $limit, $charset);
|
641 |
+
}
|
642 |
+
return $r;
|
643 |
+
}
|
644 |
+
// The '_default' filter is used internally to avoid using the ternary operator
|
645 |
+
// which costs a lot for big contexts (before PHP 5.4). So, on average,
|
646 |
+
// a function call is cheaper.
|
647 |
+
/**
|
648 |
+
* @internal
|
649 |
+
*/
|
650 |
+
function _twig_default_filter($value, $default = '')
|
651 |
+
{
|
652 |
+
if (\WPML\Core\twig_test_empty($value)) {
|
653 |
+
return $default;
|
654 |
+
}
|
655 |
+
return $value;
|
656 |
+
}
|
657 |
+
/**
|
658 |
+
* Returns the keys for the given array.
|
659 |
+
*
|
660 |
+
* It is useful when you want to iterate over the keys of an array:
|
661 |
+
*
|
662 |
+
* {% for key in array|keys %}
|
663 |
+
* {# ... #}
|
664 |
+
* {% endfor %}
|
665 |
+
*
|
666 |
+
* @param array $array An array
|
667 |
+
*
|
668 |
+
* @return array The keys
|
669 |
+
*/
|
670 |
+
function twig_get_array_keys_filter($array)
|
671 |
+
{
|
672 |
+
if ($array instanceof \Traversable) {
|
673 |
+
while ($array instanceof \IteratorAggregate) {
|
674 |
+
$array = $array->getIterator();
|
675 |
+
}
|
676 |
+
if ($array instanceof \Iterator) {
|
677 |
+
$keys = [];
|
678 |
+
$array->rewind();
|
679 |
+
while ($array->valid()) {
|
680 |
+
$keys[] = $array->key();
|
681 |
+
$array->next();
|
682 |
+
}
|
683 |
+
return $keys;
|
684 |
+
}
|
685 |
+
$keys = [];
|
686 |
+
foreach ($array as $key => $item) {
|
687 |
+
$keys[] = $key;
|
688 |
+
}
|
689 |
+
return $keys;
|
690 |
+
}
|
691 |
+
if (!\is_array($array)) {
|
692 |
+
return [];
|
693 |
+
}
|
694 |
+
return \array_keys($array);
|
695 |
+
}
|
696 |
+
/**
|
697 |
+
* Reverses a variable.
|
698 |
+
*
|
699 |
+
* @param array|\Traversable|string $item An array, a \Traversable instance, or a string
|
700 |
+
* @param bool $preserveKeys Whether to preserve key or not
|
701 |
+
*
|
702 |
+
* @return mixed The reversed input
|
703 |
+
*/
|
704 |
+
function twig_reverse_filter(\WPML\Core\Twig\Environment $env, $item, $preserveKeys = \false)
|
705 |
+
{
|
706 |
+
if ($item instanceof \Traversable) {
|
707 |
+
return \array_reverse(\iterator_to_array($item), $preserveKeys);
|
708 |
+
}
|
709 |
+
if (\is_array($item)) {
|
710 |
+
return \array_reverse($item, $preserveKeys);
|
711 |
+
}
|
712 |
+
if (null !== ($charset = $env->getCharset())) {
|
713 |
+
$string = (string) $item;
|
714 |
+
if ('UTF-8' !== $charset) {
|
715 |
+
$item = \WPML\Core\twig_convert_encoding($string, 'UTF-8', $charset);
|
716 |
+
}
|
717 |
+
\preg_match_all('/./us', $item, $matches);
|
718 |
+
$string = \implode('', \array_reverse($matches[0]));
|
719 |
+
if ('UTF-8' !== $charset) {
|
720 |
+
$string = \WPML\Core\twig_convert_encoding($string, $charset, 'UTF-8');
|
721 |
+
}
|
722 |
+
return $string;
|
723 |
+
}
|
724 |
+
return \strrev((string) $item);
|
725 |
+
}
|
726 |
+
/**
|
727 |
+
* Sorts an array.
|
728 |
+
*
|
729 |
+
* @param array|\Traversable $array
|
730 |
+
*
|
731 |
+
* @return array
|
732 |
+
*/
|
733 |
+
function twig_sort_filter($array)
|
734 |
+
{
|
735 |
+
if ($array instanceof \Traversable) {
|
736 |
+
$array = \iterator_to_array($array);
|
737 |
+
} elseif (!\is_array($array)) {
|
738 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array)));
|
739 |
+
}
|
740 |
+
\asort($array);
|
741 |
+
return $array;
|
742 |
+
}
|
743 |
+
/**
|
744 |
+
* @internal
|
745 |
+
*/
|
746 |
+
function twig_in_filter($value, $compare)
|
747 |
+
{
|
748 |
+
if ($value instanceof \WPML\Core\Twig\Markup) {
|
749 |
+
$value = (string) $value;
|
750 |
+
}
|
751 |
+
if ($compare instanceof \WPML\Core\Twig\Markup) {
|
752 |
+
$compare = (string) $compare;
|
753 |
+
}
|
754 |
+
if (\is_array($compare)) {
|
755 |
+
return \in_array($value, $compare, \is_object($value) || \is_resource($value));
|
756 |
+
} elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) {
|
757 |
+
return '' === $value || \false !== \strpos($compare, (string) $value);
|
758 |
+
} elseif ($compare instanceof \Traversable) {
|
759 |
+
if (\is_object($value) || \is_resource($value)) {
|
760 |
+
foreach ($compare as $item) {
|
761 |
+
if ($item === $value) {
|
762 |
+
return \true;
|
763 |
+
}
|
764 |
+
}
|
765 |
+
} else {
|
766 |
+
foreach ($compare as $item) {
|
767 |
+
if ($item == $value) {
|
768 |
+
return \true;
|
769 |
+
}
|
770 |
+
}
|
771 |
+
}
|
772 |
+
return \false;
|
773 |
+
}
|
774 |
+
return \false;
|
775 |
+
}
|
776 |
+
/**
|
777 |
+
* Returns a trimmed string.
|
778 |
+
*
|
779 |
+
* @return string
|
780 |
+
*
|
781 |
+
* @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both')
|
782 |
+
*/
|
783 |
+
function twig_trim_filter($string, $characterMask = null, $side = 'both')
|
784 |
+
{
|
785 |
+
if (null === $characterMask) {
|
786 |
+
$characterMask = " \t\n\r\0\v";
|
787 |
+
}
|
788 |
+
switch ($side) {
|
789 |
+
case 'both':
|
790 |
+
return \trim($string, $characterMask);
|
791 |
+
case 'left':
|
792 |
+
return \ltrim($string, $characterMask);
|
793 |
+
case 'right':
|
794 |
+
return \rtrim($string, $characterMask);
|
795 |
+
default:
|
796 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('Trimming side must be "left", "right" or "both".');
|
797 |
+
}
|
798 |
+
}
|
799 |
+
/**
|
800 |
+
* Removes whitespaces between HTML tags.
|
801 |
+
*
|
802 |
+
* @return string
|
803 |
+
*/
|
804 |
+
function twig_spaceless($content)
|
805 |
+
{
|
806 |
+
return \trim(\preg_replace('/>\\s+</', '><', $content));
|
807 |
+
}
|
808 |
+
/**
|
809 |
+
* Escapes a string.
|
810 |
+
*
|
811 |
+
* @param mixed $string The value to be escaped
|
812 |
+
* @param string $strategy The escaping strategy
|
813 |
+
* @param string $charset The charset
|
814 |
+
* @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false)
|
815 |
+
*
|
816 |
+
* @return string
|
817 |
+
*/
|
818 |
+
function twig_escape_filter(\WPML\Core\Twig\Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = \false)
|
819 |
+
{
|
820 |
+
if ($autoescape && $string instanceof \WPML\Core\Twig\Markup) {
|
821 |
+
return $string;
|
822 |
+
}
|
823 |
+
if (!\is_string($string)) {
|
824 |
+
if (\is_object($string) && \method_exists($string, '__toString')) {
|
825 |
+
$string = (string) $string;
|
826 |
+
} elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) {
|
827 |
+
return $string;
|
828 |
+
}
|
829 |
+
}
|
830 |
+
if ('' === $string) {
|
831 |
+
return '';
|
832 |
+
}
|
833 |
+
if (null === $charset) {
|
834 |
+
$charset = $env->getCharset();
|
835 |
+
}
|
836 |
+
switch ($strategy) {
|
837 |
+
case 'html':
|
838 |
+
// see https://secure.php.net/htmlspecialchars
|
839 |
+
// Using a static variable to avoid initializing the array
|
840 |
+
// each time the function is called. Moving the declaration on the
|
841 |
+
// top of the function slow downs other escaping strategies.
|
842 |
+
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];
|
843 |
+
if (isset($htmlspecialcharsCharsets[$charset])) {
|
844 |
+
return \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset);
|
845 |
+
}
|
846 |
+
if (isset($htmlspecialcharsCharsets[\strtoupper($charset)])) {
|
847 |
+
// cache the lowercase variant for future iterations
|
848 |
+
$htmlspecialcharsCharsets[$charset] = \true;
|
849 |
+
return \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset);
|
850 |
+
}
|
851 |
+
$string = \WPML\Core\twig_convert_encoding($string, 'UTF-8', $charset);
|
852 |
+
$string = \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8');
|
853 |
+
return \WPML\Core\twig_convert_encoding($string, $charset, 'UTF-8');
|
854 |
+
case 'js':
|
855 |
+
// escape all non-alphanumeric characters
|
856 |
+
// into their \x or \uHHHH representations
|
857 |
+
if ('UTF-8' !== $charset) {
|
858 |
+
$string = \WPML\Core\twig_convert_encoding($string, 'UTF-8', $charset);
|
859 |
+
}
|
860 |
+
if (!\preg_match('//u', $string)) {
|
861 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.');
|
862 |
+
}
|
863 |
+
$string = \preg_replace_callback('#[^a-zA-Z0-9,\\._]#Su', '\\WPML\\Core\\_twig_escape_js_callback', $string);
|
864 |
+
if ('UTF-8' !== $charset) {
|
865 |
+
$string = \WPML\Core\twig_convert_encoding($string, $charset, 'UTF-8');
|
866 |
+
}
|
867 |
+
return $string;
|
868 |
+
case 'css':
|
869 |
+
if ('UTF-8' !== $charset) {
|
870 |
+
$string = \WPML\Core\twig_convert_encoding($string, 'UTF-8', $charset);
|
871 |
+
}
|
872 |
+
if (!\preg_match('//u', $string)) {
|
873 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.');
|
874 |
+
}
|
875 |
+
$string = \preg_replace_callback('#[^a-zA-Z0-9]#Su', '\\WPML\\Core\\_twig_escape_css_callback', $string);
|
876 |
+
if ('UTF-8' !== $charset) {
|
877 |
+
$string = \WPML\Core\twig_convert_encoding($string, $charset, 'UTF-8');
|
878 |
+
}
|
879 |
+
return $string;
|
880 |
+
case 'html_attr':
|
881 |
+
if ('UTF-8' !== $charset) {
|
882 |
+
$string = \WPML\Core\twig_convert_encoding($string, 'UTF-8', $charset);
|
883 |
+
}
|
884 |
+
if (!\preg_match('//u', $string)) {
|
885 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.');
|
886 |
+
}
|
887 |
+
$string = \preg_replace_callback('#[^a-zA-Z0-9,\\.\\-_]#Su', '\\WPML\\Core\\_twig_escape_html_attr_callback', $string);
|
888 |
+
if ('UTF-8' !== $charset) {
|
889 |
+
$string = \WPML\Core\twig_convert_encoding($string, $charset, 'UTF-8');
|
890 |
+
}
|
891 |
+
return $string;
|
892 |
+
case 'url':
|
893 |
+
return \rawurlencode($string);
|
894 |
+
default:
|
895 |
+
static $escapers;
|
896 |
+
if (null === $escapers) {
|
897 |
+
$escapers = $env->getExtension('WPML\\Core\\Twig\\Extension\\CoreExtension')->getEscapers();
|
898 |
+
}
|
899 |
+
if (isset($escapers[$strategy])) {
|
900 |
+
return \call_user_func($escapers[$strategy], $env, $string, $charset);
|
901 |
+
}
|
902 |
+
$validStrategies = \implode(', ', \array_merge(['html', 'js', 'url', 'css', 'html_attr'], \array_keys($escapers)));
|
903 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies));
|
904 |
+
}
|
905 |
+
}
|
906 |
+
/**
|
907 |
+
* @internal
|
908 |
+
*/
|
909 |
+
function twig_escape_filter_is_safe(\WPML\Core\Twig\Node\Node $filterArgs)
|
910 |
+
{
|
911 |
+
foreach ($filterArgs as $arg) {
|
912 |
+
if ($arg instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
913 |
+
return [$arg->getAttribute('value')];
|
914 |
+
}
|
915 |
+
return [];
|
916 |
+
}
|
917 |
+
return ['html'];
|
918 |
+
}
|
919 |
+
if (\function_exists('mb_convert_encoding')) {
|
920 |
+
function twig_convert_encoding($string, $to, $from)
|
921 |
+
{
|
922 |
+
return \mb_convert_encoding($string, $to, $from);
|
923 |
+
}
|
924 |
+
} elseif (\function_exists('iconv')) {
|
925 |
+
function twig_convert_encoding($string, $to, $from)
|
926 |
+
{
|
927 |
+
return \iconv($from, $to, $string);
|
928 |
+
}
|
929 |
+
} else {
|
930 |
+
function twig_convert_encoding($string, $to, $from)
|
931 |
+
{
|
932 |
+
throw new \WPML\Core\Twig\Error\RuntimeError('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
|
933 |
+
}
|
934 |
+
}
|
935 |
+
if (\function_exists('mb_ord')) {
|
936 |
+
function twig_ord($string)
|
937 |
+
{
|
938 |
+
return \mb_ord($string, 'UTF-8');
|
939 |
+
}
|
940 |
+
} else {
|
941 |
+
function twig_ord($string)
|
942 |
+
{
|
943 |
+
$code = ($string = \unpack('C*', \substr($string, 0, 4))) ? $string[1] : 0;
|
944 |
+
if (0xf0 <= $code) {
|
945 |
+
return ($code - 0xf0 << 18) + ($string[2] - 0x80 << 12) + ($string[3] - 0x80 << 6) + $string[4] - 0x80;
|
946 |
+
}
|
947 |
+
if (0xe0 <= $code) {
|
948 |
+
return ($code - 0xe0 << 12) + ($string[2] - 0x80 << 6) + $string[3] - 0x80;
|
949 |
+
}
|
950 |
+
if (0xc0 <= $code) {
|
951 |
+
return ($code - 0xc0 << 6) + $string[2] - 0x80;
|
952 |
+
}
|
953 |
+
return $code;
|
954 |
+
}
|
955 |
+
}
|
956 |
+
function _twig_escape_js_callback($matches)
|
957 |
+
{
|
958 |
+
$char = $matches[0];
|
959 |
+
/*
|
960 |
+
* A few characters have short escape sequences in JSON and JavaScript.
|
961 |
+
* Escape sequences supported only by JavaScript, not JSON, are ommitted.
|
962 |
+
* \" is also supported but omitted, because the resulting string is not HTML safe.
|
963 |
+
*/
|
964 |
+
static $shortMap = ['\\' => '\\\\', '/' => '\\/', "\10" => '\\b', "\f" => '\\f', "\n" => '\\n', "\r" => '\\r', "\t" => '\\t'];
|
965 |
+
if (isset($shortMap[$char])) {
|
966 |
+
return $shortMap[$char];
|
967 |
+
}
|
968 |
+
// \uHHHH
|
969 |
+
$char = \WPML\Core\twig_convert_encoding($char, 'UTF-16BE', 'UTF-8');
|
970 |
+
$char = \strtoupper(\bin2hex($char));
|
971 |
+
if (4 >= \strlen($char)) {
|
972 |
+
return \sprintf('\\u%04s', $char);
|
973 |
+
}
|
974 |
+
return \sprintf('\\u%04s\\u%04s', \substr($char, 0, -4), \substr($char, -4));
|
975 |
+
}
|
976 |
+
function _twig_escape_css_callback($matches)
|
977 |
+
{
|
978 |
+
$char = $matches[0];
|
979 |
+
return \sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : \WPML\Core\twig_ord($char));
|
980 |
+
}
|
981 |
+
/**
|
982 |
+
* This function is adapted from code coming from Zend Framework.
|
983 |
+
*
|
984 |
+
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com)
|
985 |
+
* @license https://framework.zend.com/license/new-bsd New BSD License
|
986 |
+
*/
|
987 |
+
function _twig_escape_html_attr_callback($matches)
|
988 |
+
{
|
989 |
+
$chr = $matches[0];
|
990 |
+
$ord = \ord($chr);
|
991 |
+
/*
|
992 |
+
* The following replaces characters undefined in HTML with the
|
993 |
+
* hex entity for the Unicode replacement character.
|
994 |
+
*/
|
995 |
+
if ($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr || $ord >= 0x7f && $ord <= 0x9f) {
|
996 |
+
return '�';
|
997 |
+
}
|
998 |
+
/*
|
999 |
+
* Check if the current character to escape has a name entity we should
|
1000 |
+
* replace it with while grabbing the hex value of the character.
|
1001 |
+
*/
|
1002 |
+
if (1 == \strlen($chr)) {
|
1003 |
+
/*
|
1004 |
+
* While HTML supports far more named entities, the lowest common denominator
|
1005 |
+
* has become HTML5's XML Serialisation which is restricted to the those named
|
1006 |
+
* entities that XML supports. Using HTML entities would result in this error:
|
1007 |
+
* XML Parsing Error: undefined entity
|
1008 |
+
*/
|
1009 |
+
static $entityMap = [
|
1010 |
+
34 => '"',
|
1011 |
+
/* quotation mark */
|
1012 |
+
38 => '&',
|
1013 |
+
/* ampersand */
|
1014 |
+
60 => '<',
|
1015 |
+
/* less-than sign */
|
1016 |
+
62 => '>',
|
1017 |
+
];
|
1018 |
+
if (isset($entityMap[$ord])) {
|
1019 |
+
return $entityMap[$ord];
|
1020 |
+
}
|
1021 |
+
return \sprintf('&#x%02X;', $ord);
|
1022 |
+
}
|
1023 |
+
/*
|
1024 |
+
* Per OWASP recommendations, we'll use hex entities for any other
|
1025 |
+
* characters where a named entity does not exist.
|
1026 |
+
*/
|
1027 |
+
return \sprintf('&#x%04X;', \WPML\Core\twig_ord($chr));
|
1028 |
+
}
|
1029 |
+
// add multibyte extensions if possible
|
1030 |
+
if (\function_exists('mb_get_info')) {
|
1031 |
+
/**
|
1032 |
+
* Returns the length of a variable.
|
1033 |
+
*
|
1034 |
+
* @param mixed $thing A variable
|
1035 |
+
*
|
1036 |
+
* @return int The length of the value
|
1037 |
+
*/
|
1038 |
+
function twig_length_filter(\WPML\Core\Twig\Environment $env, $thing)
|
1039 |
+
{
|
1040 |
+
if (null === $thing) {
|
1041 |
+
return 0;
|
1042 |
+
}
|
1043 |
+
if (\is_scalar($thing)) {
|
1044 |
+
return \mb_strlen($thing, $env->getCharset());
|
1045 |
+
}
|
1046 |
+
if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) {
|
1047 |
+
return \count($thing);
|
1048 |
+
}
|
1049 |
+
if ($thing instanceof \Traversable) {
|
1050 |
+
return \iterator_count($thing);
|
1051 |
+
}
|
1052 |
+
if (\is_object($thing) && \method_exists($thing, '__toString')) {
|
1053 |
+
return \mb_strlen((string) $thing, $env->getCharset());
|
1054 |
+
}
|
1055 |
+
return 1;
|
1056 |
+
}
|
1057 |
+
/**
|
1058 |
+
* Converts a string to uppercase.
|
1059 |
+
*
|
1060 |
+
* @param string $string A string
|
1061 |
+
*
|
1062 |
+
* @return string The uppercased string
|
1063 |
+
*/
|
1064 |
+
function twig_upper_filter(\WPML\Core\Twig\Environment $env, $string)
|
1065 |
+
{
|
1066 |
+
if (null !== ($charset = $env->getCharset())) {
|
1067 |
+
return \mb_strtoupper($string, $charset);
|
1068 |
+
}
|
1069 |
+
return \strtoupper($string);
|
1070 |
+
}
|
1071 |
+
/**
|
1072 |
+
* Converts a string to lowercase.
|
1073 |
+
*
|
1074 |
+
* @param string $string A string
|
1075 |
+
*
|
1076 |
+
* @return string The lowercased string
|
1077 |
+
*/
|
1078 |
+
function twig_lower_filter(\WPML\Core\Twig\Environment $env, $string)
|
1079 |
+
{
|
1080 |
+
if (null !== ($charset = $env->getCharset())) {
|
1081 |
+
return \mb_strtolower($string, $charset);
|
1082 |
+
}
|
1083 |
+
return \strtolower($string);
|
1084 |
+
}
|
1085 |
+
/**
|
1086 |
+
* Returns a titlecased string.
|
1087 |
+
*
|
1088 |
+
* @param string $string A string
|
1089 |
+
*
|
1090 |
+
* @return string The titlecased string
|
1091 |
+
*/
|
1092 |
+
function twig_title_string_filter(\WPML\Core\Twig\Environment $env, $string)
|
1093 |
+
{
|
1094 |
+
if (null !== ($charset = $env->getCharset())) {
|
1095 |
+
return \mb_convert_case($string, \MB_CASE_TITLE, $charset);
|
1096 |
+
}
|
1097 |
+
return \ucwords(\strtolower($string));
|
1098 |
+
}
|
1099 |
+
/**
|
1100 |
+
* Returns a capitalized string.
|
1101 |
+
*
|
1102 |
+
* @param string $string A string
|
1103 |
+
*
|
1104 |
+
* @return string The capitalized string
|
1105 |
+
*/
|
1106 |
+
function twig_capitalize_string_filter(\WPML\Core\Twig\Environment $env, $string)
|
1107 |
+
{
|
1108 |
+
if (null !== ($charset = $env->getCharset())) {
|
1109 |
+
return \mb_strtoupper(\mb_substr($string, 0, 1, $charset), $charset) . \mb_strtolower(\mb_substr($string, 1, \mb_strlen($string, $charset), $charset), $charset);
|
1110 |
+
}
|
1111 |
+
return \ucfirst(\strtolower($string));
|
1112 |
+
}
|
1113 |
+
} else {
|
1114 |
+
/**
|
1115 |
+
* Returns the length of a variable.
|
1116 |
+
*
|
1117 |
+
* @param mixed $thing A variable
|
1118 |
+
*
|
1119 |
+
* @return int The length of the value
|
1120 |
+
*/
|
1121 |
+
function twig_length_filter(\WPML\Core\Twig\Environment $env, $thing)
|
1122 |
+
{
|
1123 |
+
if (null === $thing) {
|
1124 |
+
return 0;
|
1125 |
+
}
|
1126 |
+
if (\is_scalar($thing)) {
|
1127 |
+
return \strlen($thing);
|
1128 |
+
}
|
1129 |
+
if ($thing instanceof \SimpleXMLElement) {
|
1130 |
+
return \count($thing);
|
1131 |
+
}
|
1132 |
+
if (\is_object($thing) && \method_exists($thing, '__toString') && !$thing instanceof \Countable) {
|
1133 |
+
return \strlen((string) $thing);
|
1134 |
+
}
|
1135 |
+
if ($thing instanceof \Countable || \is_array($thing)) {
|
1136 |
+
return \count($thing);
|
1137 |
+
}
|
1138 |
+
if ($thing instanceof \IteratorAggregate) {
|
1139 |
+
return \iterator_count($thing);
|
1140 |
+
}
|
1141 |
+
return 1;
|
1142 |
+
}
|
1143 |
+
/**
|
1144 |
+
* Returns a titlecased string.
|
1145 |
+
*
|
1146 |
+
* @param string $string A string
|
1147 |
+
*
|
1148 |
+
* @return string The titlecased string
|
1149 |
+
*/
|
1150 |
+
function twig_title_string_filter(\WPML\Core\Twig\Environment $env, $string)
|
1151 |
+
{
|
1152 |
+
return \ucwords(\strtolower($string));
|
1153 |
+
}
|
1154 |
+
/**
|
1155 |
+
* Returns a capitalized string.
|
1156 |
+
*
|
1157 |
+
* @param string $string A string
|
1158 |
+
*
|
1159 |
+
* @return string The capitalized string
|
1160 |
+
*/
|
1161 |
+
function twig_capitalize_string_filter(\WPML\Core\Twig\Environment $env, $string)
|
1162 |
+
{
|
1163 |
+
return \ucfirst(\strtolower($string));
|
1164 |
+
}
|
1165 |
+
}
|
1166 |
+
/**
|
1167 |
+
* @internal
|
1168 |
+
*/
|
1169 |
+
function twig_ensure_traversable($seq)
|
1170 |
+
{
|
1171 |
+
if ($seq instanceof \Traversable || \is_array($seq)) {
|
1172 |
+
return $seq;
|
1173 |
+
}
|
1174 |
+
return [];
|
1175 |
+
}
|
1176 |
+
/**
|
1177 |
+
* @internal
|
1178 |
+
*/
|
1179 |
+
function twig_to_array($seq, $preserveKeys = \true)
|
1180 |
+
{
|
1181 |
+
if ($seq instanceof \Traversable) {
|
1182 |
+
return \iterator_to_array($seq, $preserveKeys);
|
1183 |
+
}
|
1184 |
+
if (!\is_array($seq)) {
|
1185 |
+
return $seq;
|
1186 |
+
}
|
1187 |
+
return $preserveKeys ? $seq : \array_values($seq);
|
1188 |
+
}
|
1189 |
+
/**
|
1190 |
+
* Checks if a variable is empty.
|
1191 |
+
*
|
1192 |
+
* {# evaluates to true if the foo variable is null, false, or the empty string #}
|
1193 |
+
* {% if foo is empty %}
|
1194 |
+
* {# ... #}
|
1195 |
+
* {% endif %}
|
1196 |
+
*
|
1197 |
+
* @param mixed $value A variable
|
1198 |
+
*
|
1199 |
+
* @return bool true if the value is empty, false otherwise
|
1200 |
+
*/
|
1201 |
+
function twig_test_empty($value)
|
1202 |
+
{
|
1203 |
+
if ($value instanceof \Countable) {
|
1204 |
+
return 0 == \count($value);
|
1205 |
+
}
|
1206 |
+
if ($value instanceof \Traversable) {
|
1207 |
+
return !\iterator_count($value);
|
1208 |
+
}
|
1209 |
+
if (\is_object($value) && \method_exists($value, '__toString')) {
|
1210 |
+
return '' === (string) $value;
|
1211 |
+
}
|
1212 |
+
return '' === $value || \false === $value || null === $value || [] === $value;
|
1213 |
+
}
|
1214 |
+
/**
|
1215 |
+
* Checks if a variable is traversable.
|
1216 |
+
*
|
1217 |
+
* {# evaluates to true if the foo variable is an array or a traversable object #}
|
1218 |
+
* {% if foo is iterable %}
|
1219 |
+
* {# ... #}
|
1220 |
+
* {% endif %}
|
1221 |
+
*
|
1222 |
+
* @param mixed $value A variable
|
1223 |
+
*
|
1224 |
+
* @return bool true if the value is traversable
|
1225 |
+
*/
|
1226 |
+
function twig_test_iterable($value)
|
1227 |
+
{
|
1228 |
+
return $value instanceof \Traversable || \is_array($value);
|
1229 |
+
}
|
1230 |
+
/**
|
1231 |
+
* Renders a template.
|
1232 |
+
*
|
1233 |
+
* @param array $context
|
1234 |
+
* @param string|array $template The template to render or an array of templates to try consecutively
|
1235 |
+
* @param array $variables The variables to pass to the template
|
1236 |
+
* @param bool $withContext
|
1237 |
+
* @param bool $ignoreMissing Whether to ignore missing templates or not
|
1238 |
+
* @param bool $sandboxed Whether to sandbox the template or not
|
1239 |
+
*
|
1240 |
+
* @return string The rendered template
|
1241 |
+
*/
|
1242 |
+
function twig_include(\WPML\Core\Twig\Environment $env, $context, $template, $variables = [], $withContext = \true, $ignoreMissing = \false, $sandboxed = \false)
|
1243 |
+
{
|
1244 |
+
$alreadySandboxed = \false;
|
1245 |
+
$sandbox = null;
|
1246 |
+
if ($withContext) {
|
1247 |
+
$variables = \array_merge($context, $variables);
|
1248 |
+
}
|
1249 |
+
if ($isSandboxed = $sandboxed && $env->hasExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')) {
|
1250 |
+
$sandbox = $env->getExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension');
|
1251 |
+
if (!($alreadySandboxed = $sandbox->isSandboxed())) {
|
1252 |
+
$sandbox->enableSandbox();
|
1253 |
+
}
|
1254 |
+
}
|
1255 |
+
$loaded = null;
|
1256 |
+
try {
|
1257 |
+
$loaded = $env->resolveTemplate($template);
|
1258 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
1259 |
+
if (!$ignoreMissing) {
|
1260 |
+
if ($isSandboxed && !$alreadySandboxed) {
|
1261 |
+
$sandbox->disableSandbox();
|
1262 |
+
}
|
1263 |
+
throw $e;
|
1264 |
+
}
|
1265 |
+
} catch (\Throwable $e) {
|
1266 |
+
if ($isSandboxed && !$alreadySandboxed) {
|
1267 |
+
$sandbox->disableSandbox();
|
1268 |
+
}
|
1269 |
+
throw $e;
|
1270 |
+
} catch (\Exception $e) {
|
1271 |
+
if ($isSandboxed && !$alreadySandboxed) {
|
1272 |
+
$sandbox->disableSandbox();
|
1273 |
+
}
|
1274 |
+
throw $e;
|
1275 |
+
}
|
1276 |
+
try {
|
1277 |
+
$ret = $loaded ? $loaded->render($variables) : '';
|
1278 |
+
} catch (\Exception $e) {
|
1279 |
+
if ($isSandboxed && !$alreadySandboxed) {
|
1280 |
+
$sandbox->disableSandbox();
|
1281 |
+
}
|
1282 |
+
throw $e;
|
1283 |
+
}
|
1284 |
+
if ($isSandboxed && !$alreadySandboxed) {
|
1285 |
+
$sandbox->disableSandbox();
|
1286 |
+
}
|
1287 |
+
return $ret;
|
1288 |
+
}
|
1289 |
+
/**
|
1290 |
+
* Returns a template content without rendering it.
|
1291 |
+
*
|
1292 |
+
* @param string $name The template name
|
1293 |
+
* @param bool $ignoreMissing Whether to ignore missing templates or not
|
1294 |
+
*
|
1295 |
+
* @return string The template source
|
1296 |
+
*/
|
1297 |
+
function twig_source(\WPML\Core\Twig\Environment $env, $name, $ignoreMissing = \false)
|
1298 |
+
{
|
1299 |
+
$loader = $env->getLoader();
|
1300 |
+
try {
|
1301 |
+
if (!$loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface) {
|
1302 |
+
return $loader->getSource($name);
|
1303 |
+
} else {
|
1304 |
+
return $loader->getSourceContext($name)->getCode();
|
1305 |
+
}
|
1306 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
1307 |
+
if (!$ignoreMissing) {
|
1308 |
+
throw $e;
|
1309 |
+
}
|
1310 |
+
}
|
1311 |
+
}
|
1312 |
+
/**
|
1313 |
+
* Provides the ability to get constants from instances as well as class/global constants.
|
1314 |
+
*
|
1315 |
+
* @param string $constant The name of the constant
|
1316 |
+
* @param object|null $object The object to get the constant from
|
1317 |
+
*
|
1318 |
+
* @return string
|
1319 |
+
*/
|
1320 |
+
function twig_constant($constant, $object = null)
|
1321 |
+
{
|
1322 |
+
if (null !== $object) {
|
1323 |
+
$constant = \get_class($object) . '::' . $constant;
|
1324 |
+
}
|
1325 |
+
return \constant($constant);
|
1326 |
+
}
|
1327 |
+
/**
|
1328 |
+
* Checks if a constant exists.
|
1329 |
+
*
|
1330 |
+
* @param string $constant The name of the constant
|
1331 |
+
* @param object|null $object The object to get the constant from
|
1332 |
+
*
|
1333 |
+
* @return bool
|
1334 |
+
*/
|
1335 |
+
function twig_constant_is_defined($constant, $object = null)
|
1336 |
+
{
|
1337 |
+
if (null !== $object) {
|
1338 |
+
$constant = \get_class($object) . '::' . $constant;
|
1339 |
+
}
|
1340 |
+
return \defined($constant);
|
1341 |
+
}
|
1342 |
+
/**
|
1343 |
+
* Batches item.
|
1344 |
+
*
|
1345 |
+
* @param array $items An array of items
|
1346 |
+
* @param int $size The size of the batch
|
1347 |
+
* @param mixed $fill A value used to fill missing items
|
1348 |
+
*
|
1349 |
+
* @return array
|
1350 |
+
*/
|
1351 |
+
function twig_array_batch($items, $size, $fill = null, $preserveKeys = \true)
|
1352 |
+
{
|
1353 |
+
if (!\WPML\Core\twig_test_iterable($items)) {
|
1354 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items)));
|
1355 |
+
}
|
1356 |
+
$size = \ceil($size);
|
1357 |
+
$result = \array_chunk(\WPML\Core\twig_to_array($items, $preserveKeys), $size, $preserveKeys);
|
1358 |
+
if (null !== $fill && $result) {
|
1359 |
+
$last = \count($result) - 1;
|
1360 |
+
if ($fillCount = $size - \count($result[$last])) {
|
1361 |
+
for ($i = 0; $i < $fillCount; ++$i) {
|
1362 |
+
$result[$last][] = $fill;
|
1363 |
+
}
|
1364 |
+
}
|
1365 |
+
}
|
1366 |
+
return $result;
|
1367 |
+
}
|
1368 |
+
function twig_array_filter($array, $arrow)
|
1369 |
+
{
|
1370 |
+
if (\is_array($array)) {
|
1371 |
+
if (\PHP_VERSION_ID >= 50600) {
|
1372 |
+
return \array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH);
|
1373 |
+
}
|
1374 |
+
return \array_filter($array, $arrow);
|
1375 |
+
}
|
1376 |
+
// the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator
|
1377 |
+
return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow);
|
1378 |
+
}
|
1379 |
+
function twig_array_map($array, $arrow)
|
1380 |
+
{
|
1381 |
+
$r = [];
|
1382 |
+
foreach ($array as $k => $v) {
|
1383 |
+
$r[$k] = $arrow($v, $k);
|
1384 |
+
}
|
1385 |
+
return $r;
|
1386 |
+
}
|
1387 |
+
function twig_array_reduce($array, $arrow, $initial = null)
|
1388 |
+
{
|
1389 |
+
if (!\is_array($array)) {
|
1390 |
+
$array = \iterator_to_array($array);
|
1391 |
+
}
|
1392 |
+
return \array_reduce($array, $arrow, $initial);
|
1393 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/DebugExtension.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\TwigFunction;
|
14 |
+
/**
|
15 |
+
* @final
|
16 |
+
*/
|
17 |
+
class DebugExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
18 |
+
{
|
19 |
+
public function getFunctions()
|
20 |
+
{
|
21 |
+
// dump is safe if var_dump is overridden by xdebug
|
22 |
+
$isDumpOutputHtmlSafe = \extension_loaded('xdebug') && (\false === \ini_get('xdebug.overload_var_dump') || \ini_get('xdebug.overload_var_dump')) && (\false === \ini_get('html_errors') || \ini_get('html_errors')) || 'cli' === \PHP_SAPI;
|
23 |
+
return [new \WPML\Core\Twig\TwigFunction('dump', '\WPML\Core\twig_var_dump', ['is_safe' => $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => \true, 'needs_environment' => \true, 'is_variadic' => \true])];
|
24 |
+
}
|
25 |
+
public function getName()
|
26 |
+
{
|
27 |
+
return 'debug';
|
28 |
+
}
|
29 |
+
}
|
30 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\DebugExtension', 'WPML\\Core\\Twig_Extension_Debug');
|
31 |
+
namespace WPML\Core;
|
32 |
+
|
33 |
+
use WPML\Core\Twig\Environment;
|
34 |
+
use WPML\Core\Twig\Template;
|
35 |
+
use WPML\Core\Twig\TemplateWrapper;
|
36 |
+
function twig_var_dump(\WPML\Core\Twig\Environment $env, $context, array $vars = [])
|
37 |
+
{
|
38 |
+
if (!$env->isDebug()) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
\ob_start();
|
42 |
+
if (!$vars) {
|
43 |
+
$vars = [];
|
44 |
+
foreach ($context as $key => $value) {
|
45 |
+
if (!$value instanceof \WPML\Core\Twig\Template && !$value instanceof \WPML\Core\Twig\TemplateWrapper) {
|
46 |
+
$vars[$key] = $value;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
\var_dump($vars);
|
50 |
+
} else {
|
51 |
+
foreach ($vars as $var) {
|
52 |
+
\var_dump($var);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
return \ob_get_clean();
|
56 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/EscaperExtension.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\NodeVisitor\EscaperNodeVisitor;
|
14 |
+
use WPML\Core\Twig\TokenParser\AutoEscapeTokenParser;
|
15 |
+
use WPML\Core\Twig\TwigFilter;
|
16 |
+
/**
|
17 |
+
* @final
|
18 |
+
*/
|
19 |
+
class EscaperExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
20 |
+
{
|
21 |
+
protected $defaultStrategy;
|
22 |
+
/**
|
23 |
+
* @param string|false|callable $defaultStrategy An escaping strategy
|
24 |
+
*
|
25 |
+
* @see setDefaultStrategy()
|
26 |
+
*/
|
27 |
+
public function __construct($defaultStrategy = 'html')
|
28 |
+
{
|
29 |
+
$this->setDefaultStrategy($defaultStrategy);
|
30 |
+
}
|
31 |
+
public function getTokenParsers()
|
32 |
+
{
|
33 |
+
return [new \WPML\Core\Twig\TokenParser\AutoEscapeTokenParser()];
|
34 |
+
}
|
35 |
+
public function getNodeVisitors()
|
36 |
+
{
|
37 |
+
return [new \WPML\Core\Twig\NodeVisitor\EscaperNodeVisitor()];
|
38 |
+
}
|
39 |
+
public function getFilters()
|
40 |
+
{
|
41 |
+
return [new \WPML\Core\Twig\TwigFilter('raw', 'twig_raw_filter', ['is_safe' => ['all']])];
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Sets the default strategy to use when not defined by the user.
|
45 |
+
*
|
46 |
+
* The strategy can be a valid PHP callback that takes the template
|
47 |
+
* name as an argument and returns the strategy to use.
|
48 |
+
*
|
49 |
+
* @param string|false|callable $defaultStrategy An escaping strategy
|
50 |
+
*/
|
51 |
+
public function setDefaultStrategy($defaultStrategy)
|
52 |
+
{
|
53 |
+
// for BC
|
54 |
+
if (\true === $defaultStrategy) {
|
55 |
+
@\trigger_error('Using "true" as the default strategy is deprecated since version 1.21. Use "html" instead.', \E_USER_DEPRECATED);
|
56 |
+
$defaultStrategy = 'html';
|
57 |
+
}
|
58 |
+
if ('filename' === $defaultStrategy) {
|
59 |
+
@\trigger_error('Using "filename" as the default strategy is deprecated since version 1.27. Use "name" instead.', \E_USER_DEPRECATED);
|
60 |
+
$defaultStrategy = 'name';
|
61 |
+
}
|
62 |
+
if ('name' === $defaultStrategy) {
|
63 |
+
$defaultStrategy = ['WPML\\Core\\Twig\\FileExtensionEscapingStrategy', 'guess'];
|
64 |
+
}
|
65 |
+
$this->defaultStrategy = $defaultStrategy;
|
66 |
+
}
|
67 |
+
/**
|
68 |
+
* Gets the default strategy to use when not defined by the user.
|
69 |
+
*
|
70 |
+
* @param string $name The template name
|
71 |
+
*
|
72 |
+
* @return string|false The default strategy to use for the template
|
73 |
+
*/
|
74 |
+
public function getDefaultStrategy($name)
|
75 |
+
{
|
76 |
+
// disable string callables to avoid calling a function named html or js,
|
77 |
+
// or any other upcoming escaping strategy
|
78 |
+
if (!\is_string($this->defaultStrategy) && \false !== $this->defaultStrategy) {
|
79 |
+
return \call_user_func($this->defaultStrategy, $name);
|
80 |
+
}
|
81 |
+
return $this->defaultStrategy;
|
82 |
+
}
|
83 |
+
public function getName()
|
84 |
+
{
|
85 |
+
return 'escaper';
|
86 |
+
}
|
87 |
+
}
|
88 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\EscaperExtension', 'WPML\\Core\\Twig_Extension_Escaper');
|
89 |
+
namespace WPML\Core;
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Marks a variable as being safe.
|
93 |
+
*
|
94 |
+
* @param string $string A PHP variable
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
function twig_raw_filter($string)
|
99 |
+
{
|
100 |
+
return $string;
|
101 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/ExtensionInterface.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
15 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
16 |
+
use WPML\Core\Twig\TwigFilter;
|
17 |
+
use WPML\Core\Twig\TwigFunction;
|
18 |
+
use WPML\Core\Twig\TwigTest;
|
19 |
+
/**
|
20 |
+
* Interface implemented by extension classes.
|
21 |
+
*
|
22 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
23 |
+
*/
|
24 |
+
interface ExtensionInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Initializes the runtime environment.
|
28 |
+
*
|
29 |
+
* This is where you can load some file that contains filter functions for instance.
|
30 |
+
*
|
31 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_InitRuntimeInterface instead
|
32 |
+
*/
|
33 |
+
public function initRuntime(\WPML\Core\Twig\Environment $environment);
|
34 |
+
/**
|
35 |
+
* Returns the token parser instances to add to the existing list.
|
36 |
+
*
|
37 |
+
* @return TokenParserInterface[]
|
38 |
+
*/
|
39 |
+
public function getTokenParsers();
|
40 |
+
/**
|
41 |
+
* Returns the node visitor instances to add to the existing list.
|
42 |
+
*
|
43 |
+
* @return NodeVisitorInterface[]
|
44 |
+
*/
|
45 |
+
public function getNodeVisitors();
|
46 |
+
/**
|
47 |
+
* Returns a list of filters to add to the existing list.
|
48 |
+
*
|
49 |
+
* @return TwigFilter[]
|
50 |
+
*/
|
51 |
+
public function getFilters();
|
52 |
+
/**
|
53 |
+
* Returns a list of tests to add to the existing list.
|
54 |
+
*
|
55 |
+
* @return TwigTest[]
|
56 |
+
*/
|
57 |
+
public function getTests();
|
58 |
+
/**
|
59 |
+
* Returns a list of functions to add to the existing list.
|
60 |
+
*
|
61 |
+
* @return TwigFunction[]
|
62 |
+
*/
|
63 |
+
public function getFunctions();
|
64 |
+
/**
|
65 |
+
* Returns a list of operators to add to the existing list.
|
66 |
+
*
|
67 |
+
* @return array<array> First array of unary operators, second array of binary operators
|
68 |
+
*/
|
69 |
+
public function getOperators();
|
70 |
+
/**
|
71 |
+
* Returns a list of global variables to add to the existing list.
|
72 |
+
*
|
73 |
+
* @return array An array of global variables
|
74 |
+
*
|
75 |
+
* @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_GlobalsInterface instead
|
76 |
+
*/
|
77 |
+
public function getGlobals();
|
78 |
+
/**
|
79 |
+
* Returns the name of the extension.
|
80 |
+
*
|
81 |
+
* @return string The extension name
|
82 |
+
*
|
83 |
+
* @deprecated since 1.26 (to be removed in 2.0), not used anymore internally
|
84 |
+
*/
|
85 |
+
public function getName();
|
86 |
+
}
|
87 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\ExtensionInterface', 'WPML\\Core\\Twig_ExtensionInterface');
|
88 |
+
// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
|
89 |
+
\class_exists('WPML\\Core\\Twig\\Environment');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/GlobalsInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Enables usage of the deprecated Twig\Extension\AbstractExtension::getGlobals() method.
|
15 |
+
*
|
16 |
+
* Explicitly implement this interface if you really need to implement the
|
17 |
+
* deprecated getGlobals() method in your extensions.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
interface GlobalsInterface
|
22 |
+
{
|
23 |
+
}
|
24 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\GlobalsInterface', 'WPML\\Core\\Twig_Extension_GlobalsInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/InitRuntimeInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Enables usage of the deprecated Twig\Extension\AbstractExtension::initRuntime() method.
|
15 |
+
*
|
16 |
+
* Explicitly implement this interface if you really need to implement the
|
17 |
+
* deprecated initRuntime() method in your extensions.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
interface InitRuntimeInterface
|
22 |
+
{
|
23 |
+
}
|
24 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\InitRuntimeInterface', 'WPML\\Core\\Twig_Extension_InitRuntimeInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/OptimizerExtension.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\NodeVisitor\OptimizerNodeVisitor;
|
14 |
+
/**
|
15 |
+
* @final
|
16 |
+
*/
|
17 |
+
class OptimizerExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
18 |
+
{
|
19 |
+
protected $optimizers;
|
20 |
+
public function __construct($optimizers = -1)
|
21 |
+
{
|
22 |
+
$this->optimizers = $optimizers;
|
23 |
+
}
|
24 |
+
public function getNodeVisitors()
|
25 |
+
{
|
26 |
+
return [new \WPML\Core\Twig\NodeVisitor\OptimizerNodeVisitor($this->optimizers)];
|
27 |
+
}
|
28 |
+
public function getName()
|
29 |
+
{
|
30 |
+
return 'optimizer';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\OptimizerExtension', 'WPML\\Core\\Twig_Extension_Optimizer');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/ProfilerExtension.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor;
|
14 |
+
use WPML\Core\Twig\Profiler\Profile;
|
15 |
+
class ProfilerExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
16 |
+
{
|
17 |
+
private $actives = [];
|
18 |
+
public function __construct(\WPML\Core\Twig\Profiler\Profile $profile)
|
19 |
+
{
|
20 |
+
$this->actives[] = $profile;
|
21 |
+
}
|
22 |
+
public function enter(\WPML\Core\Twig\Profiler\Profile $profile)
|
23 |
+
{
|
24 |
+
$this->actives[0]->addProfile($profile);
|
25 |
+
\array_unshift($this->actives, $profile);
|
26 |
+
}
|
27 |
+
public function leave(\WPML\Core\Twig\Profiler\Profile $profile)
|
28 |
+
{
|
29 |
+
$profile->leave();
|
30 |
+
\array_shift($this->actives);
|
31 |
+
if (1 === \count($this->actives)) {
|
32 |
+
$this->actives[0]->leave();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
public function getNodeVisitors()
|
36 |
+
{
|
37 |
+
return [new \WPML\Core\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor(\get_class($this))];
|
38 |
+
}
|
39 |
+
public function getName()
|
40 |
+
{
|
41 |
+
return 'profiler';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\ProfilerExtension', 'WPML\\Core\\Twig_Extension_Profiler');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/RuntimeExtensionInterface.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
15 |
+
*/
|
16 |
+
interface RuntimeExtensionInterface
|
17 |
+
{
|
18 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/SandboxExtension.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor;
|
14 |
+
use WPML\Core\Twig\Sandbox\SecurityPolicyInterface;
|
15 |
+
use WPML\Core\Twig\TokenParser\SandboxTokenParser;
|
16 |
+
/**
|
17 |
+
* @final
|
18 |
+
*/
|
19 |
+
class SandboxExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
20 |
+
{
|
21 |
+
protected $sandboxedGlobally;
|
22 |
+
protected $sandboxed;
|
23 |
+
protected $policy;
|
24 |
+
public function __construct(\WPML\Core\Twig\Sandbox\SecurityPolicyInterface $policy, $sandboxed = \false)
|
25 |
+
{
|
26 |
+
$this->policy = $policy;
|
27 |
+
$this->sandboxedGlobally = $sandboxed;
|
28 |
+
}
|
29 |
+
public function getTokenParsers()
|
30 |
+
{
|
31 |
+
return [new \WPML\Core\Twig\TokenParser\SandboxTokenParser()];
|
32 |
+
}
|
33 |
+
public function getNodeVisitors()
|
34 |
+
{
|
35 |
+
return [new \WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor()];
|
36 |
+
}
|
37 |
+
public function enableSandbox()
|
38 |
+
{
|
39 |
+
$this->sandboxed = \true;
|
40 |
+
}
|
41 |
+
public function disableSandbox()
|
42 |
+
{
|
43 |
+
$this->sandboxed = \false;
|
44 |
+
}
|
45 |
+
public function isSandboxed()
|
46 |
+
{
|
47 |
+
return $this->sandboxedGlobally || $this->sandboxed;
|
48 |
+
}
|
49 |
+
public function isSandboxedGlobally()
|
50 |
+
{
|
51 |
+
return $this->sandboxedGlobally;
|
52 |
+
}
|
53 |
+
public function setSecurityPolicy(\WPML\Core\Twig\Sandbox\SecurityPolicyInterface $policy)
|
54 |
+
{
|
55 |
+
$this->policy = $policy;
|
56 |
+
}
|
57 |
+
public function getSecurityPolicy()
|
58 |
+
{
|
59 |
+
return $this->policy;
|
60 |
+
}
|
61 |
+
public function checkSecurity($tags, $filters, $functions)
|
62 |
+
{
|
63 |
+
if ($this->isSandboxed()) {
|
64 |
+
$this->policy->checkSecurity($tags, $filters, $functions);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
public function checkMethodAllowed($obj, $method)
|
68 |
+
{
|
69 |
+
if ($this->isSandboxed()) {
|
70 |
+
$this->policy->checkMethodAllowed($obj, $method);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
public function checkPropertyAllowed($obj, $method)
|
74 |
+
{
|
75 |
+
if ($this->isSandboxed()) {
|
76 |
+
$this->policy->checkPropertyAllowed($obj, $method);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
public function ensureToStringAllowed($obj)
|
80 |
+
{
|
81 |
+
if ($this->isSandboxed() && \is_object($obj) && \method_exists($obj, '__toString')) {
|
82 |
+
$this->policy->checkMethodAllowed($obj, '__toString');
|
83 |
+
}
|
84 |
+
return $obj;
|
85 |
+
}
|
86 |
+
public function getName()
|
87 |
+
{
|
88 |
+
return 'sandbox';
|
89 |
+
}
|
90 |
+
}
|
91 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\SandboxExtension', 'WPML\\Core\\Twig_Extension_Sandbox');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/StagingExtension.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
14 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
15 |
+
/**
|
16 |
+
* Internal class.
|
17 |
+
*
|
18 |
+
* This class is used by \Twig\Environment as a staging area and must not be used directly.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*
|
22 |
+
* @internal
|
23 |
+
*/
|
24 |
+
class StagingExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
25 |
+
{
|
26 |
+
protected $functions = [];
|
27 |
+
protected $filters = [];
|
28 |
+
protected $visitors = [];
|
29 |
+
protected $tokenParsers = [];
|
30 |
+
protected $globals = [];
|
31 |
+
protected $tests = [];
|
32 |
+
public function addFunction($name, $function)
|
33 |
+
{
|
34 |
+
if (isset($this->functions[$name])) {
|
35 |
+
@\trigger_error(\sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), \E_USER_DEPRECATED);
|
36 |
+
}
|
37 |
+
$this->functions[$name] = $function;
|
38 |
+
}
|
39 |
+
public function getFunctions()
|
40 |
+
{
|
41 |
+
return $this->functions;
|
42 |
+
}
|
43 |
+
public function addFilter($name, $filter)
|
44 |
+
{
|
45 |
+
if (isset($this->filters[$name])) {
|
46 |
+
@\trigger_error(\sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), \E_USER_DEPRECATED);
|
47 |
+
}
|
48 |
+
$this->filters[$name] = $filter;
|
49 |
+
}
|
50 |
+
public function getFilters()
|
51 |
+
{
|
52 |
+
return $this->filters;
|
53 |
+
}
|
54 |
+
public function addNodeVisitor(\WPML\Core\Twig\NodeVisitor\NodeVisitorInterface $visitor)
|
55 |
+
{
|
56 |
+
$this->visitors[] = $visitor;
|
57 |
+
}
|
58 |
+
public function getNodeVisitors()
|
59 |
+
{
|
60 |
+
return $this->visitors;
|
61 |
+
}
|
62 |
+
public function addTokenParser(\WPML\Core\Twig\TokenParser\TokenParserInterface $parser)
|
63 |
+
{
|
64 |
+
if (isset($this->tokenParsers[$parser->getTag()])) {
|
65 |
+
@\trigger_error(\sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), \E_USER_DEPRECATED);
|
66 |
+
}
|
67 |
+
$this->tokenParsers[$parser->getTag()] = $parser;
|
68 |
+
}
|
69 |
+
public function getTokenParsers()
|
70 |
+
{
|
71 |
+
return $this->tokenParsers;
|
72 |
+
}
|
73 |
+
public function addGlobal($name, $value)
|
74 |
+
{
|
75 |
+
$this->globals[$name] = $value;
|
76 |
+
}
|
77 |
+
public function getGlobals()
|
78 |
+
{
|
79 |
+
return $this->globals;
|
80 |
+
}
|
81 |
+
public function addTest($name, $test)
|
82 |
+
{
|
83 |
+
if (isset($this->tests[$name])) {
|
84 |
+
@\trigger_error(\sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), \E_USER_DEPRECATED);
|
85 |
+
}
|
86 |
+
$this->tests[$name] = $test;
|
87 |
+
}
|
88 |
+
public function getTests()
|
89 |
+
{
|
90 |
+
return $this->tests;
|
91 |
+
}
|
92 |
+
public function getName()
|
93 |
+
{
|
94 |
+
return 'staging';
|
95 |
+
}
|
96 |
+
}
|
97 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\StagingExtension', 'WPML\\Core\\Twig_Extension_Staging');
|
addons/wpml-dependencies/lib/lib/twig/src/Extension/StringLoaderExtension.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Extension;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\TwigFunction;
|
14 |
+
/**
|
15 |
+
* @final
|
16 |
+
*/
|
17 |
+
class StringLoaderExtension extends \WPML\Core\Twig\Extension\AbstractExtension
|
18 |
+
{
|
19 |
+
public function getFunctions()
|
20 |
+
{
|
21 |
+
return [new \WPML\Core\Twig\TwigFunction('template_from_string', 'twig_template_from_string', ['needs_environment' => \true])];
|
22 |
+
}
|
23 |
+
public function getName()
|
24 |
+
{
|
25 |
+
return 'string_loader';
|
26 |
+
}
|
27 |
+
}
|
28 |
+
\class_alias('WPML\\Core\\Twig\\Extension\\StringLoaderExtension', 'WPML\\Core\\Twig_Extension_StringLoader');
|
29 |
+
namespace WPML\Core;
|
30 |
+
|
31 |
+
use WPML\Core\Twig\Environment;
|
32 |
+
use WPML\Core\Twig\TemplateWrapper;
|
33 |
+
/**
|
34 |
+
* Loads a template from a string.
|
35 |
+
*
|
36 |
+
* {{ include(template_from_string("Hello {{ name }}")) }}
|
37 |
+
*
|
38 |
+
* @param string $template A template as a string or object implementing __toString()
|
39 |
+
* @param string $name An optional name of the template to be used in error messages
|
40 |
+
*
|
41 |
+
* @return TemplateWrapper
|
42 |
+
*/
|
43 |
+
function twig_template_from_string(\WPML\Core\Twig\Environment $env, $template, $name = null)
|
44 |
+
{
|
45 |
+
return $env->createTemplate((string) $template, $name);
|
46 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/FileExtensionEscapingStrategy.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Default autoescaping strategy based on file names.
|
15 |
+
*
|
16 |
+
* This strategy sets the HTML as the default autoescaping strategy,
|
17 |
+
* but changes it based on the template name.
|
18 |
+
*
|
19 |
+
* Note that there is no runtime performance impact as the
|
20 |
+
* default autoescaping strategy is set at compilation time.
|
21 |
+
*
|
22 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
23 |
+
*/
|
24 |
+
class FileExtensionEscapingStrategy
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Guesses the best autoescaping strategy based on the file name.
|
28 |
+
*
|
29 |
+
* @param string $name The template name
|
30 |
+
*
|
31 |
+
* @return string|false The escaping strategy name to use or false to disable
|
32 |
+
*/
|
33 |
+
public static function guess($name)
|
34 |
+
{
|
35 |
+
if (\in_array(\substr($name, -1), ['/', '\\'])) {
|
36 |
+
return 'html';
|
37 |
+
// return html for directories
|
38 |
+
}
|
39 |
+
if ('.twig' === \substr($name, -5)) {
|
40 |
+
$name = \substr($name, 0, -5);
|
41 |
+
}
|
42 |
+
$extension = \pathinfo($name, \PATHINFO_EXTENSION);
|
43 |
+
switch ($extension) {
|
44 |
+
case 'js':
|
45 |
+
return 'js';
|
46 |
+
case 'css':
|
47 |
+
return 'css';
|
48 |
+
case 'txt':
|
49 |
+
return \false;
|
50 |
+
default:
|
51 |
+
return 'html';
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
\class_alias('WPML\\Core\\Twig\\FileExtensionEscapingStrategy', 'WPML\\Core\\Twig_FileExtensionEscapingStrategy');
|
addons/wpml-dependencies/lib/lib/twig/src/Lexer.php
ADDED
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
/**
|
16 |
+
* Lexes a template string.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class Lexer implements \WPML\Core\Twig_LexerInterface
|
21 |
+
{
|
22 |
+
protected $tokens;
|
23 |
+
protected $code;
|
24 |
+
protected $cursor;
|
25 |
+
protected $lineno;
|
26 |
+
protected $end;
|
27 |
+
protected $state;
|
28 |
+
protected $states;
|
29 |
+
protected $brackets;
|
30 |
+
protected $env;
|
31 |
+
// to be renamed to $name in 2.0 (where it is private)
|
32 |
+
protected $filename;
|
33 |
+
protected $options;
|
34 |
+
protected $regexes;
|
35 |
+
protected $position;
|
36 |
+
protected $positions;
|
37 |
+
protected $currentVarBlockLine;
|
38 |
+
private $source;
|
39 |
+
const STATE_DATA = 0;
|
40 |
+
const STATE_BLOCK = 1;
|
41 |
+
const STATE_VAR = 2;
|
42 |
+
const STATE_STRING = 3;
|
43 |
+
const STATE_INTERPOLATION = 4;
|
44 |
+
const REGEX_NAME = '/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A';
|
45 |
+
const REGEX_NUMBER = '/[0-9]+(?:\\.[0-9]+)?([Ee][\\+\\-][0-9]+)?/A';
|
46 |
+
const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As';
|
47 |
+
const REGEX_DQ_STRING_DELIM = '/"/A';
|
48 |
+
const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\\{))[^#"\\\\]*)*/As';
|
49 |
+
const PUNCTUATION = '()[]{}?:.,|';
|
50 |
+
public function __construct(\WPML\Core\Twig\Environment $env, array $options = [])
|
51 |
+
{
|
52 |
+
$this->env = $env;
|
53 |
+
$this->options = \array_merge(['tag_comment' => ['{#', '#}'], 'tag_block' => ['{%', '%}'], 'tag_variable' => ['{{', '}}'], 'whitespace_trim' => '-', 'whitespace_line_trim' => '~', 'whitespace_line_chars' => ' \\t\\0\\x0B', 'interpolation' => ['#{', '}']], $options);
|
54 |
+
// 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
|
55 |
+
$this->regexes = [
|
56 |
+
// }}
|
57 |
+
'lex_var' => '{
|
58 |
+
\\s*
|
59 |
+
(?:' . \preg_quote($this->options['whitespace_trim'] . $this->options['tag_variable'][1], '#') . '\\s*' . '|' . \preg_quote($this->options['whitespace_line_trim'] . $this->options['tag_variable'][1], '#') . '[' . $this->options['whitespace_line_chars'] . ']*' . '|' . \preg_quote($this->options['tag_variable'][1], '#') . ')
|
60 |
+
}Ax',
|
61 |
+
// %}
|
62 |
+
'lex_block' => '{
|
63 |
+
\\s*
|
64 |
+
(?:' . \preg_quote($this->options['whitespace_trim'] . $this->options['tag_block'][1], '#') . '\\s*\\n?' . '|' . \preg_quote($this->options['whitespace_line_trim'] . $this->options['tag_block'][1], '#') . '[' . $this->options['whitespace_line_chars'] . ']*' . '|' . \preg_quote($this->options['tag_block'][1], '#') . '\\n?' . ')
|
65 |
+
}Ax',
|
66 |
+
// {% endverbatim %}
|
67 |
+
'lex_raw_data' => '{' . \preg_quote($this->options['tag_block'][0], '#') . '(' . $this->options['whitespace_trim'] . '|' . $this->options['whitespace_line_trim'] . ')?\\s*' . '(?:end%s)' . '\\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'] . ']*' . '|' . \preg_quote($this->options['tag_block'][1], '#') . ')
|
68 |
+
}sx',
|
69 |
+
'operator' => $this->getOperatorRegex(),
|
70 |
+
// #}
|
71 |
+
'lex_comment' => '{
|
72 |
+
(?:' . \preg_quote($this->options['whitespace_trim']) . \preg_quote($this->options['tag_comment'][1], '#') . '\\s*\\n?' . '|' . \preg_quote($this->options['whitespace_line_trim'] . $this->options['tag_comment'][1], '#') . '[' . $this->options['whitespace_line_chars'] . ']*' . '|' . \preg_quote($this->options['tag_comment'][1], '#') . '\\n?' . ')
|
73 |
+
}sx',
|
74 |
+
// verbatim %}
|
75 |
+
'lex_block_raw' => '{
|
76 |
+
\\s*
|
77 |
+
(raw|verbatim)
|
78 |
+
\\s*
|
79 |
+
(?:' . \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'] . ']*' . '|' . \preg_quote($this->options['tag_block'][1], '#') . ')
|
80 |
+
}Asx',
|
81 |
+
'lex_block_line' => '{\\s*line\\s+(\\d+)\\s*' . \preg_quote($this->options['tag_block'][1], '#') . '}As',
|
82 |
+
// {{ or {% or {#
|
83 |
+
'lex_tokens_start' => '{
|
84 |
+
(' . \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'], '#') . ')?
|
85 |
+
}sx',
|
86 |
+
'interpolation_start' => '{' . \preg_quote($this->options['interpolation'][0], '#') . '\\s*}A',
|
87 |
+
'interpolation_end' => '{\\s*' . \preg_quote($this->options['interpolation'][1], '#') . '}A',
|
88 |
+
];
|
89 |
+
}
|
90 |
+
public function tokenize($code, $name = null)
|
91 |
+
{
|
92 |
+
if (!$code instanceof \WPML\Core\Twig\Source) {
|
93 |
+
@\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);
|
94 |
+
$this->source = new \WPML\Core\Twig\Source($code, $name);
|
95 |
+
} else {
|
96 |
+
$this->source = $code;
|
97 |
+
}
|
98 |
+
if ((int) \ini_get('mbstring.func_overload') & 2) {
|
99 |
+
@\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);
|
100 |
+
}
|
101 |
+
if (\function_exists('mb_internal_encoding') && (int) \ini_get('mbstring.func_overload') & 2) {
|
102 |
+
$mbEncoding = \mb_internal_encoding();
|
103 |
+
\mb_internal_encoding('ASCII');
|
104 |
+
} else {
|
105 |
+
$mbEncoding = null;
|
106 |
+
}
|
107 |
+
$this->code = \str_replace(["\r\n", "\r"], "\n", $this->source->getCode());
|
108 |
+
$this->filename = $this->source->getName();
|
109 |
+
$this->cursor = 0;
|
110 |
+
$this->lineno = 1;
|
111 |
+
$this->end = \strlen($this->code);
|
112 |
+
$this->tokens = [];
|
113 |
+
$this->state = self::STATE_DATA;
|
114 |
+
$this->states = [];
|
115 |
+
$this->brackets = [];
|
116 |
+
$this->position = -1;
|
117 |
+
// find all token starts in one go
|
118 |
+
\preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, \PREG_OFFSET_CAPTURE);
|
119 |
+
$this->positions = $matches;
|
120 |
+
while ($this->cursor < $this->end) {
|
121 |
+
// dispatch to the lexing functions depending
|
122 |
+
// on the current state
|
123 |
+
switch ($this->state) {
|
124 |
+
case self::STATE_DATA:
|
125 |
+
$this->lexData();
|
126 |
+
break;
|
127 |
+
case self::STATE_BLOCK:
|
128 |
+
$this->lexBlock();
|
129 |
+
break;
|
130 |
+
case self::STATE_VAR:
|
131 |
+
$this->lexVar();
|
132 |
+
break;
|
133 |
+
case self::STATE_STRING:
|
134 |
+
$this->lexString();
|
135 |
+
break;
|
136 |
+
case self::STATE_INTERPOLATION:
|
137 |
+
$this->lexInterpolation();
|
138 |
+
break;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
$this->pushToken(\WPML\Core\Twig\Token::EOF_TYPE);
|
142 |
+
if (!empty($this->brackets)) {
|
143 |
+
list($expect, $lineno) = \array_pop($this->brackets);
|
144 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
145 |
+
}
|
146 |
+
if ($mbEncoding) {
|
147 |
+
\mb_internal_encoding($mbEncoding);
|
148 |
+
}
|
149 |
+
return new \WPML\Core\Twig\TokenStream($this->tokens, $this->source);
|
150 |
+
}
|
151 |
+
protected function lexData()
|
152 |
+
{
|
153 |
+
// if no matches are left we return the rest of the template as simple text token
|
154 |
+
if ($this->position == \count($this->positions[0]) - 1) {
|
155 |
+
$this->pushToken(\WPML\Core\Twig\Token::TEXT_TYPE, \substr($this->code, $this->cursor));
|
156 |
+
$this->cursor = $this->end;
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
// Find the first token after the current cursor
|
160 |
+
$position = $this->positions[0][++$this->position];
|
161 |
+
while ($position[1] < $this->cursor) {
|
162 |
+
if ($this->position == \count($this->positions[0]) - 1) {
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
$position = $this->positions[0][++$this->position];
|
166 |
+
}
|
167 |
+
// push the template text first
|
168 |
+
$text = $textContent = \substr($this->code, $this->cursor, $position[1] - $this->cursor);
|
169 |
+
// trim?
|
170 |
+
if (isset($this->positions[2][$this->position][0])) {
|
171 |
+
if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) {
|
172 |
+
// whitespace_trim detected ({%-, {{- or {#-)
|
173 |
+
$text = \rtrim($text);
|
174 |
+
} elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) {
|
175 |
+
// whitespace_line_trim detected ({%~, {{~ or {#~)
|
176 |
+
// don't trim \r and \n
|
177 |
+
$text = \rtrim($text, " \t\0\v");
|
178 |
+
}
|
179 |
+
}
|
180 |
+
$this->pushToken(\WPML\Core\Twig\Token::TEXT_TYPE, $text);
|
181 |
+
$this->moveCursor($textContent . $position[0]);
|
182 |
+
switch ($this->positions[1][$this->position][0]) {
|
183 |
+
case $this->options['tag_comment'][0]:
|
184 |
+
$this->lexComment();
|
185 |
+
break;
|
186 |
+
case $this->options['tag_block'][0]:
|
187 |
+
// raw data?
|
188 |
+
if (\preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) {
|
189 |
+
$this->moveCursor($match[0]);
|
190 |
+
$this->lexRawData($match[1]);
|
191 |
+
// {% line \d+ %}
|
192 |
+
} elseif (\preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) {
|
193 |
+
$this->moveCursor($match[0]);
|
194 |
+
$this->lineno = (int) $match[1];
|
195 |
+
} else {
|
196 |
+
$this->pushToken(\WPML\Core\Twig\Token::BLOCK_START_TYPE);
|
197 |
+
$this->pushState(self::STATE_BLOCK);
|
198 |
+
$this->currentVarBlockLine = $this->lineno;
|
199 |
+
}
|
200 |
+
break;
|
201 |
+
case $this->options['tag_variable'][0]:
|
202 |
+
$this->pushToken(\WPML\Core\Twig\Token::VAR_START_TYPE);
|
203 |
+
$this->pushState(self::STATE_VAR);
|
204 |
+
$this->currentVarBlockLine = $this->lineno;
|
205 |
+
break;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
protected function lexBlock()
|
209 |
+
{
|
210 |
+
if (empty($this->brackets) && \preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) {
|
211 |
+
$this->pushToken(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
212 |
+
$this->moveCursor($match[0]);
|
213 |
+
$this->popState();
|
214 |
+
} else {
|
215 |
+
$this->lexExpression();
|
216 |
+
}
|
217 |
+
}
|
218 |
+
protected function lexVar()
|
219 |
+
{
|
220 |
+
if (empty($this->brackets) && \preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) {
|
221 |
+
$this->pushToken(\WPML\Core\Twig\Token::VAR_END_TYPE);
|
222 |
+
$this->moveCursor($match[0]);
|
223 |
+
$this->popState();
|
224 |
+
} else {
|
225 |
+
$this->lexExpression();
|
226 |
+
}
|
227 |
+
}
|
228 |
+
protected function lexExpression()
|
229 |
+
{
|
230 |
+
// whitespace
|
231 |
+
if (\preg_match('/\\s+/A', $this->code, $match, 0, $this->cursor)) {
|
232 |
+
$this->moveCursor($match[0]);
|
233 |
+
if ($this->cursor >= $this->end) {
|
234 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source);
|
235 |
+
}
|
236 |
+
}
|
237 |
+
// arrow function
|
238 |
+
if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) {
|
239 |
+
$this->pushToken(\WPML\Core\Twig\Token::ARROW_TYPE, '=>');
|
240 |
+
$this->moveCursor('=>');
|
241 |
+
} elseif (\preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) {
|
242 |
+
$this->pushToken(\WPML\Core\Twig\Token::OPERATOR_TYPE, \preg_replace('/\\s+/', ' ', $match[0]));
|
243 |
+
$this->moveCursor($match[0]);
|
244 |
+
} elseif (\preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) {
|
245 |
+
$this->pushToken(\WPML\Core\Twig\Token::NAME_TYPE, $match[0]);
|
246 |
+
$this->moveCursor($match[0]);
|
247 |
+
} elseif (\preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) {
|
248 |
+
$number = (float) $match[0];
|
249 |
+
// floats
|
250 |
+
if (\ctype_digit($match[0]) && $number <= \PHP_INT_MAX) {
|
251 |
+
$number = (int) $match[0];
|
252 |
+
// integers lower than the maximum
|
253 |
+
}
|
254 |
+
$this->pushToken(\WPML\Core\Twig\Token::NUMBER_TYPE, $number);
|
255 |
+
$this->moveCursor($match[0]);
|
256 |
+
} elseif (\false !== \strpos(self::PUNCTUATION, $this->code[$this->cursor])) {
|
257 |
+
// opening bracket
|
258 |
+
if (\false !== \strpos('([{', $this->code[$this->cursor])) {
|
259 |
+
$this->brackets[] = [$this->code[$this->cursor], $this->lineno];
|
260 |
+
} elseif (\false !== \strpos(')]}', $this->code[$this->cursor])) {
|
261 |
+
if (empty($this->brackets)) {
|
262 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
|
263 |
+
}
|
264 |
+
list($expect, $lineno) = \array_pop($this->brackets);
|
265 |
+
if ($this->code[$this->cursor] != \strtr($expect, '([{', ')]}')) {
|
266 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
$this->pushToken(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, $this->code[$this->cursor]);
|
270 |
+
++$this->cursor;
|
271 |
+
} elseif (\preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) {
|
272 |
+
$this->pushToken(\WPML\Core\Twig\Token::STRING_TYPE, \stripcslashes(\substr($match[0], 1, -1)));
|
273 |
+
$this->moveCursor($match[0]);
|
274 |
+
} elseif (\preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
|
275 |
+
$this->brackets[] = ['"', $this->lineno];
|
276 |
+
$this->pushState(self::STATE_STRING);
|
277 |
+
$this->moveCursor($match[0]);
|
278 |
+
} else {
|
279 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
|
280 |
+
}
|
281 |
+
}
|
282 |
+
protected function lexRawData($tag)
|
283 |
+
{
|
284 |
+
if ('raw' === $tag) {
|
285 |
+
@\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);
|
286 |
+
}
|
287 |
+
if (!\preg_match(\str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) {
|
288 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source);
|
289 |
+
}
|
290 |
+
$text = \substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
|
291 |
+
$this->moveCursor($text . $match[0][0]);
|
292 |
+
// trim?
|
293 |
+
if (isset($match[1][0])) {
|
294 |
+
if ($this->options['whitespace_trim'] === $match[1][0]) {
|
295 |
+
// whitespace_trim detected ({%-, {{- or {#-)
|
296 |
+
$text = \rtrim($text);
|
297 |
+
} else {
|
298 |
+
// whitespace_line_trim detected ({%~, {{~ or {#~)
|
299 |
+
// don't trim \r and \n
|
300 |
+
$text = \rtrim($text, " \t\0\v");
|
301 |
+
}
|
302 |
+
}
|
303 |
+
$this->pushToken(\WPML\Core\Twig\Token::TEXT_TYPE, $text);
|
304 |
+
}
|
305 |
+
protected function lexComment()
|
306 |
+
{
|
307 |
+
if (!\preg_match($this->regexes['lex_comment'], $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) {
|
308 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('Unclosed comment.', $this->lineno, $this->source);
|
309 |
+
}
|
310 |
+
$this->moveCursor(\substr($this->code, $this->cursor, $match[0][1] - $this->cursor) . $match[0][0]);
|
311 |
+
}
|
312 |
+
protected function lexString()
|
313 |
+
{
|
314 |
+
if (\preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) {
|
315 |
+
$this->brackets[] = [$this->options['interpolation'][0], $this->lineno];
|
316 |
+
$this->pushToken(\WPML\Core\Twig\Token::INTERPOLATION_START_TYPE);
|
317 |
+
$this->moveCursor($match[0]);
|
318 |
+
$this->pushState(self::STATE_INTERPOLATION);
|
319 |
+
} elseif (\preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) {
|
320 |
+
$this->pushToken(\WPML\Core\Twig\Token::STRING_TYPE, \stripcslashes($match[0]));
|
321 |
+
$this->moveCursor($match[0]);
|
322 |
+
} elseif (\preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
|
323 |
+
list($expect, $lineno) = \array_pop($this->brackets);
|
324 |
+
if ('"' != $this->code[$this->cursor]) {
|
325 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
|
326 |
+
}
|
327 |
+
$this->popState();
|
328 |
+
++$this->cursor;
|
329 |
+
} else {
|
330 |
+
// unlexable
|
331 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
|
332 |
+
}
|
333 |
+
}
|
334 |
+
protected function lexInterpolation()
|
335 |
+
{
|
336 |
+
$bracket = \end($this->brackets);
|
337 |
+
if ($this->options['interpolation'][0] === $bracket[0] && \preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) {
|
338 |
+
\array_pop($this->brackets);
|
339 |
+
$this->pushToken(\WPML\Core\Twig\Token::INTERPOLATION_END_TYPE);
|
340 |
+
$this->moveCursor($match[0]);
|
341 |
+
$this->popState();
|
342 |
+
} else {
|
343 |
+
$this->lexExpression();
|
344 |
+
}
|
345 |
+
}
|
346 |
+
protected function pushToken($type, $value = '')
|
347 |
+
{
|
348 |
+
// do not push empty text tokens
|
349 |
+
if (\WPML\Core\Twig\Token::TEXT_TYPE === $type && '' === $value) {
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
$this->tokens[] = new \WPML\Core\Twig\Token($type, $value, $this->lineno);
|
353 |
+
}
|
354 |
+
protected function moveCursor($text)
|
355 |
+
{
|
356 |
+
$this->cursor += \strlen($text);
|
357 |
+
$this->lineno += \substr_count($text, "\n");
|
358 |
+
}
|
359 |
+
protected function getOperatorRegex()
|
360 |
+
{
|
361 |
+
$operators = \array_merge(['='], \array_keys($this->env->getUnaryOperators()), \array_keys($this->env->getBinaryOperators()));
|
362 |
+
$operators = \array_combine($operators, \array_map('strlen', $operators));
|
363 |
+
\arsort($operators);
|
364 |
+
$regex = [];
|
365 |
+
foreach ($operators as $operator => $length) {
|
366 |
+
// an operator that ends with a character must be followed by
|
367 |
+
// a whitespace or a parenthesis
|
368 |
+
if (\ctype_alpha($operator[$length - 1])) {
|
369 |
+
$r = \preg_quote($operator, '/') . '(?=[\\s()])';
|
370 |
+
} else {
|
371 |
+
$r = \preg_quote($operator, '/');
|
372 |
+
}
|
373 |
+
// an operator with a space can be any amount of whitespaces
|
374 |
+
$r = \preg_replace('/\\s+/', '\\s+', $r);
|
375 |
+
$regex[] = $r;
|
376 |
+
}
|
377 |
+
return '/' . \implode('|', $regex) . '/A';
|
378 |
+
}
|
379 |
+
protected function pushState($state)
|
380 |
+
{
|
381 |
+
$this->states[] = $this->state;
|
382 |
+
$this->state = $state;
|
383 |
+
}
|
384 |
+
protected function popState()
|
385 |
+
{
|
386 |
+
if (0 === \count($this->states)) {
|
387 |
+
throw new \LogicException('Cannot pop state without a previous state.');
|
388 |
+
}
|
389 |
+
$this->state = \array_pop($this->states);
|
390 |
+
}
|
391 |
+
}
|
392 |
+
\class_alias('WPML\\Core\\Twig\\Lexer', 'WPML\\Core\\Twig_Lexer');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/ArrayLoader.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\LoaderError;
|
14 |
+
use WPML\Core\Twig\Source;
|
15 |
+
/**
|
16 |
+
* Loads a template from an array.
|
17 |
+
*
|
18 |
+
* When using this loader with a cache mechanism, you should know that a new cache
|
19 |
+
* key is generated each time a template content "changes" (the cache key being the
|
20 |
+
* source code of the template). If you don't want to see your cache grows out of
|
21 |
+
* control, you need to take care of clearing the old cache file by yourself.
|
22 |
+
*
|
23 |
+
* This loader should only be used for unit testing.
|
24 |
+
*
|
25 |
+
* @final
|
26 |
+
*
|
27 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
28 |
+
*/
|
29 |
+
class ArrayLoader implements \WPML\Core\Twig\Loader\LoaderInterface, \WPML\Core\Twig\Loader\ExistsLoaderInterface, \WPML\Core\Twig\Loader\SourceContextLoaderInterface
|
30 |
+
{
|
31 |
+
protected $templates = [];
|
32 |
+
/**
|
33 |
+
* @param array $templates An array of templates (keys are the names, and values are the source code)
|
34 |
+
*/
|
35 |
+
public function __construct(array $templates = [])
|
36 |
+
{
|
37 |
+
$this->templates = $templates;
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* Adds or overrides a template.
|
41 |
+
*
|
42 |
+
* @param string $name The template name
|
43 |
+
* @param string $template The template source
|
44 |
+
*/
|
45 |
+
public function setTemplate($name, $template)
|
46 |
+
{
|
47 |
+
$this->templates[(string) $name] = $template;
|
48 |
+
}
|
49 |
+
public function getSource($name)
|
50 |
+
{
|
51 |
+
@\trigger_error(\sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), \E_USER_DEPRECATED);
|
52 |
+
$name = (string) $name;
|
53 |
+
if (!isset($this->templates[$name])) {
|
54 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
|
55 |
+
}
|
56 |
+
return $this->templates[$name];
|
57 |
+
}
|
58 |
+
public function getSourceContext($name)
|
59 |
+
{
|
60 |
+
$name = (string) $name;
|
61 |
+
if (!isset($this->templates[$name])) {
|
62 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
|
63 |
+
}
|
64 |
+
return new \WPML\Core\Twig\Source($this->templates[$name], $name);
|
65 |
+
}
|
66 |
+
public function exists($name)
|
67 |
+
{
|
68 |
+
return isset($this->templates[(string) $name]);
|
69 |
+
}
|
70 |
+
public function getCacheKey($name)
|
71 |
+
{
|
72 |
+
$name = (string) $name;
|
73 |
+
if (!isset($this->templates[$name])) {
|
74 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
|
75 |
+
}
|
76 |
+
return $name . ':' . $this->templates[$name];
|
77 |
+
}
|
78 |
+
public function isFresh($name, $time)
|
79 |
+
{
|
80 |
+
$name = (string) $name;
|
81 |
+
if (!isset($this->templates[$name])) {
|
82 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
|
83 |
+
}
|
84 |
+
return \true;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\ArrayLoader', 'WPML\\Core\\Twig_Loader_Array');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/ChainLoader.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\LoaderError;
|
14 |
+
use WPML\Core\Twig\Source;
|
15 |
+
/**
|
16 |
+
* Loads templates from other loaders.
|
17 |
+
*
|
18 |
+
* @final
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class ChainLoader implements \WPML\Core\Twig\Loader\LoaderInterface, \WPML\Core\Twig\Loader\ExistsLoaderInterface, \WPML\Core\Twig\Loader\SourceContextLoaderInterface
|
23 |
+
{
|
24 |
+
private $hasSourceCache = [];
|
25 |
+
protected $loaders = [];
|
26 |
+
/**
|
27 |
+
* @param LoaderInterface[] $loaders
|
28 |
+
*/
|
29 |
+
public function __construct(array $loaders = [])
|
30 |
+
{
|
31 |
+
foreach ($loaders as $loader) {
|
32 |
+
$this->addLoader($loader);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
public function addLoader(\WPML\Core\Twig\Loader\LoaderInterface $loader)
|
36 |
+
{
|
37 |
+
$this->loaders[] = $loader;
|
38 |
+
$this->hasSourceCache = [];
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* @return LoaderInterface[]
|
42 |
+
*/
|
43 |
+
public function getLoaders()
|
44 |
+
{
|
45 |
+
return $this->loaders;
|
46 |
+
}
|
47 |
+
public function getSource($name)
|
48 |
+
{
|
49 |
+
@\trigger_error(\sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), \E_USER_DEPRECATED);
|
50 |
+
$exceptions = [];
|
51 |
+
foreach ($this->loaders as $loader) {
|
52 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\ExistsLoaderInterface && !$loader->exists($name)) {
|
53 |
+
continue;
|
54 |
+
}
|
55 |
+
try {
|
56 |
+
return $loader->getSource($name);
|
57 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
58 |
+
$exceptions[] = $e->getMessage();
|
59 |
+
}
|
60 |
+
}
|
61 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : ''));
|
62 |
+
}
|
63 |
+
public function getSourceContext($name)
|
64 |
+
{
|
65 |
+
$exceptions = [];
|
66 |
+
foreach ($this->loaders as $loader) {
|
67 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\ExistsLoaderInterface && !$loader->exists($name)) {
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
try {
|
71 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface) {
|
72 |
+
return $loader->getSourceContext($name);
|
73 |
+
}
|
74 |
+
return new \WPML\Core\Twig\Source($loader->getSource($name), $name);
|
75 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
76 |
+
$exceptions[] = $e->getMessage();
|
77 |
+
}
|
78 |
+
}
|
79 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : ''));
|
80 |
+
}
|
81 |
+
public function exists($name)
|
82 |
+
{
|
83 |
+
$name = (string) $name;
|
84 |
+
if (isset($this->hasSourceCache[$name])) {
|
85 |
+
return $this->hasSourceCache[$name];
|
86 |
+
}
|
87 |
+
foreach ($this->loaders as $loader) {
|
88 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\ExistsLoaderInterface) {
|
89 |
+
if ($loader->exists($name)) {
|
90 |
+
return $this->hasSourceCache[$name] = \true;
|
91 |
+
}
|
92 |
+
continue;
|
93 |
+
}
|
94 |
+
try {
|
95 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface) {
|
96 |
+
$loader->getSourceContext($name);
|
97 |
+
} else {
|
98 |
+
$loader->getSource($name);
|
99 |
+
}
|
100 |
+
return $this->hasSourceCache[$name] = \true;
|
101 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
102 |
+
}
|
103 |
+
}
|
104 |
+
return $this->hasSourceCache[$name] = \false;
|
105 |
+
}
|
106 |
+
public function getCacheKey($name)
|
107 |
+
{
|
108 |
+
$exceptions = [];
|
109 |
+
foreach ($this->loaders as $loader) {
|
110 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\ExistsLoaderInterface && !$loader->exists($name)) {
|
111 |
+
continue;
|
112 |
+
}
|
113 |
+
try {
|
114 |
+
return $loader->getCacheKey($name);
|
115 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
116 |
+
$exceptions[] = \get_class($loader) . ': ' . $e->getMessage();
|
117 |
+
}
|
118 |
+
}
|
119 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : ''));
|
120 |
+
}
|
121 |
+
public function isFresh($name, $time)
|
122 |
+
{
|
123 |
+
$exceptions = [];
|
124 |
+
foreach ($this->loaders as $loader) {
|
125 |
+
if ($loader instanceof \WPML\Core\Twig\Loader\ExistsLoaderInterface && !$loader->exists($name)) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
try {
|
129 |
+
return $loader->isFresh($name, $time);
|
130 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
131 |
+
$exceptions[] = \get_class($loader) . ': ' . $e->getMessage();
|
132 |
+
}
|
133 |
+
}
|
134 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : ''));
|
135 |
+
}
|
136 |
+
}
|
137 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\ChainLoader', 'WPML\\Core\\Twig_Loader_Chain');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/ExistsLoaderInterface.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Adds an exists() method for loaders.
|
15 |
+
*
|
16 |
+
* @author Florin Patan <florinpatan@gmail.com>
|
17 |
+
*
|
18 |
+
* @deprecated since 1.12 (to be removed in 3.0)
|
19 |
+
*/
|
20 |
+
interface ExistsLoaderInterface
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Check if we have the source code of a template, given its name.
|
24 |
+
*
|
25 |
+
* @param string $name The name of the template to check if we can load
|
26 |
+
*
|
27 |
+
* @return bool If the template source code is handled by this loader or not
|
28 |
+
*/
|
29 |
+
public function exists($name);
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\ExistsLoaderInterface', 'WPML\\Core\\Twig_ExistsLoaderInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/FilesystemLoader.php
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\LoaderError;
|
14 |
+
use WPML\Core\Twig\Source;
|
15 |
+
/**
|
16 |
+
* Loads template from the filesystem.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class FilesystemLoader implements \WPML\Core\Twig\Loader\LoaderInterface, \WPML\Core\Twig\Loader\ExistsLoaderInterface, \WPML\Core\Twig\Loader\SourceContextLoaderInterface
|
21 |
+
{
|
22 |
+
/** Identifier of the main namespace. */
|
23 |
+
const MAIN_NAMESPACE = '__main__';
|
24 |
+
protected $paths = [];
|
25 |
+
protected $cache = [];
|
26 |
+
protected $errorCache = [];
|
27 |
+
private $rootPath;
|
28 |
+
/**
|
29 |
+
* @param string|array $paths A path or an array of paths where to look for templates
|
30 |
+
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
|
31 |
+
*/
|
32 |
+
public function __construct($paths = [], $rootPath = null)
|
33 |
+
{
|
34 |
+
$this->rootPath = (null === $rootPath ? \getcwd() : $rootPath) . \DIRECTORY_SEPARATOR;
|
35 |
+
if (\false !== ($realPath = \realpath($rootPath))) {
|
36 |
+
$this->rootPath = $realPath . \DIRECTORY_SEPARATOR;
|
37 |
+
}
|
38 |
+
if ($paths) {
|
39 |
+
$this->setPaths($paths);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* Returns the paths to the templates.
|
44 |
+
*
|
45 |
+
* @param string $namespace A path namespace
|
46 |
+
*
|
47 |
+
* @return array The array of paths where to look for templates
|
48 |
+
*/
|
49 |
+
public function getPaths($namespace = self::MAIN_NAMESPACE)
|
50 |
+
{
|
51 |
+
return isset($this->paths[$namespace]) ? $this->paths[$namespace] : [];
|
52 |
+
}
|
53 |
+
/**
|
54 |
+
* Returns the path namespaces.
|
55 |
+
*
|
56 |
+
* The main namespace is always defined.
|
57 |
+
*
|
58 |
+
* @return array The array of defined namespaces
|
59 |
+
*/
|
60 |
+
public function getNamespaces()
|
61 |
+
{
|
62 |
+
return \array_keys($this->paths);
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* Sets the paths where templates are stored.
|
66 |
+
*
|
67 |
+
* @param string|array $paths A path or an array of paths where to look for templates
|
68 |
+
* @param string $namespace A path namespace
|
69 |
+
*/
|
70 |
+
public function setPaths($paths, $namespace = self::MAIN_NAMESPACE)
|
71 |
+
{
|
72 |
+
if (!\is_array($paths)) {
|
73 |
+
$paths = [$paths];
|
74 |
+
}
|
75 |
+
$this->paths[$namespace] = [];
|
76 |
+
foreach ($paths as $path) {
|
77 |
+
$this->addPath($path, $namespace);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
/**
|
81 |
+
* Adds a path where templates are stored.
|
82 |
+
*
|
83 |
+
* @param string $path A path where to look for templates
|
84 |
+
* @param string $namespace A path namespace
|
85 |
+
*
|
86 |
+
* @throws LoaderError
|
87 |
+
*/
|
88 |
+
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
|
89 |
+
{
|
90 |
+
// invalidate the cache
|
91 |
+
$this->cache = $this->errorCache = [];
|
92 |
+
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath . $path;
|
93 |
+
if (!\is_dir($checkPath)) {
|
94 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
|
95 |
+
}
|
96 |
+
$this->paths[$namespace][] = \rtrim($path, '/\\');
|
97 |
+
}
|
98 |
+
/**
|
99 |
+
* Prepends a path where templates are stored.
|
100 |
+
*
|
101 |
+
* @param string $path A path where to look for templates
|
102 |
+
* @param string $namespace A path namespace
|
103 |
+
*
|
104 |
+
* @throws LoaderError
|
105 |
+
*/
|
106 |
+
public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
|
107 |
+
{
|
108 |
+
// invalidate the cache
|
109 |
+
$this->cache = $this->errorCache = [];
|
110 |
+
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath . $path;
|
111 |
+
if (!\is_dir($checkPath)) {
|
112 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
|
113 |
+
}
|
114 |
+
$path = \rtrim($path, '/\\');
|
115 |
+
if (!isset($this->paths[$namespace])) {
|
116 |
+
$this->paths[$namespace][] = $path;
|
117 |
+
} else {
|
118 |
+
\array_unshift($this->paths[$namespace], $path);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
public function getSource($name)
|
122 |
+
{
|
123 |
+
@\trigger_error(\sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), \E_USER_DEPRECATED);
|
124 |
+
if (null === ($path = $this->findTemplate($name)) || \false === $path) {
|
125 |
+
return '';
|
126 |
+
}
|
127 |
+
return \file_get_contents($path);
|
128 |
+
}
|
129 |
+
public function getSourceContext($name)
|
130 |
+
{
|
131 |
+
if (null === ($path = $this->findTemplate($name)) || \false === $path) {
|
132 |
+
return new \WPML\Core\Twig\Source('', $name, '');
|
133 |
+
}
|
134 |
+
return new \WPML\Core\Twig\Source(\file_get_contents($path), $name, $path);
|
135 |
+
}
|
136 |
+
public function getCacheKey($name)
|
137 |
+
{
|
138 |
+
if (null === ($path = $this->findTemplate($name)) || \false === $path) {
|
139 |
+
return '';
|
140 |
+
}
|
141 |
+
$len = \strlen($this->rootPath);
|
142 |
+
if (0 === \strncmp($this->rootPath, $path, $len)) {
|
143 |
+
return \substr($path, $len);
|
144 |
+
}
|
145 |
+
return $path;
|
146 |
+
}
|
147 |
+
public function exists($name)
|
148 |
+
{
|
149 |
+
$name = $this->normalizeName($name);
|
150 |
+
if (isset($this->cache[$name])) {
|
151 |
+
return \true;
|
152 |
+
}
|
153 |
+
try {
|
154 |
+
return null !== ($path = $this->findTemplate($name, \false)) && \false !== $path;
|
155 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
156 |
+
@\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);
|
157 |
+
return \false;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
public function isFresh($name, $time)
|
161 |
+
{
|
162 |
+
// false support to be removed in 3.0
|
163 |
+
if (null === ($path = $this->findTemplate($name)) || \false === $path) {
|
164 |
+
return \false;
|
165 |
+
}
|
166 |
+
return \filemtime($path) < $time;
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* Checks if the template can be found.
|
170 |
+
*
|
171 |
+
* @param string $name The template name
|
172 |
+
*
|
173 |
+
* @return string|false|null The template name or false/null
|
174 |
+
*/
|
175 |
+
protected function findTemplate($name)
|
176 |
+
{
|
177 |
+
$throw = \func_num_args() > 1 ? \func_get_arg(1) : \true;
|
178 |
+
$name = $this->normalizeName($name);
|
179 |
+
if (isset($this->cache[$name])) {
|
180 |
+
return $this->cache[$name];
|
181 |
+
}
|
182 |
+
if (isset($this->errorCache[$name])) {
|
183 |
+
if (!$throw) {
|
184 |
+
return \false;
|
185 |
+
}
|
186 |
+
throw new \WPML\Core\Twig\Error\LoaderError($this->errorCache[$name]);
|
187 |
+
}
|
188 |
+
try {
|
189 |
+
$this->validateName($name);
|
190 |
+
list($namespace, $shortname) = $this->parseName($name);
|
191 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
192 |
+
if (!$throw) {
|
193 |
+
return \false;
|
194 |
+
}
|
195 |
+
throw $e;
|
196 |
+
}
|
197 |
+
if (!isset($this->paths[$namespace])) {
|
198 |
+
$this->errorCache[$name] = \sprintf('There are no registered paths for namespace "%s".', $namespace);
|
199 |
+
if (!$throw) {
|
200 |
+
return \false;
|
201 |
+
}
|
202 |
+
throw new \WPML\Core\Twig\Error\LoaderError($this->errorCache[$name]);
|
203 |
+
}
|
204 |
+
foreach ($this->paths[$namespace] as $path) {
|
205 |
+
if (!$this->isAbsolutePath($path)) {
|
206 |
+
$path = $this->rootPath . $path;
|
207 |
+
}
|
208 |
+
if (\is_file($path . '/' . $shortname)) {
|
209 |
+
if (\false !== ($realpath = \realpath($path . '/' . $shortname))) {
|
210 |
+
return $this->cache[$name] = $realpath;
|
211 |
+
}
|
212 |
+
return $this->cache[$name] = $path . '/' . $shortname;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
$this->errorCache[$name] = \sprintf('Unable to find template "%s" (looked into: %s).', $name, \implode(', ', $this->paths[$namespace]));
|
216 |
+
if (!$throw) {
|
217 |
+
return \false;
|
218 |
+
}
|
219 |
+
throw new \WPML\Core\Twig\Error\LoaderError($this->errorCache[$name]);
|
220 |
+
}
|
221 |
+
protected function parseName($name, $default = self::MAIN_NAMESPACE)
|
222 |
+
{
|
223 |
+
if (isset($name[0]) && '@' == $name[0]) {
|
224 |
+
if (\false === ($pos = \strpos($name, '/'))) {
|
225 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name));
|
226 |
+
}
|
227 |
+
$namespace = \substr($name, 1, $pos - 1);
|
228 |
+
$shortname = \substr($name, $pos + 1);
|
229 |
+
return [$namespace, $shortname];
|
230 |
+
}
|
231 |
+
return [$default, $name];
|
232 |
+
}
|
233 |
+
protected function normalizeName($name)
|
234 |
+
{
|
235 |
+
return \preg_replace('#/{2,}#', '/', \str_replace('\\', '/', (string) $name));
|
236 |
+
}
|
237 |
+
protected function validateName($name)
|
238 |
+
{
|
239 |
+
if (\false !== \strpos($name, "\0")) {
|
240 |
+
throw new \WPML\Core\Twig\Error\LoaderError('A template name cannot contain NUL bytes.');
|
241 |
+
}
|
242 |
+
$name = \ltrim($name, '/');
|
243 |
+
$parts = \explode('/', $name);
|
244 |
+
$level = 0;
|
245 |
+
foreach ($parts as $part) {
|
246 |
+
if ('..' === $part) {
|
247 |
+
--$level;
|
248 |
+
} elseif ('.' !== $part) {
|
249 |
+
++$level;
|
250 |
+
}
|
251 |
+
if ($level < 0) {
|
252 |
+
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Looks like you try to load a template outside configured directories (%s).', $name));
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
private function isAbsolutePath($file)
|
257 |
+
{
|
258 |
+
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);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\FilesystemLoader', 'WPML\\Core\\Twig_Loader_Filesystem');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/LoaderInterface.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\LoaderError;
|
14 |
+
/**
|
15 |
+
* Interface all loaders must implement.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
interface LoaderInterface
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Gets the source code of a template, given its name.
|
23 |
+
*
|
24 |
+
* @param string $name The name of the template to load
|
25 |
+
*
|
26 |
+
* @return string The template source code
|
27 |
+
*
|
28 |
+
* @throws LoaderError When $name is not found
|
29 |
+
*
|
30 |
+
* @deprecated since 1.27 (to be removed in 2.0), implement Twig\Loader\SourceContextLoaderInterface
|
31 |
+
*/
|
32 |
+
public function getSource($name);
|
33 |
+
/**
|
34 |
+
* Gets the cache key to use for the cache for a given template name.
|
35 |
+
*
|
36 |
+
* @param string $name The name of the template to load
|
37 |
+
*
|
38 |
+
* @return string The cache key
|
39 |
+
*
|
40 |
+
* @throws LoaderError When $name is not found
|
41 |
+
*/
|
42 |
+
public function getCacheKey($name);
|
43 |
+
/**
|
44 |
+
* Returns true if the template is still fresh.
|
45 |
+
*
|
46 |
+
* @param string $name The template name
|
47 |
+
* @param int $time Timestamp of the last modification time of the
|
48 |
+
* cached template
|
49 |
+
*
|
50 |
+
* @return bool true if the template is fresh, false otherwise
|
51 |
+
*
|
52 |
+
* @throws LoaderError When $name is not found
|
53 |
+
*/
|
54 |
+
public function isFresh($name, $time);
|
55 |
+
}
|
56 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\LoaderInterface', 'WPML\\Core\\Twig_LoaderInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Loader/SourceContextLoaderInterface.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Loader;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\LoaderError;
|
14 |
+
use WPML\Core\Twig\Source;
|
15 |
+
/**
|
16 |
+
* Adds a getSourceContext() method for loaders.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*
|
20 |
+
* @deprecated since 1.27 (to be removed in 3.0)
|
21 |
+
*/
|
22 |
+
interface SourceContextLoaderInterface
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Returns the source context for a given template logical name.
|
26 |
+
*
|
27 |
+
* @param string $name The template logical name
|
28 |
+
*
|
29 |
+
* @return Source
|
30 |
+
*
|
31 |
+
* @throws LoaderError When $name is not found
|
32 |
+
*/
|
33 |
+
public function getSourceContext($name);
|
34 |
+
}
|
35 |
+
\class_alias('WPML\\Core\\Twig\\Loader\\SourceContextLoaderInterface', 'WPML\\Core\\Twig_SourceContextLoaderInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Markup.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Marks a content as safe.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
class Markup implements \Countable
|
19 |
+
{
|
20 |
+
protected $content;
|
21 |
+
protected $charset;
|
22 |
+
public function __construct($content, $charset)
|
23 |
+
{
|
24 |
+
$this->content = (string) $content;
|
25 |
+
$this->charset = $charset;
|
26 |
+
}
|
27 |
+
public function __toString()
|
28 |
+
{
|
29 |
+
return $this->content;
|
30 |
+
}
|
31 |
+
public function count()
|
32 |
+
{
|
33 |
+
return \function_exists('mb_get_info') ? \mb_strlen($this->content, $this->charset) : \strlen($this->content);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
\class_alias('WPML\\Core\\Twig\\Markup', 'WPML\\Core\\Twig_Markup');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/AutoEscapeNode.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents an autoescape node.
|
16 |
+
*
|
17 |
+
* The value is the escaping strategy (can be html, js, ...)
|
18 |
+
*
|
19 |
+
* The true value is equivalent to html.
|
20 |
+
*
|
21 |
+
* If autoescaping is disabled, then the value is false.
|
22 |
+
*
|
23 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
24 |
+
*/
|
25 |
+
class AutoEscapeNode extends \WPML\Core\Twig\Node\Node
|
26 |
+
{
|
27 |
+
public function __construct($value, \WPML\Core\Twig_NodeInterface $body, $lineno, $tag = 'autoescape')
|
28 |
+
{
|
29 |
+
parent::__construct(['body' => $body], ['value' => $value], $lineno, $tag);
|
30 |
+
}
|
31 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
32 |
+
{
|
33 |
+
$compiler->subcompile($this->getNode('body'));
|
34 |
+
}
|
35 |
+
}
|
36 |
+
\class_alias('WPML\\Core\\Twig\\Node\\AutoEscapeNode', 'WPML\\Core\\Twig_Node_AutoEscape');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/BlockNode.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
/**
|
16 |
+
* Represents a block node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class BlockNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
public function __construct($name, \WPML\Core\Twig_NodeInterface $body, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct(['body' => $body], ['name' => $name], $lineno, $tag);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->addDebugInfo($this)->write(\sprintf("public function block_%s(\$context, array \$blocks = [])\n", $this->getAttribute('name')), "{\n")->indent();
|
29 |
+
$compiler->subcompile($this->getNode('body'))->outdent()->write("}\n\n");
|
30 |
+
}
|
31 |
+
}
|
32 |
+
\class_alias('WPML\\Core\\Twig\\Node\\BlockNode', 'WPML\\Core\\Twig_Node_Block');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/BlockReferenceNode.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
/**
|
16 |
+
* Represents a block call node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class BlockReferenceNode extends \WPML\Core\Twig\Node\Node implements \WPML\Core\Twig\Node\NodeOutputInterface
|
21 |
+
{
|
22 |
+
public function __construct($name, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct([], ['name' => $name], $lineno, $tag);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->addDebugInfo($this)->write(\sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name')));
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Node\\BlockReferenceNode', 'WPML\\Core\\Twig_Node_BlockReference');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/BodyNode.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Represents a body node.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
class BodyNode extends \WPML\Core\Twig\Node\Node
|
19 |
+
{
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\BodyNode', 'WPML\\Core\\Twig_Node_Body');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/CheckSecurityNode.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
+
*/
|
17 |
+
class CheckSecurityNode extends \WPML\Core\Twig\Node\Node
|
18 |
+
{
|
19 |
+
protected $usedFilters;
|
20 |
+
protected $usedTags;
|
21 |
+
protected $usedFunctions;
|
22 |
+
public function __construct(array $usedFilters, array $usedTags, array $usedFunctions)
|
23 |
+
{
|
24 |
+
$this->usedFilters = $usedFilters;
|
25 |
+
$this->usedTags = $usedTags;
|
26 |
+
$this->usedFunctions = $usedFunctions;
|
27 |
+
parent::__construct();
|
28 |
+
}
|
29 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
30 |
+
{
|
31 |
+
$tags = $filters = $functions = [];
|
32 |
+
foreach (['tags', 'filters', 'functions'] as $type) {
|
33 |
+
foreach ($this->{'used' . \ucfirst($type)} as $name => $node) {
|
34 |
+
if ($node instanceof \WPML\Core\Twig\Node\Node) {
|
35 |
+
${$type}[$name] = $node->getTemplateLine();
|
36 |
+
} else {
|
37 |
+
${$type}[$node] = null;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
$compiler->write("\$this->sandbox = \$this->env->getExtension('\\WPML\\Core\\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->getSourceContext());\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");
|
42 |
+
}
|
43 |
+
}
|
44 |
+
\class_alias('WPML\\Core\\Twig\\Node\\CheckSecurityNode', 'WPML\\Core\\Twig_Node_CheckSecurity');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/CheckToStringNode.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
/**
|
16 |
+
* Checks if casting an expression to __toString() is allowed by the sandbox.
|
17 |
+
*
|
18 |
+
* For instance, when there is a simple Print statement, like {{ article }},
|
19 |
+
* and if the sandbox is enabled, we need to check that the __toString()
|
20 |
+
* method is allowed if 'article' is an object. The same goes for {{ article|upper }}
|
21 |
+
* or {{ random(article) }}
|
22 |
+
*
|
23 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
24 |
+
*/
|
25 |
+
class CheckToStringNode extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
26 |
+
{
|
27 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr)
|
28 |
+
{
|
29 |
+
parent::__construct(['expr' => $expr], [], $expr->getTemplateLine(), $expr->getNodeTag());
|
30 |
+
}
|
31 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
32 |
+
{
|
33 |
+
$compiler->raw('$this->sandbox->ensureToStringAllowed(')->subcompile($this->getNode('expr'))->raw(')');
|
34 |
+
}
|
35 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Node/DeprecatedNode.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
16 |
+
/**
|
17 |
+
* Represents a deprecated node.
|
18 |
+
*
|
19 |
+
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
20 |
+
*/
|
21 |
+
class DeprecatedNode extends \WPML\Core\Twig\Node\Node
|
22 |
+
{
|
23 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null)
|
24 |
+
{
|
25 |
+
parent::__construct(['expr' => $expr], [], $lineno, $tag);
|
26 |
+
}
|
27 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
28 |
+
{
|
29 |
+
$compiler->addDebugInfo($this);
|
30 |
+
$expr = $this->getNode('expr');
|
31 |
+
if ($expr instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
32 |
+
$compiler->write('@trigger_error(')->subcompile($expr);
|
33 |
+
} else {
|
34 |
+
$varName = $compiler->getVarName();
|
35 |
+
$compiler->write(\sprintf('$%s = ', $varName))->subcompile($expr)->raw(";\n")->write(\sprintf('@trigger_error($%s', $varName));
|
36 |
+
}
|
37 |
+
$compiler->raw('.')->string(\sprintf(' ("%s" at line %d).', $this->getTemplateName(), $this->getTemplateLine()))->raw(", E_USER_DEPRECATED);\n");
|
38 |
+
}
|
39 |
+
}
|
40 |
+
\class_alias('WPML\\Core\\Twig\\Node\\DeprecatedNode', 'WPML\\Core\\Twig_Node_Deprecated');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/DoNode.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
/**
|
16 |
+
* Represents a do node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class DoNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct(['expr' => $expr], [], $lineno, $tag);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->addDebugInfo($this)->write('')->subcompile($this->getNode('expr'))->raw(";\n");
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Node\\DoNode', 'WPML\\Core\\Twig_Node_Do');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/EmbedNode.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
16 |
+
/**
|
17 |
+
* Represents an embed node.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class EmbedNode extends \WPML\Core\Twig\Node\IncludeNode
|
22 |
+
{
|
23 |
+
// we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module)
|
24 |
+
public function __construct($name, $index, \WPML\Core\Twig\Node\Expression\AbstractExpression $variables = null, $only = \false, $ignoreMissing = \false, $lineno, $tag = null)
|
25 |
+
{
|
26 |
+
parent::__construct(new \WPML\Core\Twig\Node\Expression\ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag);
|
27 |
+
$this->setAttribute('name', $name);
|
28 |
+
// to be removed in 2.0, used name instead
|
29 |
+
$this->setAttribute('filename', $name);
|
30 |
+
$this->setAttribute('index', $index);
|
31 |
+
}
|
32 |
+
protected function addGetTemplate(\WPML\Core\Twig\Compiler $compiler)
|
33 |
+
{
|
34 |
+
$compiler->write('$this->loadTemplate(')->string($this->getAttribute('name'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(', ')->string($this->getAttribute('index'))->raw(')');
|
35 |
+
}
|
36 |
+
}
|
37 |
+
\class_alias('WPML\\Core\\Twig\\Node\\EmbedNode', 'WPML\\Core\\Twig_Node_Embed');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AbstractExpression.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Abstract class for all nodes that represents an expression.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
abstract class AbstractExpression extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
}
|
23 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\AbstractExpression', 'WPML\\Core\\Twig_Node_Expression');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrayExpression.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class ArrayExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
15 |
+
{
|
16 |
+
protected $index;
|
17 |
+
public function __construct(array $elements, $lineno)
|
18 |
+
{
|
19 |
+
parent::__construct($elements, [], $lineno);
|
20 |
+
$this->index = -1;
|
21 |
+
foreach ($this->getKeyValuePairs() as $pair) {
|
22 |
+
if ($pair['key'] instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression && \ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) {
|
23 |
+
$this->index = $pair['key']->getAttribute('value');
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
public function getKeyValuePairs()
|
28 |
+
{
|
29 |
+
$pairs = [];
|
30 |
+
foreach (\array_chunk($this->nodes, 2) as $pair) {
|
31 |
+
$pairs[] = ['key' => $pair[0], 'value' => $pair[1]];
|
32 |
+
}
|
33 |
+
return $pairs;
|
34 |
+
}
|
35 |
+
public function hasElement(\WPML\Core\Twig\Node\Expression\AbstractExpression $key)
|
36 |
+
{
|
37 |
+
foreach ($this->getKeyValuePairs() as $pair) {
|
38 |
+
// we compare the string representation of the keys
|
39 |
+
// to avoid comparing the line numbers which are not relevant here.
|
40 |
+
if ((string) $key === (string) $pair['key']) {
|
41 |
+
return \true;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
return \false;
|
45 |
+
}
|
46 |
+
public function addElement(\WPML\Core\Twig\Node\Expression\AbstractExpression $value, \WPML\Core\Twig\Node\Expression\AbstractExpression $key = null)
|
47 |
+
{
|
48 |
+
if (null === $key) {
|
49 |
+
$key = new \WPML\Core\Twig\Node\Expression\ConstantExpression(++$this->index, $value->getTemplateLine());
|
50 |
+
}
|
51 |
+
\array_push($this->nodes, $key, $value);
|
52 |
+
}
|
53 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
54 |
+
{
|
55 |
+
$compiler->raw('[');
|
56 |
+
$first = \true;
|
57 |
+
foreach ($this->getKeyValuePairs() as $pair) {
|
58 |
+
if (!$first) {
|
59 |
+
$compiler->raw(', ');
|
60 |
+
}
|
61 |
+
$first = \false;
|
62 |
+
$compiler->subcompile($pair['key'])->raw(' => ')->subcompile($pair['value']);
|
63 |
+
}
|
64 |
+
$compiler->raw(']');
|
65 |
+
}
|
66 |
+
}
|
67 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\ArrayExpression', 'WPML\\Core\\Twig_Node_Expression_Array');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrowFunctionExpression.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Represents an arrow function.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class ArrowFunctionExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
21 |
+
{
|
22 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr, \WPML\Core\Twig\Node\Node $names, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno, $tag);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->addDebugInfo($this)->raw('function (');
|
29 |
+
foreach ($this->getNode('names') as $i => $name) {
|
30 |
+
if ($i) {
|
31 |
+
$compiler->raw(', ');
|
32 |
+
}
|
33 |
+
$compiler->raw('$__')->raw($name->getAttribute('name'))->raw('__');
|
34 |
+
}
|
35 |
+
$compiler->raw(') use ($context) { ');
|
36 |
+
foreach ($this->getNode('names') as $name) {
|
37 |
+
$compiler->raw('$context["')->raw($name->getAttribute('name'))->raw('"] = $__')->raw($name->getAttribute('name'))->raw('__; ');
|
38 |
+
}
|
39 |
+
$compiler->raw('return ')->subcompile($this->getNode('expr'))->raw('; }');
|
40 |
+
}
|
41 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AssignNameExpression.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class AssignNameExpression extends \WPML\Core\Twig\Node\Expression\NameExpression
|
16 |
+
{
|
17 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
$compiler->raw('$context[')->string($this->getAttribute('name'))->raw(']');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\AssignNameExpression', 'WPML\\Core\\Twig_Node_Expression_AssignName');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AbstractBinary.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
abstract class AbstractBinary extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
17 |
+
{
|
18 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $left, \WPML\Core\Twig_NodeInterface $right, $lineno)
|
19 |
+
{
|
20 |
+
parent::__construct(['left' => $left, 'right' => $right], [], $lineno);
|
21 |
+
}
|
22 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
$compiler->raw('(')->subcompile($this->getNode('left'))->raw(' ');
|
25 |
+
$this->operator($compiler);
|
26 |
+
$compiler->raw(' ')->subcompile($this->getNode('right'))->raw(')');
|
27 |
+
}
|
28 |
+
public abstract function operator(\WPML\Core\Twig\Compiler $compiler);
|
29 |
+
}
|
30 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AbstractBinary', 'WPML\\Core\\Twig_Node_Expression_Binary');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AddBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class AddBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('+');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AddBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Add');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AndBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class AndBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('&&');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\AndBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_And');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseAndBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class BitwiseAndBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('&');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseAnd');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseOrBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class BitwiseOrBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('|');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseOr');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseXorBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class BitwiseXorBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('^');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_BitwiseXor');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ConcatBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class ConcatBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('.');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\ConcatBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Concat');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/DivBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class DivBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('/');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\DivBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Div');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EndsWithBinary.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class EndsWithBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$left = $compiler->getVarName();
|
19 |
+
$right = $compiler->getVarName();
|
20 |
+
$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));
|
21 |
+
}
|
22 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
return $compiler->raw('');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\EndsWithBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_EndsWith');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EqualBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class EqualBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('==');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\EqualBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Equal');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/FloorDivBinary.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class FloorDivBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$compiler->raw('(int) floor(');
|
19 |
+
parent::compile($compiler);
|
20 |
+
$compiler->raw(')');
|
21 |
+
}
|
22 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
return $compiler->raw('/');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\FloorDivBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_FloorDiv');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class GreaterBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('>');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Greater');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterEqualBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class GreaterEqualBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('>=');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_GreaterEqual');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/InBinary.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class InBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$compiler->raw('twig_in_filter(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')');
|
19 |
+
}
|
20 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
return $compiler->raw('in');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\InBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_In');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class LessBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('<');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Less');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessEqualBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class LessEqualBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('<=');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\LessEqualBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_LessEqual');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MatchesBinary.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class MatchesBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$compiler->raw('preg_match(')->subcompile($this->getNode('right'))->raw(', ')->subcompile($this->getNode('left'))->raw(')');
|
19 |
+
}
|
20 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
return $compiler->raw('');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\MatchesBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Matches');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ModBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class ModBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('%');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\ModBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Mod');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MulBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class MulBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('*');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\MulBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Mul');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotEqualBinary.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class NotEqualBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
return $compiler->raw('!=');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotEqualBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_NotEqual');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotInBinary.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class NotInBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$compiler->raw('!twig_in_filter(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')');
|
19 |
+
}
|
20 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
return $compiler->raw('not in');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\NotInBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_NotIn');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/OrBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class OrBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('||');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\OrBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Or');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/PowerBinary.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class PowerBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
if (\PHP_VERSION_ID >= 50600) {
|
19 |
+
return parent::compile($compiler);
|
20 |
+
}
|
21 |
+
$compiler->raw('pow(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')');
|
22 |
+
}
|
23 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
24 |
+
{
|
25 |
+
return $compiler->raw('**');
|
26 |
+
}
|
27 |
+
}
|
28 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\PowerBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Power');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/RangeBinary.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class RangeBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$compiler->raw('range(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')');
|
19 |
+
}
|
20 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
return $compiler->raw('..');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\RangeBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Range');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/StartsWithBinary.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class StartsWithBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
15 |
+
{
|
16 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
17 |
+
{
|
18 |
+
$left = $compiler->getVarName();
|
19 |
+
$right = $compiler->getVarName();
|
20 |
+
$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));
|
21 |
+
}
|
22 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
return $compiler->raw('');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\StartsWithBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_StartsWith');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/SubBinary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Binary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class SubBinary extends \WPML\Core\Twig\Node\Expression\Binary\AbstractBinary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
return $compiler->raw('-');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Binary\\SubBinary', 'WPML\\Core\\Twig_Node_Expression_Binary_Sub');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/BlockReferenceExpression.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Node;
|
16 |
+
/**
|
17 |
+
* Represents a block call node.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class BlockReferenceExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* @param Node|null $template
|
25 |
+
*/
|
26 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $name, $template = null, $lineno, $tag = null)
|
27 |
+
{
|
28 |
+
if (\is_bool($template)) {
|
29 |
+
@\trigger_error(\sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
30 |
+
$template = null;
|
31 |
+
}
|
32 |
+
$nodes = ['name' => $name];
|
33 |
+
if (null !== $template) {
|
34 |
+
$nodes['template'] = $template;
|
35 |
+
}
|
36 |
+
parent::__construct($nodes, ['is_defined_test' => \false, 'output' => \false], $lineno, $tag);
|
37 |
+
}
|
38 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
39 |
+
{
|
40 |
+
if ($this->getAttribute('is_defined_test')) {
|
41 |
+
$this->compileTemplateCall($compiler, 'hasBlock');
|
42 |
+
} else {
|
43 |
+
if ($this->getAttribute('output')) {
|
44 |
+
$compiler->addDebugInfo($this);
|
45 |
+
$this->compileTemplateCall($compiler, 'displayBlock')->raw(";\n");
|
46 |
+
} else {
|
47 |
+
$this->compileTemplateCall($compiler, 'renderBlock');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
private function compileTemplateCall(\WPML\Core\Twig\Compiler $compiler, $method)
|
52 |
+
{
|
53 |
+
if (!$this->hasNode('template')) {
|
54 |
+
$compiler->write('$this');
|
55 |
+
} else {
|
56 |
+
$compiler->write('$this->loadTemplate(')->subcompile($this->getNode('template'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')');
|
57 |
+
}
|
58 |
+
$compiler->raw(\sprintf('->%s', $method));
|
59 |
+
$this->compileBlockArguments($compiler);
|
60 |
+
return $compiler;
|
61 |
+
}
|
62 |
+
private function compileBlockArguments(\WPML\Core\Twig\Compiler $compiler)
|
63 |
+
{
|
64 |
+
$compiler->raw('(')->subcompile($this->getNode('name'))->raw(', $context');
|
65 |
+
if (!$this->hasNode('template')) {
|
66 |
+
$compiler->raw(', $blocks');
|
67 |
+
}
|
68 |
+
return $compiler->raw(')');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\BlockReferenceExpression', 'WPML\\Core\\Twig_Node_Expression_BlockReference');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/CallExpression.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
use WPML\Core\Twig\Extension\ExtensionInterface;
|
16 |
+
use WPML\Core\Twig\Node\Node;
|
17 |
+
abstract class CallExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
18 |
+
{
|
19 |
+
private $reflector;
|
20 |
+
protected function compileCallable(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
$closingParenthesis = \false;
|
23 |
+
$isArray = \false;
|
24 |
+
if ($this->hasAttribute('callable') && ($callable = $this->getAttribute('callable'))) {
|
25 |
+
if (\is_string($callable) && \false === \strpos($callable, '::')) {
|
26 |
+
$compiler->raw($callable);
|
27 |
+
} else {
|
28 |
+
list($r, $callable) = $this->reflectCallable($callable);
|
29 |
+
if ($r instanceof \ReflectionMethod && \is_string($callable[0])) {
|
30 |
+
if ($r->isStatic()) {
|
31 |
+
$compiler->raw(\sprintf('%s::%s', $callable[0], $callable[1]));
|
32 |
+
} else {
|
33 |
+
$compiler->raw(\sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
|
34 |
+
}
|
35 |
+
} elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof \WPML\Core\Twig\Extension\ExtensionInterface) {
|
36 |
+
$compiler->raw(\sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($callable[0]), $callable[1]));
|
37 |
+
} else {
|
38 |
+
$type = \ucfirst($this->getAttribute('type'));
|
39 |
+
$compiler->raw(\sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', $type, $this->getAttribute('name')));
|
40 |
+
$closingParenthesis = \true;
|
41 |
+
$isArray = \true;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
} else {
|
45 |
+
$compiler->raw($this->getAttribute('thing')->compile());
|
46 |
+
}
|
47 |
+
$this->compileArguments($compiler, $isArray);
|
48 |
+
if ($closingParenthesis) {
|
49 |
+
$compiler->raw(')');
|
50 |
+
}
|
51 |
+
}
|
52 |
+
protected function compileArguments(\WPML\Core\Twig\Compiler $compiler, $isArray = \false)
|
53 |
+
{
|
54 |
+
$compiler->raw($isArray ? '[' : '(');
|
55 |
+
$first = \true;
|
56 |
+
if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) {
|
57 |
+
$compiler->raw('$this->env');
|
58 |
+
$first = \false;
|
59 |
+
}
|
60 |
+
if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) {
|
61 |
+
if (!$first) {
|
62 |
+
$compiler->raw(', ');
|
63 |
+
}
|
64 |
+
$compiler->raw('$context');
|
65 |
+
$first = \false;
|
66 |
+
}
|
67 |
+
if ($this->hasAttribute('arguments')) {
|
68 |
+
foreach ($this->getAttribute('arguments') as $argument) {
|
69 |
+
if (!$first) {
|
70 |
+
$compiler->raw(', ');
|
71 |
+
}
|
72 |
+
$compiler->string($argument);
|
73 |
+
$first = \false;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
if ($this->hasNode('node')) {
|
77 |
+
if (!$first) {
|
78 |
+
$compiler->raw(', ');
|
79 |
+
}
|
80 |
+
$compiler->subcompile($this->getNode('node'));
|
81 |
+
$first = \false;
|
82 |
+
}
|
83 |
+
if ($this->hasNode('arguments')) {
|
84 |
+
$callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null;
|
85 |
+
$arguments = $this->getArguments($callable, $this->getNode('arguments'));
|
86 |
+
foreach ($arguments as $node) {
|
87 |
+
if (!$first) {
|
88 |
+
$compiler->raw(', ');
|
89 |
+
}
|
90 |
+
$compiler->subcompile($node);
|
91 |
+
$first = \false;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
$compiler->raw($isArray ? ']' : ')');
|
95 |
+
}
|
96 |
+
protected function getArguments($callable, $arguments)
|
97 |
+
{
|
98 |
+
$callType = $this->getAttribute('type');
|
99 |
+
$callName = $this->getAttribute('name');
|
100 |
+
$parameters = [];
|
101 |
+
$named = \false;
|
102 |
+
foreach ($arguments as $name => $node) {
|
103 |
+
if (!\is_int($name)) {
|
104 |
+
$named = \true;
|
105 |
+
$name = $this->normalizeName($name);
|
106 |
+
} elseif ($named) {
|
107 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine(), $this->getSourceContext());
|
108 |
+
}
|
109 |
+
$parameters[$name] = $node;
|
110 |
+
}
|
111 |
+
$isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic');
|
112 |
+
if (!$named && !$isVariadic) {
|
113 |
+
return $parameters;
|
114 |
+
}
|
115 |
+
if (!$callable) {
|
116 |
+
if ($named) {
|
117 |
+
$message = \sprintf('Named arguments are not supported for %s "%s".', $callType, $callName);
|
118 |
+
} else {
|
119 |
+
$message = \sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName);
|
120 |
+
}
|
121 |
+
throw new \LogicException($message);
|
122 |
+
}
|
123 |
+
$callableParameters = $this->getCallableParameters($callable, $isVariadic);
|
124 |
+
$arguments = [];
|
125 |
+
$names = [];
|
126 |
+
$missingArguments = [];
|
127 |
+
$optionalArguments = [];
|
128 |
+
$pos = 0;
|
129 |
+
foreach ($callableParameters as $callableParameter) {
|
130 |
+
$names[] = $name = $this->normalizeName($callableParameter->name);
|
131 |
+
if (\array_key_exists($name, $parameters)) {
|
132 |
+
if (\array_key_exists($pos, $parameters)) {
|
133 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext());
|
134 |
+
}
|
135 |
+
if (\count($missingArguments)) {
|
136 |
+
throw new \WPML\Core\Twig\Error\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());
|
137 |
+
}
|
138 |
+
$arguments = \array_merge($arguments, $optionalArguments);
|
139 |
+
$arguments[] = $parameters[$name];
|
140 |
+
unset($parameters[$name]);
|
141 |
+
$optionalArguments = [];
|
142 |
+
} elseif (\array_key_exists($pos, $parameters)) {
|
143 |
+
$arguments = \array_merge($arguments, $optionalArguments);
|
144 |
+
$arguments[] = $parameters[$pos];
|
145 |
+
unset($parameters[$pos]);
|
146 |
+
$optionalArguments = [];
|
147 |
+
++$pos;
|
148 |
+
} elseif ($callableParameter->isDefaultValueAvailable()) {
|
149 |
+
$optionalArguments[] = new \WPML\Core\Twig\Node\Expression\ConstantExpression($callableParameter->getDefaultValue(), -1);
|
150 |
+
} elseif ($callableParameter->isOptional()) {
|
151 |
+
if (empty($parameters)) {
|
152 |
+
break;
|
153 |
+
} else {
|
154 |
+
$missingArguments[] = $name;
|
155 |
+
}
|
156 |
+
} else {
|
157 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext());
|
158 |
+
}
|
159 |
+
}
|
160 |
+
if ($isVariadic) {
|
161 |
+
$arbitraryArguments = new \WPML\Core\Twig\Node\Expression\ArrayExpression([], -1);
|
162 |
+
foreach ($parameters as $key => $value) {
|
163 |
+
if (\is_int($key)) {
|
164 |
+
$arbitraryArguments->addElement($value);
|
165 |
+
} else {
|
166 |
+
$arbitraryArguments->addElement($value, new \WPML\Core\Twig\Node\Expression\ConstantExpression($key, -1));
|
167 |
+
}
|
168 |
+
unset($parameters[$key]);
|
169 |
+
}
|
170 |
+
if ($arbitraryArguments->count()) {
|
171 |
+
$arguments = \array_merge($arguments, $optionalArguments);
|
172 |
+
$arguments[] = $arbitraryArguments;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
if (!empty($parameters)) {
|
176 |
+
$unknownParameter = null;
|
177 |
+
foreach ($parameters as $parameter) {
|
178 |
+
if ($parameter instanceof \WPML\Core\Twig\Node\Node) {
|
179 |
+
$unknownParameter = $parameter;
|
180 |
+
break;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
throw new \WPML\Core\Twig\Error\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());
|
184 |
+
}
|
185 |
+
return $arguments;
|
186 |
+
}
|
187 |
+
protected function normalizeName($name)
|
188 |
+
{
|
189 |
+
return \strtolower(\preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name));
|
190 |
+
}
|
191 |
+
private function getCallableParameters($callable, $isVariadic)
|
192 |
+
{
|
193 |
+
list($r) = $this->reflectCallable($callable);
|
194 |
+
if (null === $r) {
|
195 |
+
return [];
|
196 |
+
}
|
197 |
+
$parameters = $r->getParameters();
|
198 |
+
if ($this->hasNode('node')) {
|
199 |
+
\array_shift($parameters);
|
200 |
+
}
|
201 |
+
if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) {
|
202 |
+
\array_shift($parameters);
|
203 |
+
}
|
204 |
+
if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) {
|
205 |
+
\array_shift($parameters);
|
206 |
+
}
|
207 |
+
if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) {
|
208 |
+
foreach ($this->getAttribute('arguments') as $argument) {
|
209 |
+
\array_shift($parameters);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
if ($isVariadic) {
|
213 |
+
$argument = \end($parameters);
|
214 |
+
if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) {
|
215 |
+
\array_pop($parameters);
|
216 |
+
} else {
|
217 |
+
$callableName = $r->name;
|
218 |
+
if ($r instanceof \ReflectionMethod) {
|
219 |
+
$callableName = $r->getDeclaringClass()->name . '::' . $callableName;
|
220 |
+
}
|
221 |
+
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')));
|
222 |
+
}
|
223 |
+
}
|
224 |
+
return $parameters;
|
225 |
+
}
|
226 |
+
private function reflectCallable($callable)
|
227 |
+
{
|
228 |
+
if (null !== $this->reflector) {
|
229 |
+
return $this->reflector;
|
230 |
+
}
|
231 |
+
if (\is_array($callable)) {
|
232 |
+
if (!\method_exists($callable[0], $callable[1])) {
|
233 |
+
// __call()
|
234 |
+
return [null, []];
|
235 |
+
}
|
236 |
+
$r = new \ReflectionMethod($callable[0], $callable[1]);
|
237 |
+
} elseif (\is_object($callable) && !$callable instanceof \Closure) {
|
238 |
+
$r = new \ReflectionObject($callable);
|
239 |
+
$r = $r->getMethod('__invoke');
|
240 |
+
$callable = [$callable, '__invoke'];
|
241 |
+
} elseif (\is_string($callable) && \false !== ($pos = \strpos($callable, '::'))) {
|
242 |
+
$class = \substr($callable, 0, $pos);
|
243 |
+
$method = \substr($callable, $pos + 2);
|
244 |
+
if (!\method_exists($class, $method)) {
|
245 |
+
// __staticCall()
|
246 |
+
return [null, []];
|
247 |
+
}
|
248 |
+
$r = new \ReflectionMethod($callable);
|
249 |
+
$callable = [$class, $method];
|
250 |
+
} else {
|
251 |
+
$r = new \ReflectionFunction($callable);
|
252 |
+
}
|
253 |
+
return $this->reflector = [$r, $callable];
|
254 |
+
}
|
255 |
+
}
|
256 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\CallExpression', 'WPML\\Core\\Twig_Node_Expression_Call');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConditionalExpression.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class ConditionalExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
16 |
+
{
|
17 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr1, \WPML\Core\Twig\Node\Expression\AbstractExpression $expr2, \WPML\Core\Twig\Node\Expression\AbstractExpression $expr3, $lineno)
|
18 |
+
{
|
19 |
+
parent::__construct(['expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno);
|
20 |
+
}
|
21 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
22 |
+
{
|
23 |
+
$compiler->raw('((')->subcompile($this->getNode('expr1'))->raw(') ? (')->subcompile($this->getNode('expr2'))->raw(') : (')->subcompile($this->getNode('expr3'))->raw('))');
|
24 |
+
}
|
25 |
+
}
|
26 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\ConditionalExpression', 'WPML\\Core\\Twig_Node_Expression_Conditional');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConstantExpression.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class ConstantExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
16 |
+
{
|
17 |
+
public function __construct($value, $lineno)
|
18 |
+
{
|
19 |
+
parent::__construct([], ['value' => $value], $lineno);
|
20 |
+
}
|
21 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
22 |
+
{
|
23 |
+
$compiler->repr($this->getAttribute('value'));
|
24 |
+
}
|
25 |
+
}
|
26 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\ConstantExpression', 'WPML\\Core\\Twig_Node_Expression_Constant');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Filter/DefaultFilter.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Filter;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\ConditionalExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
17 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
18 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\Test\DefinedTest;
|
20 |
+
use WPML\Core\Twig\Node\Node;
|
21 |
+
/**
|
22 |
+
* Returns the value or the default value when it is undefined or empty.
|
23 |
+
*
|
24 |
+
* {{ var.foo|default('foo item on var is not defined') }}
|
25 |
+
*
|
26 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
27 |
+
*/
|
28 |
+
class DefaultFilter extends \WPML\Core\Twig\Node\Expression\FilterExpression
|
29 |
+
{
|
30 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Node\Expression\ConstantExpression $filterName, \WPML\Core\Twig_NodeInterface $arguments, $lineno, $tag = null)
|
31 |
+
{
|
32 |
+
$default = new \WPML\Core\Twig\Node\Expression\FilterExpression($node, new \WPML\Core\Twig\Node\Expression\ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine());
|
33 |
+
if ('default' === $filterName->getAttribute('value') && ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression || $node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression)) {
|
34 |
+
$test = new \WPML\Core\Twig\Node\Expression\Test\DefinedTest(clone $node, 'defined', new \WPML\Core\Twig\Node\Node(), $node->getTemplateLine());
|
35 |
+
$false = \count($arguments) ? $arguments->getNode(0) : new \WPML\Core\Twig\Node\Expression\ConstantExpression('', $node->getTemplateLine());
|
36 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConditionalExpression($test, $default, $false, $node->getTemplateLine());
|
37 |
+
} else {
|
38 |
+
$node = $default;
|
39 |
+
}
|
40 |
+
parent::__construct($node, $filterName, $arguments, $lineno, $tag);
|
41 |
+
}
|
42 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
43 |
+
{
|
44 |
+
$compiler->subcompile($this->getNode('node'));
|
45 |
+
}
|
46 |
+
}
|
47 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Filter\\DefaultFilter', 'WPML\\Core\\Twig_Node_Expression_Filter_Default');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FilterExpression.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\TwigFilter;
|
16 |
+
class FilterExpression extends \WPML\Core\Twig\Node\Expression\CallExpression
|
17 |
+
{
|
18 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Node\Expression\ConstantExpression $filterName, \WPML\Core\Twig_NodeInterface $arguments, $lineno, $tag = null)
|
19 |
+
{
|
20 |
+
parent::__construct(['node' => $node, 'filter' => $filterName, 'arguments' => $arguments], [], $lineno, $tag);
|
21 |
+
}
|
22 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
$name = $this->getNode('filter')->getAttribute('value');
|
25 |
+
$filter = $compiler->getEnvironment()->getFilter($name);
|
26 |
+
$this->setAttribute('name', $name);
|
27 |
+
$this->setAttribute('type', 'filter');
|
28 |
+
$this->setAttribute('thing', $filter);
|
29 |
+
$this->setAttribute('needs_environment', $filter->needsEnvironment());
|
30 |
+
$this->setAttribute('needs_context', $filter->needsContext());
|
31 |
+
$this->setAttribute('arguments', $filter->getArguments());
|
32 |
+
if ($filter instanceof \WPML\Core\Twig_FilterCallableInterface || $filter instanceof \WPML\Core\Twig\TwigFilter) {
|
33 |
+
$this->setAttribute('callable', $filter->getCallable());
|
34 |
+
}
|
35 |
+
if ($filter instanceof \WPML\Core\Twig\TwigFilter) {
|
36 |
+
$this->setAttribute('is_variadic', $filter->isVariadic());
|
37 |
+
}
|
38 |
+
$this->compileCallable($compiler);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\FilterExpression', 'WPML\\Core\\Twig_Node_Expression_Filter');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FunctionExpression.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\TwigFunction;
|
15 |
+
class FunctionExpression extends \WPML\Core\Twig\Node\Expression\CallExpression
|
16 |
+
{
|
17 |
+
public function __construct($name, \WPML\Core\Twig_NodeInterface $arguments, $lineno)
|
18 |
+
{
|
19 |
+
parent::__construct(['arguments' => $arguments], ['name' => $name, 'is_defined_test' => \false], $lineno);
|
20 |
+
}
|
21 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
22 |
+
{
|
23 |
+
$name = $this->getAttribute('name');
|
24 |
+
$function = $compiler->getEnvironment()->getFunction($name);
|
25 |
+
$this->setAttribute('name', $name);
|
26 |
+
$this->setAttribute('type', 'function');
|
27 |
+
$this->setAttribute('thing', $function);
|
28 |
+
$this->setAttribute('needs_environment', $function->needsEnvironment());
|
29 |
+
$this->setAttribute('needs_context', $function->needsContext());
|
30 |
+
$this->setAttribute('arguments', $function->getArguments());
|
31 |
+
if ($function instanceof \WPML\Core\Twig_FunctionCallableInterface || $function instanceof \WPML\Core\Twig\TwigFunction) {
|
32 |
+
$callable = $function->getCallable();
|
33 |
+
if ('constant' === $name && $this->getAttribute('is_defined_test')) {
|
34 |
+
$callable = 'twig_constant_is_defined';
|
35 |
+
}
|
36 |
+
$this->setAttribute('callable', $callable);
|
37 |
+
}
|
38 |
+
if ($function instanceof \WPML\Core\Twig\TwigFunction) {
|
39 |
+
$this->setAttribute('is_variadic', $function->isVariadic());
|
40 |
+
}
|
41 |
+
$this->compileCallable($compiler);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\FunctionExpression', 'WPML\\Core\\Twig_Node_Expression_Function');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/GetAttrExpression.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Template;
|
16 |
+
class GetAttrExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
17 |
+
{
|
18 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $node, \WPML\Core\Twig\Node\Expression\AbstractExpression $attribute, \WPML\Core\Twig\Node\Expression\AbstractExpression $arguments = null, $type, $lineno)
|
19 |
+
{
|
20 |
+
$nodes = ['node' => $node, 'attribute' => $attribute];
|
21 |
+
if (null !== $arguments) {
|
22 |
+
$nodes['arguments'] = $arguments;
|
23 |
+
}
|
24 |
+
parent::__construct($nodes, ['type' => $type, 'is_defined_test' => \false, 'ignore_strict_check' => \false, 'disable_c_ext' => \false], $lineno);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
if ($this->getAttribute('disable_c_ext')) {
|
29 |
+
@\trigger_error(\sprintf('Using the "disable_c_ext" attribute on %s is deprecated since version 1.30 and will be removed in 2.0.', __CLASS__), \E_USER_DEPRECATED);
|
30 |
+
}
|
31 |
+
if (\function_exists('WPML\\Core\\twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) {
|
32 |
+
$compiler->raw('twig_template_get_attributes($this, ');
|
33 |
+
} else {
|
34 |
+
$compiler->raw('$this->getAttribute(');
|
35 |
+
}
|
36 |
+
if ($this->getAttribute('ignore_strict_check')) {
|
37 |
+
$this->getNode('node')->setAttribute('ignore_strict_check', \true);
|
38 |
+
}
|
39 |
+
$compiler->subcompile($this->getNode('node'));
|
40 |
+
$compiler->raw(', ')->subcompile($this->getNode('attribute'));
|
41 |
+
// only generate optional arguments when needed (to make generated code more readable)
|
42 |
+
$needFourth = $this->getAttribute('ignore_strict_check');
|
43 |
+
$needThird = $needFourth || $this->getAttribute('is_defined_test');
|
44 |
+
$needSecond = $needThird || \WPML\Core\Twig\Template::ANY_CALL !== $this->getAttribute('type');
|
45 |
+
$needFirst = $needSecond || $this->hasNode('arguments');
|
46 |
+
if ($needFirst) {
|
47 |
+
if ($this->hasNode('arguments')) {
|
48 |
+
$compiler->raw(', ')->subcompile($this->getNode('arguments'));
|
49 |
+
} else {
|
50 |
+
$compiler->raw(', []');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
if ($needSecond) {
|
54 |
+
$compiler->raw(', ')->repr($this->getAttribute('type'));
|
55 |
+
}
|
56 |
+
if ($needThird) {
|
57 |
+
$compiler->raw(', ')->repr($this->getAttribute('is_defined_test'));
|
58 |
+
}
|
59 |
+
if ($needFourth) {
|
60 |
+
$compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check'));
|
61 |
+
}
|
62 |
+
$compiler->raw(')');
|
63 |
+
}
|
64 |
+
}
|
65 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\GetAttrExpression', 'WPML\\Core\\Twig_Node_Expression_GetAttr');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/InlinePrint.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* @internal
|
17 |
+
*/
|
18 |
+
final class InlinePrint extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
19 |
+
{
|
20 |
+
public function __construct(\WPML\Core\Twig\Node\Node $node, $lineno)
|
21 |
+
{
|
22 |
+
parent::__construct(['node' => $node], [], $lineno);
|
23 |
+
}
|
24 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
25 |
+
{
|
26 |
+
$compiler->raw('print (')->subcompile($this->getNode('node'))->raw(')');
|
27 |
+
}
|
28 |
+
}
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/MethodCallExpression.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class MethodCallExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
15 |
+
{
|
16 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $node, $method, \WPML\Core\Twig\Node\Expression\ArrayExpression $arguments, $lineno)
|
17 |
+
{
|
18 |
+
parent::__construct(['node' => $node, 'arguments' => $arguments], ['method' => $method, 'safe' => \false], $lineno);
|
19 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
20 |
+
$node->setAttribute('always_defined', \true);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
24 |
+
{
|
25 |
+
$compiler->subcompile($this->getNode('node'))->raw('->')->raw($this->getAttribute('method'))->raw('(');
|
26 |
+
$first = \true;
|
27 |
+
foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) {
|
28 |
+
if (!$first) {
|
29 |
+
$compiler->raw(', ');
|
30 |
+
}
|
31 |
+
$first = \false;
|
32 |
+
$compiler->subcompile($pair['value']);
|
33 |
+
}
|
34 |
+
$compiler->raw(')');
|
35 |
+
}
|
36 |
+
}
|
37 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\MethodCallExpression', 'WPML\\Core\\Twig_Node_Expression_MethodCall');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NameExpression.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class NameExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
16 |
+
{
|
17 |
+
protected $specialVars = ['_self' => '$this', '_context' => '$context', '_charset' => '$this->env->getCharset()'];
|
18 |
+
public function __construct($name, $lineno)
|
19 |
+
{
|
20 |
+
parent::__construct([], ['name' => $name, 'is_defined_test' => \false, 'ignore_strict_check' => \false, 'always_defined' => \false], $lineno);
|
21 |
+
}
|
22 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
$name = $this->getAttribute('name');
|
25 |
+
$compiler->addDebugInfo($this);
|
26 |
+
if ($this->getAttribute('is_defined_test')) {
|
27 |
+
if ($this->isSpecial()) {
|
28 |
+
$compiler->repr(\true);
|
29 |
+
} elseif (\PHP_VERSION_ID >= 700400) {
|
30 |
+
$compiler->raw('array_key_exists(')->string($name)->raw(', $context)');
|
31 |
+
} else {
|
32 |
+
$compiler->raw('(isset($context[')->string($name)->raw(']) || array_key_exists(')->string($name)->raw(', $context))');
|
33 |
+
}
|
34 |
+
} elseif ($this->isSpecial()) {
|
35 |
+
$compiler->raw($this->specialVars[$name]);
|
36 |
+
} elseif ($this->getAttribute('always_defined')) {
|
37 |
+
$compiler->raw('$context[')->string($name)->raw(']');
|
38 |
+
} else {
|
39 |
+
if (\PHP_VERSION_ID >= 70000) {
|
40 |
+
// use PHP 7 null coalescing operator
|
41 |
+
$compiler->raw('($context[')->string($name)->raw('] ?? ');
|
42 |
+
if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
|
43 |
+
$compiler->raw('null)');
|
44 |
+
} else {
|
45 |
+
$compiler->raw('$this->getContext($context, ')->string($name)->raw('))');
|
46 |
+
}
|
47 |
+
} elseif (\PHP_VERSION_ID >= 50400) {
|
48 |
+
// PHP 5.4 ternary operator performance was optimized
|
49 |
+
$compiler->raw('(isset($context[')->string($name)->raw(']) ? $context[')->string($name)->raw('] : ');
|
50 |
+
if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
|
51 |
+
$compiler->raw('null)');
|
52 |
+
} else {
|
53 |
+
$compiler->raw('$this->getContext($context, ')->string($name)->raw('))');
|
54 |
+
}
|
55 |
+
} else {
|
56 |
+
$compiler->raw('$this->getContext($context, ')->string($name);
|
57 |
+
if ($this->getAttribute('ignore_strict_check')) {
|
58 |
+
$compiler->raw(', true');
|
59 |
+
}
|
60 |
+
$compiler->raw(')');
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
public function isSpecial()
|
65 |
+
{
|
66 |
+
return isset($this->specialVars[$this->getAttribute('name')]);
|
67 |
+
}
|
68 |
+
public function isSimple()
|
69 |
+
{
|
70 |
+
return !$this->isSpecial() && !$this->getAttribute('is_defined_test');
|
71 |
+
}
|
72 |
+
}
|
73 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\NameExpression', 'WPML\\Core\\Twig_Node_Expression_Name');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NullCoalesceExpression.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\Binary\AndBinary;
|
15 |
+
use WPML\Core\Twig\Node\Expression\Test\DefinedTest;
|
16 |
+
use WPML\Core\Twig\Node\Expression\Test\NullTest;
|
17 |
+
use WPML\Core\Twig\Node\Expression\Unary\NotUnary;
|
18 |
+
use WPML\Core\Twig\Node\Node;
|
19 |
+
class NullCoalesceExpression extends \WPML\Core\Twig\Node\Expression\ConditionalExpression
|
20 |
+
{
|
21 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $left, \WPML\Core\Twig_NodeInterface $right, $lineno)
|
22 |
+
{
|
23 |
+
$test = new \WPML\Core\Twig\Node\Expression\Test\DefinedTest(clone $left, 'defined', new \WPML\Core\Twig\Node\Node(), $left->getTemplateLine());
|
24 |
+
// for "block()", we don't need the null test as the return value is always a string
|
25 |
+
if (!$left instanceof \WPML\Core\Twig\Node\Expression\BlockReferenceExpression) {
|
26 |
+
$test = new \WPML\Core\Twig\Node\Expression\Binary\AndBinary($test, new \WPML\Core\Twig\Node\Expression\Unary\NotUnary(new \WPML\Core\Twig\Node\Expression\Test\NullTest($left, 'null', new \WPML\Core\Twig\Node\Node(), $left->getTemplateLine()), $left->getTemplateLine()), $left->getTemplateLine());
|
27 |
+
}
|
28 |
+
parent::__construct($test, $left, $right, $lineno);
|
29 |
+
}
|
30 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
31 |
+
{
|
32 |
+
/*
|
33 |
+
* This optimizes only one case. PHP 7 also supports more complex expressions
|
34 |
+
* that can return null. So, for instance, if log is defined, log("foo") ?? "..." works,
|
35 |
+
* but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced
|
36 |
+
* cases might be implemented as an optimizer node visitor, but has not been done
|
37 |
+
* as benefits are probably not worth the added complexity.
|
38 |
+
*/
|
39 |
+
if (\PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
40 |
+
$this->getNode('expr2')->setAttribute('always_defined', \true);
|
41 |
+
$compiler->raw('((')->subcompile($this->getNode('expr2'))->raw(') ?? (')->subcompile($this->getNode('expr3'))->raw('))');
|
42 |
+
} else {
|
43 |
+
parent::compile($compiler);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\NullCoalesceExpression', 'WPML\\Core\\Twig_Node_Expression_NullCoalesce');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ParentExpression.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
/**
|
16 |
+
* Represents a parent node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class ParentExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
21 |
+
{
|
22 |
+
public function __construct($name, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct([], ['output' => \false, 'name' => $name], $lineno, $tag);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
if ($this->getAttribute('output')) {
|
29 |
+
$compiler->addDebugInfo($this)->write('$this->displayParentBlock(')->string($this->getAttribute('name'))->raw(", \$context, \$blocks);\n");
|
30 |
+
} else {
|
31 |
+
$compiler->raw('$this->renderParentBlock(')->string($this->getAttribute('name'))->raw(', $context, $blocks)');
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\ParentExpression', 'WPML\\Core\\Twig_Node_Expression_Parent');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TempNameExpression.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
class TempNameExpression extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
15 |
+
{
|
16 |
+
public function __construct($name, $lineno)
|
17 |
+
{
|
18 |
+
parent::__construct([], ['name' => $name], $lineno);
|
19 |
+
}
|
20 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
21 |
+
{
|
22 |
+
$compiler->raw('$_')->raw($this->getAttribute('name'))->raw('_');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\TempNameExpression', 'WPML\\Core\\Twig_Node_Expression_TempName');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/ConstantTest.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks if a variable is the exact same value as a constant.
|
17 |
+
*
|
18 |
+
* {% if post.status is constant('Post::PUBLISHED') %}
|
19 |
+
* the status attribute is exactly the same as Post::PUBLISHED
|
20 |
+
* {% endif %}
|
21 |
+
*
|
22 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
23 |
+
*/
|
24 |
+
class ConstantTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
25 |
+
{
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->raw('(')->subcompile($this->getNode('node'))->raw(' === constant(');
|
29 |
+
if ($this->getNode('arguments')->hasNode(1)) {
|
30 |
+
$compiler->raw('get_class(')->subcompile($this->getNode('arguments')->getNode(1))->raw(')."::".');
|
31 |
+
}
|
32 |
+
$compiler->subcompile($this->getNode('arguments')->getNode(0))->raw('))');
|
33 |
+
}
|
34 |
+
}
|
35 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\ConstantTest', 'WPML\\Core\\Twig_Node_Expression_Test_Constant');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DefinedTest.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ArrayExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
17 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
18 |
+
use WPML\Core\Twig\Node\Expression\FunctionExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
22 |
+
/**
|
23 |
+
* Checks if a variable is defined in the current context.
|
24 |
+
*
|
25 |
+
* {# defined works with variable names and variable attributes #}
|
26 |
+
* {% if foo is defined %}
|
27 |
+
* {# ... #}
|
28 |
+
* {% endif %}
|
29 |
+
*
|
30 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
31 |
+
*/
|
32 |
+
class DefinedTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
33 |
+
{
|
34 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $node, $name, \WPML\Core\Twig_NodeInterface $arguments = null, $lineno)
|
35 |
+
{
|
36 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
37 |
+
$node->setAttribute('is_defined_test', \true);
|
38 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression) {
|
39 |
+
$node->setAttribute('is_defined_test', \true);
|
40 |
+
$this->changeIgnoreStrictCheck($node);
|
41 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\BlockReferenceExpression) {
|
42 |
+
$node->setAttribute('is_defined_test', \true);
|
43 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression && 'constant' === $node->getAttribute('name')) {
|
44 |
+
$node->setAttribute('is_defined_test', \true);
|
45 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression || $node instanceof \WPML\Core\Twig\Node\Expression\ArrayExpression) {
|
46 |
+
$node = new \WPML\Core\Twig\Node\Expression\ConstantExpression(\true, $node->getTemplateLine());
|
47 |
+
} else {
|
48 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('The "defined" test only works with simple variables.', $lineno);
|
49 |
+
}
|
50 |
+
parent::__construct($node, $name, $arguments, $lineno);
|
51 |
+
}
|
52 |
+
protected function changeIgnoreStrictCheck(\WPML\Core\Twig\Node\Expression\GetAttrExpression $node)
|
53 |
+
{
|
54 |
+
$node->setAttribute('ignore_strict_check', \true);
|
55 |
+
if ($node->getNode('node') instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression) {
|
56 |
+
$this->changeIgnoreStrictCheck($node->getNode('node'));
|
57 |
+
}
|
58 |
+
}
|
59 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
60 |
+
{
|
61 |
+
$compiler->subcompile($this->getNode('node'));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\DefinedTest', 'WPML\\Core\\Twig_Node_Expression_Test_Defined');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DivisiblebyTest.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks if a variable is divisible by a number.
|
17 |
+
*
|
18 |
+
* {% if loop.index is divisible by(3) %}
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class DivisiblebyTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
23 |
+
{
|
24 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
25 |
+
{
|
26 |
+
$compiler->raw('(0 == ')->subcompile($this->getNode('node'))->raw(' % ')->subcompile($this->getNode('arguments')->getNode(0))->raw(')');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\DivisiblebyTest', 'WPML\\Core\\Twig_Node_Expression_Test_Divisibleby');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/EvenTest.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks if a number is even.
|
17 |
+
*
|
18 |
+
* {{ var is even }}
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class EvenTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
23 |
+
{
|
24 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
25 |
+
{
|
26 |
+
$compiler->raw('(')->subcompile($this->getNode('node'))->raw(' % 2 == 0')->raw(')');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\EvenTest', 'WPML\\Core\\Twig_Node_Expression_Test_Even');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/NullTest.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks that a variable is null.
|
17 |
+
*
|
18 |
+
* {{ var is none }}
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class NullTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
23 |
+
{
|
24 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
25 |
+
{
|
26 |
+
$compiler->raw('(null === ')->subcompile($this->getNode('node'))->raw(')');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\NullTest', 'WPML\\Core\\Twig_Node_Expression_Test_Null');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/OddTest.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks if a number is odd.
|
17 |
+
*
|
18 |
+
* {{ var is odd }}
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class OddTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
23 |
+
{
|
24 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
25 |
+
{
|
26 |
+
$compiler->raw('(')->subcompile($this->getNode('node'))->raw(' % 2 == 1')->raw(')');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\OddTest', 'WPML\\Core\\Twig_Node_Expression_Test_Odd');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/SameasTest.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression\Test;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\TestExpression;
|
15 |
+
/**
|
16 |
+
* Checks if a variable is the same as another one (=== in PHP).
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class SameasTest extends \WPML\Core\Twig\Node\Expression\TestExpression
|
21 |
+
{
|
22 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
$compiler->raw('(')->subcompile($this->getNode('node'))->raw(' === ')->subcompile($this->getNode('arguments')->getNode(0))->raw(')');
|
25 |
+
}
|
26 |
+
}
|
27 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Test\\SameasTest', 'WPML\\Core\\Twig_Node_Expression_Test_Sameas');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TestExpression.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node\Expression;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\TwigTest;
|
15 |
+
class TestExpression extends \WPML\Core\Twig\Node\Expression\CallExpression
|
16 |
+
{
|
17 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $node, $name, \WPML\Core\Twig_NodeInterface $arguments = null, $lineno)
|
18 |
+
{
|
19 |
+
$nodes = ['node' => $node];
|
20 |
+
if (null !== $arguments) {
|
21 |
+
$nodes['arguments'] = $arguments;
|
22 |
+
}
|
23 |
+
parent::__construct($nodes, ['name' => $name], $lineno);
|
24 |
+
}
|
25 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
26 |
+
{
|
27 |
+
$name = $this->getAttribute('name');
|
28 |
+
$test = $compiler->getEnvironment()->getTest($name);
|
29 |
+
$this->setAttribute('name', $name);
|
30 |
+
$this->setAttribute('type', 'test');
|
31 |
+
$this->setAttribute('thing', $test);
|
32 |
+
if ($test instanceof \WPML\Core\Twig\TwigTest) {
|
33 |
+
$this->setAttribute('arguments', $test->getArguments());
|
34 |
+
}
|
35 |
+
if ($test instanceof \WPML\Core\Twig_TestCallableInterface || $test instanceof \WPML\Core\Twig\TwigTest) {
|
36 |
+
$this->setAttribute('callable', $test->getCallable());
|
37 |
+
}
|
38 |
+
if ($test instanceof \WPML\Core\Twig\TwigTest) {
|
39 |
+
$this->setAttribute('is_variadic', $test->isVariadic());
|
40 |
+
}
|
41 |
+
$this->compileCallable($compiler);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\TestExpression', 'WPML\\Core\\Twig_Node_Expression_Test');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/AbstractUnary.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Unary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
abstract class AbstractUnary extends \WPML\Core\Twig\Node\Expression\AbstractExpression
|
17 |
+
{
|
18 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $node, $lineno)
|
19 |
+
{
|
20 |
+
parent::__construct(['node' => $node], [], $lineno);
|
21 |
+
}
|
22 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
23 |
+
{
|
24 |
+
$compiler->raw(' ');
|
25 |
+
$this->operator($compiler);
|
26 |
+
$compiler->subcompile($this->getNode('node'));
|
27 |
+
}
|
28 |
+
public abstract function operator(\WPML\Core\Twig\Compiler $compiler);
|
29 |
+
}
|
30 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Unary\\AbstractUnary', 'WPML\\Core\\Twig_Node_Expression_Unary');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NegUnary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Unary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class NegUnary extends \WPML\Core\Twig\Node\Expression\Unary\AbstractUnary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
$compiler->raw('-');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Unary\\NegUnary', 'WPML\\Core\\Twig_Node_Expression_Unary_Neg');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NotUnary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Unary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class NotUnary extends \WPML\Core\Twig\Node\Expression\Unary\AbstractUnary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
$compiler->raw('!');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Unary\\NotUnary', 'WPML\\Core\\Twig_Node_Expression_Unary_Not');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/PosUnary.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node\Expression\Unary;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
class PosUnary extends \WPML\Core\Twig\Node\Expression\Unary\AbstractUnary
|
16 |
+
{
|
17 |
+
public function operator(\WPML\Core\Twig\Compiler $compiler)
|
18 |
+
{
|
19 |
+
$compiler->raw('+');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Expression\\Unary\\PosUnary', 'WPML\\Core\\Twig_Node_Expression_Unary_Pos');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/FlushNode.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents a flush node.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class FlushNode extends \WPML\Core\Twig\Node\Node
|
20 |
+
{
|
21 |
+
public function __construct($lineno, $tag)
|
22 |
+
{
|
23 |
+
parent::__construct([], [], $lineno, $tag);
|
24 |
+
}
|
25 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
26 |
+
{
|
27 |
+
$compiler->addDebugInfo($this)->write("flush();\n");
|
28 |
+
}
|
29 |
+
}
|
30 |
+
\class_alias('WPML\\Core\\Twig\\Node\\FlushNode', 'WPML\\Core\\Twig_Node_Flush');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/ForLoopNode.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Internal node used by the for node.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class ForLoopNode extends \WPML\Core\Twig\Node\Node
|
20 |
+
{
|
21 |
+
public function __construct($lineno, $tag = null)
|
22 |
+
{
|
23 |
+
parent::__construct([], ['with_loop' => \false, 'ifexpr' => \false, 'else' => \false], $lineno, $tag);
|
24 |
+
}
|
25 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
26 |
+
{
|
27 |
+
if ($this->getAttribute('else')) {
|
28 |
+
$compiler->write("\$context['_iterated'] = true;\n");
|
29 |
+
}
|
30 |
+
if ($this->getAttribute('with_loop')) {
|
31 |
+
$compiler->write("++\$context['loop']['index0'];\n")->write("++\$context['loop']['index'];\n")->write("\$context['loop']['first'] = false;\n");
|
32 |
+
if (!$this->getAttribute('ifexpr')) {
|
33 |
+
$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");
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
\class_alias('WPML\\Core\\Twig\\Node\\ForLoopNode', 'WPML\\Core\\Twig_Node_ForLoop');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/ForNode.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
17 |
+
/**
|
18 |
+
* Represents a for node.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
class ForNode extends \WPML\Core\Twig\Node\Node
|
23 |
+
{
|
24 |
+
protected $loop;
|
25 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AssignNameExpression $keyTarget, \WPML\Core\Twig\Node\Expression\AssignNameExpression $valueTarget, \WPML\Core\Twig\Node\Expression\AbstractExpression $seq, \WPML\Core\Twig\Node\Expression\AbstractExpression $ifexpr = null, \WPML\Core\Twig_NodeInterface $body, \WPML\Core\Twig_NodeInterface $else = null, $lineno, $tag = null)
|
26 |
+
{
|
27 |
+
$body = new \WPML\Core\Twig\Node\Node([$body, $this->loop = new \WPML\Core\Twig\Node\ForLoopNode($lineno, $tag)]);
|
28 |
+
if (null !== $ifexpr) {
|
29 |
+
$body = new \WPML\Core\Twig\Node\IfNode(new \WPML\Core\Twig\Node\Node([$ifexpr, $body]), null, $lineno, $tag);
|
30 |
+
}
|
31 |
+
$nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body];
|
32 |
+
if (null !== $else) {
|
33 |
+
$nodes['else'] = $else;
|
34 |
+
}
|
35 |
+
parent::__construct($nodes, ['with_loop' => \true, 'ifexpr' => null !== $ifexpr], $lineno, $tag);
|
36 |
+
}
|
37 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
38 |
+
{
|
39 |
+
$compiler->addDebugInfo($this)->write("\$context['_parent'] = \$context;\n")->write("\$context['_seq'] = twig_ensure_traversable(")->subcompile($this->getNode('seq'))->raw(");\n");
|
40 |
+
if ($this->hasNode('else')) {
|
41 |
+
$compiler->write("\$context['_iterated'] = false;\n");
|
42 |
+
}
|
43 |
+
if ($this->getAttribute('with_loop')) {
|
44 |
+
$compiler->write("\$context['loop'] = [\n")->write(" 'parent' => \$context['_parent'],\n")->write(" 'index0' => 0,\n")->write(" 'index' => 1,\n")->write(" 'first' => true,\n")->write("];\n");
|
45 |
+
if (!$this->getAttribute('ifexpr')) {
|
46 |
+
$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");
|
47 |
+
}
|
48 |
+
}
|
49 |
+
$this->loop->setAttribute('else', $this->hasNode('else'));
|
50 |
+
$this->loop->setAttribute('with_loop', $this->getAttribute('with_loop'));
|
51 |
+
$this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr'));
|
52 |
+
$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");
|
53 |
+
if ($this->hasNode('else')) {
|
54 |
+
$compiler->write("if (!\$context['_iterated']) {\n")->indent()->subcompile($this->getNode('else'))->outdent()->write("}\n");
|
55 |
+
}
|
56 |
+
$compiler->write("\$_parent = \$context['_parent'];\n");
|
57 |
+
// remove some "private" loop variables (needed for nested loops)
|
58 |
+
$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");
|
59 |
+
// keep the values set in the inner context for variables defined in the outer context
|
60 |
+
$compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n");
|
61 |
+
}
|
62 |
+
}
|
63 |
+
\class_alias('WPML\\Core\\Twig\\Node\\ForNode', 'WPML\\Core\\Twig_Node_For');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/IfNode.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
/**
|
16 |
+
* Represents an if node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class IfNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $tests, \WPML\Core\Twig_NodeInterface $else = null, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
$nodes = ['tests' => $tests];
|
25 |
+
if (null !== $else) {
|
26 |
+
$nodes['else'] = $else;
|
27 |
+
}
|
28 |
+
parent::__construct($nodes, [], $lineno, $tag);
|
29 |
+
}
|
30 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
31 |
+
{
|
32 |
+
$compiler->addDebugInfo($this);
|
33 |
+
for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) {
|
34 |
+
if ($i > 0) {
|
35 |
+
$compiler->outdent()->write('} elseif (');
|
36 |
+
} else {
|
37 |
+
$compiler->write('if (');
|
38 |
+
}
|
39 |
+
$compiler->subcompile($this->getNode('tests')->getNode($i))->raw(") {\n")->indent()->subcompile($this->getNode('tests')->getNode($i + 1));
|
40 |
+
}
|
41 |
+
if ($this->hasNode('else')) {
|
42 |
+
$compiler->outdent()->write("} else {\n")->indent()->subcompile($this->getNode('else'));
|
43 |
+
}
|
44 |
+
$compiler->outdent()->write("}\n");
|
45 |
+
}
|
46 |
+
}
|
47 |
+
\class_alias('WPML\\Core\\Twig\\Node\\IfNode', 'WPML\\Core\\Twig_Node_If');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/ImportNode.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
16 |
+
/**
|
17 |
+
* Represents an import node.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class ImportNode extends \WPML\Core\Twig\Node\Node
|
22 |
+
{
|
23 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr, \WPML\Core\Twig\Node\Expression\AbstractExpression $var, $lineno, $tag = null)
|
24 |
+
{
|
25 |
+
parent::__construct(['expr' => $expr, 'var' => $var], [], $lineno, $tag);
|
26 |
+
}
|
27 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
28 |
+
{
|
29 |
+
$compiler->addDebugInfo($this)->write('')->subcompile($this->getNode('var'))->raw(' = ');
|
30 |
+
if ($this->getNode('expr') instanceof \WPML\Core\Twig\Node\Expression\NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) {
|
31 |
+
$compiler->raw('$this');
|
32 |
+
} else {
|
33 |
+
$compiler->raw('$this->loadTemplate(')->subcompile($this->getNode('expr'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')->unwrap()');
|
34 |
+
}
|
35 |
+
$compiler->raw(";\n");
|
36 |
+
}
|
37 |
+
}
|
38 |
+
\class_alias('WPML\\Core\\Twig\\Node\\ImportNode', 'WPML\\Core\\Twig_Node_Import');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/IncludeNode.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
/**
|
17 |
+
* Represents an include node.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class IncludeNode extends \WPML\Core\Twig\Node\Node implements \WPML\Core\Twig\Node\NodeOutputInterface
|
22 |
+
{
|
23 |
+
public function __construct(
|
24 |
+
\WPML\Core\Twig\Node\Expression\AbstractExpression $expr,
|
25 |
+
$variables,
|
26 |
+
$only,
|
27 |
+
$ignoreMissing,
|
28 |
+
$lineno,
|
29 |
+
$tag = null
|
30 |
+
) {
|
31 |
+
$nodes = ['expr' => $expr];
|
32 |
+
if (null !== $variables) {
|
33 |
+
$nodes['variables'] = $variables;
|
34 |
+
}
|
35 |
+
parent::__construct($nodes, ['only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing], $lineno, $tag);
|
36 |
+
}
|
37 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
38 |
+
{
|
39 |
+
$compiler->addDebugInfo($this);
|
40 |
+
if ($this->getAttribute('ignore_missing')) {
|
41 |
+
$template = $compiler->getVarName();
|
42 |
+
$compiler->write(\sprintf("\$%s = null;\n", $template))->write("try {\n")->indent()->write(\sprintf('$%s = ', $template));
|
43 |
+
$this->addGetTemplate($compiler);
|
44 |
+
$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));
|
45 |
+
$this->addTemplateArguments($compiler);
|
46 |
+
$compiler->raw(");\n")->outdent()->write("}\n");
|
47 |
+
} else {
|
48 |
+
$this->addGetTemplate($compiler);
|
49 |
+
$compiler->raw('->display(');
|
50 |
+
$this->addTemplateArguments($compiler);
|
51 |
+
$compiler->raw(");\n");
|
52 |
+
}
|
53 |
+
}
|
54 |
+
protected function addGetTemplate(\WPML\Core\Twig\Compiler $compiler)
|
55 |
+
{
|
56 |
+
$compiler->write('$this->loadTemplate(')->subcompile($this->getNode('expr'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')');
|
57 |
+
}
|
58 |
+
protected function addTemplateArguments(\WPML\Core\Twig\Compiler $compiler)
|
59 |
+
{
|
60 |
+
if (!$this->hasNode('variables')) {
|
61 |
+
$compiler->raw(\false === $this->getAttribute('only') ? '$context' : '[]');
|
62 |
+
} elseif (\false === $this->getAttribute('only')) {
|
63 |
+
$compiler->raw('twig_array_merge($context, ')->subcompile($this->getNode('variables'))->raw(')');
|
64 |
+
} else {
|
65 |
+
$compiler->raw('twig_to_array(');
|
66 |
+
$compiler->subcompile($this->getNode('variables'));
|
67 |
+
$compiler->raw(')');
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
\class_alias('WPML\\Core\\Twig\\Node\\IncludeNode', 'WPML\\Core\\Twig_Node_Include');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/MacroNode.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
/**
|
16 |
+
* Represents a macro node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class MacroNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
const VARARGS_NAME = 'varargs';
|
23 |
+
public function __construct($name, \WPML\Core\Twig_NodeInterface $body, \WPML\Core\Twig_NodeInterface $arguments, $lineno, $tag = null)
|
24 |
+
{
|
25 |
+
foreach ($arguments as $argumentName => $argument) {
|
26 |
+
if (self::VARARGS_NAME === $argumentName) {
|
27 |
+
throw new \WPML\Core\Twig\Error\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());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag);
|
31 |
+
}
|
32 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
33 |
+
{
|
34 |
+
$compiler->addDebugInfo($this)->write(\sprintf('public function get%s(', $this->getAttribute('name')));
|
35 |
+
$count = \count($this->getNode('arguments'));
|
36 |
+
$pos = 0;
|
37 |
+
foreach ($this->getNode('arguments') as $name => $default) {
|
38 |
+
$compiler->raw('$__' . $name . '__ = ')->subcompile($default);
|
39 |
+
if (++$pos < $count) {
|
40 |
+
$compiler->raw(', ');
|
41 |
+
}
|
42 |
+
}
|
43 |
+
if (\PHP_VERSION_ID >= 50600) {
|
44 |
+
if ($count) {
|
45 |
+
$compiler->raw(', ');
|
46 |
+
}
|
47 |
+
$compiler->raw('...$__varargs__');
|
48 |
+
}
|
49 |
+
$compiler->raw(")\n")->write("{\n")->indent();
|
50 |
+
$compiler->write("\$context = \$this->env->mergeGlobals([\n")->indent();
|
51 |
+
foreach ($this->getNode('arguments') as $name => $default) {
|
52 |
+
$compiler->write('')->string($name)->raw(' => $__' . $name . '__')->raw(",\n");
|
53 |
+
}
|
54 |
+
$compiler->write('')->string(self::VARARGS_NAME)->raw(' => ');
|
55 |
+
if (\PHP_VERSION_ID >= 50600) {
|
56 |
+
$compiler->raw("\$__varargs__,\n");
|
57 |
+
} else {
|
58 |
+
$compiler->raw('func_num_args() > ')->repr($count)->raw(' ? array_slice(func_get_args(), ')->repr($count)->raw(") : [],\n");
|
59 |
+
}
|
60 |
+
$compiler->outdent()->write("]);\n\n")->write("\$blocks = [];\n\n");
|
61 |
+
if ($compiler->getEnvironment()->isDebug()) {
|
62 |
+
$compiler->write("ob_start();\n");
|
63 |
+
} else {
|
64 |
+
$compiler->write("ob_start(function () { return ''; });\n");
|
65 |
+
}
|
66 |
+
$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");
|
67 |
+
}
|
68 |
+
}
|
69 |
+
\class_alias('WPML\\Core\\Twig\\Node\\MacroNode', 'WPML\\Core\\Twig_Node_Macro');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/ModuleNode.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
17 |
+
use WPML\Core\Twig\Source;
|
18 |
+
/**
|
19 |
+
* Represents a module node.
|
20 |
+
*
|
21 |
+
* Consider this class as being final. If you need to customize the behavior of
|
22 |
+
* the generated class, consider adding nodes to the following nodes: display_start,
|
23 |
+
* display_end, constructor_start, constructor_end, and class_end.
|
24 |
+
*
|
25 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
26 |
+
*/
|
27 |
+
class ModuleNode extends \WPML\Core\Twig\Node\Node
|
28 |
+
{
|
29 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $body, \WPML\Core\Twig\Node\Expression\AbstractExpression $parent = null, \WPML\Core\Twig_NodeInterface $blocks, \WPML\Core\Twig_NodeInterface $macros, \WPML\Core\Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '')
|
30 |
+
{
|
31 |
+
if (!$name instanceof \WPML\Core\Twig\Source) {
|
32 |
+
@\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);
|
33 |
+
$source = new \WPML\Core\Twig\Source($source, $name);
|
34 |
+
} else {
|
35 |
+
$source = $name;
|
36 |
+
}
|
37 |
+
$nodes = ['body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits, 'display_start' => new \WPML\Core\Twig\Node\Node(), 'display_end' => new \WPML\Core\Twig\Node\Node(), 'constructor_start' => new \WPML\Core\Twig\Node\Node(), 'constructor_end' => new \WPML\Core\Twig\Node\Node(), 'class_end' => new \WPML\Core\Twig\Node\Node()];
|
38 |
+
if (null !== $parent) {
|
39 |
+
$nodes['parent'] = $parent;
|
40 |
+
}
|
41 |
+
// embedded templates are set as attributes so that they are only visited once by the visitors
|
42 |
+
parent::__construct($nodes, [
|
43 |
+
// source to be remove in 2.0
|
44 |
+
'source' => $source->getCode(),
|
45 |
+
// filename to be remove in 2.0 (use getTemplateName() instead)
|
46 |
+
'filename' => $source->getName(),
|
47 |
+
'index' => null,
|
48 |
+
'embedded_templates' => $embeddedTemplates,
|
49 |
+
], 1);
|
50 |
+
// populate the template name of all node children
|
51 |
+
$this->setTemplateName($source->getName());
|
52 |
+
$this->setSourceContext($source);
|
53 |
+
}
|
54 |
+
public function setIndex($index)
|
55 |
+
{
|
56 |
+
$this->setAttribute('index', $index);
|
57 |
+
}
|
58 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
59 |
+
{
|
60 |
+
$this->compileTemplate($compiler);
|
61 |
+
foreach ($this->getAttribute('embedded_templates') as $template) {
|
62 |
+
$compiler->subcompile($template);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
protected function compileTemplate(\WPML\Core\Twig\Compiler $compiler)
|
66 |
+
{
|
67 |
+
if (!$this->getAttribute('index')) {
|
68 |
+
$compiler->write('<?php');
|
69 |
+
}
|
70 |
+
$this->compileClassHeader($compiler);
|
71 |
+
if (\count($this->getNode('blocks')) || \count($this->getNode('traits')) || !$this->hasNode('parent') || $this->getNode('parent') instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression || \count($this->getNode('constructor_start')) || \count($this->getNode('constructor_end'))) {
|
72 |
+
$this->compileConstructor($compiler);
|
73 |
+
}
|
74 |
+
$this->compileGetParent($compiler);
|
75 |
+
$this->compileDisplay($compiler);
|
76 |
+
$compiler->subcompile($this->getNode('blocks'));
|
77 |
+
$this->compileMacros($compiler);
|
78 |
+
$this->compileGetTemplateName($compiler);
|
79 |
+
$this->compileIsTraitable($compiler);
|
80 |
+
$this->compileDebugInfo($compiler);
|
81 |
+
$this->compileGetSource($compiler);
|
82 |
+
$this->compileGetSourceContext($compiler);
|
83 |
+
$this->compileClassFooter($compiler);
|
84 |
+
}
|
85 |
+
protected function compileGetParent(\WPML\Core\Twig\Compiler $compiler)
|
86 |
+
{
|
87 |
+
if (!$this->hasNode('parent')) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
$parent = $this->getNode('parent');
|
91 |
+
$compiler->write("protected function doGetParent(array \$context)\n", "{\n")->indent()->addDebugInfo($parent)->write('return ');
|
92 |
+
if ($parent instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
93 |
+
$compiler->subcompile($parent);
|
94 |
+
} else {
|
95 |
+
$compiler->raw('$this->loadTemplate(')->subcompile($parent)->raw(', ')->repr($this->getSourceContext()->getName())->raw(', ')->repr($parent->getTemplateLine())->raw(')');
|
96 |
+
}
|
97 |
+
$compiler->raw(";\n")->outdent()->write("}\n\n");
|
98 |
+
}
|
99 |
+
protected function compileClassHeader(\WPML\Core\Twig\Compiler $compiler)
|
100 |
+
{
|
101 |
+
$compiler->write("\n\nnamespace WPML\Core;\n\n");
|
102 |
+
if (!$this->getAttribute('index')) {
|
103 |
+
$compiler->write("use \\WPML\\Core\\Twig\\Environment;\n")->write("use \\WPML\\Core\\Twig\\Error\\LoaderError;\n")->write("use \\WPML\\Core\\Twig\\Error\\RuntimeError;\n")->write("use \\WPML\\Core\\Twig\\Markup;\n")->write("use \\WPML\\Core\\Twig\\Sandbox\\SecurityError;\n")->write("use \\WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedTagError;\n")->write("use \\WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFilterError;\n")->write("use \\WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFunctionError;\n")->write("use \\WPML\\Core\\Twig\\Source;\n")->write("use \\WPML\\Core\\Twig\\Template;\n\n");
|
104 |
+
}
|
105 |
+
$compiler->write('/* ' . \str_replace('*/', '* /', $this->getSourceContext()->getName()) . " */\n")->write('class ' . \substr( $compiler->getEnvironment()->getTemplateClass($this->getSourceContext()->getName(), $this->getAttribute('index')), 11 ) )->raw(\sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass()))->write("{\n")->indent();
|
106 |
+
}
|
107 |
+
protected function compileConstructor(\WPML\Core\Twig\Compiler $compiler)
|
108 |
+
{
|
109 |
+
$compiler->write("public function __construct(Environment \$env)\n", "{\n")->indent()->subcompile($this->getNode('constructor_start'))->write("parent::__construct(\$env);\n\n");
|
110 |
+
// parent
|
111 |
+
if (!$this->hasNode('parent')) {
|
112 |
+
$compiler->write("\$this->parent = false;\n\n");
|
113 |
+
}
|
114 |
+
$countTraits = \count($this->getNode('traits'));
|
115 |
+
if ($countTraits) {
|
116 |
+
// traits
|
117 |
+
foreach ($this->getNode('traits') as $i => $trait) {
|
118 |
+
$this->compileLoadTemplate($compiler, $trait->getNode('template'), \sprintf('$_trait_%s', $i));
|
119 |
+
$node = $trait->getNode('template');
|
120 |
+
$compiler->addDebugInfo($node)->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->getSourceContext());\n")->outdent()->write("}\n")->write(\sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i));
|
121 |
+
foreach ($trait->getNode('targets') as $key => $value) {
|
122 |
+
$compiler->write(\sprintf('if (!isset($_trait_%s_blocks[', $i))->string($key)->raw("])) {\n")->indent()->write("throw new RuntimeError(sprintf('Block ")->string($key)->raw(' is not defined in trait ')->subcompile($trait->getNode('template'))->raw(".'), ")->repr($node->getTemplateLine())->raw(", \$this->getSourceContext());\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");
|
123 |
+
}
|
124 |
+
}
|
125 |
+
if ($countTraits > 1) {
|
126 |
+
$compiler->write("\$this->traits = array_merge(\n")->indent();
|
127 |
+
for ($i = 0; $i < $countTraits; ++$i) {
|
128 |
+
$compiler->write(\sprintf('$_trait_%s_blocks' . ($i == $countTraits - 1 ? '' : ',') . "\n", $i));
|
129 |
+
}
|
130 |
+
$compiler->outdent()->write(");\n\n");
|
131 |
+
} else {
|
132 |
+
$compiler->write("\$this->traits = \$_trait_0_blocks;\n\n");
|
133 |
+
}
|
134 |
+
$compiler->write("\$this->blocks = array_merge(\n")->indent()->write("\$this->traits,\n")->write("[\n");
|
135 |
+
} else {
|
136 |
+
$compiler->write("\$this->blocks = [\n");
|
137 |
+
}
|
138 |
+
// blocks
|
139 |
+
$compiler->indent();
|
140 |
+
foreach ($this->getNode('blocks') as $name => $node) {
|
141 |
+
$compiler->write(\sprintf("'%s' => [\$this, 'block_%s'],\n", $name, $name));
|
142 |
+
}
|
143 |
+
if ($countTraits) {
|
144 |
+
$compiler->outdent()->write("]\n")->outdent()->write(");\n");
|
145 |
+
} else {
|
146 |
+
$compiler->outdent()->write("];\n");
|
147 |
+
}
|
148 |
+
$compiler->subcompile($this->getNode('constructor_end'))->outdent()->write("}\n\n");
|
149 |
+
}
|
150 |
+
protected function compileDisplay(\WPML\Core\Twig\Compiler $compiler)
|
151 |
+
{
|
152 |
+
$compiler->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n")->indent()->subcompile($this->getNode('display_start'))->subcompile($this->getNode('body'));
|
153 |
+
if ($this->hasNode('parent')) {
|
154 |
+
$parent = $this->getNode('parent');
|
155 |
+
$compiler->addDebugInfo($parent);
|
156 |
+
if ($parent instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
157 |
+
$compiler->write('$this->parent = $this->loadTemplate(')->subcompile($parent)->raw(', ')->repr($this->getSourceContext()->getName())->raw(', ')->repr($parent->getTemplateLine())->raw(");\n");
|
158 |
+
$compiler->write('$this->parent');
|
159 |
+
} else {
|
160 |
+
$compiler->write('$this->getParent($context)');
|
161 |
+
}
|
162 |
+
$compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n");
|
163 |
+
}
|
164 |
+
$compiler->subcompile($this->getNode('display_end'))->outdent()->write("}\n\n");
|
165 |
+
}
|
166 |
+
protected function compileClassFooter(\WPML\Core\Twig\Compiler $compiler)
|
167 |
+
{
|
168 |
+
$compiler->subcompile($this->getNode('class_end'))->outdent()->write("}\n");
|
169 |
+
}
|
170 |
+
protected function compileMacros(\WPML\Core\Twig\Compiler $compiler)
|
171 |
+
{
|
172 |
+
$compiler->subcompile($this->getNode('macros'));
|
173 |
+
}
|
174 |
+
protected function compileGetTemplateName(\WPML\Core\Twig\Compiler $compiler)
|
175 |
+
{
|
176 |
+
$compiler->write("public function getTemplateName()\n", "{\n")->indent()->write('return ')->repr($this->getSourceContext()->getName())->raw(";\n")->outdent()->write("}\n\n");
|
177 |
+
}
|
178 |
+
protected function compileIsTraitable(\WPML\Core\Twig\Compiler $compiler)
|
179 |
+
{
|
180 |
+
// A template can be used as a trait if:
|
181 |
+
// * it has no parent
|
182 |
+
// * it has no macros
|
183 |
+
// * it has no body
|
184 |
+
//
|
185 |
+
// Put another way, a template can be used as a trait if it
|
186 |
+
// only contains blocks and use statements.
|
187 |
+
$traitable = !$this->hasNode('parent') && 0 === \count($this->getNode('macros'));
|
188 |
+
if ($traitable) {
|
189 |
+
if ($this->getNode('body') instanceof \WPML\Core\Twig\Node\BodyNode) {
|
190 |
+
$nodes = $this->getNode('body')->getNode(0);
|
191 |
+
} else {
|
192 |
+
$nodes = $this->getNode('body');
|
193 |
+
}
|
194 |
+
if (!\count($nodes)) {
|
195 |
+
$nodes = new \WPML\Core\Twig\Node\Node([$nodes]);
|
196 |
+
}
|
197 |
+
foreach ($nodes as $node) {
|
198 |
+
if (!\count($node)) {
|
199 |
+
continue;
|
200 |
+
}
|
201 |
+
if ($node instanceof \WPML\Core\Twig\Node\TextNode && \ctype_space($node->getAttribute('data'))) {
|
202 |
+
continue;
|
203 |
+
}
|
204 |
+
if ($node instanceof \WPML\Core\Twig\Node\BlockReferenceNode) {
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
$traitable = \false;
|
208 |
+
break;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
if ($traitable) {
|
212 |
+
return;
|
213 |
+
}
|
214 |
+
$compiler->write("public function isTraitable()\n", "{\n")->indent()->write(\sprintf("return %s;\n", $traitable ? 'true' : 'false'))->outdent()->write("}\n\n");
|
215 |
+
}
|
216 |
+
protected function compileDebugInfo(\WPML\Core\Twig\Compiler $compiler)
|
217 |
+
{
|
218 |
+
$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");
|
219 |
+
}
|
220 |
+
protected function compileGetSource(\WPML\Core\Twig\Compiler $compiler)
|
221 |
+
{
|
222 |
+
$compiler->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")->write("public function getSource()\n", "{\n")->indent()->write("@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);\n\n")->write('return $this->getSourceContext()->getCode();')->raw("\n")->outdent()->write("}\n\n");
|
223 |
+
}
|
224 |
+
protected function compileGetSourceContext(\WPML\Core\Twig\Compiler $compiler)
|
225 |
+
{
|
226 |
+
$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");
|
227 |
+
}
|
228 |
+
protected function compileLoadTemplate(\WPML\Core\Twig\Compiler $compiler, $node, $var)
|
229 |
+
{
|
230 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
231 |
+
$compiler->write(\sprintf('%s = $this->loadTemplate(', $var))->subcompile($node)->raw(', ')->repr($node->getTemplateName())->raw(', ')->repr($node->getTemplateLine())->raw(");\n");
|
232 |
+
} else {
|
233 |
+
throw new \LogicException('Trait templates can only be constant nodes.');
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
\class_alias('WPML\\Core\\Twig\\Node\\ModuleNode', 'WPML\\Core\\Twig_Node_Module');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/Node.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Source;
|
16 |
+
/**
|
17 |
+
* Represents a node in the AST.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class Node implements \WPML\Core\Twig_NodeInterface
|
22 |
+
{
|
23 |
+
protected $nodes;
|
24 |
+
protected $attributes;
|
25 |
+
protected $lineno;
|
26 |
+
protected $tag;
|
27 |
+
private $name;
|
28 |
+
private $sourceContext;
|
29 |
+
/**
|
30 |
+
* @param array $nodes An array of named nodes
|
31 |
+
* @param array $attributes An array of attributes (should not be nodes)
|
32 |
+
* @param int $lineno The line number
|
33 |
+
* @param string $tag The tag name associated with the Node
|
34 |
+
*/
|
35 |
+
public function __construct(array $nodes = [], array $attributes = [], $lineno = 0, $tag = null)
|
36 |
+
{
|
37 |
+
foreach ($nodes as $name => $node) {
|
38 |
+
if (!$node instanceof \WPML\Core\Twig_NodeInterface) {
|
39 |
+
@\trigger_error(\sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', \is_object($node) ? \get_class($node) : (null === $node ? 'null' : \gettype($node)), $name, \get_class($this)), \E_USER_DEPRECATED);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
$this->nodes = $nodes;
|
43 |
+
$this->attributes = $attributes;
|
44 |
+
$this->lineno = $lineno;
|
45 |
+
$this->tag = $tag;
|
46 |
+
}
|
47 |
+
public function __toString()
|
48 |
+
{
|
49 |
+
$attributes = [];
|
50 |
+
foreach ($this->attributes as $name => $value) {
|
51 |
+
$attributes[] = \sprintf('%s: %s', $name, \str_replace("\n", '', \var_export($value, \true)));
|
52 |
+
}
|
53 |
+
$repr = [\get_class($this) . '(' . \implode(', ', $attributes)];
|
54 |
+
if (\count($this->nodes)) {
|
55 |
+
foreach ($this->nodes as $name => $node) {
|
56 |
+
$len = \strlen($name) + 4;
|
57 |
+
$noderepr = [];
|
58 |
+
foreach (\explode("\n", (string) $node) as $line) {
|
59 |
+
$noderepr[] = \str_repeat(' ', $len) . $line;
|
60 |
+
}
|
61 |
+
$repr[] = \sprintf(' %s: %s', $name, \ltrim(\implode("\n", $noderepr)));
|
62 |
+
}
|
63 |
+
$repr[] = ')';
|
64 |
+
} else {
|
65 |
+
$repr[0] .= ')';
|
66 |
+
}
|
67 |
+
return \implode("\n", $repr);
|
68 |
+
}
|
69 |
+
/**
|
70 |
+
* @deprecated since 1.16.1 (to be removed in 2.0)
|
71 |
+
*/
|
72 |
+
public function toXml($asDom = \false)
|
73 |
+
{
|
74 |
+
@\trigger_error(\sprintf('%s is deprecated since version 1.16.1 and will be removed in 2.0.', __METHOD__), \E_USER_DEPRECATED);
|
75 |
+
$dom = new \DOMDocument('1.0', 'UTF-8');
|
76 |
+
$dom->formatOutput = \true;
|
77 |
+
$dom->appendChild($xml = $dom->createElement('twig'));
|
78 |
+
$xml->appendChild($node = $dom->createElement('node'));
|
79 |
+
$node->setAttribute('class', \get_class($this));
|
80 |
+
foreach ($this->attributes as $name => $value) {
|
81 |
+
$node->appendChild($attribute = $dom->createElement('attribute'));
|
82 |
+
$attribute->setAttribute('name', $name);
|
83 |
+
$attribute->appendChild($dom->createTextNode($value));
|
84 |
+
}
|
85 |
+
foreach ($this->nodes as $name => $n) {
|
86 |
+
if (null === $n) {
|
87 |
+
continue;
|
88 |
+
}
|
89 |
+
$child = $n->toXml(\true)->getElementsByTagName('node')->item(0);
|
90 |
+
$child = $dom->importNode($child, \true);
|
91 |
+
$child->setAttribute('name', $name);
|
92 |
+
$node->appendChild($child);
|
93 |
+
}
|
94 |
+
return $asDom ? $dom : $dom->saveXML();
|
95 |
+
}
|
96 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
97 |
+
{
|
98 |
+
foreach ($this->nodes as $node) {
|
99 |
+
$node->compile($compiler);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
public function getTemplateLine()
|
103 |
+
{
|
104 |
+
return $this->lineno;
|
105 |
+
}
|
106 |
+
/**
|
107 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
108 |
+
*/
|
109 |
+
public function getLine()
|
110 |
+
{
|
111 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.', \E_USER_DEPRECATED);
|
112 |
+
return $this->lineno;
|
113 |
+
}
|
114 |
+
public function getNodeTag()
|
115 |
+
{
|
116 |
+
return $this->tag;
|
117 |
+
}
|
118 |
+
/**
|
119 |
+
* @return bool
|
120 |
+
*/
|
121 |
+
public function hasAttribute($name)
|
122 |
+
{
|
123 |
+
return \array_key_exists($name, $this->attributes);
|
124 |
+
}
|
125 |
+
/**
|
126 |
+
* @return mixed
|
127 |
+
*/
|
128 |
+
public function getAttribute($name)
|
129 |
+
{
|
130 |
+
if (!\array_key_exists($name, $this->attributes)) {
|
131 |
+
throw new \LogicException(\sprintf('Attribute "%s" does not exist for Node "%s".', $name, \get_class($this)));
|
132 |
+
}
|
133 |
+
return $this->attributes[$name];
|
134 |
+
}
|
135 |
+
/**
|
136 |
+
* @param string $name
|
137 |
+
* @param mixed $value
|
138 |
+
*/
|
139 |
+
public function setAttribute($name, $value)
|
140 |
+
{
|
141 |
+
$this->attributes[$name] = $value;
|
142 |
+
}
|
143 |
+
public function removeAttribute($name)
|
144 |
+
{
|
145 |
+
unset($this->attributes[$name]);
|
146 |
+
}
|
147 |
+
/**
|
148 |
+
* @return bool
|
149 |
+
*/
|
150 |
+
public function hasNode($name)
|
151 |
+
{
|
152 |
+
return \array_key_exists($name, $this->nodes);
|
153 |
+
}
|
154 |
+
/**
|
155 |
+
* @return Node
|
156 |
+
*/
|
157 |
+
public function getNode($name)
|
158 |
+
{
|
159 |
+
if (!\array_key_exists($name, $this->nodes)) {
|
160 |
+
throw new \LogicException(\sprintf('Node "%s" does not exist for Node "%s".', $name, \get_class($this)));
|
161 |
+
}
|
162 |
+
return $this->nodes[$name];
|
163 |
+
}
|
164 |
+
public function setNode($name, $node = null)
|
165 |
+
{
|
166 |
+
if (!$node instanceof \WPML\Core\Twig_NodeInterface) {
|
167 |
+
@\trigger_error(\sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', \is_object($node) ? \get_class($node) : (null === $node ? 'null' : \gettype($node)), $name, \get_class($this)), \E_USER_DEPRECATED);
|
168 |
+
}
|
169 |
+
$this->nodes[$name] = $node;
|
170 |
+
}
|
171 |
+
public function removeNode($name)
|
172 |
+
{
|
173 |
+
unset($this->nodes[$name]);
|
174 |
+
}
|
175 |
+
public function count()
|
176 |
+
{
|
177 |
+
return \count($this->nodes);
|
178 |
+
}
|
179 |
+
public function getIterator()
|
180 |
+
{
|
181 |
+
return new \ArrayIterator($this->nodes);
|
182 |
+
}
|
183 |
+
public function setTemplateName($name)
|
184 |
+
{
|
185 |
+
$this->name = $name;
|
186 |
+
foreach ($this->nodes as $node) {
|
187 |
+
if (null !== $node) {
|
188 |
+
$node->setTemplateName($name);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
public function getTemplateName()
|
193 |
+
{
|
194 |
+
return $this->name;
|
195 |
+
}
|
196 |
+
public function setSourceContext(\WPML\Core\Twig\Source $source)
|
197 |
+
{
|
198 |
+
$this->sourceContext = $source;
|
199 |
+
foreach ($this->nodes as $node) {
|
200 |
+
if ($node instanceof \WPML\Core\Twig\Node\Node) {
|
201 |
+
$node->setSourceContext($source);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
public function getSourceContext()
|
206 |
+
{
|
207 |
+
return $this->sourceContext;
|
208 |
+
}
|
209 |
+
/**
|
210 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
211 |
+
*/
|
212 |
+
public function setFilename($name)
|
213 |
+
{
|
214 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0. Use setTemplateName() instead.', \E_USER_DEPRECATED);
|
215 |
+
$this->setTemplateName($name);
|
216 |
+
}
|
217 |
+
/**
|
218 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
219 |
+
*/
|
220 |
+
public function getFilename()
|
221 |
+
{
|
222 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateName() instead.', \E_USER_DEPRECATED);
|
223 |
+
return $this->name;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
\class_alias('WPML\\Core\\Twig\\Node\\Node', 'WPML\\Core\\Twig_Node');
|
227 |
+
// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
|
228 |
+
\class_exists('WPML\\Core\\Twig\\Compiler');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/NodeCaptureInterface.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Represents a node that captures any nested displayable nodes.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
interface NodeCaptureInterface
|
19 |
+
{
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\NodeCaptureInterface', 'WPML\\Core\\Twig_NodeCaptureInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/NodeOutputInterface.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Represents a displayable node in the AST.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
interface NodeOutputInterface
|
19 |
+
{
|
20 |
+
}
|
21 |
+
\class_alias('WPML\\Core\\Twig\\Node\\NodeOutputInterface', 'WPML\\Core\\Twig_NodeOutputInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/PrintNode.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
16 |
+
/**
|
17 |
+
* Represents a node that outputs an expression.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class PrintNode extends \WPML\Core\Twig\Node\Node implements \WPML\Core\Twig\Node\NodeOutputInterface
|
22 |
+
{
|
23 |
+
public function __construct(\WPML\Core\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null)
|
24 |
+
{
|
25 |
+
parent::__construct(['expr' => $expr], [], $lineno, $tag);
|
26 |
+
}
|
27 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
28 |
+
{
|
29 |
+
$compiler->addDebugInfo($this)->write('echo ')->subcompile($this->getNode('expr'))->raw(";\n");
|
30 |
+
}
|
31 |
+
}
|
32 |
+
\class_alias('WPML\\Core\\Twig\\Node\\PrintNode', 'WPML\\Core\\Twig_Node_Print');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxNode.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents a sandbox node.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class SandboxNode extends \WPML\Core\Twig\Node\Node
|
20 |
+
{
|
21 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $body, $lineno, $tag = null)
|
22 |
+
{
|
23 |
+
parent::__construct(['body' => $body], [], $lineno, $tag);
|
24 |
+
}
|
25 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
26 |
+
{
|
27 |
+
$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");
|
28 |
+
}
|
29 |
+
}
|
30 |
+
\class_alias('WPML\\Core\\Twig\\Node\\SandboxNode', 'WPML\\Core\\Twig_Node_Sandbox');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxedPrintNode.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
16 |
+
/**
|
17 |
+
* Adds a check for the __toString() method when the variable is an object and the sandbox is activated.
|
18 |
+
*
|
19 |
+
* When there is a simple Print statement, like {{ article }},
|
20 |
+
* and if the sandbox is enabled, we need to check that the __toString()
|
21 |
+
* method is allowed if 'article' is an object.
|
22 |
+
*
|
23 |
+
* Not used anymore, to be deprecated in 2.x and removed in 3.0
|
24 |
+
*
|
25 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
26 |
+
*/
|
27 |
+
class SandboxedPrintNode extends \WPML\Core\Twig\Node\PrintNode
|
28 |
+
{
|
29 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
30 |
+
{
|
31 |
+
$compiler->addDebugInfo($this)->write('echo ');
|
32 |
+
$expr = $this->getNode('expr');
|
33 |
+
if ($expr instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
34 |
+
$compiler->subcompile($expr)->raw(";\n");
|
35 |
+
} else {
|
36 |
+
$compiler->write('$this->env->getExtension(\'\\WPML\\Core\\Twig\\Extension\\SandboxExtension\')->ensureToStringAllowed(')->subcompile($expr)->raw(");\n");
|
37 |
+
}
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* Removes node filters.
|
41 |
+
*
|
42 |
+
* This is mostly needed when another visitor adds filters (like the escaper one).
|
43 |
+
*
|
44 |
+
* @return Node
|
45 |
+
*/
|
46 |
+
protected function removeNodeFilter(\WPML\Core\Twig\Node\Node $node)
|
47 |
+
{
|
48 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
|
49 |
+
return $this->removeNodeFilter($node->getNode('node'));
|
50 |
+
}
|
51 |
+
return $node;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
\class_alias('WPML\\Core\\Twig\\Node\\SandboxedPrintNode', 'WPML\\Core\\Twig_Node_SandboxedPrint');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/SetNode.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
15 |
+
/**
|
16 |
+
* Represents a set node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class SetNode extends \WPML\Core\Twig\Node\Node implements \WPML\Core\Twig\Node\NodeCaptureInterface
|
21 |
+
{
|
22 |
+
public function __construct($capture, \WPML\Core\Twig_NodeInterface $names, \WPML\Core\Twig_NodeInterface $values, $lineno, $tag = null)
|
23 |
+
{
|
24 |
+
parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => \false], $lineno, $tag);
|
25 |
+
/*
|
26 |
+
* Optimizes the node when capture is used for a large block of text.
|
27 |
+
*
|
28 |
+
* {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo");
|
29 |
+
*/
|
30 |
+
if ($this->getAttribute('capture')) {
|
31 |
+
$this->setAttribute('safe', \true);
|
32 |
+
$values = $this->getNode('values');
|
33 |
+
if ($values instanceof \WPML\Core\Twig\Node\TextNode) {
|
34 |
+
$this->setNode('values', new \WPML\Core\Twig\Node\Expression\ConstantExpression($values->getAttribute('data'), $values->getTemplateLine()));
|
35 |
+
$this->setAttribute('capture', \false);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
40 |
+
{
|
41 |
+
$compiler->addDebugInfo($this);
|
42 |
+
if (\count($this->getNode('names')) > 1) {
|
43 |
+
$compiler->write('list(');
|
44 |
+
foreach ($this->getNode('names') as $idx => $node) {
|
45 |
+
if ($idx) {
|
46 |
+
$compiler->raw(', ');
|
47 |
+
}
|
48 |
+
$compiler->subcompile($node);
|
49 |
+
}
|
50 |
+
$compiler->raw(')');
|
51 |
+
} else {
|
52 |
+
if ($this->getAttribute('capture')) {
|
53 |
+
if ($compiler->getEnvironment()->isDebug()) {
|
54 |
+
$compiler->write("ob_start();\n");
|
55 |
+
} else {
|
56 |
+
$compiler->write("ob_start(function () { return ''; });\n");
|
57 |
+
}
|
58 |
+
$compiler->subcompile($this->getNode('values'));
|
59 |
+
}
|
60 |
+
$compiler->subcompile($this->getNode('names'), \false);
|
61 |
+
if ($this->getAttribute('capture')) {
|
62 |
+
$compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())");
|
63 |
+
}
|
64 |
+
}
|
65 |
+
if (!$this->getAttribute('capture')) {
|
66 |
+
$compiler->raw(' = ');
|
67 |
+
if (\count($this->getNode('names')) > 1) {
|
68 |
+
$compiler->write('[');
|
69 |
+
foreach ($this->getNode('values') as $idx => $value) {
|
70 |
+
if ($idx) {
|
71 |
+
$compiler->raw(', ');
|
72 |
+
}
|
73 |
+
$compiler->subcompile($value);
|
74 |
+
}
|
75 |
+
$compiler->raw(']');
|
76 |
+
} else {
|
77 |
+
if ($this->getAttribute('safe')) {
|
78 |
+
$compiler->raw("('' === \$tmp = ")->subcompile($this->getNode('values'))->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())");
|
79 |
+
} else {
|
80 |
+
$compiler->subcompile($this->getNode('values'));
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
$compiler->raw(";\n");
|
85 |
+
}
|
86 |
+
}
|
87 |
+
\class_alias('WPML\\Core\\Twig\\Node\\SetNode', 'WPML\\Core\\Twig_Node_Set');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/SetTempNode.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* @internal
|
16 |
+
*/
|
17 |
+
class SetTempNode extends \WPML\Core\Twig\Node\Node
|
18 |
+
{
|
19 |
+
public function __construct($name, $lineno)
|
20 |
+
{
|
21 |
+
parent::__construct([], ['name' => $name], $lineno);
|
22 |
+
}
|
23 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
24 |
+
{
|
25 |
+
$name = $this->getAttribute('name');
|
26 |
+
$compiler->addDebugInfo($this)->write('if (isset($context[')->string($name)->raw('])) { $_')->raw($name)->raw('_ = $context[')->repr($name)->raw(']; } else { $_')->raw($name)->raw("_ = null; }\n");
|
27 |
+
}
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\Node\\SetTempNode', 'WPML\\Core\\Twig_Node_SetTemp');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/SpacelessNode.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents a spaceless node.
|
16 |
+
*
|
17 |
+
* It removes spaces between HTML tags.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class SpacelessNode extends \WPML\Core\Twig\Node\Node
|
22 |
+
{
|
23 |
+
public function __construct(\WPML\Core\Twig_NodeInterface $body, $lineno, $tag = 'spaceless')
|
24 |
+
{
|
25 |
+
parent::__construct(['body' => $body], [], $lineno, $tag);
|
26 |
+
}
|
27 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
28 |
+
{
|
29 |
+
$compiler->addDebugInfo($this);
|
30 |
+
if ($compiler->getEnvironment()->isDebug()) {
|
31 |
+
$compiler->write("ob_start();\n");
|
32 |
+
} else {
|
33 |
+
$compiler->write("ob_start(function () { return ''; });\n");
|
34 |
+
}
|
35 |
+
$compiler->subcompile($this->getNode('body'))->write("echo trim(preg_replace('/>\\s+</', '><', ob_get_clean()));\n");
|
36 |
+
}
|
37 |
+
}
|
38 |
+
\class_alias('WPML\\Core\\Twig\\Node\\SpacelessNode', 'WPML\\Core\\Twig_Node_Spaceless');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/TextNode.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig\Node;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Compiler;
|
15 |
+
/**
|
16 |
+
* Represents a text node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class TextNode extends \WPML\Core\Twig\Node\Node implements \WPML\Core\Twig\Node\NodeOutputInterface
|
21 |
+
{
|
22 |
+
public function __construct($data, $lineno)
|
23 |
+
{
|
24 |
+
parent::__construct([], ['data' => $data], $lineno);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->addDebugInfo($this)->write('echo ')->string($this->getAttribute('data'))->raw(";\n");
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Node\\TextNode', 'WPML\\Core\\Twig_Node_Text');
|
addons/wpml-dependencies/lib/lib/twig/src/Node/WithNode.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
/**
|
15 |
+
* Represents a nested "with" scope.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class WithNode extends \WPML\Core\Twig\Node\Node
|
20 |
+
{
|
21 |
+
public function __construct(\WPML\Core\Twig\Node\Node $body, \WPML\Core\Twig\Node\Node $variables = null, $only = \false, $lineno, $tag = null)
|
22 |
+
{
|
23 |
+
$nodes = ['body' => $body];
|
24 |
+
if (null !== $variables) {
|
25 |
+
$nodes['variables'] = $variables;
|
26 |
+
}
|
27 |
+
parent::__construct($nodes, ['only' => (bool) $only], $lineno, $tag);
|
28 |
+
}
|
29 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
30 |
+
{
|
31 |
+
$compiler->addDebugInfo($this);
|
32 |
+
if ($this->hasNode('variables')) {
|
33 |
+
$node = $this->getNode('variables');
|
34 |
+
$varsName = $compiler->getVarName();
|
35 |
+
$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));
|
36 |
+
if ($this->getAttribute('only')) {
|
37 |
+
$compiler->write("\$context = ['_parent' => \$context];\n");
|
38 |
+
} else {
|
39 |
+
$compiler->write("\$context['_parent'] = \$context;\n");
|
40 |
+
}
|
41 |
+
$compiler->write(\sprintf("\$context = \$this->env->mergeGlobals(array_merge(\$context, \$%s));\n", $varsName));
|
42 |
+
} else {
|
43 |
+
$compiler->write("\$context['_parent'] = \$context;\n");
|
44 |
+
}
|
45 |
+
$compiler->subcompile($this->getNode('body'))->write("\$context = \$context['_parent'];\n");
|
46 |
+
}
|
47 |
+
}
|
48 |
+
\class_alias('WPML\\Core\\Twig\\Node\\WithNode', 'WPML\\Core\\Twig_Node_With');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeTraverser.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
14 |
+
/**
|
15 |
+
* A node traverser.
|
16 |
+
*
|
17 |
+
* It visits all nodes and their children and calls the given visitor for each.
|
18 |
+
*
|
19 |
+
* @final
|
20 |
+
*
|
21 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
22 |
+
*/
|
23 |
+
class NodeTraverser
|
24 |
+
{
|
25 |
+
protected $env;
|
26 |
+
protected $visitors = [];
|
27 |
+
/**
|
28 |
+
* @param NodeVisitorInterface[] $visitors
|
29 |
+
*/
|
30 |
+
public function __construct(\WPML\Core\Twig\Environment $env, array $visitors = [])
|
31 |
+
{
|
32 |
+
$this->env = $env;
|
33 |
+
foreach ($visitors as $visitor) {
|
34 |
+
$this->addVisitor($visitor);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
public function addVisitor(\WPML\Core\Twig\NodeVisitor\NodeVisitorInterface $visitor)
|
38 |
+
{
|
39 |
+
$this->visitors[$visitor->getPriority()][] = $visitor;
|
40 |
+
}
|
41 |
+
/**
|
42 |
+
* Traverses a node and calls the registered visitors.
|
43 |
+
*
|
44 |
+
* @return \Twig_NodeInterface
|
45 |
+
*/
|
46 |
+
public function traverse(\WPML\Core\Twig_NodeInterface $node)
|
47 |
+
{
|
48 |
+
\ksort($this->visitors);
|
49 |
+
foreach ($this->visitors as $visitors) {
|
50 |
+
foreach ($visitors as $visitor) {
|
51 |
+
$node = $this->traverseForVisitor($visitor, $node);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $node;
|
55 |
+
}
|
56 |
+
protected function traverseForVisitor(\WPML\Core\Twig\NodeVisitor\NodeVisitorInterface $visitor, \WPML\Core\Twig_NodeInterface $node = null)
|
57 |
+
{
|
58 |
+
if (null === $node) {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
$node = $visitor->enterNode($node, $this->env);
|
62 |
+
foreach ($node as $k => $n) {
|
63 |
+
if (null === $n) {
|
64 |
+
continue;
|
65 |
+
}
|
66 |
+
if (\false !== ($m = $this->traverseForVisitor($visitor, $n)) && null !== $m) {
|
67 |
+
if ($m !== $n) {
|
68 |
+
$node->setNode($k, $m);
|
69 |
+
}
|
70 |
+
} else {
|
71 |
+
$node->removeNode($k);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
return $visitor->leaveNode($node, $this->env);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
\class_alias('WPML\\Core\\Twig\\NodeTraverser', 'WPML\\Core\\Twig_NodeTraverser');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/AbstractNodeVisitor.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Used to make node visitors compatible with Twig 1.x and 2.x.
|
17 |
+
*
|
18 |
+
* To be removed in Twig 3.1.
|
19 |
+
*
|
20 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
+
*/
|
22 |
+
abstract class AbstractNodeVisitor implements \WPML\Core\Twig\NodeVisitor\NodeVisitorInterface
|
23 |
+
{
|
24 |
+
public final function enterNode(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
25 |
+
{
|
26 |
+
if (!$node instanceof \WPML\Core\Twig\Node\Node) {
|
27 |
+
throw new \LogicException(\sprintf('%s only supports \\Twig\\Node\\Node instances.', __CLASS__));
|
28 |
+
}
|
29 |
+
return $this->doEnterNode($node, $env);
|
30 |
+
}
|
31 |
+
public final function leaveNode(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
32 |
+
{
|
33 |
+
if (!$node instanceof \WPML\Core\Twig\Node\Node) {
|
34 |
+
throw new \LogicException(\sprintf('%s only supports \\Twig\\Node\\Node instances.', __CLASS__));
|
35 |
+
}
|
36 |
+
return $this->doLeaveNode($node, $env);
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* Called before child nodes are visited.
|
40 |
+
*
|
41 |
+
* @return Node The modified node
|
42 |
+
*/
|
43 |
+
protected abstract function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env);
|
44 |
+
/**
|
45 |
+
* Called after child nodes are visited.
|
46 |
+
*
|
47 |
+
* @return Node|false|null The modified node or null if the node must be removed
|
48 |
+
*/
|
49 |
+
protected abstract function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env);
|
50 |
+
}
|
51 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\AbstractNodeVisitor', 'WPML\\Core\\Twig_BaseNodeVisitor');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/EscaperNodeVisitor.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\AutoEscapeNode;
|
15 |
+
use WPML\Core\Twig\Node\BlockNode;
|
16 |
+
use WPML\Core\Twig\Node\BlockReferenceNode;
|
17 |
+
use WPML\Core\Twig\Node\DoNode;
|
18 |
+
use WPML\Core\Twig\Node\Expression\ConditionalExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\InlinePrint;
|
22 |
+
use WPML\Core\Twig\Node\ImportNode;
|
23 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
24 |
+
use WPML\Core\Twig\Node\Node;
|
25 |
+
use WPML\Core\Twig\Node\PrintNode;
|
26 |
+
use WPML\Core\Twig\NodeTraverser;
|
27 |
+
/**
|
28 |
+
* @final
|
29 |
+
*
|
30 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
31 |
+
*/
|
32 |
+
class EscaperNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
33 |
+
{
|
34 |
+
protected $statusStack = [];
|
35 |
+
protected $blocks = [];
|
36 |
+
protected $safeAnalysis;
|
37 |
+
protected $traverser;
|
38 |
+
protected $defaultStrategy = \false;
|
39 |
+
protected $safeVars = [];
|
40 |
+
public function __construct()
|
41 |
+
{
|
42 |
+
$this->safeAnalysis = new \WPML\Core\Twig\NodeVisitor\SafeAnalysisNodeVisitor();
|
43 |
+
}
|
44 |
+
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
45 |
+
{
|
46 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
47 |
+
if ($env->hasExtension('WPML\\Core\\Twig\\Extension\\EscaperExtension') && ($defaultStrategy = $env->getExtension('WPML\\Core\\Twig\\Extension\\EscaperExtension')->getDefaultStrategy($node->getTemplateName()))) {
|
48 |
+
$this->defaultStrategy = $defaultStrategy;
|
49 |
+
}
|
50 |
+
$this->safeVars = [];
|
51 |
+
$this->blocks = [];
|
52 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\AutoEscapeNode) {
|
53 |
+
$this->statusStack[] = $node->getAttribute('value');
|
54 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\BlockNode) {
|
55 |
+
$this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env);
|
56 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\ImportNode) {
|
57 |
+
$this->safeVars[] = $node->getNode('var')->getAttribute('name');
|
58 |
+
}
|
59 |
+
return $node;
|
60 |
+
}
|
61 |
+
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
62 |
+
{
|
63 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
64 |
+
$this->defaultStrategy = \false;
|
65 |
+
$this->safeVars = [];
|
66 |
+
$this->blocks = [];
|
67 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
|
68 |
+
return $this->preEscapeFilterNode($node, $env);
|
69 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\PrintNode && \false !== ($type = $this->needEscaping($env))) {
|
70 |
+
$expression = $node->getNode('expr');
|
71 |
+
if ($expression instanceof \WPML\Core\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expression, $env, $type)) {
|
72 |
+
return new \WPML\Core\Twig\Node\DoNode($this->unwrapConditional($expression, $env, $type), $expression->getTemplateLine());
|
73 |
+
}
|
74 |
+
return $this->escapePrintNode($node, $env, $type);
|
75 |
+
}
|
76 |
+
if ($node instanceof \WPML\Core\Twig\Node\AutoEscapeNode || $node instanceof \WPML\Core\Twig\Node\BlockNode) {
|
77 |
+
\array_pop($this->statusStack);
|
78 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\BlockReferenceNode) {
|
79 |
+
$this->blocks[$node->getAttribute('name')] = $this->needEscaping($env);
|
80 |
+
}
|
81 |
+
return $node;
|
82 |
+
}
|
83 |
+
private function shouldUnwrapConditional(\WPML\Core\Twig\Node\Expression\ConditionalExpression $expression, \WPML\Core\Twig\Environment $env, $type)
|
84 |
+
{
|
85 |
+
$expr2Safe = $this->isSafeFor($type, $expression->getNode('expr2'), $env);
|
86 |
+
$expr3Safe = $this->isSafeFor($type, $expression->getNode('expr3'), $env);
|
87 |
+
return $expr2Safe !== $expr3Safe;
|
88 |
+
}
|
89 |
+
private function unwrapConditional(\WPML\Core\Twig\Node\Expression\ConditionalExpression $expression, \WPML\Core\Twig\Environment $env, $type)
|
90 |
+
{
|
91 |
+
// convert "echo a ? b : c" to "a ? echo b : echo c" recursively
|
92 |
+
$expr2 = $expression->getNode('expr2');
|
93 |
+
if ($expr2 instanceof \WPML\Core\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expr2, $env, $type)) {
|
94 |
+
$expr2 = $this->unwrapConditional($expr2, $env, $type);
|
95 |
+
} else {
|
96 |
+
$expr2 = $this->escapeInlinePrintNode(new \WPML\Core\Twig\Node\Expression\InlinePrint($expr2, $expr2->getTemplateLine()), $env, $type);
|
97 |
+
}
|
98 |
+
$expr3 = $expression->getNode('expr3');
|
99 |
+
if ($expr3 instanceof \WPML\Core\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expr3, $env, $type)) {
|
100 |
+
$expr3 = $this->unwrapConditional($expr3, $env, $type);
|
101 |
+
} else {
|
102 |
+
$expr3 = $this->escapeInlinePrintNode(new \WPML\Core\Twig\Node\Expression\InlinePrint($expr3, $expr3->getTemplateLine()), $env, $type);
|
103 |
+
}
|
104 |
+
return new \WPML\Core\Twig\Node\Expression\ConditionalExpression($expression->getNode('expr1'), $expr2, $expr3, $expression->getTemplateLine());
|
105 |
+
}
|
106 |
+
private function escapeInlinePrintNode(\WPML\Core\Twig\Node\Expression\InlinePrint $node, \WPML\Core\Twig\Environment $env, $type)
|
107 |
+
{
|
108 |
+
$expression = $node->getNode('node');
|
109 |
+
if ($this->isSafeFor($type, $expression, $env)) {
|
110 |
+
return $node;
|
111 |
+
}
|
112 |
+
return new \WPML\Core\Twig\Node\Expression\InlinePrint($this->getEscaperFilter($type, $expression), $node->getTemplateLine());
|
113 |
+
}
|
114 |
+
protected function escapePrintNode(\WPML\Core\Twig\Node\PrintNode $node, \WPML\Core\Twig\Environment $env, $type)
|
115 |
+
{
|
116 |
+
if (\false === $type) {
|
117 |
+
return $node;
|
118 |
+
}
|
119 |
+
$expression = $node->getNode('expr');
|
120 |
+
if ($this->isSafeFor($type, $expression, $env)) {
|
121 |
+
return $node;
|
122 |
+
}
|
123 |
+
$class = \get_class($node);
|
124 |
+
return new $class($this->getEscaperFilter($type, $expression), $node->getTemplateLine());
|
125 |
+
}
|
126 |
+
protected function preEscapeFilterNode(\WPML\Core\Twig\Node\Expression\FilterExpression $filter, \WPML\Core\Twig\Environment $env)
|
127 |
+
{
|
128 |
+
$name = $filter->getNode('filter')->getAttribute('value');
|
129 |
+
$type = $env->getFilter($name)->getPreEscape();
|
130 |
+
if (null === $type) {
|
131 |
+
return $filter;
|
132 |
+
}
|
133 |
+
$node = $filter->getNode('node');
|
134 |
+
if ($this->isSafeFor($type, $node, $env)) {
|
135 |
+
return $filter;
|
136 |
+
}
|
137 |
+
$filter->setNode('node', $this->getEscaperFilter($type, $node));
|
138 |
+
return $filter;
|
139 |
+
}
|
140 |
+
protected function isSafeFor($type, \WPML\Core\Twig_NodeInterface $expression, $env)
|
141 |
+
{
|
142 |
+
$safe = $this->safeAnalysis->getSafe($expression);
|
143 |
+
if (null === $safe) {
|
144 |
+
if (null === $this->traverser) {
|
145 |
+
$this->traverser = new \WPML\Core\Twig\NodeTraverser($env, [$this->safeAnalysis]);
|
146 |
+
}
|
147 |
+
$this->safeAnalysis->setSafeVars($this->safeVars);
|
148 |
+
$this->traverser->traverse($expression);
|
149 |
+
$safe = $this->safeAnalysis->getSafe($expression);
|
150 |
+
}
|
151 |
+
return \in_array($type, $safe) || \in_array('all', $safe);
|
152 |
+
}
|
153 |
+
protected function needEscaping(\WPML\Core\Twig\Environment $env)
|
154 |
+
{
|
155 |
+
if (\count($this->statusStack)) {
|
156 |
+
return $this->statusStack[\count($this->statusStack) - 1];
|
157 |
+
}
|
158 |
+
return $this->defaultStrategy ? $this->defaultStrategy : \false;
|
159 |
+
}
|
160 |
+
protected function getEscaperFilter($type, \WPML\Core\Twig_NodeInterface $node)
|
161 |
+
{
|
162 |
+
$line = $node->getTemplateLine();
|
163 |
+
$name = new \WPML\Core\Twig\Node\Expression\ConstantExpression('escape', $line);
|
164 |
+
$args = new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\Expression\ConstantExpression((string) $type, $line), new \WPML\Core\Twig\Node\Expression\ConstantExpression(null, $line), new \WPML\Core\Twig\Node\Expression\ConstantExpression(\true, $line)]);
|
165 |
+
return new \WPML\Core\Twig\Node\Expression\FilterExpression($node, $name, $args, $line);
|
166 |
+
}
|
167 |
+
public function getPriority()
|
168 |
+
{
|
169 |
+
return 0;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\EscaperNodeVisitor', 'WPML\\Core\\Twig_NodeVisitor_Escaper');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/NodeVisitorInterface.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
/**
|
15 |
+
* Interface for node visitor classes.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
interface NodeVisitorInterface
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Called before child nodes are visited.
|
23 |
+
*
|
24 |
+
* @return \Twig_NodeInterface The modified node
|
25 |
+
*/
|
26 |
+
public function enterNode(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env);
|
27 |
+
/**
|
28 |
+
* Called after child nodes are visited.
|
29 |
+
*
|
30 |
+
* @return \Twig_NodeInterface|false|null The modified node or null if the node must be removed
|
31 |
+
*/
|
32 |
+
public function leaveNode(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env);
|
33 |
+
/**
|
34 |
+
* Returns the priority for this visitor.
|
35 |
+
*
|
36 |
+
* Priority should be between -10 and 10 (0 is the default).
|
37 |
+
*
|
38 |
+
* @return int The priority level
|
39 |
+
*/
|
40 |
+
public function getPriority();
|
41 |
+
}
|
42 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\NodeVisitorInterface', 'WPML\\Core\\Twig_NodeVisitorInterface');
|
43 |
+
// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
|
44 |
+
\class_exists('WPML\\Core\\Twig\\Environment');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/OptimizerNodeVisitor.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\BlockReferenceNode;
|
15 |
+
use WPML\Core\Twig\Node\BodyNode;
|
16 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
17 |
+
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
18 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\FunctionExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
22 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
23 |
+
use WPML\Core\Twig\Node\Expression\ParentExpression;
|
24 |
+
use WPML\Core\Twig\Node\Expression\TempNameExpression;
|
25 |
+
use WPML\Core\Twig\Node\ForNode;
|
26 |
+
use WPML\Core\Twig\Node\IncludeNode;
|
27 |
+
use WPML\Core\Twig\Node\Node;
|
28 |
+
use WPML\Core\Twig\Node\PrintNode;
|
29 |
+
use WPML\Core\Twig\Node\SetTempNode;
|
30 |
+
/**
|
31 |
+
* Tries to optimize the AST.
|
32 |
+
*
|
33 |
+
* This visitor is always the last registered one.
|
34 |
+
*
|
35 |
+
* You can configure which optimizations you want to activate via the
|
36 |
+
* optimizer mode.
|
37 |
+
*
|
38 |
+
* @final
|
39 |
+
*
|
40 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
41 |
+
*/
|
42 |
+
class OptimizerNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
43 |
+
{
|
44 |
+
const OPTIMIZE_ALL = -1;
|
45 |
+
const OPTIMIZE_NONE = 0;
|
46 |
+
const OPTIMIZE_FOR = 2;
|
47 |
+
const OPTIMIZE_RAW_FILTER = 4;
|
48 |
+
const OPTIMIZE_VAR_ACCESS = 8;
|
49 |
+
protected $loops = [];
|
50 |
+
protected $loopsTargets = [];
|
51 |
+
protected $optimizers;
|
52 |
+
protected $prependedNodes = [];
|
53 |
+
protected $inABody = \false;
|
54 |
+
/**
|
55 |
+
* @param int $optimizers The optimizer mode
|
56 |
+
*/
|
57 |
+
public function __construct($optimizers = -1)
|
58 |
+
{
|
59 |
+
if (!\is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) {
|
60 |
+
throw new \InvalidArgumentException(\sprintf('Optimizer mode "%s" is not valid.', $optimizers));
|
61 |
+
}
|
62 |
+
$this->optimizers = $optimizers;
|
63 |
+
}
|
64 |
+
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
65 |
+
{
|
66 |
+
if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
|
67 |
+
$this->enterOptimizeFor($node, $env);
|
68 |
+
}
|
69 |
+
if (\PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')) {
|
70 |
+
if ($this->inABody) {
|
71 |
+
if (!$node instanceof \WPML\Core\Twig\Node\Expression\AbstractExpression) {
|
72 |
+
if ('Twig_Node' !== \get_class($node)) {
|
73 |
+
\array_unshift($this->prependedNodes, []);
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
$node = $this->optimizeVariables($node, $env);
|
77 |
+
}
|
78 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\BodyNode) {
|
79 |
+
$this->inABody = \true;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return $node;
|
83 |
+
}
|
84 |
+
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
85 |
+
{
|
86 |
+
$expression = $node instanceof \WPML\Core\Twig\Node\Expression\AbstractExpression;
|
87 |
+
if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) {
|
88 |
+
$this->leaveOptimizeFor($node, $env);
|
89 |
+
}
|
90 |
+
if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) {
|
91 |
+
$node = $this->optimizeRawFilter($node, $env);
|
92 |
+
}
|
93 |
+
$node = $this->optimizePrintNode($node, $env);
|
94 |
+
if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')) {
|
95 |
+
if ($node instanceof \WPML\Core\Twig\Node\BodyNode) {
|
96 |
+
$this->inABody = \false;
|
97 |
+
} elseif ($this->inABody) {
|
98 |
+
if (!$expression && 'Twig_Node' !== \get_class($node) && ($prependedNodes = \array_shift($this->prependedNodes))) {
|
99 |
+
$nodes = [];
|
100 |
+
foreach (\array_unique($prependedNodes) as $name) {
|
101 |
+
$nodes[] = new \WPML\Core\Twig\Node\SetTempNode($name, $node->getTemplateLine());
|
102 |
+
}
|
103 |
+
$nodes[] = $node;
|
104 |
+
$node = new \WPML\Core\Twig\Node\Node($nodes);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
return $node;
|
109 |
+
}
|
110 |
+
protected function optimizeVariables(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
111 |
+
{
|
112 |
+
if ('Twig_Node_Expression_Name' === \get_class($node) && $node->isSimple()) {
|
113 |
+
$this->prependedNodes[0][] = $node->getAttribute('name');
|
114 |
+
return new \WPML\Core\Twig\Node\Expression\TempNameExpression($node->getAttribute('name'), $node->getTemplateLine());
|
115 |
+
}
|
116 |
+
return $node;
|
117 |
+
}
|
118 |
+
/**
|
119 |
+
* Optimizes print nodes.
|
120 |
+
*
|
121 |
+
* It replaces:
|
122 |
+
*
|
123 |
+
* * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
|
124 |
+
*
|
125 |
+
* @return \Twig_NodeInterface
|
126 |
+
*/
|
127 |
+
protected function optimizePrintNode(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
128 |
+
{
|
129 |
+
if (!$node instanceof \WPML\Core\Twig\Node\PrintNode) {
|
130 |
+
return $node;
|
131 |
+
}
|
132 |
+
$exprNode = $node->getNode('expr');
|
133 |
+
if ($exprNode instanceof \WPML\Core\Twig\Node\Expression\BlockReferenceExpression || $exprNode instanceof \WPML\Core\Twig\Node\Expression\ParentExpression) {
|
134 |
+
$exprNode->setAttribute('output', \true);
|
135 |
+
return $exprNode;
|
136 |
+
}
|
137 |
+
return $node;
|
138 |
+
}
|
139 |
+
/**
|
140 |
+
* Removes "raw" filters.
|
141 |
+
*
|
142 |
+
* @return \Twig_NodeInterface
|
143 |
+
*/
|
144 |
+
protected function optimizeRawFilter(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
145 |
+
{
|
146 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression && 'raw' == $node->getNode('filter')->getAttribute('value')) {
|
147 |
+
return $node->getNode('node');
|
148 |
+
}
|
149 |
+
return $node;
|
150 |
+
}
|
151 |
+
/**
|
152 |
+
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
|
153 |
+
*/
|
154 |
+
protected function enterOptimizeFor(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
155 |
+
{
|
156 |
+
if ($node instanceof \WPML\Core\Twig\Node\ForNode) {
|
157 |
+
// disable the loop variable by default
|
158 |
+
$node->setAttribute('with_loop', \false);
|
159 |
+
\array_unshift($this->loops, $node);
|
160 |
+
\array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name'));
|
161 |
+
\array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name'));
|
162 |
+
} elseif (!$this->loops) {
|
163 |
+
// we are outside a loop
|
164 |
+
return;
|
165 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression && 'loop' === $node->getAttribute('name')) {
|
166 |
+
$node->setAttribute('always_defined', \true);
|
167 |
+
$this->addLoopToCurrent();
|
168 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\NameExpression && \in_array($node->getAttribute('name'), $this->loopsTargets)) {
|
169 |
+
$node->setAttribute('always_defined', \true);
|
170 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\BlockReferenceNode || $node instanceof \WPML\Core\Twig\Node\Expression\BlockReferenceExpression) {
|
171 |
+
$this->addLoopToCurrent();
|
172 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\IncludeNode && !$node->getAttribute('only')) {
|
173 |
+
$this->addLoopToAll();
|
174 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression && 'include' === $node->getAttribute('name') && (!$node->getNode('arguments')->hasNode('with_context') || \false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value'))) {
|
175 |
+
$this->addLoopToAll();
|
176 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression && (!$node->getNode('attribute') instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression || 'parent' === $node->getNode('attribute')->getAttribute('value')) && (\true === $this->loops[0]->getAttribute('with_loop') || $node->getNode('node') instanceof \WPML\Core\Twig\Node\Expression\NameExpression && 'loop' === $node->getNode('node')->getAttribute('name'))) {
|
177 |
+
$this->addLoopToAll();
|
178 |
+
}
|
179 |
+
}
|
180 |
+
/**
|
181 |
+
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
|
182 |
+
*/
|
183 |
+
protected function leaveOptimizeFor(\WPML\Core\Twig_NodeInterface $node, \WPML\Core\Twig\Environment $env)
|
184 |
+
{
|
185 |
+
if ($node instanceof \WPML\Core\Twig\Node\ForNode) {
|
186 |
+
\array_shift($this->loops);
|
187 |
+
\array_shift($this->loopsTargets);
|
188 |
+
\array_shift($this->loopsTargets);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
protected function addLoopToCurrent()
|
192 |
+
{
|
193 |
+
$this->loops[0]->setAttribute('with_loop', \true);
|
194 |
+
}
|
195 |
+
protected function addLoopToAll()
|
196 |
+
{
|
197 |
+
foreach ($this->loops as $loop) {
|
198 |
+
$loop->setAttribute('with_loop', \true);
|
199 |
+
}
|
200 |
+
}
|
201 |
+
public function getPriority()
|
202 |
+
{
|
203 |
+
return 255;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\OptimizerNodeVisitor', 'WPML\\Core\\Twig_NodeVisitor_Optimizer');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
15 |
+
use WPML\Core\Twig\Node\Expression\ConditionalExpression;
|
16 |
+
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
17 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
18 |
+
use WPML\Core\Twig\Node\Expression\FunctionExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\MethodCallExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
22 |
+
use WPML\Core\Twig\Node\Expression\ParentExpression;
|
23 |
+
use WPML\Core\Twig\Node\Node;
|
24 |
+
/**
|
25 |
+
* @final
|
26 |
+
*/
|
27 |
+
class SafeAnalysisNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
28 |
+
{
|
29 |
+
protected $data = [];
|
30 |
+
protected $safeVars = [];
|
31 |
+
public function setSafeVars($safeVars)
|
32 |
+
{
|
33 |
+
$this->safeVars = $safeVars;
|
34 |
+
}
|
35 |
+
public function getSafe(\WPML\Core\Twig_NodeInterface $node)
|
36 |
+
{
|
37 |
+
$hash = \spl_object_hash($node);
|
38 |
+
if (!isset($this->data[$hash])) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
foreach ($this->data[$hash] as $bucket) {
|
42 |
+
if ($bucket['key'] !== $node) {
|
43 |
+
continue;
|
44 |
+
}
|
45 |
+
if (\in_array('html_attr', $bucket['value'])) {
|
46 |
+
$bucket['value'][] = 'html';
|
47 |
+
}
|
48 |
+
return $bucket['value'];
|
49 |
+
}
|
50 |
+
}
|
51 |
+
protected function setSafe(\WPML\Core\Twig_NodeInterface $node, array $safe)
|
52 |
+
{
|
53 |
+
$hash = \spl_object_hash($node);
|
54 |
+
if (isset($this->data[$hash])) {
|
55 |
+
foreach ($this->data[$hash] as &$bucket) {
|
56 |
+
if ($bucket['key'] === $node) {
|
57 |
+
$bucket['value'] = $safe;
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
$this->data[$hash][] = ['key' => $node, 'value' => $safe];
|
63 |
+
}
|
64 |
+
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
65 |
+
{
|
66 |
+
return $node;
|
67 |
+
}
|
68 |
+
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
69 |
+
{
|
70 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
71 |
+
// constants are marked safe for all
|
72 |
+
$this->setSafe($node, ['all']);
|
73 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\BlockReferenceExpression) {
|
74 |
+
// blocks are safe by definition
|
75 |
+
$this->setSafe($node, ['all']);
|
76 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\ParentExpression) {
|
77 |
+
// parent block is safe by definition
|
78 |
+
$this->setSafe($node, ['all']);
|
79 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\ConditionalExpression) {
|
80 |
+
// intersect safeness of both operands
|
81 |
+
$safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3')));
|
82 |
+
$this->setSafe($node, $safe);
|
83 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
|
84 |
+
// filter expression is safe when the filter is safe
|
85 |
+
$name = $node->getNode('filter')->getAttribute('value');
|
86 |
+
$args = $node->getNode('arguments');
|
87 |
+
if (\false !== ($filter = $env->getFilter($name))) {
|
88 |
+
$safe = $filter->getSafe($args);
|
89 |
+
if (null === $safe) {
|
90 |
+
$safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety());
|
91 |
+
}
|
92 |
+
$this->setSafe($node, $safe);
|
93 |
+
} else {
|
94 |
+
$this->setSafe($node, []);
|
95 |
+
}
|
96 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression) {
|
97 |
+
// function expression is safe when the function is safe
|
98 |
+
$name = $node->getAttribute('name');
|
99 |
+
$args = $node->getNode('arguments');
|
100 |
+
$function = $env->getFunction($name);
|
101 |
+
if (\false !== $function) {
|
102 |
+
$this->setSafe($node, $function->getSafe($args));
|
103 |
+
} else {
|
104 |
+
$this->setSafe($node, []);
|
105 |
+
}
|
106 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\MethodCallExpression) {
|
107 |
+
if ($node->getAttribute('safe')) {
|
108 |
+
$this->setSafe($node, ['all']);
|
109 |
+
} else {
|
110 |
+
$this->setSafe($node, []);
|
111 |
+
}
|
112 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
113 |
+
$name = $node->getNode('node')->getAttribute('name');
|
114 |
+
// attributes on template instances are safe
|
115 |
+
if ('_self' == $name || \in_array($name, $this->safeVars)) {
|
116 |
+
$this->setSafe($node, ['all']);
|
117 |
+
} else {
|
118 |
+
$this->setSafe($node, []);
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$this->setSafe($node, []);
|
122 |
+
}
|
123 |
+
return $node;
|
124 |
+
}
|
125 |
+
protected function intersectSafe(array $a = null, array $b = null)
|
126 |
+
{
|
127 |
+
if (null === $a || null === $b) {
|
128 |
+
return [];
|
129 |
+
}
|
130 |
+
if (\in_array('all', $a)) {
|
131 |
+
return $b;
|
132 |
+
}
|
133 |
+
if (\in_array('all', $b)) {
|
134 |
+
return $a;
|
135 |
+
}
|
136 |
+
return \array_intersect($a, $b);
|
137 |
+
}
|
138 |
+
public function getPriority()
|
139 |
+
{
|
140 |
+
return 0;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\SafeAnalysisNodeVisitor', 'WPML\\Core\\Twig_NodeVisitor_SafeAnalysis');
|
addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SandboxNodeVisitor.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\CheckSecurityNode;
|
15 |
+
use WPML\Core\Twig\Node\CheckToStringNode;
|
16 |
+
use WPML\Core\Twig\Node\Expression\Binary\ConcatBinary;
|
17 |
+
use WPML\Core\Twig\Node\Expression\Binary\RangeBinary;
|
18 |
+
use WPML\Core\Twig\Node\Expression\FilterExpression;
|
19 |
+
use WPML\Core\Twig\Node\Expression\FunctionExpression;
|
20 |
+
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
21 |
+
use WPML\Core\Twig\Node\Expression\NameExpression;
|
22 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
23 |
+
use WPML\Core\Twig\Node\Node;
|
24 |
+
use WPML\Core\Twig\Node\PrintNode;
|
25 |
+
use WPML\Core\Twig\Node\SetNode;
|
26 |
+
/**
|
27 |
+
* @final
|
28 |
+
*
|
29 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
30 |
+
*/
|
31 |
+
class SandboxNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
32 |
+
{
|
33 |
+
protected $inAModule = \false;
|
34 |
+
protected $tags;
|
35 |
+
protected $filters;
|
36 |
+
protected $functions;
|
37 |
+
private $needsToStringWrap = \false;
|
38 |
+
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
39 |
+
{
|
40 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
41 |
+
$this->inAModule = \true;
|
42 |
+
$this->tags = [];
|
43 |
+
$this->filters = [];
|
44 |
+
$this->functions = [];
|
45 |
+
return $node;
|
46 |
+
} elseif ($this->inAModule) {
|
47 |
+
// look for tags
|
48 |
+
if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) {
|
49 |
+
$this->tags[$node->getNodeTag()] = $node;
|
50 |
+
}
|
51 |
+
// look for filters
|
52 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) {
|
53 |
+
$this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
|
54 |
+
}
|
55 |
+
// look for functions
|
56 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) {
|
57 |
+
$this->functions[$node->getAttribute('name')] = $node;
|
58 |
+
}
|
59 |
+
// the .. operator is equivalent to the range() function
|
60 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\Binary\RangeBinary && !isset($this->functions['range'])) {
|
61 |
+
$this->functions['range'] = $node;
|
62 |
+
}
|
63 |
+
if ($node instanceof \WPML\Core\Twig\Node\PrintNode) {
|
64 |
+
$this->needsToStringWrap = \true;
|
65 |
+
$this->wrapNode($node, 'expr');
|
66 |
+
}
|
67 |
+
if ($node instanceof \WPML\Core\Twig\Node\SetNode && !$node->getAttribute('capture')) {
|
68 |
+
$this->needsToStringWrap = \true;
|
69 |
+
}
|
70 |
+
// wrap outer nodes that can implicitly call __toString()
|
71 |
+
if ($this->needsToStringWrap) {
|
72 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\Binary\ConcatBinary) {
|
73 |
+
$this->wrapNode($node, 'left');
|
74 |
+
$this->wrapNode($node, 'right');
|
75 |
+
}
|
76 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
|
77 |
+
$this->wrapNode($node, 'node');
|
78 |
+
$this->wrapArrayNode($node, 'arguments');
|
79 |
+
}
|
80 |
+
if ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression) {
|
81 |
+
$this->wrapArrayNode($node, 'arguments');
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
return $node;
|
86 |
+
}
|
87 |
+
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
88 |
+
{
|
89 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
90 |
+
$this->inAModule = \false;
|
91 |
+
$node->getNode('constructor_end')->setNode('_security_check', new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')]));
|
92 |
+
} elseif ($this->inAModule) {
|
93 |
+
if ($node instanceof \WPML\Core\Twig\Node\PrintNode || $node instanceof \WPML\Core\Twig\Node\SetNode) {
|
94 |
+
$this->needsToStringWrap = \false;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
return $node;
|
98 |
+
}
|
99 |
+
private function wrapNode(\WPML\Core\Twig\Node\Node $node, $name)
|
100 |
+
{
|
101 |
+
$expr = $node->getNode($name);
|
102 |
+
if ($expr instanceof \WPML\Core\Twig\Node\Expression\NameExpression || $expr instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression) {
|
103 |
+
$node->setNode($name, new \WPML\Core\Twig\Node\CheckToStringNode($expr));
|
104 |
+
}
|
105 |
+
}
|
106 |
+
private function wrapArrayNode(\WPML\Core\Twig\Node\Node $node, $name)
|
107 |
+
{
|
108 |
+
$args = $node->getNode($name);
|
109 |
+
foreach ($args as $name => $_) {
|
110 |
+
$this->wrapNode($args, $name);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
public function getPriority()
|
114 |
+
{
|
115 |
+
return 0;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\SandboxNodeVisitor', 'WPML\\Core\\Twig_NodeVisitor_Sandbox');
|
addons/wpml-dependencies/lib/lib/twig/src/Parser.php
ADDED
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
+
use WPML\Core\Twig\Node\BlockNode;
|
16 |
+
use WPML\Core\Twig\Node\BlockReferenceNode;
|
17 |
+
use WPML\Core\Twig\Node\BodyNode;
|
18 |
+
use WPML\Core\Twig\Node\Expression\AbstractExpression;
|
19 |
+
use WPML\Core\Twig\Node\MacroNode;
|
20 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
21 |
+
use WPML\Core\Twig\Node\Node;
|
22 |
+
use WPML\Core\Twig\Node\NodeCaptureInterface;
|
23 |
+
use WPML\Core\Twig\Node\NodeOutputInterface;
|
24 |
+
use WPML\Core\Twig\Node\PrintNode;
|
25 |
+
use WPML\Core\Twig\Node\TextNode;
|
26 |
+
use WPML\Core\Twig\NodeVisitor\NodeVisitorInterface;
|
27 |
+
use WPML\Core\Twig\TokenParser\TokenParserInterface;
|
28 |
+
/**
|
29 |
+
* Default parser implementation.
|
30 |
+
*
|
31 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
32 |
+
*/
|
33 |
+
class Parser implements \WPML\Core\Twig_ParserInterface
|
34 |
+
{
|
35 |
+
protected $stack = [];
|
36 |
+
protected $stream;
|
37 |
+
protected $parent;
|
38 |
+
protected $handlers;
|
39 |
+
protected $visitors;
|
40 |
+
protected $expressionParser;
|
41 |
+
protected $blocks;
|
42 |
+
protected $blockStack;
|
43 |
+
protected $macros;
|
44 |
+
protected $env;
|
45 |
+
protected $reservedMacroNames;
|
46 |
+
protected $importedSymbols;
|
47 |
+
protected $traits;
|
48 |
+
protected $embeddedTemplates = [];
|
49 |
+
private $varNameSalt = 0;
|
50 |
+
public function __construct(\WPML\Core\Twig\Environment $env)
|
51 |
+
{
|
52 |
+
$this->env = $env;
|
53 |
+
}
|
54 |
+
/**
|
55 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
56 |
+
*/
|
57 |
+
public function getEnvironment()
|
58 |
+
{
|
59 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
60 |
+
return $this->env;
|
61 |
+
}
|
62 |
+
public function getVarName()
|
63 |
+
{
|
64 |
+
return \sprintf('__internal_%s', \hash('sha256', __METHOD__ . $this->stream->getSourceContext()->getCode() . $this->varNameSalt++));
|
65 |
+
}
|
66 |
+
/**
|
67 |
+
* @deprecated since 1.27 (to be removed in 2.0). Use $parser->getStream()->getSourceContext()->getPath() instead.
|
68 |
+
*/
|
69 |
+
public function getFilename()
|
70 |
+
{
|
71 |
+
@\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);
|
72 |
+
return $this->stream->getSourceContext()->getName();
|
73 |
+
}
|
74 |
+
public function parse(\WPML\Core\Twig\TokenStream $stream, $test = null, $dropNeedle = \false)
|
75 |
+
{
|
76 |
+
// push all variables into the stack to keep the current state of the parser
|
77 |
+
// using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336
|
78 |
+
// This hack can be removed when min version if PHP 7.0
|
79 |
+
$vars = [];
|
80 |
+
foreach ($this as $k => $v) {
|
81 |
+
$vars[$k] = $v;
|
82 |
+
}
|
83 |
+
unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']);
|
84 |
+
$this->stack[] = $vars;
|
85 |
+
// tag handlers
|
86 |
+
if (null === $this->handlers) {
|
87 |
+
$this->handlers = $this->env->getTokenParsers();
|
88 |
+
$this->handlers->setParser($this);
|
89 |
+
}
|
90 |
+
// node visitors
|
91 |
+
if (null === $this->visitors) {
|
92 |
+
$this->visitors = $this->env->getNodeVisitors();
|
93 |
+
}
|
94 |
+
if (null === $this->expressionParser) {
|
95 |
+
$this->expressionParser = new \WPML\Core\Twig\ExpressionParser($this, $this->env);
|
96 |
+
}
|
97 |
+
$this->stream = $stream;
|
98 |
+
$this->parent = null;
|
99 |
+
$this->blocks = [];
|
100 |
+
$this->macros = [];
|
101 |
+
$this->traits = [];
|
102 |
+
$this->blockStack = [];
|
103 |
+
$this->importedSymbols = [[]];
|
104 |
+
$this->embeddedTemplates = [];
|
105 |
+
$this->varNameSalt = 0;
|
106 |
+
try {
|
107 |
+
$body = $this->subparse($test, $dropNeedle);
|
108 |
+
if (null !== $this->parent && null === ($body = $this->filterBodyNodes($body))) {
|
109 |
+
$body = new \WPML\Core\Twig\Node\Node();
|
110 |
+
}
|
111 |
+
} catch (\WPML\Core\Twig\Error\SyntaxError $e) {
|
112 |
+
if (!$e->getSourceContext()) {
|
113 |
+
$e->setSourceContext($this->stream->getSourceContext());
|
114 |
+
}
|
115 |
+
if (!$e->getTemplateLine()) {
|
116 |
+
$e->setTemplateLine($this->stream->getCurrent()->getLine());
|
117 |
+
}
|
118 |
+
throw $e;
|
119 |
+
}
|
120 |
+
$node = new \WPML\Core\Twig\Node\ModuleNode(new \WPML\Core\Twig\Node\BodyNode([$body]), $this->parent, new \WPML\Core\Twig\Node\Node($this->blocks), new \WPML\Core\Twig\Node\Node($this->macros), new \WPML\Core\Twig\Node\Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext());
|
121 |
+
$traverser = new \WPML\Core\Twig\NodeTraverser($this->env, $this->visitors);
|
122 |
+
$node = $traverser->traverse($node);
|
123 |
+
// restore previous stack so previous parse() call can resume working
|
124 |
+
foreach (\array_pop($this->stack) as $key => $val) {
|
125 |
+
$this->{$key} = $val;
|
126 |
+
}
|
127 |
+
return $node;
|
128 |
+
}
|
129 |
+
public function subparse($test, $dropNeedle = \false)
|
130 |
+
{
|
131 |
+
$lineno = $this->getCurrentToken()->getLine();
|
132 |
+
$rv = [];
|
133 |
+
while (!$this->stream->isEOF()) {
|
134 |
+
switch ($this->getCurrentToken()->getType()) {
|
135 |
+
case \WPML\Core\Twig\Token::TEXT_TYPE:
|
136 |
+
$token = $this->stream->next();
|
137 |
+
$rv[] = new \WPML\Core\Twig\Node\TextNode($token->getValue(), $token->getLine());
|
138 |
+
break;
|
139 |
+
case \WPML\Core\Twig\Token::VAR_START_TYPE:
|
140 |
+
$token = $this->stream->next();
|
141 |
+
$expr = $this->expressionParser->parseExpression();
|
142 |
+
$this->stream->expect(\WPML\Core\Twig\Token::VAR_END_TYPE);
|
143 |
+
$rv[] = new \WPML\Core\Twig\Node\PrintNode($expr, $token->getLine());
|
144 |
+
break;
|
145 |
+
case \WPML\Core\Twig\Token::BLOCK_START_TYPE:
|
146 |
+
$this->stream->next();
|
147 |
+
$token = $this->getCurrentToken();
|
148 |
+
if (\WPML\Core\Twig\Token::NAME_TYPE !== $token->getType()) {
|
149 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext());
|
150 |
+
}
|
151 |
+
if (null !== $test && \call_user_func($test, $token)) {
|
152 |
+
if ($dropNeedle) {
|
153 |
+
$this->stream->next();
|
154 |
+
}
|
155 |
+
if (1 === \count($rv)) {
|
156 |
+
return $rv[0];
|
157 |
+
}
|
158 |
+
return new \WPML\Core\Twig\Node\Node($rv, [], $lineno);
|
159 |
+
}
|
160 |
+
$subparser = $this->handlers->getTokenParser($token->getValue());
|
161 |
+
if (null === $subparser) {
|
162 |
+
if (null !== $test) {
|
163 |
+
$e = new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
|
164 |
+
if (\is_array($test) && isset($test[0]) && $test[0] instanceof \WPML\Core\Twig\TokenParser\TokenParserInterface) {
|
165 |
+
$e->appendMessage(\sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno));
|
166 |
+
}
|
167 |
+
} else {
|
168 |
+
$e = new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext());
|
169 |
+
$e->addSuggestions($token->getValue(), \array_keys($this->env->getTags()));
|
170 |
+
}
|
171 |
+
throw $e;
|
172 |
+
}
|
173 |
+
$this->stream->next();
|
174 |
+
$node = $subparser->parse($token);
|
175 |
+
if (null !== $node) {
|
176 |
+
$rv[] = $node;
|
177 |
+
}
|
178 |
+
break;
|
179 |
+
default:
|
180 |
+
throw new \WPML\Core\Twig\Error\SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext());
|
181 |
+
}
|
182 |
+
}
|
183 |
+
if (1 === \count($rv)) {
|
184 |
+
return $rv[0];
|
185 |
+
}
|
186 |
+
return new \WPML\Core\Twig\Node\Node($rv, [], $lineno);
|
187 |
+
}
|
188 |
+
/**
|
189 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
190 |
+
*/
|
191 |
+
public function addHandler($name, $class)
|
192 |
+
{
|
193 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
194 |
+
$this->handlers[$name] = $class;
|
195 |
+
}
|
196 |
+
/**
|
197 |
+
* @deprecated since 1.27 (to be removed in 2.0)
|
198 |
+
*/
|
199 |
+
public function addNodeVisitor(\WPML\Core\Twig\NodeVisitor\NodeVisitorInterface $visitor)
|
200 |
+
{
|
201 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
202 |
+
$this->visitors[] = $visitor;
|
203 |
+
}
|
204 |
+
public function getBlockStack()
|
205 |
+
{
|
206 |
+
return $this->blockStack;
|
207 |
+
}
|
208 |
+
public function peekBlockStack()
|
209 |
+
{
|
210 |
+
return isset($this->blockStack[\count($this->blockStack) - 1]) ? $this->blockStack[\count($this->blockStack) - 1] : null;
|
211 |
+
}
|
212 |
+
public function popBlockStack()
|
213 |
+
{
|
214 |
+
\array_pop($this->blockStack);
|
215 |
+
}
|
216 |
+
public function pushBlockStack($name)
|
217 |
+
{
|
218 |
+
$this->blockStack[] = $name;
|
219 |
+
}
|
220 |
+
public function hasBlock($name)
|
221 |
+
{
|
222 |
+
return isset($this->blocks[$name]);
|
223 |
+
}
|
224 |
+
public function getBlock($name)
|
225 |
+
{
|
226 |
+
return $this->blocks[$name];
|
227 |
+
}
|
228 |
+
public function setBlock($name, \WPML\Core\Twig\Node\BlockNode $value)
|
229 |
+
{
|
230 |
+
$this->blocks[$name] = new \WPML\Core\Twig\Node\BodyNode([$value], [], $value->getTemplateLine());
|
231 |
+
}
|
232 |
+
public function hasMacro($name)
|
233 |
+
{
|
234 |
+
return isset($this->macros[$name]);
|
235 |
+
}
|
236 |
+
public function setMacro($name, \WPML\Core\Twig\Node\MacroNode $node)
|
237 |
+
{
|
238 |
+
if ($this->isReservedMacroName($name)) {
|
239 |
+
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext());
|
240 |
+
}
|
241 |
+
$this->macros[$name] = $node;
|
242 |
+
}
|
243 |
+
public function isReservedMacroName($name)
|
244 |
+
{
|
245 |
+
if (null === $this->reservedMacroNames) {
|
246 |
+
$this->reservedMacroNames = [];
|
247 |
+
$r = new \ReflectionClass($this->env->getBaseTemplateClass());
|
248 |
+
foreach ($r->getMethods() as $method) {
|
249 |
+
$methodName = \strtolower($method->getName());
|
250 |
+
if ('get' === \substr($methodName, 0, 3) && isset($methodName[3])) {
|
251 |
+
$this->reservedMacroNames[] = \substr($methodName, 3);
|
252 |
+
}
|
253 |
+
}
|
254 |
+
}
|
255 |
+
return \in_array(\strtolower($name), $this->reservedMacroNames);
|
256 |
+
}
|
257 |
+
public function addTrait($trait)
|
258 |
+
{
|
259 |
+
$this->traits[] = $trait;
|
260 |
+
}
|
261 |
+
public function hasTraits()
|
262 |
+
{
|
263 |
+
return \count($this->traits) > 0;
|
264 |
+
}
|
265 |
+
public function embedTemplate(\WPML\Core\Twig\Node\ModuleNode $template)
|
266 |
+
{
|
267 |
+
$template->setIndex(\mt_rand());
|
268 |
+
$this->embeddedTemplates[] = $template;
|
269 |
+
}
|
270 |
+
public function addImportedSymbol($type, $alias, $name = null, \WPML\Core\Twig\Node\Expression\AbstractExpression $node = null)
|
271 |
+
{
|
272 |
+
$this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node];
|
273 |
+
}
|
274 |
+
public function getImportedSymbol($type, $alias)
|
275 |
+
{
|
276 |
+
if (null !== $this->peekBlockStack()) {
|
277 |
+
foreach ($this->importedSymbols as $functions) {
|
278 |
+
if (isset($functions[$type][$alias])) {
|
279 |
+
if (\count($this->blockStack) > 1) {
|
280 |
+
return null;
|
281 |
+
}
|
282 |
+
return $functions[$type][$alias];
|
283 |
+
}
|
284 |
+
}
|
285 |
+
} else {
|
286 |
+
return isset($this->importedSymbols[0][$type][$alias]) ? $this->importedSymbols[0][$type][$alias] : null;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
public function isMainScope()
|
290 |
+
{
|
291 |
+
return 1 === \count($this->importedSymbols);
|
292 |
+
}
|
293 |
+
public function pushLocalScope()
|
294 |
+
{
|
295 |
+
\array_unshift($this->importedSymbols, []);
|
296 |
+
}
|
297 |
+
public function popLocalScope()
|
298 |
+
{
|
299 |
+
\array_shift($this->importedSymbols);
|
300 |
+
}
|
301 |
+
/**
|
302 |
+
* @return ExpressionParser
|
303 |
+
*/
|
304 |
+
public function getExpressionParser()
|
305 |
+
{
|
306 |
+
return $this->expressionParser;
|
307 |
+
}
|
308 |
+
public function getParent()
|
309 |
+
{
|
310 |
+
return $this->parent;
|
311 |
+
}
|
312 |
+
public function setParent($parent)
|
313 |
+
{
|
314 |
+
$this->parent = $parent;
|
315 |
+
}
|
316 |
+
/**
|
317 |
+
* @return TokenStream
|
318 |
+
*/
|
319 |
+
public function getStream()
|
320 |
+
{
|
321 |
+
return $this->stream;
|
322 |
+
}
|
323 |
+
/**
|
324 |
+
* @return Token
|
325 |
+
*/
|
326 |
+
public function getCurrentToken()
|
327 |
+
{
|
328 |
+
return $this->stream->getCurrent();
|
329 |
+
}
|
330 |
+
protected function filterBodyNodes(\WPML\Core\Twig_NodeInterface $node)
|
331 |
+
{
|
332 |
+
// check that the body does not contain non-empty output nodes
|
333 |
+
if ($node instanceof \WPML\Core\Twig\Node\TextNode && !\ctype_space($node->getAttribute('data')) || !$node instanceof \WPML\Core\Twig\Node\TextNode && !$node instanceof \WPML\Core\Twig\Node\BlockReferenceNode && $node instanceof \WPML\Core\Twig\Node\NodeOutputInterface) {
|
334 |
+
if (\false !== \strpos((string) $node, \chr(0xef) . \chr(0xbb) . \chr(0xbf))) {
|
335 |
+
$t = \substr($node->getAttribute('data'), 3);
|
336 |
+
if ('' === $t || \ctype_space($t)) {
|
337 |
+
// bypass empty nodes starting with a BOM
|
338 |
+
return;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
throw new \WPML\Core\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?', $node->getTemplateLine(), $this->stream->getSourceContext());
|
342 |
+
}
|
343 |
+
// bypass nodes that will "capture" the output
|
344 |
+
if ($node instanceof \WPML\Core\Twig\Node\NodeCaptureInterface) {
|
345 |
+
return $node;
|
346 |
+
}
|
347 |
+
if ($node instanceof \WPML\Core\Twig\Node\NodeOutputInterface) {
|
348 |
+
return;
|
349 |
+
}
|
350 |
+
foreach ($node as $k => $n) {
|
351 |
+
if (null !== $n && null === $this->filterBodyNodes($n)) {
|
352 |
+
$node->removeNode($k);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
return $node;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
\class_alias('WPML\\Core\\Twig\\Parser', 'WPML\\Core\\Twig_Parser');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BaseDumper.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Dumper;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Profiler\Profile;
|
14 |
+
/**
|
15 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
+
*/
|
17 |
+
abstract class BaseDumper
|
18 |
+
{
|
19 |
+
private $root;
|
20 |
+
public function dump(\WPML\Core\Twig\Profiler\Profile $profile)
|
21 |
+
{
|
22 |
+
return $this->dumpProfile($profile);
|
23 |
+
}
|
24 |
+
protected abstract function formatTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix);
|
25 |
+
protected abstract function formatNonTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix);
|
26 |
+
protected abstract function formatTime(\WPML\Core\Twig\Profiler\Profile $profile, $percent);
|
27 |
+
private function dumpProfile(\WPML\Core\Twig\Profiler\Profile $profile, $prefix = '', $sibling = \false)
|
28 |
+
{
|
29 |
+
if ($profile->isRoot()) {
|
30 |
+
$this->root = $profile->getDuration();
|
31 |
+
$start = $profile->getName();
|
32 |
+
} else {
|
33 |
+
if ($profile->isTemplate()) {
|
34 |
+
$start = $this->formatTemplate($profile, $prefix);
|
35 |
+
} else {
|
36 |
+
$start = $this->formatNonTemplate($profile, $prefix);
|
37 |
+
}
|
38 |
+
$prefix .= $sibling ? '│ ' : ' ';
|
39 |
+
}
|
40 |
+
$percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0;
|
41 |
+
if ($profile->getDuration() * 1000 < 1) {
|
42 |
+
$str = $start . "\n";
|
43 |
+
} else {
|
44 |
+
$str = \sprintf("%s %s\n", $start, $this->formatTime($profile, $percent));
|
45 |
+
}
|
46 |
+
$nCount = \count($profile->getProfiles());
|
47 |
+
foreach ($profile as $i => $p) {
|
48 |
+
$str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount);
|
49 |
+
}
|
50 |
+
return $str;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Dumper\\BaseDumper', 'WPML\\Core\\Twig_Profiler_Dumper_Base');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BlackfireDumper.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Dumper;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Profiler\Profile;
|
14 |
+
/**
|
15 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
+
*
|
17 |
+
* @final
|
18 |
+
*/
|
19 |
+
class BlackfireDumper
|
20 |
+
{
|
21 |
+
public function dump(\WPML\Core\Twig\Profiler\Profile $profile)
|
22 |
+
{
|
23 |
+
$data = [];
|
24 |
+
$this->dumpProfile('main()', $profile, $data);
|
25 |
+
$this->dumpChildren('main()', $profile, $data);
|
26 |
+
$start = \sprintf('%f', \microtime(\true));
|
27 |
+
$str = <<<EOF
|
28 |
+
file-format: BlackfireProbe
|
29 |
+
cost-dimensions: wt mu pmu
|
30 |
+
request-start: {$start}
|
31 |
+
|
32 |
+
|
33 |
+
EOF;
|
34 |
+
foreach ($data as $name => $values) {
|
35 |
+
$str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n";
|
36 |
+
}
|
37 |
+
return $str;
|
38 |
+
}
|
39 |
+
private function dumpChildren($parent, \WPML\Core\Twig\Profiler\Profile $profile, &$data)
|
40 |
+
{
|
41 |
+
foreach ($profile as $p) {
|
42 |
+
if ($p->isTemplate()) {
|
43 |
+
$name = $p->getTemplate();
|
44 |
+
} else {
|
45 |
+
$name = \sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName());
|
46 |
+
}
|
47 |
+
$this->dumpProfile(\sprintf('%s==>%s', $parent, $name), $p, $data);
|
48 |
+
$this->dumpChildren($name, $p, $data);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
private function dumpProfile($edge, \WPML\Core\Twig\Profiler\Profile $profile, &$data)
|
52 |
+
{
|
53 |
+
if (isset($data[$edge])) {
|
54 |
+
++$data[$edge]['ct'];
|
55 |
+
$data[$edge]['wt'] += \floor($profile->getDuration() * 1000000);
|
56 |
+
$data[$edge]['mu'] += $profile->getMemoryUsage();
|
57 |
+
$data[$edge]['pmu'] += $profile->getPeakMemoryUsage();
|
58 |
+
} else {
|
59 |
+
$data[$edge] = ['ct' => 1, 'wt' => \floor($profile->getDuration() * 1000000), 'mu' => $profile->getMemoryUsage(), 'pmu' => $profile->getPeakMemoryUsage()];
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Dumper\\BlackfireDumper', 'WPML\\Core\\Twig_Profiler_Dumper_Blackfire');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/HtmlDumper.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Dumper;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Profiler\Profile;
|
14 |
+
/**
|
15 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
+
*
|
17 |
+
* @final
|
18 |
+
*/
|
19 |
+
class HtmlDumper extends \WPML\Core\Twig\Profiler\Dumper\BaseDumper
|
20 |
+
{
|
21 |
+
private static $colors = ['block' => '#dfd', 'macro' => '#ddf', 'template' => '#ffd', 'big' => '#d44'];
|
22 |
+
public function dump(\WPML\Core\Twig\Profiler\Profile $profile)
|
23 |
+
{
|
24 |
+
return '<pre>' . parent::dump($profile) . '</pre>';
|
25 |
+
}
|
26 |
+
protected function formatTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix)
|
27 |
+
{
|
28 |
+
return \sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());
|
29 |
+
}
|
30 |
+
protected function formatNonTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix)
|
31 |
+
{
|
32 |
+
return \sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName());
|
33 |
+
}
|
34 |
+
protected function formatTime(\WPML\Core\Twig\Profiler\Profile $profile, $percent)
|
35 |
+
{
|
36 |
+
return \sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Dumper\\HtmlDumper', 'WPML\\Core\\Twig_Profiler_Dumper_Html');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/TextDumper.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Dumper;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Profiler\Profile;
|
14 |
+
/**
|
15 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
16 |
+
*
|
17 |
+
* @final
|
18 |
+
*/
|
19 |
+
class TextDumper extends \WPML\Core\Twig\Profiler\Dumper\BaseDumper
|
20 |
+
{
|
21 |
+
protected function formatTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix)
|
22 |
+
{
|
23 |
+
return \sprintf('%s└ %s', $prefix, $profile->getTemplate());
|
24 |
+
}
|
25 |
+
protected function formatNonTemplate(\WPML\Core\Twig\Profiler\Profile $profile, $prefix)
|
26 |
+
{
|
27 |
+
return \sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
|
28 |
+
}
|
29 |
+
protected function formatTime(\WPML\Core\Twig\Profiler\Profile $profile, $percent)
|
30 |
+
{
|
31 |
+
return \sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Dumper\\TextDumper', 'WPML\\Core\\Twig_Profiler_Dumper_Text');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/EnterProfileNode.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Represents a profile enter node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class EnterProfileNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
public function __construct($extensionName, $type, $name, $varName)
|
23 |
+
{
|
24 |
+
parent::__construct([], ['extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName]);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->write(\sprintf('$%s = $this->env->getExtension(', $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");
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Node\\EnterProfileNode', 'WPML\\Core\\Twig_Profiler_Node_EnterProfile');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/LeaveProfileNode.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\Node;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Compiler;
|
14 |
+
use WPML\Core\Twig\Node\Node;
|
15 |
+
/**
|
16 |
+
* Represents a profile leave node.
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class LeaveProfileNode extends \WPML\Core\Twig\Node\Node
|
21 |
+
{
|
22 |
+
public function __construct($varName)
|
23 |
+
{
|
24 |
+
parent::__construct([], ['var_name' => $varName]);
|
25 |
+
}
|
26 |
+
public function compile(\WPML\Core\Twig\Compiler $compiler)
|
27 |
+
{
|
28 |
+
$compiler->write("\n")->write(\sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name') . '_prof'));
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Node\\LeaveProfileNode', 'WPML\\Core\\Twig_Profiler_Node_LeaveProfile');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler\NodeVisitor;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Environment;
|
14 |
+
use WPML\Core\Twig\Node\BlockNode;
|
15 |
+
use WPML\Core\Twig\Node\BodyNode;
|
16 |
+
use WPML\Core\Twig\Node\MacroNode;
|
17 |
+
use WPML\Core\Twig\Node\ModuleNode;
|
18 |
+
use WPML\Core\Twig\Node\Node;
|
19 |
+
use WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor;
|
20 |
+
use WPML\Core\Twig\Profiler\Node\EnterProfileNode;
|
21 |
+
use WPML\Core\Twig\Profiler\Node\LeaveProfileNode;
|
22 |
+
use WPML\Core\Twig\Profiler\Profile;
|
23 |
+
/**
|
24 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
25 |
+
*
|
26 |
+
* @final
|
27 |
+
*/
|
28 |
+
class ProfilerNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
|
29 |
+
{
|
30 |
+
private $extensionName;
|
31 |
+
public function __construct($extensionName)
|
32 |
+
{
|
33 |
+
$this->extensionName = $extensionName;
|
34 |
+
}
|
35 |
+
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
36 |
+
{
|
37 |
+
return $node;
|
38 |
+
}
|
39 |
+
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
|
40 |
+
{
|
41 |
+
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
|
42 |
+
$varName = $this->getVarName();
|
43 |
+
$node->setNode('display_start', new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \WPML\Core\Twig\Profiler\Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')]));
|
44 |
+
$node->setNode('display_end', new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Profiler\Node\LeaveProfileNode($varName), $node->getNode('display_end')]));
|
45 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\BlockNode) {
|
46 |
+
$varName = $this->getVarName();
|
47 |
+
$node->setNode('body', new \WPML\Core\Twig\Node\BodyNode([new \WPML\Core\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \WPML\Core\Twig\Profiler\Profile::BLOCK, $node->getAttribute('name'), $varName), $node->getNode('body'), new \WPML\Core\Twig\Profiler\Node\LeaveProfileNode($varName)]));
|
48 |
+
} elseif ($node instanceof \WPML\Core\Twig\Node\MacroNode) {
|
49 |
+
$varName = $this->getVarName();
|
50 |
+
$node->setNode('body', new \WPML\Core\Twig\Node\BodyNode([new \WPML\Core\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \WPML\Core\Twig\Profiler\Profile::MACRO, $node->getAttribute('name'), $varName), $node->getNode('body'), new \WPML\Core\Twig\Profiler\Node\LeaveProfileNode($varName)]));
|
51 |
+
}
|
52 |
+
return $node;
|
53 |
+
}
|
54 |
+
private function getVarName()
|
55 |
+
{
|
56 |
+
return \sprintf('__internal_%s', \hash('sha256', $this->extensionName));
|
57 |
+
}
|
58 |
+
public function getPriority()
|
59 |
+
{
|
60 |
+
return 0;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor', 'WPML\\Core\\Twig_Profiler_NodeVisitor_Profiler');
|
addons/wpml-dependencies/lib/lib/twig/src/Profiler/Profile.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Profiler;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
15 |
+
*
|
16 |
+
* @final
|
17 |
+
*/
|
18 |
+
class Profile implements \IteratorAggregate, \Serializable
|
19 |
+
{
|
20 |
+
const ROOT = 'ROOT';
|
21 |
+
const BLOCK = 'block';
|
22 |
+
const TEMPLATE = 'template';
|
23 |
+
const MACRO = 'macro';
|
24 |
+
private $template;
|
25 |
+
private $name;
|
26 |
+
private $type;
|
27 |
+
private $starts = [];
|
28 |
+
private $ends = [];
|
29 |
+
private $profiles = [];
|
30 |
+
public function __construct($template = 'main', $type = self::ROOT, $name = 'main')
|
31 |
+
{
|
32 |
+
$this->template = $template;
|
33 |
+
$this->type = $type;
|
34 |
+
$this->name = 0 === \strpos($name, '__internal_') ? 'INTERNAL' : $name;
|
35 |
+
$this->enter();
|
36 |
+
}
|
37 |
+
public function getTemplate()
|
38 |
+
{
|
39 |
+
return $this->template;
|
40 |
+
}
|
41 |
+
public function getType()
|
42 |
+
{
|
43 |
+
return $this->type;
|
44 |
+
}
|
45 |
+
public function getName()
|
46 |
+
{
|
47 |
+
return $this->name;
|
48 |
+
}
|
49 |
+
public function isRoot()
|
50 |
+
{
|
51 |
+
return self::ROOT === $this->type;
|
52 |
+
}
|
53 |
+
public function isTemplate()
|
54 |
+
{
|
55 |
+
return self::TEMPLATE === $this->type;
|
56 |
+
}
|
57 |
+
public function isBlock()
|
58 |
+
{
|
59 |
+
return self::BLOCK === $this->type;
|
60 |
+
}
|
61 |
+
public function isMacro()
|
62 |
+
{
|
63 |
+
return self::MACRO === $this->type;
|
64 |
+
}
|
65 |
+
public function getProfiles()
|
66 |
+
{
|
67 |
+
return $this->profiles;
|
68 |
+
}
|
69 |
+
public function addProfile(self $profile)
|
70 |
+
{
|
71 |
+
$this->profiles[] = $profile;
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* Returns the duration in microseconds.
|
75 |
+
*
|
76 |
+
* @return float
|
77 |
+
*/
|
78 |
+
public function getDuration()
|
79 |
+
{
|
80 |
+
if ($this->isRoot() && $this->profiles) {
|
81 |
+
// for the root node with children, duration is the sum of all child durations
|
82 |
+
$duration = 0;
|
83 |
+
foreach ($this->profiles as $profile) {
|
84 |
+
$duration += $profile->getDuration();
|
85 |
+
}
|
86 |
+
return $duration;
|
87 |
+
}
|
88 |
+
return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0;
|
89 |
+
}
|
90 |
+
/**
|
91 |
+
* Returns the memory usage in bytes.
|
92 |
+
*
|
93 |
+
* @return int
|
94 |
+
*/
|
95 |
+
public function getMemoryUsage()
|
96 |
+
{
|
97 |
+
return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0;
|
98 |
+
}
|
99 |
+
/**
|
100 |
+
* Returns the peak memory usage in bytes.
|
101 |
+
*
|
102 |
+
* @return int
|
103 |
+
*/
|
104 |
+
public function getPeakMemoryUsage()
|
105 |
+
{
|
106 |
+
return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0;
|
107 |
+
}
|
108 |
+
/**
|
109 |
+
* Starts the profiling.
|
110 |
+
*/
|
111 |
+
public function enter()
|
112 |
+
{
|
113 |
+
$this->starts = ['wt' => \microtime(\true), 'mu' => \memory_get_usage(), 'pmu' => \memory_get_peak_usage()];
|
114 |
+
}
|
115 |
+
/**
|
116 |
+
* Stops the profiling.
|
117 |
+
*/
|
118 |
+
public function leave()
|
119 |
+
{
|
120 |
+
$this->ends = ['wt' => \microtime(\true), 'mu' => \memory_get_usage(), 'pmu' => \memory_get_peak_usage()];
|
121 |
+
}
|
122 |
+
public function reset()
|
123 |
+
{
|
124 |
+
$this->starts = $this->ends = $this->profiles = [];
|
125 |
+
$this->enter();
|
126 |
+
}
|
127 |
+
public function getIterator()
|
128 |
+
{
|
129 |
+
return new \ArrayIterator($this->profiles);
|
130 |
+
}
|
131 |
+
public function serialize()
|
132 |
+
{
|
133 |
+
return \serialize($this->__serialize());
|
134 |
+
}
|
135 |
+
public function unserialize($data)
|
136 |
+
{
|
137 |
+
$this->__unserialize(\unserialize($data));
|
138 |
+
}
|
139 |
+
/**
|
140 |
+
* @internal
|
141 |
+
*/
|
142 |
+
public function __serialize()
|
143 |
+
{
|
144 |
+
return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles];
|
145 |
+
}
|
146 |
+
/**
|
147 |
+
* @internal
|
148 |
+
*/
|
149 |
+
public function __unserialize(array $data)
|
150 |
+
{
|
151 |
+
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
\class_alias('WPML\\Core\\Twig\\Profiler\\Profile', 'WPML\\Core\\Twig_Profiler_Profile');
|
addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/ContainerRuntimeLoader.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\RuntimeLoader;
|
12 |
+
|
13 |
+
use WPML\Core\Psr\Container\ContainerInterface;
|
14 |
+
/**
|
15 |
+
* Lazily loads Twig runtime implementations from a PSR-11 container.
|
16 |
+
*
|
17 |
+
* Note that the runtime services MUST use their class names as identifiers.
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
* @author Robin Chalas <robin.chalas@gmail.com>
|
21 |
+
*/
|
22 |
+
class ContainerRuntimeLoader implements \WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface
|
23 |
+
{
|
24 |
+
private $container;
|
25 |
+
public function __construct(\WPML\Core\Psr\Container\ContainerInterface $container)
|
26 |
+
{
|
27 |
+
$this->container = $container;
|
28 |
+
}
|
29 |
+
public function load($class)
|
30 |
+
{
|
31 |
+
if ($this->container->has($class)) {
|
32 |
+
return $this->container->get($class);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
\class_alias('WPML\\Core\\Twig\\RuntimeLoader\\ContainerRuntimeLoader', 'WPML\\Core\\Twig_ContainerRuntimeLoader');
|
addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/FactoryRuntimeLoader.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\RuntimeLoader;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Lazy loads the runtime implementations for a Twig element.
|
15 |
+
*
|
16 |
+
* @author Robin Chalas <robin.chalas@gmail.com>
|
17 |
+
*/
|
18 |
+
class FactoryRuntimeLoader implements \WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface
|
19 |
+
{
|
20 |
+
private $map;
|
21 |
+
/**
|
22 |
+
* @param array $map An array where keys are class names and values factory callables
|
23 |
+
*/
|
24 |
+
public function __construct($map = [])
|
25 |
+
{
|
26 |
+
$this->map = $map;
|
27 |
+
}
|
28 |
+
public function load($class)
|
29 |
+
{
|
30 |
+
if (isset($this->map[$class])) {
|
31 |
+
$runtimeFactory = $this->map[$class];
|
32 |
+
return $runtimeFactory();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
\class_alias('WPML\\Core\\Twig\\RuntimeLoader\\FactoryRuntimeLoader', 'WPML\\Core\\Twig_FactoryRuntimeLoader');
|
addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/RuntimeLoaderInterface.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\RuntimeLoader;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Creates runtime implementations for Twig elements (filters/functions/tests).
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
interface RuntimeLoaderInterface
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Creates the runtime implementation of a Twig element (filter/function/test).
|
22 |
+
*
|
23 |
+
* @param string $class A runtime class
|
24 |
+
*
|
25 |
+
* @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class
|
26 |
+
*/
|
27 |
+
public function load($class);
|
28 |
+
}
|
29 |
+
\class_alias('WPML\\Core\\Twig\\RuntimeLoader\\RuntimeLoaderInterface', 'WPML\\Core\\Twig_RuntimeLoaderInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityError.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Error\Error;
|
14 |
+
/**
|
15 |
+
* Exception thrown when a security error occurs at runtime.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class SecurityError extends \WPML\Core\Twig\Error\Error
|
20 |
+
{
|
21 |
+
}
|
22 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityError', 'WPML\\Core\\Twig_Sandbox_SecurityError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFilterError.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when a not allowed filter is used in a template.
|
15 |
+
*
|
16 |
+
* @author Martin Hasoň <martin.hason@gmail.com>
|
17 |
+
*/
|
18 |
+
class SecurityNotAllowedFilterError extends \WPML\Core\Twig\Sandbox\SecurityError
|
19 |
+
{
|
20 |
+
private $filterName;
|
21 |
+
public function __construct($message, $functionName, $lineno = -1, $filename = null, \Exception $previous = null)
|
22 |
+
{
|
23 |
+
parent::__construct($message, $lineno, $filename, $previous);
|
24 |
+
$this->filterName = $functionName;
|
25 |
+
}
|
26 |
+
public function getFilterName()
|
27 |
+
{
|
28 |
+
return $this->filterName;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFilterError', 'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFilterError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFunctionError.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when a not allowed function is used in a template.
|
15 |
+
*
|
16 |
+
* @author Martin Hasoň <martin.hason@gmail.com>
|
17 |
+
*/
|
18 |
+
class SecurityNotAllowedFunctionError extends \WPML\Core\Twig\Sandbox\SecurityError
|
19 |
+
{
|
20 |
+
private $functionName;
|
21 |
+
public function __construct($message, $functionName, $lineno = -1, $filename = null, \Exception $previous = null)
|
22 |
+
{
|
23 |
+
parent::__construct($message, $lineno, $filename, $previous);
|
24 |
+
$this->functionName = $functionName;
|
25 |
+
}
|
26 |
+
public function getFunctionName()
|
27 |
+
{
|
28 |
+
return $this->functionName;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedFunctionError', 'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedFunctionError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedMethodError.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when a not allowed class method is used in a template.
|
15 |
+
*
|
16 |
+
* @author Kit Burton-Senior <mail@kitbs.com>
|
17 |
+
*/
|
18 |
+
class SecurityNotAllowedMethodError extends \WPML\Core\Twig\Sandbox\SecurityError
|
19 |
+
{
|
20 |
+
private $className;
|
21 |
+
private $methodName;
|
22 |
+
public function __construct($message, $className, $methodName, $lineno = -1, $filename = null, \Exception $previous = null)
|
23 |
+
{
|
24 |
+
parent::__construct($message, $lineno, $filename, $previous);
|
25 |
+
$this->className = $className;
|
26 |
+
$this->methodName = $methodName;
|
27 |
+
}
|
28 |
+
public function getClassName()
|
29 |
+
{
|
30 |
+
return $this->className;
|
31 |
+
}
|
32 |
+
public function getMethodName()
|
33 |
+
{
|
34 |
+
return $this->methodName;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedMethodError', 'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedMethodError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedPropertyError.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when a not allowed class property is used in a template.
|
15 |
+
*
|
16 |
+
* @author Kit Burton-Senior <mail@kitbs.com>
|
17 |
+
*/
|
18 |
+
class SecurityNotAllowedPropertyError extends \WPML\Core\Twig\Sandbox\SecurityError
|
19 |
+
{
|
20 |
+
private $className;
|
21 |
+
private $propertyName;
|
22 |
+
public function __construct($message, $className, $propertyName, $lineno = -1, $filename = null, \Exception $previous = null)
|
23 |
+
{
|
24 |
+
parent::__construct($message, $lineno, $filename, $previous);
|
25 |
+
$this->className = $className;
|
26 |
+
$this->propertyName = $propertyName;
|
27 |
+
}
|
28 |
+
public function getClassName()
|
29 |
+
{
|
30 |
+
return $this->className;
|
31 |
+
}
|
32 |
+
public function getPropertyName()
|
33 |
+
{
|
34 |
+
return $this->propertyName;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedPropertyError', 'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedPropertyError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedTagError.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Exception thrown when a not allowed tag is used in a template.
|
15 |
+
*
|
16 |
+
* @author Martin Hasoň <martin.hason@gmail.com>
|
17 |
+
*/
|
18 |
+
class SecurityNotAllowedTagError extends \WPML\Core\Twig\Sandbox\SecurityError
|
19 |
+
{
|
20 |
+
private $tagName;
|
21 |
+
public function __construct($message, $tagName, $lineno = -1, $filename = null, \Exception $previous = null)
|
22 |
+
{
|
23 |
+
parent::__construct($message, $lineno, $filename, $previous);
|
24 |
+
$this->tagName = $tagName;
|
25 |
+
}
|
26 |
+
public function getTagName()
|
27 |
+
{
|
28 |
+
return $this->tagName;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityNotAllowedTagError', 'WPML\\Core\\Twig_Sandbox_SecurityNotAllowedTagError');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicy.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
use WPML\Core\Twig\Markup;
|
14 |
+
/**
|
15 |
+
* Represents a security policy which need to be enforced when sandbox mode is enabled.
|
16 |
+
*
|
17 |
+
* @final
|
18 |
+
*
|
19 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
+
*/
|
21 |
+
class SecurityPolicy implements \WPML\Core\Twig\Sandbox\SecurityPolicyInterface
|
22 |
+
{
|
23 |
+
protected $allowedTags;
|
24 |
+
protected $allowedFilters;
|
25 |
+
protected $allowedMethods;
|
26 |
+
protected $allowedProperties;
|
27 |
+
protected $allowedFunctions;
|
28 |
+
public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = [])
|
29 |
+
{
|
30 |
+
$this->allowedTags = $allowedTags;
|
31 |
+
$this->allowedFilters = $allowedFilters;
|
32 |
+
$this->setAllowedMethods($allowedMethods);
|
33 |
+
$this->allowedProperties = $allowedProperties;
|
34 |
+
$this->allowedFunctions = $allowedFunctions;
|
35 |
+
}
|
36 |
+
public function setAllowedTags(array $tags)
|
37 |
+
{
|
38 |
+
$this->allowedTags = $tags;
|
39 |
+
}
|
40 |
+
public function setAllowedFilters(array $filters)
|
41 |
+
{
|
42 |
+
$this->allowedFilters = $filters;
|
43 |
+
}
|
44 |
+
public function setAllowedMethods(array $methods)
|
45 |
+
{
|
46 |
+
$this->allowedMethods = [];
|
47 |
+
foreach ($methods as $class => $m) {
|
48 |
+
$this->allowedMethods[$class] = \array_map('strtolower', \is_array($m) ? $m : [$m]);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
public function setAllowedProperties(array $properties)
|
52 |
+
{
|
53 |
+
$this->allowedProperties = $properties;
|
54 |
+
}
|
55 |
+
public function setAllowedFunctions(array $functions)
|
56 |
+
{
|
57 |
+
$this->allowedFunctions = $functions;
|
58 |
+
}
|
59 |
+
public function checkSecurity($tags, $filters, $functions)
|
60 |
+
{
|
61 |
+
foreach ($tags as $tag) {
|
62 |
+
if (!\in_array($tag, $this->allowedTags)) {
|
63 |
+
throw new \WPML\Core\Twig\Sandbox\SecurityNotAllowedTagError(\sprintf('Tag "%s" is not allowed.', $tag), $tag);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
foreach ($filters as $filter) {
|
67 |
+
if (!\in_array($filter, $this->allowedFilters)) {
|
68 |
+
throw new \WPML\Core\Twig\Sandbox\SecurityNotAllowedFilterError(\sprintf('Filter "%s" is not allowed.', $filter), $filter);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
foreach ($functions as $function) {
|
72 |
+
if (!\in_array($function, $this->allowedFunctions)) {
|
73 |
+
throw new \WPML\Core\Twig\Sandbox\SecurityNotAllowedFunctionError(\sprintf('Function "%s" is not allowed.', $function), $function);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
public function checkMethodAllowed($obj, $method)
|
78 |
+
{
|
79 |
+
if ($obj instanceof \WPML\Core\Twig_TemplateInterface || $obj instanceof \WPML\Core\Twig\Markup) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
$allowed = \false;
|
83 |
+
$method = \strtolower($method);
|
84 |
+
foreach ($this->allowedMethods as $class => $methods) {
|
85 |
+
if ($obj instanceof $class) {
|
86 |
+
$allowed = \in_array($method, $methods);
|
87 |
+
break;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
if (!$allowed) {
|
91 |
+
$class = \get_class($obj);
|
92 |
+
throw new \WPML\Core\Twig\Sandbox\SecurityNotAllowedMethodError(\sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
public function checkPropertyAllowed($obj, $property)
|
96 |
+
{
|
97 |
+
$allowed = \false;
|
98 |
+
foreach ($this->allowedProperties as $class => $properties) {
|
99 |
+
if ($obj instanceof $class) {
|
100 |
+
$allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]);
|
101 |
+
break;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
if (!$allowed) {
|
105 |
+
$class = \get_class($obj);
|
106 |
+
throw new \WPML\Core\Twig\Sandbox\SecurityNotAllowedPropertyError(\sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityPolicy', 'WPML\\Core\\Twig_Sandbox_SecurityPolicy');
|
addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicyInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig\Sandbox;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Interface that all security policy classes must implements.
|
15 |
+
*
|
16 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
+
*/
|
18 |
+
interface SecurityPolicyInterface
|
19 |
+
{
|
20 |
+
public function checkSecurity($tags, $filters, $functions);
|
21 |
+
public function checkMethodAllowed($obj, $method);
|
22 |
+
public function checkPropertyAllowed($obj, $method);
|
23 |
+
}
|
24 |
+
\class_alias('WPML\\Core\\Twig\\Sandbox\\SecurityPolicyInterface', 'WPML\\Core\\Twig_Sandbox_SecurityPolicyInterface');
|
addons/wpml-dependencies/lib/lib/twig/src/Source.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
namespace WPML\Core\Twig;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Holds information about a non-compiled Twig template.
|
15 |
+
*
|
16 |
+
* @final
|
17 |
+
*
|
18 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
+
*/
|
20 |
+
class Source
|
21 |
+
{
|
22 |
+
private $code;
|
23 |
+
private $name;
|
24 |
+
private $path;
|
25 |
+
/**
|
26 |
+
* @param string $code The template source code
|
27 |
+
* @param string $name The template logical name
|
28 |
+
* @param string $path The filesystem path of the template if any
|
29 |
+
*/
|
30 |
+
public function __construct($code, $name, $path = '')
|
31 |
+
{
|
32 |
+
$this->code = $code;
|
33 |
+
$this->name = $name;
|
34 |
+
$this->path = $path;
|
35 |
+
}
|
36 |
+
public function getCode()
|
37 |
+
{
|
38 |
+
return $this->code;
|
39 |
+
}
|
40 |
+
public function getName()
|
41 |
+
{
|
42 |
+
return $this->name;
|
43 |
+
}
|
44 |
+
public function getPath()
|
45 |
+
{
|
46 |
+
return $this->path;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
\class_alias('WPML\\Core\\Twig\\Source', 'WPML\\Core\\Twig_Source');
|
addons/wpml-dependencies/lib/lib/twig/src/Template.php
ADDED
@@ -0,0 +1,639 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Twig.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier
|
7 |
+
* (c) Armin Ronacher
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
namespace WPML\Core\Twig;
|
13 |
+
|
14 |
+
use WPML\Core\Twig\Error\Error;
|
15 |
+
use WPML\Core\Twig\Error\LoaderError;
|
16 |
+
use WPML\Core\Twig\Error\RuntimeError;
|
17 |
+
/**
|
18 |
+
* Default base class for compiled templates.
|
19 |
+
*
|
20 |
+
* This class is an implementation detail of how template compilation currently
|
21 |
+
* works, which might change. It should never be used directly. Use $twig->load()
|
22 |
+
* instead, which returns an instance of \Twig\TemplateWrapper.
|
23 |
+
*
|
24 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
25 |
+
*
|
26 |
+
* @internal
|
27 |
+
*/
|
28 |
+
abstract class Template implements \WPML\Core\Twig_TemplateInterface
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @internal
|
32 |
+
*/
|
33 |
+
protected static $cache = [];
|
34 |
+
protected $parent;
|
35 |
+
protected $parents = [];
|
36 |
+
protected $env;
|
37 |
+
protected $blocks = [];
|
38 |
+
protected $traits = [];
|
39 |
+
protected $sandbox;
|
40 |
+
public function __construct(\WPML\Core\Twig\Environment $env)
|
41 |
+
{
|
42 |
+
$this->env = $env;
|
43 |
+
}
|
44 |
+
/**
|
45 |
+
* @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
|
46 |
+
*/
|
47 |
+
public function __toString()
|
48 |
+
{
|
49 |
+
return $this->getTemplateName();
|
50 |
+
}
|
51 |
+
/**
|
52 |
+
* Returns the template name.
|
53 |
+
*
|
54 |
+
* @return string The template name
|
55 |
+
*/
|
56 |
+
public abstract function getTemplateName();
|
57 |
+
/**
|
58 |
+
* Returns debug information about the template.
|
59 |
+
*
|
60 |
+
* @return array Debug information
|
61 |
+
*/
|
62 |
+
public function getDebugInfo()
|
63 |
+
{
|
64 |
+
return [];
|
65 |
+
}
|
66 |
+
/**
|
67 |
+
* Returns the template source code.
|
68 |
+
*
|
69 |
+
* @return string The template source code
|
70 |
+
*
|
71 |
+
* @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead
|
72 |
+
*/
|
73 |
+
public function getSource()
|
74 |
+
{
|
75 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', \E_USER_DEPRECATED);
|
76 |
+
return '';
|
77 |
+
}
|
78 |
+
/**
|
79 |
+
* Returns information about the original template source code.
|
80 |
+
*
|
81 |
+
* @return Source
|
82 |
+
*/
|
83 |
+
public function getSourceContext()
|
84 |
+
{
|
85 |
+
return new \WPML\Core\Twig\Source('', $this->getTemplateName());
|
86 |
+
}
|
87 |
+
/**
|
88 |
+
* @deprecated since 1.20 (to be removed in 2.0)
|
89 |
+
*/
|
90 |
+
public function getEnvironment()
|
91 |
+
{
|
92 |
+
@\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 1.20 and will be removed in 2.0.', \E_USER_DEPRECATED);
|
93 |
+
return $this->env;
|
94 |
+
}
|
95 |
+
/**
|
96 |
+
* Returns the parent template.
|
97 |
+
*
|
98 |
+
* This method is for internal use only and should never be called
|
99 |
+
* directly.
|
100 |
+
*
|
101 |
+
* @param array $context
|
102 |
+
*
|
103 |
+
* @return \Twig_TemplateInterface|TemplateWrapper|false The parent template or false if there is no parent
|
104 |
+
*
|
105 |
+
* @internal
|
106 |
+
*/
|
107 |
+
public function getParent(array $context)
|
108 |
+
{
|
109 |
+
if (null !== $this->parent) {
|
110 |
+
return $this->parent;
|
111 |
+
}
|
112 |
+
try {
|
113 |
+
$parent = $this->doGetParent($context);
|
114 |
+
if (\false === $parent) {
|
115 |
+
return \false;
|
116 |
+
}
|
117 |
+
if ($parent instanceof self || $parent instanceof \WPML\Core\Twig\TemplateWrapper) {
|
118 |
+
return $this->parents[$parent->getSourceContext()->getName()] = $parent;
|
119 |
+
}
|
120 |
+
if (!isset($this->parents[$parent])) {
|
121 |
+
$this->parents[$parent] = $this->loadTemplate($parent);
|
122 |
+
}
|
123 |
+
} catch (\WPML\Core\Twig\Error\LoaderError $e) {
|
124 |
+
$e->setSourceContext(null);
|
125 |
+
$e->guess();
|
126 |
+
throw $e;
|
127 |
+
}
|
128 |
+
return $this->parents[$parent];
|
129 |
+
}
|
130 |
+
protected function doGetParent(array $context)
|
131 |
+
{
|
132 |
+
return \false;
|
133 |
+
}
|
134 |
+
public function isTraitable()
|
135 |
+
{
|
136 |
+
return \true;
|
137 |
+
}
|
138 |
+
/**
|
139 |
+
* Displays a parent block.
|
140 |
+
*
|
141 |
+
* This method is for internal use only and should never be called
|
142 |
+
* directly.
|
143 |
+
*
|
144 |
+
* @param string $name The block name to display from the parent
|
145 |
+
* @param array $context The context
|
146 |
+
* @param array $blocks The current set of blocks
|
147 |
+
*/
|
148 |
+
public function displayParentBlock($name, array $context, array $blocks = [])
|
149 |
+
{
|
150 |
+
$name = (string) $name;
|
151 |
+
if (isset($this->traits[$name])) {
|
152 |
+
$this->traits[$name][0]->displayBlock($name, $context, $blocks, \false);
|
153 |
+
} elseif (\false !== ($parent = $this->getParent($context))) {
|
154 |
+
$parent->displayBlock($name, $context, $blocks, \false);
|
155 |
+
} else {
|
156 |
+
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext());
|
157 |
+
}
|
158 |
+
}
|
159 |
+
/**
|
160 |
+
* Displays a block.
|
161 |
+
*
|
162 |
+
* This method is for internal use only and should never be called
|
163 |
+
* directly.
|
164 |
+
*
|
165 |
+
* @param string $name The block name to display
|
166 |
+
* @param array $context The context
|
167 |
+
* @param array $blocks The current set of blocks
|
168 |
+
* @param bool $useBlocks Whether to use the current set of blocks
|
169 |
+
*/
|
170 |
+
public function displayBlock($name, array $context, array $blocks = [], $useBlocks = \true)
|
171 |
+
{
|
172 |
+
$name = (string) $name;
|
173 |
+
if ($useBlocks && isset($blocks[$name])) {
|
174 |
+
$template = $blocks[$name][0];
|
175 |
+
$block = $blocks[$name][1];
|
176 |
+
} elseif (isset($this->blocks[$name])) {
|
177 |
+
$template = $this->blocks[$name][0];
|
178 |
+
$block = $this->blocks[$name][1];
|
179 |
+
} else {
|
180 |
+
$template = null;
|
181 |
+
$block = null;
|
182 |
+
}
|
183 |
+
// avoid RCEs when sandbox is enabled
|
184 |
+
if (null !== $template && !$template instanceof self) {
|
185 |
+
throw new \LogicException('A block must be a method on a \\Twig\\Template instance.');
|
186 |
+
}
|
187 |
+
if (null !== $template) {
|
188 |
+
try {
|
189 |
+
$template->{$block}($context, $blocks);
|
190 |
+
} catch (\WPML\Core\Twig\Error\Error $e) {
|
191 |
+
if (!$e->getSourceContext()) {
|
192 |
+
$e->setSourceContext($template->getSourceContext());
|
193 |
+
}
|
194 |
+
// this is mostly useful for \Twig\Error\LoaderError exceptions
|
195 |
+
// see \Twig\Error\LoaderError
|
196 |
+
if (-1 === $e->getTemplateLine()) {
|
197 |
+
$e->guess();
|
198 |
+
}
|
199 |
+
throw $e;
|
200 |
+
} catch (\Exception $e) {
|
201 |
+
$e = new \WPML\Core\Twig\Error\RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
|
202 |
+
$e->guess();
|
203 |
+
throw $e;
|
204 |
+
}
|
205 |
+
} elseif (\false !== ($parent = $this->getParent($context))) {
|
206 |
+
$parent->displayBlock($name, $context, \array_merge($this->blocks, $blocks), \false);
|
207 |
+
} else {
|
208 |
+
@\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);
|
209 |
+
}
|
210 |
+
}
|
211 |
+
/**
|
212 |
+
* Renders a parent block.
|
213 |
+
*
|
214 |
+
* This method is for internal use only and should never be called
|
215 |
+
* directly.
|
216 |
+
*
|
217 |
+
* @param string $name The block name to render from the parent
|
218 |
+
* @param array $context The context
|
219 |
+
* @param array $blocks The current set of blocks
|
220 |
+
*
|
221 |
+
* @return string The rendered block
|
222 |
+
*/
|
223 |
+
public function renderParentBlock($name, array $context, array $blocks = [])
|
224 |
+
{
|
225 |
+
if ($this->env->isDebug()) {
|
226 |
+
\ob_start();
|
227 |
+
} else {
|
228 |
+
\ob_start(function () {
|
229 |
+
return '';
|
230 |
+
});
|
231 |
+
}
|
232 |
+
$this->displayParentBlock($name, $context, $blocks);
|
233 |
+
return \ob_get_clean();
|
234 |
+
}
|
235 |
+
/**
|
236 |
+
* Renders a block.
|
237 |
+
*
|
238 |
+
* This method is for internal use only and should never be called
|
239 |
+
* directly.
|
240 |
+
*
|
241 |
+
* @param string $name The block name to render
|
242 |
+
* @param array $context The context
|
243 |
+
* @param array $blocks The current set of blocks
|
244 |
+
* @param bool $useBlocks Whether to use the current set of blocks
|
245 |
+
*
|
246 |
+
* @return string The rendered block
|
247 |
+
*/
|
248 |
+
public function renderBlock($name, array $context, array $blocks = [], $useBlocks = \true)
|
249 |
+
{
|
250 |
+
if ($this->env->isDebug()) {
|
251 |
+
\ob_start();
|
252 |
+
} else {
|
253 |
+
\ob_start(function () {
|
254 |
+
return '';
|
255 |
+
});
|
256 |
+
}
|
257 |
+
$this->displayBlock($name, $context, $blocks, $useBlocks);
|
258 |
+
return \ob_get_clean();
|
259 |
+
}
|
260 |
+
/**
|
261 |
+
* Returns whether a block exists or not in the current context of the template.
|
262 |
+
*
|
263 |
+
* This method checks blocks defined in the current template
|
264 |
+
* or defined in "used" traits or defined in parent templates.
|
265 |
+
*
|
266 |
+
* @param string $name The block name
|
267 |
+
* @param array $context The context
|
268 |
+
* @param array $blocks The current set of blocks
|
269 |
+
*
|
270 |
+
* @return bool true if the block exists, false otherwise
|
271 |
+
*/
|
272 |
+
public function hasBlock($name, array $context = null, array $blocks = [])
|
273 |
+
{
|
274 |
+
if (null === $context) {
|
275 |
+
@\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);
|