function fetch_tweets($num_tweets, $username, $tweet_reset_time){ // $tweets = curl("https://api.twitter.com/1/statuses/user_timeline/square44.json"); // $tweets = curl("https://api.twitter.com/1/statuses/user_timeline/jbrooksuk.json"); // var_dump($username); // $tweets = curl("http://api.twitter.com/1/statuses/user_timeline/$username.json"); global $id; $recent_tweets = get_post_meta($id, 'mh_recent_tweets'); reset_data($recent_tweets, $tweet_reset_time); // delete_post_meta($id, 'mh_recent_tweets'); die(); // print_r($recent_tweets); die(); // if no cache, fetch new tweets and cache. if(empty($recent_tweets)) { $tweets = curl($username,$num_tweets); // $tweets = curl("https://twitter.com/statuses/user_timeline/$username.json"); // var_dump('hi iam from fetch_tweets'); // var_dump($tweets); // echo "<pre>"; // print_r($tweets); // echo "</pre>"; $data = array(); foreach ($tweets as $tweet) { if($num_tweets-- === 0) break; $data[] = $tweet->text; } $recent_tweets = array( (int)date('i', time())); $recent_tweets[] = '<ul class="mh_tweets"><li>' . implode('</li><li>', $data). '</li><ul>'; cache($recent_tweets); } return isset($recent_tweets[0][1]) ? $recent_tweets[0][1] : $recent_tweets[1]; }
function fetch_tweets($num_tweets, $username, $tweet_reset_time){ global $id; $recent_tweets = get_post_meta($id, 'mh_recent_tweets'); reset_data($recent_tweets, $tweet_reset_time); if(empty($recent_tweets)) { $tweets = curl($username,$num_tweets); $data = array(); foreach ($tweets as $tweet) { if($num_tweets-- === 0) break; $data[] = $tweet->text; } $recent_tweets = array( (int)date('i', time())); $recent_tweets[] = '<ul class="mh_tweets"><li>' . implode('</li><li>', $data). '</li><ul>'; cache($recent_tweets); } return isset($recent_tweets[0][1]) ? $recent_tweets[0][1] : $recent_tweets[1]; }
function reprocess_all_mail($start = 0) { if ($start == 0) { reset_data(); } $output = array(); global $ft; $ids = $ft->dbh->_select_column('SELECT mailid FROM tbl:rawmail WHERE mailid >= ? ORDER BY mailid LIMIT 10', array($start)); foreach ($ids as $id) { $mail = $ft->dbh->_select_one('SELECT mail FROM tbl:rawmail WHERE mailid = ?', array($id)); if ($mail) { $obj = new KillMail($mail, $id); if ($obj->parsed) { array_push($output, array('ok', "<a href='/killmail.php?killid={$id}&raw=1'>Mail #{$id}</a> " . "processed: " . $obj->victim->pilot . " lost a " . $obj->victim->ship . " in " . $obj->system . ".", $id)); $obj->adjust_totals(); } else { array_push($output, array('err', "<a href='/killmail.php?killid={$id}&raw=1'>Mail #{$id}</a> failed to process.", $id)); } } } return $output; }