X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FOStatus.php;h=45000d77005e8b8bd6801a80809aab28d52d0182;hb=6733b77b738b64b1d7b96c0bacd4a0fdb3dcbde2;hp=5f5066d75c3bc7489151a6fe9aea091796c14163;hpb=dd65c5d150d0732b8b8c7a773665e73946d37a3a;p=friendica.git diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 5f5066d75c..45000d7700 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -634,15 +634,15 @@ class OStatus if ($categories) { foreach ($categories as $category) { foreach ($category->attributes as $attributes) { - if ($attributes->name == "term") { + if ($attributes->name == 'term') { $term = $attributes->textContent; - if (!empty($item["tag"])) { - $item["tag"] .= ','; + if (!empty($item['tag'])) { + $item['tag'] .= ','; } else { - $item["tag"] = ''; + $item['tag'] = ''; } - $item["tag"] .= "#[url=".System::baseUrl()."/search?tag=".$term."]".$term."[/url]"; + $item['tag'] .= '#[url=' . System::baseUrl() . '/search?tag=' . $term . ']' . $term . '[/url]'; } } } @@ -1263,10 +1263,11 @@ class OStatus * @param object $doc XML document * @param array $owner Contact data of the poster * @param string $filter The related feed filter (activity, posts or comments) + * @param bool $feed_mode Behave like a regular feed for users if true * * @return object header root element */ - private static function addHeader(DOMDocument $doc, array $owner, $filter) + private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false) { $a = get_app(); @@ -1283,10 +1284,23 @@ class OStatus $root->setAttribute("xmlns:mastodon", NAMESPACE_MASTODON); $title = ''; + $selfUri = '/feed/' . $owner["nick"] . '/'; switch ($filter) { - case 'activity': $title = L10n::t('%s\'s timeline', $owner['name']); break; - case 'posts' : $title = L10n::t('%s\'s posts' , $owner['name']); break; - case 'comments': $title = L10n::t('%s\'s comments', $owner['name']); break; + case 'activity': + $title = L10n::t('%s\'s timeline', $owner['name']); + $selfUri .= $filter; + break; + case 'posts': + $title = L10n::t('%s\'s posts', $owner['name']); + break; + case 'comments': + $title = L10n::t('%s\'s comments', $owner['name']); + $selfUri .= $filter; + break; + } + + if (!$feed_mode) { + $selfUri = "/dfrn_poll/" . $owner["nick"]; } $attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION]; @@ -1320,8 +1334,7 @@ class OStatus $attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"]; XML::addElement($doc, $root, "link", "", $attributes); - $attributes = ["href" => System::baseUrl() . "/dfrn_poll/" . $owner["nick"], - "rel" => "self", "type" => "application/atom+xml"]; + $attributes = ["href" => System::baseUrl() . $selfUri, "rel" => "self", "type" => "application/atom+xml"]; XML::addElement($doc, $root, "link", "", $attributes); if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) { @@ -2206,7 +2219,7 @@ class OStatus $doc = new DOMDocument('1.0', 'utf-8'); $doc->formatOutput = true; - $root = self::addHeader($doc, $owner, $filter); + $root = self::addHeader($doc, $owner, $filter, $feed_mode); foreach ($items as $item) { if (Config::get('system', 'ostatus_debug')) {