function twitter_status_page($query) { $id = (string) $query[1]; if (is_numeric($id)) { $request = API_URL . "statuses/show/{$id}.json?include_entities=true"; $status = twitter_process($request); $text = $status->text; // Grab the text before it gets formatted $content = theme('status', $status); // Show a link to the original tweet $screen_name = $status->from->screen_name; $content .= '<p><a href="https://mobile.twitter.com/' . $screen_name . '/status/' . $id . '" target="' . get_target() . '">View orginal tweet on Twitter</a> | '; // Translate the tweet $content .= '<a href="http://translate.google.com/m?hl=en&sl=auto&ie=UTF-8&q=' . urlencode($text) . '" target="' . get_target() . '">Translate this tweet</a></p>'; if (!$status->user->protected) { $thread = twitter_thread_timeline($id); } if ($thread) { $content .= '<p>And the experimental conversation view...</p>' . theme('timeline', $thread); $content .= "<p>Don't like the thread order? Go to <a href='settings'>settings</a> to reverse it. Either way - the dates/times are not always accurate.</p>"; } theme('page', "Status {$id}", $content); } }
function twitter_status_page($query) { $id = (string) $query[1]; if (is_numeric($id)) { $request = API_URL . "statuses/show/{$id}.json?include_entities=true"; $status = twitter_process($request); $content = theme('status', $status); if (!$status->user->protected) { $thread = twitter_thread_timeline($id); } if ($thread) { $content .= '<p>And the experimental conversation view...</p>' . theme('timeline', $thread); $content .= "<p>Don't like the thread order? Go to <a href='settings'>settings</a> to reverse it. Either way - the dates/times are not always accurate.</p>"; } theme('page', "Status {$id}", $content); } }
function twitter_status_page($query) { $id = (string) $query[1]; if (is_numeric($id)) { $request = API_URL . "statuses/show/{$id}.json?include_entities=true"; $status = twitter_process($request); $content = theme('status', $status); if (strcmp($query[2], '') == 0) { $status->id = $status->id_str; $threadrequest = API_URL . "related_results/show/{$id}.json?include_entities=true"; $threadstatus = twitter_process($threadrequest); if ($threadstatus && $threadstatus[0] && $threadstatus[0]->results) { $array = array_reverse($threadstatus[0]->results); $tl = array(); //$status = twitter_process($request); $status->user = $status->from; $tl[] = $status; foreach ($array as $key => $value) { $tl[] = $value->value; } $tl = twitter_standard_timeline($tl, 'status', true); $content .= '<p>Related results...</p>' . theme('timeline', $tl); } elseif (!$status->user->protected) { $thread = twitter_thread_timeline($id); if ($thread) { $content .= '<p>And the experimental conversation view...</p>' . theme('timeline', $thread); $content .= "<p>Don't like the thread order? Go to <a href='settings'>settings</a> to reverse it. Either way - the dates/times are not always accurate.</p>"; } } } elseif (strcmp($query[2], 'rl') == 0) { $rl_api = "http://readitlaterlist.com/v2/add?username="******"&password="******"&apikey=" . READ_IT_LATER_API_KEY; $rl_u = "http://twitter.com/" . $status->user->screen_name . "/status/" . $status->id_str; $rl_t = "Tweet+from+@" . $status->user->screen_name . ":+" . urlencode($status->text); $curl_url = "{$rl_api}&url={$rl_u}&title={$rl_t}"; $ret = twitter_fetch($curl_url); switch ($ret) { case '200 OK': $content .= "Tweet saved. Status: 200 OK"; break; case 100: $content .= "X-Limit-User-Limit. Error: 100"; break; case 43: $content .= "X-Limit-User-Remaining. Error: 43"; break; case 25: $content .= "X-Limit-User-Reset or X-Limit-Key-Reset. Error: 25"; break; case 5000: $content .= "X-Limit-Key-Limit. Error: 5000"; break; case 3520: $content .= "X-Limit-Key-Remaining. Error: 3520"; break; default: $content .= "ERROR: instead of response code 200, we got: {$ret}."; break; } } theme('page', "Status {$id}", $content); } }