Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../lib/twig/src/NodeVisi...
File: SandboxNodeVisitor.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
* This file is part of Twig.
[3] Fix | Delete
*
[4] Fix | Delete
* (c) Fabien Potencier
[5] Fix | Delete
*
[6] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[7] Fix | Delete
* file that was distributed with this source code.
[8] Fix | Delete
*/
[9] Fix | Delete
namespace WPML\Core\Twig\NodeVisitor;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\Environment;
[12] Fix | Delete
use WPML\Core\Twig\Node\CheckSecurityNode;
[13] Fix | Delete
use WPML\Core\Twig\Node\CheckToStringNode;
[14] Fix | Delete
use WPML\Core\Twig\Node\Expression\Binary\ConcatBinary;
[15] Fix | Delete
use WPML\Core\Twig\Node\Expression\Binary\RangeBinary;
[16] Fix | Delete
use WPML\Core\Twig\Node\Expression\FilterExpression;
[17] Fix | Delete
use WPML\Core\Twig\Node\Expression\FunctionExpression;
[18] Fix | Delete
use WPML\Core\Twig\Node\Expression\GetAttrExpression;
[19] Fix | Delete
use WPML\Core\Twig\Node\Expression\NameExpression;
[20] Fix | Delete
use WPML\Core\Twig\Node\ModuleNode;
[21] Fix | Delete
use WPML\Core\Twig\Node\Node;
[22] Fix | Delete
use WPML\Core\Twig\Node\PrintNode;
[23] Fix | Delete
use WPML\Core\Twig\Node\SetNode;
[24] Fix | Delete
/**
[25] Fix | Delete
* @final
[26] Fix | Delete
*
[27] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[28] Fix | Delete
*/
[29] Fix | Delete
class SandboxNodeVisitor extends \WPML\Core\Twig\NodeVisitor\AbstractNodeVisitor
[30] Fix | Delete
{
[31] Fix | Delete
protected $inAModule = \false;
[32] Fix | Delete
protected $tags;
[33] Fix | Delete
protected $filters;
[34] Fix | Delete
protected $functions;
[35] Fix | Delete
private $needsToStringWrap = \false;
[36] Fix | Delete
protected function doEnterNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
[37] Fix | Delete
{
[38] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
[39] Fix | Delete
$this->inAModule = \true;
[40] Fix | Delete
$this->tags = [];
[41] Fix | Delete
$this->filters = [];
[42] Fix | Delete
$this->functions = [];
[43] Fix | Delete
return $node;
[44] Fix | Delete
} elseif ($this->inAModule) {
[45] Fix | Delete
// look for tags
[46] Fix | Delete
if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) {
[47] Fix | Delete
$this->tags[$node->getNodeTag()] = $node;
[48] Fix | Delete
}
[49] Fix | Delete
// look for filters
[50] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) {
[51] Fix | Delete
$this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
[52] Fix | Delete
}
[53] Fix | Delete
// look for functions
[54] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) {
[55] Fix | Delete
$this->functions[$node->getAttribute('name')] = $node;
[56] Fix | Delete
}
[57] Fix | Delete
// the .. operator is equivalent to the range() function
[58] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\Binary\RangeBinary && !isset($this->functions['range'])) {
[59] Fix | Delete
$this->functions['range'] = $node;
[60] Fix | Delete
}
[61] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\PrintNode) {
[62] Fix | Delete
$this->needsToStringWrap = \true;
[63] Fix | Delete
$this->wrapNode($node, 'expr');
[64] Fix | Delete
}
[65] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\SetNode && !$node->getAttribute('capture')) {
[66] Fix | Delete
$this->needsToStringWrap = \true;
[67] Fix | Delete
}
[68] Fix | Delete
// wrap outer nodes that can implicitly call __toString()
[69] Fix | Delete
if ($this->needsToStringWrap) {
[70] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\Binary\ConcatBinary) {
[71] Fix | Delete
$this->wrapNode($node, 'left');
[72] Fix | Delete
$this->wrapNode($node, 'right');
[73] Fix | Delete
}
[74] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
[75] Fix | Delete
$this->wrapNode($node, 'node');
[76] Fix | Delete
$this->wrapArrayNode($node, 'arguments');
[77] Fix | Delete
}
[78] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\FunctionExpression) {
[79] Fix | Delete
$this->wrapArrayNode($node, 'arguments');
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
return $node;
[84] Fix | Delete
}
[85] Fix | Delete
protected function doLeaveNode(\WPML\Core\Twig\Node\Node $node, \WPML\Core\Twig\Environment $env)
[86] Fix | Delete
{
[87] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\ModuleNode) {
[88] Fix | Delete
$this->inAModule = \false;
[89] Fix | Delete
$node->getNode('constructor_end')->setNode('_security_check', new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')]));
[90] Fix | Delete
} elseif ($this->inAModule) {
[91] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\PrintNode || $node instanceof \WPML\Core\Twig\Node\SetNode) {
[92] Fix | Delete
$this->needsToStringWrap = \false;
[93] Fix | Delete
}
[94] Fix | Delete
}
[95] Fix | Delete
return $node;
[96] Fix | Delete
}
[97] Fix | Delete
private function wrapNode(\WPML\Core\Twig\Node\Node $node, $name)
[98] Fix | Delete
{
[99] Fix | Delete
$expr = $node->getNode($name);
[100] Fix | Delete
if ($expr instanceof \WPML\Core\Twig\Node\Expression\NameExpression || $expr instanceof \WPML\Core\Twig\Node\Expression\GetAttrExpression) {
[101] Fix | Delete
$node->setNode($name, new \WPML\Core\Twig\Node\CheckToStringNode($expr));
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
private function wrapArrayNode(\WPML\Core\Twig\Node\Node $node, $name)
[105] Fix | Delete
{
[106] Fix | Delete
$args = $node->getNode($name);
[107] Fix | Delete
foreach ($args as $name => $_) {
[108] Fix | Delete
$this->wrapNode($args, $name);
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
public function getPriority()
[112] Fix | Delete
{
[113] Fix | Delete
return 0;
[114] Fix | Delete
}
[115] Fix | Delete
}
[116] Fix | Delete
\class_alias('WPML\\Core\\Twig\\NodeVisitor\\SandboxNodeVisitor', 'WPML\\Core\\Twig_NodeVisitor_Sandbox');
[117] Fix | Delete
[118] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function