Open GoogleCodeExporter opened 8 years ago
added the ability to turn @'s into links back to the user.
class Twitter_com {
function pre_db($item)
{
//all we want to do before twitter stuff gets added to the db is to remove the
username from the front of the title / content
$username = 'yongfook';
$item->item_title = str_replace($username.':', '', $item->item_title);
// Using Regex instead of hardcoding username
$item->item_title = preg_replace('/^\w+:\s/', '', $item->item_title);
// Look for @'s make them links to the user profile
$item->item_title = eregi_replace('((@)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','@<a
href="http://twitter.com/\\1" target="_blank">\\1</a>', $item->item_title);
$item->item_title = eregi_replace("/@", "/", $item->item_title);
$item->item_title = eregi_replace(">@", ">", $item->item_title);
//remove item_content as it's just the same as the title anyway
$item->item_content = '';
return $item;
}
function pre_display($item)
{
return $item;
}
}
Original comment by cronc...@gmail.com
on 31 Aug 2008 at 3:43
Original issue reported on code.google.com by
jm%grokc...@gtempaccount.com
on 30 Aug 2008 at 11:40