Add helper method to use implode() with HTML escaping

This commit is contained in:
Frederic Guillot
2017-02-23 18:51:11 -05:00
parent 73b2f51fe5
commit dd579937e3
4 changed files with 23 additions and 2 deletions

View File

@@ -24,6 +24,19 @@ class TextHelper extends Base
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
}
/**
* Join with HTML escaping
*
* @param $glue
* @param array $list
* @return string
*/
public function implode($glue, array $list)
{
array_walk($list, function (&$value) { $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false); });
return implode($glue, $list);
}
/**
* Markdown transformation
*