'.'
'.''.'';
}
}
// Helper funtion to the twitter function. This fixes the hyperlinks in the tweets so the URL's work
function formatTweet($tweet) {
$tweet = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1\\2", $tweet);
$tweet = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1\\2", $tweet);
$tweet = preg_replace("/@(\w+)/", "@\\1", $tweet);
$tweet = preg_replace("/#(\w+)/", "#\\1", $tweet);
return $tweet;
}
// Helper function to the twitter function. This gets the elapsed time since the tweet was posted
function get_elapsedtime($time)
{
$gap = time() - $time;
if ($gap < 5) {
return 'less than 5 seconds ago';
} else if ($gap < 10) {
return 'less than 10 seconds ago';
} else if ($gap < 20) {
return 'less than 20 seconds ago';
} else if ($gap < 40) {
return 'half a minute ago';
} else if ($gap < 60) {
return 'less than a minute ago';
}
$gap = round($gap / 60);
if ($gap < 60) {
return $gap.' minute'.($gap > 1 ? 's' : '').' ago';
}
$gap = round($gap / 60);
if ($gap < 24) {
return 'about '.$gap.' hour'.($gap > 1 ? 's' : '').' ago';
}
return date('H:i M jS, Y', $time);
}
?>