Limit smilies replacement to BBCode::convert

This commit is contained in:
Hypolite Petovan 2019-06-20 15:00:33 -04:00
parent 5e4ace271b
commit 9545ff614b
3 changed files with 6 additions and 9 deletions

View file

@ -143,13 +143,9 @@ function redir_private_images($a, &$item)
* @return string Formattet HTML. * @return string Formattet HTML.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
function prepare_text($text) { function prepare_text($text)
if (stristr($text, '[nosmile]')) { {
$s = BBCode::convert($text); $s = BBCode::convert($text);
} else {
$s = Smilies::replace(BBCode::convert($text));
}
return trim($s); return trim($s);
} }

View file

@ -384,7 +384,7 @@ function message_content(App $a)
$from_name_e = $message['from-name']; $from_name_e = $message['from-name'];
$subject_e = $message['title']; $subject_e = $message['title'];
$body_e = Smilies::replace(BBCode::convert($message['body'])); $body_e = BBCode::convert($message['body']);
$to_name_e = $message['name']; $to_name_e = $message['name'];
$contact = Contact::getDetailsByURL($message['from-url']); $contact = Contact::getDetailsByURL($message['from-url']);

View file

@ -1395,6 +1395,7 @@ class BBCode extends BaseObject
// This is actually executed in Item::prepareBody() // This is actually executed in Item::prepareBody()
$nosmile = strpos($text, '[nosmile]') !== false;
$text = str_replace('[nosmile]', '', $text); $text = str_replace('[nosmile]', '', $text);
// Check for font change text // Check for font change text
@ -1572,7 +1573,7 @@ class BBCode extends BaseObject
} }
// Replace non graphical smilies for external posts // Replace non graphical smilies for external posts
if ($simple_html) { if (!$nosmile && !$for_plaintext) {
$text = Smilies::replace($text); $text = Smilies::replace($text);
} }