From ea00b92232d2efb121e55825aef7dfa28b97349e Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 16 Jul 2021 23:03:57 +0200 Subject: Drop support for parsing ASCII emoticons This commit drops support for parsing plain text ASCII emoticons like ":)" or ":P" to its unicode equivalent. Please use unicode emoticons directly (like those already proposed in the admin form templates). --- core/functions.php | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/core/functions.php b/core/functions.php index ffcb488..a9d103e 100644 --- a/core/functions.php +++ b/core/functions.php @@ -213,7 +213,6 @@ function parseEntityContent(EntityInterface $Entity): string { if(Application::get("$prefix.EMOTICONS")) { $text = parseUnicodeEmoticons($text); - $text = parseEmoticons($text); } return $Parsedown->text($text); @@ -279,44 +278,6 @@ function parseDatetime($datetime, $format): string { ]); } -#=============================================================================== -# Get emoticons with unicode characters and description -#=============================================================================== -function getEmoticons(): array { - $Language = Application::getLanguage(); - - return [ - ':)' => ['😊', $Language->text('emoticon_1F60A')], - ':(' => ['😞', $Language->text('emoticon_1F61E')], - ':D' => ['😃', $Language->text('emoticon_1F603')], - ':P' => ['😛', $Language->text('emoticon_1F61B')], - ':O' => ['😲', $Language->text('emoticon_1F632')], - ';)' => ['😉', $Language->text('emoticon_1F609')], - ';(' => ['😢', $Language->text('emoticon_1F622')], - ':|' => ['😐', $Language->text('emoticon_1F610')], - ':X' => ['😵', $Language->text('emoticon_1F635')], - ':/' => ['😒', $Language->text('emoticon_1F612')], - '8)' => ['😎', $Language->text('emoticon_1F60E')], - ':S' => ['😟', $Language->text('emoticon_1F61F')], - 'xD' => ['😂', $Language->text('emoticon_1F602')], - '^^' => ['😄', $Language->text('emoticon_1F604')], - ]; -} - -#=============================================================================== -# Parse emoticons to HTML encoded unicode characters -#=============================================================================== -function parseEmoticons($string): string { - foreach(getEmoticons() as $emoticon => $data) { - $pattern = '#(^|\s)'.preg_quote($emoticon).'#'; - $replace = "\\1{$data[0]}"; - - $string = preg_replace($pattern, $replace, $string); - } - - return $string; -} - #=============================================================================== # Get unicode emoticons with their corresponding explanation #=============================================================================== -- cgit v1.2.3