function worksafe_theme_timeline($feed) { if (count($feed) == 0) { return theme('no_tweets'); } $rows = array(); $page = menu_current_page(); $date_heading = false; foreach ($feed as $status) { $time = strtotime($status->created_at); if ($time > 0) { $date = twitter_date('l jS F Y', strtotime($status->created_at)); if ($date_heading !== $date) { $date_heading = $date; $rows[] = array(array('data' => "<b>{$date}</b>", 'colspan' => 2)); } } else { $date = $status->created_at; } $text = twitter_parse_tags($status->text); $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $source = $status->source ? " from {$status->source}" : ''; $from = ''; if ($status->in_reply_to_status_id) { $from = "<small>in reply to <a href='status/{$status->in_reply_to_status_id}'>{$status->in_reply_to_screen_name}</a></small>"; } $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link} {$source}<br /><span class='text'>{$text} {$from}</span>"; if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $html .= "<br /><small>retweeted to you by <a href='user/{$retweeted_by}'>{$retweeted_by}</a></small>"; } $row = array($html); if ($page != 'user' && $avatar) { array_unshift($row, $avatar); } if ($page != 'replies' && twitter_is_reply($status)) { $row = array('class' => 'reply', 'data' => $row); } $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); if (count($feed) >= 15) { $content .= theme('pagination'); } return $content; }
function theme_search_results($feed) { $rows = array(); foreach ($feed->results as $status) { $text = twitter_parse_tags($status->text, $status->entities); $link = theme('status_time_link', $status); $actions = theme('action_icons', $status); $row = array(theme('avatar', theme_get_avatar($status)), "<a href='{$status->from_user}'>{$status->from_user}</a> {$actions} - {$link}<br />{$text}"); if (twitter_is_reply($status)) { $row = array('class' => 'reply', 'data' => $row); } $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); $content .= theme('pagination'); return $content; }
function theme_timeline($feed) { if (count($feed) == 0) { return theme('no_tweets'); } $hide_pagination = count($feed) < 5 ? true : false; $rows = array(); $page = menu_current_page(); $date_heading = false; $max_id = false; foreach ($feed as &$status) { $max_id = isset($status->retweeted_by) ? $status->retweeted_by->id_str : $status->id_str; $status->text = twitter_parse_tags($status->text, $status->entities, $status->id_str, strip_tags($status->source)); } unset($status); // Only embed images in suitable browsers if (EMBEDLY_KEY !== '' && setting_fetch('showthumbs', 'yes') == 'yes') { embedly_embed_thumbnails($feed); } foreach ($feed as $status) { $time = strtotime($status->created_at); if ($time > 0) { $date = twitter_date('l jS F Y', strtotime($status->created_at)); if ($date_heading !== $date) { $date_heading = $date; $rows[] = array('data' => array("{$date}"), 'class' => 'date'); } } else { $date = $status->created_at; } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $avatar = theme('avatar', img_proxy_url(theme_get_avatar($status->from))); if (substr($_GET['q'], 0, 4) == 'user' || setting_fetch('browser') == 'touch' || setting_fetch('browser', 'desktop') == 'desktop') { $source = $status->source ? " " . __("via") . " {$status->source}" : ''; } else { $source = $status->source ? " " . __("via") . " " . strip_tags($status->source) . "" : ''; } if ($status->in_reply_to_status_id_str) { $replyto = "<a href='" . BASE_URL . "status/{$status->in_reply_to_status_id_str}'>>></a>"; } else { $replyto = null; } if (setting_fetch('dispnick') == 'yes') { $showname = $status->from->name; } else { $showname = $status->from->screen_name; } $html = "<b class='suser'><a href='" . BASE_URL . "user/{$status->from->screen_name}'>{$showname}</a></b> "; if (setting_fetch('buttonend') == 'yes') { $html .= "<span class='stext'>{$status->text}</span><br /><small class='sbutton'>{$actions} {$link} "; } else { $html .= "<small class='sbutton'>{$actions}</small><br /><span class='stext'>{$status->text}</span><br /><small class='sbutton'>{$link}"; } $html .= " {$source} {$replyto}</small>"; if ($status->retweeted_by) { if (setting_fetch('dispnick') == 'yes') { $showrtname = $status->retweeted_by->user->name; } else { $showrtname = $status->retweeted_by->user->screen_name; } $retweeted_by = $status->retweeted_by->user->screen_name; $retweeted_times = $status->retweet_count; $retweeted_times_minus = is_numeric($retweeted_times) ? $retweeted_times - 1 : $retweeted_times; $retweeted_times_str = $retweeted_times && $retweeted_times_minus ? "+{$retweeted_times_minus}" : ""; $html .= " <small class='sretweet'>" . __("retweeted by") . " <a href='" . BASE_URL . "user/{$retweeted_by}'>{$showrtname}</a>{$retweeted_times_str} " . __("<span style='display:none;'>zhuanfa</span>") . "</small>"; } unset($row); $class = 'status'; if ($page != 'user' && $avatar) { $row[] = array('data' => $avatar, 'class' => 'avatar'); $class .= ' shift'; } $row[] = array('data' => $html, 'class' => $class); $class = 'tweet'; if ($page != 'replies' && twitter_is_reply($status)) { $class .= ' reply'; } $row = array('data' => $row, 'class' => $class); $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); if ($max_id) { if (function_exists('bcsub')) { $max_id = bcsub($max_id, '1'); } if (setting_fetch('browser') != 'blackberry' && !$hide_pagination) { $content .= theme('pagination', $max_id); } else { global $blackberry_pagination; $blackberry_pagination = theme('pagination', $max_id); } } return $content; }
function theme_search_results($feed) { $rows = array(); foreach ($feed->results as $status) { $text = twitter_parse_tags($status->text, $status->entities, $status->id_str); $link = theme('status_time_link', $status); $actions = theme('action_icons', $status); if (setting_fetch('avataro', 'yes') !== 'yes') { $row = array(theme('avatar', theme_get_avatar($status), htmlspecialchars($status->name, ENT_QUOTES, 'UTF-8')), "<a href='user/{$status->from_user}'>{$status->from_user}</a> {$actions} - {$link}<br />{$text}"); } else { $row = array("<a href='user/{$status->from_user}'>{$status->from_user}</a> {$actions} - {$link}<br />{$text}"); } if (twitter_is_reply($status)) { $row = array('class' => 'reply', 'data' => $row); } $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); $content .= theme('pagination'); return $content; }