function theme_user_header($user) { $friendship = friendship($user->screen_name); $followed_by = $friendship->relationship->target->followed_by; //The $user is followed by the authenticating $following = $friendship->relationship->target->following; $name = theme('full_name', $user); $full_avatar = theme_get_full_avatar($user); $link = twitter_parse_tags($user->url, $user->entities->url); //Some locations have a prefix which should be removed (UberTwitter and iPhone) $cleanLocation = urlencode(str_replace(array("iPhone: ", "ÜT: "), "", $user->location)); $raw_date_joined = strtotime($user->created_at); $date_joined = date('jS M Y', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user, 1); $bio = twitter_parse_tags($user->description, $user->entities->description); $out = "<div class='profile'>\n\t <span class='avatar'>" . theme('external_link', $full_avatar, theme('avatar', theme_get_avatar($user))) . "</span>\n\t <span class='status shift'><b>{$name}</b><br/>\n\t <span class='about'>"; // if ($user->verified == true) { // $out .= ' <strong>Verified</strong> '.theme('action_icon', "", '✔', 'Verified').'<br />'; // } if ($user->protected == true) { $out .= '<strong>Private/Protected Tweets</strong><br />'; } $out .= "Bio: {$bio}<br />\n\t Link: {$link}<br />\n\t <span class='icons'>⌖</span> <a href=\"https://maps.google.com/maps?q={$cleanLocation}\" target=\"" . get_target() . "\">\n\t {$user->location}\n\t </a>\n\t <br />\n\t Joined: {$date_joined} (~" . pluralise('tweet', $tweets_per_day, true) . " per day)\n\t </span>\n\t </span>\n\t <div class='features'>"; $out .= pluralise('tweet', $user->statuses_count, true); //If the authenticated user is not following the protected used, the API will return a 401 error when trying to view friends, followers and favourites //This is not the case on the Twitter website //To avoid the user being logged out, check to see if she is following the protected user. If not, don't create links to friends, followers and favourites if ($user->protected == true && $followed_by == false) { $out .= " | " . pluralise('follower', $user->followers_count, true); $out .= " | " . pluralise('friend', $user->friends_count, true); $out .= " | " . pluralise('favourite', $user->favourites_count, true); } else { $out .= " | <a href='followers/{$user->screen_name}'>" . pluralise('follower', $user->followers_count, true) . "</a>"; $out .= " | <a href='friends/{$user->screen_name}'>" . pluralise('friend', $user->friends_count, true) . "</a>"; $out .= " | <a href='favourites/{$user->screen_name}'>" . pluralise('favourite', $user->favourites_count, true) . "</a>"; } $out .= " | <a href='lists/{$user->screen_name}'>" . pluralise('list', $user->listed_count, true) . "</a>"; if ($following) { $out .= " | <a href='messages/create/{$user->screen_name}'>Direct Message</a>"; } // One cannot follow, block, nor report spam oneself. if (strtolower($user->screen_name) !== strtolower(user_current_username())) { if ($followed_by == false) { $out .= " | <a href='follow/{$user->screen_name}'>Follow</a>"; } else { $out .= " | <a href='unfollow/{$user->screen_name}'>Unfollow</a>"; if ($friendship->relationship->source->want_retweets) { $out .= " | <a href='confirm/hideretweets/{$user->screen_name}'>Hide Retweets</a>"; } else { $out .= " | <a href='confirm/showretweets/{$user->screen_name}'>Show Retweets</a>"; } } //We need to pass the User Name and the User ID. The Name is presented in the UI, the ID is used in checking $blocked = $friendship->relationship->source->blocking; //The $user is blocked by the authenticating if ($blocked == true) { $out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Unblock</a>"; } else { $out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block</a>"; } $out .= " | <a href='confirm/spam/{$user->screen_name}/{$user->id}'>Report Spam</a>"; } else { // Items we can only show on ourself $out .= " | <a href='blocked'>Show Blocked Users</a>"; } $out .= " | <a href='search?query=%40{$user->screen_name}'>Search @{$user->screen_name}</a>"; $out .= "</div></div>"; return $out; }
function theme_user_header($user) { $following = friendship($user->screen_name); $followed_by = $following->relationship->target->followed_by; //The $user is followed by the authenticating $following = $following->relationship->target->following; $name = theme('full_name', $user); $full_avatar = str_replace('_normal.', '.', $user->profile_image_url); $link = theme('external_link', $user->url); //Some locations have a prefix which should be removed (UbertTwitter and iPhone) //Sorry if my PC has converted from UTF-8 with the U (artesea) $cleanLocation = str_replace(array("iPhone: ", "ÜT: "), "", $user->location); $raw_date_joined = strtotime($user->created_at); $date_joined = date('jS M Y', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user, 1); $bio = twitter_parse_tags($user->description); $out = "<div class='profile'>"; $out .= "<span class='avatar'>" . theme('external_link', $full_avatar, theme('avatar', $user->profile_image_url)) . "</span>"; $out .= "<span class='status shift'><b>{$name}</b><br />"; $out .= "<span class='about'>"; if ($user->verified == true) { $out .= '<strong>Verified Account</strong><br />'; } if ($user->protected == true) { $out .= '<strong>Private/Protected Tweets</strong><br />'; } $out .= "Bio: {$bio}<br />"; $out .= "Link: {$link}<br />"; $out .= "Location: <a href=\"http://maps.google.com/m?q={$cleanLocation}\" target=\"_blank\">{$user->location}</a><br />"; $out .= "Joined: {$date_joined} (~" . pluralise('tweet', $tweets_per_day, true) . " per day)"; $out .= "</span></span>"; $out .= "<div class='features'>"; $out .= pluralise('tweet', $user->statuses_count, true); //If the authenticated user is not following the protected used, the API will return a 401 error when trying to view friends, followers and favourites //This is not the case on the Twitter website //To avoid the user being logged out, check to see if she is following the protected user. If not, don't create links to friends, followers and favourites if ($user->protected == true && $followed_by == false) { $out .= " | " . pluralise('follower', $user->followers_count, true); $out .= " | " . pluralise('friend', $user->friends_count, true); $out .= " | " . pluralise('favourite', $user->favourites_count, true); } else { $out .= " | <a href='followers/{$user->screen_name}'>" . pluralise('follower', $user->followers_count, true) . "</a>"; $out .= " | <a href='friends/{$user->screen_name}'>" . pluralise('friend', $user->friends_count, true) . "</a>"; $out .= " | <a href='favourites/{$user->screen_name}'>" . pluralise('favourite', $user->favourites_count, true) . "</a>"; } $out .= " | <a href='lists/{$user->screen_name}'>" . pluralise('list', $user->listed_count, true) . "</a>"; $out .= " | <a href='directs/create/{$user->screen_name}'>Direct Message</a>"; //NB we can tell if the user can be sent a DM $following->relationship->target->following; //Would removing this link confuse users? //Deprecated http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-users%C2%A0show //if ($user->following !== true) if ($followed_by == false) { $out .= " | <a href='follow/{$user->screen_name}'>Follow</a>"; } else { $out .= " | <a href='unfollow/{$user->screen_name}'>Unfollow</a>"; } //We need to pass the User Name and the User ID. The Name is presented in the UI, the ID is used in checking $out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>(Un)Block</a>"; /* //This should work, but it doesn't. Grrr. $blocked = $following->relationship->source->blocking; //The $user is blocked by the authenticating if ($blocked == true) { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Unblock</a>"; } else { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block</a>"; } */ $out .= " | <a href='confirm/spam/{$user->screen_name}/{$user->id}'>Report Spam</a>"; $out .= " | <a href='search?query=%40{$user->screen_name}'>Search @{$user->screen_name}</a>"; $out .= "</div></div>"; return $out; }
function theme_user_header($user) { $following = friendship($user->screen_name); $followed_by = $following->relationship->target->followed_by; //The $user is followed by the authenticating $following = $following->relationship->target->following; $name = theme('full_name', $user); $full_avatar = str_replace('_normal.', '.', $user->profile_image_url); $link = theme('external_link', $user->url); $raw_date_joined = strtotime($user->created_at); $date_joined = date('jS M Y', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user, 1); $out = "<table>\n \t\t\t\t<tr>\n \t\t\t\t\t<td>" . theme('external_link', $full_avatar, theme('avatar', $user->profile_image_url, 1)) . "</td>\n\t\t\t\t\t<td><b>{$name}</b>\n\t\t\t\t\t\t<small>"; if ($user->verified == true) { $out .= '<br /><strong>Verified Account</strong>'; } if ($user->protected == true) { $out .= '<br /><strong>Private/Protected Tweets</strong>'; } $out .= "\n\t\t\t<br />Bio: {$user->description}\n\t\t\t<br />Link: {$link}\n\t\t\t<br />Location: {$user->location}\n\t\t\t<br />Joined: {$date_joined} (~{$tweets_per_day} tweets per day)\n\t\t\t</small>\n\t\t\t<br />\n\t\t\t{$user->statuses_count} tweets | "; //If the authenticated user is not following the protected used, the API will return a 401 error when trying to view friends, followers and favourites //This is not the case on the Twitter website //To avoid the user being logged out, check to see if she is following the protected user. If not, don't create links to friends, followers and favourites if ($user->protected == true && $followed_by == false) { $out .= "{$user->followers_count} followers\n\t\t\t\t| {$user->friends_count} friends</a>\n\t\t\t\t| {$user->favourites_count} favourites</a>"; } else { $out .= "<a href='followers/{$user->screen_name}'>{$user->followers_count} followers</a>\n\t\t\t\t| <a href='friends/{$user->screen_name}'>{$user->friends_count} friends</a>\n\t\t\t\t| <a href='favourites/{$user->screen_name}'>{$user->favourites_count} favourites</a>"; } $out .= "\t| <a href='lists/{$user->screen_name}'>Lists</a>\n\t\t\t\t| <a href='directs/create/{$user->screen_name}'>Direct Message</a>"; //NB we can tell if the user can be sent a DM $following->relationship->target->following; //Would removing this link confuse users? //Deprecated http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-users%C2%A0show //if ($user->following !== true) if ($followed_by == false) { $out .= " | <a href='follow/{$user->screen_name}'>Follow</a>"; } else { $out .= " | <a href='unfollow/{$user->screen_name}'>Unfollow</a>"; } //We need to pass the User Name and the User ID. The Name is presented in the UI, the ID is used in checking $out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block | Unblock</a>"; /* //This should work, but it doesn't. Grrr. $blocked = $following->relationship->source->blocking; //The $user is blocked by the authenticating if ($blocked == true) { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Unblock</a>"; } else { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block</a>"; } */ $out .= " | <a href='confirm/spam/{$user->screen_name}/{$user->id}'>Report Spam</a>\n\t\n\t\t\t</td></table>"; return $out; }
function theme_user_header($user) { $name = theme('full_name', $user); $full_avatar = img_proxy_url(str_replace('_normal.', '.', theme_get_avatar($user))); $link = theme('external_link', $user->url); $raw_date_joined = strtotime($user->created_at); $date_joined = date('Y-m-d H:i', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user, 1); $bio = twitter_parse_tags($user->description); $out = "<div class='profile'>"; if (setting_fetch('avataro', 'yes') == 'yes') { $out .= "<span class='avatar'><a href='{$full_avatar}'>" . theme('avatar', img_proxy_url(theme_get_avatar($user)), 1) . "</a></span><span class='status shift48'>"; } else { $out .= "<span class='status'>"; } $out .= "<b>{$name}</b> "; if ($user->verified == true) { $out .= '<small><i>' . __("Verified") . '</i></small> '; } if ($user->protected == true) { $out .= '<small><i>' . __("Private/Protected") . '</i></small> '; } $friendship_obj = NULL; if (strtolower($user->screen_name) !== strtolower(user_current_username())) { $friendship_obj = friendship($user->screen_name); if ($friendship_obj->relationship->target->following == 1) { $out .= '<small><b>FOLLOWS YOU</b></small>'; } } $out .= "<br /><span class='features'>[ "; if (setting_fetch('avataro', 'yes') != 'yes') { $out .= "<a href='{$full_avatar}'>" . __("View picture") . "</a> | "; } if (strtolower($user->screen_name) !== strtolower(user_current_username())) { if ($user->following !== true) { $out .= "<a href='" . BASE_URL . "follow/{$user->screen_name}'>" . __("Follow") . "</a>"; } else { $out .= "<a href='" . BASE_URL . "unfollow/{$user->screen_name}'>" . __("Unfollow") . "</a>"; } $out .= " | <a href='" . BASE_URL . "directs/create/{$user->screen_name}'>" . __("Direct Message") . "</a>"; } else { $out .= "<a href='" . BASE_URL . "profile'>" . __("Update Profile") . "</a>"; } $out .= " ] [ {$user->statuses_count} " . __("Tweets") . " | <a href='" . BASE_URL . "followers/{$user->screen_name}'>{$user->followers_count} " . __("Followers") . "</a> | <a href='" . BASE_URL . "friends/{$user->screen_name}'>{$user->friends_count} " . __("Friends") . "</a> | <a href='" . BASE_URL . "favourites/{$user->screen_name}'>{$user->favourites_count} " . __("Favourites") . "</a> | <a href='" . BASE_URL . "lists/{$user->screen_name}'>{$user->listed_count} " . __("Lists") . "</a> ]"; if (strtolower($user->screen_name) !== strtolower(user_current_username())) { $block_str = $friendship_obj->relationship->source->blocking == 1 ? "Unblock" : "Block"; $out .= " [ <a href='" . BASE_URL . "confirm/block/{$user->screen_name}/{$user->id_str}'>" . __($block_str) . "</a> - <a href='" . BASE_URL . "confirm/spam/{$user->screen_name}/{$user->id_str}'>" . __('Report Spam') . "</a> ]"; } $out .= "</span><br /><small class='about'>"; if ($user->description != "") { $out .= __("Bio: ") . "{$bio}<br />"; } if ($user->url != "") { $out .= __("Link: ") . "{$link}<br />"; } if ($user->location != "") { $out .= __("Location: ") . "<a href='http://maps.google.com/maps?q={$user->location}' target='_blank'>{$user->location}</a><br />"; } $out .= __("Joined: ") . "{$date_joined} ({$tweets_per_day} " . __("Tweets Per Day") . ")</small></span></div>"; return $out; }
function theme_user_header($user) { $following = friendship($user->screen_name); $followed_by = $following->relationship->target->followed_by; //The $user is followed by the authenticating $following = $following->relationship->target->following; $name = theme('full_name', $user); $full_avatar = str_replace('_normal.', '.', theme_get_avatar($user)); $link = isset($user->url) ? theme('external_link', $user->url) : $user->url; //Some locations have a prefix which should be removed (UbertTwitter and iPhone) //Sorry if my PC has converted from UTF-8 with the U (artesea) $cleanLocation = str_replace(array("iPhone: ", "üT: "), "", $user->location); $raw_date_joined = strtotime($user->created_at); $date_joined = date('jS M Y', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user, 1); $bio = twitter_parse_tags($user->description); $username = user_current_username(); $out = "<div class='profile'>"; if (setting_fetch('avataro', 'yes') !== 'yes') { $out .= "<span class='avatar'>" . theme('external_link', $full_avatar, theme('avatar', theme_get_avatar($user), htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8')), $name) . "</span>"; } $out .= "<span class='status shift'><span class='textb'>{$name}</span><br />"; $out .= "<span class='about'>"; if ($user->verified == true) { $out .= '<strong>Verified Account</strong><br />'; } if ($user->protected == true) { $out .= '<strong>Private/Protected Tweets</strong><br />'; } $out .= "Bio: {$bio}<br />"; $out .= empty($user->url) ? "Link: No link to display.<br />" : "Link: {$link}<br />"; $out .= empty($user->location) ? "Location: No location to display.<br />" : "Location: <a href=\"https://maps.google.com/maps?q={$cleanLocation}\" rel=\"external nofollow noreferrer\">{$user->location}</a><br />"; $out .= "Joined: {$date_joined} (~" . pluralise('tweet', $tweets_per_day, true) . " per day)"; if (strtolower($user->screen_name) !== strtolower(user_current_username())) { $out .= "<br /><strong>{$user->screen_name} "; if ($following == true) { $out .= "follows"; } else { $out .= "does not follow"; } $out .= " {$username}</strong>"; } $out .= "</span></span>"; $out .= "<div class='features'>"; $out .= pluralise('tweet', $user->statuses_count, true); //If the authenticated user is not following the protected used, the API will return a 401 error when trying to view friends, followers and favourites //This is not the case on the Twitter website //To avoid the user being logged out, check to see if she is following the protected user. If not, don't create links to friends, followers and favourites if ($user->protected == true && $followed_by == false) { $out .= " | " . pluralise('follower', $user->followers_count, true); $out .= " | " . pluralise('friend', $user->friends_count, true); $out .= " | " . pluralise('favourite', $user->favourites_count, true); } else { $out .= " | <a href='followers/{$user->screen_name}'>" . pluralise('follower', $user->followers_count, true) . "</a>"; $out .= " | <a href='friends/{$user->screen_name}'>" . pluralise('friend', $user->friends_count, true) . "</a>"; $out .= " | <a href='favourites/{$user->screen_name}'>" . pluralise('favourite', $user->favourites_count, true) . "</a>"; } //NB we can tell if the user can be sent a DM $following->relationship->target->following; //Would removing this link confuse users? //One cannot follow, block, nor report spam oneself. if (strtolower($user->screen_name) !== strtolower(user_current_username())) { if ($followed_by == false) { $out .= " | <a href='follow/{$user->screen_name}'>Follow</a>"; } else { $out .= " | <a href='unfollow/{$user->screen_name}'>Unfollow</a>"; } //We need to pass the User Name and the User ID. The Name is presented in the UI, the ID is used in checking $out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block | Unblock</a>"; /* //This should work, but it doesn't. Grrr. $blocked = $following->relationship->source->blocking; //The $user is blocked by the authenticating if ($blocked == true) { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Unblock</a>"; } else { $out.= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block</a>"; } */ $out .= " | <a href='confirm/spam/{$user->screen_name}/{$user->id}'>Report Spam</a>"; } else { $out .= " | <a href='profile'>Update Profile</a>"; } $out .= " | <a href='lists/{$user->screen_name}'>" . pluralise('list', $user->listed_count, true) . "</a>"; $out .= " | <a href='user/{$user->screen_name}/retweets'>Retweets</a>"; if ($following == true && $followed_by == true || strtolower($user->screen_name) == strtolower(user_current_username())) { $out .= " | <a href='directs/create/{$user->screen_name}'>Direct Message</a>"; } $out .= " | <a href='search?query=%40{$user->screen_name}'>Search @{$user->screen_name}</a>"; $out .= "</div></div>"; return $out; }
function theme_user_header($user) { $friendship = friendship($user->screen_name); $followed_by = $friendship->relationship->target->followed_by; //The $user is followed by the authenticating $following = $friendship->relationship->target->following; $name = theme('full_name', $user); $screen_name = $user->screen_name; $full_avatar = theme_get_full_avatar($user); $link = twitter_parse_tags($user->url, $user->entities->url, "me"); //Some locations have a prefix which should be removed (UberTwitter and iPhone) $cleanLocation = urlencode(str_replace(array("iPhone: ", "ÜT: "), "", $user->location)); $raw_date_joined = strtotime($user->created_at); $date_joined = date('jS M Y', $raw_date_joined); $tweets_per_day = twitter_tweets_per_day($user); $bio = twitter_parse_tags($user->description, $user->entities->description); $out = "<div class='profile'>\n\t <span class='avatar'>" . theme('external_link', $full_avatar, theme('avatar', theme_get_avatar($user))) . "</span>\n\t <span class='status shift'><b>{$name}</b><br/>\n\t <span class='about'>"; if ($user->protected == true) { $out .= '<strong>' . _(PRIVATE_TWEETS) . '</strong><br />'; } $out .= _(PROFILE_BIO) . ": {$bio}<br />" . _(PROFILE_LINK) . ": {$link}<br />\n <span class='icons'>⌖</span>\n\t\t\t\t\t\t\t\t<a href=\"https://maps.google.com/maps?q={$cleanLocation}\" target=\"" . get_target() . "\">\n {$user->location}\n </a>\n \t\t\t<br />" . _(PROFILE_JOINED) . ": {$date_joined} (" . sprintf(ngettext("PROFILE_TWEET_PER_DAY %s", "PROFILE_TWEETS_PER_DAY %s", $tweets_per_day), number_format($tweets_per_day)) . ")\n \t\t\t</span>\n \t\t</span>\n \t\t\t\t\t<div class='features'>"; $out .= theme_user_info($user); $out .= "</div>\n\t\t\t</div>"; return $out; }