diff options
author | Thomas Lange <code@nerdmind.de> | 2021-07-16 23:03:57 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-07-16 23:03:57 +0200 |
commit | ea00b92232d2efb121e55825aef7dfa28b97349e (patch) | |
tree | 12612808dc912d8ed6c1af8b71992c0fb981e7f3 /core/functions.php | |
parent | 01cbd757d69668b39c1b072b0449b77e6e2bee8d (diff) | |
download | blog-ea00b92232d2efb121e55825aef7dfa28b97349e.tar.gz blog-ea00b92232d2efb121e55825aef7dfa28b97349e.tar.xz blog-ea00b92232d2efb121e55825aef7dfa28b97349e.zip |
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).
Diffstat (limited to 'core/functions.php')
-rw-r--r-- | core/functions.php | 39 |
1 files changed, 0 insertions, 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); @@ -280,44 +279,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<span title=\"{$data[1]}\">{$data[0]}</span>"; - - $string = preg_replace($pattern, $replace, $string); - } - - return $string; -} - -#=============================================================================== # Get unicode emoticons with their corresponding explanation #=============================================================================== function getUnicodeEmoticons(): array { |