const VERSION = '2021-05-01';
const INTERNAL = 0;
+ const EXTERNAL = 1;
const API = 2;
const DIASPORA = 3;
const CONNECTORS = 4;
// Handle attached links or videos
if ($simple_html == self::ACTIVITYPUB) {
$text = self::removeAttachment($text);
- } elseif (!in_array($simple_html, [self::INTERNAL, self::CONNECTORS])) {
+ } elseif (!in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::CONNECTORS])) {
$text = self::removeAttachment($text, true);
} else {
$text = self::convertAttachment($text, $simple_html, $try_oembed);
$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);
+ if (!$nosmile) {
+ $text = self::performWithEscapedTags($text, ['img'], function ($text) use ($simple_html, $for_plaintext) {
+ return Smilies::replace($text, ($simple_html != self::INTERNAL) || $for_plaintext);
});
}
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
$richbody = BBCode::removeAttachment($richbody);
- $data['contentMap'][$language] = BBCode::convert($richbody, false);
+ $data['contentMap'][$language] = BBCode::convert($richbody, false, BBCode::EXTERNAL);
}
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];