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/Extensio...
File: SandboxExtension.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\Extension;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor;
[12] Fix | Delete
use WPML\Core\Twig\Sandbox\SecurityPolicyInterface;
[13] Fix | Delete
use WPML\Core\Twig\TokenParser\SandboxTokenParser;
[14] Fix | Delete
/**
[15] Fix | Delete
* @final
[16] Fix | Delete
*/
[17] Fix | Delete
class SandboxExtension extends \WPML\Core\Twig\Extension\AbstractExtension
[18] Fix | Delete
{
[19] Fix | Delete
protected $sandboxedGlobally;
[20] Fix | Delete
protected $sandboxed;
[21] Fix | Delete
protected $policy;
[22] Fix | Delete
public function __construct(\WPML\Core\Twig\Sandbox\SecurityPolicyInterface $policy, $sandboxed = \false)
[23] Fix | Delete
{
[24] Fix | Delete
$this->policy = $policy;
[25] Fix | Delete
$this->sandboxedGlobally = $sandboxed;
[26] Fix | Delete
}
[27] Fix | Delete
public function getTokenParsers()
[28] Fix | Delete
{
[29] Fix | Delete
return [new \WPML\Core\Twig\TokenParser\SandboxTokenParser()];
[30] Fix | Delete
}
[31] Fix | Delete
public function getNodeVisitors()
[32] Fix | Delete
{
[33] Fix | Delete
return [new \WPML\Core\Twig\NodeVisitor\SandboxNodeVisitor()];
[34] Fix | Delete
}
[35] Fix | Delete
public function enableSandbox()
[36] Fix | Delete
{
[37] Fix | Delete
$this->sandboxed = \true;
[38] Fix | Delete
}
[39] Fix | Delete
public function disableSandbox()
[40] Fix | Delete
{
[41] Fix | Delete
$this->sandboxed = \false;
[42] Fix | Delete
}
[43] Fix | Delete
public function isSandboxed()
[44] Fix | Delete
{
[45] Fix | Delete
return $this->sandboxedGlobally || $this->sandboxed;
[46] Fix | Delete
}
[47] Fix | Delete
public function isSandboxedGlobally()
[48] Fix | Delete
{
[49] Fix | Delete
return $this->sandboxedGlobally;
[50] Fix | Delete
}
[51] Fix | Delete
public function setSecurityPolicy(\WPML\Core\Twig\Sandbox\SecurityPolicyInterface $policy)
[52] Fix | Delete
{
[53] Fix | Delete
$this->policy = $policy;
[54] Fix | Delete
}
[55] Fix | Delete
public function getSecurityPolicy()
[56] Fix | Delete
{
[57] Fix | Delete
return $this->policy;
[58] Fix | Delete
}
[59] Fix | Delete
public function checkSecurity($tags, $filters, $functions)
[60] Fix | Delete
{
[61] Fix | Delete
if ($this->isSandboxed()) {
[62] Fix | Delete
$this->policy->checkSecurity($tags, $filters, $functions);
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
public function checkMethodAllowed($obj, $method)
[66] Fix | Delete
{
[67] Fix | Delete
if ($this->isSandboxed()) {
[68] Fix | Delete
$this->policy->checkMethodAllowed($obj, $method);
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
public function checkPropertyAllowed($obj, $method)
[72] Fix | Delete
{
[73] Fix | Delete
if ($this->isSandboxed()) {
[74] Fix | Delete
$this->policy->checkPropertyAllowed($obj, $method);
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
public function ensureToStringAllowed($obj)
[78] Fix | Delete
{
[79] Fix | Delete
if ($this->isSandboxed() && \is_object($obj) && \method_exists($obj, '__toString')) {
[80] Fix | Delete
$this->policy->checkMethodAllowed($obj, '__toString');
[81] Fix | Delete
}
[82] Fix | Delete
return $obj;
[83] Fix | Delete
}
[84] Fix | Delete
public function getName()
[85] Fix | Delete
{
[86] Fix | Delete
return 'sandbox';
[87] Fix | Delete
}
[88] Fix | Delete
}
[89] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Extension\\SandboxExtension', 'WPML\\Core\\Twig_Extension_Sandbox');
[90] Fix | Delete
[91] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function