diff options
author | Evan Prodromou <evan@status.net> | 2009-12-12 16:15:47 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-12 16:15:47 -0500 |
commit | cc063aedccd614d6e486d88921c7752ec5750551 (patch) | |
tree | 603d7055f5b25fbff886c520ecddaee0e998ffd7 /lib/api.php | |
parent | b42b2e1d05867b2dd4cdb3e1b7e278c63001d355 (diff) | |
parent | 78a649ca0af3ffbf1fd23d5ae9e84def7befa79e (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/api.php')
-rw-r--r-- | lib/api.php | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/api.php b/lib/api.php index eacb80dbe..7ebe65dbb 100644 --- a/lib/api.php +++ b/lib/api.php @@ -134,17 +134,19 @@ class ApiAction extends Action $twitter_user['protected'] = false; # not supported by StatusNet yet $twitter_user['followers_count'] = $profile->subscriberCount(); - $user = $profile->getUser(); $design = null; + $user = $profile->getUser(); // Note: some profiles don't have an associated user - $defaultDesign = Design::siteDesign(); - if (!empty($user)) { $design = $user->getDesign(); } + if (empty($design)) { + $design = Design::siteDesign(); + } + $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor); $twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue(); $color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor); @@ -163,7 +165,7 @@ class ApiAction extends Action $timezone = 'UTC'; - if (!empty($user) && !empty($user->timezone)) { + if ($user->timezone) { $timezone = $user->timezone; } @@ -586,7 +588,7 @@ class ApiAction extends Action $this->endDocument('xml'); } - function showRssTimeline($notice, $title, $link, $subtitle, $suplink=null) + function showRssTimeline($notice, $title, $link, $subtitle, $suplink=null, $logo=null) { $this->initDocument('rss'); @@ -600,6 +602,15 @@ class ApiAction extends Action 'href' => $suplink, 'type' => 'application/json')); } + + if (!is_null($logo)) { + $this->elementStart('image'); + $this->element('link', null, $link); + $this->element('title', null, $title); + $this->element('url', null, $logo); + $this->elementEnd('image'); + } + $this->element('description', null, $subtitle); $this->element('language', null, 'en-us'); $this->element('ttl', null, '40'); @@ -619,7 +630,7 @@ class ApiAction extends Action $this->endTwitterRss(); } - function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null) + function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null, $logo=null) { $this->initDocument('atom'); @@ -628,6 +639,10 @@ class ApiAction extends Action $this->element('id', null, $id); $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); + if (!is_null($logo)) { + $this->element('logo',null,$logo); + } + if (!is_null($suplink)) { # For FriendFeed's SUP protocol $this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup', |