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/TokenPar...
File: BlockTokenParser.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
* (c) Armin Ronacher
[6] Fix | Delete
*
[7] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[8] Fix | Delete
* file that was distributed with this source code.
[9] Fix | Delete
*/
[10] Fix | Delete
namespace WPML\Core\Twig\TokenParser;
[11] Fix | Delete
[12] Fix | Delete
use WPML\Core\Twig\Error\SyntaxError;
[13] Fix | Delete
use WPML\Core\Twig\Node\BlockNode;
[14] Fix | Delete
use WPML\Core\Twig\Node\BlockReferenceNode;
[15] Fix | Delete
use WPML\Core\Twig\Node\Node;
[16] Fix | Delete
use WPML\Core\Twig\Node\PrintNode;
[17] Fix | Delete
use WPML\Core\Twig\Token;
[18] Fix | Delete
/**
[19] Fix | Delete
* Marks a section of a template as being reusable.
[20] Fix | Delete
*
[21] Fix | Delete
* {% block head %}
[22] Fix | Delete
* <link rel="stylesheet" href="style.css" />
[23] Fix | Delete
* <title>{% block title %}{% endblock %} - My Webpage</title>
[24] Fix | Delete
* {% endblock %}
[25] Fix | Delete
*
[26] Fix | Delete
* @final
[27] Fix | Delete
*/
[28] Fix | Delete
class BlockTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
[29] Fix | Delete
{
[30] Fix | Delete
public function parse(\WPML\Core\Twig\Token $token)
[31] Fix | Delete
{
[32] Fix | Delete
$lineno = $token->getLine();
[33] Fix | Delete
$stream = $this->parser->getStream();
[34] Fix | Delete
$name = $stream->expect(\WPML\Core\Twig\Token::NAME_TYPE)->getValue();
[35] Fix | Delete
if ($this->parser->hasBlock($name)) {
[36] Fix | Delete
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext());
[37] Fix | Delete
}
[38] Fix | Delete
$this->parser->setBlock($name, $block = new \WPML\Core\Twig\Node\BlockNode($name, new \WPML\Core\Twig\Node\Node([]), $lineno));
[39] Fix | Delete
$this->parser->pushLocalScope();
[40] Fix | Delete
$this->parser->pushBlockStack($name);
[41] Fix | Delete
if ($stream->nextIf(\WPML\Core\Twig\Token::BLOCK_END_TYPE)) {
[42] Fix | Delete
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
[43] Fix | Delete
if ($token = $stream->nextIf(\WPML\Core\Twig\Token::NAME_TYPE)) {
[44] Fix | Delete
$value = $token->getValue();
[45] Fix | Delete
if ($value != $name) {
[46] Fix | Delete
throw new \WPML\Core\Twig\Error\SyntaxError(\sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext());
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
} else {
[50] Fix | Delete
$body = new \WPML\Core\Twig\Node\Node([new \WPML\Core\Twig\Node\PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno)]);
[51] Fix | Delete
}
[52] Fix | Delete
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
[53] Fix | Delete
$block->setNode('body', $body);
[54] Fix | Delete
$this->parser->popBlockStack();
[55] Fix | Delete
$this->parser->popLocalScope();
[56] Fix | Delete
return new \WPML\Core\Twig\Node\BlockReferenceNode($name, $lineno, $this->getTag());
[57] Fix | Delete
}
[58] Fix | Delete
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
[59] Fix | Delete
{
[60] Fix | Delete
return $token->test('endblock');
[61] Fix | Delete
}
[62] Fix | Delete
public function getTag()
[63] Fix | Delete
{
[64] Fix | Delete
return 'block';
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
\class_alias('WPML\\Core\\Twig\\TokenParser\\BlockTokenParser', 'WPML\\Core\\Twig_TokenParser_Block');
[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