public static function formatTweets($status, $targetBlank = true, $linkMaxLen = 250)
{
$target = $targetBlank ? " target=\"_blank\" " : "";
// convert link to url
$status = preg_replace("/((http:\\/\\/|https:\\/\\/)[^ )\r\n]+)/e", "'<a href=\"\$1\" title=\"\$1\" {$target} >'. ((strlen('\$1')>={$linkMaxLen} ? substr('\$1',0,{$linkMaxLen}).'...':'\$1')).'</a>'", $status);
// convert @ to follow
$status = preg_replace("/(@([_a-z0-9\\-]+))/i", "<a href=\"http://twitter.com/\$2\" title=\"Follow \$2\" {$target} >\$1</a>", $status);
// convert # to search
$status = preg_replace("/(#([_a-z0-9\\-\\.]+))/i", "<a href=\"http://search.twitter.com/search?q=%23\$2\" title=\"Search \$1\" {$target} >\$1</a>", $status);
return $status;
}