Add Feed module
- Update profile alternate links
This commit is contained in:
parent
c2e29f2685
commit
fec3aaf9b2
2 changed files with 56 additions and 1 deletions
|
@ -64,7 +64,9 @@ function profile_init(App $a)
|
|||
}
|
||||
|
||||
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which . '" />' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
|
||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
|
||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||
|
|
53
src/Module/Feed.php
Normal file
53
src/Module/Feed.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
||||
/**
|
||||
* Provides public Atom feeds
|
||||
*
|
||||
* Currently supported:
|
||||
* - /feed/[nickname]/ => posts
|
||||
* - /feed/[nickname]/posts => posts
|
||||
* - /feed/[nickname]/comments => comments
|
||||
* - /feed/[nickname]/replies => comments
|
||||
* - /feed/[nickname]/activity => activity
|
||||
*
|
||||
* @brief Provides public Atom feeds
|
||||
*
|
||||
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
||||
*/
|
||||
class Feed extends BaseModule
|
||||
{
|
||||
public static function content()
|
||||
{
|
||||
$a = self::getApp();
|
||||
|
||||
$last_update = x($_GET, 'last_update') ? $_GET['last_update'] : '';
|
||||
$nocache = x($_GET, 'nocache') && local_user();
|
||||
|
||||
$type = null;
|
||||
if ($a->argc > 2) {
|
||||
$type = $a->argv[2];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'posts':
|
||||
case 'comments':
|
||||
case 'activity':
|
||||
break;
|
||||
case 'replies':
|
||||
$type = 'comments';
|
||||
break;
|
||||
default:
|
||||
$type = 'posts';
|
||||
}
|
||||
|
||||
$nickname = $a->argv[1];
|
||||
header("Content-type: application/atom+xml");
|
||||
echo OStatus::feed($nickname, $last_update, 10, $type, $nocache);
|
||||
killme();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue