aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/functions.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/functions.php b/core/functions.php
index 7bddb5b..558acf2 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -217,6 +217,20 @@ function getUnicodeEmoticons(): array {
}
#===============================================================================
+# Wrap emoticons in <span> element with "title" attribute for explanation
+#===============================================================================
+function parseUnicodeEmoticons($string): string {
+ foreach(getUnicodeEmoticons() as $emoticon => $explanation) {
+ $pattern = '#(^|\s)'.preg_quote($emoticon).'#';
+ $replace = " <span title=\"{$explanation}\">{$emoticon}</span>";
+
+ $string = preg_replace($pattern, $replace, $string);
+ }
+
+ return $string;
+}
+
+#===============================================================================
# Wrapper function for htmlspecialchars()
#===============================================================================
function escapeHTML($string): string {