Prevent multiple replacements for the same emoji in Protocol\ActivityPub\Processor::replaceEmojis
This commit is contained in:
parent
9e4a0bf212
commit
a8f16788f4
|
@ -75,10 +75,15 @@ class Processor
|
||||||
*/
|
*/
|
||||||
private static function replaceEmojis($body, array $emojis)
|
private static function replaceEmojis($body, array $emojis)
|
||||||
{
|
{
|
||||||
foreach ($emojis as $emoji) {
|
$body = strtr($body,
|
||||||
$replace = '[class=emoji mastodon][img=' . $emoji['href'] . ']' . $emoji['name'] . '[/img][/class]';
|
array_combine(
|
||||||
$body = str_replace($emoji['name'], $replace, $body);
|
array_column($emojis, 'name'),
|
||||||
}
|
array_map(function ($emoji) {
|
||||||
|
return '[class=emoji mastodon][img=' . $emoji['href'] . ']' . $emoji['name'] . '[/img][/class]';
|
||||||
|
}, $emojis)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue