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: AutoEscapeTokenParser.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\TokenParser;
[10] Fix | Delete
[11] Fix | Delete
use WPML\Core\Twig\Error\SyntaxError;
[12] Fix | Delete
use WPML\Core\Twig\Node\AutoEscapeNode;
[13] Fix | Delete
use WPML\Core\Twig\Node\Expression\ConstantExpression;
[14] Fix | Delete
use WPML\Core\Twig\Token;
[15] Fix | Delete
/**
[16] Fix | Delete
* Marks a section of a template to be escaped or not.
[17] Fix | Delete
*
[18] Fix | Delete
* {% autoescape true %}
[19] Fix | Delete
* Everything will be automatically escaped in this block
[20] Fix | Delete
* {% endautoescape %}
[21] Fix | Delete
*
[22] Fix | Delete
* {% autoescape false %}
[23] Fix | Delete
* Everything will be outputed as is in this block
[24] Fix | Delete
* {% endautoescape %}
[25] Fix | Delete
*
[26] Fix | Delete
* {% autoescape true js %}
[27] Fix | Delete
* Everything will be automatically escaped in this block
[28] Fix | Delete
* using the js escaping strategy
[29] Fix | Delete
* {% endautoescape %}
[30] Fix | Delete
*
[31] Fix | Delete
* @final
[32] Fix | Delete
*/
[33] Fix | Delete
class AutoEscapeTokenParser extends \WPML\Core\Twig\TokenParser\AbstractTokenParser
[34] Fix | Delete
{
[35] Fix | Delete
public function parse(\WPML\Core\Twig\Token $token)
[36] Fix | Delete
{
[37] Fix | Delete
$lineno = $token->getLine();
[38] Fix | Delete
$stream = $this->parser->getStream();
[39] Fix | Delete
if ($stream->test(\WPML\Core\Twig\Token::BLOCK_END_TYPE)) {
[40] Fix | Delete
$value = 'html';
[41] Fix | Delete
} else {
[42] Fix | Delete
$expr = $this->parser->getExpressionParser()->parseExpression();
[43] Fix | Delete
if (!$expr instanceof \WPML\Core\Twig\Node\Expression\ConstantExpression) {
[44] Fix | Delete
throw new \WPML\Core\Twig\Error\SyntaxError('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
[45] Fix | Delete
}
[46] Fix | Delete
$value = $expr->getAttribute('value');
[47] Fix | Delete
$compat = \true === $value || \false === $value;
[48] Fix | Delete
if (\true === $value) {
[49] Fix | Delete
$value = 'html';
[50] Fix | Delete
}
[51] Fix | Delete
if ($compat && $stream->test(\WPML\Core\Twig\Token::NAME_TYPE)) {
[52] Fix | Delete
@\trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', \E_USER_DEPRECATED);
[53] Fix | Delete
if (\false === $value) {
[54] Fix | Delete
throw new \WPML\Core\Twig\Error\SyntaxError('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
[55] Fix | Delete
}
[56] Fix | Delete
$value = $stream->next()->getValue();
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
[60] Fix | Delete
$body = $this->parser->subparse([$this, 'decideBlockEnd'], \true);
[61] Fix | Delete
$stream->expect(\WPML\Core\Twig\Token::BLOCK_END_TYPE);
[62] Fix | Delete
return new \WPML\Core\Twig\Node\AutoEscapeNode($value, $body, $lineno, $this->getTag());
[63] Fix | Delete
}
[64] Fix | Delete
public function decideBlockEnd(\WPML\Core\Twig\Token $token)
[65] Fix | Delete
{
[66] Fix | Delete
return $token->test('endautoescape');
[67] Fix | Delete
}
[68] Fix | Delete
public function getTag()
[69] Fix | Delete
{
[70] Fix | Delete
return 'autoescape';
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
\class_alias('WPML\\Core\\Twig\\TokenParser\\AutoEscapeTokenParser', 'WPML\\Core\\Twig_TokenParser_AutoEscape');
[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