diff options
Diffstat (limited to 'Zotlabs/Lib/Text.php')
-rw-r--r-- | Zotlabs/Lib/Text.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Text.php b/Zotlabs/Lib/Text.php new file mode 100644 index 000000000..f593f9dd6 --- /dev/null +++ b/Zotlabs/Lib/Text.php @@ -0,0 +1,24 @@ +<?php + +namespace Zotlabs\Lib; + +class Text { + + /** + * use this on "body" or "content" input where angle chars shouldn't be removed, + * and allow them to be safely displayed. + * + * @param string $string + * + * @return string + */ + + public static function escape_tags(string $string): string { + if (!$string) { + return EMPTY_STR; + } + + return htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false); + } + +} |