Include feeds in Link HTTP headers, for easier discovery
This commit is contained in:
parent
1d0a448e07
commit
128a00c4ab
@ -62,6 +62,11 @@ class Feed
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
function mimeType()
|
||||
{
|
||||
switch ($this->type) {
|
||||
|
@ -34,6 +34,18 @@ abstract class NoticestreamAction extends ProfileAction
|
||||
// pass by default
|
||||
}
|
||||
|
||||
public function extraHeaders()
|
||||
{
|
||||
parent::extraHeaders();
|
||||
foreach ($this->getFeeds() as $feed) {
|
||||
header('Link: <'.htmlspecialchars($feed->getUrl()).'>;' .
|
||||
' rel="'.htmlspecialchars($feed->rel()).'";' .
|
||||
' type="'.htmlspecialchars($feed->mimeType()).'"',
|
||||
false // don't overwrite previous headers of this sort
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// this fetches the NoticeStream
|
||||
abstract public function getStream();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user