summaryrefslogtreecommitdiff
path: root/lib/twitterapi.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r--lib/twitterapi.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 66664334c..ab6c0d62c 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -188,15 +188,18 @@ class TwitterapiAction extends Action
# Enclosures
$attachments = $notice->attachments();
- $twitter_status['attachments']=array();
- if($attachments){
- foreach($attachments as $attachment){
+
+ if (!empty($attachments)) {
+
+ $twitter_status['attachments'] = array();
+
+ foreach ($attachments as $attachment) {
if ($attachment->isEnclosure()) {
- $enclosure=array();
- $enclosure['url']=$attachment->url;
- $enclosure['mimetype']=$attachment->mimetype;
- $enclosure['size']=$attachment->size;
- $twitter_status['attachments'][]=$enclosure;
+ $enclosure = array();
+ $enclosure['url'] = $attachment->url;
+ $enclosure['mimetype'] = $attachment->mimetype;
+ $enclosure['size'] = $attachment->size;
+ $twitter_status['attachments'][] = $enclosure;
}
}
}