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: CheckSecurityNode.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
/**
[13] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[14] Fix | Delete
*/
[15] Fix | Delete
class CheckSecurityNode extends \WPML\Core\Twig\Node\Node
[16] Fix | Delete
{
[17] Fix | Delete
protected $usedFilters;
[18] Fix | Delete
protected $usedTags;
[19] Fix | Delete
protected $usedFunctions;
[20] Fix | Delete
public function __construct(array $usedFilters, array $usedTags, array $usedFunctions)
[21] Fix | Delete
{
[22] Fix | Delete
$this->usedFilters = $usedFilters;
[23] Fix | Delete
$this->usedTags = $usedTags;
[24] Fix | Delete
$this->usedFunctions = $usedFunctions;
[25] Fix | Delete
parent::__construct();
[26] Fix | Delete
}
[27] Fix | Delete
public function compile(\WPML\Core\Twig\Compiler $compiler)
[28] Fix | Delete
{
[29] Fix | Delete
$tags = $filters = $functions = [];
[30] Fix | Delete
foreach (['tags', 'filters', 'functions'] as $type) {
[31] Fix | Delete
foreach ($this->{'used' . \ucfirst($type)} as $name => $node) {
[32] Fix | Delete
if ($node instanceof \WPML\Core\Twig\Node\Node) {
[33] Fix | Delete
${$type}[$name] = $node->getTemplateLine();
[34] Fix | Delete
} else {
[35] Fix | Delete
${$type}[$node] = null;
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
}
[39] Fix | Delete
$compiler->write("\$this->sandbox = \$this->env->getExtension('\\WPML\\Core\\Twig\\Extension\\SandboxExtension');\n")->write('$tags = ')->repr(\array_filter($tags))->raw(";\n")->write('$filters = ')->repr(\array_filter($filters))->raw(";\n")->write('$functions = ')->repr(\array_filter($functions))->raw(";\n\n")->write("try {\n")->indent()->write("\$this->sandbox->checkSecurity(\n")->indent()->write(!$tags ? "[],\n" : "['" . \implode("', '", \array_keys($tags)) . "'],\n")->write(!$filters ? "[],\n" : "['" . \implode("', '", \array_keys($filters)) . "'],\n")->write(!$functions ? "[]\n" : "['" . \implode("', '", \array_keys($functions)) . "']\n")->outdent()->write(");\n")->outdent()->write("} catch (SecurityError \$e) {\n")->indent()->write("\$e->setSourceContext(\$this->getSourceContext());\n\n")->write("if (\$e instanceof SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n")->indent()->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n")->outdent()->write("} elseif (\$e instanceof SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n")->indent()->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n")->outdent()->write("} elseif (\$e instanceof SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n")->indent()->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n")->outdent()->write("}\n\n")->write("throw \$e;\n")->outdent()->write("}\n\n");
[40] Fix | Delete
}
[41] Fix | Delete
}
[42] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Node\\CheckSecurityNode', 'WPML\\Core\\Twig_Node_CheckSecurity');
[43] Fix | Delete
[44] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function