function theme_timeline($feed, $paginate = true) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities); } unset($status); // Only embed images if user hasn't hidden them if (setting_fetch('show_oembed')) { oembed_embed_thumbnails($feed); } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $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; } if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $retweeted = "<br /><small>RT by <a href='{$retweeted_by}'>{$retweeted_by}</a></small>"; } else { $retweeted = ""; } $text = $status->text; if ("yes" != setting_fetch('hide_inline')) { $media = twitter_get_media($status); } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); if ("yes" != setting_fetch('hide_avatars')) { $avatar = theme('avatar', theme_get_avatar($status->from)); } $source = ""; if ($status->in_reply_to_status_id) { $source .= "In reply to <a href='status/{$status->in_reply_to_status_id_str}'>{$status->in_reply_to_screen_name}</a>."; } if ($status->place->name) { $source .= " " . theme('action_icon', "https://maps.google.com/maps?q=" . urlencode("{$status->place->name},{$status->place->country}"), "<span class='icons' title='location'>⌖</span> {$status->place->name}, {$status->place->country}.", 'MAP'); } //need to replace & in links with &s and force new window on links if ($status->source) { $source .= " Via " . str_replace('rel="nofollow"', 'target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) . "."; } // $source .= " " . $status->source ? " Via ".str_replace('rel="nofollow"', 'target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) . "." : ''; // Build up the status to display $html = "<b>" . theme_full_name($status->from) . "</b>\n\t\t {$link}\n\t\t {$retweeted}\n\t\t <br />\n\t\t {$text}\n\t\t <br />{$media}\n\t\t {$actions} \n\t\t <span class='from'>{$source}</span>"; unset($row); $class = 'status'; if ($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 (!$hide_pagination) { if ($paginate) { if ($page == 'some-unknown-method-which-doesnt-take-max_id') { $content .= theme('pagination'); } else { if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $content .= theme('pagination', $max_id); } } } return $content; }
function theme_timeline($feed, $paginate = true) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities); } unset($status); // Only embed images in suitable browsers if (!setting_fetch('hide_inline') && !in_array(setting_fetch('browser'), array('text', 'worksafe'))) { embedly_embed_thumbnails($feed); } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $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; } $text = $status->text; if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { $media = twitter_get_media($status); } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $avatar = theme('avatar', theme_get_avatar($status->from)); $source = $status->source ? " from " . str_replace('rel="nofollow"', 'rel="nofollow" target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) : ''; //need to replace & in links with &s and force new window on links if ($status->place->name) { $source .= ", " . $status->place->name . ", " . $status->place->country; } if ($status->in_reply_to_status_id) { $source .= ", in reply to <a href='status/{$status->in_reply_to_status_id_str}'>{$status->in_reply_to_screen_name}</a>"; } if ($status->retweet_count) { $source .= ", <a href='retweeted_by/{$status->id}'>retweeted " . x_times($status->retweet_count) . "</a>"; } $retweeted = ''; if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $retweeted = "<br /><small>" . theme('action_icon', "retweeted_by/{$status->id}", 'images/retweet.png', 'RT') . "retweeted by <a href='user/{$retweeted_by}'>{$retweeted_by}</a></small>"; //$source .= "<br /><a href='retweeted_by/{$status->id}'>retweeted</a> by <a href='user/{$retweeted_by}'>{$retweeted_by}</a>"; } if ($status->favorite_count) { $source .= ', favourited ' . x_times($status->favorite_count); } //$html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> $actions $link<br />{$text}<br />$media<small>$source</small>"; $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}{$retweeted}<br />{$text}<br />{$media}<span class='from'>{$source}</span>"; unset($row); $class = 'status'; if ($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 (!$hide_pagination) { if ($paginate) { if ($page == 'some-unknown-method-which-doesnt-take-max_id') { $content .= theme('pagination'); } else { if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $content .= theme('pagination', $max_id); } } } return $content; }
function theme_timeline($feed) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities); } unset($status); // Only embed images in suitable browsers if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { if (EMBEDLY_KEY !== '') { embedly_embed_thumbnails($feed); } } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $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; } $text = $status->text; if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { $media = twitter_get_media($status); } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $avatar = theme('avatar', theme_get_avatar($status->from)); $source = $status->source ? " from " . str_replace('rel="nofollow"', 'rel="nofollow" target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) : ''; //need to replace & in links with &s and force new window on links if ($status->place->name) { $source .= " " . $status->place->name . ", " . $status->place->country; } if ($status->in_reply_to_status_id) { $source .= " <a href='status/{$status->in_reply_to_status_id_str}'>in reply to {$status->in_reply_to_screen_name}</a>"; } if ($status->retweet_count) { $source .= " <a href='retweeted_by/{$status->id}'>retweeted "; switch ($status->retweet_count) { case 1: $source .= "once</a>"; break; case 2: $source .= "twice</a>"; break; default: $source .= $status->retweet_count . " times</a>"; } } if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $source .= "<br /><a href='retweeted_by/{$status->id}'>retweeted</a> by <a href='user/{$retweeted_by}'>{$retweeted_by}</a>"; } $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}<br />{$text}<br />{$media}<small>{$source}</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 ($page != '' && !$hide_pagination) { $content .= theme('pagination'); } else { if (!$hide_pagination) { //Doesn't work. since_id returns the most recent tweets up to since_id, not since. Grrr //$links[] = "<a href='{$_GET['q']}?since_id=$since_id'>Newer</a>"; if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $links[] = "<a href='{$_GET['q']}?max_id={$max_id}' accesskey='9'>Older</a> 9"; $content .= '<p>' . implode(' | ', $links) . '</p>'; } } return $content; }
function theme_timeline($feed) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities, $status->id_str); } unset($status); //Add in images if (EMBEDLY_KEY !== '') { embedly_embed_thumbnails($feed); } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $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; } // Old Filter /* if ((setting_fetch('filtero', 'no') == 'yes') && twitter_timeline_filter($status->text)) { $text = "<a href='status/{$status->id}' class='filter'><span class='texts'>[Tweet Filtered]</span></a>"; } else { $text = $status->text; setting_fetch('hide_inline') || $media = twitter_get_media($status); } */ $text = $status->text; setting_fetch('hide_inline') || setting_fetch('filtero', 'no') == 'yes' || setting_fetch('filterc') || ($media = twitter_get_media($status)); setting_fetch('buttontime', 'yes') == 'yes' && ($link = theme('status_time_link', $status, !$status->is_direct)); $actions = theme('action_icons', $status); if (setting_fetch('avataro', 'yes') !== 'yes') { $avatar = theme('avatar', theme_get_avatar($status->from), htmlspecialchars($status->from->name, ENT_QUOTES, 'UTF-8')); } if (setting_fetch('buttonfrom', 'yes') == 'yes') { if (substr($_GET['q'], 0, 4) == 'user' || setting_fetch('browser') == 'touch' || setting_fetch('browser') == 'desktop' || setting_fetch('browser') == 'bigtouch') { $source = $status->source ? " via " . str_replace('rel="nofollow"', 'rel="external nofollow noreferrer"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) : ''; //need to replace & in links with &s and force new window on links } else { $source = $status->source ? " via " . strip_tags($status->source) . "" : ''; } } else { $source = NULL; } if ($status->place->name) { $source .= " " . $status->place->name . ", " . $status->place->country; } if ($status->in_reply_to_status_id) { $source .= " <a href='status/{$status->in_reply_to_status_id_str}'>in reply to {$status->in_reply_to_screen_name}</a>"; } if ($status->retweet_count) { $source .= " <a href='retweeted_by/{$status->id}'>retweeted "; switch ($status->retweet_count) { case 1: $source .= "once</a>"; break; case 2: $source .= "twice</a>"; break; //Twitter are uncapping the retweet count (https://dev.twitter.com/discussions/5129) will need to correctly format large numbers //Twitter are uncapping the retweet count (https://dev.twitter.com/discussions/5129) will need to correctly format large numbers case is_int($status->retweet_count): $source .= number_format($status->retweet_count) . " times</a>"; break; //Legacy for old tweets where the retweet count is a string (usually "100+") //Legacy for old tweets where the retweet count is a string (usually "100+") default: $source .= $status->retweet_count . " times</a>"; } } if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $source .= "<br /><a href='retweeted_by/{$status->id}'>retweeted</a> by <a href='user/{$retweeted_by}'>{$retweeted_by}</a>"; } $html = "<span class='textb'><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></span> {$actions} <span class='texts'>{$link}</span><br />{$text}<br />{$media}<span class='texts'>{$source}</span>"; 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 ($page != '' && !$hide_pagination) { $content .= theme('pagination'); } else { if (!$hide_pagination) { //Doesn't work. since_id returns the most recent tweets up to since_id, not since. Grrr //$links[] = "<a href='{$_GET['q']}?since_id=$since_id'>Newer</a>"; if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $links[] = "<a href='{$_GET['q']}?max_id={$max_id}' accesskey='9'>Older</a> 9"; $content .= '<p>' . implode(' | ', $links) . '</p>'; } } return $content; }