summaryrefslogtreecommitdiff
path: root/lib/twitterapi.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-07-17 12:33:51 -0700
committerZach Copley <zach@controlyourself.ca>2009-08-08 00:57:41 +0000
commit348fa35c6b465b404f0bd056d0917c501a8145eb (patch)
tree7537e594afeea59827f16e5d970e08c31deecbf7 /lib/twitterapi.php
parent0cfdc2b91be69245a642f3f3e9effb4c00ed6c00 (diff)
Also show XML representation of attachments in the API
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r--lib/twitterapi.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 749083c7c..66664334c 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -369,6 +369,9 @@ class TwitterapiAction extends Action
case 'text':
$this->element($element, null, common_xml_safe_str($value));
break;
+ case 'attachments':
+ $this->show_xml_attachments($twitter_status['attachments']);
+ break;
default:
$this->element($element, null, $value);
}
@@ -389,6 +392,20 @@ class TwitterapiAction extends Action
$this->elementEnd($role);
}
+ function show_xml_attachments($attachments) {
+ if (!empty($attachments)) {
+ $this->elementStart('attachments', array('type' => 'array'));
+ foreach ($attachments as $attachment) {
+ $attrs = array();
+ $attrs['url'] = $attachment['url'];
+ $attrs['mimetype'] = $attachment['mimetype'];
+ $attrs['size'] = $attachment['size'];
+ $this->element('enclosure', $attrs, '');
+ }
+ $this->elementEnd('attachments');
+ }
+ }
+
function show_twitter_rss_item($entry)
{
$this->elementStart('item');