From 37a76e70efe66d3181747947b0355ce934cf27d6 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 6 Jul 2021 12:34:48 +0000 Subject: [PATCH] Providing the uri-id to "convert" when possible --- src/Object/Api/Mastodon/Status.php | 2 +- src/Protocol/ActivityPub/Transmitter.php | 6 +++--- src/Protocol/DFRN.php | 2 +- src/Protocol/Feed.php | 4 ++-- src/Protocol/OStatus.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index 0985c0002..f476710d4 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -131,7 +131,7 @@ class Status extends BaseDataTransferObject $this->muted = $userAttributes->muted; $this->bookmarked = $userAttributes->bookmarked; $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->application = $application->toArray(); $this->account = $account->toArray(); diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 0eac87f6a..652e76529 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1464,7 +1464,7 @@ class Transmitter { $event = []; $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); if (!$item['event-nofinish']) { @@ -1571,7 +1571,7 @@ class Transmitter $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism"; $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 @@ -1583,7 +1583,7 @@ class Transmitter $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']); $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"]; diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 797a3973b..9ac40c0a2 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -918,7 +918,7 @@ class DFRN $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); diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index f137bd234..bed67faac 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -1109,7 +1109,7 @@ class Feed $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"]); @@ -1186,7 +1186,7 @@ class Feed private static function getTitle(array $item) { 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 diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 869213ade..6318f0940 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1803,7 +1803,7 @@ class OStatus if (!$toplevel) { 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 { $title = sprintf("New note by %s", $owner["nick"]); } @@ -1892,7 +1892,7 @@ class OStatus $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"]);