mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Fix error, that mutilated post if it had multiple same emojis (OVK-113)
This commit is contained in:
parent
7d8947eaeb
commit
213c5410a2
1 changed files with 9 additions and 3 deletions
|
@ -6,8 +6,14 @@ trait TRichText
|
|||
private function formatEmojis(string $text): string
|
||||
{
|
||||
$emojis = \Emoji\detect_emoji($text);
|
||||
$replaced = []; # OVK-113
|
||||
foreach($emojis as $emoji) {
|
||||
$point = strtolower($emoji["hex_str"]);
|
||||
if(in_array($point, $replaced))
|
||||
continue;
|
||||
else
|
||||
$replaced[] = $point;
|
||||
|
||||
$image = "https://cdn.jsdelivr.net/npm/emojione-assets@4.5.0/png/32/$point.png";
|
||||
$image = "<img src='$image' alt='$emoji[emoji]' ";
|
||||
$image .= "style='max-height:10pt; padding-left: 2pt; padding-right: 2pt; vertical-align: bottom;' />";
|
||||
|
|
Loading…
Reference in a new issue