public function formatEmojiToImage($string)
{
if ($this->config['style'] === 'native') {
return $string;
}
return preg_replace_callback('/' . $this->client->unicodeRegexp . '/u', function ($match) {
if ($this->config['style'] === 'emojione') {
$chars = mb_str_split($match[0]);
$codepoints = array_map(static function (string $code): string {
return str_pad(dechex(mb_ord($code, 'UTF-8')), 4, 0, STR_PAD_LEFT);
}, $chars);
$codepoints = array_diff($codepoints, ['fe0f', '200d']);
$filename = implode('-', $codepoints);
} elseif ($this->config['style'] === 'twemoji') {
$chars = mb_str_split($match[0]);
$codepoints = array_map(static function (string $code): string {
return dechex(mb_ord($code));
}, $chars);
$codepoints[0] = ltrim($codepoints[0], '0');
$codepoints = !in_array('200d', $codepoints) ? array_diff($codepoints, ['fe0f']) : $codepoints;
$filename = implode('-', $codepoints);
} else {
/** shouldn't be here already */
return $match[0];
}
return '<img class="smilie smilie--emoji" loading="lazy"'
. ' alt="' . htmlspecialchars($match[0]) . '" title="' . htmlspecialchars($match[0]) . '"'
. ' src="' . htmlspecialchars($this->config['path'] . $filename) . '.png"'
. ' />';
}, $string);
}
when is the patch happening?I don't want to start editing code if a patch is incoming. Any idea if/when that might happen?
WIR (When it's ready)when is the patch happening?
Twemoji is affected for me tho.Came here to report the same thing, except for Twemoji.
It's not an "install"... .it's an edit of a coreCan you please tell me how to install this?
PHP
file that is related to the script. If you have nerve enough to manually edit the PHP files on untested code (by anyone other than the person posting it) then I think the file is /src/XF/Str/EmojiFormatter.php
at around line 29.Got it. Thank you so much!It's not an "install"... .it's an edit of a corePHP
file that is related to the script. If you have nerve enough to manually edit the PHP files on untested code (by anyone other than the person posting it) then I think the file is
/src/XF/Str/EmojiFormatter.php
at around line 29.
I've got a feeling it's already on the "to fix" list... it's just the impatient that have to have it now that the tweak of theCould you implement that in 2.2.13? That would be great.
PHP
file applies to. Me personally... I don't want to be warted by a warning on my ACP about files not matching. I can simply wait until the fix is pushed out.That's fine! For me it's more important what the frontend shows than the backend.Me personally... I don't want to be warted by a warning on my ACP about files not matching.
We use essential cookies to make this site work, and optional cookies to enhance your experience.