From dd579937e36ec494372d8d99b49d0943ea2b721d Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 23 Feb 2017 18:51:11 -0500 Subject: Add helper method to use implode() with HTML escaping --- app/Helper/TextHelper.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/Helper') diff --git a/app/Helper/TextHelper.php b/app/Helper/TextHelper.php index 66583cd1..89c1a8f3 100644 --- a/app/Helper/TextHelper.php +++ b/app/Helper/TextHelper.php @@ -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 * -- cgit v1.2.3