예제 #1
0
파일: twitter.php 프로젝트: dheere/twitubas
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 = theme_get_full_avatar($user);
    $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', theme_get_avatar($user))) . "</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=\"" . get_target() . "\">{$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;
}
예제 #2
0
파일: theme.php 프로젝트: NaiRobley/Dabr
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;
}
예제 #3
0
파일: theme.php 프로젝트: vinazol/Dabr
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;
}