}
$return = '';
- if ($simplehtml == 7) {
+ if (in_array($simplehtml, [7, 9])) {
$return = self::convertUrlForOStatus($data["url"]);
} elseif (($simplehtml != 4) && ($simplehtml != 0)) {
$return = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
$text = ($is_quote_share? '<br />' : '') . '<p>' . html_entity_decode('♲ ', ENT_QUOTES, 'UTF-8') . ' ' . $author_contact['addr'] . ': </p>' . "\n" . $content;
break;
case 7: // statusnet/GNU Social
+ case 9:
$text = ($is_quote_share? '<br />' : '') . '<p>' . html_entity_decode('♲ ', ENT_QUOTES, 'UTF-8') . ' @' . $author_contact['addr'] . ': ' . $content . '</p>' . "\n";
break;
- case 9: // Google+
- $text = ($is_quote_share? '<br />' : '') . '<p>' . html_entity_decode('♲ ', ENT_QUOTES, 'UTF-8') . ' ' . $author_contact['addr'] . ': </p>' . "\n";
- $text .= '<p>' . $content . '</p>' . "\n";
-
- if ($attributes['link'] != '') {
- $text .= '<p>' . $attributes['link'] . '</p>';
- }
- break;
default:
// Transforms quoted tweets in rich attachments to avoid nested tweets
if (stripos(Strings::normaliseLink($attributes['link']), 'http://twitter.com/') === 0 && OEmbed::isAllowedURL($attributes['link'])) {
* Simple HTML values meaning:
* - 0: Friendica display
* - 1: Unused
- * - 2: Used for Google+, Windows Phone push, Friendica API
+ * - 2: Used for Windows Phone push, Friendica API
* - 3: Used before converting to Markdown in bb2diaspora.php
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
* - 5: Unused
* - 6: Unused
* - 7: Used for dfrn, OStatus
* - 8: Used for WP backlink text setting
+ * - 9: ActivityPub
*
* @param string $text
* @param bool $try_oembed
// if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text
if (!$for_plaintext) {
$text = preg_replace(Strings::autoLinkRegEx(), '[url]$1[/url]', $text);
- if ($simple_html == 7) {
+ if (in_array($simple_html, [7, 9])) {
$text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
$text = preg_replace_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
}
$text = str_replace(["\r","\n"], ['<br />', '<br />'], $text);
// Remove all hashtag addresses
- if ((!$try_oembed || $simple_html) && !in_array($simple_html, [3, 7])) {
+ if ((!$try_oembed || $simple_html) && !in_array($simple_html, [3, 7, 9])) {
$text = preg_replace("/([#@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $text);
} elseif ($simple_html == 3) {
// The ! is converted to @ since Diaspora only understands the @
$text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
'@<a href="$2">$3</a>',
$text);
- } elseif ($simple_html == 7) {
+ } elseif (in_array($simple_html, [7, 9])) {
$text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
'$1<span class="vcard"><a href="$2" class="url u-url mention" title="$3"><span class="fn nickname mention">$3</span></a></span>',
$text);
$text = preg_replace("/#\[url\=[$URLSearchString]*\]\^\[\/url\]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/i",
"[bookmark=$1]$2[/bookmark]", $text);
- if (in_array($simple_html, [2, 6, 7, 8, 9])) {
+ if (in_array($simple_html, [2, 6, 7, 8])) {
$text = preg_replace_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", "self::expandLinksCallback", $text);
//$Text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $Text);
$text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", ' $2 [url]$1[/url]',$text);
{
$event = [];
$event['name'] = $item['event-summary'];
- $event['content'] = BBCode::convert($item['event-desc'], false, 7);
+ $event['content'] = BBCode::convert($item['event-desc'], false, 9);
$event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
if (!$item['event-nofinish']) {
$regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
$body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
- $data['content'] = BBCode::convert($body, false, 7);
+ $data['content'] = BBCode::convert($body, false, 9);
}
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];