$text = str_replace(["\r","\n"], ['<br />', '<br />'], $text);
// Remove all hashtag addresses
- if ((!$try_oembed || $simple_html) && !in_array($simple_html, [3, 7, 9])) {
+ if ($simple_html && !in_array($simple_html, [3, 7, 9])) {
$text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text);
} elseif ($simple_html == 3) {
// The ! is converted to @ since Diaspora only understands the @
$data['content'] = BBCode::convert($body, false, 9);
}
- $data['contentMap']['text/html'] = BBCode::convert($item['body'], false);
+ $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
+ $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
+
+ $data['contentMap']['text/html'] = BBCode::convert($richbody, false);
$data['contentMap']['text/markdown'] = BBCode::toMarkdown($item["body"]);
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];