Improved Emoji detection
authorMichael <heluecht@pirati.ca>
Fri, 13 Oct 2023 21:55:15 +0000 (21:55 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 13 Oct 2023 21:55:15 +0000 (21:55 +0000)
src/Content/Smilies.php

index 7d3e4073f480b8130c3c3d3bd321b0b031922121..2e1a6cf19c158db52b4b25a2155f5831c426a952 100644 (file)
@@ -287,7 +287,7 @@ class Smilies
        }
 
        /**
-        * Checks if the body only contains 4 byte unicode characters.
+        * Checks if the body doesn't contain any alphanumeric characters
         *
         * @param string $body Possibly-HTML post body
         * @return boolean
@@ -308,7 +308,7 @@ class Smilies
                for ($i = 0; $i < mb_strlen($conv); $i++) {
                        $character = mb_substr($conv, $i, 1);
 
-                       if (\IntlChar::isalnum($character)) {
+                       if (\IntlChar::isalnum($character) || \IntlChar::ispunct($character) || \IntlChar::isgraph($character) && (strlen($character) <= 2)) {
                                return false;
                        }
                }