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: MacroNode.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\Error\SyntaxError;
[13] Fix | Delete
/**
[14] Fix | Delete
* Represents a macro node.
[15] Fix | Delete
*
[16] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[17] Fix | Delete
*/
[18] Fix | Delete
class MacroNode extends \WPML\Core\Twig\Node\Node
[19] Fix | Delete
{
[20] Fix | Delete
const VARARGS_NAME = 'varargs';
[21] Fix | Delete
public function __construct($name, \WPML\Core\Twig_NodeInterface $body, \WPML\Core\Twig_NodeInterface $arguments, $lineno, $tag = null)
[22] Fix | Delete
{
[23] Fix | Delete
foreach ($arguments as $argumentName => $argument) {
[24] Fix | Delete
if (self::VARARGS_NAME === $argumentName) {
[25] Fix | Delete
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine(), $argument->getSourceContext());
[26] Fix | Delete
}
[27] Fix | Delete
}
[28] Fix | Delete
parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag);
[29] Fix | Delete
}
[30] Fix | Delete
public function compile(\WPML\Core\Twig\Compiler $compiler)
[31] Fix | Delete
{
[32] Fix | Delete
$compiler->addDebugInfo($this)->write(\sprintf('public function get%s(', $this->getAttribute('name')));
[33] Fix | Delete
$count = \count($this->getNode('arguments'));
[34] Fix | Delete
$pos = 0;
[35] Fix | Delete
foreach ($this->getNode('arguments') as $name => $default) {
[36] Fix | Delete
$compiler->raw('$__' . $name . '__ = ')->subcompile($default);
[37] Fix | Delete
if (++$pos < $count) {
[38] Fix | Delete
$compiler->raw(', ');
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
if (\PHP_VERSION_ID >= 50600) {
[42] Fix | Delete
if ($count) {
[43] Fix | Delete
$compiler->raw(', ');
[44] Fix | Delete
}
[45] Fix | Delete
$compiler->raw('...$__varargs__');
[46] Fix | Delete
}
[47] Fix | Delete
$compiler->raw(")\n")->write("{\n")->indent();
[48] Fix | Delete
$compiler->write("\$context = \$this->env->mergeGlobals([\n")->indent();
[49] Fix | Delete
foreach ($this->getNode('arguments') as $name => $default) {
[50] Fix | Delete
$compiler->write('')->string($name)->raw(' => $__' . $name . '__')->raw(",\n");
[51] Fix | Delete
}
[52] Fix | Delete
$compiler->write('')->string(self::VARARGS_NAME)->raw(' => ');
[53] Fix | Delete
if (\PHP_VERSION_ID >= 50600) {
[54] Fix | Delete
$compiler->raw("\$__varargs__,\n");
[55] Fix | Delete
} else {
[56] Fix | Delete
$compiler->raw('func_num_args() > ')->repr($count)->raw(' ? array_slice(func_get_args(), ')->repr($count)->raw(") : [],\n");
[57] Fix | Delete
}
[58] Fix | Delete
$compiler->outdent()->write("]);\n\n")->write("\$blocks = [];\n\n");
[59] Fix | Delete
if ($compiler->getEnvironment()->isDebug()) {
[60] Fix | Delete
$compiler->write("ob_start();\n");
[61] Fix | Delete
} else {
[62] Fix | Delete
$compiler->write("ob_start(function () { return ''; });\n");
[63] Fix | Delete
}
[64] Fix | Delete
$compiler->write("try {\n")->indent()->subcompile($this->getNode('body'))->outdent()->write("} catch (\\Exception \$e) {\n")->indent()->write("ob_end_clean();\n\n")->write("throw \$e;\n")->outdent()->write("} catch (\\Throwable \$e) {\n")->indent()->write("ob_end_clean();\n\n")->write("throw \$e;\n")->outdent()->write("}\n\n")->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n")->outdent()->write("}\n\n");
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Node\\MacroNode', 'WPML\\Core\\Twig_Node_Macro');
[68] Fix | Delete
[69] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function