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/Loader
File: ArrayLoader.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\Loader;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\Error\LoaderError;
[12] Fix | Delete
use WPML\Core\Twig\Source;
[13] Fix | Delete
/**
[14] Fix | Delete
* Loads a template from an array.
[15] Fix | Delete
*
[16] Fix | Delete
* When using this loader with a cache mechanism, you should know that a new cache
[17] Fix | Delete
* key is generated each time a template content "changes" (the cache key being the
[18] Fix | Delete
* source code of the template). If you don't want to see your cache grows out of
[19] Fix | Delete
* control, you need to take care of clearing the old cache file by yourself.
[20] Fix | Delete
*
[21] Fix | Delete
* This loader should only be used for unit testing.
[22] Fix | Delete
*
[23] Fix | Delete
* @final
[24] Fix | Delete
*
[25] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[26] Fix | Delete
*/
[27] Fix | Delete
class ArrayLoader implements \WPML\Core\Twig\Loader\LoaderInterface, \WPML\Core\Twig\Loader\ExistsLoaderInterface, \WPML\Core\Twig\Loader\SourceContextLoaderInterface
[28] Fix | Delete
{
[29] Fix | Delete
protected $templates = [];
[30] Fix | Delete
/**
[31] Fix | Delete
* @param array $templates An array of templates (keys are the names, and values are the source code)
[32] Fix | Delete
*/
[33] Fix | Delete
public function __construct(array $templates = [])
[34] Fix | Delete
{
[35] Fix | Delete
$this->templates = $templates;
[36] Fix | Delete
}
[37] Fix | Delete
/**
[38] Fix | Delete
* Adds or overrides a template.
[39] Fix | Delete
*
[40] Fix | Delete
* @param string $name The template name
[41] Fix | Delete
* @param string $template The template source
[42] Fix | Delete
*/
[43] Fix | Delete
public function setTemplate($name, $template)
[44] Fix | Delete
{
[45] Fix | Delete
$this->templates[(string) $name] = $template;
[46] Fix | Delete
}
[47] Fix | Delete
public function getSource($name)
[48] Fix | Delete
{
[49] Fix | Delete
@\trigger_error(\sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), \E_USER_DEPRECATED);
[50] Fix | Delete
$name = (string) $name;
[51] Fix | Delete
if (!isset($this->templates[$name])) {
[52] Fix | Delete
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
[53] Fix | Delete
}
[54] Fix | Delete
return $this->templates[$name];
[55] Fix | Delete
}
[56] Fix | Delete
public function getSourceContext($name)
[57] Fix | Delete
{
[58] Fix | Delete
$name = (string) $name;
[59] Fix | Delete
if (!isset($this->templates[$name])) {
[60] Fix | Delete
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
[61] Fix | Delete
}
[62] Fix | Delete
return new \WPML\Core\Twig\Source($this->templates[$name], $name);
[63] Fix | Delete
}
[64] Fix | Delete
public function exists($name)
[65] Fix | Delete
{
[66] Fix | Delete
return isset($this->templates[(string) $name]);
[67] Fix | Delete
}
[68] Fix | Delete
public function getCacheKey($name)
[69] Fix | Delete
{
[70] Fix | Delete
$name = (string) $name;
[71] Fix | Delete
if (!isset($this->templates[$name])) {
[72] Fix | Delete
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
[73] Fix | Delete
}
[74] Fix | Delete
return $name . ':' . $this->templates[$name];
[75] Fix | Delete
}
[76] Fix | Delete
public function isFresh($name, $time)
[77] Fix | Delete
{
[78] Fix | Delete
$name = (string) $name;
[79] Fix | Delete
if (!isset($this->templates[$name])) {
[80] Fix | Delete
throw new \WPML\Core\Twig\Error\LoaderError(\sprintf('Template "%s" is not defined.', $name));
[81] Fix | Delete
}
[82] Fix | Delete
return \true;
[83] Fix | Delete
}
[84] Fix | Delete
}
[85] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Loader\\ArrayLoader', 'WPML\\Core\\Twig_Loader_Array');
[86] Fix | Delete
[87] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function