Providing the uri-id to "convert" when possible

This commit is contained in:
Michael 2021-07-06 12:34:48 +00:00
parent 098cd543ea
commit 37a76e70ef
5 changed files with 9 additions and 9 deletions

View file

@ -131,7 +131,7 @@ class Status extends BaseDataTransferObject
$this->muted = $userAttributes->muted; $this->muted = $userAttributes->muted;
$this->bookmarked = $userAttributes->bookmarked; $this->bookmarked = $userAttributes->bookmarked;
$this->pinned = $userAttributes->pinned; $this->pinned = $userAttributes->pinned;
$this->content = BBCode::convert($item['raw-body'] ?? $item['body'], false, BBCode::API); $this->content = BBCode::convert($item['raw-body'] ?? $item['body'], false, BBCode::API, false, $item['uri-id']);
$this->reblog = $reblog; $this->reblog = $reblog;
$this->application = $application->toArray(); $this->application = $application->toArray();
$this->account = $account->toArray(); $this->account = $account->toArray();

View file

@ -1464,7 +1464,7 @@ class Transmitter
{ {
$event = []; $event = [];
$event['name'] = $item['event-summary']; $event['name'] = $item['event-summary'];
$event['content'] = BBCode::convert($item['event-desc'], false, BBCode::ACTIVITYPUB); $event['content'] = BBCode::convert($item['event-desc'], false, BBCode::ACTIVITYPUB, false, $item['uri-id']);
$event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM); $event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
if (!$item['event-nofinish']) { if (!$item['event-nofinish']) {
@ -1571,7 +1571,7 @@ class Transmitter
$regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism"; $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
$body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body); $body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
$data['content'] = BBCode::convert($body, false, BBCode::ACTIVITYPUB); $data['content'] = BBCode::convert($body, false, BBCode::ACTIVITYPUB, false, $item['uri-id']);
} }
// The regular "content" field does contain a minimized HTML. This is done since systems like // The regular "content" field does contain a minimized HTML. This is done since systems like
@ -1583,7 +1583,7 @@ class Transmitter
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']); $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
$richbody = BBCode::removeAttachment($richbody); $richbody = BBCode::removeAttachment($richbody);
$data['contentMap'][$language] = BBCode::convert($richbody, false, BBCode::EXTERNAL); $data['contentMap'][$language] = BBCode::convert($richbody, false, BBCode::EXTERNAL, false, $item['uri-id']);
} }
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"]; $data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];

View file

@ -918,7 +918,7 @@ class DFRN
$htmlbody = "[b]" . $item['title'] . "[/b]\n\n" . $htmlbody; $htmlbody = "[b]" . $item['title'] . "[/b]\n\n" . $htmlbody;
} }
$htmlbody = BBCode::convert($htmlbody, false, BBCode::OSTATUS); $htmlbody = BBCode::convert($htmlbody, false, BBCode::OSTATUS, false, $item['uri-id']);
} }
$author = self::addEntryAuthor($doc, "author", $item["author-link"], $item); $author = self::addEntryAuthor($doc, "author", $item["author-link"], $item);

View file

@ -1109,7 +1109,7 @@ class Feed
$body = OStatus::formatPicturePost($item['body'], $item['uri-id']); $body = OStatus::formatPicturePost($item['body'], $item['uri-id']);
$body = BBCode::convert($body, false, BBCode::OSTATUS); $body = BBCode::convert($body, false, BBCode::OSTATUS, false, $item['uri-id']);
XML::addElement($doc, $entry, "content", $body, ["type" => "html"]); XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);
@ -1186,7 +1186,7 @@ class Feed
private static function getTitle(array $item) private static function getTitle(array $item)
{ {
if ($item['title'] != '') { if ($item['title'] != '') {
return BBCode::convert($item['title'], false, BBCode::OSTATUS); return BBCode::convert($item['title'], false, BBCode::OSTATUS, false, $item['uri-id']);
} }
// Fetch information about the post // Fetch information about the post

View file

@ -1803,7 +1803,7 @@ class OStatus
if (!$toplevel) { if (!$toplevel) {
if (!empty($item['title'])) { if (!empty($item['title'])) {
$title = BBCode::convert($item['title'], false, BBCode::OSTATUS); $title = BBCode::convert($item['title'], false, BBCode::OSTATUS, false, $item['uri-id']);
} else { } else {
$title = sprintf("New note by %s", $owner["nick"]); $title = sprintf("New note by %s", $owner["nick"]);
} }
@ -1892,7 +1892,7 @@ class OStatus
$body = "[b]".$item['title']."[/b]\n\n".$body; $body = "[b]".$item['title']."[/b]\n\n".$body;
} }
$body = BBCode::convert($body, false, BBCode::OSTATUS); $body = BBCode::convert($body, false, BBCode::OSTATUS, false, $item['uri-id']);
XML::addElement($doc, $entry, "content", $body, ["type" => "html"]); XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);