ho trovato in rete questa soluzione,che sembra funzionare.
Codice PHP:
<?
function makeClickableLinks($text)
{
$text = html_entity_decode($text);
$text = " ".$text;
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'[url="\\1"]\\1[/url]', $text);
$text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'[url="\\1"]\\1[/url]', $text);
$text = eregi_replace('([[:space:]()[{}])([url]www.[/url][-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1[url="http://\\2"]\\2[/url]', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
'[email="\\1"]\\1[/email]', $text);
return $text;
}
// Example Usage
echo makeClickableLinks("This is a test clickable link: [url]http://www.miosito.com[/url] You can also try using an email address like [email]test@miosito.com[/email]");
?>