}
/**
- * Return array with details for categories and folders for an item
+ * Lists categories and folders for an item
*
* @param array $item
* @param int $uid
- * @return [array, array]
- *
+ * @return array
* [
- * [ // categories array
- * {
- * 'name': 'category name',
- * 'removeurl': 'url to remove this category',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ],
- * [ //folders array
- * {
- * 'name': 'folder name',
- * 'removeurl': 'url to remove this folder',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ]
- * ]
+ * [ // categories array
+ * {
+ * 'name': 'category name',
+ * 'removeurl': 'url to remove this category',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * },
+ * ...
+ * ],
+ * [ //folders array
+ * {
+ * 'name': 'folder name',
+ * 'removeurl': 'url to remove this folder',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * } ,
+ * ...
+ * ]
+ * ]
+ *
+ * @throws \Exception
*/
public function determineCategoriesTerms(array $item, int $uid = 0): array
{
return [$categories, $folders];
}
- foreach (Post\Category::getArrayByURIId($item['uri-id'], $uid, Post\Category::CATEGORY) as $savedFolderName) {
+ foreach (Post\Category::getArrayByURIId($item['uri-id'], $uid) as $savedFolderName) {
if (!empty($item['author-link'])) {
- $url = $item['author-link'] . "?category=" . rawurlencode($savedFolderName);
+ $url = $item['author-link'] . '/conversations?category=' . rawurlencode($savedFolderName);
} else {
$url = '#';
}
} else {
$post_type = $this->l10n->t('status');
}
- // Let's break everthing ... ;-)
+ // Let's break everything ... ;-)
break;
}
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
'url' => $item['author-link'],
];
$profile_link = Contact::magicLinkByContact($author, $item['author-link']);
- $sparkle = (strpos($profile_link, 'contact/redir/') === 0);
+ if (strpos($profile_link, 'contact/redir/') === 0) {
+ $status_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/status']);
+ $photos_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/photos']);
+ $profile_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/profile']);
+ }
$cid = 0;
$pcid = $item['author-id'];
$rel = $contact['rel'];
}
- if ($sparkle) {
- $status_link = $profile_link . '/status';
- $photos_link = $profile_link . '/photos';
- $profile_link = $profile_link . '/profile';
- }
-
if (!empty($pcid)) {
$contact_url = 'contact/' . $pcid;
$posts_link = $contact_url . '/posts';
// If it is a reshared post then reformat it to avoid display problems with two share elements
if (!empty($shared)) {
- if (!empty($shared['guid']) && ($encaspulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
+ if (!empty($shared['guid']) && ($encapsulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
if (!empty(BBCode::fetchShareAttributes($item['body']))) {
- $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encaspulated_share, $item['body']);
+ $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encapsulated_share, $item['body']);
} else {
- $item['body'] .= $encaspulated_share;
+ $item['body'] .= $encapsulated_share;
}
}
$item['body'] = HTML::toBBCode(BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::ACTIVITYPUB));