summaryrefslogtreecommitdiff
path: root/lib/apiaction.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-19 10:59:14 -0700
committerBrion Vibber <brion@pobox.com>2010-05-19 10:59:14 -0700
commita39a934dd4a133bad6e76fa9a5018cedcb70225c (patch)
treef82b4248da5447780df322c35ca041956bcd887e /lib/apiaction.php
parentd0ba34e0f32ac71b552302ec875943e0e9236720 (diff)
parent74a89b1fc37067d91d31bd66922053361eb4e616 (diff)
Merge branch 'master' of gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'lib/apiaction.php')
-rw-r--r--lib/apiaction.php55
1 files changed, 17 insertions, 38 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php
index f87b04611..68198effc 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -260,7 +260,23 @@ class ApiAction extends Action
$twitter_status['created_at'] = $this->dateTwitter($notice->created);
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
intval($notice->reply_to) : null;
- $twitter_status['source'] = $this->sourceLink($notice->source);
+
+ $source = null;
+
+ $ns = $notice->getSource();
+ if ($ns) {
+ if (!empty($ns->name) && !empty($ns->url)) {
+ $source = '<a href="'
+ . htmlspecialchars($ns->url)
+ . '" rel="nofollow">'
+ . htmlspecialchars($ns->name)
+ . '</a>';
+ } else {
+ $source = $ns->code;
+ }
+ }
+
+ $twitter_status['source'] = $source;
$twitter_status['id'] = intval($notice->id);
$replier_profile = null;
@@ -1298,43 +1314,6 @@ class ApiAction extends Action
}
}
- function sourceLink($source)
- {
- $source_name = _($source);
- switch ($source) {
- case 'web':
- case 'xmpp':
- case 'mail':
- case 'omb':
- case 'api':
- break;
- default:
-
- $name = null;
- $url = null;
-
- $ns = Notice_source::staticGet($source);
-
- if ($ns) {
- $name = $ns->name;
- $url = $ns->url;
- } else {
- $app = Oauth_application::staticGet('name', $source);
- if ($app) {
- $name = $app->name;
- $url = $app->source_url;
- }
- }
-
- if (!empty($name) && !empty($url)) {
- $source_name = '<a href="' . $url . '">' . $name . '</a>';
- }
-
- break;
- }
- return $source_name;
- }
-
/**
* Returns query argument or default value if not found. Certain
* parameters used throughout the API are lightly scrubbed and