Use handlebars escape function for helpers' results

This commit is contained in:
Dmitriy Simushev 2014-02-01 10:44:23 +00:00
parent 3a3ab36c5f
commit b6a903fee8

View File

@ -407,9 +407,16 @@ class Template
$current[Tokenizer::NAME] = $name;
$current[Tokenizer::ARGS] = implode(' ', $args);
$result = $this->_section($context, $current);
if ( $escaped ) {
$result = htmlspecialchars($result);
if ($escaped) {
$escape_args = $this->handlebars->getEscapeArgs();
array_unshift($escape_args, $result);
$result = call_user_func_array(
$this->handlebars->getEscape(),
array_values($escape_args)
);
}
return $result;
}