Fixed PHP Notice "Undefined index: enclosures" (and a possible one for 'tags')

This commit is contained in:
Jeffery To 2009-08-02 19:38:03 +08:00
parent b2d2b19d3a
commit 6c1bd67591
1 changed files with 2 additions and 2 deletions

View File

@ -479,12 +479,12 @@ class TwitterapiAction extends Action
$this->element('link', null, $entry['link']);
# RSS only supports 1 enclosure per item
if($entry['enclosures']){
if(array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])){
$enclosure = $entry['enclosures'][0];
$this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null);
}
if($entry['tags']){
if(array_key_exists('tags', $entry)){
foreach($entry['tags'] as $tag){
$this->element('category', null,$tag);
}