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/Node
File: SandboxedPrintNode.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\Node;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\Compiler;
[12] Fix | Delete
use WPML\Core\Twig\Node\Expression\ConstantExpression;
[13] Fix | Delete
use WPML\Core\Twig\Node\Expression\FilterExpression;
[14] Fix | Delete
/**
[15] Fix | Delete
* Adds a check for the __toString() method when the variable is an object and the sandbox is activated.
[16] Fix | Delete
*
[17] Fix | Delete
* When there is a simple Print statement, like {{ article }},
[18] Fix | Delete
* and if the sandbox is enabled, we need to check that the __toString()
[19] Fix | Delete
* method is allowed if 'article' is an object.
[20] Fix | Delete
*
[21] Fix | Delete
* Not used anymore, to be deprecated in 2.x and removed in 3.0
[22] Fix | Delete
*
[23] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[24] Fix | Delete
*/
[25] Fix | Delete
class SandboxedPrintNode extends \WPML\Core\Twig\Node\PrintNode
[26] Fix | Delete
{
[27] Fix | Delete
public function compile(\WPML\Core\Twig\Compiler $compiler)
[28] Fix | Delete
{
[29] Fix | Delete
$compiler->addDebugInfo($this)->write('echo ');
[30] Fix | Delete
$expr = $this->getNode('expr');
[31] Fix | Delete
if ($expr instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
[32] Fix | Delete
$compiler->subcompile($expr)->raw(";\n");
[33] Fix | Delete
} else {
[34] Fix | Delete
$compiler->write('$this->env->getExtension(\'\\WPML\\Core\\Twig\\Extension\\SandboxExtension\')->ensureToStringAllowed(')->subcompile($expr)->raw(");\n");
[35] Fix | Delete
}
[36] Fix | Delete
}
[37] Fix | Delete
/**
[38] Fix | Delete
* Removes node filters.
[39] Fix | Delete
*
[40] Fix | Delete
* This is mostly needed when another visitor adds filters (like the escaper one).
[41] Fix | Delete
*
[42] Fix | Delete
* @return Node
[43] Fix | Delete
*/
[44] Fix | Delete
protected function removeNodeFilter(\WPML\Core\Twig\Node\Node $node)
[45] Fix | Delete
{
[46] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Expression\FilterExpression) {
[47] Fix | Delete
return $this->removeNodeFilter($node->getNode('node'));
[48] Fix | Delete
}
[49] Fix | Delete
return $node;
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Node\\SandboxedPrintNode', 'WPML\\Core\\Twig_Node_SandboxedPrint');
[53] Fix | Delete
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function