From 4d359b7de1f5ee3522ed0e5cff037b88f0ed6a4f Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 May 2022 07:57:52 +0000 Subject: [PATCH] Move the plink functionality to the right function --- src/Content/Item.php | 18 +----------------- src/Model/Item.php | 6 ++++++ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/Content/Item.php b/src/Content/Item.php index 9136396ed..d36112865 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -355,23 +355,7 @@ class Item $item['body'] = $this->l10n->t('%1$s tagged %2$s\'s %3$s with %4$s', $author, $objauthor, $plink, $tag); } } -/* - $matches = null; - if (preg_match_all('/@\[url=(.*?)\]/is', $item['body'], $matches, PREG_SET_ORDER)) { - foreach ($matches as $mtch) { - if (!strpos($mtch[1], 'zrl=')) { - $item['body'] = str_replace($mtch[0], '@[url=' . Contact::magicLink($mtch[1]) . ']', $item['body']); - } - } - } -*/ - // add sparkle links to appropriate permalinks - // Only create a redirection to a magic link when logged in - if (!empty($item['plink']) && Session::isAuthenticated() && $item['private'] == ModelItem::PRIVATE) { - $author = ['uid' => 0, 'id' => $item['author-id'], - 'network' => $item['author-network'], 'url' => $item['author-link']]; - $item['plink'] = Contact::magicLinkByContact($author, $item['plink']); - } + $this->profiler->stopRecording(); } diff --git a/src/Model/Item.php b/src/Model/Item.php index d57700c33..496757910 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3200,6 +3200,12 @@ class Item 'orig_title' => DI::l10n()->t('View on separate page'), ]; + if (!empty($plink) && ($item['private'] == self::PRIVATE)) { + $author = ['uid' => 0, 'id' => $item['author-id'], + 'network' => $item['author-network'], 'url' => $item['author-link']]; + $plink = Contact::magicLinkByContact($author, $plink); + } + if (!empty($plink)) { $ret['href'] = DI::baseUrl()->remove($plink); $ret['title'] = DI::l10n()->t('Link to source');