]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/twitterapi.php
Merge branch 'master' into 0.8.x
[quix0rs-gnu-social.git] / lib / twitterapi.php
index a5dc2067f85ffb389471fdb799254526cfe917af..58300720865ced1b66ee77f2795a3f6c449ea862 100644 (file)
@@ -188,20 +188,20 @@ class TwitterapiAction extends Action
 
         // Enclosures
         $attachments = $notice->attachments();
-        $enclosures = array();
 
-        foreach ($attachments as $attachment) {
-            if ($attachment->isEnclosure()) {
-                 $enclosure = array();
-                 $enclosure['url'] = $attachment->url;
-                 $enclosure['mimetype'] = $attachment->mimetype;
-                 $enclosure['size'] = $attachment->size;
-                 $enclosures[] = $enclosure;
-            }
-        }
+        if (!empty($attachments)) {
 
-        if (!empty($enclosures)) {
-            $twitter_status['attachments'] = $enclosures;
+            $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;
+                }
+            }
         }
 
         if ($include_user) {