diff options
author | zach <zach@controlyourself.ca> | 2008-09-30 13:53:54 -0400 |
---|---|---|
committer | zach <zach@controlyourself.ca> | 2008-09-30 13:53:54 -0400 |
commit | bbd5f6b471c873e9fff955bfbedd3db91ee25dc0 (patch) | |
tree | 491c92fd602493067e8241cbf9a02a0fd6d042cc /lib | |
parent | 924491f08a24201c7bda45b4d4be16ccebba97c0 (diff) |
Twitter-compatible API - added source links to statuses/notices
darcs-hash:20080930175354-462f3-b49bef0e1b91ef1b94c01426c4c54900a43554d3.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/twitterapi.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 5bcb538f9..c8d78e1a3 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -61,7 +61,7 @@ class TwitterapiAction extends Action { $twitter_status['truncated'] = 'false'; # Not possible on Laconica $twitter_status['created_at'] = $this->date_twitter($notice->created); $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL; - $twitter_status['source'] = $notice->source; + $twitter_status['source'] = $this->source_link($notice->source); $twitter_status['id'] = intval($notice->id); $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : NULL; $twitter_status['favorited'] = NULL; # XXX: Not implemented on Laconica yet. @@ -441,4 +441,23 @@ class TwitterapiAction extends Action { } } + function source_link($source) { + $source_name = _($source); + switch ($source) { + case 'web': + case 'xmpp': + case 'mail': + case 'omb': + case 'api': + break; + default: + $ns = Notice_source::staticGet($source); + if ($ns) { + $source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>'; + } + break; + } + return $source_name; + } + }
\ No newline at end of file |