summaryrefslogtreecommitdiff
path: root/lib/twitterapi.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-07-17 12:39:54 -0700
committerZach Copley <zach@controlyourself.ca>2009-08-08 00:57:49 +0000
commit9ec022df93a41c33c15ed0b2b3592f3faff40414 (patch)
tree53d4f160e43330057b302b524f7e4cb39a786517 /lib/twitterapi.php
parent348fa35c6b465b404f0bd056d0917c501a8145eb (diff)
Only populate attachments array element if there are attachments
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;
}
}
}