summaryrefslogtreecommitdiff
path: root/lib/api.php
diff options
context:
space:
mode:
authorHue Bastard <hubris@kevin.(none)>2009-12-08 21:28:11 +1000
committerBrion Vibber <brion@status.net>2009-12-11 16:15:22 -0800
commit59e5958d3afa0a5613efbc1ed4546ce63946fe43 (patch)
tree65736eb221001a02bdd5c73db702e3823b60728d /lib/api.php
parente2f0fc7b3f459a38c71c730c4006db42cab4724e (diff)
ticket 2055: added logos to Atom and RSS feeds
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php27
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',