forked from GNUsocial/gnu-social
Notice attachments are enclosures in feeds (Atom, RSS 1.0/RDF, and RSS 2.0).
http://laconi.ca/trac/ticket/1690
This commit is contained in:
@@ -207,7 +207,6 @@ class TwitterapiAction extends Action
|
||||
|
||||
function twitter_rss_entry_array($notice)
|
||||
{
|
||||
|
||||
$profile = $notice->getProfile();
|
||||
$entry = array();
|
||||
|
||||
@@ -224,6 +223,19 @@ class TwitterapiAction extends Action
|
||||
$entry['updated'] = $entry['published'];
|
||||
$entry['author'] = $profile->getBestName();
|
||||
|
||||
# Enclosure
|
||||
$attachments = $notice->attachments();
|
||||
if($attachments){
|
||||
$entry['enclosures']=array();
|
||||
foreach($attachments as $attachment){
|
||||
$enclosure=array();
|
||||
$enclosure['url']=$attachment->url;
|
||||
$enclosure['mimetype']=$attachment->mimetype;
|
||||
$enclosure['size']=$attachment->size;
|
||||
$entry['enclosures'][]=$enclosure;
|
||||
}
|
||||
}
|
||||
|
||||
# RSS Item specific
|
||||
$entry['description'] = $entry['content'];
|
||||
$entry['pubDate'] = common_date_rfc2822($notice->created);
|
||||
@@ -378,6 +390,13 @@ class TwitterapiAction extends Action
|
||||
$this->element('pubDate', null, $entry['pubDate']);
|
||||
$this->element('guid', null, $entry['guid']);
|
||||
$this->element('link', null, $entry['link']);
|
||||
|
||||
# RSS only supports 1 enclosure per item
|
||||
if($entry['enclosures']){
|
||||
$enclosure = $entry['enclosures'][0];
|
||||
$this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
|
||||
}
|
||||
|
||||
$this->elementEnd('item');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user