Version Description
- Fixed currency switcher modal has lost its padding.
Download this release
Release Info
Developer | sergey.r |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 4.10.4 |
Comparing to | |
See all releases |
Code changes from version trunk to 4.10.4
- addons/load-standalone-dependencies.php +0 -48
- addons/wpml-dependencies/lib/classes/ISitePress.php +0 -5
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-filter-loader.php +0 -159
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-action-type.php +0 -75
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-base-factory.php +0 -33
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-ajax-action-validation.php +0 -29
- addons/wpml-dependencies/lib/classes/action-filter-loader/class-wpml-current-screen-loader-factory.php +0 -44
- addons/wpml-dependencies/lib/classes/block-editor/class-wpml-block-editor-helper.php +0 -70
- addons/wpml-dependencies/lib/classes/class-wpml-file.php +0 -138
- addons/wpml-dependencies/lib/classes/container/class-config.php +0 -60
- addons/wpml-dependencies/lib/classes/container/class-wpml-container.php +0 -112
- addons/wpml-dependencies/lib/classes/container/functions.php +0 -97
- addons/wpml-dependencies/lib/classes/cookie/class-wpml-cookie.php +0 -80
- addons/wpml-dependencies/lib/classes/languages/interface-iwpml-current-language.php +0 -7
- addons/wpml-dependencies/lib/classes/notices/DismissNotices.php +0 -63
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-action.php +0 -89
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice-render.php +0 -407
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notice.php +0 -414
- addons/wpml-dependencies/lib/classes/notices/class-wpml-notices.php +0 -489
- addons/wpml-dependencies/lib/classes/notices/pages/class-wpml-notice-show-on-dashboard-and-wpml-pages.php +0 -24
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-core-privacy-content.php +0 -25
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content-factory.php +0 -13
- addons/wpml-dependencies/lib/classes/privacy/class-wpml-privacy-content.php +0 -35
- addons/wpml-dependencies/lib/classes/templates/class-wpml-twig-template.php +0 -23
- addons/wpml-dependencies/lib/classes/templates/interface-iwpml-template-service.php +0 -8
- addons/wpml-dependencies/lib/classes/templates/wpml-twig-template-loader.php +0 -37
- addons/wpml-dependencies/lib/classes/templating/class-wpml-templates-factory.php +0 -207
- addons/wpml-dependencies/lib/classes/twig-extensions/wpml-twig-wp-plugin-extension.php +0 -25
- addons/wpml-dependencies/lib/classes/utilities/class-wpml-wp-cache.php +0 -117
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-api.php +0 -1292
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-roles.php +0 -130
- addons/wpml-dependencies/lib/classes/wpml-wp/class-wpml-wp-taxonomy.php +0 -30
- addons/wpml-dependencies/lib/classes/wpml-wp/iwpml-wp-element-type.php +0 -12
- addons/wpml-dependencies/lib/classes/wpml-wp/wpml-php-functions.php +0 -129
- addons/wpml-dependencies/lib/classes/wpml-wp/wpml-wp-post-type.php +0 -14
- addons/wpml-dependencies/lib/dist/js/notices/app.js +0 -1
- addons/wpml-dependencies/lib/inc/icl-admin-notifier.php +0 -814
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Autoloader.php +0 -49
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/BaseNodeVisitor.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Filesystem.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Cache/Null.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/CacheInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Compiler.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/CompilerInterface.php +0 -34
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ContainerRuntimeLoader.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Environment.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Loader.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Runtime.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Error/Syntax.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExistsLoaderInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExpressionParser.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Core.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Debug.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Escaper.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/GlobalsInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/InitRuntimeInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Optimizer.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Profiler.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Sandbox.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/Staging.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Extension/StringLoader.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ExtensionInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FactoryRuntimeLoader.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FileExtensionEscapingStrategy.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter.php +0 -69
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Function.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Method.php +0 -39
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Filter/Node.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterCallableInterface.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FilterInterface.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function.php +0 -62
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Function.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Method.php +0 -40
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Function/Node.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionCallableInterface.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/FunctionInterface.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Lexer.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/LexerInterface.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Array.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Chain.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/Filesystem.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Loader/String.php +0 -57
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/LoaderInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Markup.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/AutoEscape.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Block.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/BlockReference.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Body.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/CheckSecurity.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Deprecated.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Do.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Embed.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Array.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/AssignName.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Add.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/And.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Concat.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Div.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/EndsWith.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Equal.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Greater.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/In.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Less.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/LessEqual.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Matches.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mod.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Mul.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotEqual.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/NotIn.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Or.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Power.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Range.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/StartsWith.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Binary/Sub.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/BlockReference.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Call.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Conditional.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Constant.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/ExtensionReference.php +0 -33
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Filter/Default.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Function.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/GetAttr.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/MethodCall.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Name.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/NullCoalesce.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Parent.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/TempName.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Constant.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Defined.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Divisibleby.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Even.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Null.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Odd.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Test/Sameas.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Neg.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Not.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Expression/Unary/Pos.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Flush.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/For.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/ForLoop.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/If.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Import.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Include.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Macro.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Module.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Print.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Sandbox.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SandboxedPrint.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Set.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/SetTemp.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Spaceless.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/Text.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Node/With.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeCaptureInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeInterface.php +0 -32
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeOutputInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeTraverser.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Escaper.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Optimizer.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/SafeAnalysis.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitor/Sandbox.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/NodeVisitorInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Parser.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/ParserInterface.php +0 -33
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Base.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Blackfire.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Html.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Dumper/Text.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/EnterProfile.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Node/LeaveProfile.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Profiler/Profile.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/RuntimeLoaderInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicy.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFilter.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleFunction.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SimpleTest.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Source.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/SourceContextLoaderInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Template.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateInterface.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TemplateWrapper.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test.php +0 -33
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Function.php +0 -34
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/IntegrationTestCase.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Method.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/Node.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Test/NodeTestCase.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestCallableInterface.php +0 -23
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TestInterface.php +0 -28
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Token.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/AutoEscape.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Block.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Deprecated.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Do.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Embed.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Extends.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Filter.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Flush.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/For.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/From.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/If.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Import.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Include.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Macro.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Sandbox.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Set.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Spaceless.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/Use.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParser/With.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBroker.php +0 -112
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserBrokerInterface.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenParserInterface.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/TokenStream.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/DeprecationCollector.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/lib/Twig/Util/TemplateDirIterator.php +0 -11
- addons/wpml-dependencies/lib/lib/twig/src/Cache/CacheInterface.php +0 -55
- addons/wpml-dependencies/lib/lib/twig/src/Cache/FilesystemCache.php +0 -79
- addons/wpml-dependencies/lib/lib/twig/src/Cache/NullCache.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/src/Compiler.php +0 -247
- addons/wpml-dependencies/lib/lib/twig/src/Environment.php +0 -1407
- addons/wpml-dependencies/lib/lib/twig/src/Error/Error.php +0 -280
- addons/wpml-dependencies/lib/lib/twig/src/Error/LoaderError.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Error/RuntimeError.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Error/SyntaxError.php +0 -52
- addons/wpml-dependencies/lib/lib/twig/src/ExpressionParser.php +0 -684
- addons/wpml-dependencies/lib/lib/twig/src/Extension/AbstractExtension.php +0 -61
- addons/wpml-dependencies/lib/lib/twig/src/Extension/CoreExtension.php +0 -1393
- addons/wpml-dependencies/lib/lib/twig/src/Extension/DebugExtension.php +0 -56
- addons/wpml-dependencies/lib/lib/twig/src/Extension/EscaperExtension.php +0 -101
- addons/wpml-dependencies/lib/lib/twig/src/Extension/ExtensionInterface.php +0 -89
- addons/wpml-dependencies/lib/lib/twig/src/Extension/GlobalsInterface.php +0 -24
- addons/wpml-dependencies/lib/lib/twig/src/Extension/InitRuntimeInterface.php +0 -24
- addons/wpml-dependencies/lib/lib/twig/src/Extension/OptimizerExtension.php +0 -33
- addons/wpml-dependencies/lib/lib/twig/src/Extension/ProfilerExtension.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/src/Extension/RuntimeExtensionInterface.php +0 -18
- addons/wpml-dependencies/lib/lib/twig/src/Extension/SandboxExtension.php +0 -91
- addons/wpml-dependencies/lib/lib/twig/src/Extension/StagingExtension.php +0 -97
- addons/wpml-dependencies/lib/lib/twig/src/Extension/StringLoaderExtension.php +0 -46
- addons/wpml-dependencies/lib/lib/twig/src/FileExtensionEscapingStrategy.php +0 -55
- addons/wpml-dependencies/lib/lib/twig/src/Lexer.php +0 -392
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ArrayLoader.php +0 -87
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ChainLoader.php +0 -137
- addons/wpml-dependencies/lib/lib/twig/src/Loader/ExistsLoaderInterface.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Loader/FilesystemLoader.php +0 -261
- addons/wpml-dependencies/lib/lib/twig/src/Loader/LoaderInterface.php +0 -56
- addons/wpml-dependencies/lib/lib/twig/src/Loader/SourceContextLoaderInterface.php +0 -35
- addons/wpml-dependencies/lib/lib/twig/src/Markup.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/src/Node/AutoEscapeNode.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/src/Node/BlockNode.php +0 -32
- addons/wpml-dependencies/lib/lib/twig/src/Node/BlockReferenceNode.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Node/BodyNode.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/CheckSecurityNode.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/src/Node/CheckToStringNode.php +0 -35
- addons/wpml-dependencies/lib/lib/twig/src/Node/DeprecatedNode.php +0 -40
- addons/wpml-dependencies/lib/lib/twig/src/Node/DoNode.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Node/EmbedNode.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AbstractExpression.php +0 -23
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrayExpression.php +0 -67
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ArrowFunctionExpression.php +0 -41
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/AssignNameExpression.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AbstractBinary.php +0 -30
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AddBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/AndBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseAndBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseOrBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/BitwiseXorBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ConcatBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/DivBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EndsWithBinary.php +0 -27
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/EqualBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/FloorDivBinary.php +0 -27
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/GreaterEqualBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/InBinary.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/LessEqualBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MatchesBinary.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/ModBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/MulBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotEqualBinary.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/NotInBinary.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/OrBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/PowerBinary.php +0 -28
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/RangeBinary.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/StartsWithBinary.php +0 -27
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Binary/SubBinary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/BlockReferenceExpression.php +0 -71
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/CallExpression.php +0 -256
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConditionalExpression.php +0 -26
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ConstantExpression.php +0 -26
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Filter/DefaultFilter.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FilterExpression.php +0 -41
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/FunctionExpression.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/GetAttrExpression.php +0 -65
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/InlinePrint.php +0 -28
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/MethodCallExpression.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NameExpression.php +0 -73
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/NullCoalesceExpression.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/ParentExpression.php +0 -35
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TempNameExpression.php +0 -25
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/ConstantTest.php +0 -35
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DefinedTest.php +0 -64
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/DivisiblebyTest.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/EvenTest.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/NullTest.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/OddTest.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Test/SameasTest.php +0 -27
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/TestExpression.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/AbstractUnary.php +0 -30
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NegUnary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/NotUnary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/Expression/Unary/PosUnary.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Node/FlushNode.php +0 -30
- addons/wpml-dependencies/lib/lib/twig/src/Node/ForLoopNode.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/src/Node/ForNode.php +0 -63
- addons/wpml-dependencies/lib/lib/twig/src/Node/IfNode.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/src/Node/ImportNode.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/src/Node/IncludeNode.php +0 -71
- addons/wpml-dependencies/lib/lib/twig/src/Node/MacroNode.php +0 -69
- addons/wpml-dependencies/lib/lib/twig/src/Node/ModuleNode.php +0 -237
- addons/wpml-dependencies/lib/lib/twig/src/Node/Node.php +0 -228
- addons/wpml-dependencies/lib/lib/twig/src/Node/NodeCaptureInterface.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/NodeOutputInterface.php +0 -21
- addons/wpml-dependencies/lib/lib/twig/src/Node/PrintNode.php +0 -32
- addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxNode.php +0 -30
- addons/wpml-dependencies/lib/lib/twig/src/Node/SandboxedPrintNode.php +0 -54
- addons/wpml-dependencies/lib/lib/twig/src/Node/SetNode.php +0 -87
- addons/wpml-dependencies/lib/lib/twig/src/Node/SetTempNode.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Node/SpacelessNode.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/src/Node/TextNode.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Node/WithNode.php +0 -48
- addons/wpml-dependencies/lib/lib/twig/src/NodeTraverser.php +0 -77
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/AbstractNodeVisitor.php +0 -51
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/EscaperNodeVisitor.php +0 -172
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/NodeVisitorInterface.php +0 -44
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/OptimizerNodeVisitor.php +0 -206
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php +0 -143
- addons/wpml-dependencies/lib/lib/twig/src/NodeVisitor/SandboxNodeVisitor.php +0 -118
- addons/wpml-dependencies/lib/lib/twig/src/Parser.php +0 -358
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BaseDumper.php +0 -53
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/BlackfireDumper.php +0 -63
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/HtmlDumper.php +0 -39
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Dumper/TextDumper.php +0 -34
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/EnterProfileNode.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Node/LeaveProfileNode.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +0 -63
- addons/wpml-dependencies/lib/lib/twig/src/Profiler/Profile.php +0 -154
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/ContainerRuntimeLoader.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/FactoryRuntimeLoader.php +0 -36
- addons/wpml-dependencies/lib/lib/twig/src/RuntimeLoader/RuntimeLoaderInterface.php +0 -29
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityError.php +0 -22
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFilterError.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedFunctionError.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedMethodError.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedPropertyError.php +0 -37
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityNotAllowedTagError.php +0 -31
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicy.php +0 -110
- addons/wpml-dependencies/lib/lib/twig/src/Sandbox/SecurityPolicyInterface.php +0 -24
- addons/wpml-dependencies/lib/lib/twig/src/Source.php +0 -49
- addons/wpml-dependencies/lib/lib/twig/src/Template.php +0 -639
- addons/wpml-dependencies/lib/lib/twig/src/TemplateWrapper.php +0 -148
- addons/wpml-dependencies/lib/lib/twig/src/Test/IntegrationTestCase.php +0 -213
- addons/wpml-dependencies/lib/lib/twig/src/Test/NodeTestCase.php +0 -65
- addons/wpml-dependencies/lib/lib/twig/src/Token.php +0 -198
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/AbstractTokenParser.php +0 -30
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ApplyTokenParser.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/AutoEscapeTokenParser.php +0 -75
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/BlockTokenParser.php +0 -69
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/DeprecatedTokenParser.php +0 -38
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/DoTokenParser.php +0 -33
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/EmbedTokenParser.php +0 -55
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ExtendsTokenParser.php +0 -46
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FilterTokenParser.php +0 -50
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FlushTokenParser.php +0 -34
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ForTokenParser.php +0 -118
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FromTokenParser.php +0 -59
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/IfTokenParser.php +0 -79
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ImportTokenParser.php +0 -39
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/IncludeTokenParser.php +0 -55
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/MacroTokenParser.php +0 -58
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SandboxTokenParser.php +0 -59
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SetTokenParser.php +0 -62
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SpacelessTokenParser.php +0 -46
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/TokenParserInterface.php +0 -45
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/UseTokenParser.php +0 -63
- addons/wpml-dependencies/lib/lib/twig/src/TokenParser/WithTokenParser.php +0 -47
- addons/wpml-dependencies/lib/lib/twig/src/TokenStream.php +0 -170
- addons/wpml-dependencies/lib/lib/twig/src/TwigFilter.php +0 -97
- addons/wpml-dependencies/lib/lib/twig/src/TwigFunction.php +0 -90
- addons/wpml-dependencies/lib/lib/twig/src/TwigTest.php +0 -69
- addons/wpml-dependencies/lib/lib/twig/src/Util/DeprecationCollector.php +0 -75
- addons/wpml-dependencies/lib/lib/twig/src/Util/TemplateDirIterator.php +0 -27
- addons/wpml-dependencies/lib/missing-functions.php +0 -38
- addons/wpml-dependencies/lib/res/css/dialog.css +0 -1
- addons/wpml-dependencies/lib/res/css/otgs-dialogs.css +0 -1
- addons/wpml-dependencies/lib/res/css/otgs-ico.css +0 -1
- addons/wpml-dependencies/lib/res/css/otgs-notices.css +0 -1
- addons/wpml-dependencies/lib/res/css/style.css +0 -2
- addons/wpml-dependencies/lib/res/css/styles.css +0 -2
- addons/wpml-dependencies/lib/res/font/otgs-icons.eot +0 -0
- addons/wpml-dependencies/lib/res/font/otgs-icons.svg +0 -67
- addons/wpml-dependencies/lib/res/font/otgs-icons.ttf +0 -0
- addons/wpml-dependencies/lib/res/font/otgs-icons.woff +0 -0
- addons/wpml-dependencies/lib/res/img/ajax-loader.gif +0 -0
- addons/wpml-dependencies/lib/res/img/icon16.png +0 -0
- addons/wpml-dependencies/lib/res/js/icl-admin-notifier.js +0 -61
- addons/wpml-dependencies/lib/res/js/otgs-notices.js +0 -127
- addons/wpml-dependencies/lib/res/js/scripts.js +0 -18
- addons/wpml-dependencies/vendor/autoload.php +0 -7
- addons/wpml-dependencies/vendor/composer/{ClassLoader.php → Cl} +0 -0
addons/load-standalone-dependencies.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* This bootstrap file is loaded only when WCML is running in the Standalone mode.
|
4 |
-
* It's executed on `plugins_loaded` priority 10000.
|
5 |
-
*
|
6 |
-
* @see load_wcml_without_wpml
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
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() );
|
20 |
-
\WPML\Container\share( \WCML\StandAlone\Container\Config::getSharedClasses() );
|
21 |
-
\WPML\Container\alias( \WCML\StandAlone\Container\Config::getAliases() );
|
22 |
-
\WPML\Container\delegate( \WCML\StandAlone\Container\Config::getDelegated() );
|
23 |
-
};
|
24 |
-
|
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 );
|
36 |
-
}, PHP_INT_MAX );
|
37 |
-
};
|
38 |
-
|
39 |
-
$loadOtgsIconsStyles();
|
40 |
-
|
41 |
-
( new \WCML\StandAlone\DependencyAssets( WCML_WPML_DEPENDENCY_URL ) )->add_hooks();
|
42 |
-
|
43 |
-
wcml_wpml_get_admin_notices(); // Initialize the notices hooks
|
44 |
-
|
45 |
-
( new WPML_Action_Filter_Loader() )->load( [
|
46 |
-
\WPML\Notices\DismissNotices::class,
|
47 |
-
] );
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/classes/ISitePress.php
DELETED
@@ -1,5 +0,0 @@
|
|
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
DELETED
@@ -1,159 +0,0 @@
|
|
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
DELETED
@@ -1,75 +0,0 @@
|
|
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
DELETED
@@ -1,33 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,70 +0,0 @@
|
|
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
DELETED
@@ -1,138 +0,0 @@
|
|
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
DELETED
@@ -1,60 +0,0 @@
|
|
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
DELETED
@@ -1,112 +0,0 @@
|
|
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
DELETED
@@ -1,97 +0,0 @@
|
|
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
DELETED
@@ -1,80 +0,0 @@
|
|
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
DELETED
@@ -1,7 +0,0 @@
|
|
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
DELETED
@@ -1,63 +0,0 @@
|
|
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
DELETED
@@ -1,89 +0,0 @@
|
|
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
DELETED
@@ -1,407 +0,0 @@
|
|
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
DELETED
@@ -1,414 +0,0 @@
|
|
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
DELETED
@@ -1,489 +0,0 @@
|
|
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
DELETED
@@ -1,24 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,13 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
DELETED
@@ -1,23 +0,0 @@
|
|
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
DELETED
@@ -1,8 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,207 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,117 +0,0 @@
|
|
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
DELETED
@@ -1,1292 +0,0 @@
|
|
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
DELETED
@@ -1,130 +0,0 @@
|
|
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
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,12 +0,0 @@
|
|
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
DELETED
@@ -1,129 +0,0 @@
|
|
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
DELETED
@@ -1,14 +0,0 @@
|
|
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
DELETED
@@ -1 +0,0 @@
|
|
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
DELETED
@@ -1,814 +0,0 @@
|
|
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
DELETED
@@ -1,49 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,34 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,69 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,39 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,62 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,40 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,57 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,33 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,32 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,33 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,47 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,33 +0,0 @@
|
|
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
DELETED
@@ -1,34 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,23 +0,0 @@
|
|
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
DELETED
@@ -1,28 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,112 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,11 +0,0 @@
|
|
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
DELETED
@@ -1,55 +0,0 @@
|
|
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
DELETED
@@ -1,79 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,247 +0,0 @@
|
|
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
DELETED
@@ -1,1407 +0,0 @@
|
|
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
DELETED
@@ -1,280 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,52 +0,0 @@
|
|
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
DELETED
@@ -1,684 +0,0 @@
|
|
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
DELETED
@@ -1,61 +0,0 @@
|
|
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
DELETED
@@ -1,1393 +0,0 @@
|
|
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
DELETED
@@ -1,56 +0,0 @@
|
|
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
DELETED
@@ -1,101 +0,0 @@
|
|
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
DELETED
@@ -1,89 +0,0 @@
|
|
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
DELETED
@@ -1,24 +0,0 @@
|
|
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
DELETED
@@ -1,24 +0,0 @@
|
|
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
DELETED
@@ -1,33 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,18 +0,0 @@
|
|
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
DELETED
@@ -1,91 +0,0 @@
|
|
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
DELETED
@@ -1,97 +0,0 @@
|
|
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
DELETED
@@ -1,46 +0,0 @@
|
|
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
DELETED
@@ -1,55 +0,0 @@
|
|
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
DELETED
@@ -1,392 +0,0 @@
|
|
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
DELETED
@@ -1,87 +0,0 @@
|
|
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
DELETED
@@ -1,137 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,261 +0,0 @@
|
|
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
DELETED
@@ -1,56 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,32 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
DELETED
@@ -1,40 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,23 +0,0 @@
|
|
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
DELETED
@@ -1,67 +0,0 @@
|
|
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
DELETED
@@ -1,41 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,27 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,27 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,28 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,27 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,71 +0,0 @@
|
|
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
DELETED
@@ -1,256 +0,0 @@
|
|
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
DELETED
@@ -1,26 +0,0 @@
|
|
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
DELETED
@@ -1,26 +0,0 @@
|
|
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
DELETED
@@ -1,47 +0,0 @@
|
|
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
DELETED
@@ -1,41 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,65 +0,0 @@
|
|
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
DELETED
@@ -1,28 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,73 +0,0 @@
|
|
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
DELETED
@@ -1,47 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
DELETED
@@ -1,25 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
DELETED
@@ -1,64 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,27 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,63 +0,0 @@
|
|
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
DELETED
@@ -1,47 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,71 +0,0 @@
|
|
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
DELETED
@@ -1,69 +0,0 @@
|
|
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
DELETED
@@ -1,237 +0,0 @@
|
|
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
DELETED
@@ -1,228 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
DELETED
@@ -1,32 +0,0 @@
|
|
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
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,54 +0,0 @@
|
|
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
DELETED
@@ -1,87 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,38 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,48 +0,0 @@
|
|
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
DELETED
@@ -1,77 +0,0 @@
|
|
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
DELETED
@@ -1,51 +0,0 @@
|
|
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
DELETED
@@ -1,172 +0,0 @@
|
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
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
DELETED
@@ -1,206 +0,0 @@
|
|
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
DELETED
@@ -1,143 +0,0 @@
|
|
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
DELETED
@@ -1,118 +0,0 @@
|
|
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
DELETED
@@ -1,358 +0,0 @@
|
|
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
DELETED
@@ -1,53 +0,0 @@
|
|
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
DELETED
@@ -1,63 +0,0 @@
|
|
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
DELETED
@@ -1,39 +0,0 @@
|
|
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
DELETED
@@ -1,34 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,63 +0,0 @@
|
|
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
DELETED
@@ -1,154 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,29 +0,0 @@
|
|
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
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
@@ -1,31 +0,0 @@
|
|
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
DELETED
@@ -1,110 +0,0 @@
|
|
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
DELETED
@@ -1,24 +0,0 @@
|
|
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
DELETED
@@ -1,49 +0,0 @@
|
|
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
DELETED
@@ -1,639 +0,0 @@
|
|
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);
|
276 |
-
return isset($this->blocks[(string) $name]);
|
277 |
-
}
|
278 |
-
if (isset($blocks[$name])) {
|
279 |
-
return $blocks[$name][0] instanceof self;
|
280 |
-
}
|
281 |
-
if (isset($this->blocks[$name])) {
|
282 |
-
return \true;
|
283 |
-
}
|
284 |
-
if (\false !== ($parent = $this->getParent($context))) {
|
285 |
-
return $parent->hasBlock($name, $context);
|
286 |
-
}
|
287 |
-
return \false;
|
288 |
-
}
|
289 |
-
/**
|
290 |
-
* Returns all block names in the current context of the template.
|
291 |
-
*
|
292 |
-
* This method checks blocks defined in the current template
|
293 |
-
* or defined in "used" traits or defined in parent templates.
|
294 |
-
*
|
295 |
-
* @param array $context The context
|
296 |
-
* @param array $blocks The current set of blocks
|
297 |
-
*
|
298 |
-
* @return array An array of block names
|
299 |
-
*/
|
300 |
-
public function getBlockNames(array $context = null, array $blocks = [])
|
301 |
-
{
|
302 |
-
if (null === $context) {
|
303 |
-
@\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);
|
304 |
-
return \array_keys($this->blocks);
|
305 |
-
}
|
306 |
-
$names = \array_merge(\array_keys($blocks), \array_keys($this->blocks));
|
307 |
-
if (\false !== ($parent = $this->getParent($context))) {
|
308 |
-
$names = \array_merge($names, $parent->getBlockNames($context));
|
309 |
-
}
|
310 |
-
return \array_unique($names);
|
311 |
-
}
|
312 |
-
/**
|
313 |
-
* @return Template|TemplateWrapper
|
314 |
-
*/
|
315 |
-
protected function loadTemplate($template, $templateName = null, $line = null, $index = null)
|
316 |
-
{
|
317 |
-
try {
|
318 |
-
if (\is_array($template)) {
|
319 |
-
return $this->env->resolveTemplate($template);
|
320 |
-
}
|
321 |
-
if ($template instanceof self || $template instanceof \WPML\Core\Twig\TemplateWrapper) {
|
322 |
-
return $template;
|
323 |
-
}
|
324 |
-
if ($template === $this->getTemplateName()) {
|
325 |
-
$class = \get_class($this);
|
326 |
-
if (\false !== ($pos = \strrpos($class, '___', -1))) {
|
327 |
-
$class = \substr($class, 0, $pos);
|
328 |
-
}
|
329 |
-
return $this->env->loadClass($class, $template, $index);
|
330 |
-
}
|
331 |
-
return $this->env->loadTemplate($template, $index);
|
332 |
-
} catch (\WPML\Core\Twig\Error\Error $e) {
|
333 |
-
if (!$e->getSourceContext()) {
|
334 |
-
$e->setSourceContext($templateName ? new \WPML\Core\Twig\Source('', $templateName) : $this->getSourceContext());
|
335 |
-
}
|
336 |
-
if ($e->getTemplateLine() > 0) {
|
337 |
-
throw $e;
|
338 |
-
}
|
339 |
-
if (!$line) {
|
340 |
-
$e->guess();
|
341 |
-
} else {
|
342 |
-
$e->setTemplateLine($line);
|
343 |
-
}
|
344 |
-
throw $e;
|
345 |
-
}
|
346 |
-
}
|
347 |
-
/**
|
348 |
-
* @internal
|
349 |
-
*
|
350 |
-
* @return Template
|
351 |
-
*/
|
352 |
-
protected function unwrap()
|
353 |
-
{
|
354 |
-
return $this;
|
355 |
-
}
|
356 |
-
/**
|
357 |
-
* Returns all blocks.
|
358 |
-
*
|
359 |
-
* This method is for internal use only and should never be called
|
360 |
-
* directly.
|
361 |
-
*
|
362 |
-
* @return array An array of blocks
|
363 |
-
*/
|
364 |
-
public function getBlocks()
|
365 |
-
{
|
366 |
-
return $this->blocks;
|
367 |
-
}
|
368 |
-
public function display(array $context, array $blocks = [])
|
369 |
-
{
|
370 |
-
$this->displayWithErrorHandling($this->env->mergeGlobals($context), \array_merge($this->blocks, $blocks));
|
371 |
-
}
|
372 |
-
public function render(array $context)
|
373 |
-
{
|
374 |
-
$level = \ob_get_level();
|
375 |
-
if ($this->env->isDebug()) {
|
376 |
-
\ob_start();
|
377 |
-
} else {
|
378 |
-
\ob_start(function () {
|
379 |
-
return '';
|
380 |
-
});
|
381 |
-
}
|
382 |
-
try {
|
383 |
-
$this->display($context);
|
384 |
-
} catch (\Exception $e) {
|
385 |
-
while (\ob_get_level() > $level) {
|
386 |
-
\ob_end_clean();
|
387 |
-
}
|
388 |
-
throw $e;
|
389 |
-
} catch (\Throwable $e) {
|
390 |
-
while (\ob_get_level() > $level) {
|
391 |
-
\ob_end_clean();
|
392 |
-
}
|
393 |
-
throw $e;
|
394 |
-
}
|
395 |
-
return \ob_get_clean();
|
396 |
-
}
|
397 |
-
protected function displayWithErrorHandling(array $context, array $blocks = [])
|
398 |
-
{
|
399 |
-
try {
|
400 |
-
$this->doDisplay($context, $blocks);
|
401 |
-
} catch (\WPML\Core\Twig\Error\Error $e) {
|
402 |
-
if (!$e->getSourceContext()) {
|
403 |
-
$e->setSourceContext($this->getSourceContext());
|
404 |
-
}
|
405 |
-
// this is mostly useful for \Twig\Error\LoaderError exceptions
|
406 |
-
// see \Twig\Error\LoaderError
|
407 |
-
if (-1 === $e->getTemplateLine()) {
|
408 |
-
$e->guess();
|
409 |
-
}
|
410 |
-
throw $e;
|
411 |
-
} catch (\Exception $e) {
|
412 |
-
$e = new \WPML\Core\Twig\Error\RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
|
413 |
-
$e->guess();
|
414 |
-
throw $e;
|
415 |
-
}
|
416 |
-
}
|
417 |
-
/**
|
418 |
-
* Auto-generated method to display the template with the given context.
|
419 |
-
*
|
420 |
-
* @param array $context An array of parameters to pass to the template
|
421 |
-
* @param array $blocks An array of blocks to pass to the template
|
422 |
-
*/
|
423 |
-
protected abstract function doDisplay(array $context, array $blocks = []);
|
424 |
-
/**
|
425 |
-
* Returns a variable from the context.
|
426 |
-
*
|
427 |
-
* This method is for internal use only and should never be called
|
428 |
-
* directly.
|
429 |
-
*
|
430 |
-
* This method should not be overridden in a sub-class as this is an
|
431 |
-
* implementation detail that has been introduced to optimize variable
|
432 |
-
* access for versions of PHP before 5.4. This is not a way to override
|
433 |
-
* the way to get a variable value.
|
434 |
-
*
|
435 |
-
* @param array $context The context
|
436 |
-
* @param string $item The variable to return from the context
|
437 |
-
* @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not
|
438 |
-
*
|
439 |
-
* @return mixed The content of the context variable
|
440 |
-
*
|
441 |
-
* @throws RuntimeError if the variable does not exist and Twig is running in strict mode
|
442 |
-
*
|
443 |
-
* @internal
|
444 |
-
*/
|
445 |
-
protected final function getContext($context, $item, $ignoreStrictCheck = \false)
|
446 |
-
{
|
447 |
-
if (!\array_key_exists($item, $context)) {
|
448 |
-
if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
|
449 |
-
return;
|
450 |
-
}
|
451 |
-
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext());
|
452 |
-
}
|
453 |
-
return $context[$item];
|
454 |
-
}
|
455 |
-
/**
|
456 |
-
* Returns the attribute value for a given array/object.
|
457 |
-
*
|
458 |
-
* @param mixed $object The object or array from where to get the item
|
459 |
-
* @param mixed $item The item to get from the array or object
|
460 |
-
* @param array $arguments An array of arguments to pass if the item is an object method
|
461 |
-
* @param string $type The type of attribute (@see \Twig\Template constants)
|
462 |
-
* @param bool $isDefinedTest Whether this is only a defined check
|
463 |
-
* @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
|
464 |
-
*
|
465 |
-
* @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
|
466 |
-
*
|
467 |
-
* @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
|
468 |
-
*
|
469 |
-
* @internal
|
470 |
-
*/
|
471 |
-
protected function getAttribute($object, $item, array $arguments = [], $type = self::ANY_CALL, $isDefinedTest = \false, $ignoreStrictCheck = \false)
|
472 |
-
{
|
473 |
-
// array
|
474 |
-
if (self::METHOD_CALL !== $type) {
|
475 |
-
$arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item;
|
476 |
-
if ((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object)) || $object instanceof \ArrayAccess && isset($object[$arrayItem])) {
|
477 |
-
if ($isDefinedTest) {
|
478 |
-
return \true;
|
479 |
-
}
|
480 |
-
return $object[$arrayItem];
|
481 |
-
}
|
482 |
-
if (self::ARRAY_CALL === $type || !\is_object($object)) {
|
483 |
-
if ($isDefinedTest) {
|
484 |
-
return \false;
|
485 |
-
}
|
486 |
-
if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
|
487 |
-
return;
|
488 |
-
}
|
489 |
-
if ($object instanceof \ArrayAccess) {
|
490 |
-
$message = \sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object));
|
491 |
-
} elseif (\is_object($object)) {
|
492 |
-
$message = \sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object));
|
493 |
-
} elseif (\is_array($object)) {
|
494 |
-
if (empty($object)) {
|
495 |
-
$message = \sprintf('Key "%s" does not exist as the array is empty.', $arrayItem);
|
496 |
-
} else {
|
497 |
-
$message = \sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, \implode(', ', \array_keys($object)));
|
498 |
-
}
|
499 |
-
} elseif (self::ARRAY_CALL === $type) {
|
500 |
-
if (null === $object) {
|
501 |
-
$message = \sprintf('Impossible to access a key ("%s") on a null variable.', $item);
|
502 |
-
} else {
|
503 |
-
$message = \sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object);
|
504 |
-
}
|
505 |
-
} elseif (null === $object) {
|
506 |
-
$message = \sprintf('Impossible to access an attribute ("%s") on a null variable.', $item);
|
507 |
-
} else {
|
508 |
-
$message = \sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object);
|
509 |
-
}
|
510 |
-
throw new \WPML\Core\Twig\Error\RuntimeError($message, -1, $this->getSourceContext());
|
511 |
-
}
|
512 |
-
}
|
513 |
-
if (!\is_object($object)) {
|
514 |
-
if ($isDefinedTest) {
|
515 |
-
return \false;
|
516 |
-
}
|
517 |
-
if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
|
518 |
-
return;
|
519 |
-
}
|
520 |
-
if (null === $object) {
|
521 |
-
$message = \sprintf('Impossible to invoke a method ("%s") on a null variable.', $item);
|
522 |
-
} elseif (\is_array($object)) {
|
523 |
-
$message = \sprintf('Impossible to invoke a method ("%s") on an array.', $item);
|
524 |
-
} else {
|
525 |
-
$message = \sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object);
|
526 |
-
}
|
527 |
-
throw new \WPML\Core\Twig\Error\RuntimeError($message, -1, $this->getSourceContext());
|
528 |
-
}
|
529 |
-
// object property
|
530 |
-
if (self::METHOD_CALL !== $type && !$object instanceof self) {
|
531 |
-
// \Twig\Template does not have public properties, and we don't want to allow access to internal ones
|
532 |
-
if (isset($object->{$item}) || \array_key_exists((string) $item, (array) $object)) {
|
533 |
-
if ($isDefinedTest) {
|
534 |
-
return \true;
|
535 |
-
}
|
536 |
-
if ($this->env->hasExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')) {
|
537 |
-
$this->env->getExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')->checkPropertyAllowed($object, $item);
|
538 |
-
}
|
539 |
-
return $object->{$item};
|
540 |
-
}
|
541 |
-
}
|
542 |
-
$class = \get_class($object);
|
543 |
-
// object method
|
544 |
-
if (!isset(self::$cache[$class])) {
|
545 |
-
// get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates
|
546 |
-
if ($object instanceof self) {
|
547 |
-
$ref = new \ReflectionClass($class);
|
548 |
-
$methods = [];
|
549 |
-
foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) {
|
550 |
-
// Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
|
551 |
-
if ('getenvironment' !== \strtolower($refMethod->name)) {
|
552 |
-
$methods[] = $refMethod->name;
|
553 |
-
}
|
554 |
-
}
|
555 |
-
} else {
|
556 |
-
$methods = \get_class_methods($object);
|
557 |
-
}
|
558 |
-
// sort values to have consistent behavior, so that "get" methods win precedence over "is" methods
|
559 |
-
\sort($methods);
|
560 |
-
$cache = [];
|
561 |
-
foreach ($methods as $method) {
|
562 |
-
$cache[$method] = $method;
|
563 |
-
$cache[$lcName = \strtolower($method)] = $method;
|
564 |
-
if ('g' === $lcName[0] && 0 === \strpos($lcName, 'get')) {
|
565 |
-
$name = \substr($method, 3);
|
566 |
-
$lcName = \substr($lcName, 3);
|
567 |
-
} elseif ('i' === $lcName[0] && 0 === \strpos($lcName, 'is')) {
|
568 |
-
$name = \substr($method, 2);
|
569 |
-
$lcName = \substr($lcName, 2);
|
570 |
-
} else {
|
571 |
-
continue;
|
572 |
-
}
|
573 |
-
// skip get() and is() methods (in which case, $name is empty)
|
574 |
-
if ($name) {
|
575 |
-
if (!isset($cache[$name])) {
|
576 |
-
$cache[$name] = $method;
|
577 |
-
}
|
578 |
-
if (!isset($cache[$lcName])) {
|
579 |
-
$cache[$lcName] = $method;
|
580 |
-
}
|
581 |
-
}
|
582 |
-
}
|
583 |
-
self::$cache[$class] = $cache;
|
584 |
-
}
|
585 |
-
$call = \false;
|
586 |
-
if (isset(self::$cache[$class][$item])) {
|
587 |
-
$method = self::$cache[$class][$item];
|
588 |
-
} elseif (isset(self::$cache[$class][$lcItem = \strtolower($item)])) {
|
589 |
-
$method = self::$cache[$class][$lcItem];
|
590 |
-
} elseif (isset(self::$cache[$class]['__call'])) {
|
591 |
-
$method = $item;
|
592 |
-
$call = \true;
|
593 |
-
} else {
|
594 |
-
if ($isDefinedTest) {
|
595 |
-
return \false;
|
596 |
-
}
|
597 |
-
if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
|
598 |
-
return;
|
599 |
-
}
|
600 |
-
throw new \WPML\Core\Twig\Error\RuntimeError(\sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext());
|
601 |
-
}
|
602 |
-
if ($isDefinedTest) {
|
603 |
-
return \true;
|
604 |
-
}
|
605 |
-
if ($this->env->hasExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')) {
|
606 |
-
$this->env->getExtension('WPML\\Core\\Twig\\Extension\\SandboxExtension')->checkMethodAllowed($object, $method);
|
607 |
-
}
|
608 |
-
// Some objects throw exceptions when they have __call, and the method we try
|
609 |
-
// to call is not supported. If ignoreStrictCheck is true, we should return null.
|
610 |
-
try {
|
611 |
-
if (!$arguments) {
|
612 |
-
$ret = $object->{$method}();
|
613 |
-
} else {
|
614 |
-
$ret = \call_user_func_array([$object, $method], $arguments);
|
615 |
-
}
|
616 |
-
} catch (\BadMethodCallException $e) {
|
617 |
-
if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
|
618 |
-
return;
|
619 |
-
}
|
620 |
-
throw $e;
|
621 |
-
}
|
622 |
-
// @deprecated in 1.28
|
623 |
-
if ($object instanceof \WPML\Core\Twig_TemplateInterface) {
|
624 |
-
$self = $object->getTemplateName() === $this->getTemplateName();
|
625 |
-
$message = \sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName());
|
626 |
-
if ('renderBlock' === $method || 'displayBlock' === $method) {
|
627 |
-
$message .= \sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template');
|
628 |
-
} elseif ('hasBlock' === $method) {
|
629 |
-
$message .= \sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template');
|
630 |
-
} elseif ('render' === $method || 'display' === $method) {
|
631 |
-
$message .= \sprintf(' Use include("%s") instead).', $object->getTemplateName());
|
632 |
-
}
|
633 |
-
@\trigger_error($message, \E_USER_DEPRECATED);
|
634 |
-
return '' === $ret ? '' : new \WPML\Core\Twig\Markup($ret, $this->env->getCharset());
|
635 |
-
}
|
636 |
-
return $ret;
|
637 |
-
}
|
638 |
-
}
|
639 |
-
\class_alias('WPML\\Core\\Twig\\Template', 'WPML\\Core\\Twig_Template');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TemplateWrapper.php
DELETED
@@ -1,148 +0,0 @@
|
|
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 |
-
* Exposes a template to userland.
|
15 |
-
*
|
16 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
17 |
-
*/
|
18 |
-
final class TemplateWrapper
|
19 |
-
{
|
20 |
-
private $env;
|
21 |
-
private $template;
|
22 |
-
/**
|
23 |
-
* This method is for internal use only and should never be called
|
24 |
-
* directly (use \\WPML\\Core\\Twig\\Environment::load() instead).
|
25 |
-
*
|
26 |
-
* @internal
|
27 |
-
*/
|
28 |
-
public function __construct(\WPML\Core\Twig\Environment $env, \WPML\Core\Twig\Template $template)
|
29 |
-
{
|
30 |
-
$this->env = $env;
|
31 |
-
$this->template = $template;
|
32 |
-
}
|
33 |
-
/**
|
34 |
-
* Renders the template.
|
35 |
-
*
|
36 |
-
* @param array $context An array of parameters to pass to the template
|
37 |
-
*
|
38 |
-
* @return string The rendered template
|
39 |
-
*/
|
40 |
-
public function render($context = [])
|
41 |
-
{
|
42 |
-
// using func_get_args() allows to not expose the blocks argument
|
43 |
-
// as it should only be used by internal code
|
44 |
-
return $this->template->render($context, \func_num_args() > 1 ? \func_get_arg(1) : []);
|
45 |
-
}
|
46 |
-
/**
|
47 |
-
* Displays the template.
|
48 |
-
*
|
49 |
-
* @param array $context An array of parameters to pass to the template
|
50 |
-
*/
|
51 |
-
public function display($context = [])
|
52 |
-
{
|
53 |
-
// using func_get_args() allows to not expose the blocks argument
|
54 |
-
// as it should only be used by internal code
|
55 |
-
$this->template->display($context, \func_num_args() > 1 ? \func_get_arg(1) : []);
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Checks if a block is defined.
|
59 |
-
*
|
60 |
-
* @param string $name The block name
|
61 |
-
* @param array $context An array of parameters to pass to the template
|
62 |
-
*
|
63 |
-
* @return bool
|
64 |
-
*/
|
65 |
-
public function hasBlock($name, $context = [])
|
66 |
-
{
|
67 |
-
return $this->template->hasBlock($name, $context);
|
68 |
-
}
|
69 |
-
/**
|
70 |
-
* Returns defined block names in the template.
|
71 |
-
*
|
72 |
-
* @param array $context An array of parameters to pass to the template
|
73 |
-
*
|
74 |
-
* @return string[] An array of defined template block names
|
75 |
-
*/
|
76 |
-
public function getBlockNames($context = [])
|
77 |
-
{
|
78 |
-
return $this->template->getBlockNames($context);
|
79 |
-
}
|
80 |
-
/**
|
81 |
-
* Renders a template block.
|
82 |
-
*
|
83 |
-
* @param string $name The block name to render
|
84 |
-
* @param array $context An array of parameters to pass to the template
|
85 |
-
*
|
86 |
-
* @return string The rendered block
|
87 |
-
*/
|
88 |
-
public function renderBlock($name, $context = [])
|
89 |
-
{
|
90 |
-
$context = $this->env->mergeGlobals($context);
|
91 |
-
$level = \ob_get_level();
|
92 |
-
if ($this->env->isDebug()) {
|
93 |
-
\ob_start();
|
94 |
-
} else {
|
95 |
-
\ob_start(function () {
|
96 |
-
return '';
|
97 |
-
});
|
98 |
-
}
|
99 |
-
try {
|
100 |
-
$this->template->displayBlock($name, $context);
|
101 |
-
} catch (\Exception $e) {
|
102 |
-
while (\ob_get_level() > $level) {
|
103 |
-
\ob_end_clean();
|
104 |
-
}
|
105 |
-
throw $e;
|
106 |
-
} catch (\Throwable $e) {
|
107 |
-
while (\ob_get_level() > $level) {
|
108 |
-
\ob_end_clean();
|
109 |
-
}
|
110 |
-
throw $e;
|
111 |
-
}
|
112 |
-
return \ob_get_clean();
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* Displays a template block.
|
116 |
-
*
|
117 |
-
* @param string $name The block name to render
|
118 |
-
* @param array $context An array of parameters to pass to the template
|
119 |
-
*/
|
120 |
-
public function displayBlock($name, $context = [])
|
121 |
-
{
|
122 |
-
$this->template->displayBlock($name, $this->env->mergeGlobals($context));
|
123 |
-
}
|
124 |
-
/**
|
125 |
-
* @return Source
|
126 |
-
*/
|
127 |
-
public function getSourceContext()
|
128 |
-
{
|
129 |
-
return $this->template->getSourceContext();
|
130 |
-
}
|
131 |
-
/**
|
132 |
-
* @return string
|
133 |
-
*/
|
134 |
-
public function getTemplateName()
|
135 |
-
{
|
136 |
-
return $this->template->getTemplateName();
|
137 |
-
}
|
138 |
-
/**
|
139 |
-
* @internal
|
140 |
-
*
|
141 |
-
* @return Template
|
142 |
-
*/
|
143 |
-
public function unwrap()
|
144 |
-
{
|
145 |
-
return $this->template;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
\class_alias('WPML\\Core\\Twig\\TemplateWrapper', 'WPML\\Core\\Twig_TemplateWrapper');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/Test/IntegrationTestCase.php
DELETED
@@ -1,213 +0,0 @@
|
|
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\Test;
|
12 |
-
|
13 |
-
use WPML\Core\PHPUnit\Framework\TestCase;
|
14 |
-
use WPML\Core\Twig\Environment;
|
15 |
-
use WPML\Core\Twig\Error\Error;
|
16 |
-
use WPML\Core\Twig\Extension\ExtensionInterface;
|
17 |
-
use WPML\Core\Twig\Loader\ArrayLoader;
|
18 |
-
use WPML\Core\Twig\Loader\SourceContextLoaderInterface;
|
19 |
-
use WPML\Core\Twig\RuntimeLoader\RuntimeLoaderInterface;
|
20 |
-
use WPML\Core\Twig\Source;
|
21 |
-
use WPML\Core\Twig\TwigFilter;
|
22 |
-
use WPML\Core\Twig\TwigFunction;
|
23 |
-
use WPML\Core\Twig\TwigTest;
|
24 |
-
/**
|
25 |
-
* Integration test helper.
|
26 |
-
*
|
27 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
28 |
-
* @author Karma Dordrak <drak@zikula.org>
|
29 |
-
*/
|
30 |
-
abstract class IntegrationTestCase extends \WPML\Core\PHPUnit\Framework\TestCase
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* @return string
|
34 |
-
*/
|
35 |
-
protected abstract function getFixturesDir();
|
36 |
-
/**
|
37 |
-
* @return RuntimeLoaderInterface[]
|
38 |
-
*/
|
39 |
-
protected function getRuntimeLoaders()
|
40 |
-
{
|
41 |
-
return [];
|
42 |
-
}
|
43 |
-
/**
|
44 |
-
* @return ExtensionInterface[]
|
45 |
-
*/
|
46 |
-
protected function getExtensions()
|
47 |
-
{
|
48 |
-
return [];
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* @return TwigFilter[]
|
52 |
-
*/
|
53 |
-
protected function getTwigFilters()
|
54 |
-
{
|
55 |
-
return [];
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* @return TwigFunction[]
|
59 |
-
*/
|
60 |
-
protected function getTwigFunctions()
|
61 |
-
{
|
62 |
-
return [];
|
63 |
-
}
|
64 |
-
/**
|
65 |
-
* @return TwigTest[]
|
66 |
-
*/
|
67 |
-
protected function getTwigTests()
|
68 |
-
{
|
69 |
-
return [];
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* @dataProvider getTests
|
73 |
-
*/
|
74 |
-
public function testIntegration($file, $message, $condition, $templates, $exception, $outputs)
|
75 |
-
{
|
76 |
-
$this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs);
|
77 |
-
}
|
78 |
-
/**
|
79 |
-
* @dataProvider getLegacyTests
|
80 |
-
* @group legacy
|
81 |
-
*/
|
82 |
-
public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs)
|
83 |
-
{
|
84 |
-
$this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs);
|
85 |
-
}
|
86 |
-
public function getTests($name, $legacyTests = \false)
|
87 |
-
{
|
88 |
-
$fixturesDir = \realpath($this->getFixturesDir());
|
89 |
-
$tests = [];
|
90 |
-
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
|
91 |
-
if (!\preg_match('/\\.test$/', $file)) {
|
92 |
-
continue;
|
93 |
-
}
|
94 |
-
if ($legacyTests xor \false !== \strpos($file->getRealpath(), '.legacy.test')) {
|
95 |
-
continue;
|
96 |
-
}
|
97 |
-
$test = \file_get_contents($file->getRealpath());
|
98 |
-
if (\preg_match('/--TEST--\\s*(.*?)\\s*(?:--CONDITION--\\s*(.*))?\\s*((?:--TEMPLATE(?:\\(.*?\\))?--(?:.*?))+)\\s*(?:--DATA--\\s*(.*))?\\s*--EXCEPTION--\\s*(.*)/sx', $test, $match)) {
|
99 |
-
$message = $match[1];
|
100 |
-
$condition = $match[2];
|
101 |
-
$templates = self::parseTemplates($match[3]);
|
102 |
-
$exception = $match[5];
|
103 |
-
$outputs = [[null, $match[4], null, '']];
|
104 |
-
} elseif (\preg_match('/--TEST--\\s*(.*?)\\s*(?:--CONDITION--\\s*(.*))?\\s*((?:--TEMPLATE(?:\\(.*?\\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) {
|
105 |
-
$message = $match[1];
|
106 |
-
$condition = $match[2];
|
107 |
-
$templates = self::parseTemplates($match[3]);
|
108 |
-
$exception = \false;
|
109 |
-
\preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\\-\\-DATA\\-\\-|$)/s', $test, $outputs, \PREG_SET_ORDER);
|
110 |
-
} else {
|
111 |
-
throw new \InvalidArgumentException(\sprintf('Test "%s" is not valid.', \str_replace($fixturesDir . '/', '', $file)));
|
112 |
-
}
|
113 |
-
$tests[] = [\str_replace($fixturesDir . '/', '', $file), $message, $condition, $templates, $exception, $outputs];
|
114 |
-
}
|
115 |
-
if ($legacyTests && empty($tests)) {
|
116 |
-
// add a dummy test to avoid a PHPUnit message
|
117 |
-
return [['not', '-', '', [], '', []]];
|
118 |
-
}
|
119 |
-
return $tests;
|
120 |
-
}
|
121 |
-
public function getLegacyTests()
|
122 |
-
{
|
123 |
-
return $this->getTests('testLegacyIntegration', \true);
|
124 |
-
}
|
125 |
-
protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs)
|
126 |
-
{
|
127 |
-
if (!$outputs) {
|
128 |
-
$this->markTestSkipped('no tests to run');
|
129 |
-
}
|
130 |
-
if ($condition) {
|
131 |
-
eval('$ret = ' . $condition . ';');
|
132 |
-
if (!$ret) {
|
133 |
-
$this->markTestSkipped($condition);
|
134 |
-
}
|
135 |
-
}
|
136 |
-
$loader = new \WPML\Core\Twig\Loader\ArrayLoader($templates);
|
137 |
-
foreach ($outputs as $i => $match) {
|
138 |
-
$config = \array_merge(['cache' => \false, 'strict_variables' => \true], $match[2] ? eval($match[2] . ';') : []);
|
139 |
-
$twig = new \WPML\Core\Twig\Environment($loader, $config);
|
140 |
-
$twig->addGlobal('global', 'global');
|
141 |
-
foreach ($this->getRuntimeLoaders() as $runtimeLoader) {
|
142 |
-
$twig->addRuntimeLoader($runtimeLoader);
|
143 |
-
}
|
144 |
-
foreach ($this->getExtensions() as $extension) {
|
145 |
-
$twig->addExtension($extension);
|
146 |
-
}
|
147 |
-
foreach ($this->getTwigFilters() as $filter) {
|
148 |
-
$twig->addFilter($filter);
|
149 |
-
}
|
150 |
-
foreach ($this->getTwigTests() as $test) {
|
151 |
-
$twig->addTest($test);
|
152 |
-
}
|
153 |
-
foreach ($this->getTwigFunctions() as $function) {
|
154 |
-
$twig->addFunction($function);
|
155 |
-
}
|
156 |
-
$p = new \ReflectionProperty($twig, 'templateClassPrefix');
|
157 |
-
$p->setAccessible(\true);
|
158 |
-
$p->setValue($twig, '\\WPML\\Core\\__TwigTemplate_' . \hash('sha256', \uniqid(\mt_rand(), \true), \false) . '_');
|
159 |
-
try {
|
160 |
-
$template = $twig->load('index.twig');
|
161 |
-
} catch (\Exception $e) {
|
162 |
-
if (\false !== $exception) {
|
163 |
-
$message = $e->getMessage();
|
164 |
-
$this->assertSame(\trim($exception), \trim(\sprintf('%s: %s', \get_class($e), $message)));
|
165 |
-
$last = \substr($message, \strlen($message) - 1);
|
166 |
-
$this->assertTrue('.' === $last || '?' === $last, 'Exception message must end with a dot or a question mark.');
|
167 |
-
return;
|
168 |
-
}
|
169 |
-
throw new \WPML\Core\Twig\Error\Error(\sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e);
|
170 |
-
}
|
171 |
-
try {
|
172 |
-
$output = \trim($template->render(eval($match[1] . ';')), "\n ");
|
173 |
-
} catch (\Exception $e) {
|
174 |
-
if (\false !== $exception) {
|
175 |
-
$this->assertSame(\trim($exception), \trim(\sprintf('%s: %s', \get_class($e), $e->getMessage())));
|
176 |
-
return;
|
177 |
-
}
|
178 |
-
$e = new \WPML\Core\Twig\Error\Error(\sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e);
|
179 |
-
$output = \trim(\sprintf('%s: %s', \get_class($e), $e->getMessage()));
|
180 |
-
}
|
181 |
-
if (\false !== $exception) {
|
182 |
-
list($class) = \explode(':', $exception);
|
183 |
-
$constraintClass = \class_exists('WPML\\Core\\PHPUnit\\Framework\\Constraint\\Exception') ? 'PHPUnit\\Framework\\Constraint\\Exception' : 'PHPUnit_Framework_Constraint_Exception';
|
184 |
-
$this->assertThat(null, new $constraintClass($class));
|
185 |
-
}
|
186 |
-
$expected = \trim($match[3], "\n ");
|
187 |
-
if ($expected !== $output) {
|
188 |
-
\printf("Compiled templates that failed on case %d:\n", $i + 1);
|
189 |
-
foreach (\array_keys($templates) as $name) {
|
190 |
-
echo "Template: {$name}\n";
|
191 |
-
$loader = $twig->getLoader();
|
192 |
-
if (!$loader instanceof \WPML\Core\Twig\Loader\SourceContextLoaderInterface) {
|
193 |
-
$source = new \WPML\Core\Twig\Source($loader->getSource($name), $name);
|
194 |
-
} else {
|
195 |
-
$source = $loader->getSourceContext($name);
|
196 |
-
}
|
197 |
-
echo $twig->compile($twig->parse($twig->tokenize($source)));
|
198 |
-
}
|
199 |
-
}
|
200 |
-
$this->assertEquals($expected, $output, $message . ' (in ' . $file . ')');
|
201 |
-
}
|
202 |
-
}
|
203 |
-
protected static function parseTemplates($test)
|
204 |
-
{
|
205 |
-
$templates = [];
|
206 |
-
\preg_match_all('/--TEMPLATE(?:\\((.*?)\\))?--(.*?)(?=\\-\\-TEMPLATE|$)/s', $test, $matches, \PREG_SET_ORDER);
|
207 |
-
foreach ($matches as $match) {
|
208 |
-
$templates[$match[1] ? $match[1] : 'index.twig'] = $match[2];
|
209 |
-
}
|
210 |
-
return $templates;
|
211 |
-
}
|
212 |
-
}
|
213 |
-
\class_alias('WPML\\Core\\Twig\\Test\\IntegrationTestCase', 'WPML\\Core\\Twig_Test_IntegrationTestCase');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/Test/NodeTestCase.php
DELETED
@@ -1,65 +0,0 @@
|
|
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\Test;
|
12 |
-
|
13 |
-
use WPML\Core\PHPUnit\Framework\TestCase;
|
14 |
-
use WPML\Core\Twig\Compiler;
|
15 |
-
use WPML\Core\Twig\Environment;
|
16 |
-
use WPML\Core\Twig\Loader\ArrayLoader;
|
17 |
-
use WPML\Core\Twig\Node\Node;
|
18 |
-
abstract class NodeTestCase extends \WPML\Core\PHPUnit\Framework\TestCase
|
19 |
-
{
|
20 |
-
public abstract function getTests();
|
21 |
-
/**
|
22 |
-
* @dataProvider getTests
|
23 |
-
*/
|
24 |
-
public function testCompile($node, $source, $environment = null, $isPattern = \false)
|
25 |
-
{
|
26 |
-
$this->assertNodeCompilation($source, $node, $environment, $isPattern);
|
27 |
-
}
|
28 |
-
public function assertNodeCompilation($source, \WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $environment = null, $isPattern = \false)
|
29 |
-
{
|
30 |
-
$compiler = $this->getCompiler($environment);
|
31 |
-
$compiler->compile($node);
|
32 |
-
if ($isPattern) {
|
33 |
-
$this->assertStringMatchesFormat($source, \trim($compiler->getSource()));
|
34 |
-
} else {
|
35 |
-
$this->assertEquals($source, \trim($compiler->getSource()));
|
36 |
-
}
|
37 |
-
}
|
38 |
-
protected function getCompiler(\WPML\Core\Twig\Environment $environment = null)
|
39 |
-
{
|
40 |
-
return new \WPML\Core\Twig\Compiler(null === $environment ? $this->getEnvironment() : $environment);
|
41 |
-
}
|
42 |
-
protected function getEnvironment()
|
43 |
-
{
|
44 |
-
return new \WPML\Core\Twig\Environment(new \WPML\Core\Twig\Loader\ArrayLoader([]));
|
45 |
-
}
|
46 |
-
protected function getVariableGetter($name, $line = \false)
|
47 |
-
{
|
48 |
-
$line = $line > 0 ? "// line {$line}\n" : '';
|
49 |
-
if (\PHP_VERSION_ID >= 70000) {
|
50 |
-
return \sprintf('%s($context["%s"] ?? null)', $line, $name);
|
51 |
-
}
|
52 |
-
if (\PHP_VERSION_ID >= 50400) {
|
53 |
-
return \sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
|
54 |
-
}
|
55 |
-
return \sprintf('%s$this->getContext($context, "%s")', $line, $name);
|
56 |
-
}
|
57 |
-
protected function getAttributeGetter()
|
58 |
-
{
|
59 |
-
if (\function_exists('WPML\\Core\\twig_template_get_attributes')) {
|
60 |
-
return 'twig_template_get_attributes($this, ';
|
61 |
-
}
|
62 |
-
return '$this->getAttribute(';
|
63 |
-
}
|
64 |
-
}
|
65 |
-
\class_alias('WPML\\Core\\Twig\\Test\\NodeTestCase', 'WPML\\Core\\Twig_Test_NodeTestCase');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/Token.php
DELETED
@@ -1,198 +0,0 @@
|
|
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 |
-
/**
|
15 |
-
* Represents a Token.
|
16 |
-
*
|
17 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
-
*
|
19 |
-
* @final
|
20 |
-
*/
|
21 |
-
class Token
|
22 |
-
{
|
23 |
-
protected $value;
|
24 |
-
protected $type;
|
25 |
-
protected $lineno;
|
26 |
-
const EOF_TYPE = -1;
|
27 |
-
const TEXT_TYPE = 0;
|
28 |
-
const BLOCK_START_TYPE = 1;
|
29 |
-
const VAR_START_TYPE = 2;
|
30 |
-
const BLOCK_END_TYPE = 3;
|
31 |
-
const VAR_END_TYPE = 4;
|
32 |
-
const NAME_TYPE = 5;
|
33 |
-
const NUMBER_TYPE = 6;
|
34 |
-
const STRING_TYPE = 7;
|
35 |
-
const OPERATOR_TYPE = 8;
|
36 |
-
const PUNCTUATION_TYPE = 9;
|
37 |
-
const INTERPOLATION_START_TYPE = 10;
|
38 |
-
const INTERPOLATION_END_TYPE = 11;
|
39 |
-
const ARROW_TYPE = 12;
|
40 |
-
/**
|
41 |
-
* @param int $type The type of the token
|
42 |
-
* @param string $value The token value
|
43 |
-
* @param int $lineno The line position in the source
|
44 |
-
*/
|
45 |
-
public function __construct($type, $value, $lineno)
|
46 |
-
{
|
47 |
-
$this->type = $type;
|
48 |
-
$this->value = $value;
|
49 |
-
$this->lineno = $lineno;
|
50 |
-
}
|
51 |
-
public function __toString()
|
52 |
-
{
|
53 |
-
return \sprintf('%s(%s)', self::typeToString($this->type, \true), $this->value);
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* Tests the current token for a type and/or a value.
|
57 |
-
*
|
58 |
-
* Parameters may be:
|
59 |
-
* * just type
|
60 |
-
* * type and value (or array of possible values)
|
61 |
-
* * just value (or array of possible values) (NAME_TYPE is used as type)
|
62 |
-
*
|
63 |
-
* @param array|string|int $type The type to test
|
64 |
-
* @param array|string|null $values The token value
|
65 |
-
*
|
66 |
-
* @return bool
|
67 |
-
*/
|
68 |
-
public function test($type, $values = null)
|
69 |
-
{
|
70 |
-
if (null === $values && !\is_int($type)) {
|
71 |
-
$values = $type;
|
72 |
-
$type = self::NAME_TYPE;
|
73 |
-
}
|
74 |
-
return $this->type === $type && (null === $values || \is_array($values) && \in_array($this->value, $values) || $this->value == $values);
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* @return int
|
78 |
-
*/
|
79 |
-
public function getLine()
|
80 |
-
{
|
81 |
-
return $this->lineno;
|
82 |
-
}
|
83 |
-
/**
|
84 |
-
* @return int
|
85 |
-
*/
|
86 |
-
public function getType()
|
87 |
-
{
|
88 |
-
return $this->type;
|
89 |
-
}
|
90 |
-
/**
|
91 |
-
* @return string
|
92 |
-
*/
|
93 |
-
public function getValue()
|
94 |
-
{
|
95 |
-
return $this->value;
|
96 |
-
}
|
97 |
-
/**
|
98 |
-
* Returns the constant representation (internal) of a given type.
|
99 |
-
*
|
100 |
-
* @param int $type The type as an integer
|
101 |
-
* @param bool $short Whether to return a short representation or not
|
102 |
-
*
|
103 |
-
* @return string The string representation
|
104 |
-
*/
|
105 |
-
public static function typeToString($type, $short = \false)
|
106 |
-
{
|
107 |
-
switch ($type) {
|
108 |
-
case self::EOF_TYPE:
|
109 |
-
$name = 'EOF_TYPE';
|
110 |
-
break;
|
111 |
-
case self::TEXT_TYPE:
|
112 |
-
$name = 'TEXT_TYPE';
|
113 |
-
break;
|
114 |
-
case self::BLOCK_START_TYPE:
|
115 |
-
$name = 'BLOCK_START_TYPE';
|
116 |
-
break;
|
117 |
-
case self::VAR_START_TYPE:
|
118 |
-
$name = 'VAR_START_TYPE';
|
119 |
-
break;
|
120 |
-
case self::BLOCK_END_TYPE:
|
121 |
-
$name = 'BLOCK_END_TYPE';
|
122 |
-
break;
|
123 |
-
case self::VAR_END_TYPE:
|
124 |
-
$name = 'VAR_END_TYPE';
|
125 |
-
break;
|
126 |
-
case self::NAME_TYPE:
|
127 |
-
$name = 'NAME_TYPE';
|
128 |
-
break;
|
129 |
-
case self::NUMBER_TYPE:
|
130 |
-
$name = 'NUMBER_TYPE';
|
131 |
-
break;
|
132 |
-
case self::STRING_TYPE:
|
133 |
-
$name = 'STRING_TYPE';
|
134 |
-
break;
|
135 |
-
case self::OPERATOR_TYPE:
|
136 |
-
$name = 'OPERATOR_TYPE';
|
137 |
-
break;
|
138 |
-
case self::PUNCTUATION_TYPE:
|
139 |
-
$name = 'PUNCTUATION_TYPE';
|
140 |
-
break;
|
141 |
-
case self::INTERPOLATION_START_TYPE:
|
142 |
-
$name = 'INTERPOLATION_START_TYPE';
|
143 |
-
break;
|
144 |
-
case self::INTERPOLATION_END_TYPE:
|
145 |
-
$name = 'INTERPOLATION_END_TYPE';
|
146 |
-
break;
|
147 |
-
case self::ARROW_TYPE:
|
148 |
-
$name = 'ARROW_TYPE';
|
149 |
-
break;
|
150 |
-
default:
|
151 |
-
throw new \LogicException(\sprintf('Token of type "%s" does not exist.', $type));
|
152 |
-
}
|
153 |
-
return $short ? $name : 'Twig\\Token::' . $name;
|
154 |
-
}
|
155 |
-
/**
|
156 |
-
* Returns the English representation of a given type.
|
157 |
-
*
|
158 |
-
* @param int $type The type as an integer
|
159 |
-
*
|
160 |
-
* @return string The string representation
|
161 |
-
*/
|
162 |
-
public static function typeToEnglish($type)
|
163 |
-
{
|
164 |
-
switch ($type) {
|
165 |
-
case self::EOF_TYPE:
|
166 |
-
return 'end of template';
|
167 |
-
case self::TEXT_TYPE:
|
168 |
-
return 'text';
|
169 |
-
case self::BLOCK_START_TYPE:
|
170 |
-
return 'begin of statement block';
|
171 |
-
case self::VAR_START_TYPE:
|
172 |
-
return 'begin of print statement';
|
173 |
-
case self::BLOCK_END_TYPE:
|
174 |
-
return 'end of statement block';
|
175 |
-
case self::VAR_END_TYPE:
|
176 |
-
return 'end of print statement';
|
177 |
-
case self::NAME_TYPE:
|
178 |
-
return 'name';
|
179 |
-
case self::NUMBER_TYPE:
|
180 |
-
return 'number';
|
181 |
-
case self::STRING_TYPE:
|
182 |
-
return 'string';
|
183 |
-
case self::OPERATOR_TYPE:
|
184 |
-
return 'operator';
|
185 |
-
case self::PUNCTUATION_TYPE:
|
186 |
-
return 'punctuation';
|
187 |
-
case self::INTERPOLATION_START_TYPE:
|
188 |
-
return 'begin of string interpolation';
|
189 |
-
case self::INTERPOLATION_END_TYPE:
|
190 |
-
return 'end of string interpolation';
|
191 |
-
case self::ARROW_TYPE:
|
192 |
-
return 'arrow function';
|
193 |
-
default:
|
194 |
-
throw new \LogicException(\sprintf('Token of type "%s" does not exist.', $type));
|
195 |
-
}
|
196 |
-
}
|
197 |
-
}
|
198 |
-
\class_alias('WPML\\Core\\Twig\\Token', 'WPML\\Core\\Twig_Token');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/AbstractTokenParser.php
DELETED
@@ -1,30 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Parser;
|
14 |
-
/**
|
15 |
-
* Base class for all token parsers.
|
16 |
-
*
|
17 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
-
*/
|
19 |
-
abstract class AbstractTokenParser implements \WPML\Core\Twig\TokenParser\TokenParserInterface
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @var Parser
|
23 |
-
*/
|
24 |
-
protected $parser;
|
25 |
-
public function setParser(\WPML\Core\Twig\Parser $parser)
|
26 |
-
{
|
27 |
-
$this->parser = $parser;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\AbstractTokenParser', 'WPML\\Core\\Twig_TokenParser');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ApplyTokenParser.php
DELETED
@@ -1,47 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\Expression\TempNameExpression;
|
14 |
-
use WPML\Core\Twig\Node\Node;
|
15 |
-
use WPML\Core\Twig\Node\PrintNode;
|
16 |
-
use WPML\Core\Twig\Node\SetNode;
|
17 |
-
use WPML\Core\Twig\Token;
|
18 |
-
/**
|
19 |
-
* Applies filters on a section of a template.
|
20 |
-
*
|
21 |
-
* {% apply upper %}
|
22 |
-
* This text becomes uppercase
|
23 |
-
* {% endapplys %}
|
24 |
-
*/
|
25 |
-
final class ApplyTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
26 |
-
{
|
27 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
28 |
-
{
|
29 |
-
$lineno = $token->getLine();
|
30 |
-
$name = $this->parser->getVarName();
|
31 |
-
$ref = new \WPML\Core\Twig\Node\Expression\TempNameExpression($name, $lineno);
|
32 |
-
$ref->setAttribute('always_defined', \true);
|
33 |
-
$filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
|
34 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
35 |
-
$body = $this->parser->subparse([$this, 'decideApplyEnd'], \true);
|
36 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
37 |
-
return new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\SetNode(\true, $ref, $body, $lineno, $this->getTag()), new \WPML\Core\Twig\Node\PrintNode($filter, $lineno, $this->getTag())]);
|
38 |
-
}
|
39 |
-
public function decideApplyEnd(\WPML\Core\Twig\Token $token)
|
40 |
-
{
|
41 |
-
return $token->test('endapply');
|
42 |
-
}
|
43 |
-
public function getTag()
|
44 |
-
{
|
45 |
-
return 'apply';
|
46 |
-
}
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/AutoEscapeTokenParser.php
DELETED
@@ -1,75 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\AutoEscapeNode;
|
15 |
-
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
16 |
-
use WPML\Core\Twig\Token;
|
17 |
-
/**
|
18 |
-
* Marks a section of a template to be escaped or not.
|
19 |
-
*
|
20 |
-
* {% autoescape true %}
|
21 |
-
* Everything will be automatically escaped in this block
|
22 |
-
* {% endautoescape %}
|
23 |
-
*
|
24 |
-
* {% autoescape false %}
|
25 |
-
* Everything will be outputed as is in this block
|
26 |
-
* {% endautoescape %}
|
27 |
-
*
|
28 |
-
* {% autoescape true js %}
|
29 |
-
* Everything will be automatically escaped in this block
|
30 |
-
* using the js escaping strategy
|
31 |
-
* {% endautoescape %}
|
32 |
-
*
|
33 |
-
* @final
|
34 |
-
*/
|
35 |
-
class AutoEscapeTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
36 |
-
{
|
37 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
38 |
-
{
|
39 |
-
$lineno = $token->getLine();
|
40 |
-
$stream = $this->parser->getStream();
|
41 |
-
if ($stream->test(\WPML\Core\Twig\Token::BLOCK_END_TYPE)) {
|
42 |
-
$value = 'html';
|
43 |
-
} else {
|
44 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
45 |
-
if (!$expr instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
46 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
47 |
-
}
|
48 |
-
$value = $expr->getAttribute('value');
|
49 |
-
$compat = \true === $value || \false === $value;
|
50 |
-
if (\true === $value) {
|
51 |
-
$value = 'html';
|
52 |
-
}
|
53 |
-
if ($compat && $stream->test(\WPML\Core\Twig\Token::NAME_TYPE)) {
|
54 |
-
@\trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', \E_USER_DEPRECATED);
|
55 |
-
if (\false === $value) {
|
56 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
57 |
-
}
|
58 |
-
$value = $stream->next()->getValue();
|
59 |
-
}
|
60 |
-
}
|
61 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
62 |
-
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
63 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
64 |
-
return new \WPML\Core\Twig\Node\AutoEscapeNode($value, $body, $lineno, $this->getTag());
|
65 |
-
}
|
66 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
67 |
-
{
|
68 |
-
return $token->test('endautoescape');
|
69 |
-
}
|
70 |
-
public function getTag()
|
71 |
-
{
|
72 |
-
return 'autoescape';
|
73 |
-
}
|
74 |
-
}
|
75 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\AutoEscapeTokenParser', 'WPML\\Core\\Twig_TokenParser_AutoEscape');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/BlockTokenParser.php
DELETED
@@ -1,69 +0,0 @@
|
|
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\TokenParser;
|
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\Node;
|
18 |
-
use WPML\Core\Twig\Node\PrintNode;
|
19 |
-
use WPML\Core\Twig\Token;
|
20 |
-
/**
|
21 |
-
* Marks a section of a template as being reusable.
|
22 |
-
*
|
23 |
-
* {% block head %}
|
24 |
-
* <link rel="stylesheet" href="style.css" />
|
25 |
-
* <title>{% block title %}{% endblock %} - My Webpage</title>
|
26 |
-
* {% endblock %}
|
27 |
-
*
|
28 |
-
* @final
|
29 |
-
*/
|
30 |
-
class BlockTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
31 |
-
{
|
32 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
33 |
-
{
|
34 |
-
$lineno = $token->getLine();
|
35 |
-
$stream = $this->parser->getStream();
|
36 |
-
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
37 |
-
if ($this->parser->hasBlock($name)) {
|
38 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
39 |
-
}
|
40 |
-
$this->parser->setBlock($name, $block = new \WPML\Core\Twig\Node\BlockNode($name, new \WPML\Core\Twig\Node\Node([]), $lineno));
|
41 |
-
$this->parser->pushLocalScope();
|
42 |
-
$this->parser->pushBlockStack($name);
|
43 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::BLOCK_END_TYPE)) {
|
44 |
-
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
45 |
-
if ($token = $stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE)) {
|
46 |
-
$value = $token->getValue();
|
47 |
-
if ($value != $name) {
|
48 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
49 |
-
}
|
50 |
-
}
|
51 |
-
} else {
|
52 |
-
$body = new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno)]);
|
53 |
-
}
|
54 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
55 |
-
$block->setNode('body', $body);
|
56 |
-
$this->parser->popBlockStack();
|
57 |
-
$this->parser->popLocalScope();
|
58 |
-
return new \WPML\Core\Twig\Node\BlockReferenceNode($name, $lineno, $this->getTag());
|
59 |
-
}
|
60 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
61 |
-
{
|
62 |
-
return $token->test('endblock');
|
63 |
-
}
|
64 |
-
public function getTag()
|
65 |
-
{
|
66 |
-
return 'block';
|
67 |
-
}
|
68 |
-
}
|
69 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\BlockTokenParser', 'WPML\\Core\\Twig_TokenParser_Block');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/DeprecatedTokenParser.php
DELETED
@@ -1,38 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\DeprecatedNode;
|
14 |
-
use WPML\Core\Twig\Token;
|
15 |
-
/**
|
16 |
-
* Deprecates a section of a template.
|
17 |
-
*
|
18 |
-
* {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
|
19 |
-
* {% extends 'layout.html.twig' %}
|
20 |
-
*
|
21 |
-
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
22 |
-
*
|
23 |
-
* @final
|
24 |
-
*/
|
25 |
-
class DeprecatedTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
26 |
-
{
|
27 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
28 |
-
{
|
29 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
30 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
31 |
-
return new \WPML\Core\Twig\Node\DeprecatedNode($expr, $token->getLine(), $this->getTag());
|
32 |
-
}
|
33 |
-
public function getTag()
|
34 |
-
{
|
35 |
-
return 'deprecated';
|
36 |
-
}
|
37 |
-
}
|
38 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\DeprecatedTokenParser', 'WPML\\Core\\Twig_TokenParser_Deprecated');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/DoTokenParser.php
DELETED
@@ -1,33 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\DoNode;
|
14 |
-
use WPML\Core\Twig\Token;
|
15 |
-
/**
|
16 |
-
* Evaluates an expression, discarding the returned value.
|
17 |
-
*
|
18 |
-
* @final
|
19 |
-
*/
|
20 |
-
class DoTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
21 |
-
{
|
22 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
23 |
-
{
|
24 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
25 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
26 |
-
return new \WPML\Core\Twig\Node\DoNode($expr, $token->getLine(), $this->getTag());
|
27 |
-
}
|
28 |
-
public function getTag()
|
29 |
-
{
|
30 |
-
return 'do';
|
31 |
-
}
|
32 |
-
}
|
33 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\DoTokenParser', 'WPML\\Core\\Twig_TokenParser_Do');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/EmbedTokenParser.php
DELETED
@@ -1,55 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\EmbedNode;
|
14 |
-
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
15 |
-
use WPML\Core\Twig\Node\Expression\NameExpression;
|
16 |
-
use WPML\Core\Twig\Token;
|
17 |
-
/**
|
18 |
-
* Embeds a template.
|
19 |
-
*
|
20 |
-
* @final
|
21 |
-
*/
|
22 |
-
class EmbedTokenParser extends \WPML\Core\Twig\TokenParser\IncludeTokenParser
|
23 |
-
{
|
24 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
25 |
-
{
|
26 |
-
$stream = $this->parser->getStream();
|
27 |
-
$parent = $this->parser->getExpressionParser()->parseExpression();
|
28 |
-
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
29 |
-
$parentToken = $fakeParentToken = new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::STRING_TYPE, '__parent__', $token->getLine());
|
30 |
-
if ($parent instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
31 |
-
$parentToken = new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine());
|
32 |
-
} elseif ($parent instanceof \WPML\Core\Twig\Node\Expression\NameExpression) {
|
33 |
-
$parentToken = new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine());
|
34 |
-
}
|
35 |
-
// inject a fake parent to make the parent() function work
|
36 |
-
$stream->injectTokens([new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::BLOCK_START_TYPE, '', $token->getLine()), new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::NAME_TYPE, 'extends', $token->getLine()), $parentToken, new \WPML\Core\Twig\Token(\WPML\Core\Twig\Token::BLOCK_END_TYPE, '', $token->getLine())]);
|
37 |
-
$module = $this->parser->parse($stream, [$this, 'decideBlockEnd'], \true);
|
38 |
-
// override the parent with the correct one
|
39 |
-
if ($fakeParentToken === $parentToken) {
|
40 |
-
$module->setNode('parent', $parent);
|
41 |
-
}
|
42 |
-
$this->parser->embedTemplate($module);
|
43 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
44 |
-
return new \WPML\Core\Twig\Node\EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
|
45 |
-
}
|
46 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
47 |
-
{
|
48 |
-
return $token->test('endembed');
|
49 |
-
}
|
50 |
-
public function getTag()
|
51 |
-
{
|
52 |
-
return 'embed';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\EmbedTokenParser', 'WPML\\Core\\Twig_TokenParser_Embed');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ExtendsTokenParser.php
DELETED
@@ -1,46 +0,0 @@
|
|
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\TokenParser;
|
13 |
-
|
14 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
-
use WPML\Core\Twig\Node\Node;
|
16 |
-
use WPML\Core\Twig\Token;
|
17 |
-
/**
|
18 |
-
* Extends a template by another one.
|
19 |
-
*
|
20 |
-
* {% extends "base.html" %}
|
21 |
-
*
|
22 |
-
* @final
|
23 |
-
*/
|
24 |
-
class ExtendsTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
25 |
-
{
|
26 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
27 |
-
{
|
28 |
-
$stream = $this->parser->getStream();
|
29 |
-
if ($this->parser->peekBlockStack()) {
|
30 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext());
|
31 |
-
} elseif (!$this->parser->isMainScope()) {
|
32 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext());
|
33 |
-
}
|
34 |
-
if (null !== $this->parser->getParent()) {
|
35 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext());
|
36 |
-
}
|
37 |
-
$this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
|
38 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
39 |
-
return new \WPML\Core\Twig\Node\Node();
|
40 |
-
}
|
41 |
-
public function getTag()
|
42 |
-
{
|
43 |
-
return 'extends';
|
44 |
-
}
|
45 |
-
}
|
46 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\ExtendsTokenParser', 'WPML\\Core\\Twig_TokenParser_Extends');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FilterTokenParser.php
DELETED
@@ -1,50 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\BlockNode;
|
14 |
-
use WPML\Core\Twig\Node\Expression\BlockReferenceExpression;
|
15 |
-
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
16 |
-
use WPML\Core\Twig\Node\PrintNode;
|
17 |
-
use WPML\Core\Twig\Token;
|
18 |
-
/**
|
19 |
-
* Filters a section of a template by applying filters.
|
20 |
-
*
|
21 |
-
* {% filter upper %}
|
22 |
-
* This text becomes uppercase
|
23 |
-
* {% endfilter %}
|
24 |
-
*
|
25 |
-
* @final
|
26 |
-
*/
|
27 |
-
class FilterTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
28 |
-
{
|
29 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
30 |
-
{
|
31 |
-
$name = $this->parser->getVarName();
|
32 |
-
$ref = new \WPML\Core\Twig\Node\Expression\BlockReferenceExpression(new \WPML\Core\Twig\Node\Expression\ConstantExpression($name, $token->getLine()), null, $token->getLine(), $this->getTag());
|
33 |
-
$filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
|
34 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
35 |
-
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
36 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
37 |
-
$block = new \WPML\Core\Twig\Node\BlockNode($name, $body, $token->getLine());
|
38 |
-
$this->parser->setBlock($name, $block);
|
39 |
-
return new \WPML\Core\Twig\Node\PrintNode($filter, $token->getLine(), $this->getTag());
|
40 |
-
}
|
41 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
42 |
-
{
|
43 |
-
return $token->test('endfilter');
|
44 |
-
}
|
45 |
-
public function getTag()
|
46 |
-
{
|
47 |
-
return 'filter';
|
48 |
-
}
|
49 |
-
}
|
50 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\FilterTokenParser', 'WPML\\Core\\Twig_TokenParser_Filter');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FlushTokenParser.php
DELETED
@@ -1,34 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\FlushNode;
|
14 |
-
use WPML\Core\Twig\Token;
|
15 |
-
/**
|
16 |
-
* Flushes the output to the client.
|
17 |
-
*
|
18 |
-
* @see flush()
|
19 |
-
*
|
20 |
-
* @final
|
21 |
-
*/
|
22 |
-
class FlushTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
23 |
-
{
|
24 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
25 |
-
{
|
26 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
27 |
-
return new \WPML\Core\Twig\Node\FlushNode($token->getLine(), $this->getTag());
|
28 |
-
}
|
29 |
-
public function getTag()
|
30 |
-
{
|
31 |
-
return 'flush';
|
32 |
-
}
|
33 |
-
}
|
34 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\FlushTokenParser', 'WPML\\Core\\Twig_TokenParser_Flush');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ForTokenParser.php
DELETED
@@ -1,118 +0,0 @@
|
|
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\TokenParser;
|
13 |
-
|
14 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
-
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
16 |
-
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
17 |
-
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
|
18 |
-
use WPML\Core\Twig\Node\Expression\NameExpression;
|
19 |
-
use WPML\Core\Twig\Node\ForNode;
|
20 |
-
use WPML\Core\Twig\Token;
|
21 |
-
use WPML\Core\Twig\TokenStream;
|
22 |
-
/**
|
23 |
-
* Loops over each item of a sequence.
|
24 |
-
*
|
25 |
-
* <ul>
|
26 |
-
* {% for user in users %}
|
27 |
-
* <li>{{ user.username|e }}</li>
|
28 |
-
* {% endfor %}
|
29 |
-
* </ul>
|
30 |
-
*
|
31 |
-
* @final
|
32 |
-
*/
|
33 |
-
class ForTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
34 |
-
{
|
35 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
36 |
-
{
|
37 |
-
$lineno = $token->getLine();
|
38 |
-
$stream = $this->parser->getStream();
|
39 |
-
$targets = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
40 |
-
$stream->expect(\WPML\Core\Twig\Token::OPERATOR_TYPE, 'in');
|
41 |
-
$seq = $this->parser->getExpressionParser()->parseExpression();
|
42 |
-
$ifexpr = null;
|
43 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE, 'if')) {
|
44 |
-
$ifexpr = $this->parser->getExpressionParser()->parseExpression();
|
45 |
-
}
|
46 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
47 |
-
$body = $this->parser->subparse([$this, 'decideForFork']);
|
48 |
-
if ('else' == $stream->next()->getValue()) {
|
49 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
50 |
-
$else = $this->parser->subparse([$this, 'decideForEnd'], \true);
|
51 |
-
} else {
|
52 |
-
$else = null;
|
53 |
-
}
|
54 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
55 |
-
if (\count($targets) > 1) {
|
56 |
-
$keyTarget = $targets->getNode(0);
|
57 |
-
$keyTarget = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine());
|
58 |
-
$valueTarget = $targets->getNode(1);
|
59 |
-
$valueTarget = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
|
60 |
-
} else {
|
61 |
-
$keyTarget = new \WPML\Core\Twig\Node\Expression\AssignNameExpression('_key', $lineno);
|
62 |
-
$valueTarget = $targets->getNode(0);
|
63 |
-
$valueTarget = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine());
|
64 |
-
}
|
65 |
-
if ($ifexpr) {
|
66 |
-
$this->checkLoopUsageCondition($stream, $ifexpr);
|
67 |
-
$this->checkLoopUsageBody($stream, $body);
|
68 |
-
}
|
69 |
-
return new \WPML\Core\Twig\Node\ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag());
|
70 |
-
}
|
71 |
-
public function decideForFork(\WPML\Core\Twig\Token $token)
|
72 |
-
{
|
73 |
-
return $token->test(['else', 'endfor']);
|
74 |
-
}
|
75 |
-
public function decideForEnd(\WPML\Core\Twig\Token $token)
|
76 |
-
{
|
77 |
-
return $token->test('endfor');
|
78 |
-
}
|
79 |
-
// the loop variable cannot be used in the condition
|
80 |
-
protected function checkLoopUsageCondition(\WPML\Core\Twig\TokenStream $stream, \WPML\Core\Twig_NodeInterface $node)
|
81 |
-
{
|
82 |
-
if ($node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \WPML\Core\Twig\Node\Expression\NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) {
|
83 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext());
|
84 |
-
}
|
85 |
-
foreach ($node as $n) {
|
86 |
-
if (!$n) {
|
87 |
-
continue;
|
88 |
-
}
|
89 |
-
$this->checkLoopUsageCondition($stream, $n);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
// check usage of non-defined loop-items
|
93 |
-
// it does not catch all problems (for instance when a for is included into another or when the variable is used in an include)
|
94 |
-
protected function checkLoopUsageBody(\WPML\Core\Twig\TokenStream $stream, \WPML\Core\Twig_NodeInterface $node)
|
95 |
-
{
|
96 |
-
if ($node instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \WPML\Core\Twig\Node\Expression\NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) {
|
97 |
-
$attribute = $node->getNode('attribute');
|
98 |
-
if ($attribute instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression && \in_array($attribute->getAttribute('value'), ['length', 'revindex0', 'revindex', 'last'])) {
|
99 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext());
|
100 |
-
}
|
101 |
-
}
|
102 |
-
// should check for parent.loop.XXX usage
|
103 |
-
if ($node instanceof \WPML\Core\Twig\Node\ForNode) {
|
104 |
-
return;
|
105 |
-
}
|
106 |
-
foreach ($node as $n) {
|
107 |
-
if (!$n) {
|
108 |
-
continue;
|
109 |
-
}
|
110 |
-
$this->checkLoopUsageBody($stream, $n);
|
111 |
-
}
|
112 |
-
}
|
113 |
-
public function getTag()
|
114 |
-
{
|
115 |
-
return 'for';
|
116 |
-
}
|
117 |
-
}
|
118 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\ForTokenParser', 'WPML\\Core\\Twig_TokenParser_For');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/FromTokenParser.php
DELETED
@@ -1,59 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
15 |
-
use WPML\Core\Twig\Node\ImportNode;
|
16 |
-
use WPML\Core\Twig\Token;
|
17 |
-
/**
|
18 |
-
* Imports macros.
|
19 |
-
*
|
20 |
-
* {% from 'forms.html' import forms %}
|
21 |
-
*
|
22 |
-
* @final
|
23 |
-
*/
|
24 |
-
class FromTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
25 |
-
{
|
26 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
27 |
-
{
|
28 |
-
$macro = $this->parser->getExpressionParser()->parseExpression();
|
29 |
-
$stream = $this->parser->getStream();
|
30 |
-
$stream->expect(\WPML\Core\Twig\Token::NAME_TYPE, 'import');
|
31 |
-
$targets = [];
|
32 |
-
do {
|
33 |
-
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
34 |
-
$alias = $name;
|
35 |
-
if ($stream->nextIf('as')) {
|
36 |
-
$alias = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
37 |
-
}
|
38 |
-
$targets[$name] = $alias;
|
39 |
-
if (!$stream->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
40 |
-
break;
|
41 |
-
}
|
42 |
-
} while (\true);
|
43 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
44 |
-
$var = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($this->parser->getVarName(), $token->getLine());
|
45 |
-
$node = new \WPML\Core\Twig\Node\ImportNode($macro, $var, $token->getLine(), $this->getTag());
|
46 |
-
foreach ($targets as $name => $alias) {
|
47 |
-
if ($this->parser->isReservedMacroName($name)) {
|
48 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext());
|
49 |
-
}
|
50 |
-
$this->parser->addImportedSymbol('function', $alias, 'get' . $name, $var);
|
51 |
-
}
|
52 |
-
return $node;
|
53 |
-
}
|
54 |
-
public function getTag()
|
55 |
-
{
|
56 |
-
return 'from';
|
57 |
-
}
|
58 |
-
}
|
59 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\FromTokenParser', 'WPML\\Core\\Twig_TokenParser_From');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/IfTokenParser.php
DELETED
@@ -1,79 +0,0 @@
|
|
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\TokenParser;
|
13 |
-
|
14 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
-
use WPML\Core\Twig\Node\IfNode;
|
16 |
-
use WPML\Core\Twig\Node\Node;
|
17 |
-
use WPML\Core\Twig\Token;
|
18 |
-
/**
|
19 |
-
* Tests a condition.
|
20 |
-
*
|
21 |
-
* {% if users %}
|
22 |
-
* <ul>
|
23 |
-
* {% for user in users %}
|
24 |
-
* <li>{{ user.username|e }}</li>
|
25 |
-
* {% endfor %}
|
26 |
-
* </ul>
|
27 |
-
* {% endif %}
|
28 |
-
*
|
29 |
-
* @final
|
30 |
-
*/
|
31 |
-
class IfTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
32 |
-
{
|
33 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
34 |
-
{
|
35 |
-
$lineno = $token->getLine();
|
36 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
37 |
-
$stream = $this->parser->getStream();
|
38 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
39 |
-
$body = $this->parser->subparse([$this, 'decideIfFork']);
|
40 |
-
$tests = [$expr, $body];
|
41 |
-
$else = null;
|
42 |
-
$end = \false;
|
43 |
-
while (!$end) {
|
44 |
-
switch ($stream->next()->getValue()) {
|
45 |
-
case 'else':
|
46 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
47 |
-
$else = $this->parser->subparse([$this, 'decideIfEnd']);
|
48 |
-
break;
|
49 |
-
case 'elseif':
|
50 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
51 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
52 |
-
$body = $this->parser->subparse([$this, 'decideIfFork']);
|
53 |
-
$tests[] = $expr;
|
54 |
-
$tests[] = $body;
|
55 |
-
break;
|
56 |
-
case 'endif':
|
57 |
-
$end = \true;
|
58 |
-
break;
|
59 |
-
default:
|
60 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
61 |
-
}
|
62 |
-
}
|
63 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
64 |
-
return new \WPML\Core\Twig\Node\IfNode(new \WPML\Core\Twig\Node\Node($tests), $else, $lineno, $this->getTag());
|
65 |
-
}
|
66 |
-
public function decideIfFork(\WPML\Core\Twig\Token $token)
|
67 |
-
{
|
68 |
-
return $token->test(['elseif', 'else', 'endif']);
|
69 |
-
}
|
70 |
-
public function decideIfEnd(\WPML\Core\Twig\Token $token)
|
71 |
-
{
|
72 |
-
return $token->test(['endif']);
|
73 |
-
}
|
74 |
-
public function getTag()
|
75 |
-
{
|
76 |
-
return 'if';
|
77 |
-
}
|
78 |
-
}
|
79 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\IfTokenParser', 'WPML\\Core\\Twig_TokenParser_If');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/ImportTokenParser.php
DELETED
@@ -1,39 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\Expression\AssignNameExpression;
|
14 |
-
use WPML\Core\Twig\Node\ImportNode;
|
15 |
-
use WPML\Core\Twig\Token;
|
16 |
-
/**
|
17 |
-
* Imports macros.
|
18 |
-
*
|
19 |
-
* {% import 'forms.html' as forms %}
|
20 |
-
*
|
21 |
-
* @final
|
22 |
-
*/
|
23 |
-
class ImportTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
24 |
-
{
|
25 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
26 |
-
{
|
27 |
-
$macro = $this->parser->getExpressionParser()->parseExpression();
|
28 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::NAME_TYPE, 'as');
|
29 |
-
$var = new \WPML\Core\Twig\Node\Expression\AssignNameExpression($this->parser->getStream()->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue(), $token->getLine());
|
30 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
31 |
-
$this->parser->addImportedSymbol('template', $var->getAttribute('name'));
|
32 |
-
return new \WPML\Core\Twig\Node\ImportNode($macro, $var, $token->getLine(), $this->getTag());
|
33 |
-
}
|
34 |
-
public function getTag()
|
35 |
-
{
|
36 |
-
return 'import';
|
37 |
-
}
|
38 |
-
}
|
39 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\ImportTokenParser', 'WPML\\Core\\Twig_TokenParser_Import');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/IncludeTokenParser.php
DELETED
@@ -1,55 +0,0 @@
|
|
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\TokenParser;
|
13 |
-
|
14 |
-
use WPML\Core\Twig\Node\IncludeNode;
|
15 |
-
use WPML\Core\Twig\Token;
|
16 |
-
/**
|
17 |
-
* Includes a template.
|
18 |
-
*
|
19 |
-
* {% include 'header.html' %}
|
20 |
-
* Body
|
21 |
-
* {% include 'footer.html' %}
|
22 |
-
*/
|
23 |
-
class IncludeTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
24 |
-
{
|
25 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
26 |
-
{
|
27 |
-
$expr = $this->parser->getExpressionParser()->parseExpression();
|
28 |
-
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
29 |
-
return new \WPML\Core\Twig\Node\IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
|
30 |
-
}
|
31 |
-
protected function parseArguments()
|
32 |
-
{
|
33 |
-
$stream = $this->parser->getStream();
|
34 |
-
$ignoreMissing = \false;
|
35 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE, 'ignore')) {
|
36 |
-
$stream->expect(\WPML\Core\Twig\Token::NAME_TYPE, 'missing');
|
37 |
-
$ignoreMissing = \true;
|
38 |
-
}
|
39 |
-
$variables = null;
|
40 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE, 'with')) {
|
41 |
-
$variables = $this->parser->getExpressionParser()->parseExpression();
|
42 |
-
}
|
43 |
-
$only = \false;
|
44 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE, 'only')) {
|
45 |
-
$only = \true;
|
46 |
-
}
|
47 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
48 |
-
return [$variables, $only, $ignoreMissing];
|
49 |
-
}
|
50 |
-
public function getTag()
|
51 |
-
{
|
52 |
-
return 'include';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\IncludeTokenParser', 'WPML\\Core\\Twig_TokenParser_Include');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/MacroTokenParser.php
DELETED
@@ -1,58 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\BodyNode;
|
15 |
-
use WPML\Core\Twig\Node\MacroNode;
|
16 |
-
use WPML\Core\Twig\Node\Node;
|
17 |
-
use WPML\Core\Twig\Token;
|
18 |
-
/**
|
19 |
-
* Defines a macro.
|
20 |
-
*
|
21 |
-
* {% macro input(name, value, type, size) %}
|
22 |
-
* <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
23 |
-
* {% endmacro %}
|
24 |
-
*
|
25 |
-
* @final
|
26 |
-
*/
|
27 |
-
class MacroTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
28 |
-
{
|
29 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
30 |
-
{
|
31 |
-
$lineno = $token->getLine();
|
32 |
-
$stream = $this->parser->getStream();
|
33 |
-
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
34 |
-
$arguments = $this->parser->getExpressionParser()->parseArguments(\true, \true);
|
35 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
36 |
-
$this->parser->pushLocalScope();
|
37 |
-
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
38 |
-
if ($token = $stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE)) {
|
39 |
-
$value = $token->getValue();
|
40 |
-
if ($value != $name) {
|
41 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
42 |
-
}
|
43 |
-
}
|
44 |
-
$this->parser->popLocalScope();
|
45 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
46 |
-
$this->parser->setMacro($name, new \WPML\Core\Twig\Node\MacroNode($name, new \WPML\Core\Twig\Node\BodyNode([$body]), $arguments, $lineno, $this->getTag()));
|
47 |
-
return new \WPML\Core\Twig\Node\Node();
|
48 |
-
}
|
49 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
50 |
-
{
|
51 |
-
return $token->test('endmacro');
|
52 |
-
}
|
53 |
-
public function getTag()
|
54 |
-
{
|
55 |
-
return 'macro';
|
56 |
-
}
|
57 |
-
}
|
58 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\MacroTokenParser', 'WPML\\Core\\Twig_TokenParser_Macro');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SandboxTokenParser.php
DELETED
@@ -1,59 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\IncludeNode;
|
15 |
-
use WPML\Core\Twig\Node\SandboxNode;
|
16 |
-
use WPML\Core\Twig\Node\TextNode;
|
17 |
-
use WPML\Core\Twig\Token;
|
18 |
-
/**
|
19 |
-
* Marks a section of a template as untrusted code that must be evaluated in the sandbox mode.
|
20 |
-
*
|
21 |
-
* {% sandbox %}
|
22 |
-
* {% include 'user.html' %}
|
23 |
-
* {% endsandbox %}
|
24 |
-
*
|
25 |
-
* @see https://twig.symfony.com/doc/api.html#sandbox-extension for details
|
26 |
-
*
|
27 |
-
* @final
|
28 |
-
*/
|
29 |
-
class SandboxTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
30 |
-
{
|
31 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
32 |
-
{
|
33 |
-
$stream = $this->parser->getStream();
|
34 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
35 |
-
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
36 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
37 |
-
// in a sandbox tag, only include tags are allowed
|
38 |
-
if (!$body instanceof \WPML\Core\Twig\Node\IncludeNode) {
|
39 |
-
foreach ($body as $node) {
|
40 |
-
if ($node instanceof \WPML\Core\Twig\Node\TextNode && \ctype_space($node->getAttribute('data'))) {
|
41 |
-
continue;
|
42 |
-
}
|
43 |
-
if (!$node instanceof \WPML\Core\Twig\Node\IncludeNode) {
|
44 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext());
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
return new \WPML\Core\Twig\Node\SandboxNode($body, $token->getLine(), $this->getTag());
|
49 |
-
}
|
50 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
51 |
-
{
|
52 |
-
return $token->test('endsandbox');
|
53 |
-
}
|
54 |
-
public function getTag()
|
55 |
-
{
|
56 |
-
return 'sandbox';
|
57 |
-
}
|
58 |
-
}
|
59 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\SandboxTokenParser', 'WPML\\Core\\Twig_TokenParser_Sandbox');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SetTokenParser.php
DELETED
@@ -1,62 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\SetNode;
|
15 |
-
use WPML\Core\Twig\Token;
|
16 |
-
/**
|
17 |
-
* Defines a variable.
|
18 |
-
*
|
19 |
-
* {% set foo = 'foo' %}
|
20 |
-
* {% set foo = [1, 2] %}
|
21 |
-
* {% set foo = {'foo': 'bar'} %}
|
22 |
-
* {% set foo = 'foo' ~ 'bar' %}
|
23 |
-
* {% set foo, bar = 'foo', 'bar' %}
|
24 |
-
* {% set foo %}Some content{% endset %}
|
25 |
-
*
|
26 |
-
* @final
|
27 |
-
*/
|
28 |
-
class SetTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
29 |
-
{
|
30 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
31 |
-
{
|
32 |
-
$lineno = $token->getLine();
|
33 |
-
$stream = $this->parser->getStream();
|
34 |
-
$names = $this->parser->getExpressionParser()->parseAssignmentExpression();
|
35 |
-
$capture = \false;
|
36 |
-
if ($stream->nextIf(\WPML\Core\Twig\Token::OPERATOR_TYPE, '=')) {
|
37 |
-
$values = $this->parser->getExpressionParser()->parseMultitargetExpression();
|
38 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
39 |
-
if (\count($names) !== \count($values)) {
|
40 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
41 |
-
}
|
42 |
-
} else {
|
43 |
-
$capture = \true;
|
44 |
-
if (\count($names) > 1) {
|
45 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
46 |
-
}
|
47 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
48 |
-
$values = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
|
49 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
50 |
-
}
|
51 |
-
return new \WPML\Core\Twig\Node\SetNode($capture, $names, $values, $lineno, $this->getTag());
|
52 |
-
}
|
53 |
-
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
|
54 |
-
{
|
55 |
-
return $token->test('endset');
|
56 |
-
}
|
57 |
-
public function getTag()
|
58 |
-
{
|
59 |
-
return 'set';
|
60 |
-
}
|
61 |
-
}
|
62 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\SetTokenParser', 'WPML\\Core\\Twig_TokenParser_Set');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/SpacelessTokenParser.php
DELETED
@@ -1,46 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\SpacelessNode;
|
14 |
-
use WPML\Core\Twig\Token;
|
15 |
-
/**
|
16 |
-
* Remove whitespaces between HTML tags.
|
17 |
-
*
|
18 |
-
* {% spaceless %}
|
19 |
-
* <div>
|
20 |
-
* <strong>foo</strong>
|
21 |
-
* </div>
|
22 |
-
* {% endspaceless %}
|
23 |
-
* {# output will be <div><strong>foo</strong></div> #}
|
24 |
-
*
|
25 |
-
* @final
|
26 |
-
*/
|
27 |
-
class SpacelessTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
28 |
-
{
|
29 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
30 |
-
{
|
31 |
-
$lineno = $token->getLine();
|
32 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
33 |
-
$body = $this->parser->subparse([$this, 'decideSpacelessEnd'], \true);
|
34 |
-
$this->parser->getStream()->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
35 |
-
return new \WPML\Core\Twig\Node\SpacelessNode($body, $lineno, $this->getTag());
|
36 |
-
}
|
37 |
-
public function decideSpacelessEnd(\WPML\Core\Twig\Token $token)
|
38 |
-
{
|
39 |
-
return $token->test('endspaceless');
|
40 |
-
}
|
41 |
-
public function getTag()
|
42 |
-
{
|
43 |
-
return 'spaceless';
|
44 |
-
}
|
45 |
-
}
|
46 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\SpacelessTokenParser', 'WPML\\Core\\Twig_TokenParser_Spaceless');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/TokenParserInterface.php
DELETED
@@ -1,45 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Parser;
|
15 |
-
use WPML\Core\Twig\Token;
|
16 |
-
/**
|
17 |
-
* Interface implemented by token parsers.
|
18 |
-
*
|
19 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
-
*/
|
21 |
-
interface TokenParserInterface
|
22 |
-
{
|
23 |
-
/**
|
24 |
-
* Sets the parser associated with this token parser.
|
25 |
-
*/
|
26 |
-
public function setParser(\WPML\Core\Twig\Parser $parser);
|
27 |
-
/**
|
28 |
-
* Parses a token and returns a node.
|
29 |
-
*
|
30 |
-
* @return \Twig_NodeInterface
|
31 |
-
*
|
32 |
-
* @throws SyntaxError
|
33 |
-
*/
|
34 |
-
public function parse(\WPML\Core\Twig\Token $token);
|
35 |
-
/**
|
36 |
-
* Gets the tag name associated with this token parser.
|
37 |
-
*
|
38 |
-
* @return string The tag name
|
39 |
-
*/
|
40 |
-
public function getTag();
|
41 |
-
}
|
42 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\TokenParserInterface', 'WPML\\Core\\Twig_TokenParserInterface');
|
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\\Token');
|
45 |
-
\class_exists('WPML\\Core\\Twig\\Parser');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/UseTokenParser.php
DELETED
@@ -1,63 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
14 |
-
use WPML\Core\Twig\Node\Expression\ConstantExpression;
|
15 |
-
use WPML\Core\Twig\Node\Node;
|
16 |
-
use WPML\Core\Twig\Token;
|
17 |
-
/**
|
18 |
-
* Imports blocks defined in another template into the current template.
|
19 |
-
*
|
20 |
-
* {% extends "base.html" %}
|
21 |
-
*
|
22 |
-
* {% use "blocks.html" %}
|
23 |
-
*
|
24 |
-
* {% block title %}{% endblock %}
|
25 |
-
* {% block content %}{% endblock %}
|
26 |
-
*
|
27 |
-
* @see https://twig.symfony.com/doc/templates.html#horizontal-reuse for details.
|
28 |
-
*
|
29 |
-
* @final
|
30 |
-
*/
|
31 |
-
class UseTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
32 |
-
{
|
33 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
34 |
-
{
|
35 |
-
$template = $this->parser->getExpressionParser()->parseExpression();
|
36 |
-
$stream = $this->parser->getStream();
|
37 |
-
if (!$template instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
|
38 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
39 |
-
}
|
40 |
-
$targets = [];
|
41 |
-
if ($stream->nextIf('with')) {
|
42 |
-
do {
|
43 |
-
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
44 |
-
$alias = $name;
|
45 |
-
if ($stream->nextIf('as')) {
|
46 |
-
$alias = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
|
47 |
-
}
|
48 |
-
$targets[$name] = new \WPML\Core\Twig\Node\Expression\ConstantExpression($alias, -1);
|
49 |
-
if (!$stream->nextIf(\WPML\Core\Twig\Token::PUNCTUATION_TYPE, ',')) {
|
50 |
-
break;
|
51 |
-
}
|
52 |
-
} while (\true);
|
53 |
-
}
|
54 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
55 |
-
$this->parser->addTrait(new \WPML\Core\Twig\Node\Node(['template' => $template, 'targets' => new \WPML\Core\Twig\Node\Node($targets)]));
|
56 |
-
return new \WPML\Core\Twig\Node\Node();
|
57 |
-
}
|
58 |
-
public function getTag()
|
59 |
-
{
|
60 |
-
return 'use';
|
61 |
-
}
|
62 |
-
}
|
63 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\UseTokenParser', 'WPML\\Core\\Twig_TokenParser_Use');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenParser/WithTokenParser.php
DELETED
@@ -1,47 +0,0 @@
|
|
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\TokenParser;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Node\WithNode;
|
14 |
-
use WPML\Core\Twig\Token;
|
15 |
-
/**
|
16 |
-
* Creates a nested scope.
|
17 |
-
*
|
18 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
-
*
|
20 |
-
* @final
|
21 |
-
*/
|
22 |
-
class WithTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
|
23 |
-
{
|
24 |
-
public function parse(\WPML\Core\Twig\Token $token)
|
25 |
-
{
|
26 |
-
$stream = $this->parser->getStream();
|
27 |
-
$variables = null;
|
28 |
-
$only = \false;
|
29 |
-
if (!$stream->test(\WPML\Core\Twig\Token::BLOCK_END_TYPE)) {
|
30 |
-
$variables = $this->parser->getExpressionParser()->parseExpression();
|
31 |
-
$only = $stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE, 'only');
|
32 |
-
}
|
33 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
34 |
-
$body = $this->parser->subparse([$this, 'decideWithEnd'], \true);
|
35 |
-
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
|
36 |
-
return new \WPML\Core\Twig\Node\WithNode($body, $variables, $only, $token->getLine(), $this->getTag());
|
37 |
-
}
|
38 |
-
public function decideWithEnd(\WPML\Core\Twig\Token $token)
|
39 |
-
{
|
40 |
-
return $token->test('endwith');
|
41 |
-
}
|
42 |
-
public function getTag()
|
43 |
-
{
|
44 |
-
return 'with';
|
45 |
-
}
|
46 |
-
}
|
47 |
-
\class_alias('WPML\\Core\\Twig\\TokenParser\\WithTokenParser', 'WPML\\Core\\Twig_TokenParser_With');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TokenStream.php
DELETED
@@ -1,170 +0,0 @@
|
|
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 |
-
* Represents a token stream.
|
17 |
-
*
|
18 |
-
* @final
|
19 |
-
*
|
20 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
21 |
-
*/
|
22 |
-
class TokenStream
|
23 |
-
{
|
24 |
-
protected $tokens;
|
25 |
-
protected $current = 0;
|
26 |
-
protected $filename;
|
27 |
-
private $source;
|
28 |
-
/**
|
29 |
-
* @param array $tokens An array of tokens
|
30 |
-
* @param string|null $name The name of the template which tokens are associated with
|
31 |
-
* @param string|null $source The source code associated with the tokens
|
32 |
-
*/
|
33 |
-
public function __construct(array $tokens, $name = null, $source = null)
|
34 |
-
{
|
35 |
-
if (!$name instanceof \WPML\Core\Twig\Source) {
|
36 |
-
if (null !== $name || null !== $source) {
|
37 |
-
@\trigger_error(\sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \\Twig\\Source instance instead.', __METHOD__), \E_USER_DEPRECATED);
|
38 |
-
}
|
39 |
-
$this->source = new \WPML\Core\Twig\Source($source, $name);
|
40 |
-
} else {
|
41 |
-
$this->source = $name;
|
42 |
-
}
|
43 |
-
$this->tokens = $tokens;
|
44 |
-
// deprecated, not used anymore, to be removed in 2.0
|
45 |
-
$this->filename = $this->source->getName();
|
46 |
-
}
|
47 |
-
public function __toString()
|
48 |
-
{
|
49 |
-
return \implode("\n", $this->tokens);
|
50 |
-
}
|
51 |
-
public function injectTokens(array $tokens)
|
52 |
-
{
|
53 |
-
$this->tokens = \array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current));
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* Sets the pointer to the next token and returns the old one.
|
57 |
-
*
|
58 |
-
* @return Token
|
59 |
-
*/
|
60 |
-
public function next()
|
61 |
-
{
|
62 |
-
if (!isset($this->tokens[++$this->current])) {
|
63 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source);
|
64 |
-
}
|
65 |
-
return $this->tokens[$this->current - 1];
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Tests a token, sets the pointer to the next one and returns it or throws a syntax error.
|
69 |
-
*
|
70 |
-
* @return Token|null The next token if the condition is true, null otherwise
|
71 |
-
*/
|
72 |
-
public function nextIf($primary, $secondary = null)
|
73 |
-
{
|
74 |
-
if ($this->tokens[$this->current]->test($primary, $secondary)) {
|
75 |
-
return $this->next();
|
76 |
-
}
|
77 |
-
}
|
78 |
-
/**
|
79 |
-
* Tests a token and returns it or throws a syntax error.
|
80 |
-
*
|
81 |
-
* @return Token
|
82 |
-
*/
|
83 |
-
public function expect($type, $value = null, $message = null)
|
84 |
-
{
|
85 |
-
$token = $this->tokens[$this->current];
|
86 |
-
if (!$token->test($type, $value)) {
|
87 |
-
$line = $token->getLine();
|
88 |
-
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', $message ? $message . '. ' : '', \WPML\Core\Twig\Token::typeToEnglish($token->getType()), $token->getValue() ? \sprintf(' of value "%s"', $token->getValue()) : '', \WPML\Core\Twig\Token::typeToEnglish($type), $value ? \sprintf(' with value "%s"', $value) : ''), $line, $this->source);
|
89 |
-
}
|
90 |
-
$this->next();
|
91 |
-
return $token;
|
92 |
-
}
|
93 |
-
/**
|
94 |
-
* Looks at the next token.
|
95 |
-
*
|
96 |
-
* @param int $number
|
97 |
-
*
|
98 |
-
* @return Token
|
99 |
-
*/
|
100 |
-
public function look($number = 1)
|
101 |
-
{
|
102 |
-
if (!isset($this->tokens[$this->current + $number])) {
|
103 |
-
throw new \WPML\Core\Twig\Error\SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source);
|
104 |
-
}
|
105 |
-
return $this->tokens[$this->current + $number];
|
106 |
-
}
|
107 |
-
/**
|
108 |
-
* Tests the current token.
|
109 |
-
*
|
110 |
-
* @return bool
|
111 |
-
*/
|
112 |
-
public function test($primary, $secondary = null)
|
113 |
-
{
|
114 |
-
return $this->tokens[$this->current]->test($primary, $secondary);
|
115 |
-
}
|
116 |
-
/**
|
117 |
-
* Checks if end of stream was reached.
|
118 |
-
*
|
119 |
-
* @return bool
|
120 |
-
*/
|
121 |
-
public function isEOF()
|
122 |
-
{
|
123 |
-
return \WPML\Core\Twig\Token::EOF_TYPE === $this->tokens[$this->current]->getType();
|
124 |
-
}
|
125 |
-
/**
|
126 |
-
* @return Token
|
127 |
-
*/
|
128 |
-
public function getCurrent()
|
129 |
-
{
|
130 |
-
return $this->tokens[$this->current];
|
131 |
-
}
|
132 |
-
/**
|
133 |
-
* Gets the name associated with this stream (null if not defined).
|
134 |
-
*
|
135 |
-
* @return string|null
|
136 |
-
*
|
137 |
-
* @deprecated since 1.27 (to be removed in 2.0)
|
138 |
-
*/
|
139 |
-
public function getFilename()
|
140 |
-
{
|
141 |
-
@\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);
|
142 |
-
return $this->source->getName();
|
143 |
-
}
|
144 |
-
/**
|
145 |
-
* Gets the source code associated with this stream.
|
146 |
-
*
|
147 |
-
* @return string
|
148 |
-
*
|
149 |
-
* @internal Don't use this as it might be empty depending on the environment configuration
|
150 |
-
*
|
151 |
-
* @deprecated since 1.27 (to be removed in 2.0)
|
152 |
-
*/
|
153 |
-
public function getSource()
|
154 |
-
{
|
155 |
-
@\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);
|
156 |
-
return $this->source->getCode();
|
157 |
-
}
|
158 |
-
/**
|
159 |
-
* Gets the source associated with this stream.
|
160 |
-
*
|
161 |
-
* @return Source
|
162 |
-
*
|
163 |
-
* @internal
|
164 |
-
*/
|
165 |
-
public function getSourceContext()
|
166 |
-
{
|
167 |
-
return $this->source;
|
168 |
-
}
|
169 |
-
}
|
170 |
-
\class_alias('WPML\\Core\\Twig\\TokenStream', 'WPML\\Core\\Twig_TokenStream');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TwigFilter.php
DELETED
@@ -1,97 +0,0 @@
|
|
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\Node\Node;
|
14 |
-
/**
|
15 |
-
* Represents a template filter.
|
16 |
-
*
|
17 |
-
* @final
|
18 |
-
*
|
19 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
-
*/
|
21 |
-
class TwigFilter
|
22 |
-
{
|
23 |
-
protected $name;
|
24 |
-
protected $callable;
|
25 |
-
protected $options;
|
26 |
-
protected $arguments = [];
|
27 |
-
public function __construct($name, $callable, array $options = [])
|
28 |
-
{
|
29 |
-
$this->name = $name;
|
30 |
-
$this->callable = $callable;
|
31 |
-
$this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'is_variadic' => \false, 'is_safe' => null, 'is_safe_callback' => null, 'pre_escape' => null, 'preserves_safety' => null, 'node_class' => '\\WPML\\Core\\Twig\\Node\\Expression\\FilterExpression', 'deprecated' => \false, 'alternative' => null], $options);
|
32 |
-
}
|
33 |
-
public function getName()
|
34 |
-
{
|
35 |
-
return $this->name;
|
36 |
-
}
|
37 |
-
public function getCallable()
|
38 |
-
{
|
39 |
-
return $this->callable;
|
40 |
-
}
|
41 |
-
public function getNodeClass()
|
42 |
-
{
|
43 |
-
return $this->options['node_class'];
|
44 |
-
}
|
45 |
-
public function setArguments($arguments)
|
46 |
-
{
|
47 |
-
$this->arguments = $arguments;
|
48 |
-
}
|
49 |
-
public function getArguments()
|
50 |
-
{
|
51 |
-
return $this->arguments;
|
52 |
-
}
|
53 |
-
public function needsEnvironment()
|
54 |
-
{
|
55 |
-
return $this->options['needs_environment'];
|
56 |
-
}
|
57 |
-
public function needsContext()
|
58 |
-
{
|
59 |
-
return $this->options['needs_context'];
|
60 |
-
}
|
61 |
-
public function getSafe(\WPML\Core\Twig\Node\Node $filterArgs)
|
62 |
-
{
|
63 |
-
if (null !== $this->options['is_safe']) {
|
64 |
-
return $this->options['is_safe'];
|
65 |
-
}
|
66 |
-
if (null !== $this->options['is_safe_callback']) {
|
67 |
-
return \call_user_func($this->options['is_safe_callback'], $filterArgs);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
public function getPreservesSafety()
|
71 |
-
{
|
72 |
-
return $this->options['preserves_safety'];
|
73 |
-
}
|
74 |
-
public function getPreEscape()
|
75 |
-
{
|
76 |
-
return $this->options['pre_escape'];
|
77 |
-
}
|
78 |
-
public function isVariadic()
|
79 |
-
{
|
80 |
-
return $this->options['is_variadic'];
|
81 |
-
}
|
82 |
-
public function isDeprecated()
|
83 |
-
{
|
84 |
-
return (bool) $this->options['deprecated'];
|
85 |
-
}
|
86 |
-
public function getDeprecatedVersion()
|
87 |
-
{
|
88 |
-
return $this->options['deprecated'];
|
89 |
-
}
|
90 |
-
public function getAlternative()
|
91 |
-
{
|
92 |
-
return $this->options['alternative'];
|
93 |
-
}
|
94 |
-
}
|
95 |
-
\class_alias('WPML\\Core\\Twig\\TwigFilter', 'WPML\\Core\\Twig_SimpleFilter');
|
96 |
-
// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
|
97 |
-
\class_exists('WPML\\Core\\Twig\\Node\\Node');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TwigFunction.php
DELETED
@@ -1,90 +0,0 @@
|
|
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\Node\Node;
|
14 |
-
/**
|
15 |
-
* Represents a template function.
|
16 |
-
*
|
17 |
-
* @final
|
18 |
-
*
|
19 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
20 |
-
*/
|
21 |
-
class TwigFunction
|
22 |
-
{
|
23 |
-
protected $name;
|
24 |
-
protected $callable;
|
25 |
-
protected $options;
|
26 |
-
protected $arguments = [];
|
27 |
-
public function __construct($name, $callable, array $options = [])
|
28 |
-
{
|
29 |
-
$this->name = $name;
|
30 |
-
$this->callable = $callable;
|
31 |
-
$this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'is_variadic' => \false, 'is_safe' => null, 'is_safe_callback' => null, 'node_class' => '\\WPML\\Core\\Twig\\Node\\Expression\\FunctionExpression', 'deprecated' => \false, 'alternative' => null], $options);
|
32 |
-
}
|
33 |
-
public function getName()
|
34 |
-
{
|
35 |
-
return $this->name;
|
36 |
-
}
|
37 |
-
public function getCallable()
|
38 |
-
{
|
39 |
-
return $this->callable;
|
40 |
-
}
|
41 |
-
public function getNodeClass()
|
42 |
-
{
|
43 |
-
return $this->options['node_class'];
|
44 |
-
}
|
45 |
-
public function setArguments($arguments)
|
46 |
-
{
|
47 |
-
$this->arguments = $arguments;
|
48 |
-
}
|
49 |
-
public function getArguments()
|
50 |
-
{
|
51 |
-
return $this->arguments;
|
52 |
-
}
|
53 |
-
public function needsEnvironment()
|
54 |
-
{
|
55 |
-
return $this->options['needs_environment'];
|
56 |
-
}
|
57 |
-
public function needsContext()
|
58 |
-
{
|
59 |
-
return $this->options['needs_context'];
|
60 |
-
}
|
61 |
-
public function getSafe(\WPML\Core\Twig\Node\Node $functionArgs)
|
62 |
-
{
|
63 |
-
if (null !== $this->options['is_safe']) {
|
64 |
-
return $this->options['is_safe'];
|
65 |
-
}
|
66 |
-
if (null !== $this->options['is_safe_callback']) {
|
67 |
-
return \call_user_func($this->options['is_safe_callback'], $functionArgs);
|
68 |
-
}
|
69 |
-
return [];
|
70 |
-
}
|
71 |
-
public function isVariadic()
|
72 |
-
{
|
73 |
-
return $this->options['is_variadic'];
|
74 |
-
}
|
75 |
-
public function isDeprecated()
|
76 |
-
{
|
77 |
-
return (bool) $this->options['deprecated'];
|
78 |
-
}
|
79 |
-
public function getDeprecatedVersion()
|
80 |
-
{
|
81 |
-
return $this->options['deprecated'];
|
82 |
-
}
|
83 |
-
public function getAlternative()
|
84 |
-
{
|
85 |
-
return $this->options['alternative'];
|
86 |
-
}
|
87 |
-
}
|
88 |
-
\class_alias('WPML\\Core\\Twig\\TwigFunction', 'WPML\\Core\\Twig_SimpleFunction');
|
89 |
-
// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
|
90 |
-
\class_exists('WPML\\Core\\Twig\\Node\\Node');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/TwigTest.php
DELETED
@@ -1,69 +0,0 @@
|
|
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 |
-
* Represents a template test.
|
15 |
-
*
|
16 |
-
* @final
|
17 |
-
*
|
18 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
19 |
-
*/
|
20 |
-
class TwigTest
|
21 |
-
{
|
22 |
-
protected $name;
|
23 |
-
protected $callable;
|
24 |
-
protected $options;
|
25 |
-
private $arguments = [];
|
26 |
-
public function __construct($name, $callable, array $options = [])
|
27 |
-
{
|
28 |
-
$this->name = $name;
|
29 |
-
$this->callable = $callable;
|
30 |
-
$this->options = \array_merge(['is_variadic' => \false, 'node_class' => '\\WPML\\Core\\Twig\\Node\\Expression\\TestExpression', 'deprecated' => \false, 'alternative' => null], $options);
|
31 |
-
}
|
32 |
-
public function getName()
|
33 |
-
{
|
34 |
-
return $this->name;
|
35 |
-
}
|
36 |
-
public function getCallable()
|
37 |
-
{
|
38 |
-
return $this->callable;
|
39 |
-
}
|
40 |
-
public function getNodeClass()
|
41 |
-
{
|
42 |
-
return $this->options['node_class'];
|
43 |
-
}
|
44 |
-
public function isVariadic()
|
45 |
-
{
|
46 |
-
return $this->options['is_variadic'];
|
47 |
-
}
|
48 |
-
public function isDeprecated()
|
49 |
-
{
|
50 |
-
return (bool) $this->options['deprecated'];
|
51 |
-
}
|
52 |
-
public function getDeprecatedVersion()
|
53 |
-
{
|
54 |
-
return $this->options['deprecated'];
|
55 |
-
}
|
56 |
-
public function getAlternative()
|
57 |
-
{
|
58 |
-
return $this->options['alternative'];
|
59 |
-
}
|
60 |
-
public function setArguments($arguments)
|
61 |
-
{
|
62 |
-
$this->arguments = $arguments;
|
63 |
-
}
|
64 |
-
public function getArguments()
|
65 |
-
{
|
66 |
-
return $this->arguments;
|
67 |
-
}
|
68 |
-
}
|
69 |
-
\class_alias('WPML\\Core\\Twig\\TwigTest', 'WPML\\Core\\Twig_SimpleTest');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/Util/DeprecationCollector.php
DELETED
@@ -1,75 +0,0 @@
|
|
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\Util;
|
12 |
-
|
13 |
-
use WPML\Core\Twig\Environment;
|
14 |
-
use WPML\Core\Twig\Error\SyntaxError;
|
15 |
-
use WPML\Core\Twig\Source;
|
16 |
-
/**
|
17 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
-
*
|
19 |
-
* @final
|
20 |
-
*/
|
21 |
-
class DeprecationCollector
|
22 |
-
{
|
23 |
-
private $twig;
|
24 |
-
private $deprecations;
|
25 |
-
public function __construct(\WPML\Core\Twig\Environment $twig)
|
26 |
-
{
|
27 |
-
$this->twig = $twig;
|
28 |
-
}
|
29 |
-
/**
|
30 |
-
* Returns deprecations for templates contained in a directory.
|
31 |
-
*
|
32 |
-
* @param string $dir A directory where templates are stored
|
33 |
-
* @param string $ext Limit the loaded templates by extension
|
34 |
-
*
|
35 |
-
* @return array An array of deprecations
|
36 |
-
*/
|
37 |
-
public function collectDir($dir, $ext = '.twig')
|
38 |
-
{
|
39 |
-
$iterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY), '{' . \preg_quote($ext) . '$}');
|
40 |
-
return $this->collect(new \WPML\Core\Twig\Util\TemplateDirIterator($iterator));
|
41 |
-
}
|
42 |
-
/**
|
43 |
-
* Returns deprecations for passed templates.
|
44 |
-
*
|
45 |
-
* @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template)
|
46 |
-
*
|
47 |
-
* @return array An array of deprecations
|
48 |
-
*/
|
49 |
-
public function collect(\Traversable $iterator)
|
50 |
-
{
|
51 |
-
$this->deprecations = [];
|
52 |
-
\set_error_handler([$this, 'errorHandler']);
|
53 |
-
foreach ($iterator as $name => $contents) {
|
54 |
-
try {
|
55 |
-
$this->twig->parse($this->twig->tokenize(new \WPML\Core\Twig\Source($contents, $name)));
|
56 |
-
} catch (\WPML\Core\Twig\Error\SyntaxError $e) {
|
57 |
-
// ignore templates containing syntax errors
|
58 |
-
}
|
59 |
-
}
|
60 |
-
\restore_error_handler();
|
61 |
-
$deprecations = $this->deprecations;
|
62 |
-
$this->deprecations = [];
|
63 |
-
return $deprecations;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* @internal
|
67 |
-
*/
|
68 |
-
public function errorHandler($type, $msg)
|
69 |
-
{
|
70 |
-
if (\E_USER_DEPRECATED === $type) {
|
71 |
-
$this->deprecations[] = $msg;
|
72 |
-
}
|
73 |
-
}
|
74 |
-
}
|
75 |
-
\class_alias('WPML\\Core\\Twig\\Util\\DeprecationCollector', 'WPML\\Core\\Twig_Util_DeprecationCollector');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/lib/twig/src/Util/TemplateDirIterator.php
DELETED
@@ -1,27 +0,0 @@
|
|
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\Util;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
15 |
-
*/
|
16 |
-
class TemplateDirIterator extends \IteratorIterator
|
17 |
-
{
|
18 |
-
public function current()
|
19 |
-
{
|
20 |
-
return \file_get_contents(parent::current());
|
21 |
-
}
|
22 |
-
public function key()
|
23 |
-
{
|
24 |
-
return (string) parent::key();
|
25 |
-
}
|
26 |
-
}
|
27 |
-
\class_alias('WPML\\Core\\Twig\\Util\\TemplateDirIterator', 'WPML\\Core\\Twig_Util_TemplateDirIterator');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/missing-functions.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! function_exists( 'wcml_wpml_get_admin_notices' ) ) {
|
4 |
-
/**
|
5 |
-
* We could not reuse the original function name `wpml_get_admin_notices`
|
6 |
-
* because we have a double definition when WPML is being activated,
|
7 |
-
* which causes a fatal error.
|
8 |
-
*
|
9 |
-
* @see sitepress-multilingual-cms/inc/wpml-private-actions.php
|
10 |
-
*
|
11 |
-
* @return WPML_Notices
|
12 |
-
*/
|
13 |
-
function wcml_wpml_get_admin_notices() {
|
14 |
-
global $wpml_admin_notices;
|
15 |
-
|
16 |
-
if ( ! $wpml_admin_notices ) {
|
17 |
-
$wpml_admin_notices = new WPML_Notices( new WPML_Notice_Render() );
|
18 |
-
$wpml_admin_notices->init_hooks();
|
19 |
-
}
|
20 |
-
|
21 |
-
return $wpml_admin_notices;
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( ! function_exists( 'wpml_is_ajax' ) ) {
|
26 |
-
/**
|
27 |
-
* @see sitepress-multilingual-cms/inc/functions.php
|
28 |
-
*
|
29 |
-
* @return bool
|
30 |
-
*/
|
31 |
-
function wpml_is_ajax() {
|
32 |
-
if ( defined( 'DOING_AJAX' ) ) {
|
33 |
-
return true;
|
34 |
-
}
|
35 |
-
|
36 |
-
return ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && wpml_mb_strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false;
|
37 |
-
}
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/res/css/dialog.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.js .wpml-dialog .tmce-active .wp-editor-area{color:#000}.wpml-dialog .posts-found,.wpml-dialog .no-posts-found,.wpml-dialog .ajax-loader{display:none}.wpml-dialog .spinner{display:block}.wpml-dialog button .spinner{display:inline-block;margin:0 0 0 5px;vertical-align:middle;float:none}.wpml-dialog .ui-dialog-buttonpane{border-top:1px solid #ddd !important;padding:8px 16px;margin-top:0}.wpml-dialog .ui-dialog-buttonset{width:100%;float:none;text-align:right}.rtl .wpml-dialog .ui-dialog-buttonset{text-align:left}.wpml-dialog .ui-dialog-buttonset .ui-button-text-only.button-primary,.wpml-dialog .ui-dialog-buttonset .ui-button-text-only.button-secondary{margin:0}.wpml-dialog .ui-dialog-buttonset .ui-button-text-only.button-primary .ui-button-text,.wpml-dialog .ui-dialog-buttonset .ui-button-text-only.button-secondary .ui-button-text{padding:0}.dialog-fixed{position:fixed}.wpml-dialog-footer{overflow:hidden;padding:8px 16px;border:1px solid #dfdfdf;background:#fcfcfc;position:absolute;top:100%;top:-webkit-calc(100% - 1px);top:calc(100% - 1px);left:0;right:0}.wpml-dialog-footer input[type=submit],.wpml-dialog-footer input[type=button]{width:auto}.wpml-dialog.icl_tt_form{overflow:auto;max-height:-webkit-calc(70vh - 50px) !important;max-height:calc(70vh - 50px) !important}.wpml-translation-title a{font-size:13px;margin:0 15px}.wpml-translation-action-buttons{overflow:hidden;padding:15px 30px;border-top:1px solid #cbcbcb;background:#f1f1f1;z-index:100;position:fixed;bottom:0;right:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;left:160px}.rtl .wpml-translation-action-buttons{right:160px}@media only screen and (max-width: 960px){.wpml-translation-action-buttons{left:36px}}@media screen and (max-width: 782px){.wpml-translation-action-buttons{left:0}}.wpml-translation-action-buttons input[type=submit],.wpml-translation-action-buttons input[type=button]{width:auto}.wpml-translation-action-buttons-abort,.wpml-translation-action-buttons-apply{white-space:nowrap}.wpml-translation-action-buttons-status{margin:0 10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-translation-action-buttons-status label+label{margin-left:30px}.rtl .wpml-translation-action-buttons-status label+label{margin-left:10px;margin-right:30px}@media(max-width: 900px){.wpml-translation-action-buttons-status{-ms-flex-wrap:wrap;flex-wrap:wrap}.wpml-translation-action-buttons-status label+label{margin-left:0}.rtl .wpml-translation-action-buttons-status label+label{margin-left:10px;margin-right:0}.wpml-translation-action-buttons-status>label{-webkit-box-flex:0;-ms-flex:0 1 100%;flex:0 1 100%;margin-top:5px}}.cancel.wpml-dialog-close-button{display:inline-block;text-decoration:none;font-size:13px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;color:#555;border-color:#ccc;background:#f7f7f7;-webkit-box-shadow:0 1px 0 #ccc;box-shadow:0 1px 0 #ccc;vertical-align:top}.cancel.wpml-dialog-close-button:hover{background:#fafafa;border-color:#999;color:#23282d}.button-secondary.wpml-resign-button{margin-left:30px;margin-right:15px}.rtl .button-secondary.wpml-resign-button{margin-left:15px;margin-right:30px}.wpml-form-row label,.wpml-form-row input,.wpml-form-row textarea:not(.wp-editor-area),.wpml-form-row select,.wpml-form-row-nolabel label,.wpml-form-row-nolabel input,.wpml-form-row-nolabel textarea:not(.wp-editor-area),.wpml-form-row-nolabel select,.wpml-form-row-no-translation label,.wpml-form-row-no-translation input,.wpml-form-row-no-translation textarea:not(.wp-editor-area),.wpml-form-row-no-translation select{margin:7px 15px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.wpml-form-row label,.wpml-form-row-nolabel label,.wpml-form-row-no-translation label{text-align:right}.rtl .wpml-form-row label,.rtl .wpml-form-row-nolabel label,.rtl .wpml-form-row-no-translation label{text-align:left}.wpml-header-original,.wpml-header-translation,.wpml-duplicated-post-title{font-size:1.5em;font-weight:normal;display:inline-block;margin:7px 15px}.wpml-header-original .wpml-title-flag,.wpml-header-translation .wpml-title-flag,.wpml-duplicated-post-title .wpml-title-flag{top:-1px}.wpml-duplicated-post-title{display:block}.wpml-dialog-translate .postbox{margin-top:30px;margin-bottom:30px}.wpml-dialog-translate .postbox .handlediv:before{content:"";right:12px;font:400 20px/1 dashicons;speak:none;display:inline-block;padding:8px 10px;top:0;position:relative;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none !important}.rtl .wpml-dialog-translate .postbox .handlediv:before{left:12px;right:0}.wpml-dialog-translate .postbox.closed .handlediv:before{content:""}.wpml-dialog-translate .postbox .hndle{cursor:pointer;font-size:14px;padding:8px 12px;margin:0;line-height:1.4}.wpml-dialog-translate .postbox .hndle [class*=otgs-ico]{font-size:16px;line-height:1;top:-2px;position:relative;margin-right:5px}.wpml-dialog-translate .wpml-copy-container{float:right;margin:2px 17px 0 15px}.rtl .wpml-dialog-translate .wpml-copy-container{float:left}.wpml-dialog-translate .wpml-copy-container .button-copy-all .otgs-ico-copy{margin-right:3px}.wpml-dialog-translate .wpml-translation-header{margin-top:40px;margin-bottom:20px}.wpml-dialog-translate .wpml-translation-header:before,.wpml-dialog-translate .wpml-translation-header:after{content:" ";display:table}.wpml-dialog-translate .wpml-translation-header:after{clear:both}.wpml-dialog-translate .wpml-header-original{width:-webkit-calc(50% - 5% - 30px - 15px - 35px - 5px);width:calc(50% - 5% - 30px - 15px - 35px - 5px);margin-left:-webkit-calc(10% + 48px);margin-left:calc(10% + 48px);margin-right:0}.rtl .wpml-dialog-translate .wpml-header-original{margin-left:0;margin-right:-webkit-calc(10% + 48px);margin-right:calc(10% + 48px)}.wpml-dialog-translate .wpml-header-translation{margin-left:100px;margin-right:0;max-width:-webkit-calc(50% - 5% - 30px - 15px - 35px - 5px);max-width:calc(50% - 5% - 30px - 15px - 35px - 5px)}.rtl .wpml-dialog-translate .wpml-header-translation{margin-left:0;margin-right:100px}.wpml-dialog-translate .wpml-header-original-no-translation{width:70%;margin-left:-webkit-calc(20% + 48px);margin-left:calc(20% + 48px)}.rtl .wpml-dialog-translate .wpml-header-original-no-translation{margin-left:0;margin-right:-webkit-calc(20% + 48px);margin-right:calc(20% + 48px)}.wpml-dialog-translate .wpml-form-row input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]),.wpml-dialog-translate .wpml-form-row textarea:not(.wp-editor-area),.wpml-dialog-translate .wpml-form-row .mce_editor,.wpml-dialog-translate .wpml-form-row div.mce_editor_origin{width:-webkit-calc(50% - 5% - 30px - 15px - 35px - 7px);width:calc(50% - 5% - 30px - 15px - 35px - 7px)}.wpml-dialog-translate .wpml-form-row>label{width:10%;word-wrap:break-word;word-break:break-all}.wpml-dialog-translate .wpml-form-row-nolabel input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]).original_value,.wpml-dialog-translate .wpml-form-row-nolabel textarea:not(.wp-editor-area).original_value,.wpml-dialog-translate .wpml-form-row-nolabel .mce_editor.original_value,.wpml-dialog-translate .wpml-form-row-nolabel div.mce_editor_origin.original_value{width:-webkit-calc(55% - 15px - 35px);width:calc(55% - 15px - 35px)}.wpml-dialog-translate .wpml-form-row-nolabel input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]).translated_value,.wpml-dialog-translate .wpml-form-row-nolabel textarea:not(.wp-editor-area).translated_value,.wpml-dialog-translate .wpml-form-row-nolabel .mce_editor.translated_value,.wpml-dialog-translate .wpml-form-row-nolabel div.mce_editor_origin.translated_value{width:-webkit-calc(45% - 30px - 15px - 35px - 10px);width:calc(45% - 30px - 15px - 35px - 10px)}.wpml-dialog-translate .wpml-form-row-nolabel>label{display:none}.wpml-dialog-translate .wpml-form-row-no-translation input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]),.wpml-dialog-translate .wpml-form-row-no-translation textarea:not(.wp-editor-area),.wpml-dialog-translate .wpml-form-row-no-translation .mce_editor,.wpml-dialog-translate .wpml-form-row-no-translation div.mce_editor_origin{width:60%}.wpml-dialog-translate .wpml-form-row-no-translation>label{width:20%}.wpml-dialog-translate .wpml-form-row::after,.wpml-dialog-translate .wpml-form-row-nolabel::after{content:"";display:table;clear:both}.wpml-dialog-translate .wpml-form-row .field_translation_complete,.wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete{float:right;margin:-6px 19px 15px 0;width:-webkit-calc(50% - 5% - 30px - 15px - 35px - 7px);width:calc(50% - 5% - 30px - 15px - 35px - 7px)}.rtl .wpml-dialog-translate .wpml-form-row .field_translation_complete,.rtl .wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete{float:left;margin:-6px 0 15px 19px}.wpml-dialog-translate .wpml-form-row .field_translation_complete label,.wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete label{text-align:left;margin:0}.rtl .wpml-dialog-translate .wpml-form-row .field_translation_complete label,.rtl .wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete label{text-align:right}.wpml-dialog-translate .wpml-form-row .field_translation_complete input,.wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete input{margin:0 4px 0 0}.rtl .wpml-dialog-translate .wpml-form-row .field_translation_complete input,.rtl .wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete input{margin:0 0 0 4px}.wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete{margin:-6px 17px 15px 0}.rtl .wpml-dialog-translate .wpml-form-row-nolabel .field_translation_complete{margin:-6px 0 15px 17px}.wpml-dialog-translate .postbox{margin-left:15px;margin-right:15px}.wpml-field-image>.inside{padding-bottom:0}.wpml-field-image .inside .inside{margin:0;padding:0}.wpml-field-image img{display:inline-block;vertical-align:middle;max-width:100px;height:auto;margin-right:15px}.rtl .wpml-field-image img{margin-right:0;margin-left:15px}.wpml-field-image .wpml-field-group{width:-webkit-calc(100% - 100px - 15px - 5px);width:calc(100% - 100px - 15px - 5px);display:inline-block;vertical-align:middle}.wpml-dialog-cols-content{float:right;width:-webkit-calc(100% - 70px - 30px);width:calc(100% - 70px - 30px)}.rtl .wpml-dialog-cols-content{float:left}.wpml-dialog-cols-content ul,.wpml-dialog-cols-content ol{padding-left:30px}.rtl .wpml-dialog-cols-content ul,.rtl .wpml-dialog-cols-content ol{padding-left:0;padding-right:30px}.wpml-dialog-cols-content ul{list-style:disc}.wpml-dialog-cols-content ol{list-style:decimal}.wpml-dialog-cols-content li{margin-bottom:3px}.wpml-dialog-cols-icon{float:left;width:70px}.rtl .wpml-dialog-cols-icon{float:right}[class*=otgs-ico].wpml-dialog-icon-xl:before{font-size:70px}.wpml-end-user-confirmation-dialog .ui-dialog-buttonset{float:none;text-align:center}.ui-button.ui-dialog-titlebar-close{font-size:0 !important}
|
|
addons/wpml-dependencies/lib/res/css/otgs-dialogs.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.otgs-ui-dialog.ui-dialog{z-index:100102 !important;border-radius:0 !important;padding:0 !important;overflow:visible}[dir="rtl"] .otgs-ui-dialog.ui-dialog{right:auto}.otgs-ui-dialog.ui-dialog .ui-dialog-content{position:static}.otgs-ui-dialog.ui-widget-content{border-top:1px solid #dddddd !important;border-bottom:0 !important;border-left:0 !important;border-right:0 !important;background:#ffffff !important;color:#333333 !important}.otgs-ui-dialog .ui-dialog-titlebar{background:#fcfcfc !important;border-bottom:1px solid #ddd !important;height:36px !important;font-size:18px !important;font-weight:600 !important;line-height:36px !important;padding:0 36px 0 16px !important}[dir="rtl"] .otgs-ui-dialog .ui-dialog-titlebar{padding:0 16px 0 36px !important}.otgs-ui-dialog .ui-dialog-title{float:none !important;display:block !important;width:100% !important;white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important}.otgs-ui-dialog .ui-widget,.otgs-ui-dialog.ui-widget{font-family:"Open Sans", sans-serif !important;font-size:13px !important;line-height:1.4em !important}.otgs-ui-dialog.ui-widget{color:#444 !important}.otgs-ui-dialog.ui-widget input,.otgs-ui-dialog.ui-widget select,.otgs-ui-dialog.ui-widget textarea{font-size:13px !important;font-family:"Open Sans", sans-serif !important}.otgs-ui-dialog .ui-widget-header{border:1px solid #dddddd !important;border-top:0 !important;background:#fcfcfc !important;color:#444 !important;font-weight:600 !important;border-radius:0 !important}.otgs-ui-dialog .ui-widget-header.ui-tabs-nav{border:0 !important}.otgs-ui-dialog .ui-tabs-nav .ui-state-active.ui-state-default{background:#ededed !important}.otgs-ui-dialog .ui-tabs-nav .ui-state-default{background:#fcfcfc !important;font-weight:normal !important}.otgs-ui-dialog .ui-tabs-panel.ui-widget-content{border-left:1px solid #ccc !important}[dir="rtl"] .otgs-ui-dialog .ui-tabs-panel.ui-widget-content{border-left:0;border-right:1px solid #ccc !important}.otgs-ui-dialog .ui-widget button{font-size:13px !important;font-family:"Open Sans", sans-serif !important}.otgs-ui-dialog .ui-widget-overlay{background:#000 !important;opacity:.7 !important;filter:alpha(opacity=70) !important;z-index:100101}.otgs-ui-dialog .ui-button.ui-dialog-titlebar-close{background:0 0 !important;border:none !important;-webkit-box-shadow:none !important;box-shadow:none !important;color:#666 !important;cursor:pointer !important;display:block;padding:0 !important;margin:0 !important;position:absolute !important;top:0 !important;right:0 !important;width:36px !important;height:36px !important;text-align:center !important}.otgs-ui-dialog .ui-button.ui-dialog-titlebar-close:hover{color:#00a0d2 !important}[dir="rtl"] .otgs-ui-dialog .ui-button.ui-dialog-titlebar-close{right:auto !important;left:0 !important}.otgs-ui-dialog .ui-icon{width:0 !important;height:0 !important}.otgs-ui-dialog .ui-widget-content{border:0 !important}.otgs-ui-dialog .ui-dialog-buttonpane{border-top:1px solid #ddd !important;padding:9px 16px 10px}.otgs-ui-dialog .button-primary{background:#0085ba !important;border-color:#0073aa #006799 #006799 !important;-webkit-box-shadow:0 1px 0 #006799 !important;box-shadow:0 1px 0 #006799 !important;color:#fff !important;text-decoration:none !important;text-shadow:0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799 !important;font-weight:normal !important;border-radius:3px !important}.otgs-ui-dialog .button-primary:not([disabled]):hover{border-color:#069dd4 !important}.otgs-ui-dialog .button-secondary{color:#555 !important;border-color:#ccc !important;background:#f7f7f7 !important;-webkit-box-shadow:0 1px 0 #ccc !important;box-shadow:0 1px 0 #ccc !important;font-weight:normal !important;border-radius:3px !important}.otgs-ui-dialog .button-secondary:not([disabled]):hover{border-color:#999 !important}.otgs-confirmation-dialog{display:-webkit-box;display:-ms-flexbox;display:flex}.otgs-confirmation-dialog-icon{padding:5px 20px 5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.rtl .otgs-confirmation-dialog-icon{padding:5px 0 5px 20px}.otgs-confirmation-dialog-icon [class*="otgs-ico"]::before{font-size:75px}@media (min-width: 768px){.otgs-confirmation-dialog-icon{padding:5px 40px 5px 15px}.rtl .otgs-confirmation-dialog-icon{padding:5px 15px 5px 40px}.otgs-confirmation-dialog-icon [class*="otgs-ico"]::before{font-size:95px}}@media (max-width: 360px){.otgs-confirmation-dialog-icon{display:none}}.otgs-confirmation-dialog-content>:first-child{margin-top:0}
|
|
addons/wpml-dependencies/lib/res/css/otgs-ico.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
@font-face{font-family:"otgs-icons";src:url("../font/otgs-icons.eot");src:url("../font/otgs-icons.eot?#iefix") format("embedded-opentype"),url("../font/otgs-icons.ttf") format("truetype"),url("../font/otgs-icons.svg#otgs-icons") format("svg");font-weight:normal;font-style:normal}[class*="otgs-ico"]{display:inline-block;-webkit-transform:translate(0, 0);transform:translate(0, 0)}[class*="otgs-ico"]:focus{outline:none}[class*="otgs-ico"]:before,[data-otgs-ico]:before{font-family:"otgs-icons" !important;font-style:normal !important;font-weight:normal !important;font-variant:normal !important;text-transform:none !important;speak:none;line-height:1 !important;vertical-align:text-bottom;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.otgs-ico-32:before{font-size:32px}[data-otgs-ico]:before{content:attr(data-otgs-ico)}.otgs-ico-note-add:before{content:"\61"}.otgs-ico-note-add-o:before{content:"\62"}.otgs-ico-translated:before,.otgs-ico-ok:before{content:"\63"}.otgs-ico-yes:before{content:"\64"}.otgs-ico-in-progress:before{content:"\65"}.otgs-ico-copy:before{content:"\66"}.otgs-ico-copy-o:before{content:"\67"}.otgs-ico-note-edit:before{content:"\69"}.otgs-ico-note-edit-o:before{content:"\6a"}.otgs-ico-add:before,.otgs-ico-add-disabled:before{content:"\6b"}.otgs-ico-refresh:before,.otgs-ico-refresh-spin:before{content:"\6c"}.otgs-ico-no:before{content:"\6e"}.otgs-ico-not-translated:before{content:"\6f"}.otgs-ico-delete:before{content:"\70"}.otgs-ico-warning:before{content:"\73"}.otgs-ico-original:before{content:"\74"}.otgs-ico-needs-update:before{content:"\75"}.otgs-ico-cred:before{content:"\77"}.otgs-ico-layouts:before{content:"\78"}.otgs-ico-module-manager:before{content:"\79"}.otgs-ico-toolset:before{content:"\7a"}.otgs-ico-types:before{content:"\41"}.otgs-ico-views:before{content:"\42"}.otgs-ico-edit:before,.otgs-ico-edit-disabled:before{content:"\68"}.otgs-ico-duplicate:before{content:"\6d"}.otgs-ico-basket:before{content:"\72"}.otgs-ico-discoverwp:before{content:"\43"}.otgs-ico-wpml:before,.otgs-ico-sitepress-multilingual-cms:before{content:"\44"}.otgs-ico-otgs:before{content:"\45"}.otgs-ico-wrench:before{content:"\46"}.otgs-ico-link:before{content:"\47"}.otgs-ico-envelope-o:before{content:"\48"}.otgs-ico-user:before{content:"\49"}.otgs-ico-wpml-cms-nav:before{content:"\4a"}.otgs-ico-wpml-media:before{content:"\4b"}.otgs-ico-wpml-string-translation:before{content:"\4c"}.otgs-ico-wpml-translation-management:before{content:"\4d"}.otgs-ico-picture:before{content:"\4e"}.otgs-ico-toolset-training:before{content:"\4f"}.otgs-ico-access-title:before{content:"\50"}.otgs-ico-views-title:before{content:"\51"}.otgs-ico-cred-title:before{content:"\52"}.otgs-ico-layouts-title:before{content:"\53"}.otgs-ico-types-title:before{content:"\54"}.otgs-ico-module-manager-title:before{content:"\55"}.otgs-ico-access:before{content:"\76"}.otgs-ico-bullhorn:before{content:"\56"}.otgs-ico-comment:before{content:"\57"}.otgs-ico-quote:before{content:"\58"}.otgs-ico-thumbsup:before{content:"\59"}.otgs-ico-star:before{content:"\5a"}.otgs-ico-spinner:before{content:"\30"}.otgs-ico-status:before{content:"\31"}.otgs-ico-file:before{content:"\32"}.otgs-ico-cancel:before{content:"\33"}.otgs-ico-download:before{content:"\34"}.otgs-ico-close:before{content:"\f158";font-family:dashicons !important}.otgs-ico-help:before{content:"\f223";font-family:dashicons !important}.otgs-ico-info:before{content:"\f348";font-family:dashicons !important}.otgs-ico-caret-up:before{font-family:dashicons !important;content:"\f142"}.otgs-ico-caret-right:before{font-family:dashicons !important;content:"\f139"}.otgs-ico-caret-down:before{font-family:dashicons !important;content:"\f140"}.otgs-ico-caret-left:before{font-family:dashicons !important;content:"\f141"}.otgs-ico-unlink:before{font-family:dashicons !important;content:"\f225"}.otgs-ico-translation:before{font-family:dashicons !important;content:"\f326"}.otgs-ico-new:before{font-family:dashicons !important;content:"\f534"}.otgs-ico-mail:before{font-family:dashicons !important;content:"\f466"}.otgs-ico-chat:before{font-family:dashicons !important;content:"\f125"}.otgs-ico-sent:before{font-family:dashicons !important;content:"\f310"}.otgs-ico-lock:before{font-family:dashicons !important;content:"\f160"}.otgs-ico-unlock:before{font-family:dashicons !important;content:"\f528"}.otgs-ico-media:before{font-family:dashicons !important;content:"\f233"}.otgs-ico-wpml-sticky-links:before{font-family:dashicons !important;content:"\f103"}.otgs-ico-refresh-spin{-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.otgs-ico-waiting,.otgs-ico-needs-review{width:100%;height:100%;max-width:18px;min-height:16px;display:inline-block;background-size:contain;background-repeat:no-repeat;background-position:50% 50%}.otgs-ico-waiting:before,.otgs-ico-needs-review:before{content:'';display:none}.otgs-ico-waiting{background-image:url(../img/otgs-ico-hourglass.svg)}.otgs-ico-needs-review{background-image:url(../img/otgs-ico-review.svg)}
|
|
addons/wpml-dependencies/lib/res/css/otgs-notices.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.otgs-notice{position:relative}.otgs-notice .otgs-notice-actions{margin-bottom:1em}.otgs-notice.message,.otgs-notice.info,.otgs-notice.warning,.otgs-notice.error,.otgs-notice.success{clear:both;background:#fff;border:1px solid #ccd0d4;border-left-width:4px;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);margin:5px 15px 2px;padding:1px 12px}.rtl .otgs-notice.message,.rtl .otgs-notice.info,.rtl .otgs-notice.warning,.rtl .otgs-notice.error,.rtl .otgs-notice.success{border-left-width:1px;border-left-color:#ccd0d4;border-right-width:4px}.wrap .otgs-notice.message,.wrap .otgs-notice.info,.wrap .otgs-notice.warning,.wrap .otgs-notice.error,.wrap .otgs-notice.success{margin:5px 0 15px}.otgs-notice.message p,.otgs-notice.info p,.otgs-notice.warning p,.otgs-notice.error p,.otgs-notice.success p{margin:.5em 0;padding:2px}.otgs-notice.message ul,.otgs-notice.message ol,.otgs-notice.info ul,.otgs-notice.info ol,.otgs-notice.warning ul,.otgs-notice.warning ol,.otgs-notice.error ul,.otgs-notice.error ol,.otgs-notice.success ul,.otgs-notice.success ol{max-height:10em;overflow:auto;padding-left:2em !important}.otgs-notice.message ul,.otgs-notice.info ul,.otgs-notice.warning ul,.otgs-notice.error ul,.otgs-notice.success ul{list-style-type:disc}.otgs-notice.message.right>*,.otgs-notice.info.right>*,.otgs-notice.warning.right>*,.otgs-notice.error.right>*,.otgs-notice.success.right>*{text-align:right}.rtl .otgs-notice.message.right>*,.rtl .otgs-notice.info.right>*,.rtl .otgs-notice.warning.right>*,.rtl .otgs-notice.error.right>*,.rtl .otgs-notice.success.right>*{text-align:left}.otgs-notice.message.center>*,.otgs-notice.info.center>*,.otgs-notice.warning.center>*,.otgs-notice.error.center>*,.otgs-notice.success.center>*{text-align:center}.otgs-notice.message.center>*>ul,.otgs-notice.message.center>*>ol,.otgs-notice.info.center>*>ul,.otgs-notice.info.center>*>ol,.otgs-notice.warning.center>*>ul,.otgs-notice.warning.center>*>ol,.otgs-notice.error.center>*>ul,.otgs-notice.error.center>*>ol,.otgs-notice.success.center>*>ul,.otgs-notice.success.center>*>ol{text-align:left;padding-left:1em !important;font-weight:normal}.rtl .otgs-notice.message.center>*>ul,.rtl .otgs-notice.message.center>*>ol,.rtl .otgs-notice.info.center>*>ul,.rtl .otgs-notice.info.center>*>ol,.rtl .otgs-notice.warning.center>*>ul,.rtl .otgs-notice.warning.center>*>ol,.rtl .otgs-notice.error.center>*>ul,.rtl .otgs-notice.error.center>*>ol,.rtl .otgs-notice.success.center>*>ul,.rtl .otgs-notice.success.center>*>ol{text-align:right;padding-left:12px !important;padding-right:1em !important}.otgs-notice.message.center>*>ul,.otgs-notice.info.center>*>ul,.otgs-notice.warning.center>*>ul,.otgs-notice.error.center>*>ul,.otgs-notice.success.center>*>ul{list-style-type:disc}.otgs-notice.message,.otgs-notice.info{border-left-color:#9bc8f0}.rtl .otgs-notice.message,.rtl .otgs-notice.info{border-right-color:#9bc8f0}.otgs-notice.warning{border-left-color:#ffb900}.rtl .otgs-notice.warning{border-right-color:#ffb900}.otgs-notice.error{border-left-color:#dc3232;background-color:#FFE6E5}.rtl .otgs-notice.error{border-right-color:#dc3232}.otgs-notice.success{border-left-color:#46b450}.rtl .otgs-notice.success{border-right-color:#46b450}.otgs-notice.is-dismissible{position:relative;padding-left:38px}.rtl .otgs-notice.is-dismissible{padding-right:38px;padding-left:12px}.otgs-notice.is-dismissible .notice-dismiss{text-decoration:none}.otgs-notice.is-dismissible p [class*="button-"]{margin:-5px 5px}.otgs-notice .otgs-notice-collapse-hide{position:absolute;top:0;right:1px;border:none;margin:0;padding:9px;background:0 0;color:#b4b9be;cursor:pointer}.rtl .otgs-notice .otgs-notice-collapse-hide{right:auto;left:1px}.otgs-notice .otgs-notice-collapse-hide,.otgs-notice .otgs-notice-collapse-show{cursor:pointer}.otgs-notice .otgs-notice-collapse-hide::before,.otgs-notice .otgs-notice-collapse-show::before{background:0 0;color:#b4b9be;display:block;font:400 16px/20px dashicons;speak:none;height:20px;width:20px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.otgs-notice .otgs-notice-collapse-hide:hover::before,.otgs-notice .otgs-notice-collapse-show:hover::before{color:#d54e21}.otgs-notice .otgs-notice-collapse-hide::before{content:"\f460"}.otgs-notice .otgs-notice-collapsed-text .otgs-notice-collapse-show::before{content:"\f132";float:left}.rtl .otgs-notice .otgs-notice-collapsed-text .otgs-notice-collapse-show::before{float:right}.otgs-notice .notice-collapse-header{display:none}.otgs-notice .notice-action-link{display:block;position:absolute;right:1em;bottom:1em}.rtl .otgs-notice .notice-action-link{right:auto;left:1em}.otgs-notice table{border-spacing:0;border-collapse:collapse;margin:0 auto}.otgs-notice table th,.otgs-notice table td{vertical-align:top;text-align:left;padding:2px}.otgs-notice table thead{font-weight:400}.otgs-notice table thead tr{background:#222;background:rgba(34,34,34,0.8);color:#ccc}.otgs-notice table thead th{text-transform:capitalize;border-right:1px solid #ccc}.otgs-notice table thead th:last-child{border-right:none}.otgs-notice table tbody tr{background:#ccc;background:rgba(204,204,204,0.8)}.otgs-notice table tbody tr:nth-child(even) td:nth-child(odd),.otgs-notice table tbody tr:nth-child(odd) td:nth-child(even){background:#fff;background:rgba(255,255,255,0.8)}.otgs-notice table tbody td p:first-child{margin-top:0;padding-top:0}.otgs-notice table tbody td p:last-child{margin-bottom:0;padding-bottom:0}.otgs-notice table tbody td code{font-family:monospace;white-space:pre;display:block}.otgs-notice-toggle{font-size:.85em;position:absolute;bottom:5px;right:15px;color:#aaa;cursor:pointer}.rtl .otgs-notice-toggle{right:auto;left:15px}.otgs-notice-toggle::after{content:'';vertical-align:middle;margin-left:.3em;display:inline-block;border:.3em solid transparent}.rtl .otgs-notice-toggle::after{margin-left:0;margin-right:0.3em}.expanded .otgs-notice-toggle::after{border-bottom:.45em solid;margin-top:-.25em}.minimized .otgs-notice-toggle::after{border-left:.5em solid}.rtl .minimized .otgs-notice-toggle::after{border-left:.3em solid transparent;border-right:.5em solid}.otgs-notice-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.otgs-notice-icon>i::before{margin-right:15px;font-size:25px}.rtl .otgs-notice-icon>i::before{margin-right:0;margin-left:15px}.otgs-notice-icon .otgs-ico-warning::before{color:#ffb900}
|
|
addons/wpml-dependencies/lib/res/css/style.css
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
.wpml-wrap{border:1px solid #CCCCCC;padding:15px;background-color:#ffffff;position:relative}.wpml-wrap:before,.wpml-wrap:after{content:" ";display:table}.wpml-wrap:after{clear:both}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[class*="otgs-ico"]:before{font-size:16px}.otgs-ico-not-translated{color:#d89000}.otgs-ico-basket{color:#3078a8}.otgs-ico-in-progress,.otgs-ico-duplicate,.otgs-ico-waiting,.otgs-ico-refresh-spin{color:#000}.otgs-ico-refresh-spin{cursor:default}.otgs-ico-translated{color:#46b450}.otgs-ico-needs-update{color:#78c0d8}.otgs-ico-add-disabled,.otgs-ico-waiting-disabled,.otgs-ico-edit-disabled{color:#c1c1c1}.otgs-ico-note-add-o:hover::before,.otgs-ico-note-add-o:focus::before{content:"\61"}.otgs-ico-note-edit-o{color:#d89000}.otgs-ico-note-edit-o:hover::before,.otgs-ico-note-edit-o:focus::before{content:"\69"}.otgs-ico-close,.otgs-ico-cancel{color:#aa0000}.otgs-ico-close:hover,.otgs-ico-close:focus,.otgs-ico-cancel:hover,.otgs-ico-cancel:focus{color:#d00}.wpml-section .otgs-ico-help::before,.wpml-ls-subform-options .otgs-ico-help::before{vertical-align:top;cursor:help}.otgs-ico-star.full-star{color:#FFD700}.otgs-ico-help{cursor:help}.text-center{text-align:center}.text-left{text-align:left}.rtl .text-left{text-align:right}.text-right{text-align:right}.rtl .text-right{text-align:left}.text-gray{color:#666}.text-gray-dark{color:#373737}.text-gray-light{color:#999}.wpml-semibold{font-weight:500}.wpml-margin-top-lg{margin-top:50px !important}.wpml-margin-bottom-lg{margin-bottom:50px !important}.wpml-margin-top-base{margin-top:30px !important}.wpml-margin-bottom-base{margin-bottom:30px !important}.wpml-margin-top-sm{margin-top:15px !important}.wpml-margin-bottom-sm{margin-bottom:15px !important}.wpml-margin-right-lg{margin-right:50px !important}.wpml-margin-left-lg{margin-left:50px !important}.wpml-margin-right-base{margin-right:30px !important}.wpml-margin-left-base{margin-left:30px !important}.wpml-margin-right-sm{margin-right:15px !important}.wpml-margin-left-sm{margin-left:15px !important}.wpml-display-block{display:block}.wpml-display-flex{display:-webkit-box;display:-ms-flexbox;display:flex}.wpml-display-flex-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.clearfix:before,.wpml-tabs:before,.wpml-section-content:before,.wpml-section-content-inner:before,.clearfix:after,.wpml-tabs:after,.wpml-section-content:after,.wpml-section-content-inner:after{content:" ";display:table}.clearfix:after,.wpml-tabs:after,.wpml-section-content:after,.wpml-section-content-inner:after{clear:both}pre{max-width:100%;overflow-x:auto}.wpml-col-title{width:30%}.wpml-col-title strong{font-size:1.077em}@media (max-width: 782px){.wpml-col-title{width:40%}}.wpml-col-title a{cursor:pointer}.wpml-col-title-flag .row-actions{margin-left:26px}.wpml-title-flag{margin-right:5px;position:relative;top:1px;width:20px;display:inline-block}.wpml-header-translation .wpml-title-flag,.wpml-header-original .wpml-title-flag{margin-left:5px}.wpml-title-flag img{margin:0;width:18px;height:12px}.wpml-col-languages img{max-width:100%;height:auto;margin:0}.wpml-col-languages>a,.wpml-col-languages>span{display:inline-block;width:20px;text-align:center;padding:2px 1px;float:left;margin:0 1px}[dir="rtl"] .wpml-col-languages>a,[dir="rtl"] .wpml-col-languages>span{float:right}.wpml-col-languages>span>a{display:block}.wpml-col-languages a{cursor:pointer}.wpml-col-url{white-space:nowrap}.wpml-list-table a{cursor:pointer}.wpml-list-table th:not(.check-column):first-child,.wpml-list-table td:not(.check-column):first-child{padding-left:15px}.wpml-list-table th:last-child,.wpml-list-table td:last-child{padding-right:15px}@media screen and (max-width: 782px){.wpml-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}.wpml-table-info{font-size:1.2em}.wpml-section{clear:both;margin:30px 0 0 0;padding:20px;border-bottom:1px solid #ededed;background:#fff}.wpml-section:before,.wpml-section:after{content:" ";display:table}.wpml-section:after{clear:both}.wpml-section:first-of-type{margin-top:0}.wpml-section:last-of-type{border:none}.wpml-section>h3:first-child{margin-top:0}.wpml-section input,.wpml-section textarea,.wpml-section select{max-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpml-section label:hover [type="radio"],.wpml-section label:hover [type="checkbox"]{-webkit-box-shadow:inset 0 5px 8px rgba(0,0,0,0.1);box-shadow:inset 0 5px 8px rgba(0,0,0,0.1)}.wpml-section .explanation-text{color:#999}.wpml-section h4+.explanation-text{margin-top:-1.1em;margin-bottom:1.33em}.wpml-section .sub-section{margin-left:20px}.wpml-section li{margin-bottom:10px}.wpml-tabs{margin-top:20px;margin-bottom:0}@media (max-width: 980px){.wpml-tabs{margin-bottom:15px;margin-left:-7px}.rtl .wpml-tabs{margin-right:-7px;margin-left:0}}.wpml-tabs .nav-tab{cursor:pointer;margin-top:10px}@media (min-width: 981px) and (max-width: 1280px){.wpml-tabs .nav-tab{margin-left:.2em;padding:5px}.rtl .wpml-tabs .nav-tab{margin-right:.2em;margin-left:0}}@media (max-width: 980px){.wpml-tabs .nav-tab{border-bottom:1px solid #ccc}}.wpml-tabs .nav-tab-active,.wpml-tabs .nav-tab-active:focus,.wpml-tabs .nav-tab-active:focus:active,.wpml-tabs .nav-tab-active:hover{background:#fff;border-bottom:none;padding-bottom:6px;position:relative;z-index:2}@media (max-width: 980px){.wpml-tabs .nav-tab-active,.wpml-tabs .nav-tab-active:focus,.wpml-tabs .nav-tab-active:focus:active,.wpml-tabs .nav-tab-active:hover{border-bottom:1px solid #ccc}}.icl-admin-message,.icl-admin-message-information,.icl-admin-message-information-inline,.icl-admin-message-warning,.icl-admin-message-error{clear:both;background:#fff;border-style:solid;border-width:0 0 0 4px;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);margin:5px 15px 2px;padding:1px 12px}.rtl .icl-admin-message,.rtl .icl-admin-message-information,.rtl .icl-admin-message-information-inline,.rtl .icl-admin-message-warning,.rtl .icl-admin-message-error{border-width:0 4px 0 0}.wrap .icl-admin-message,.wrap .icl-admin-message-information,.wrap .icl-admin-message-information-inline,.wrap .icl-admin-message-warning,.wrap .icl-admin-message-error{margin:5px 0 15px}.icl-admin-message p,.icl-admin-message-information p,.icl-admin-message-information-inline p,.icl-admin-message-warning p,.icl-admin-message-error p{margin:.5em 0;padding:2px}.icl-admin-message ul,.icl-admin-message ol,.icl-admin-message-information ul,.icl-admin-message-information ol,.icl-admin-message-information-inline ul,.icl-admin-message-information-inline ol,.icl-admin-message-warning ul,.icl-admin-message-warning ol,.icl-admin-message-error ul,.icl-admin-message-error ol{max-height:10em;overflow:auto}.icl-admin-message.right>*,.icl-admin-message-information.right>*,.icl-admin-message-information-inline.right>*,.icl-admin-message-warning.right>*,.icl-admin-message-error.right>*{text-align:right}.rtl .icl-admin-message.right>*,.rtl .icl-admin-message-information.right>*,.rtl .icl-admin-message-information-inline.right>*,.rtl .icl-admin-message-warning.right>*,.rtl .icl-admin-message-error.right>*{text-align:left}.icl-admin-message.center>*,.icl-admin-message-information.center>*,.icl-admin-message-information-inline.center>*,.icl-admin-message-warning.center>*,.icl-admin-message-error.center>*{text-align:center}.icl-admin-message.center>*>ul,.icl-admin-message.center>*>ol,.icl-admin-message-information.center>*>ul,.icl-admin-message-information.center>*>ol,.icl-admin-message-information-inline.center>*>ul,.icl-admin-message-information-inline.center>*>ol,.icl-admin-message-warning.center>*>ul,.icl-admin-message-warning.center>*>ol,.icl-admin-message-error.center>*>ul,.icl-admin-message-error.center>*>ol{text-align:left;padding-left:1em !important;font-weight:normal}.rtl .icl-admin-message.center>*>ul,.rtl .icl-admin-message.center>*>ol,.rtl .icl-admin-message-information.center>*>ul,.rtl .icl-admin-message-information.center>*>ol,.rtl .icl-admin-message-information-inline.center>*>ul,.rtl .icl-admin-message-information-inline.center>*>ol,.rtl .icl-admin-message-warning.center>*>ul,.rtl .icl-admin-message-warning.center>*>ol,.rtl .icl-admin-message-error.center>*>ul,.rtl .icl-admin-message-error.center>*>ol{text-align:right}.icl-admin-message.center>*>ul,.icl-admin-message-information.center>*>ul,.icl-admin-message-information-inline.center>*>ul,.icl-admin-message-warning.center>*>ul,.icl-admin-message-error.center>*>ul{list-style-type:disc}.icl-admin-message,.icl-admin-message-information,.icl-admin-message-information-inline{border-color:#9bc8f0}.icl-admin-message-warning{border-color:#fff366}.icl-admin-message-error{border-color:#dd3d36;background-color:#FFE6E5}.otgs-is-dismissible{position:relative;padding-right:38px}.rtl .otgs-is-dismissible{padding-left:38px;padding-right:12px}.otgs-is-dismissible .notice-dismiss{text-decoration:none}.otgs-is-dismissible p [class*="button-"]{margin:-5px 5px}.wpml-notice{border-left-color:#2782AD}.wpml-notice .rtl{border-right-color:#2782AD;border-left-color:#ccd0d4}.icl_form_errors{padding:5px;width:65%;border:1px solid #f00;border-radius:2px;background-color:#ffb7b7;color:#000}.icl_form_errors p{margin:0;line-height:1.5}.icl_form_errors ul{margin-left:20px;list-style:circle}.rtl .icl_form_errors ul{margin-left:0;margin-right:20px}.icl_form_success{padding:5px;border:1px solid #fff;border-radius:2px;background-color:#336600;color:#fff}.icl_error_text{color:#f00;font-style:italic}.icl_valid_text{color:#3f7257;font-style:italic}.icl_error_input{background-color:#FA9393 !important}.icl_ajx_response{display:none;margin:0 5px;color:#E68A00}.post-type-wc_order_status th.column-icl_translations{width:15%}td.icl_translations a,td.icl_translations span{display:inline-block;width:20px;text-align:center;padding:2px 1px}.icl_sidebar{display:block;float:right;margin-top:4px;margin-bottom:10px;padding:3px 10px 3px 9px;width:207px;border:1px solid #8cceea;border-radius:2px;background-color:#eff8fc}.icl_cyan_box{margin-top:0;margin-bottom:0;padding:10px;border:1px solid #8cceea;border-radius:2px;background-color:#eff8fc}.icl_cyan_box p{margin:5px 0;line-height:100%}.icl_cyan_box h3{margin-top:2px}.icl_cyan_box ul{margin-top:5px;font-size:11px}img.icl_als_iclflag{width:18px !important;height:12px !important}.wpml-navigation-links{overflow:hidden;margin-bottom:12px}.wpml-navigation-links li{display:inline-block;margin-right:10px}.wpml-navigation-links li a{white-space:nowrap}@media (min-width: 1200px){.wpml-section-header{float:left;width:300px}[dir="rtl"] .wpml-section-header{float:right}}.wpml-section-header h3{margin-top:15px;margin-bottom:0;color:#333;font-weight:normal;font-size:20px;line-height:20px;-webkit-transition:all 0.15s linear;transition:all 0.15s linear}.wpml-section-header .active{color:#d54e21}.wpml-section-header .icon-question-sign{color:#ccc;vertical-align:middle;font-size:12px;cursor:help}.wpml-section-header .icon-question-sign:hover{color:#007cbd;-webkit-transition:all 0.15s linear;transition:all 0.15s linear}.wpml-section-content{margin-left:30px}@media (min-width: 1200px){.wpml-section-content{float:left;width:570px}}[dir="rtl"] .wpml-section-content{margin-left:0;margin-right:30px}@media (min-width: 1200px){[dir="rtl"] .wpml-section-content{float:right}}.wpml-section-content .buttons-wrap{text-align:right}.rtl .wpml-section-content .buttons-wrap{text-align:left}.wpml-section-content .wpml-section-content-inner{margin:0 0 20px 0;padding:0 0 10px 0;border-bottom:1px solid #ededed}.wpml-section-content .wpml-section-content-inner:last-child{margin:0;padding:0;border:0}.wpml-section-content .wpml-form-message.update-nag{font-size:inherit}@media (min-width: 1200px){.wpml-section-content-wide{width:calc(100% - 360px)}}.wpml-section-content,.wpml-section-content-inner{*zoom:1}.wp-core-ui .button-lg{font-size:15px;line-height:38px;height:40px;padding:0 15px 1px}.wp-core-ui .button-lg-wrap{font-size:14px;line-height:1.3;height:auto;padding:14px 20px 15px;white-space:normal}.wp-core-ui .wpml-button{background:#2782AD;border-color:#1f698c;-webkit-box-shadow:0 1px 0 #1f698c;box-shadow:0 1px 0 #1f698c;color:#fff;text-shadow:0 -1px 1px #1f698c,1px 0 1px #1f698c,0 1px 1px #1f698c,-1px 0 1px #1f698c}.wp-core-ui .wpml-button:hover,.wp-core-ui .wpml-button:focus,.wp-core-ui .wpml-button:active{background:#23759c;border-color:#1f698c;color:#fff}.woocommerce_page_wc-settings .wpml_select2-container .wpml_select2-choice .wpml_select2-arrow b:after{content:none}#sso_information{cursor:pointer}body.mobile .wpml-section-content{margin-left:0;width:auto}body.mobile .wpml-section-header{width:auto}body.mobile .wpml-section{margin:20px 0 0 0;padding:10px 0}.icl_subsubsub{display:block !important;clear:both;list-style:none;margin:0;padding:0;font-size:13px;float:left;color:#666}.icl_subsubsub ul{margin:0;padding:0}.icl_subsubsub li{display:inline-block;margin:0;padding:0;white-space:nowrap}.icl_subsubsub a{line-height:2;padding:.2em;text-decoration:none}.icl_subsubsub a .count,.icl_subsubsub a.current .count{color:#555d66;font-weight:400}.wpml-external-link{cursor:pointer}.wpml-external-link:after{font-family:dashicons !important;content:"\00a0\f504";vertical-align:baseline;line-height:1;display:inline-block;font-weight:normal}body.AJAXwait *{cursor:wait}.wpml-select2-button,.wpml-select2-text{width:auto}.wpml-select2-button .wpml_select2-arrow,.wpml-select2-text .wpml_select2-arrow{border:none !important;background:transparent !important;border-radius:0 !important}.wpml-select2-button>.button:active,.wpml-select2-text>.button:active{-webkit-transform:none !important;transform:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}.wp-admin .error li{list-style-position:inside}.ant-radio-input[type=checkbox]:disabled,.ant-radio-input[type=radio]:disabled{opacity:0 !important}.ant-radio .ant-radio-inner{border-color:#999;-webkit-box-sizing:border-box;box-sizing:border-box}.ant-radio-checked .ant-radio-inner{border-color:#2782AD !important}.ant-radio-checked .ant-radio-inner:after{background-color:#2782AD}.ant-radio-checked:after{width:14px !important;height:14px !important}.ant-radio:hover .ant-radio-inner{border-color:#2782AD !important}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content{font-size:13px}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content p{margin-top:0}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content p:last-child{margin-bottom:0}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content table tr td{padding-right:15px}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-arrow{border-color:#181D22;background-color:#181D22}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner{background-color:#181D22}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner .ant-popover-title{color:#fff;background-color:#181D22;border-color:#666}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner .ant-popover-inner-content{color:#fff}.ant-select-selector{-webkit-box-sizing:border-box;box-sizing:border-box}.ant-modal-mask{z-index:9991 !important}.ant-modal-wrap{z-index:9992 !important}.ant-modal-wrap>*{z-index:9993 !important}.wpml-wizard__modal{position:relative}.wpml-wizard__modal:before{position:absolute;content:'';top:0;left:0;right:0;width:100%;height:4px;background:linear-gradient(87.89deg, #2782AD 0%, #27AD95 99.36%);z-index:99}.wpml-wizard__modal .ant-modal-close{top:5px}.wpml-wizard__modal .ant-modal-header{border:none;padding:50px 30px 0}.wpml-wizard__modal .ant-modal-header .ant-modal-title{font-size:22px;font-weight:700}.wpml-wizard__modal .ant-modal-body{padding:20px 30px}.wpml-wizard__modal .ant-modal-body p.wpml-skip{color:#999}.wpml-wizard__modal .ant-modal-body p.wpml-skip a{display:inline-block;margin-left:5px;color:#999;text-decoration:underline}.wpml-wizard__modal .ant-modal-body p.wpml-skip a:hover{text-decoration:none}.wpml-wizard__modal .ant-modal-body p a{text-decoration:underline}.wpml-wizard__modal .ant-modal-body p a:not([class*="text-"]){color:#2782AD}.wpml-wizard__modal .ant-modal-body p a:hover{text-decoration:none}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item{height:auto;padding:0 0 0 10px}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-info>span{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-thumbnail{position:relative;top:0;left:0;width:32px;height:32px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-thumbnail img{margin:0 auto;border:1px solid #D9D9D9}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-name{display:none}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-card-actions{position:relative;top:0;left:0;width:32px;height:32px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:10px}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-card-actions button svg path{fill:#C9471F}.wpml-wizard__modal .ant-modal-body .ant-radio-group label{margin-top:10px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div{margin:10px 0 15px 25px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user{margin:20px 0 0 25px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row{margin-top:10px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row label{color:#666}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row input{border-color:#D9D9D9}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row{border:1px solid #D9D9D9;padding:15px 20px;margin:5px 0 15px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row:first-child{margin-bottom:5px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row .ant-select-selection-item span{margin-right:5px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row span[language] img{margin-top:-3px}.wpml-wizard__modal .ant-modal-body__footer{padding:30px 0 10px;border:none}.wpml-wizard__modal .ant-modal-footer{padding:20px 30px 30px;border:none}.wpml-wizard__modal .ant-form-item-label{padding-bottom:0}.wpml-wizard__modal .ant-form-item-control input{border-color:#D9D9D9;min-height:32px}
|
2 |
-
#wpml-basket-items{margin-left:5px;border-radius:1rem;background-color:#d54e21;min-width:1.1rem;display:inline-block;line-height:1.1rem;text-align:center;height:1.1rem;font-size:.7rem;vertical-align:middle;padding:0 .4rem;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff}.rtl #wpml-basket-items{margin-right:5px;margin-left:0}.icl_tm_admin_options li ul{margin-left:20px}.icl-translation-services{position:relative;text-align:center;margin:20px 0 0 0;padding:0 10px 0 0}.icl-translation-services.hidden{display:none}.icl-translation-services .icl-translation-services-inner{border:1px solid #CFCFCF;border-radius:5px;padding:30px 50px}.icl-translation-services .icl-translation-services-logo{margin-top:-49px}.icl-translation-services .icl-translation-services-logo span{display:inline-block;background:#F9F9F9;padding:0 2px}.icl-translation-services .icl-translation-services-header{color:#333;font-size:14px;font-weight:bold}.icl-translation-services .icl-translation-desc{margin-bottom:10px}.icl-translation-services .icl-translation-links{margin:20px 0 10px 0;text-align:right;line-height:1.1}.icl-translation-services .icl-translation-links a{display:inline-block;margin:0 0 0 10px}.icl-translation-services .icl-translation-links a:first-child{border-right:1px solid #BDBDBD;padding-right:10px}.icl-translation-services .icl-translation-links a.icl-mail-ico{padding-left:12px;background:url("../img/icl-button-mail-ico.png") center left no-repeat}.icl-translation-services .icl-translation-links a#icl_hide_promo{padding-left:15px;background:url("../img/icl-button-close-ico.png") center left no-repeat}#icl_show_promo{float:right}.wpml-tm-messages{font-weight:500;margin:0 5px;padding:1px 4px 2px;border-radius:3px;white-space:nowrap}.wpml-tm-messages.updated{color:#46b450;background-color:rgba(92,255,102,0.15)}.wpml-tm-messages.notice{color:#00a0d2;background-color:rgba(0,194,255,0.15)}.wpml-tm-messages.error{color:#dc3232;background-color:rgba(255,57,57,0.15)}.wpmltm-notice{border:none !important;background:url(../img/bg-world.png) no-repeat 100% 50%,linear-gradient(84.39deg, #2782AD 0%, #27AD95 99.36%) !important;color:#fff;padding:30px;margin:20px 20px 0 0;border-radius:5px}.wpmltm-notice h2{color:#fff;margin-top:0 !important}.wpmltm-notice p{line-height:1.6}.wpmltm-notice fieldset label{display:inline-block;margin:0 0 8px}.wpmltm-notice fieldset label input[type=radio]{border-color:#fff;margin-top:-.15rem;margin-right:5px}.wpmltm-notice__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-top:15px}.wpmltm-notice__actions-btn{display:inline-block;border:none;-webkit-box-shadow:none;box-shadow:none;background:#fff;border-radius:5px;padding:0 25px;margin-right:15px;line-height:34px;height:34px;text-decoration:none}.wpmltm-notice__actions-btn:hover{color:#fff;background:#db552b}.wpmltm-notice__actions-link{color:#fff}.wpmltm-notice__actions-link:hover{text-decoration:none;color:#fff !important;opacity:0.8}.wpml-tm-post-edit-alert :first-child{margin-top:0}.wpml-tm-post-edit-alert :last-child{margin-bottom:0}.wpml-tm-post-edit-alert .button+.button{margin-left:1em}.rtl .wpml-tm-post-edit-alert .button+.button{margin-left:0;margin-right:1em}
|
|
|
|
addons/wpml-dependencies/lib/res/css/styles.css
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
.wpml-wrap{border:1px solid #CCCCCC;padding:15px;background-color:#ffffff;position:relative}.wpml-wrap:before,.wpml-wrap:after{content:" ";display:table}.wpml-wrap:after{clear:both}.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[class*="otgs-ico"]:before{font-size:16px}.otgs-ico-not-translated{color:#d89000}.otgs-ico-basket{color:#3078a8}.otgs-ico-in-progress,.otgs-ico-duplicate,.otgs-ico-waiting,.otgs-ico-refresh-spin{color:#000}.otgs-ico-refresh-spin{cursor:default}.otgs-ico-translated{color:#46b450}.otgs-ico-needs-update{color:#78c0d8}.otgs-ico-add-disabled,.otgs-ico-waiting-disabled,.otgs-ico-edit-disabled{color:#c1c1c1}.otgs-ico-note-add-o:hover::before,.otgs-ico-note-add-o:focus::before{content:"\61"}.otgs-ico-note-edit-o{color:#d89000}.otgs-ico-note-edit-o:hover::before,.otgs-ico-note-edit-o:focus::before{content:"\69"}.otgs-ico-close,.otgs-ico-cancel{color:#aa0000}.otgs-ico-close:hover,.otgs-ico-close:focus,.otgs-ico-cancel:hover,.otgs-ico-cancel:focus{color:#d00}.wpml-section .otgs-ico-help::before,.wpml-ls-subform-options .otgs-ico-help::before{vertical-align:top;cursor:help}.otgs-ico-star.full-star{color:#FFD700}.otgs-ico-help{cursor:help}.text-center{text-align:center}.text-left{text-align:left}.rtl .text-left{text-align:right}.text-right{text-align:right}.rtl .text-right{text-align:left}.text-gray{color:#666}.text-gray-dark{color:#373737}.text-gray-light{color:#999}.wpml-semibold{font-weight:500}.wpml-margin-top-lg{margin-top:50px !important}.wpml-margin-bottom-lg{margin-bottom:50px !important}.wpml-margin-top-base{margin-top:30px !important}.wpml-margin-bottom-base{margin-bottom:30px !important}.wpml-margin-top-sm{margin-top:15px !important}.wpml-margin-bottom-sm{margin-bottom:15px !important}.wpml-margin-right-lg{margin-right:50px !important}.wpml-margin-left-lg{margin-left:50px !important}.wpml-margin-right-base{margin-right:30px !important}.wpml-margin-left-base{margin-left:30px !important}.wpml-margin-right-sm{margin-right:15px !important}.wpml-margin-left-sm{margin-left:15px !important}.wpml-display-block{display:block}.wpml-display-flex{display:-webkit-box;display:-ms-flexbox;display:flex}.wpml-display-flex-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.clearfix:before,.wpml-tabs:before,.wpml-section-content:before,.wpml-section-content-inner:before,.clearfix:after,.wpml-tabs:after,.wpml-section-content:after,.wpml-section-content-inner:after{content:" ";display:table}.clearfix:after,.wpml-tabs:after,.wpml-section-content:after,.wpml-section-content-inner:after{clear:both}pre{max-width:100%;overflow-x:auto}.wpml-col-title{width:30%}.wpml-col-title strong{font-size:1.077em}@media (max-width: 782px){.wpml-col-title{width:40%}}.wpml-col-title a{cursor:pointer}.wpml-col-title-flag .row-actions{margin-left:26px}.wpml-title-flag{margin-right:5px;position:relative;top:1px;width:20px;display:inline-block}.wpml-header-translation .wpml-title-flag,.wpml-header-original .wpml-title-flag{margin-left:5px}.wpml-title-flag img{margin:0;width:18px;height:12px}.wpml-col-languages img{max-width:100%;height:auto;margin:0}.wpml-col-languages>a,.wpml-col-languages>span{display:inline-block;width:20px;text-align:center;padding:2px 1px;float:left;margin:0 1px}[dir="rtl"] .wpml-col-languages>a,[dir="rtl"] .wpml-col-languages>span{float:right}.wpml-col-languages>span>a{display:block}.wpml-col-languages a{cursor:pointer}.wpml-col-url{white-space:nowrap}.wpml-list-table a{cursor:pointer}.wpml-list-table th:not(.check-column):first-child,.wpml-list-table td:not(.check-column):first-child{padding-left:15px}.wpml-list-table th:last-child,.wpml-list-table td:last-child{padding-right:15px}@media screen and (max-width: 782px){.wpml-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}.wpml-table-info{font-size:1.2em}.wpml-section{clear:both;margin:30px 0 0 0;padding:20px;border-bottom:1px solid #ededed;background:#fff}.wpml-section:before,.wpml-section:after{content:" ";display:table}.wpml-section:after{clear:both}.wpml-section:first-of-type{margin-top:0}.wpml-section:last-of-type{border:none}.wpml-section>h3:first-child{margin-top:0}.wpml-section input,.wpml-section textarea,.wpml-section select{max-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpml-section label:hover [type="radio"],.wpml-section label:hover [type="checkbox"]{-webkit-box-shadow:inset 0 5px 8px rgba(0,0,0,0.1);box-shadow:inset 0 5px 8px rgba(0,0,0,0.1)}.wpml-section .explanation-text{color:#999}.wpml-section h4+.explanation-text{margin-top:-1.1em;margin-bottom:1.33em}.wpml-section .sub-section{margin-left:20px}.wpml-section li{margin-bottom:10px}.wpml-tabs{margin-top:20px;margin-bottom:0}@media (max-width: 980px){.wpml-tabs{margin-bottom:15px;margin-left:-7px}.rtl .wpml-tabs{margin-right:-7px;margin-left:0}}.wpml-tabs .nav-tab{cursor:pointer;margin-top:10px}@media (min-width: 981px) and (max-width: 1280px){.wpml-tabs .nav-tab{margin-left:.2em;padding:5px}.rtl .wpml-tabs .nav-tab{margin-right:.2em;margin-left:0}}@media (max-width: 980px){.wpml-tabs .nav-tab{border-bottom:1px solid #ccc}}.wpml-tabs .nav-tab-active,.wpml-tabs .nav-tab-active:focus,.wpml-tabs .nav-tab-active:focus:active,.wpml-tabs .nav-tab-active:hover{background:#fff;border-bottom:none;padding-bottom:6px;position:relative;z-index:2}@media (max-width: 980px){.wpml-tabs .nav-tab-active,.wpml-tabs .nav-tab-active:focus,.wpml-tabs .nav-tab-active:focus:active,.wpml-tabs .nav-tab-active:hover{border-bottom:1px solid #ccc}}.icl-admin-message,.icl-admin-message-information,.icl-admin-message-information-inline,.icl-admin-message-warning,.icl-admin-message-error{clear:both;background:#fff;border-style:solid;border-width:0 0 0 4px;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);margin:5px 15px 2px;padding:1px 12px}.rtl .icl-admin-message,.rtl .icl-admin-message-information,.rtl .icl-admin-message-information-inline,.rtl .icl-admin-message-warning,.rtl .icl-admin-message-error{border-width:0 4px 0 0}.wrap .icl-admin-message,.wrap .icl-admin-message-information,.wrap .icl-admin-message-information-inline,.wrap .icl-admin-message-warning,.wrap .icl-admin-message-error{margin:5px 0 15px}.icl-admin-message p,.icl-admin-message-information p,.icl-admin-message-information-inline p,.icl-admin-message-warning p,.icl-admin-message-error p{margin:.5em 0;padding:2px}.icl-admin-message ul,.icl-admin-message ol,.icl-admin-message-information ul,.icl-admin-message-information ol,.icl-admin-message-information-inline ul,.icl-admin-message-information-inline ol,.icl-admin-message-warning ul,.icl-admin-message-warning ol,.icl-admin-message-error ul,.icl-admin-message-error ol{max-height:10em;overflow:auto}.icl-admin-message.right>*,.icl-admin-message-information.right>*,.icl-admin-message-information-inline.right>*,.icl-admin-message-warning.right>*,.icl-admin-message-error.right>*{text-align:right}.rtl .icl-admin-message.right>*,.rtl .icl-admin-message-information.right>*,.rtl .icl-admin-message-information-inline.right>*,.rtl .icl-admin-message-warning.right>*,.rtl .icl-admin-message-error.right>*{text-align:left}.icl-admin-message.center>*,.icl-admin-message-information.center>*,.icl-admin-message-information-inline.center>*,.icl-admin-message-warning.center>*,.icl-admin-message-error.center>*{text-align:center}.icl-admin-message.center>*>ul,.icl-admin-message.center>*>ol,.icl-admin-message-information.center>*>ul,.icl-admin-message-information.center>*>ol,.icl-admin-message-information-inline.center>*>ul,.icl-admin-message-information-inline.center>*>ol,.icl-admin-message-warning.center>*>ul,.icl-admin-message-warning.center>*>ol,.icl-admin-message-error.center>*>ul,.icl-admin-message-error.center>*>ol{text-align:left;padding-left:1em !important;font-weight:normal}.rtl .icl-admin-message.center>*>ul,.rtl .icl-admin-message.center>*>ol,.rtl .icl-admin-message-information.center>*>ul,.rtl .icl-admin-message-information.center>*>ol,.rtl .icl-admin-message-information-inline.center>*>ul,.rtl .icl-admin-message-information-inline.center>*>ol,.rtl .icl-admin-message-warning.center>*>ul,.rtl .icl-admin-message-warning.center>*>ol,.rtl .icl-admin-message-error.center>*>ul,.rtl .icl-admin-message-error.center>*>ol{text-align:right}.icl-admin-message.center>*>ul,.icl-admin-message-information.center>*>ul,.icl-admin-message-information-inline.center>*>ul,.icl-admin-message-warning.center>*>ul,.icl-admin-message-error.center>*>ul{list-style-type:disc}.icl-admin-message,.icl-admin-message-information,.icl-admin-message-information-inline{border-color:#9bc8f0}.icl-admin-message-warning{border-color:#fff366}.icl-admin-message-error{border-color:#dd3d36;background-color:#FFE6E5}.otgs-is-dismissible{position:relative;padding-right:38px}.rtl .otgs-is-dismissible{padding-left:38px;padding-right:12px}.otgs-is-dismissible .notice-dismiss{text-decoration:none}.otgs-is-dismissible p [class*="button-"]{margin:-5px 5px}.wpml-notice{border-left-color:#2782AD}.wpml-notice .rtl{border-right-color:#2782AD;border-left-color:#ccd0d4}.icl_form_errors{padding:5px;width:65%;border:1px solid #f00;border-radius:2px;background-color:#ffb7b7;color:#000}.icl_form_errors p{margin:0;line-height:1.5}.icl_form_errors ul{margin-left:20px;list-style:circle}.rtl .icl_form_errors ul{margin-left:0;margin-right:20px}.icl_form_success{padding:5px;border:1px solid #fff;border-radius:2px;background-color:#336600;color:#fff}.icl_error_text{color:#f00;font-style:italic}.icl_valid_text{color:#3f7257;font-style:italic}.icl_error_input{background-color:#FA9393 !important}.icl_ajx_response{display:none;margin:0 5px;color:#E68A00}.post-type-wc_order_status th.column-icl_translations{width:15%}td.icl_translations a,td.icl_translations span{display:inline-block;width:20px;text-align:center;padding:2px 1px}.icl_sidebar{display:block;float:right;margin-top:4px;margin-bottom:10px;padding:3px 10px 3px 9px;width:207px;border:1px solid #8cceea;border-radius:2px;background-color:#eff8fc}.icl_cyan_box{margin-top:0;margin-bottom:0;padding:10px;border:1px solid #8cceea;border-radius:2px;background-color:#eff8fc}.icl_cyan_box p{margin:5px 0;line-height:100%}.icl_cyan_box h3{margin-top:2px}.icl_cyan_box ul{margin-top:5px;font-size:11px}img.icl_als_iclflag{width:18px !important;height:12px !important}.wpml-navigation-links{overflow:hidden;margin-bottom:12px}.wpml-navigation-links li{display:inline-block;margin-right:10px}.wpml-navigation-links li a{white-space:nowrap}@media (min-width: 1200px){.wpml-section-header{float:left;width:300px}[dir="rtl"] .wpml-section-header{float:right}}.wpml-section-header h3{margin-top:15px;margin-bottom:0;color:#333;font-weight:normal;font-size:20px;line-height:20px;-webkit-transition:all 0.15s linear;transition:all 0.15s linear}.wpml-section-header .active{color:#d54e21}.wpml-section-header .icon-question-sign{color:#ccc;vertical-align:middle;font-size:12px;cursor:help}.wpml-section-header .icon-question-sign:hover{color:#007cbd;-webkit-transition:all 0.15s linear;transition:all 0.15s linear}.wpml-section-content{margin-left:30px}@media (min-width: 1200px){.wpml-section-content{float:left;width:570px}}[dir="rtl"] .wpml-section-content{margin-left:0;margin-right:30px}@media (min-width: 1200px){[dir="rtl"] .wpml-section-content{float:right}}.wpml-section-content .buttons-wrap{text-align:right}.rtl .wpml-section-content .buttons-wrap{text-align:left}.wpml-section-content .wpml-section-content-inner{margin:0 0 20px 0;padding:0 0 10px 0;border-bottom:1px solid #ededed}.wpml-section-content .wpml-section-content-inner:last-child{margin:0;padding:0;border:0}.wpml-section-content .wpml-form-message.update-nag{font-size:inherit}@media (min-width: 1200px){.wpml-section-content-wide{width:calc(100% - 360px)}}.wpml-section-content,.wpml-section-content-inner{*zoom:1}.wp-core-ui .button-lg{font-size:15px;line-height:38px;height:40px;padding:0 15px 1px}.wp-core-ui .button-lg-wrap{font-size:14px;line-height:1.3;height:auto;padding:14px 20px 15px;white-space:normal}.wp-core-ui .wpml-button{background:#2782AD;border-color:#1f698c;-webkit-box-shadow:0 1px 0 #1f698c;box-shadow:0 1px 0 #1f698c;color:#fff;text-shadow:0 -1px 1px #1f698c,1px 0 1px #1f698c,0 1px 1px #1f698c,-1px 0 1px #1f698c}.wp-core-ui .wpml-button:hover,.wp-core-ui .wpml-button:focus,.wp-core-ui .wpml-button:active{background:#23759c;border-color:#1f698c;color:#fff}.woocommerce_page_wc-settings .wpml_select2-container .wpml_select2-choice .wpml_select2-arrow b:after{content:none}#sso_information{cursor:pointer}body.mobile .wpml-section-content{margin-left:0;width:auto}body.mobile .wpml-section-header{width:auto}body.mobile .wpml-section{margin:20px 0 0 0;padding:10px 0}.icl_subsubsub{display:block !important;clear:both;list-style:none;margin:0;padding:0;font-size:13px;float:left;color:#666}.icl_subsubsub ul{margin:0;padding:0}.icl_subsubsub li{display:inline-block;margin:0;padding:0;white-space:nowrap}.icl_subsubsub a{line-height:2;padding:.2em;text-decoration:none}.icl_subsubsub a .count,.icl_subsubsub a.current .count{color:#555d66;font-weight:400}.wpml-external-link{cursor:pointer}.wpml-external-link:after{font-family:dashicons !important;content:"\00a0\f504";vertical-align:baseline;line-height:1;display:inline-block;font-weight:normal}body.AJAXwait *{cursor:wait}.wpml-select2-button,.wpml-select2-text{width:auto}.wpml-select2-button .wpml_select2-arrow,.wpml-select2-text .wpml_select2-arrow{border:none !important;background:transparent !important;border-radius:0 !important}.wpml-select2-button>.button:active,.wpml-select2-text>.button:active{-webkit-transform:none !important;transform:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}.wp-admin .error li{list-style-position:inside}.ant-radio-input[type=checkbox]:disabled,.ant-radio-input[type=radio]:disabled{opacity:0 !important}.ant-radio .ant-radio-inner{border-color:#999;-webkit-box-sizing:border-box;box-sizing:border-box}.ant-radio-checked .ant-radio-inner{border-color:#2782AD !important}.ant-radio-checked .ant-radio-inner:after{background-color:#2782AD}.ant-radio-checked:after{width:14px !important;height:14px !important}.ant-radio:hover .ant-radio-inner{border-color:#2782AD !important}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content{font-size:13px}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content p{margin-top:0}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content p:last-child{margin-bottom:0}.ant-popover .ant-popover-content .ant-popover-inner .ant-popover-inner-content table tr td{padding-right:15px}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-arrow{border-color:#181D22;background-color:#181D22}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner{background-color:#181D22}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner .ant-popover-title{color:#fff;background-color:#181D22;border-color:#666}.ant-popover.ant-popover-dark .ant-popover-content .ant-popover-inner .ant-popover-inner-content{color:#fff}.ant-select-selector{-webkit-box-sizing:border-box;box-sizing:border-box}.ant-modal-mask{z-index:9991 !important}.ant-modal-wrap{z-index:9992 !important}.ant-modal-wrap>*{z-index:9993 !important}.wpml-wizard__modal{position:relative}.wpml-wizard__modal:before{position:absolute;content:'';top:0;left:0;right:0;width:100%;height:4px;background:linear-gradient(87.89deg, #2782AD 0%, #27AD95 99.36%);z-index:99}.wpml-wizard__modal .ant-modal-close{top:5px}.wpml-wizard__modal .ant-modal-header{border:none;padding:50px 30px 0}.wpml-wizard__modal .ant-modal-header .ant-modal-title{font-size:22px;font-weight:700}.wpml-wizard__modal .ant-modal-body{padding:20px 30px}.wpml-wizard__modal .ant-modal-body p.wpml-skip{color:#999}.wpml-wizard__modal .ant-modal-body p.wpml-skip a{display:inline-block;margin-left:5px;color:#999;text-decoration:underline}.wpml-wizard__modal .ant-modal-body p.wpml-skip a:hover{text-decoration:none}.wpml-wizard__modal .ant-modal-body p a{text-decoration:underline}.wpml-wizard__modal .ant-modal-body p a:not([class*="text-"]){color:#2782AD}.wpml-wizard__modal .ant-modal-body p a:hover{text-decoration:none}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item{height:auto;padding:0 0 0 10px}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-info>span{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-thumbnail{position:relative;top:0;left:0;width:32px;height:32px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-thumbnail img{margin:0 auto;border:1px solid #D9D9D9}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-name{display:none}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-card-actions{position:relative;top:0;left:0;width:32px;height:32px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:10px}.wpml-wizard__modal .ant-modal-body .ant-upload-list-item-card-actions button svg path{fill:#C9471F}.wpml-wizard__modal .ant-modal-body .ant-radio-group label{margin-top:10px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div{margin:10px 0 15px 25px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user{margin:20px 0 0 25px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row{margin-top:10px}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row label{color:#666}.wpml-wizard__modal .ant-modal-body .ant-radio-group label+div.wpml-create-new-user .ant-row input{border-color:#D9D9D9}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row{border:1px solid #D9D9D9;padding:15px 20px;margin:5px 0 15px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row:first-child{margin-bottom:5px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row .ant-select-selection-item span{margin-right:5px}.wpml-wizard__modal .ant-modal-body .wpml-set-language-pairs__row .ant-row span[language] img{margin-top:-3px}.wpml-wizard__modal .ant-modal-body__footer{padding:30px 0 10px;border:none}.wpml-wizard__modal .ant-modal-footer{padding:20px 30px 30px;border:none}.wpml-wizard__modal .ant-form-item-label{padding-bottom:0}.wpml-wizard__modal .ant-form-item-control input{border-color:#D9D9D9;min-height:32px}
|
2 |
-
#wpml-basket-items{margin-left:5px;border-radius:1rem;background-color:#d54e21;min-width:1.1rem;display:inline-block;line-height:1.1rem;text-align:center;height:1.1rem;font-size:.7rem;vertical-align:middle;padding:0 .4rem;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff}.rtl #wpml-basket-items{margin-right:5px;margin-left:0}.icl_tm_admin_options li ul{margin-left:20px}.icl-translation-services{position:relative;text-align:center;margin:20px 0 0 0;padding:0 10px 0 0}.icl-translation-services.hidden{display:none}.icl-translation-services .icl-translation-services-inner{border:1px solid #CFCFCF;border-radius:5px;padding:30px 50px}.icl-translation-services .icl-translation-services-logo{margin-top:-49px}.icl-translation-services .icl-translation-services-logo span{display:inline-block;background:#F9F9F9;padding:0 2px}.icl-translation-services .icl-translation-services-header{color:#333;font-size:14px;font-weight:bold}.icl-translation-services .icl-translation-desc{margin-bottom:10px}.icl-translation-services .icl-translation-links{margin:20px 0 10px 0;text-align:right;line-height:1.1}.icl-translation-services .icl-translation-links a{display:inline-block;margin:0 0 0 10px}.icl-translation-services .icl-translation-links a:first-child{border-right:1px solid #BDBDBD;padding-right:10px}.icl-translation-services .icl-translation-links a.icl-mail-ico{padding-left:12px;background:url("../img/icl-button-mail-ico.png") center left no-repeat}.icl-translation-services .icl-translation-links a#icl_hide_promo{padding-left:15px;background:url("../img/icl-button-close-ico.png") center left no-repeat}#icl_show_promo{float:right}.wpml-tm-messages{font-weight:500;margin:0 5px;padding:1px 4px 2px;border-radius:3px;white-space:nowrap}.wpml-tm-messages.updated{color:#46b450;background-color:rgba(92,255,102,0.15)}.wpml-tm-messages.notice{color:#00a0d2;background-color:rgba(0,194,255,0.15)}.wpml-tm-messages.error{color:#dc3232;background-color:rgba(255,57,57,0.15)}.wpmltm-notice{border:none !important;background:url(../img/bg-world.png) no-repeat 100% 50%,linear-gradient(84.39deg, #2782AD 0%, #27AD95 99.36%) !important;color:#fff;padding:30px;margin:20px 20px 0 0;border-radius:5px}.wpmltm-notice h2{color:#fff;margin-top:0 !important}.wpmltm-notice p{line-height:1.6}.wpmltm-notice fieldset label{display:inline-block;margin:0 0 8px}.wpmltm-notice fieldset label input[type=radio]{border-color:#fff;margin-top:-.15rem;margin-right:5px}.wpmltm-notice__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-top:15px}.wpmltm-notice__actions-btn{display:inline-block;border:none;-webkit-box-shadow:none;box-shadow:none;background:#fff;border-radius:5px;padding:0 25px;margin-right:15px;line-height:34px;height:34px;text-decoration:none}.wpmltm-notice__actions-btn:hover{color:#fff;background:#db552b}.wpmltm-notice__actions-link{color:#fff}.wpmltm-notice__actions-link:hover{text-decoration:none;color:#fff !important;opacity:0.8}.wpml-tm-post-edit-alert :first-child{margin-top:0}.wpml-tm-post-edit-alert :last-child{margin-bottom:0}.wpml-tm-post-edit-alert .button+.button{margin-left:1em}.rtl .wpml-tm-post-edit-alert .button+.button{margin-left:0;margin-right:1em}
|
|
|
|
addons/wpml-dependencies/lib/res/font/otgs-icons.eot
DELETED
Binary file
|
addons/wpml-dependencies/lib/res/font/otgs-icons.svg
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
-
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
-
<metadata>Generated by Fontastic.me</metadata>
|
5 |
-
<defs>
|
6 |
-
<font id="otgs-icons" horiz-adv-x="512">
|
7 |
-
<font-face font-family="otgs-icons" units-per-em="512" ascent="480" descent="-32"/>
|
8 |
-
<missing-glyph horiz-adv-x="512" />
|
9 |
-
|
10 |
-
<glyph glyph-name="note-add" unicode="a" d="M394 304c-49 0-89 39-89 89l0 59-180 0c-36 0-65-29-65-65l0-261c0-70 66-66 66-66l261 0c36 0 65 29 65 65l0 179z m-92-91l-29 0 0-29c0-15-12-27-27-27-16 0-28 12-28 27l0 29-30 0c-16 0-28 12-28 28 0 15 12 27 28 27l29 0 0 29c0 15 12 27 27 27 15 0 27-12 27-27l0-29 29 0c16 0 28-12 28-27 1-14-11-28-26-28z m97 132l52 0-110 109 0-51c2-33 28-58 58-58z"/>
|
11 |
-
<glyph glyph-name="note-add-o" unicode="b" d="M242 324c16 0 28-12 28-27l0-29 29 0c15 0 27-12 27-27 0-16-12-28-27-28l-29 0 0-29c0-15-12-27-28-27-15 0-27 12-27 27l0 29-29 0c-15 0-27 12-27 28 0 15 12 27 27 27l29 0 0 29c0 14 12 27 27 27z m77 140l-196 0c-44 0-80-36-80-80l0-258c0-65 51-82 80-82l259 0c45 0 81 36 81 81l0 194z m0-48l97-99-25 0c-39 0-72 33-72 72z m111-293c0-26-20-46-46-46l-259 0c-14 0-48 5-48 49l0 258c0 26 20 46 46 46l162 0 0-41c0-58 48-104 104-104l41 0z"/>
|
12 |
-
<glyph glyph-name="translated" unicode="c" d="M439 384c-19 19-50 19-70 0l-156-154-70 70c-18 19-49 19-70 0-18-18-18-49 0-70l104-104c19-18 52-18 70 0l190 188c20 21 20 51 2 70z"/>
|
13 |
-
<glyph glyph-name="yes" unicode="d" d="M111 44c-7 0-36 2-58 23-15 15-24 35-24 61l0 256c0 44 36 80 80 80l179 0 0-34-177 0c-26 0-46-20-46-46l0-258c0-15 5-29 12-36 13-13 34-11 36-11l259 0c26 0 46 20 46 46l0 179 34 0 0-179c0-45-36-81-80-81l-259 0c0 0-2 0-2 0z m123 108c-9 0-17 3-24 10l-91 89c-13 14-13 34 0 48 14 13 35 13 48 0l60-60 140 213c10 16 31 21 48 11 15-11 20-31 10-48l-164-249c-5-9-15-14-25-16 0 2 0 2-2 2z"/>
|
14 |
-
<glyph glyph-name="in-progress" unicode="e" d="M329 203l0-15c-1-9-8-16-17-17l-17 0c-1 0-3 0-5-2-2 0-3-2-5-3-7-7-7-16-2-23l4-3 7-7 3-3c5-7 5-17 0-24l-12-12c-7-5-17-5-24 0l-5 3-7 7-3 4c0 0-2 0-2 1-2 2-5 2-7 2 0 0 0 0-1 0-2 0-4 0-6 0 0 0-1 0-1-2 0 0 0 0-2 0-2 0-2-1-3-3-2-2-4-5-4-9l0-17c-2-8-8-15-17-17l-15 0c-9 2-16 9-17 17l0 17c0 4-2 7-5 11-4 3-9 5-14 5 0 0 0 0-2 0 0 0-2 0-2 0 0 0-1 0-1 0 0 0-2 0-2 0 0 0 0 0-2 0 0 0 0 0-1-2l-9-9-3-3c-7-5-17-5-24 0l-12 12c-5 7-5 17 0 24l3 3 7 7 4 3c1 4 3 7 3 11 0 7-5 13-12 15 0 0 0 0-2 0 0 0-1 0-1 0l-19 0c-9 2-16 9-17 17l0 16c1 8 8 17 17 17l17 0c3 0 7 1 10 5 4 3 5 8 5 13 0 0 0 2 0 2 0 0 0 2 0 2 0 0 0 0 0 1 0 0 0 0 0 2l-12 7-3 3c-5 7-5 17 0 24l12 12c7 5 17 5 24 0l3-3 7-7 3-3c4-2 7-4 11-4 3 0 8 2 10 4 2 1 3 3 3 5 0 0 0 1 0 1 0 0 0 2 0 2 0 0 0 2 0 2 0 0 0 2 0 2l0 18c2 9 9 16 17 17l16 0c8-1 15-8 17-17l0-17c0-3 1-7 5-10 2-2 3-3 5-3 5-2 12-2 17 1l12 12c7 5 17 5 24 0l12-12c5-7 5-17 0-24l0-3-10-10c-2-2-2-4-4-5 0-2-2-4-2-5 0-6 4-11 7-14 2-2 5-2 7-4l22 0c9 0 16-6 17-15z m-134 31c-21 0-38-17-38-38 0-20 17-37 38-37 20 0 37 17 37 37 2 21-17 38-37 38z m257 94l-5-11c-3-5-10-8-17-6l-3 1-7 2-4 2c-1 0-1 0-3 0-2 0-3 0-5-2-5-2-9-9-7-15l2-2 5-10c2-7-2-14-7-17l-10-5c-7-2-14 0-17 6l-2 4-2 7-1 3c0 0 0 0 0 2-2 1-2 3-4 3-1 0-1 0-3 0 0 0-2 0-2 0-2 0-2 0-3-2-2-1-4-3-5-5l-2-1-2-7-5-2c-3-5-10-8-17-7l-10 5c-5 4-9 11-7 17l2 4 1 5 2 3c0 2 0 5 0 9-2 3-3 5-7 7 0 0 0 0-2 0 0 0 0 0-1 0 0 0 0 0-2 0 0 0 0 0-2 0 0 0 0 0-1 0l-9-5-3-2c-7-2-14 2-17 7l-5 10c-2 7 1 14 6 17l11 5 3 2c2 2 3 3 5 5 2 5 0 10-3 14 0 0 0 0-2 0l-9 3-3 2c-5 3-8 10-7 17l5 10c4 5 11 9 17 7l2-2 7-2 3-1c2 0 5 0 9 0 3 1 7 5 7 8 0 0 0 0 0 2 0 0 0 0 0 2l-5 12-2 3c-2 7 2 14 7 17l10 5c7 2 14-1 17-7l2-3 1-7 2-3c2-2 4-4 7-5 2 0 5 0 7 0 2 0 3 1 3 1 0 0 0 0 0 2 0 0 0 0 0 2 0 0 0 0 0 1l2 2 2 7 1 3c4 6 11 9 17 7l11-5c5-3 8-10 6-17l-1-3-2-7-2-4c0-1 0-5 0-8 0-2 2-4 2-4 3-3 9-5 12-3l14 7 3 2c7 1 14-2 17-7l5-10c2-7 0-14-7-18l-3-1-7-2-3-2c-2 0-2-1-4-3-1-2-1-2-1-3-2-4-2-9 1-12 2-2 2-4 4-4l8-3 4-2c7-3 10-10 8-15z m-83 56c-14 5-31-2-36-15-5-14 2-31 15-36 14-5 31 2 36 15 5 14 0 31-15 36z"/>
|
15 |
-
<glyph glyph-name="copy" unicode="f" d="M420 398l41 0-86 87 0-41c0-26 21-46 45-46z m-4-33c-39 0-71 33-71 70l0 48-144 0c-29 0-51-22-51-51l0-277c0-56 53-53 53-53l208 0c29 0 52 23 52 52l0 211z m-10-106l-51-51c-5-5-12-1-12 5l0 23-113 0c-10 0-18 8-18 18l0 22c0 11 8 19 18 19l113 0 0 22c0 7 9 11 12 6l51-52c0 0 4-3 0 0 4-5 4-8 0-12z m0 11c4-4 0 0 0 0z m-281-132l0 222-17 0c-24 0-52-25-52-49l0-241c0-48 53-51 53-51l181 0c24 0 39 25 39 49l0 2-145 0c-24 0-59 15-59 68z"/>
|
16 |
-
<glyph glyph-name="copy-o" unicode="g" d="M387 271l-47 48c-5 5-12 2-12-5l0-20-108 0c-10 0-17-9-17-18l0-20c0-10 7-17 17-17l108 0 0-21c0-5 7-8 12-5l47 48c2 4 2 9 0 10 0 0 2-1 0 0z m-44 221l-145 0c-29 0-53-21-60-48l-27 0c-32 0-60-28-60-60l0-290c0-19 5-34 17-45 16-15 36-15 43-15 0 0 2 0 2 0l189 0c29 0 53 21 58 48l31 0c32 0 60 27 60 60l0 240z m0-36l72-74-19 0c-29 0-53 24-53 53z m-41-398l-191 0c0 0-15 0-26 9-6 5-8 15-8 27l0 290c0 19 15 34 34 34l26 0 0-276c0-48 37-62 59-62l137 0c-4-13-16-22-31-22z m125 82c0-19-16-34-34-34l-193 0c-11 0-36 3-36 36l0 290c0 19 15 34 34 34l121 0 0-31c0-42 34-78 79-78l29 0z"/>
|
17 |
-
<glyph glyph-name="note-edit" unicode="i" d="M399 345l52 0-110 109 0-51c2-33 28-58 58-58z m-5-41c-49 0-89 39-89 89l0 59-180 0c-36 0-65-29-65-65l0-261c0-70 66-66 66-66l261 0c36 0 65 29 65 65l0 179z m-133-128l-107 107c-7 7-7 19 0 26l29 29c6 7 18 7 25 0l108-108c7-6 7-18 0-25l-29-29c-5-9-17-9-26 0z m31-22l44 44 21-65z"/>
|
18 |
-
<glyph glyph-name="add" unicode="k" d="M297 215l123 0c19 0 32 15 32 32l0 18c0 18-15 32-32 32l-123 0 0 123c0 19-15 32-32 32l-18 0c-18 0-32-15-32-32l0-123-123 0c-19 0-32-15-32-32l0-18c0-18 15-32 32-32l123 0 0-123c0-19 15-32 32-32l18 0c18 0 32 15 32 32z"/>
|
19 |
-
<glyph glyph-name="refresh" unicode="l" d="M258 437c-103 0-185-82-185-184l-30 0c-9 0-12-6-5-12l27-28 27-25c7-7 17-7 24 0l55 54c6 7 3 12-5 12l-33 0c0 69 56 125 125 125 34 0 66-14 88-36l41 41c-34 32-78 53-129 53z m-4-362c101 0 185 82 185 184l30 0c9 0 12 6 5 12l-27 28-27 25c-7 7-17 7-24 0l-55-54c-6-7-5-12 5-12l33 0c0-69-56-125-125-125-34 0-66 14-88 36l-41-41c34-32 78-53 129-53z"/>
|
20 |
-
<glyph glyph-name="no" unicode="n" d="M464 384c0 44-36 80-80 80l-261 0c-44 0-80-36-80-80l0-258c0-25 8-46 24-61 20-21 49-22 58-22 1 0 1 0 1 0l258 0c44 0 80 36 80 80z m-34-261c0-26-20-46-46-46l-259 0c0 0-21 0-36 12-9 8-12 20-12 36l0 259c0 26 20 46 46 46l261 0c26 0 46-20 46-46z"/>
|
21 |
-
<glyph glyph-name="not-translated" unicode="o" d="M329 256l111 111c16 15 16 43 0 60l-15 15c-15 17-43 17-60 0l-109-113-111 111c-15 16-43 16-58 0l-15-15c-16-15-16-43 0-58l111-111-111-111c-16-15-16-43 0-60l15-15c15-15 43-15 60 0l111 111 111-111c15-15 42-15 59 0l16 15c15 16 15 43 0 60z"/>
|
22 |
-
<glyph glyph-name="delete" unicode="p" d="M403 428l-99 0c0 14-10 24-24 24l-50 0c-13 0-23-10-23-24l-98 0c-13 0-24-10-24-24 0-13 11-23 24-23l295 0c14 0 24 10 24 23 0 14-12 24-25 24z m-295-71l0-243c0-30 25-56 56-56l186 0c31 0 56 26 56 56l0 243z m83-226c0-8-7-15-15-15-9 0-16 7-16 15l0 151c0 8 7 15 16 15 8 0 15-7 15-15z m80 0c0-8-6-15-15-15-9 0-15 7-15 15l0 151c0 8 6 15 15 15 9 0 15-7 15-15z m82 0c0-8-7-15-15-15-9 0-15 7-15 15l0 151c0 8 6 15 15 15 8 0 15-7 15-15z"/>
|
23 |
-
<glyph glyph-name="waiting" unicode="q" d="M439 90c-2 0-4 4-4 6-2 6-2 12-3 18-17 70-62 115-130 135-3 2-5 4-5 7 0 3 2 5 5 7 72 19 123 78 133 152 0 3 2 7 7 7 9 1 12 10 10 17-1 8-8 13-19 13-100 0-201 0-302 0-18 0-35 0-54 0-10 0-17-5-19-13-2-9 3-14 14-17l3-4c4-8 4-15 7-22 19-68 61-113 130-133 3-2 5-4 5-7 0-3 0-5-5-7-72-19-123-78-133-152 0-3-2-7-7-7-9-1-14-15-11-23 2-7 9-16 18-16 59 0 117 0 177 0 60 0 118 0 177 0 11 0 18 10 19 19 2 7-5 19-13 20z m-33 328c-3-10-12-34-15-43l-270 0c-3 6-5 11-7 16-3 7-3 19-6 27m122-196c14 0 41 2 57 0 24-5 46-15 65-33 12-10 22-22 30-35l-252 0c22 34 59 61 100 68z"/>
|
24 |
-
<glyph glyph-name="warning" unicode="s" d="M447 126l-165 285c-14 24-36 24-52 0l-165-285c-14-24-2-44 25-44l330 0c29 0 41 20 27 44z m-165 14l-48 0 0 31 48 0z m-6 51l-39 0-5 126 50 0z"/>
|
25 |
-
<glyph glyph-name="original" unicode="t" d="M256 452c-108 0-196-88-196-196 0-108 88-196 196-196 108 0 196 88 196 196 0 108-88 196-196 196z m138-112l4-5c10-19 17-40 20-62l0-7-73 0 0 7c0 17-2 32-5 48l-2 7 7 1c15 4 30 6 44 11z m-65 59c16-8 29-17 41-29 0 0 2-1 2-1l9-9-11-3c-8-2-18-4-29-5l-5 0-1 5c-4 12-7 25-12 36l-7 17z m-13-131l-125 0 0 7c0 15 2 30 5 44l2 5 5 0c17-1 36-1 55-1 18 0 37 0 54 1l5 0 2-5c2-14 4-29 5-44l0-7z m7-24l0-7c0-15-2-30-6-44l-1-5-5 0c-17 1-36 1-55 1-19 0-38 0-55-1l-5 0-1 5c-2 14-4 29-6 44l0 7z m-120 111c4 10 7 20 10 29 5 12 12 22 17 29l2 2 2 0c7 1 13 1 20 1 7 0 14 0 22-1l2 0 2-2c7-7 12-17 17-29 3-9 7-19 10-29l2-7-9 0c-15-2-30-2-47-2-17 0-33 0-48 2l-7 0z m-63 14c0 0 2 1 2 1 12 12 25 23 41 29l15 9-7-17c-5-10-8-22-12-36l-2-5-5 2c-10 1-20 3-29 5l-12 3z m-44-94c1 22 8 42 20 61l2 5 5-1c14-4 27-7 44-11l7-1-2-7c-3-16-5-31-5-48l0-7-71 0z m22-103l-2 5c-10 19-17 40-20 62l0 7 73 0 0-7c0-17 2-32 5-48l2-7-7-1c-15-4-31-6-44-11z m65-59c-16 8-29 17-41 29 0 0-2 1-2 1l-7 9 10 3c9 2 19 4 29 5l5 2 2-5c4-14 7-26 12-36l7-15z m126 44c-4-10-7-20-10-29-5-12-12-22-17-29l-2-2-2 0c-7-1-13-1-22-1-7 0-14 0-20 1l-2 0-2 2c-7 7-12 17-17 29-3 9-7 19-10 29l-2 7 7 0c15 2 31 2 48 2 17 0 32 0 47-2l9 0z m63-12c0 0-2-2-2-2-12-12-25-22-41-29l-15-8 7 15c5 10 8 22 12 36l2 5 5-2c10-1 20-3 29-5l10-3z m44 92c-1-22-8-42-20-61l-3-5-6 1c-13 4-27 7-44 11l-7 1 2 7c2 16 3 31 5 48l0 7 73 0z"/>
|
26 |
-
<glyph glyph-name="needs-update" unicode="u" d="M258 437c-103 0-185-82-185-184l-30 0c-9 0-12-6-5-12l27-28 27-25c7-7 17-7 24 0l55 54c6 7 3 12-5 12l-33 0c0 69 56 125 125 125 34 0 66-14 88-36l41 41c-34 32-78 53-129 53z m-4-362c101 0 185 82 185 184l30 0c9 0 12 6 5 12l-27 28-27 25c-7 7-17 7-24 0l-55-54c-6-7-5-12 5-12l33 0c0-69-56-125-125-125-34 0-66 14-88 36l-41-41c34-32 78-53 129-53z m19 260l-5-115-36 0-5 115z m0-163l-44 0 0 29 44 0z"/>
|
27 |
-
<glyph glyph-name="cred" unicode="w" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-32-329c0-1 0-2-1-3 0 0 0-1 0-2-1-1-1-1-2-2-1-1-1-1-1-2-1-1-2-2-2-2-1-1-2-2-3-2l-1 0c-1-1-2-2-4-3-1 0-2-2-4-2 0-1-2-1-3-2l0 0c-1-1-2-1-2-1l-2 0c-2-1-3-2-6-2l0 0c-2-1-5-2-7-2l0 0c-3-1-5-2-8-3l-1 0c-3 0-5-1-8-1l-1 0c-2-1-4-1-7-1l-2 0c-2 0-5 0-7 0l-1 0c-3 0-6-1-9-1l-1 0c-2 0-5 0-7 0l-1 0c-1 0-3 0-4 0-1 0-2 0-3 0l-1 0c-2 0-4 0-6 0l-2 0c-2 0-3 0-5 1l-2 0c-2 0-3 0-5 0l-1 0c-2 0-3 1-5 1l-2 0c-2 0-3 1-5 1-2 0-4 0-6 1l-1 0c-3 1-5 1-6 2l-1 0c-3 0-5 1-7 2l-1 0c0 0-1 0-2 0l-2 1c-1 0-1 1-2 1l-1 1 0 0-6 2-2 1-2-3-10 5-2 2-1 1-2 1 0 1-2 2 0 1 0 3-1 1 0 1-1 1 0 3c0 1 0 2 0 2l-1 56c0-1 0-2 0-2l0-4 1-1 6-5 1-1 2-2 5-3 2-5 5-3 2 0 6-3c0 0 1-1 2-1l1-1c1 0 2 0 3 0l1-1c3-1 5-2 7-2l1 0c2-1 3-1 5-2l2 0c1 0 3 0 5-1l1 0c2 0 4-1 6-1l1 0c2 0 3-1 5-1l2 0c2 0 3 0 5 0l2 0c1 0 2 0 5-1l1 0c2 0 4 0 6 0 2 0 3 0 5 0 1 0 3 0 4 0 2 0 5 0 7 0l2 0c2 0 5 0 8 1l1 0c3 0 5 0 8 0l1 0c2 0 5 1 7 1l1 0c3 1 6 1 8 2l1 0c3 0 5 1 8 2l1 0c2 0 4 1 6 2l1 0c2 1 3 1 5 2l1 1c1 0 2 0 2 0l2 1c0 1 2 1 3 2 1 0 3 2 4 2 2 1 3 2 4 3l1 0c0 1 2 2 3 2 0 1 1 2 2 3l0 0c1 1 2 2 2 2 1 1 1 2 1 2l0 1c0 1 1 2 1 2 0 1 0 2 1 3l0 2 0-56z m0 80c0-2 0-2-1-3 0-1 0-1 0-2-1-1-1-2-2-2-1-1-1-2-1-2-1-1-2-2-2-3-1 0-2-1-3-2l-1 0c-1 0-2-1-4-2-1-1-2-2-4-3 0 0-2 0-3-1l-1-1c-1-1-1-1-2-1l-2 0c-2 0-3-1-5-2l-1 0c-2 0-4-1-6-2l-1 0c-2-1-5-1-8-2l-1 0c-2-1-5-1-7-1l-2 0c-2-1-4-1-7-1l-1 0c-3 0-5-1-8-1l-1 0c-3 0-6-1-8-1l-2 0c-2 0-5 0-7 0l-1 0c-1 0-3 0-3 0-2 0-3 0-4 0l-1 0c-2 0-4 0-6 0l-2 0c-2 0-3 0-4 1l-2 0c-3 0-4 1-6 1l-1 0c-1 0-3 1-5 1l-1 0c-2 0-4 0-6 0-2 0-4 1-6 2l-1 0c-2 0-4 0-6 1l-1 0c-2 1-4 2-7 2l0 0c-1 0-2 1-3 1l-2 1c0 0-1 0-2 0l0 1-1 0-4 2-3-3-11 6 0 2-3 3-1 1-1 1-3 2 0 2 0 1-1 1 0 1-1 1 0 3c0 1 0 1 0 2l-1 56c0-1 0-2 0-3l0-3 7-7 1 0 2-2 12-7 2-1 6-2c0 0 1-1 2-1l1-1c1 0 2-1 3-1l1 0c3-1 5-2 7-2l1 0c2-1 3-1 5-2l2 0c1 0 3 0 5-1l1 0c2 0 4-1 6-1l1 0c2 0 3-1 5-1l2 0c2 0 3 0 5 0l2 0c1 0 2 0 5-1l1 0c2 0 4 0 6 0 2 0 3 0 5 0 1 0 3 0 4 0 2 0 5 0 7 0l2 0c2 0 5 0 8 1l1 0c3 0 5 0 8 0l1 0c2 0 5 1 7 1l1 0c3 1 6 1 8 2l1 0c3 0 5 1 8 2l1 0c2 0 4 1 6 2l1 0c2 0 3 1 5 2l1 1c1 0 2 0 2 0l2 1c0 1 2 1 3 1 1 1 3 3 4 3 2 1 3 2 4 2l1 1c0 1 2 2 3 2 0 1 1 2 2 2l0 1c1 1 2 2 2 2 1 1 1 2 1 2l0 1c0 1 1 2 1 2 0 1 1 2 1 3l0 2 0-56z m0 79c0-2 0-2-1-3 0-1 0-2 0-2-1-1-1-2-2-2-1-1-1-2-1-3-1 0-2-1-2-2-1 0-2-1-3-2l-1 0c-1-1-2-1-4-2-1-1-2-2-4-3 0 0-2 0-3-1l-1-1c-1-1-1-1-2-1l-2 0c-2 0-3-1-5-2l-1 0c-2 0-4-1-6-2l-1-3c-2-1-5-2-8-3l-1 0c-2 0-5-1-7-1l-2 0c-2-1-4-1-7-1l-1 0c-3 0-5 0-8 0l-1 0c-3 0-6-1-8-1l-2 0c-2 0-5 0-7 0l-1 0c-1 0-3 0-3 0-2 0-3 0-4 0l-1 0c-2 0-4 0-6 0l-2 0c-2 0-3 0-4 1l-2 0c-3 0-4 0-6 0l-1 0c-1 0-3 1-5 1l-1 0c-2 0-4 1-6 1-2 0-4 0-6 1l-1 0c-2 1-4 1-6 2l0 0c-3 0-5 1-7 2l-1 0c0 0-1 0-2 0l-2 1c-1 0-1 1-2 1l-1 1 0 0-2 0-2 2-3 1-1 1-7 3-2 2-3 1-2 3-1 1-2 2-2 2 0 1 0 1-1 2 0 0-1 1 0 3c0 1 0 1 0 2l-1 48c0 0 0 0 0 1 0 0 0 0 0 1l0 6c0-1 0-1 0-2l0-1c5 19 45 34 95 34 50-1 91-17 95-37 0 0 0 1 0 2l0 1 1-55z"/>
|
28 |
-
<glyph glyph-name="layouts" unicode="x" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-208-370l-79 0 0 193 79 0z m236 0l-216 0 0 193 216 0z m0 214l-315 0 0 83 315 0z"/>
|
29 |
-
<glyph glyph-name="module-manager" unicode="y" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-142-381l-130 76 0 138 130-78c0 0 0-136 0-136z m156 76l-130-76 0 132 130 78z m0 165l-140-84-144 85 141 82z"/>
|
30 |
-
<glyph glyph-name="toolset" unicode="z" d="M410 410l0 102-103 0 0-102-102 0 0 102-103 0 0-102-68 0 0-410 444 0 0 410z m-315-232c0-4-1-7-4-9-3-2-6-3-11-3l-3 0-3-14-6 0 8 36 8 0c3 0 6-1 8-3 2-1 3-4 3-7z m-17-7l2 0c3 0 5 0 7 1 2 2 2 3 2 6 0 2 0 3-1 4 0 1-2 1-4 1l-3 0z m23-19l-5 0 8 38 5 0z m19 27l-3-15c0-2 0-4 0-4 0-2 1-4 2-4 2 0 3 1 4 2 1 1 2 2 3 4 1 1 1 3 2 6l2 11 6 0-6-27-4 0 0 6c-1-2-3-4-4-4-1-1-3-2-4-2-3 0-4 1-5 2-1 1-2 3-2 5 0 1 0 3 1 3 0 1 0 2 0 3l3 14z m44 0l-1-3-4-1c0-1 0-2 0-3 0-3-1-6-3-8-1-1-4-2-8-2 0 0-1 0-2 0-2-1-3-2-3-3 0 0 0-1 1-1 0 0 1 0 2 0l3-1c3-1 5-1 6-2 1-1 2-3 2-5 0-3-1-6-3-7-3-2-6-3-11-3-3 0-5 1-7 2-2 1-3 2-3 5 0 1 1 3 2 4 1 1 3 3 5 3-1 1-2 2-2 3 0 1 1 2 1 3 1 0 2 2 4 2-2 1-4 4-4 6 0 4 2 6 3 8 2 1 5 3 8 3 1 0 3 0 4-1l10 0z m-20-26c-2-1-3-1-4-2-1 0-2-1-2-3 0-1 1-2 1-2 2-1 3-2 4-2 3 0 5 1 7 2 1 1 2 2 2 4 0 0-1 1-1 1-1 1-3 1-4 1z m7 23c-1 0-2-1-3-1-1-1-1-2-2-3 0-1 0-2 0-3 0-1 0-2 1-3 0 0 1-1 2-1 1 0 2 1 3 1 0 1 1 2 2 3 0 1 0 2 0 3 0 3-1 4-3 4z m17-24l-5 0 5 27 6 0z m2 34c0 1 0 2 1 3 0 0 1 1 3 1 1 0 1 0 2-1 0 0 0-1 0-1 0-1 0-3-1-3 0-1-1-1-2-1-1 0-2 0-2 0-1 0-1 1-1 2z m22-34l3 17c1 2 1 2 1 3 0 3-1 4-3 4-1 0-2-1-4-1-1-1-2-3-2-4-2-2-2-4-3-6l-2-11-6 0 6 26 5 0-1-5c1 2 3 4 4 4 1 1 3 1 5 1 2 0 4 0 5-1 1-2 1-3 1-5 0-2 0-3 0-5l-4-16z m30 9c0-3-1-5-2-6-2-2-5-3-8-3-3 0-6 1-8 2l0 5c2-1 5-2 7-2 2 0 3 1 4 1 1 1 2 2 2 3 0 1 0 2-1 2 0 1-2 1-3 3-3 1-4 2-5 3 0 1-1 2-1 4 0 2 1 4 3 6 2 1 4 2 7 2 3 0 5-1 8-2l-1-4c-3 1-5 1-7 1-1 0-2 0-3 0 0-1-1-1-1-2 0-1 0-2 1-2 0-1 2-1 3-2 2-2 3-2 4-3 0 0 1-1 1-2 0-2 0-3 0-4z m14-20c-2 0-3 0-4 0l0 5c1-1 2-1 3-1 2 0 3 2 5 5l5 25-5 0 1 2 4 2 1 2c0 4 1 6 3 7 2 1 4 3 6 3 2 0 4-1 6-2l-2-4c-1 1-2 1-4 1-1 0-2-1-2-1-1-1-2-2-2-4l-1-2 6 0-1-4-6 0-5-26c-1-3-2-5-3-7-1 0-3-1-5-1z m44 29c0-4-1-7-2-10-1-2-3-4-5-6-2-2-4-2-7-2-3 0-5 1-7 3-2 1-3 4-3 7 0 4 1 6 2 9 1 3 3 5 5 6 2 2 4 3 7 3 4 0 6-1 8-3 1-2 2-5 2-7z m-6 0c0 1 0 2-1 4-1 1-2 1-3 1-2 0-3 0-4-1-1-2-3-3-3-5-1-2-1-4-1-6 0-2 0-4 1-4 0-1 2-2 3-2 2 0 3 1 4 2 1 1 2 3 3 4 1 2 1 4 1 7z m27 10c1 0 2 0 3-1l-1-5c-1 0-2 1-3 1-2 0-4-1-5-3-2-2-3-4-4-8l-2-12-6 0 6 27 5 0-1-5c1 2 3 3 4 4 1 1 3 2 4 2z m-203-90l-6 0-1 21 0 7c-1-3-2-5-3-7l-9-21-6 0-1 36 5 0 1-21c0-2 0-5-1-8 2 3 3 6 4 8l9 21 6 0 0-21 0-8c1 1 1 3 2 4 0 2 1 3 2 4l8 20 6 0z m37 18c0-4 0-7-1-10-1-2-3-4-5-6-3-2-5-2-7-2-3 0-6 1-8 3-1 1-2 4-2 7 0 4 0 6 1 9 1 3 3 5 5 6 3 2 5 3 8 3 3 0 5-1 7-3 2-2 2-5 2-7z m-5 0c0 1-1 2-1 4-1 1-2 1-4 1-2 0-3 0-4-1-1-2-2-3-3-5 0-2-1-4-1-6 0-2 1-4 1-4 1-1 2-2 4-2 1 0 3 1 4 2 1 1 2 3 3 4 0 2 1 4 1 7z m26 10c2 0 2 0 3-1l-1-5c-1 0-2 1-2 1-2 0-4-1-6-3-2-2-3-4-3-8l-3-12-6 0 6 27 4 0 0-5c1 2 3 3 4 4 2 1 3 2 4 2z m16 0c3 0 5-2 6-5 0 2 1 5 1 6l2 9 6 0-8-38-5 0 1 4c-1-1-3-2-4-3-1-1-3-1-4-1-3 0-4 0-6 2-1 2-2 4-2 7 0 3 1 6 2 9 1 3 3 5 5 7 1 2 4 3 6 3z m-3-23c1 0 3 1 4 2 1 1 2 3 3 5 0 3 1 5 1 7 0 1-1 3-1 3-1 1-2 1-4 1-1 0-2 0-4-1-1-2-2-3-2-6-1-2-2-4-2-6 1-3 2-5 5-5z m45 21c0-4-1-7-4-9-3-2-6-3-11-3l-3 0-3-14-6 0 8 36 8 0c3 0 6-1 8-3 2-1 3-4 3-7z m-17-7l2 0c3 0 5 0 7 1 2 2 2 3 2 6 0 2 0 3-1 4 0 1-2 1-4 1l-3 0z m36 9c1 0 1 0 3-1l-2-5c-1 0-1 1-2 1-2 0-4-1-6-3-1-2-2-4-3-8l-3-12-6 0 6 27 5 0-1-5c1 2 3 3 4 4 2 1 3 2 5 2z m12-28c-3 0-5 2-7 3-2 2-3 5-3 8 0 3 1 6 2 9 1 3 3 5 5 6 2 2 4 2 7 2 3 0 5 0 6-1 2-2 3-3 3-5 0-3-1-6-4-7-3-2-7-3-12-3l-1 0 0-1c0-1 1-3 1-4 1-1 3-1 4-1 1 0 3 0 4 0 1 1 2 1 4 2l0-5c-2 0-3-1-5-1 0-2-2-2-4-2z m4 24c-2 0-3-1-4-2-2-2-3-4-3-6l0 0c3 0 5 0 7 1 2 1 3 2 3 3 0 1 0 2-1 2 0 1-1 2-2 2z m28-15c0-3-1-5-3-6-2-2-4-3-8-3-3 0-5 1-8 2l0 5c3-2 5-3 8-3 1 0 3 1 4 2 1 0 1 1 1 2 0 1 0 2 0 3-1 0-2 1-4 2-2 1-3 2-4 3-1 2-1 3-1 4 0 3 1 5 3 6 1 1 4 2 6 2 4 0 6 0 9-2l-2-4c-2 1-4 2-6 2-1 0-2 0-3-1 0 0-1-1-1-2 0-1 0-1 1-2 0 0 1-1 3-2 2-1 3-2 3-2 1-1 1-1 2-3 0-1 0-2 0-3z m22 0c0-3-1-5-3-6-1-2-4-3-8-3-2 0-5 1-8 2l0 5c3-2 6-3 8-3 2 0 3 1 4 2 1 0 2 1 2 2 0 1-1 2-1 3-1 0-2 1-3 2-3 1-4 2-5 3-1 2-1 3-1 4 0 3 1 5 3 6 1 1 4 2 7 2 3 0 5 0 8-2l-2-4c-2 1-4 2-6 2-1 0-2 0-3-1 0 0-1-1-1-2 0-1 0-1 1-2 0 0 1-1 3-2 2-1 3-2 4-2 0-1 1-1 1-3 0-1 0-2 0-3z m-201-48c0-5 0-8-2-12-2-3-4-5-7-7-3-2-7-3-10-3l-10 0 7 35 9 0c5 0 8-1 11-3 1-2 2-6 2-10z m-19-17c2 0 5 0 7 2 2 1 4 3 5 6 1 2 2 5 2 8 0 3-1 5-3 7-1 2-3 2-6 2l-3 0-6-25z m33-6c-4 0-6 2-8 3-2 2-3 5-3 8 0 3 1 6 2 9 1 3 3 5 5 6 2 2 5 2 7 2 3 0 5 0 7-1 1-2 2-3 2-6 0-2-1-5-4-6-3-2-6-3-11-3l-1 0 0-1c0-1 0-3 1-4 1-1 2-1 4-1 1 0 2 0 3 0 1 1 2 1 4 2l0-5c-2 0-3-1-5-1 0-2-2-2-3-2z m3 24c-1 0-2-1-4-3-1-1-2-3-3-5l1 0c3 0 5 0 6 1 2 1 3 2 3 3 0 1 0 2 0 2-1 1-1 2-3 2z m15-23l-3 27 6 0 1-14c0-3 0-6 0-8 1 1 1 2 2 4 1 2 1 2 2 4l7 14 6 0-14-27c0 0-7 0-7 0z m31-1c-3 0-6 2-7 3-2 2-3 5-3 8 0 3 0 6 1 9 2 3 3 5 6 6 2 2 4 2 7 2 3 0 5 0 6-1 2-2 3-3 3-6 0-2-2-5-4-6-3-2-7-3-12-3l-1 0 0-1c0-1 1-3 1-4 1-1 2-1 4-1 1 0 2 0 4 0 1 1 2 1 4 2l0-5c-2 0-3-1-5-1-1-2-3-2-4-2z m3 24c-1 0-2-1-4-3-1-1-2-3-3-5l1 0c2 0 5 0 6 1 2 1 3 2 3 3 0 1 0 2 0 2-1 1-1 2-3 2z m17-23l-6 0 8 38 6 0z m32 17c0-4-1-7-2-10-1-2-3-4-5-6-2-2-5-2-7-2-3 0-6 1-7 3-2 1-3 4-3 7 0 4 0 6 2 9 1 3 2 5 5 6 2 2 4 3 7 3 4 0 6-1 7-3 2-2 3-4 3-7z m-6 0c0 1 0 2-1 3-1 2-2 2-3 2-2 0-3 0-4-2-2-1-3-2-3-4-1-2-1-4-1-6 0-2 0-4 1-4 0-1 1-2 3-2 2 0 3 1 4 2 1 1 2 3 3 4 1 3 1 4 1 7z m22-18c-3 0-5 2-7 4 0-1 0-2 0-4l-2-12-6 0 8 39 4 0 0-4c2 3 5 5 8 5 3 0 4-1 6-3 1-1 2-4 2-6 0-4-1-7-2-9-1-3-3-6-4-7-2-2-5-3-7-3z m3 23c-1 0-3 0-4-2-1-1-2-2-3-5-1-2-1-4-1-6 0-2 0-3 1-3 0-1 1-1 3-1 2 0 3 0 4 1 1 1 2 3 3 5 1 3 1 5 1 7 0 3-2 4-4 4z m31 5c3 0 6-1 6-5 1 1 3 3 4 4 2 1 3 1 5 1 2 0 4 0 5-1 1-2 1-3 1-6 0-1 0-2 0-4l-4-16-5 0 3 17c1 1 1 2 1 3 0 2-1 3-3 3-2 0-4-1-5-3-2-2-3-5-4-8l-2-11-6 0 4 16c0 1 0 2 0 3 0 2-1 3-2 3-2 0-4-1-6-3-1-2-2-4-3-7l-2-12-6 0 6 27 4 0 0-5c3 2 5 4 9 4z m36-28c-3 0-5 2-7 3-2 2-3 5-3 8 0 3 1 6 2 9 1 3 3 5 5 6 2 2 4 2 7 2 3 0 5 0 6-1 2-2 3-3 3-6 0-2-1-5-4-6-3-2-6-3-12-3l-1 0 0-1c0-1 1-3 1-4 2-1 3-1 4-1 2 0 3 0 4 0 1 1 2 1 4 2l0-5c-2 0-3-1-5-1-1-2-2-2-4-2z m4 24c-2 0-3-1-5-3-1-1-2-3-3-5l1 0c3 0 5 0 7 1 1 1 2 2 2 3 0 1 0 2-1 2 1 1 0 2-1 2z m26-23l4 17c0 1 0 2 0 3 0 2-1 3-2 3-2 0-3 0-4-1-1 0-2-2-3-4-1-1-1-3-2-5l-2-12-6 0 6 27 4 0 0-5c1 1 3 3 4 4 1 1 3 1 4 1 3 0 4-1 5-2 1-1 2-3 2-5 0-1 0-3-1-4l-3-16z m23 4c1 0 2 0 4 1l0-5c-1 0-2-1-3-1-1 0-1 0-3 0-4 0-6 2-6 6 0 1 0 1 0 3l3 14-4 0 1 2 4 3 3 5 3 0-1-5 7 0-1-5-7 0-3-13c0-2 0-2 0-3 0 0 0-1 0-1 1-1 2-1 3-1z m-256 218l-22 0 13 63-18 0 4 18 57 0-4-18-18 0z m52-1c-7 0-13 3-17 7-4 4-6 10-6 17 0 8 1 15 4 21 3 7 7 11 13 14 5 4 11 6 18 6 7 0 14-3 17-7 4-4 7-10 7-17 0-8-2-15-5-21-3-7-7-11-12-15-5-3-12-5-19-5z m9 49c-3 0-6-3-8-8-2-5-3-11-3-17 0-5 1-8 4-8 3 0 6 3 8 8 2 5 4 10 4 17 0 3-1 4-2 6-1 1-2 2-3 2z m56-49c-8 0-14 3-18 7-4 4-6 10-6 17 0 8 2 15 4 21 3 7 7 11 13 14 5 4 11 6 18 6 8 0 14-3 18-7 4-4 6-10 6-17 0-8-2-15-5-21-2-7-6-11-12-15-5-3-11-5-18-5z m8 49c-3 0-5-3-8-8-2-5-3-11-3-17 0-5 2-8 4-8 3 0 6 3 8 8 3 5 4 10 4 17 0 3-1 4-1 6-1 1-2 2-4 2z m50-48l-21 0 19 86 21 0z m60 22c0-7-2-13-7-16-5-4-12-6-21-6-8 0-15 1-19 3l0 17c3-1 6-2 9-4 3 0 6-1 9-1 2 0 4 1 5 1 1 1 2 2 2 3 0 1-1 2-1 4-1 1-4 2-8 4-4 2-6 5-8 8-2 2-3 6-3 10 0 6 2 11 7 15 4 3 11 5 19 5 4 0 8-1 11-1 3-2 7-3 10-5l-7-14c-2 2-5 3-8 4-2 2-4 2-6 2-3 0-4-2-4-4 0-2 0-3 1-3 1-1 3-2 6-3 9-5 13-12 13-19z m33-23c-8 0-14 3-18 7-5 4-6 10-6 18 0 8 1 15 4 21 3 6 8 11 13 14 5 3 11 5 18 5 7 0 12-2 16-5 4-3 6-7 6-12 0-8-3-14-8-18-6-4-15-5-25-5l-4 0 0-1c0-5 3-8 9-8 3 0 6 0 9 1 3 1 5 2 9 4l0-15c-4-2-8-3-11-5-3 0-7-1-12-1z m9 50c-3 0-5-1-7-4-1-2-2-5-3-8l2 0c4 0 6 0 9 2 2 2 3 4 3 6 0 2 0 3-1 3-1 1-2 1-3 1z m54-33c3 0 6 1 10 3l0-16c-5-2-11-3-18-3-5 0-10 1-13 3-3 3-4 7-4 12 0 3 1 6 1 10l5 22-9 0 3 10 12 5 7 13 14 0-3-13 16 0-3-15-16 0-5-22c0-2-1-4-1-5 1-2 2-4 4-4z"/>
|
31 |
-
<glyph glyph-name="types" unicode="A" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-292-141c0 4 3 8 5 10 1 1 6 3 10 3l9 0c6 0 11-1 12 0 2 2 4 5 5 10l1 6c2 4 3 8 5 9 3 2 7 3 12 3l52 0c6 0 9-2 11-3 1-1 3-4 4-9l2-7c1-6 3-8 5-9 2 0 8 0 16 0l97 0c8 0 10-6 10-13l0-16-162 0c-10 0-17 1-20 0-2-2-7-6-12-15l-62-117z m335-48l-63-124-252 0 64 124c2 4 5 7 7 9 2 1 5 2 11 2l227 0c6 0 9-2 9-3 0-1-1-4-3-8z"/>
|
32 |
-
<glyph glyph-name="views" unicode="B" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-279-214c0 0 137 187 307 0-1 0-138-192-307 0z m152 56c-32 0-57-26-57-58 0-32 25-57 57-57 32 0 58 25 58 57 1 32-26 58-58 58z m0-95c-21 0-38 17-38 38 0 21 17 38 38 38 22 0 39-17 39-38 0-21-17-38-39-38z"/>
|
33 |
-
<glyph glyph-name="edit" unicode="h" d="M273 140l-198 200c-14 13-14 35 0 49l55 55c13 13 36 13 47 0l198-202c14-13 14-35 0-47l-54-55c-12-12-34-12-48 0z m138 41l-80-80 116-41z"/>
|
34 |
-
<glyph glyph-name="duplicate" unicode="m" d="M90 49c-5 0-27 2-42 16-12 10-17 25-17 44l0 290c0 33 27 60 59 60l64 0 0-26-64 0c-18 0-34-15-34-34l0-290c0-12 4-20 9-27 10-10 25-9 25-9l55 0 0-25-55 1c2 0 0 0 0 0z m388 304l-108 108-1-2-142 0c-32 0-60-27-60-60l0-290c0-48 38-61 60-61l191 0c33 0 60 27 60 60z m-34-1l-21 0c-29 0-53 23-53 52l0 21z m8-244c0-19-15-35-34-35l-191 0 0-12 0 12c-10 0-34 4-34 36l0 290c0 19 15 34 34 34l119 0 0-30c0-43 35-77 77-77l31 0 0-218z"/>
|
35 |
-
<glyph glyph-name="basket" unicode="r" d="M184 413l-75-99 50 0 58 77c-16 2-28 10-33 22z m41-10c2 0 2 0 4 0 13 3 22 15 22 27 0 0 0 0 0 2 0 1 0 3 0 5-4 14-14 22-27 22-2 0-4 0-7 0-14-3-24-17-21-31 0 0 0-1 0-1 4-14 14-23 28-23-2-1 0-1 1-1z m178-89l-75 99c-5-12-17-22-31-24l58-77 48 0z m-120 89c2 0 2 0 4 0 1 0 1 0 3 0 12 0 24 8 27 22 0 0 0 2 0 2 2 13-6 27-20 30-2 0-5 0-7 0-12 0-24-8-27-22 0-2 0-3 0-5 0 0 0 0 0-2 0-10 8-22 20-25z m128-101l-351 0 51-249 288 0 52 249z"/>
|
36 |
-
<glyph glyph-name="discoverwp" unicode="C" d="M319 333c-7 8-15 17-25 22-11 5-23 9-35 9-8 0-15 0-22 0-5 0-12 0-17 0 0-2 0-6 0-12 0-7 0-14-2-21l0-24-1-19-4-70-1-20-2-24c0-7 0-14 0-20 0-7 0-11 0-12 3 0 8-2 14-2 5 0 12-2 18-2 28-1 52 7 69 26 17 19 27 49 29 89 0 15 0 30-4 44-3 15-10 27-17 36z m-61 150c-125 0-226-102-226-227 0-125 101-225 226-225 124 0 225 100 225 225 0 125-101 227-225 227z m140-230c-2-23-5-41-12-58-7-18-17-31-29-43-12-12-26-21-43-26-15-5-32-8-49-7-19 2-35 2-48 4-14 2-24 2-34 2-7 0-12 0-17 1-6 0-11 0-14 0 2 16 3 33 5 50 2 17 2 36 3 58l2 53c0 18 2 37 2 54 0 4 0 5 0 9-7-2-12-4-17-5 0 0-4-4-5-5l-11-12c-13-16-15-23-22-29 0 0 9 58 16 105 0 4 1 6 1 7 5-8 12-24 17-34 28 5 55 9 84 9 9 0 19 0 31-2 20-2 41-3 58-9 17-5 32-11 44-22 12-10 21-24 27-41 9-15 12-36 11-59z"/>
|
37 |
-
<glyph glyph-name="otgs" unicode="E" d="M123 265c0-29 5-53 15-72 10-21 26-34 46-45 21-10 43-15 65-15 36 0 67 12 91 38 24 24 35 56 35 92 0 37-11 68-35 92-17 17-40 29-64 34l0 89-59 0 0-91c-12-3-24-6-34-13-21-10-35-26-46-46-9-21-14-41-14-63z m85 52c4 4 7 7 12 11l0-103 60 0 0 104c5-3 10-6 15-12 12-13 17-32 17-56 0-25-5-44-17-56-12-14-25-19-42-19-17 0-31 7-43 19-12 13-17 32-17 56-4 24 3 43 15 56z m183 123l-39-49c41-29 66-77 66-132 0-90-73-162-162-162-89 0-162 74-162 162 0 52 22 96 60 125l-40 51c-51-41-83-104-83-174 0-126 100-227 225-227 125 0 225 101 225 225 0 76-36 140-90 181z"/>
|
38 |
-
<glyph glyph-name="wrench" unicode="F" d="M63 365l50-49c20-21 56-19 78 3 22 22 24 58 4 79l-50 49c10 4 21 4 31 4 65 0 118-53 118-118 0-19-4-36-12-50l158-157c14-13 14-37-1-53-16-15-40-17-53-1l-159 157c-15-7-32-12-50-12-64 0-117 53-117 118 0 10 1 20 3 30z m330-264c0-11 8-21 20-21 10 0 20 9 20 21 0 10-8 20-20 20-12 0-20-10-20-20z"/>
|
39 |
-
<glyph glyph-name="link" unicode="G" d="M299 398l-60-58c-12-12-12-29 0-41l10-11 63 64 38-38-63-63 10-10c12-12 29-12 41 0l60 59c12 12 12 29 0 41l-60 60c-10 9-29 9-39-3z m-69-193c-6-7-18-7-27 0-7 7-7 19 0 27l80 80c7 7 19 7 28 0 6-7 6-18 0-27z m-17-91l60 60c12 12 12 29 0 41l-10 10-63-63-38 38 63 63-12 10c-12 12-29 12-41 0l-59-60c-12-12-12-29 0-41l59-59c12-11 31-11 41 1z"/>
|
40 |
-
<glyph glyph-name="envelope-o" unicode="H" d="M413 365l-328 0 0-218 342 0 0 218z m-14-13l-131-132c-7-7-17-7-22 0l-133 132z m-300-6l89-88-89-89z m10-186l87 87 38-37c5-5 13-9 20-9 7 0 16 4 21 9l37 37 87-87z m304 9l-89 89 89 88z"/>
|
41 |
-
<glyph glyph-name="user" unicode="I" d="M386 121l-258-2c0 0-2 14-2 28 0 13 14 17 14 17 17 8 70 29 73 31l0 13 7 2c0 0 2 22 2 26 0 0-9 18-12 29 0 0-7 0-9 6-1 9 0 14-1 19-2 5 3 12 7 10 0 0-9 41 0 53 5 12 8 33 49 40 0 0 24-4 24-7 0 0 20-14 27-34 4-14 2-41 0-48 0 0 7 1 5-7-1-12-1-36-10-31 0 0 0-25-8-30 0 0-2-21 1-21l5 0c0 0 2-17 7-20 0 0 67-23 75-33 7-12 4-41 4-41z"/>
|
42 |
-
<glyph glyph-name="wpml-cms-nav" unicode="J" d="M232 104l-152 152 152 152m48-304l152 152-152 152"/>
|
43 |
-
<glyph glyph-name="wpml-media" unicode="K" d="M335 425l46 0 0-340-46 0z m-103-67l46 0 0-271-46 0z m-101-68l46 0 0-203-46 0z"/>
|
44 |
-
<glyph glyph-name="wpml-string-translation" unicode="L" d="M294 131c-18 0-35 4-52 11-41 17-80 37-117 58-19 10-40 20-58 30-9 4-11 14-7 23 3 8 13 12 22 6 19-10 37-20 58-30 37-21 77-41 116-57 31-13 63-10 89 7 29 19 44 50 44 87 0 46-37 84-84 84-35 0-63-29-63-63 0-26 23-48 48-48 19 0 34 15 34 34 0 14-12 26-25 26-9 0-16 6-16 15 0 9 7 15 16 15 30 0 56-25 56-56 0-37-31-66-67-66-44 0-80 35-80 80 0 53 43 95 96 95 63 0 116-51 116-116 0-46-22-89-58-112-21-16-45-23-68-23z"/>
|
45 |
-
<glyph glyph-name="wpml-translation-management" unicode="M" d="M381 292c-12 0-24-7-29-19l-135 0c-4 15-12 27-24 36l51 22c0 0 0-2 0-2 3-17 21-29 38-25 17 3 29 20 25 37-3 17-20 29-37 26-11-2-17-9-23-15l-76-33c-4 2-9 2-14 2-34 0-60-27-60-60 0-32 28-60 60-60 9 0 17 2 24 6l118-45c5-7 12-14 20-15 17-4 34 8 38 25 3 17-9 35-26 38-17 3-34-9-37-26 0-1 0-1 0-3l-96 36c10 10 17 24 19 41l129 0c2-16 16-29 33-29 17 0 32 13 32 32 0 19-12 31-30 31z"/>
|
46 |
-
<glyph glyph-name="picture" unicode="N" d="M427 116l-342 0 0 280 342 0z m-311 31l282 0 0 218-282 0z m150 25c33 0 79 0 96 0l0 38-65 92-63-89-41 40-53-50 0-29c34-2 104-2 126-2"/>
|
47 |
-
<glyph glyph-name="toolset-training" unicode="O" d="M384 427l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-33-284c0-19-17-29-38-39 0 0-29-14-58-14-28 0-57 14-57 14-24 11-39 19-39 39l0 51 66-23c9-3 20-5 30-5 11 0 22 2 30 5l66 23z m33-3l6 21c0 3 2 5 5 5 3 0 5-2 5-5l6-21z m22 103l0-60c0-6-5-10-11-10-5 0-10 4-10 10l0 52-106-36c-13-6-35-6-48 0l-153 55 28 11 125 53c13 6 35 6 48 0l125-53 30-12z"/>
|
48 |
-
<glyph glyph-name="access-title" unicode="P" d="M155 101l-19 0-5-12-16 0 30 60 20 0 5-60-15 0z m-13 12l12 0 0 17 0 4c0 2 0 4 0 6-1-3-2-5-3-7z m55-25c-6 0-10 2-13 6-2 3-4 7-4 14 0 5 1 10 3 14 2 5 5 8 9 11 3 2 8 3 13 3 5 0 10-1 15-3l-5-12c-4 2-7 3-10 3-2 0-3-1-4-2-2-1-3-3-4-6-1-3-2-5-2-8 0-2 1-4 2-5 1-1 2-2 4-2 1 0 3 0 5 1 2 0 4 1 6 3l0-13c-2-1-4-2-7-3-2 0-5-1-8-1z m42 0c-6 0-10 2-13 6-3 3-4 7-4 14 0 5 0 10 3 14 2 5 5 8 9 11 3 2 8 3 13 3 5 0 10-1 15-3l-6-12c-3 2-6 3-9 3-2 0-3-1-4-2-2-1-3-3-4-6-1-3-2-5-2-8 0-2 1-4 2-5 1-1 2-2 4-2 1 0 3 0 5 1 2 0 4 1 6 3l0-13c-2-1-5-2-7-3-2 0-5-1-8-1z m43 0c-6 0-10 2-13 5-4 3-5 8-5 14 0 5 1 11 3 15 3 5 6 8 9 11 5 2 9 3 14 3 6 0 10-1 13-3 2-3 4-6 4-10 0-5-2-9-6-12-5-3-11-4-19-4l-2 0 0-1c0-4 2-6 6-6 3 0 4 1 7 1 2 0 4 2 7 3l0-11c-4-1-6-3-9-3-2-1-5-2-9-2z m7 38c-2 0-4-1-5-3-1-2-2-4-3-7l2 0c2 0 5 1 7 2 1 1 2 3 2 5 0 1-1 1-1 2-1 1-1 1-2 1z m56-21c0-5-1-10-5-12-3-3-9-5-15-5-6 0-11 1-15 3l0 13c3-2 5-3 7-3 3 0 5-1 7-1 2 0 3 1 4 1 1 0 2 1 2 2 0 1-1 2-1 3-1 1-3 2-6 3-2 1-5 3-6 5-1 3-2 5-2 8 0 5 2 8 5 11 3 2 8 3 14 3 3 0 6 0 9-1 2 0 5-1 7-3l-5-10c-2 1-4 2-6 3-2 0-3 1-5 1-2 0-3-1-3-3 0-1 0-2 1-2 1 0 3-1 5-2 5-4 8-8 8-14z m42 0c0-5-2-10-5-12-3-3-9-5-15-5-6 0-11 1-15 3l0 13c3-2 5-3 7-3 3 0 5-1 7-1 2 0 3 1 4 1 1 0 1 1 1 2 0 1 0 2 0 3-1 1-3 2-6 3-2 1-5 3-6 5-2 3-2 5-2 8 0 5 2 8 5 11 3 2 8 3 14 3 3 0 6 0 8-1 3 0 6-1 8-3l-5-10c-2 1-4 2-6 3-2 0-4 1-5 1-2 0-3-1-3-3 0-1 0-2 1-2 1 0 3-1 4-2 6-4 9-8 9-14z m-132 286c-13 0-25-11-25-25l0-16 50 0 0 16c0 14-11 25-25 25z m82 65l0 56-56 0 0-56-56 0 0 56-56 0 0-56-55 0 0-279 279 0 0 279z m-20-220c0-7-5-12-12-12l-101 0c-7 0-13 5-13 12l0 101c0 7 6 13 13 13l7 0 0 16c0 25 20 45 44 45 24 0 44-20 44-45l0-16 5 0c7 0 13-6 13-13z"/>
|
49 |
-
<glyph glyph-name="views-title" unicode="Q" d="M178 149l17 0-30-60-18 0-4 60 16 0 1-33 0-2c0-3 0-7-1-10l1 0c0 2 1 4 2 7 0 2 1 4 2 6z m27-60l-16 0 10 46 16 0z m-4 57c0 2 1 5 2 6 2 2 4 3 7 3 3 0 5-1 6-2 1-1 2-2 2-4 0-3-1-5-2-7-2-1-4-2-7-2-5 0-8 1-8 6z m36-58c-5 0-10 2-13 5-3 3-5 8-5 14 0 5 1 11 3 15 3 5 6 8 10 11 4 2 8 3 14 3 5 0 9-1 12-3 3-3 5-6 5-10 0-5-3-9-7-12-4-3-10-4-19-4l-2 0 0-1c0-4 2-6 7-6 2 0 4 1 6 1 2 0 5 2 7 3l0-11c-3-1-6-3-8-3-3-2-6-2-10-2z m7 38c-2 0-3-1-5-3-1-2-2-4-3-7l2 0c3 0 5 1 7 2 2 1 2 3 2 5 0 1 0 1-1 2 0 1-1 1-2 1z m54-37l1 18c0 2 0 5 1 8 0 4 0 7 1 9l-1 0c-2-6-3-11-5-16l-8-20-17 0-2 47 15 0 0-21c0-5 0-8-1-11l1 0c1 5 2 9 3 12l7 20 18 0-1-20c0-3 0-7-1-12l0 0c0 1 1 2 1 2 0 1 0 3 1 6 1 3 5 11 10 24l16 0-22-47-17 0z m72 16c0-5-2-10-6-12-3-3-8-5-15-5-6 0-11 1-14 3l0 12c2-1 4-2 7-2 2-1 4-1 6-1 2 0 3 0 4 1 1 0 2 1 2 2 0 1-1 2-1 2-1 1-3 2-5 3-3 2-5 4-7 6-1 2-2 5-2 7 0 5 2 9 5 11 4 3 8 4 14 4 4 0 6-1 9-1 2 0 5-2 7-3l-5-11c-2 2-4 3-5 3-2 1-4 1-6 1-1 0-3-1-3-3 0-1 1-1 2-1 0-1 2-2 4-3 6-3 9-7 9-13z m-30 351l0 56-56 0 0-56-56 0 0 56-56 0 0-56-56 0 0-279 280 0 0 279z m-183-140c0 0 90 122 201 0-1 0-90-126-201 0z m100 37c-21 0-38-17-38-38 0-21 17-38 38-38 21 0 38 17 38 38 0 21-17 38-38 38z m0-63c-14 0-25 12-25 26 0 14 11 25 25 25 14 0 25-11 25-25 0-14-11-26-25-26z"/>
|
50 |
-
<glyph glyph-name="cred-title" unicode="R" d="M340 456l0 56-56 0 0-56-56 0 0 56-56 0 0-56-56 0 0-279 280 0 0 279z m-21-215c0-1 0-1-1-2 0 0 0-1 0-1-1-1-1-1-1-2 0 0 0 0-1-1 0 0-1-1-1-1-1-1-1-1-2-2l-1 0c0 0-1-1-2-1-1-1-2-2-3-2 0 0-1 0-2-1l0 0c-1-1-1-1-2-1l0 0c-2 0-3-1-4-1l-1 0c-1-1-2-1-4-2l0 0c-2 0-4-1-5-1l-1 0c-2-1-3-1-5-1l-1 0c-1 0-3 0-5 0l-1 0c-1 0-3-1-4-1l-1 0c-2 0-4 0-6 0l-1 0c-1 0-3 0-4 0l-1 0c-1 0-2 0-2 0-1 0-2 0-2 0l-1 0c-1 0-3 0-4 0l-1 0c-1 0-2 0-3 0l-2 0c-1 0-2 1-3 1l-1 0c-1 0-2 0-3 0l-1 0c-1 0-2 0-4 0-1 0-2 1-3 1l-1 0c-2 1-3 1-4 1l-1 0c-1 1-3 1-4 2l-1 0c0 0-1 0-2 0l0 1c-1 0-1 0-2 0l0 1-1 0-1 0-2 1-1 0-1 1-1 1-2 1-1 0-3 2-4 4-1 1 0 0-1 1 0 1 0 1 0 1c0 1 0 1 0 2l0 36c0 0 0-1 0-1l0-3 0 0 1-1 1-1 1-1 0 0 1-1 1-1 1-1 1 0 1-1 1-1 1 0 1 0 1-1 2-1 1 0 1-1 2-1 1 0c0 0 1-1 1-1l1 0c0 0 1-1 2-1l1 0c1 0 3-1 4-1l0 0c2-1 3-1 4-1l1 0c1-1 2-1 4-1l0 0c2 0 3-1 4-1l1 0c1 0 2 0 3 0l1 0c2 0 2-1 4-1l1 0c1 0 2 0 3 0l1 0c1 0 3 0 4 0 1 0 2 0 3 0 1 0 2 0 3 0 1 0 3 0 4 0l1 0c2 0 4 0 6 0l1 0c1 0 3 1 4 1l1 0c2 0 4 0 5 0l1 0c1 1 3 1 5 1l1 0c1 1 3 1 5 2l0 0c2 0 3 1 4 1l1 0c1 0 2 1 4 1l0 1c0 0 1 0 1 0l1 1c1 0 2 0 2 1 1 0 3 1 3 2 1 0 2 0 3 1l0 0c1 1 2 1 2 2 1 0 1 1 2 1l0 1c0 0 1 1 1 1 0 1 0 1 1 1l0 1c0 0 0 1 0 1 0 1 0 1 1 2l0 1 0-36z m0 52c0-1 0-1-1-2 0 0 0-1 0-1-1 0-1-1-1-1 0-1 0-1-1-2 0 0-1-1-1-1-1-1-1-1-2-2l-1 0c0 0-1-1-2-1-1 0-2-1-3-2 0 0-1 0-2-1l-1 0c0-1-1-1-1-1l-1 0c-1 0-2-1-4-1l0 0c-2-1-3-1-4-2l-1 0c-1 0-3 0-5-1l0 0c-2 0-4-1-5-1l-1 0c-2 0-3 0-5 0l-1 0c-1 0-3-1-5-1l-1 0c-1 0-3 0-5 0l-1 0c-1 0-3 0-5 0l0 0c-1 0-2 0-3 0 0 0-1 0-2 0l0 0c-2 0-3 0-5 0l-1 0c-1 0-2 0-3 0l-1 0c-1 0-2 1-4 1l0 0c-1 0-2 0-4 0l0 0c-2 0-3 1-4 1-2 0-3 0-4 1l-1 0c-1 0-3 0-4 0l-1 0c-1 1-2 1-4 2l0 0c-1 0-1 0-2 0l-1 1c0 0-1 0-1 0l-1 1 0 0-3 1-1 1-2 1-1 0-2 1-1 0-1 1-1 1-2 1 0 1-1 0 0 1-2 1 0 1-1 0 0 1 0 1 0 1 0 2c0 0 0 0 0 1l-1 36c0 0 0-1 0-1l0-2 3-4 1 0 0-1 2-2 1 0 1 0 2-1 1-1 2-1 1 0 1-1 1-1 2-1 1 0c1 0 1 0 2 0l1-1c0 0 0 0 1 0l1-1c2 0 3-1 4-1l1 0c1-1 2-1 4-1l1 0c1-1 2-1 3-1l1 0c1 0 2-1 4-1l0 0c1 0 2 0 4 0l1 0c1 0 2-1 3-1l1 0c1 0 2 0 4 0l0 0c2 0 3 0 5 0 1 0 2 0 2 0 1 0 2 0 3 0 2 0 4 0 5 0l1 0c2 0 4 0 5 0l1 0c2 0 4 1 5 1l1 0c1 0 3 0 5 0l0 0c2 1 4 1 6 1l0 0c2 1 3 1 5 2l1 0c1 0 2 1 4 1l0 0c2 1 3 1 4 2l1 0c0 0 0 0 1 0l1 1c0 0 1 0 2 1 1 0 2 1 3 2 1 0 1 1 2 1l1 1c0 0 1 0 2 1 0 0 1 1 1 1l1 1c0 0 0 1 0 1 1 1 1 1 1 2l0 0c0 1 1 1 1 1 0 1 0 1 0 2l0 1 1-36z m0 52c0-1 0-1-1-2 0 0 0-1 0-1-1-1-1-1-1-2 0 0 0-1-1-1 0-1-1-1-1-2-1 0-1 0-2-1l-1 0c0 0-1-1-2-1-1-1-2-2-3-2 0-1-1-1-2-1l-1-1c0 0-1 0-1 0l-1 0c-1-1-2-1-4-1l0 0c-2-1-3-1-4-2l-1 0c-1 0-3-1-5-1l0 0c-2-1-4-1-5-1l-1 0c-2-1-3-1-5-1l-1 0c-1 0-3 0-5 0l-1 0c-1 0-3-1-5-1l-1 0c-1 0-3 0-5 0l0 0c-1 0-2 0-3 0 0 0-1 0-2 0l0 0c-2 0-3 0-5 0l-1 0c-1 0-2 0-3 1l-1 0c-1 0-2 0-4 0l0 0c-1 0-2 1-4 1l0 0c-2 0-3 0-4 0-2 0-3 1-4 1l-1 0c-1 1-3 1-4 1l-1 0c-1 1-2 1-4 2l0 0c-1 0-1 0-2 0l-1 0c0 0-1 1-1 1l-1 0 0 0-1 1-1 0-1 1-1 0-2 1-1 1-1 0-1 1-1 0-1 1-1 0-1 1-2 2 0 0-1 1 0 0-1 1 0 1-1 0 0 1 0 0 0 1 0 2c0 1 0 1 0 2l-1 31c0 0 0 0 0 1 0 0 0 0 0 0l0 4c0 0 0-1 0-1l0-1c3 13 29 23 62 22 33 0 60-11 62-24 0 1 0 1 0 2l0 1 1-37z m-134-209c-3 0-5-1-8-3-2-2-4-5-5-9-2-3-2-8-2-12 0-4 1-6 2-8 2-2 4-3 7-3 2 0 4 0 7 1 2 0 5 1 8 3l0-13c-5-3-12-4-18-4-7 0-13 2-16 6-4 4-6 10-6 17 0 8 1 14 4 20 3 6 7 11 11 14 5 3 11 4 17 4 7 0 14-1 19-5l-6-13c-2 2-4 3-7 4-3 1-4 1-7 1z m39-25l-5-22-16 0 13 59 16 0c7 0 12-1 16-4 3-3 5-7 5-12 0-4-1-8-3-11-1-3-4-6-8-7l9-21 2-4-17 0-8 22z m2 12l2 0c3 0 5 1 6 2 2 2 2 4 2 6 0 2 0 3-1 4-1 1-2 1-4 1l-2 0z m67-34l-35 0 12 59 36 0-3-13-20 0-1-9 18 0-3-13-18 0-3-11 20 0z m65 37c0-7-1-14-4-20-3-5-7-10-12-13-5-3-11-5-18-5l-19 0 12 60 18 0c7 0 13-2 17-6 4-3 6-8 6-16z m-32-24c3 0 6 1 8 3 3 2 4 5 6 9 1 3 2 7 2 12 0 3-1 6-3 8-1 1-3 2-6 2l-3 0-7-33 3 0z"/>
|
51 |
-
<glyph glyph-name="layouts-title" unicode="S" d="M95 89l13 59 16 0-10-46 20 0-3-13z m83 0l-12 0 0 5 0 0c-2-2-4-4-5-5-2-1-4-1-6-1-5 0-8 1-10 5-3 3-3 7-3 13 0 4 0 9 2 15 2 5 5 8 8 11 3 3 6 4 10 4 2 0 4-1 6-1 2-1 3-3 5-6l0 0 2 6 13 0z m-16 12c1 0 2 1 3 2 2 2 3 4 3 7 0 3 1 5 1 8 0 2-1 3-1 4 0 1-1 1-2 1-2 0-4-2-6-5-2-3-2-7-2-11 0-4 1-6 4-6z m30 34l16 0 2-22 0-6 0 0c1 3 2 6 2 7 1 0 4 8 10 22l17 0-27-52c-3-5-6-9-10-11-3-2-7-3-12-3-2 0-5 0-7 0l0 13c2-1 3-1 5-1 2 0 4 1 6 2 1 1 3 2 4 4l1 2z m64-47c-6 0-10 1-13 5-3 3-5 7-5 13 0 5 1 10 4 15 2 5 5 8 9 11 4 2 8 3 14 3 5 0 10-1 13-4 3-3 5-8 5-13 0-6-1-11-4-16-2-4-5-8-9-10-4-3-9-4-14-4z m7 36c-3 0-5-2-6-5-1-4-2-9-2-13 0-4 1-6 3-6 2 0 4 2 5 6 2 3 3 8 3 13 0 2-1 3-1 4-1 1-2 1-2 1z m42-20c0-1 1-2 1-3 1 0 2 0 3 0 1 0 3 0 4 3 1 2 2 5 3 9l5 22 16 0-10-47-13 0 1 7-1 0c-1-2-3-4-5-6-2-1-5-1-7-1-4 0-7 0-9 3-3 3-3 6-3 10 0 3 0 6 0 9l6 25 15 0-5-25c0-2-1-4-1-6z m56-3c2 0 4 0 7 2l0-12c-4-2-8-3-14-3-4 0-7 1-9 3-2 2-3 4-3 8 0 2 0 5 1 8l3 16-7 0 2 8 9 4 6 10 10 0-2-10 12 0-3-12-11 0-4-15c0-3 0-4 0-5 0-1 1-2 3-2z m51 4c0-5-1-10-5-12-3-3-9-5-15-5-6 0-11 1-15 3l0 13c3-2 5-3 7-3 3 0 5-1 7-1 2 0 3 1 4 1 1 0 2 1 2 2 0 1-1 2-1 3-1 1-3 2-5 3-3 1-6 3-7 5-1 3-2 5-2 8 0 5 2 8 5 11 4 2 8 3 14 3 3 0 6 0 9-1 2 0 5-1 7-3l-5-10c-2 1-4 2-6 3-2 0-3 1-5 1-2 0-3-1-3-3 0-1 0-2 1-2 1 0 3-1 5-2 5-4 8-8 8-14z m-72 351l0 56-56 0 0-56-56 0 0 56-56 0 0-56-56 0 0-279 280 0 0 279z m-137-242l-51 0 0 127 51 0z m155 0l-142 0 0 127 142 0z m0 140l-206 0 0 54 206 0z"/>
|
52 |
-
<glyph glyph-name="types-title" unicode="T" d="M165 89l-16 0 10 46-13 0 2 13 42 0-2-13-13 0z m24 46l16 0 2-22 0-6 0 0c1 3 2 6 2 7 0 0 4 8 10 22l17 0-27-52c-3-5-6-9-10-11-4-2-8-3-12-3-3 0-5 0-7 0l0 12c2-1 3-1 5-1 2 0 4 1 6 2 1 1 3 2 4 5l1 1z m68-47c-3 0-7 2-9 6l0 0c-1-5-1-10-3-15l-2-11-15 0 14 67 12 0 0-5 0 0c3 4 6 6 11 6 4 0 7-1 10-5 2-3 4-7 4-12 0-6-1-11-3-16-2-5-5-9-7-11-3-3-8-4-12-4z m2 35c-2 0-3-1-4-2-1-1-2-4-3-7 0-2-1-5-1-7 0-2 1-4 1-5 1-1 2-1 3-1 1 0 3 1 4 2 1 2 2 4 3 6 0 3 1 5 1 8-1 4-2 6-4 6z m44-35c-5 0-10 1-13 5-3 3-5 8-5 13 0 6 1 11 4 15 2 5 5 8 9 11 4 3 8 4 14 4 5 0 9-1 12-4 3-2 5-5 5-9 0-6-3-10-7-13-4-2-10-4-19-4l-2 0 0 0c0-5 2-6 7-6 2 0 4 0 6 1 2 0 5 1 7 3l0-11c-3-2-6-3-8-4-3-1-6-1-10-1z m7 38c-2 0-3-1-5-3-1-2-2-4-2-7l1 0c3 0 5 1 7 2 2 1 2 3 2 5 0 1 0 1-1 2 0 1-1 1-2 1z m57-21c0-5-2-10-5-12-4-3-9-5-16-5-6 0-10 1-14 3l0 13c2-2 5-3 7-3 2 0 4-1 6-1 2 0 4 1 5 1 0 0 1 1 1 2 0 1-1 2-1 3-1 1-2 2-5 3-3 1-5 3-7 5-1 3-1 5-1 8 0 5 1 8 5 11 3 2 8 3 14 3 3 0 6 0 8-1 2 0 5-1 7-3l-5-10c-2 1-3 2-5 3-2 0-4 1-5 1-2 0-4-1-4-3 0-1 1-2 2-2 1 0 2-1 4-2 6-4 9-8 9-14z m-27 351l0 56-56 0 0-56-56 0 0 56-56 0 0-56-56 0 0-279 280 0 0 279z m-191-92c0 3 1 6 3 6 1 1 4 2 7 2l5 0c4 0 7 0 8 1 2 1 3 3 3 6l1 4c1 3 2 5 4 6 1 1 4 2 8 2l34 0c3 0 5-1 7-2 0-1 1-3 2-6l1-5c1-3 2-5 4-5 1-1 5-1 10-1l64 0c5 0 7-3 7-8l0-10-107 0c-7 0-11 0-13-1-1-1-5-3-8-9l-40-77z m219-31l-41-82-165 0 42 82c2 3 3 4 5 5 1 1 3 2 7 2l148 0c4 0 6-1 6-2 0-1-1-2-2-5z"/>
|
53 |
-
<glyph glyph-name="module-manager-title" unicode="U" d="M127 89l0 43 0 0c-2-11-3-18-4-21l-5-22-14 0 12 60 22 0 0-42 0 0 20 42 21 0-13-60-14 0 4 23c2 6 3 12 5 17l0 3 0 0-20-43z m74-1c-6 0-11 2-13 5-3 3-5 8-5 13 0 6 1 11 3 15 3 5 5 9 9 11 5 3 9 4 14 4 6 0 11-1 13-5 3-3 5-7 5-13 0-5-1-10-3-15-2-5-5-9-9-11-5-2-9-4-14-4z m6 37c-2 0-4-2-5-6-2-4-3-8-3-13 0-4 1-5 3-5 3 0 5 1 6 5 1 4 2 8 2 13 0 2 0 3-1 4 0 1-1 2-2 2z m47 11c2 0 4 0 5-1 2-1 3-2 5-5l0 0 0 1c0 4 1 7 1 9l3 12 15 0-13-64-13 0 1 6-1 0c-1-3-3-4-5-5-2-1-3-1-6-1-4 0-7 1-10 4-2 3-3 8-3 13 0 5 1 10 3 15 2 5 5 9 7 12 3 3 7 4 11 4z m-1-35c2 0 3 1 4 3 1 1 2 4 3 6 0 3 1 5 1 8 0 4-1 6-4 6-1 0-2-1-3-2-1-1-3-4-4-7-1-2-1-5-1-7 1-5 2-7 4-7z m48 4c0-2 0-2 1-3 0-1 1-1 2-1 1 0 3 1 4 3 2 3 2 5 3 9l5 22 16 0-10-46-12 0 0 6 0 0c-2-2-4-4-6-5-1-1-4-2-7-2-4 0-7 1-9 4-2 2-3 5-3 9 0 3 0 7 1 10l5 24 16 0-5-25c-1-2-1-4-1-5z m49-16l-16 0 13 64 16 0z m32-1c-5 0-10 2-13 5-4 3-5 8-5 14 0 5 1 11 3 15 3 5 6 8 10 11 4 2 8 3 14 3 5 0 9-1 12-3 2-3 4-6 4-10 0-5-2-9-6-12-4-3-10-4-19-4l-2 0 0-1c0-4 2-6 6-6 3 0 5 1 7 1 2 0 5 2 7 3l0-11c-3-1-6-3-9-3-2-1-6-2-9-2z m7 38c-2 0-4-1-5-3-1-2-2-4-3-7l2 0c2 0 5 1 7 2 1 1 2 3 2 5 0 1-1 1-1 2 0 1-1 1-2 1z m-290-102l0 43-1 0c-2-11-3-18-4-21l-4-22-15 0 13 60 21 0 0-43 1 0 19 43 22 0-13-60-15 0 5 23c1 6 3 12 4 17l1 3-1 0-19-43z m92 0l-12 0 0 5 0 0c-2-2-4-3-5-4-2-1-4-2-6-2-5 0-8 2-10 5-3 3-3 7-3 13 0 5 0 10 2 15 2 5 5 9 8 11 3 3 6 4 10 4 2 0 4 0 6-1 2-1 3-3 5-5l0 0 3 5 12 0z m-17 12c1 0 3 1 4 3 1 1 2 3 3 6 0 3 1 5 1 8 0 2-1 3-1 4-1 1-2 2-3 2-2 0-3-2-5-5-2-4-3-8-3-12 1-4 2-6 4-6z m60 19c0 2 0 2-1 3 0 1-1 1-2 1-2 0-3-1-4-3-2-2-3-5-4-9l-4-23-16 0 10 47 12 0 0-7 0 0c2 3 4 5 5 6 2 1 5 2 8 2 4 0 7-2 9-4 2-2 3-6 3-10 0-3-1-6-1-9l-5-25-16 0 5 25c1 3 1 5 1 6z m60-31l-12 0 0 5 0 0c-2-2-4-3-6-4-1-1-3-2-6-2-4 0-7 2-9 5-3 3-4 7-4 13 0 5 1 10 3 15 2 5 5 9 8 11 2 3 6 4 10 4 2 0 4 0 6-1 2-1 3-3 5-5l0 0 2 5 13 0z m-17 12c1 0 3 1 4 3 1 1 2 3 2 6 1 3 1 5 1 8 0 2 0 3-1 4 0 1-1 2-2 2-2 0-4-2-5-5-2-4-3-8-3-12 1-4 2-6 4-6z m78 35l-2-9-6-2c0-1 0-2 0-4 0-5-2-9-5-12-4-4-8-5-14-5-2 0-4 0-5 1 0-1-1-1-1-1-1-1-1-1-1-2 0-1 2-2 5-2l5-1c5 0 9-2 11-4 2-2 3-4 3-8 0-6-2-10-7-13-5-3-11-5-20-5-5 0-10 1-14 3-3 3-5 6-5 9 0 3 1 5 3 7 2 2 5 4 9 4-1 1-2 2-2 3-1 1-1 2-1 3 0 2 0 4 2 5 1 2 3 3 6 4-4 3-6 7-6 12 0 5 2 10 6 13 3 2 8 4 14 4 2 0 3 0 5 0 1-1 2-1 3-1l17 0z m-42-53c0-2 2-4 7-4 3 0 6 1 8 2 2 1 2 2 2 3 0 1 0 2-1 2-1 1-2 1-5 1l-4 1c-3-1-4-1-5-2-2-1-2-2-2-3z m12 35c0-3 1-4 3-4 2 0 3 1 4 3 1 2 1 4 1 6 0 3-1 4-2 4-1 0-2-1-3-1-1-1-1-3-2-4 0-2-1-3-1-4z m48-30c-5 0-10 2-13 5-3 3-5 8-5 13 0 6 1 12 3 16 3 4 6 8 10 10 4 3 8 4 14 4 5 0 9-1 12-4 3-2 4-5 4-9 0-5-2-10-6-12-4-3-10-5-19-5l-2 0 0 0c0-4 2-6 6-6 3 0 5 0 7 1 2 0 5 2 7 3l0-11c-3-1-6-3-8-3-3-1-6-2-10-2z m7 38c-2 0-3-1-5-3-1-2-2-4-3-7l2 0c3 0 5 1 7 2 2 1 2 3 2 5 0 1 0 1-1 2 0 1-1 1-2 1z m57 10c1 0 3 0 3 0l-3-16c-1 0-3 1-5 1-3 0-5-1-7-3-1-2-2-5-3-9l-4-20-16 0 9 46 13 0-1-8 1 0c1 4 3 5 5 7 2 1 5 2 8 2z m-97 385l0 56-56 0 0-56-56 0 0 56-56 0 0-56-56 0 0-279 280 0 0 279z m-93-249l-85 49 0 91 85-51z m102 49l-85-48 0 86 85 51z m0 108l-92-54-94 55 93 54z"/>
|
54 |
-
<glyph glyph-name="access" unicode="v" d="M259 327c-21 0-38-17-38-38l0-24 76 0 0 24c0 21-18 38-38 38z m125 100l0 85-85 0 0-85-86 0 0 85-85 0 0-85-85 0 0-427 426 0 0 427z m-30-336c0-11-8-19-19-19l-154 0c-11 0-20 8-20 19l0 154c0 11 9 20 20 20l10 0 0 24c0 37 31 68 68 68 37 0 67-31 67-68l0-24 8 0c11 0 19-9 19-20l0-154z"/>
|
55 |
-
<glyph glyph-name="bullhorn" unicode="V" d="M401 316c-32 73-83 130-109 119-44-18 26-103-189-191-19-8-24-38-16-56 8-18 33-36 52-29 3 2 15 6 15 6 13-18 27-8 32-19l23-53c5-10 15-20 22-17l41 16c7 2 12 9 10 16-1 1-1 2-1 2-3 7-16 9-20 18-3 8-15 34-18 43-5 11 5 21 19 22 98 10 117-50 150-37 26 11 21 86-11 160z m-11-120c-6-3-45 28-69 85-25 58-22 110-16 113 6 2 43-35 68-92 25-58 23-104 17-106z"/>
|
56 |
-
<glyph glyph-name="comment" unicode="W" d="M79 58l0 24c1 35 27 65 63 69 1 0 2 0 3-1 34-24 80-24 114 0 1 1 2 1 4 1 35-4 62-34 62-69l0-24m-196 171c0 41 33 73 73 73 40 0 73-32 73-73 0-40-33-72-73-72-40 0-73 32-73 72z m296 213l-144 0c-10 0-18-8-18-18l0-84c0-10 8-18 18-18l0 0 0-42c0-2 2-4 4-4 1 0 2 0 2 1l41 44 3 1 94 0c10 0 18 8 18 18l0 84c0 10-8 18-18 18z"/>
|
57 |
-
<glyph glyph-name="quote" unicode="X" d="M395 290c0 77-62 139-139 139-77 0-139-62-139-139 0-66 47-122 109-135l0-63c0-5 4-9 9-9 3 0 5 1 7 3l109 102c0 0 0 0-1 0 28 26 45 62 45 102z m-121 4l0 48 47 0 0-41c0-7-1-14-2-20-2-6-5-12-8-17-7-10-15-19-24-26l-13 11c14 11 24 27 26 44l-26 0z m-59-56c0 0 0 0 0 0l-13 11c14 11 24 27 26 44l-26 0 0 49 47 0 0-41c0-7-1-14-3-20-1-6-4-12-7-18-7-9-15-18-24-25z"/>
|
58 |
-
<glyph glyph-name="star" unicode="Z" d="M262 433l45-108 118-10c5-1 9-5 8-11 0-2-1-4-3-6l-89-77 27-115c1-5-2-9-7-11-3 0-5 0-7 2l-101 60-101-60c-4-3-10-2-12 3-2 2-2 4-2 7l27 114-89 77c-4 4-4 10-1 13 2 2 4 3 6 4l118 10 46 108c1 5 7 7 12 5 2-1 4-3 5-5z"/>
|
59 |
-
<glyph glyph-name="wpml" unicode="D" d="M374 22c-6 4-6 4-6 4-6 3-6 16-6 22 0 6 0 10 0 16 0 3-4 10-7 13-3 6-13 9-19 9-16 0-26-9-29-28 0-13 3-26 10-29 3-3 3-3 6-7 13-12 35-19 55-19 6 0 16 0 22 3 16 7 29 23 35 42 7 22 0 51-16 64-9 10-22 16-35 19-16 7-42 3-58 0-6 0-16-3-22-3-61-13-106-3-150 32-42 38-64 96-55 154 10 64 67 124 135 137 51 10 108 0 134-25 10-10 13-20 13-32 3-36-19-58-42-80-22-23-45-48-41-87 0-19 6-35 25-51 23-13 32-16 55-16 64 0 83 58 86 77 16 80-6 153-61 205-48 48-115 70-182 64-80-10-195-90-176-237 6-51 35-90 61-109 48-42 108-70 240-51 19 3 41 0 51-10 13-13 13-35 9-51 0-6-3-16-9-22-7-7-16-4-23-4"/>
|
60 |
-
<glyph glyph-name="edit-note-o" unicode="j" d="M333 189l-43-42 62-22z m-14 275l-196 0c-44 0-80-36-80-80l0-258c0-65 51-82 80-82l259 0c45 0 81 36 81 81l0 194z m0-48l97-99-25 0c-39 0-72 33-72 72z m111-293c0-26-20-46-46-46l-259 0c-14 0-48 5-48 49l0 258c0 26 20 46 46 46l162 0 0-41c0-58 48-104 104-104l41 0z m-171 46l-105 106c-7 7-7 19 0 25l29 29c6 7 18 7 25 0l106-105c7-7 7-19 0-26l-29-29c-7-7-19-7-26 0z"/>
|
61 |
-
<glyph glyph-name="spinner" unicode="0" d="M109 241l-80 0c3-50 22-96 53-132l58 58c-17 21-27 46-31 74z m51-98l-59-58c34-29 87-49 121-56l0 82c-17 5-45 17-62 32z m96-34l0-82c51 2 106 22 145 55l-60 58c-22-19-51-29-85-31z m145 166l82 0c-3 51-26 97-56 133l-58-58c17-21 29-48 32-75z m-179 124l0 84c-34-5-85-26-118-55l56-58c17 16 45 26 62 29z m181-158c-4-29-14-55-33-77l58-58c33 36 53 83 57 135z m-263 105l-58 58c-31-35-50-80-53-129l82 0c3 25 14 51 29 71z"/>
|
62 |
-
<glyph glyph-name="thumbsup" unicode="Y" d="M321 267c-6 8-58 90-60 97-1 19 0 38 1 57 0 12-37 29-46 7-6-12-25-57-23-69 2-13 6-44 11-67l-108 0c-14 1-26-10-27-24 0 0 0 0 0 0-1-14 5-26 16-33-6-6-9-14-8-22 1-10 7-20 17-26-6-5-9-13-9-21 1-11 8-21 17-27-5-5-7-12-6-20 2-19 19-33 38-31l170 0c9 0 16 4 23 9 5 3 10 7 16 10l83 1c4 0 8 4 8 8l0 124c0 4-2 7-6 7-14 1-94 4-107 20z"/>
|
63 |
-
<glyph glyph-name="status" unicode="1" d="M474 147l-382 0 54 53c8 8 9 22 0 30 0 0 0 0 0 0-9 9-23 9-32 0l-91-89c-9-8-9-22-1-31 0 0 0 0 1 0l91-90c9-8 23-8 32 0 8 9 9 22 0 31 0 0 0 0 0 0l-54 53 382 0c12-2 22 7 24 19 0 0 0 0 0 0 1 12-8 23-20 24-1 1-3 1-4 0z m-436 218l382 0-54-52c-8-9-9-22 0-31 0 0 0 0 0 0 9-9 23-9 32 0l91 89c9 9 9 22 1 31 0 0 0 0-1 0l-91 90c-9 8-23 8-32 0-8-9-9-22 0-31 0 0 0 0 0 0l54-53-382 0c-12 2-22-7-24-19-1-12 8-23 20-24 1 0 3 0 4 0l0 0z"/>
|
64 |
-
<glyph glyph-name="file" unicode="2" d="M276 329c0 3-2 6-6 6l-28 0c-3 0-6-2-6-5l0-141-63 64c-5 5-14 5-20 0l-9-10c-3-2-4-6-4-9 0-4 1-8 4-10l103-104c2-2 6-4 10-4 3 0 7 2 10 4l101 102c5 6 5 15 0 20l-9 10c-6 5-15 5-20 0l-63-63c0 0 0 140 0 140z m72 176l-272 0c-16 0-28-13-28-28l0-442c0-15 12-28 28-28l362 0c15 1 26 13 26 27l0 355c-41 36-80 75-116 116z m6-139l72 0 0-320-339 0 0 420 238 0 0-72c0-16 13-28 29-28z"/>
|
65 |
-
<glyph glyph-name="cancel" unicode="3" d="M299 256l139 139c11 12 11 29 0 43-11 11-28 11-40 0l-142-142-139 139c-12 12-32 12-43 0-11-8-11-28 0-40l3-2 139-137-139-139c-12-12-12-29 0-40 5-6 14-9 20-9 8 0 14 3 20 9l139 136 139-139c12-11 29-11 40 0 12 11 12 28 3 40l-3 3z"/>
|
66 |
-
<glyph glyph-name="download" unicode="4" d="M243 110c3-3 7-5 12-5 5 0 10 2 13 5l152 153c8 7 8 19 0 27l-14 14c-7 7-19 7-26 0l-97-97 0 270c0 16-12 29-28 29-16 0-29-13-29-29l0-271-95 98c-8 7-19 7-27 0l-14-14c-3-4-6-9-6-14 0-5 2-10 6-13 0 0 153-153 153-153z m218-49l-410 0c-14-1-24-13-24-26-1-14 8-27 22-29 1 0 1 0 2 0l410 0c14 1 24 13 24 26 1 14-9 27-23 29 0 0-1 0-1 0z"/>
|
67 |
-
</font></defs></svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/res/font/otgs-icons.ttf
DELETED
Binary file
|
addons/wpml-dependencies/lib/res/font/otgs-icons.woff
DELETED
Binary file
|
addons/wpml-dependencies/lib/res/img/ajax-loader.gif
DELETED
Binary file
|
addons/wpml-dependencies/lib/res/img/icon16.png
DELETED
Binary file
|
addons/wpml-dependencies/lib/res/js/icl-admin-notifier.js
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
/* <![CDATA[*/
|
2 |
-
jQuery(function () {
|
3 |
-
jQuery('.icl-admin-message-hide').on('click', function (event) {
|
4 |
-
|
5 |
-
if (typeof (event.preventDefault) !== 'undefined') {
|
6 |
-
event.preventDefault();
|
7 |
-
} else {
|
8 |
-
event.returnValue = false;
|
9 |
-
}
|
10 |
-
|
11 |
-
var messageBox = jQuery(this).closest('.otgs-is-dismissible');
|
12 |
-
if (messageBox) {
|
13 |
-
var messageID = messageBox.attr('id');
|
14 |
-
|
15 |
-
jQuery.ajax({
|
16 |
-
url: ajaxurl,
|
17 |
-
type: 'POST',
|
18 |
-
data: {
|
19 |
-
action: 'icl-hide-admin-message',
|
20 |
-
'icl-admin-message-id': messageID
|
21 |
-
},
|
22 |
-
dataType: 'json',
|
23 |
-
success: function (ret) {
|
24 |
-
|
25 |
-
if (ret) {
|
26 |
-
messageBox.fadeOut('slow', function () {
|
27 |
-
messageBox.removeAttr('class');
|
28 |
-
if (ret.type) {
|
29 |
-
messageBox.addClass(ret.type);
|
30 |
-
}
|
31 |
-
messageBox.html(ret.text);
|
32 |
-
messageBox.fadeIn();
|
33 |
-
});
|
34 |
-
} else {
|
35 |
-
messageBox.fadeOut();
|
36 |
-
}
|
37 |
-
}
|
38 |
-
});
|
39 |
-
}
|
40 |
-
});
|
41 |
-
|
42 |
-
jQuery('a.icl-admin-message-link').on('click', function (event) {
|
43 |
-
|
44 |
-
if (typeof(event.preventDefault) !== 'undefined' ) {
|
45 |
-
event.preventDefault();
|
46 |
-
} else {
|
47 |
-
event.returnValue = false;
|
48 |
-
}
|
49 |
-
|
50 |
-
jQuery.post(
|
51 |
-
ajaxurl,
|
52 |
-
{
|
53 |
-
action: 'icl-hide-admin-message',
|
54 |
-
'icl-admin-message-id': jQuery(this).parent().parent().attr('id')
|
55 |
-
},
|
56 |
-
function (response) {
|
57 |
-
}
|
58 |
-
);
|
59 |
-
});
|
60 |
-
});
|
61 |
-
/*]]>*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/res/js/otgs-notices.js
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
/*globals jQuery, ajaxurl */
|
2 |
-
|
3 |
-
(function (jQuery, ajaxurl) {
|
4 |
-
function bindEvents() {
|
5 |
-
'use strict';
|
6 |
-
|
7 |
-
var otgsNotice = jQuery('.otgs-notice');
|
8 |
-
var otgsCollapseText = '.otgs-notice-collapse-text';
|
9 |
-
var otgsCollapsedText = '.otgs-notice-collapsed-text';
|
10 |
-
|
11 |
-
jQuery(otgsCollapsedText).hide();
|
12 |
-
|
13 |
-
var preventDefaultEvent = function (event) {
|
14 |
-
if (typeof (event.preventDefault) !== 'undefined') {
|
15 |
-
event.preventDefault();
|
16 |
-
} else {
|
17 |
-
event.returnValue = false;
|
18 |
-
}
|
19 |
-
};
|
20 |
-
|
21 |
-
var noticeAction = function (noticeBox, action) {
|
22 |
-
if (noticeBox) {
|
23 |
-
var ajaxAction = 'otgs-' + action + '-notice';
|
24 |
-
var noticeId = _.escape(noticeBox.data('id'));
|
25 |
-
var noticeGroup = noticeBox.data('group');
|
26 |
-
var nonce = noticeBox.data('nonce');
|
27 |
-
|
28 |
-
jQuery.ajax({
|
29 |
-
url: ajaxurl,
|
30 |
-
type: 'POST',
|
31 |
-
data: {
|
32 |
-
action: ajaxAction,
|
33 |
-
'id': noticeId,
|
34 |
-
'group': noticeGroup,
|
35 |
-
nonce: nonce
|
36 |
-
},
|
37 |
-
dataType: 'json'
|
38 |
-
});
|
39 |
-
|
40 |
-
if (action === 'dismiss') {
|
41 |
-
noticeBox.remove();
|
42 |
-
}
|
43 |
-
|
44 |
-
document.dispatchEvent(new CustomEvent('otgs-notice-' + action, {'detail': noticeBox}));
|
45 |
-
}
|
46 |
-
};
|
47 |
-
|
48 |
-
var toggleNotice = function (contentToMinimize, contentToMaximize) {
|
49 |
-
contentToMinimize.toggle();
|
50 |
-
contentToMaximize.toggle();
|
51 |
-
};
|
52 |
-
|
53 |
-
otgsNotice.on('click', '.notice-dismiss, a.otgs-dismiss-link', function (event) {
|
54 |
-
preventDefaultEvent(event);
|
55 |
-
|
56 |
-
var noticeBox = jQuery(this).closest('.is-dismissible');
|
57 |
-
noticeAction(noticeBox, 'dismiss');
|
58 |
-
});
|
59 |
-
|
60 |
-
otgsNotice.on('click', '.notice-hide, a.otgs-hide-link', function (event) {
|
61 |
-
preventDefaultEvent(event);
|
62 |
-
|
63 |
-
var noticeBox = jQuery(this).closest('.is-dismissible');
|
64 |
-
noticeAction(noticeBox, 'hide');
|
65 |
-
});
|
66 |
-
|
67 |
-
otgsNotice.on('click', '.otgs-notice-collapse-hide', function (event) {
|
68 |
-
preventDefaultEvent(event);
|
69 |
-
|
70 |
-
jQuery(this).toggle();
|
71 |
-
var noticeCollapseText = jQuery(this).siblings(otgsCollapseText);
|
72 |
-
var noticeCollapsedText = jQuery(this).siblings(otgsCollapsedText);
|
73 |
-
toggleNotice(noticeCollapseText, noticeCollapsedText);
|
74 |
-
});
|
75 |
-
|
76 |
-
otgsNotice.on('click', '.otgs-notice-collapse-show', function (event) {
|
77 |
-
preventDefaultEvent(event);
|
78 |
-
|
79 |
-
jQuery(this).closest(otgsCollapsedText).siblings('.otgs-notice-collapse-hide').toggle();
|
80 |
-
var noticeCollapseCollapseText = jQuery(this).closest(otgsCollapsedText).siblings(otgsCollapseText);
|
81 |
-
var noticeCollapseCollapsedText = jQuery(this).closest(otgsCollapsedText);
|
82 |
-
toggleNotice(noticeCollapseCollapseText, noticeCollapseCollapsedText);
|
83 |
-
});
|
84 |
-
|
85 |
-
otgsNotice.on('click', '.notice-action.notice-action-link', function (event) {
|
86 |
-
var groupToDismiss = jQuery(this).data('dismiss-group');
|
87 |
-
var nonce = jQuery(this).data('nonce');
|
88 |
-
var jsCallback = jQuery(this).data('js-callback');
|
89 |
-
|
90 |
-
if (groupToDismiss) {
|
91 |
-
|
92 |
-
if (jsCallback && typeof window[jsCallback] === 'function') {
|
93 |
-
window[jsCallback](jQuery(this), function () {
|
94 |
-
dismissGroup(groupToDismiss, nonce);
|
95 |
-
});
|
96 |
-
} else {
|
97 |
-
dismissGroup(groupToDismiss, nonce);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
});
|
101 |
-
|
102 |
-
var dismissGroup = function (groupToDismiss, nonce) {
|
103 |
-
jQuery.ajax({
|
104 |
-
url: ajaxurl,
|
105 |
-
type: 'POST',
|
106 |
-
data: {
|
107 |
-
action: 'otgs-dismiss-group',
|
108 |
-
group : groupToDismiss,
|
109 |
-
nonce : nonce
|
110 |
-
},
|
111 |
-
dataType: 'json',
|
112 |
-
complete: function () {
|
113 |
-
location.reload();
|
114 |
-
}
|
115 |
-
});
|
116 |
-
};
|
117 |
-
}
|
118 |
-
|
119 |
-
jQuery(function () {
|
120 |
-
bindEvents();
|
121 |
-
|
122 |
-
});
|
123 |
-
|
124 |
-
jQuery(document).on('otgs-notices-added', function (event) {
|
125 |
-
bindEvents();
|
126 |
-
});
|
127 |
-
})(jQuery, ajaxurl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/lib/res/js/scripts.js
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
// This file contains partial code extracted manually from sitepress-multilingual-cms/res/js/scripts.js
|
2 |
-
|
3 |
-
function fadeInAjxResp(spot, msg, err){
|
4 |
-
if(err != undefined){
|
5 |
-
col = jQuery(spot).css('color');
|
6 |
-
jQuery(spot).css('color','red');
|
7 |
-
}
|
8 |
-
jQuery(spot).text(msg); // Originally altering the "html" but we don't have the DOM purifier here so we'll just alter the "text" (enough for what we need).
|
9 |
-
jQuery(spot).fadeIn();
|
10 |
-
window.setTimeout(fadeOutAjxResp, 3000, spot);
|
11 |
-
if(err != undefined){
|
12 |
-
jQuery(spot).css('color',col);
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
function fadeOutAjxResp(spot){
|
17 |
-
jQuery(spot).fadeOut();
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/vendor/autoload.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload.php @generated by Composer
|
4 |
-
|
5 |
-
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
-
|
7 |
-
return ComposerAutoloaderInit5d83f950b133d7d4ec4e876dc0120a4a::getLoader();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/wpml-dependencies/vendor/composer/{ClassLoader.php → Cl}
RENAMED
File without changes
|