1
0
Fork 0

Move the plink functionality to the right function

This commit is contained in:
Michael 2022-05-05 07:57:52 +00:00
parent d34432c517
commit 4d359b7de1
2 changed files with 7 additions and 17 deletions

View file

@ -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); $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(); $this->profiler->stopRecording();
} }

View file

@ -3200,6 +3200,12 @@ class Item
'orig_title' => DI::l10n()->t('View on separate page'), '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)) { if (!empty($plink)) {
$ret['href'] = DI::baseUrl()->remove($plink); $ret['href'] = DI::baseUrl()->remove($plink);
$ret['title'] = DI::l10n()->t('Link to source'); $ret['title'] = DI::l10n()->t('Link to source');