From ab4c1fde6d73ab8c93c3f2b53babb62d8c200fcf Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 16 Feb 2014 13:17:59 +0100 Subject: [PATCH] create method for savely printing text --- app/Utils.inc | 27 +++++++++++++++++++++++++++ views/html/questgroups/questgroup.tpl | 2 +- views/html/quests/quest.tpl | 4 ++-- views/html/quests/sidequest.tpl | 4 ++-- views/html/seminaries/seminary.tpl | 2 +- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/Utils.inc b/app/Utils.inc index 1e3527c1..76ccc7fe 100644 --- a/app/Utils.inc +++ b/app/Utils.inc @@ -19,6 +19,33 @@ */ class Utils { + + + /** + * Mask HTML-chars for save output. + * + * @static + * @param string $string String to be masked + * @return string Masked string + */ + static function t($string) + { + return nl2br(htmlspecialchars($string)); + } + + + /** + * ‚htmlspecialchars‘ with support for UTF-8. + * + * @static + * @param string $string String to be masked + * @return string Masked string + */ + public static function htmlspecialchars_utf8($string) + { + return htmlspecialchars($string, ENT_COMPAT, 'UTF-8'); + } + } ?> diff --git a/views/html/questgroups/questgroup.tpl b/views/html/questgroups/questgroup.tpl index b78d1fe4..5699bfa7 100644 --- a/views/html/questgroups/questgroup.tpl +++ b/views/html/questgroups/questgroup.tpl @@ -6,7 +6,7 @@

:

-

+

diff --git a/views/html/quests/quest.tpl b/views/html/quests/quest.tpl index afccd176..9a8b7376 100644 --- a/views/html/quests/quest.tpl +++ b/views/html/quests/quest.tpl @@ -10,7 +10,7 @@

-

+