17 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
18 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;
51 use CompileWithContentArgumentAndRenderStatic;
72 $this->registerArgument(
'value',
'string',
'string to format');
73 $this->registerArgument(
'keepQuotes',
'bool',
'If TRUE, single and double quotes won\'t be replaced (sets ENT_NOQUOTES flag).',
false,
false);
74 $this->registerArgument(
'encoding',
'string',
'');
75 $this->registerArgument(
'doubleEncode',
'bool',
'If FALSE existing html entities won\'t be encoded, the default is to convert everything.',
false,
true);
87 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
89 $value = $renderChildrenClosure();
90 $encoding = $arguments[
'encoding'];
91 $keepQuotes = $arguments[
'keepQuotes'];
92 $doubleEncode = $arguments[
'doubleEncode'];
94 if (!is_string($value) && !(is_object($value) && method_exists($value,
'__toString'))) {
97 if ($encoding ===
null) {
100 $flags = $keepQuotes ? ENT_NOQUOTES : ENT_QUOTES;
101 return htmlentities((
string)$value, $flags, $encoding, $doubleEncode);