示例#1
0
文件: theme.php 项目: NaiRobley/Dabr
function theme_action_icons($status)
{
    $from = $status->from->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        $actions[] = theme('action_icon', "{$from}/reply/{$status->id}", '@', 'Reply');
    }
    //	DM only shows up if we can actually send a DM
    if (!user_is_current_user($from)) {
        $actions[] = theme('action_icon', "messages/create/{$from}", '✉', 'Direct Message');
    }
    if (!$status->is_direct) {
        $favourite_count = "";
        //	Display favourite count
        if ($status->favorite_count) {
            $favourite_count = "<sup>" . number_format($status->favorite_count) . "</sup>";
        }
        if ($status->favorited == '1') {
            $actions[] = theme('action_icon', "unfavourite/{$status->id}", '<span style="color:#FFFF00;">★</span>', 'Unfavourite') . $favourite_count;
        } else {
            $actions[] = theme('action_icon', "favourite/{$status->id}", '☆', 'Favourite') . $favourite_count;
        }
        $retweet_count = "";
        //	Display number of RT
        if ($status->retweet_count) {
            $retweet_count = "<sup>" . theme('action_icon', "retweeted_by/{$status->id}", number_format($status->retweet_count), number_format($status->retweet_count)) . "</sup>";
        }
        // Show a diffrent retweet icon to indicate to the user this is an RT
        if ($status->retweeted || user_is_current_user($retweeted_by)) {
            $actions[] = theme('action_icon', "retweet/{$status->id}", '<span style="color:#009933;">♻</span>', 'Retweet') . $retweet_count;
        } else {
            $actions[] = theme('action_icon', "retweet/{$status->id}", '♻', 'Retweet') . $retweet_count;
        }
        if (user_is_current_user($from)) {
            $actions[] = theme('action_icon', "confirm/delete/{$status->id}", '🗑', 'Delete');
        }
        //Allow users to delete what they have retweeted
        if (user_is_current_user($retweeted_by)) {
            $actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", '🗑', 'Delete');
        }
    } else {
        $actions[] = theme('action_icon', "confirm/deleteDM/{$status->id}", '🗑', 'Delete');
    }
    if ($geo !== null) {
        $latlong = $geo->coordinates;
        $lat = $latlong[0];
        $long = $latlong[1];
        $actions[] = theme('action_icon', "https://maps.google.com/maps?q={$lat},{$long}", '⌖', 'Location');
    }
    //Search for @ to a user
    $actions[] = theme('action_icon', "search?query=%40{$from}", '🔍', 'Search');
    return '<span class="actionicons">' . implode('&emsp;', $actions) . '</span>';
}
示例#2
0
function theme_action_icons($status)
{
    $from = $status->from->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        $actions[] = theme('action_icon', "user/{$from}/reply/{$status->id}", 'images/reply.png', '@');
    }
    //Reply All functionality.
    if ($status->entities->user_mentions) {
        $actions[] = theme('action_icon', "user/{$from}/replyall/{$status->id}", 'images/replyall.png', 'REPLY ALL');
    }
    if (!user_is_current_user($from)) {
        $actions[] = theme('action_icon', "directs/create/{$from}", 'images/dm.png', 'DM');
    }
    if (!$status->is_direct) {
        if ($status->favorited == '1') {
            $actions[] = theme('action_icon', "unfavourite/{$status->id}", 'images/star.png', 'UNFAV');
        } else {
            $actions[] = theme('action_icon', "favourite/{$status->id}", 'images/star_grey.png', 'FAV');
        }
        if ($retweeted_by) {
            $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweeted.png', 'RT');
        } else {
            $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweet.png', 'RT');
        }
        if (user_is_current_user($from)) {
            $actions[] = theme('action_icon', "confirm/delete/{$status->id}", 'images/trash.gif', 'DEL');
        }
        if ($retweeted_by) {
            if (user_is_current_user($retweeted_by)) {
                $actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", 'images/trash.gif', 'DEL');
            }
        }
    } else {
        $actions[] = theme('action_icon', "confirm/deleteDM/{$status->id}", 'images/trash.gif', 'DEL');
    }
    if ($geo !== null) {
        $latlong = $geo->coordinates;
        $lat = $latlong[0];
        $long = $latlong[1];
        $actions[] = theme('action_icon', "http://maps.google.co.uk/m?q={$lat},{$long}", 'images/map.png', 'MAP');
    }
    //Search for @ to a user
    $actions[] = theme('action_icon', "search?query=%40{$from}", 'images/q.png', '?');
    return implode(' ', $actions);
}
示例#3
0
function theme_action_icons($status)
{
    $from = $status->from->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        $actions[] = theme('action_icon', "user/{$from}/reply/{$status->id}", 'images/reply.png', '@');
    }
    //Reply All functionality.
    if (substr_count($status->text, '@') >= 1) {
        $found = Twitter_Extractor::extractMentionedScreennames($status->text);
        $to_users = array_unique($found);
        $key = array_search(user_current_username(), $to_users);
        // Remove the username of the authenticated user
        if ($key != NULL || $key !== FALSE) {
            unset($to_users[$key]);
            // remove the username from array
        }
        if (count($to_users) >= 1) {
            $actions[] = theme('action_icon', "user/{$from}/replyall/{$status->id}", 'images/replyall.png', 'REPLY ALL');
        }
    }
    if (!user_is_current_user($from)) {
        $actions[] = theme('action_icon', "directs/create/{$from}", 'images/dm.png', 'DM');
    }
    if (!$status->is_direct) {
        if ($status->favorited == '1') {
            $actions[] = theme('action_icon', "unfavourite/{$status->id}", 'images/star.png', 'UNFAV');
        } else {
            $actions[] = theme('action_icon', "favourite/{$status->id}", 'images/star_grey.png', 'FAV');
        }
        $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweet.png', 'RT');
        if (user_is_current_user($from)) {
            $actions[] = theme('action_icon', "confirm/delete/{$status->id}", 'images/trash.gif', 'DEL');
        }
        if ($retweeted_by) {
            if (user_is_current_user($retweeted_by)) {
                $actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", 'images/trash.gif', 'DEL');
            }
        }
    } else {
        $actions[] = theme('action_icon', "directs/delete/{$status->id}", 'images/trash.gif', 'DEL');
    }
    if ($geo !== null) {
        $latlong = $geo->coordinates;
        $lat = $latlong[0];
        $long = $latlong[1];
        $actions[] = theme('action_icon', "http://maps.google.co.uk/m?q={$lat},{$long}", 'images/map.png', 'MAP');
    }
    //Search for @ to a user
    $actions[] = theme('action_icon', "search?query=%40{$from}", 'images/q.png', '?');
    return implode(' ', $actions);
}
示例#4
0
function twitter_user_page($query)
{
    $screen_name = $query[1];
    // echo "<h1>q1 = {$screen_name}</h1>";
    $subaction = $query[2];
    // echo "<h1>q2 = {$subaction}</h1>";
    $in_reply_to_id = (string) $query[3];
    // echo "<h1>q3 = {$in_reply_to_id}</h1>";
    $content = '';
    if (!$screen_name) {
        // theme('error', 'No username given');
        //	Ugly cludge because @user is a real user
        twitter_refresh('user/user');
    }
    // Load up user profile information and one tweet
    $user = twitter_user_info($screen_name);
    // If the user has at least one tweet
    if (isset($user->status)) {
        // Fetch the timeline early, so we can try find the tweet they're replying to
        $cb = get_codebird();
        $api_options = "";
        $per_page = setting_fetch('perPage', 20);
        $api_options = "&count={$per_page}";
        //	If we're paginating through
        if ($_GET['max_id']) {
            $api_options .= '&max_id=' . $_GET['max_id'];
        }
        $api_options .= "&screen_name={$screen_name}";
        $user_timeline = $cb->statuses_userTimeline($api_options);
        twitter_api_status($user_timeline);
        $tl = twitter_standard_timeline($user_timeline, 'user');
        // $content = theme('status_form');
        // $content .= theme('timeline', $tl);
        // theme('page', 'user', $content);
    }
    // Build an array of people we're talking to
    $to_users = array($user->screen_name);
    // Build an array of hashtags being used
    $hashtags = array();
    // Are we replying to anyone?
    if (is_numeric($in_reply_to_id)) {
        $tweet = twitter_find_tweet_in_timeline($in_reply_to_id, $tl);
        $out = twitter_parse_tags($tweet->text);
        $content .= "<p>In reply to:<br />{$out}</p>";
        // if ($subaction == 'replyall') {
        $found = Twitter_Extractor::create($tweet->text)->extractMentionedUsernames();
        $to_users = array_unique(array_merge($to_users, $found));
        // }
        if ($tweet->entities->hashtags) {
            $hashtags = $tweet->entities->hashtags;
        }
    }
    // Build a status message to everyone we're talking to
    $status = '';
    foreach ($to_users as $username) {
        if (!user_is_current_user($username)) {
            $status .= "@{$username} ";
        }
    }
    // Add in the hashtags they've used
    foreach ($hashtags as $hashtag) {
        $status .= "#{$hashtag->text} ";
    }
    $content .= theme('status_form', $status, $in_reply_to_id);
    $content .= theme('user_header', $user);
    $content .= theme('timeline', $tl);
    theme('page', "User {$screen_name}", $content);
}
示例#5
0
文件: lists.php 项目: xctcc/npt
function lists_list_members_page($user, $list)
{
    // Show members of a list
    // TODO: add logic to CREATE and REMOVE members
    $p = twitter_lists_list_members($user, $list);
    // TODO: use a different theme() function? Add a "delete member" link for each member
    $listname = user_is_current_user($user) ? $list : false;
    $content = theme('followers', $p, 1, $listname);
    $content .= theme('list_pagination', $p);
    theme('page', __("Members of") . " {$user}/{$list}", $content);
}
示例#6
0
文件: twitter.php 项目: xctcc/npt
function theme_action_icons($status)
{
    $from = isset($status->from->screen_name) ? $status->from->screen_name : $status->user->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id_str;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        $actions[] = theme('action_icon', BASE_URL . "user/{$from}/reply/{$status->id_str}", 'images/reply.png', __('@'));
        if ($status->favorited == '1') {
            $actions[] = theme('action_icon', BASE_URL . "unfavourite/{$status->id_str}", 'images/star.png', __('UNFAV'));
        } else {
            $actions[] = theme('action_icon', BASE_URL . "favourite/{$status->id_str}", 'images/star_grey.png', __('FAV'));
        }
        if (user_is_current_user($retweeted_by)) {
            $actions[] = theme('action_icon', BASE_URL . "confirm/delete/{$retweeted_id}", 'images/trash.gif', __('UNDO'));
        } else {
            $actions[] = theme('action_icon', BASE_URL . "retweet/{$status->id_str}", 'images/retweet.png', __('RT'));
        }
        if (user_is_current_user($from)) {
            $actions[] = theme('action_icon', BASE_URL . "confirm/delete/{$status->id_str}", 'images/trash.gif', __('DEL'));
        }
        if ($geo !== null) {
            $latlong = $geo->coordinates;
            $lat = $latlong[0];
            $long = $latlong[1];
            $actions[] = theme('action_icon', "http://maps.google.com/maps?q={$lat},{$long}", 'images/map.png', __('GEO'));
        }
    } else {
        $actions[] = theme('action_icon', BASE_URL . "directs/create/{$from}", 'images/dm.png', __('DM'));
        $actions[] = theme('action_icon', BASE_URL . "directs/delete/{$status->id_str}", 'images/trash.gif', __('DEL'));
    }
    return implode(' ', $actions);
}
示例#7
0
function theme_action_icons($status)
{
    $from = $status->from->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        if (setting_fetch('buttonrl', 'yes') == 'yes' && setting_fetch('rl_user', '') !== '' && setting_fetch('rl_pass', '') !== '') {
            $actions[] = theme('action_icon', "status/{$status->id}/rl", 'images/instapaper.png', 'RL');
        }
        if (setting_fetch('buttonre', 'yes') == 'yes') {
            $actions[] = theme('action_icon', "user/{$from}/reply/{$status->id}", 'images/reply.png', 'AT');
        }
    }
    //Reply All functionality.
    if (setting_fetch('buttonreall') == 'yes' && $status->entities->user_mentions) {
        $actions[] = theme('action_icon', "user/{$from}/replyall/{$status->id}", 'images/replyall.png', 'RE');
    }
    if (setting_fetch('buttondm') == 'yes') {
        if (!user_is_current_user($from)) {
            $actions[] = theme('action_icon', "directs/create/{$from}", 'images/dm.png', 'DM');
        }
    }
    if (!$status->is_direct) {
        if (setting_fetch('buttonfav', 'yes') == 'yes') {
            if ($status->favorited == '1') {
                $actions[] = theme('action_icon', "unfavourite/{$status->id}", 'images/star.png', 'UNFAV');
            } else {
                $actions[] = theme('action_icon', "favourite/{$status->id}", 'images/star_grey.png', 'FAV');
            }
        }
        if (setting_fetch('buttonrt', 'yes') == 'yes') {
            if ($retweeted_by) {
                $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweeted.png', 'RTED');
            } else {
                $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweet.png', 'RT');
            }
        }
        if (setting_fetch('buttondel', 'yes') == 'yes') {
            if (user_is_current_user($from)) {
                $actions[] = theme('action_icon', "confirm/delete/{$status->id}", 'images/trash.gif', 'DEL');
            }
            if ($retweeted_by) {
                if (user_is_current_user($retweeted_by)) {
                    $actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", 'images/trash.gif', 'DEL');
                }
            }
        }
    } else {
        if (setting_fetch('buttondel', 'yes') == 'yes') {
            $actions[] = theme('action_icon', "confirm/deleteDM/{$status->id}", 'images/trash.gif', 'DEL');
        }
    }
    if (setting_fetch('buttonmap', 'yes') == 'yes') {
        if ($geo !== null) {
            $latlong = $geo->coordinates;
            $lat = $latlong[0];
            $long = $latlong[1];
            $actions[] = theme('action_icon', "https://maps.google.com/maps?q={$lat},{$long}", 'images/map.png', 'MAP');
        }
    }
    if (setting_fetch('buttonot', 'yes') == 'yes') {
        $actions[] = theme('action_icon', "http://twitter.com/{$from}/status/{$status->id}", 'images/original.png', 'OT');
    }
    if (setting_fetch('buttonsearch', 'yes') == 'yes') {
        //Search for @ to a user
        $actions[] = theme('action_icon', "search?query=%40{$from}", 'images/q.png', '?');
    }
    return implode(' ', $actions);
}
示例#8
0
文件: theme.php 项目: vinazol/Dabr
function theme_action_icons($status)
{
    $id = $status->id;
    $from = $status->from->screen_name;
    $retweeted_by = $status->retweeted_by->user->screen_name;
    $retweeted_id = $status->retweeted_by->id;
    $geo = $status->geo;
    $actions = array();
    if (!$status->is_direct) {
        $actions[] = theme('action_icon', "{$from}/reply/{$status->id}", '@', _(REPLY));
    }
    //	DM only shows up if we can actually send a DM
    if (!user_is_current_user($from)) {
        $actions[] = theme('action_icon', "messages/create/{$from}", '✉', _(DIRECT_MESSAGE));
    }
    if (!$status->is_direct) {
        $favourite_count = "";
        //	Display favourite count
        if ($status->favorite_count) {
            $favourite_count = "<sup>" . number_format($status->favorite_count) . "</sup>";
        }
        if ($status->favorited == '1') {
            $actions[] = theme('action_icon', ".unfavourite/{$id}", '<span style="color:#FF0000;">♥</span>', _(UNFAVOURITE)) . $favourite_count;
        } else {
            $actions[] = theme('action_icon', ".favourite/{$id}", '♡', _(FAVOURITE)) . $favourite_count;
        }
        $retweet_count = "";
        //	Display number of RT
        if ($status->retweet_count) {
            $retweet_count = "<sup>" . theme('action_icon', ".retweeted-by/{$id}", number_format($status->retweet_count), number_format($status->retweet_count)) . "</sup>";
        }
        // Show a diffrent retweet icon to indicate to the user this is an RT
        if ($status->retweeted || user_is_current_user($retweeted_by)) {
            $actions[] = theme('action_icon', ".retweet/{$id}", '<span style="color:#009933;">♻</span>', _(RETWEET)) . $retweet_count;
        } else {
            $actions[] = theme('action_icon', ".retweet/{$id}", '♻', _(RETWEET)) . $retweet_count;
        }
        if (user_is_current_user($from)) {
            $actions[] = theme('action_icon', ".confirm/.delete/{$id}", '🗑', _(DELETE_BUTTON));
        }
        //Allow users to delete what they have retweeted
        if (user_is_current_user($retweeted_by)) {
            $actions[] = theme('action_icon', ".confirm/.delete/{$retweeted_id}", '🗑', _(DELETE_BUTTON));
        }
    } else {
        $actions[] = theme('action_icon', ".confirm/.deleteDM/{$id}", '🗑', _(DELETE_BUTTON));
    }
    if ($geo !== null) {
        $latlong = $geo->coordinates;
        $lat = $latlong[0];
        $long = $latlong[1];
        $actions[] = theme('action_icon', "https://maps.google.com/maps?q={$lat},{$long}", '⌖', _(PROFILE_LOCATION));
    }
    //Search for @ to a user
    $actions[] = theme('action_icon', "search?query=%40{$from}", '🔍', _(SEARCH_BUTTON));
    return '<span class="actionicons">' . implode('&emsp;', $actions) . '</span>';
}