mirror of
https://github.com/friendica/friendica
synced 2025-04-30 05:04:22 +02:00
Posts without text or only with emojis are now always accepted in the language check
This commit is contained in:
parent
5f832cb75a
commit
4dbb7dd3da
3 changed files with 21 additions and 6 deletions
|
@ -285,4 +285,17 @@ class Smilies
|
|||
|
||||
return str_replace($matches[0], $t, $matches[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the body only contains 4 byte unicode characters.
|
||||
*
|
||||
* @param string $body
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isEmojiPost(string $body): bool
|
||||
{
|
||||
$conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $body));
|
||||
// Emojis are always 4 byte Unicode characters
|
||||
return (!empty($conv) && (strlen($conv) / mb_strlen($conv) == 4));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue