forked from GNUsocial/gnu-social
Only populate attachments array element if there are attachments
This commit is contained in:
parent
348fa35c6b
commit
9ec022df93
@ -188,15 +188,18 @@ class TwitterapiAction extends Action
|
|||||||
|
|
||||||
# Enclosures
|
# Enclosures
|
||||||
$attachments = $notice->attachments();
|
$attachments = $notice->attachments();
|
||||||
$twitter_status['attachments']=array();
|
|
||||||
if($attachments){
|
if (!empty($attachments)) {
|
||||||
foreach($attachments as $attachment){
|
|
||||||
|
$twitter_status['attachments'] = array();
|
||||||
|
|
||||||
|
foreach ($attachments as $attachment) {
|
||||||
if ($attachment->isEnclosure()) {
|
if ($attachment->isEnclosure()) {
|
||||||
$enclosure=array();
|
$enclosure = array();
|
||||||
$enclosure['url']=$attachment->url;
|
$enclosure['url'] = $attachment->url;
|
||||||
$enclosure['mimetype']=$attachment->mimetype;
|
$enclosure['mimetype'] = $attachment->mimetype;
|
||||||
$enclosure['size']=$attachment->size;
|
$enclosure['size'] = $attachment->size;
|
||||||
$twitter_status['attachments'][]=$enclosure;
|
$twitter_status['attachments'][] = $enclosure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user