]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added attachment information to the json responses
authorCraig Andrews <candrews@integralblue.com>
Wed, 15 Jul 2009 14:37:50 +0000 (10:37 -0400)
committerCraig Andrews <candrews@integralblue.com>
Wed, 15 Jul 2009 14:37:50 +0000 (10:37 -0400)
lib/twitterapi.php

index 655b6c77786fff82a7432fa5f3c5f8ad26852a46..749083c7c560399ffee07034bac1942f99ed15bf 100644 (file)
@@ -186,6 +186,21 @@ class TwitterapiAction extends Action
             $twitter_status['favorited'] = false;
         }
 
+        # Enclosures
+        $attachments = $notice->attachments();
+        $twitter_status['attachments']=array();
+        if($attachments){
+            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) {
             # Don't get notice (recursive!)
             $twitter_user = $this->twitter_user_array($profile, false);