summaryrefslogtreecommitdiff
path: root/lib/apiaction.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-06-11 12:05:53 -0700
committerBrion Vibber <brion@pobox.com>2010-06-11 12:05:53 -0700
commit7f3b3620af2af88ced37da1d9f8913cfd1a31b90 (patch)
tree13f137c377c3dfebbb2e749866e958ede08c2d24 /lib/apiaction.php
parente81f17e911f59c5ba68fddefd318ea6caf25924c (diff)
parent47665e845ae74e6ee5b9a39565fb45dd9a93f921 (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/apiaction.php')
-rw-r--r--lib/apiaction.php42
1 files changed, 32 insertions, 10 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 7085c096b..27df55892 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -295,6 +295,10 @@ class ApiAction extends Action
}
}
+ // StatusNet-specific
+
+ $twitter_user['statusnet:profile_url'] = $profile->profileurl;
+
return $twitter_user;
}
@@ -396,6 +400,10 @@ class ApiAction extends Action
$twitter_status['user'] = $twitter_user;
}
+ // StatusNet-specific
+
+ $twitter_status['statusnet:html'] = $notice->rendered;
+
return $twitter_status;
}
@@ -563,9 +571,13 @@ class ApiAction extends Action
}
}
- function showTwitterXmlStatus($twitter_status, $tag='status')
+ function showTwitterXmlStatus($twitter_status, $tag='status', $namespaces=false)
{
- $this->elementStart($tag);
+ $attrs = array();
+ if ($namespaces) {
+ $attrs['xmlns:statusnet'] = 'http://status.net/schema/api/1/';
+ }
+ $this->elementStart($tag, $attrs);
foreach($twitter_status as $element => $value) {
switch ($element) {
case 'user':
@@ -599,9 +611,13 @@ class ApiAction extends Action
$this->elementEnd('group');
}
- function showTwitterXmlUser($twitter_user, $role='user')
+ function showTwitterXmlUser($twitter_user, $role='user', $namespaces=false)
{
- $this->elementStart($role);
+ $attrs = array();
+ if ($namespaces) {
+ $attrs['xmlns:statusnet'] = 'http://status.net/schema/api/1/';
+ }
+ $this->elementStart($role, $attrs);
foreach($twitter_user as $element => $value) {
if ($element == 'status') {
$this->showTwitterXmlStatus($twitter_user['status']);
@@ -683,7 +699,7 @@ class ApiAction extends Action
{
$this->initDocument('xml');
$twitter_status = $this->twitterStatusArray($notice);
- $this->showTwitterXmlStatus($twitter_status);
+ $this->showTwitterXmlStatus($twitter_status, 'status', true);
$this->endDocument('xml');
}
@@ -699,7 +715,8 @@ class ApiAction extends Action
{
$this->initDocument('xml');
- $this->elementStart('statuses', array('type' => 'array'));
+ $this->elementStart('statuses', array('type' => 'array',
+ 'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
if (is_array($notice)) {
foreach ($notice as $n) {
@@ -866,9 +883,13 @@ class ApiAction extends Action
$this->elementEnd('entry');
}
- function showXmlDirectMessage($dm)
+ function showXmlDirectMessage($dm, $namespaces=false)
{
- $this->elementStart('direct_message');
+ $attrs = array();
+ if ($namespaces) {
+ $attrs['xmlns:statusnet'] = 'http://status.net/schema/api/1/';
+ }
+ $this->elementStart('direct_message', $attrs);
foreach($dm as $element => $value) {
switch ($element) {
case 'sender':
@@ -945,7 +966,7 @@ class ApiAction extends Action
{
$this->initDocument('xml');
$dmsg = $this->directMessageArray($message);
- $this->showXmlDirectMessage($dmsg);
+ $this->showXmlDirectMessage($dmsg, true);
$this->endDocument('xml');
}
@@ -1062,7 +1083,8 @@ class ApiAction extends Action
{
$this->initDocument('xml');
- $this->elementStart('users', array('type' => 'array'));
+ $this->elementStart('users', array('type' => 'array',
+ 'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
if (is_array($user)) {
foreach ($user as $u) {