http://www.wjunction.com/showthread.php?t=42226
function bbcode_second_pass_code($type, $code)
$code = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $code);
Did you try this?
Code:http://www.wjunction.com/showthread.php?t=42226
I'm pretty sure he means he wants to have the links clickable server-side, not client-side like GreaseMonkey script functions.
You can check the includes\bbcode.php file, look for
Add the following line after the three lines starting with $code:PHP:function bbcode_second_pass_code($type, $code)
note: I just looked around and did this quick and dirty, if there is another better way to do it - please post :DPHP:$code = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $code);
EDIT: Fixed the RegEx that it also catches a dash (-)![]()
I'm pretty sure he means he wants to have the links clickable server-side, not client-side like GreaseMonkey script functions.
You can check the includes\bbcode.php file, look for
Add the following line after the three lines starting with $code:PHP:function bbcode_second_pass_code($type, $code)
note: I just looked around and did this quick and dirty, if there is another better way to do it - please post :DPHP:$code = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $code);
EDIT: Fixed the RegEx that it also catches a dash (-)![]()
$code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');
// make links clickable in [ code ] tags / 4seven / 2010
preg_match_all("#(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\#\./-~-]*)?#is", $code, $find_urls2);
$find_urls2[0] = preg_replace('#http:\/\/#is', '', $find_urls2[0]);
$code = str_replace('http://', '', $code);
foreach ($find_urls2[0] as $urls1)
{
$code = str_replace($urls1, "<a href='http://$urls1'>$urls1</a>", $code);
}
$code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');
// make links clickable in [ code ] tags / 4seven / 2010