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/Util
File: DeprecationCollector.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\Util;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\Environment;
[12] Fix | Delete
use WPML\Core\Twig\Error\SyntaxError;
[13] Fix | Delete
use WPML\Core\Twig\Source;
[14] Fix | Delete
/**
[15] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[16] Fix | Delete
*
[17] Fix | Delete
* @final
[18] Fix | Delete
*/
[19] Fix | Delete
class DeprecationCollector
[20] Fix | Delete
{
[21] Fix | Delete
private $twig;
[22] Fix | Delete
private $deprecations;
[23] Fix | Delete
public function __construct(\WPML\Core\Twig\Environment $twig)
[24] Fix | Delete
{
[25] Fix | Delete
$this->twig = $twig;
[26] Fix | Delete
}
[27] Fix | Delete
/**
[28] Fix | Delete
* Returns deprecations for templates contained in a directory.
[29] Fix | Delete
*
[30] Fix | Delete
* @param string $dir A directory where templates are stored
[31] Fix | Delete
* @param string $ext Limit the loaded templates by extension
[32] Fix | Delete
*
[33] Fix | Delete
* @return array An array of deprecations
[34] Fix | Delete
*/
[35] Fix | Delete
public function collectDir($dir, $ext = '.twig')
[36] Fix | Delete
{
[37] Fix | Delete
$iterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY), '{' . \preg_quote($ext) . '$}');
[38] Fix | Delete
return $this->collect(new \WPML\Core\Twig\Util\TemplateDirIterator($iterator));
[39] Fix | Delete
}
[40] Fix | Delete
/**
[41] Fix | Delete
* Returns deprecations for passed templates.
[42] Fix | Delete
*
[43] Fix | Delete
* @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template)
[44] Fix | Delete
*
[45] Fix | Delete
* @return array An array of deprecations
[46] Fix | Delete
*/
[47] Fix | Delete
public function collect(\Traversable $iterator)
[48] Fix | Delete
{
[49] Fix | Delete
$this->deprecations = [];
[50] Fix | Delete
\set_error_handler([$this, 'errorHandler']);
[51] Fix | Delete
foreach ($iterator as $name => $contents) {
[52] Fix | Delete
try {
[53] Fix | Delete
$this->twig->parse($this->twig->tokenize(new \WPML\Core\Twig\Source($contents, $name)));
[54] Fix | Delete
} catch (\WPML\Core\Twig\Error\SyntaxError $e) {
[55] Fix | Delete
// ignore templates containing syntax errors
[56] Fix | Delete
}
[57] Fix | Delete
}
[58] Fix | Delete
\restore_error_handler();
[59] Fix | Delete
$deprecations = $this->deprecations;
[60] Fix | Delete
$this->deprecations = [];
[61] Fix | Delete
return $deprecations;
[62] Fix | Delete
}
[63] Fix | Delete
/**
[64] Fix | Delete
* @internal
[65] Fix | Delete
*/
[66] Fix | Delete
public function errorHandler($type, $msg)
[67] Fix | Delete
{
[68] Fix | Delete
if (\E_USER_DEPRECATED === $type) {
[69] Fix | Delete
$this->deprecations[] = $msg;
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Util\\DeprecationCollector', 'WPML\\Core\\Twig_Util_DeprecationCollector');
[74] Fix | Delete
[75] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function