I tested adding this function to the module:
<?php
function convert_twitter_links($tweet)
{
//converts URLs to active links
$tweet = preg_replace('/((http)+(s)?:\/\/[^<>\s]+)/i', '<a href="$0" target="_blank">$0</a>', $tweet );
//converts mentions (e.g. @stathisg) to active links, pointing to the user's twitter profile
$tweet = preg_replace('/[@]+([A-Za-z0-9-_]+)/', '<a href="http://twitter.com/$1" target="_blank">$1</a>', $tweet );
//converts hashtags (e.g. #test) to active links, pointing to a twitter's search URL
$tweet = preg_replace('/[#]+([A-Za-z0-9-_]+)/', '<a href="http://twitter.com/search?q=%23$1" target="_blank">$0</a>', $tweet );
return $tweet;
}
and then called it like this:
$text = $this->convert_twitter_links($text);
Though, I had to put this line just below this line (this is within renderItem() definition ):
$text = wire('sanitizer')->entities($text);
I will guess I must be doing something wrong here not sanitizing this string before rendering it, but I can't really tell, I don't know much about this "entities" methods, so I will recommend taking this solution as unsafe or something like that until someone else gives a hand