]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into facebook-app-plugin
authorZach Copley <zach@status.net>
Fri, 23 Oct 2009 22:48:35 +0000 (22:48 +0000)
committerZach Copley <zach@status.net>
Fri, 23 Oct 2009 22:48:35 +0000 (22:48 +0000)
classes/Profile.php
lib/api.php

index 4a069ee84eb6141465d27f2a9ac205432d41cfd5..a78a27f4a2b35e3e490d991b56e12b0f1c79d322 100644 (file)
@@ -46,6 +46,11 @@ class Profile extends Memcached_DataObject
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
+    function getUser()
+    {
+        return User::staticGet('id', $this->id);
+    }
+
     function getAvatar($width, $height=null)
     {
         if (is_null($height)) {
index 7a63a4a785514868b70f42f62d33c4dded3856e8..9bd2083deba20912fad009c10d91c5d69b096a8c 100644 (file)
@@ -134,11 +134,19 @@ class ApiAction extends Action
         $twitter_user['protected'] = false; # not supported by StatusNet yet
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        // To be supported soon...
-        $twitter_user['profile_background_color'] = '';
-        $twitter_user['profile_text_color'] = '';
-        $twitter_user['profile_link_color'] = '';
-        $twitter_user['profile_sidebar_fill_color'] = '';
+        // Need to pull up the user for some of this
+        $user = $profile->getUser();
+        $design = $user->getDesign();
+        $defaultDesign = Design::siteDesign();
+        if (!$design) $design = $defaultDesign;
+        $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);
+        $twitter_user['profile_text_color'] = ($color == null) ? '' : '#'.$color->hexValue();
+        $color = Design::toWebColor(empty($design->linkcolor) ? $defaultDesign->linkcolor : $design->linkcolor);
+        $twitter_user['profile_link_color'] = ($color == null) ? '' : '#'.$color->hexValue();
+        $color = Design::toWebColor(empty($design->sidebarcolor) ? $defaultDesign->sidebarcolor : $design->sidebarcolor);
+        $twitter_user['profile_sidebar_fill_color'] = ($color == null) ? '' : '#'.$color->hexValue();
         $twitter_user['profile_sidebar_border_color'] = '';
 
         $twitter_user['friends_count'] = $profile->subscriptionCount();
@@ -147,8 +155,6 @@ class ApiAction extends Action
 
         $twitter_user['favourites_count'] = $profile->faveCount(); // British spelling!
 
-        // Need to pull up the user for some of this
-        $user = User::staticGet($profile->id);
 
         $timezone = 'UTC';