Copy isset($attachment->filename) fix from RSS 1.0 to RSS 2.0 and Atom 1.0 feeds.

This commit is contained in:
Toby Inkster 2009-07-13 16:56:52 +01:00
parent ae2bc6a850
commit 38784141d1
2 changed files with 13 additions and 9 deletions

View File

@ -1170,11 +1170,13 @@ class Notice extends Memcached_DataObject
$attachments = $this->attachments(); $attachments = $this->attachments();
if($attachments){ if($attachments){
foreach($attachments as $attachment){ foreach($attachments as $attachment){
$attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size); if (isset($attachment->filename)) {
if($attachment->title){ $attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size);
$attributes['title']=$attachment->title; if($attachment->title){
$attributes['title']=$attachment->title;
}
$xs->element('link', $attributes, null);
} }
$xs->element('link', $attributes, null);
} }
} }

View File

@ -218,11 +218,13 @@ class TwitterapiAction extends Action
if($attachments){ if($attachments){
$entry['enclosures']=array(); $entry['enclosures']=array();
foreach($attachments as $attachment){ foreach($attachments as $attachment){
$enclosure=array(); if (isset($attachment->filename)) {
$enclosure['url']=$attachment->url; $enclosure=array();
$enclosure['mimetype']=$attachment->mimetype; $enclosure['url']=$attachment->url;
$enclosure['size']=$attachment->size; $enclosure['mimetype']=$attachment->mimetype;
$entry['enclosures'][]=$enclosure; $enclosure['size']=$attachment->size;
$entry['enclosures'][]=$enclosure;
}
} }
} }