Merge pull request #43 from Mibew/fix_helpers_auto_esc

Use handlebars escape function for helpers' results
This commit is contained in:
Behrooz Shabani 2014-02-01 03:05:31 -08:00
commit 8650422483

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;
}