Merge pull request #9725 from MrPetovan/bug/smilies-image-description
Prevent alt text of emoji image tags to be converted to smilies in BBCode::convert
This commit is contained in:
commit
656ba2a63e
1 changed files with 10 additions and 12 deletions
|
@ -1393,6 +1393,16 @@ class BBCode
|
||||||
$text = self::convertAttachment($text, $simple_html, $try_oembed);
|
$text = self::convertAttachment($text, $simple_html, $try_oembed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$nosmile = strpos($text, '[nosmile]') !== false;
|
||||||
|
$text = str_replace('[nosmile]', '', $text);
|
||||||
|
|
||||||
|
// Replace non graphical smilies for external posts
|
||||||
|
if (!$nosmile && !$for_plaintext) {
|
||||||
|
$text = self::performWithEscapedTags($text, ['img'], function ($text) {
|
||||||
|
return Smilies::replace($text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// leave open the posibility of [map=something]
|
// leave open the posibility of [map=something]
|
||||||
// this is replaced in Item::prepareBody() which has knowledge of the item location
|
// this is replaced in Item::prepareBody() which has knowledge of the item location
|
||||||
if (strpos($text, '[/map]') !== false) {
|
if (strpos($text, '[/map]') !== false) {
|
||||||
|
@ -1506,11 +1516,6 @@ class BBCode
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is actually executed in Item::prepareBody()
|
|
||||||
|
|
||||||
$nosmile = strpos($text, '[nosmile]') !== false;
|
|
||||||
$text = str_replace('[nosmile]', '', $text);
|
|
||||||
|
|
||||||
// Check for font change text
|
// Check for font change text
|
||||||
$text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $text);
|
$text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $text);
|
||||||
|
|
||||||
|
@ -1683,13 +1688,6 @@ class BBCode
|
||||||
$text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism", '', $text);
|
$text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism", '', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace non graphical smilies for external posts
|
|
||||||
if (!$nosmile && !$for_plaintext) {
|
|
||||||
$text = self::performWithEscapedTags($text, ['img'], function ($text) {
|
|
||||||
return Smilies::replace($text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$for_plaintext && DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA)) {
|
if (!$for_plaintext && DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA)) {
|
||||||
$conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $text));
|
$conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $text));
|
||||||
// Emojis are always 4 byte Unicode characters
|
// Emojis are always 4 byte Unicode characters
|
||||||
|
|
Loading…
Reference in a new issue