2 namespace TYPO3\CMS\Fluid\ViewHelpers\Format;
58 public function render($value = null, $keepQuotes =
false, $encoding = null, $doubleEncode =
true)
60 if ($value === null) {
63 if (!is_string($value)) {
66 if ($encoding === null) {
67 $encoding = self::resolveDefaultEncoding();
69 $flags = $keepQuotes ? ENT_NOQUOTES : ENT_COMPAT;
70 return htmlspecialchars($value, $flags, $encoding, $doubleEncode);
84 public function compile($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\
AbstractNode $syntaxTreeNode, \TYPO3\CMS\
Fluid\Core\Compiler\
TemplateCompiler $templateCompiler)
86 $valueVariableName = $templateCompiler->variableName(
'value');
87 $initializationPhpCode .= sprintf(
'%s = (%s[\'value\'] !== NULL ? %s[\'value\'] : %s());', $valueVariableName, $argumentsVariableName, $argumentsVariableName, $renderChildrenClosureVariableName) . LF;
89 return sprintf(
'(!is_string(%s) ? %s : htmlspecialchars(%s, (%s[\'keepQuotes\'] ? ENT_NOQUOTES : ENT_COMPAT), (%s[\'encoding\'] !== NULL ? %s[\'encoding\'] : \\TYPO3\\CMS\\Fluid\\Core\\Compiler\\AbstractCompiledTemplate::resolveDefaultEncoding()), %s[\'doubleEncode\']))',
90 $valueVariableName, $valueVariableName, $valueVariableName, $argumentsVariableName, $argumentsVariableName, $argumentsVariableName, $argumentsVariableName);