示例#1
0
 function showCSS($out)
 {
     $css = '';
     $bgcolor = Design::toWebColor($this->backgroundcolor);
     if (!empty($bgcolor)) {
         $css .= 'body { background-color: #' . $bgcolor->hexValue() . ' }' . "\n";
     }
     $ccolor = Design::toWebColor($this->contentcolor);
     if (!empty($ccolor)) {
         $css .= '#content, #site_nav_local_views .current a { background-color: #';
         $css .= $ccolor->hexValue() . '} ' . "\n";
     }
     $sbcolor = Design::toWebColor($this->sidebarcolor);
     if (!empty($sbcolor)) {
         $css .= '#aside_primary { background-color: #' . $sbcolor->hexValue() . ' }' . "\n";
     }
     $tcolor = Design::toWebColor($this->textcolor);
     if (!empty($tcolor)) {
         $css .= 'html body { color: #' . $tcolor->hexValue() . ' }' . "\n";
     }
     $lcolor = Design::toWebColor($this->linkcolor);
     if (!empty($lcolor)) {
         $css .= 'a { color: #' . $lcolor->hexValue() . ' }' . "\n";
     }
     if (!empty($this->backgroundimage) && $this->disposition & BACKGROUND_ON) {
         $repeat = $this->disposition & BACKGROUND_TILE ? 'background-repeat:repeat;' : 'background-repeat:no-repeat;';
         $css .= 'body { background-image:url(' . Design::url($this->backgroundimage) . '); ' . $repeat . ' background-attachment:fixed; }' . "\n";
     }
     if (0 != mb_strlen($css)) {
         $out->style($css);
     }
 }
 function twitterUserArray($profile, $get_notice = false)
 {
     $twitter_user = array();
     $twitter_user['id'] = intval($profile->id);
     $twitter_user['name'] = $profile->getBestName();
     $twitter_user['screen_name'] = $profile->nickname;
     $twitter_user['location'] = $profile->location ? $profile->location : null;
     $twitter_user['description'] = $profile->bio ? $profile->bio : null;
     $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
     $twitter_user['profile_image_url'] = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
     $twitter_user['url'] = $profile->homepage ? $profile->homepage : null;
     $twitter_user['protected'] = false;
     # not supported by StatusNet yet
     $twitter_user['followers_count'] = $profile->subscriberCount();
     $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 = $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();
     $twitter_user['created_at'] = $this->dateTwitter($profile->created);
     $twitter_user['favourites_count'] = $profile->faveCount();
     // British spelling!
     $timezone = 'UTC';
     if (!empty($user) && $user->timezone) {
         $timezone = $user->timezone;
     }
     $t = new DateTime();
     $t->setTimezone(new DateTimeZone($timezone));
     $twitter_user['utc_offset'] = $t->format('Z');
     $twitter_user['time_zone'] = $timezone;
     $twitter_user['profile_background_image_url'] = empty($design->backgroundimage) ? '' : $design->disposition & BACKGROUND_ON ? Design::url($design->backgroundimage) : '';
     $twitter_user['profile_background_tile'] = empty($design->disposition) ? '' : $design->disposition & BACKGROUND_TILE ? 'true' : 'false';
     $twitter_user['statuses_count'] = $profile->noticeCount();
     // Is the requesting user following this user?
     $twitter_user['following'] = false;
     $twitter_user['notifications'] = false;
     if (isset($this->auth_user)) {
         $twitter_user['following'] = $this->auth_user->isSubscribed($profile);
         // Notifications on?
         $sub = Subscription::pkeyGet(array('subscriber' => $this->auth_user->id, 'subscribed' => $profile->id));
         if ($sub) {
             $twitter_user['notifications'] = $sub->jabber || $sub->sms;
         }
     }
     if ($get_notice) {
         $notice = $profile->getCurrentNotice();
         if ($notice) {
             # don't get user!
             $twitter_user['status'] = $this->twitterStatusArray($notice, false);
         }
     }
     return $twitter_user;
 }