From d029c223252923bd346dbb2ca6f65ee24e9e4dde Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 10 Mar 2024 06:17:18 +0000 Subject: [PATCH] Tumblr: Handle quote shares --- tumblr/tumblr.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 12e9e5e0..78e415ee 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -677,11 +677,20 @@ function tumblr_send_npf(array $post): bool return true; } - $post['body'] = Post\Media::addAttachmentsToBody($post['uri-id'], $post['body']); + $post['body'] = Post\Media::addAttachmentsToBody($post['uri-id'], $post['body'], [Post\Media::IMAGE, Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::ACTIVITY]); if (!empty($post['title'])) { $post['body'] = '[h1]' . $post['title'] . "[/h1]\n" . $post['body']; } + if (!empty($post['quote-uri-id'])) { + $quote = Post::selectFirstPost(['uri', 'plink'], ['uri-id' => $post['quote-uri-id']]); + if (!empty($quote)) { + if ((strpos($post['body'], $quote['plink'] ?: $quote['uri']) === false) && (strpos($post['body'], $quote['uri']) === false)) { + $post['body'] .= "\n[url]" . ($quote['plink'] ?: $quote['uri']) . "[/url]\n"; + } + } + } + $params = [ 'content' => NPF::fromBBCode($post['body'], $post['uri-id']), 'state' => 'published',