diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-07-09 11:28:21 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-07-09 11:28:21 -0700 |
commit | db587562756483ec285b274adc073df29d4031ae (patch) | |
tree | e4ac812d424e223eb8ce25490262996ae7cb7d9a /lib/twitterapi.php | |
parent | c981f5bcec02295482153e45b0d57f37260706c0 (diff) | |
parent | 69574591d0ac429475b1099e8d9f3e46f7a004ea (diff) |
Merge branch 'candrews-review' into 0.8.x
* candrews-review:
Notice attachments are enclosures in feeds (Atom, RSS 1.0/RDF, and RSS 2.0).
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r-- | lib/twitterapi.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 40e5b5067..8f902cbca 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -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'); } |