Add this to your BBCode.php extension (at the bottom.. anywhere really, just not in another function):
function AutoLink($String) { // autolink example from www.zend.com (Code Gallery ) by http://www.zend.com/search_code_author.php?author=goten return preg_replace("/(?<!<a href=\")(?<!\")(?<!\">)((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+)/","\\1",$String); }
Just to make sure that the comment //... all goes on one line when you copy and paste. There's no reason it shouldnt but if it doesnt then you need to move it onto one line or it'l break.
I'm having some issues with this.
It seems to only autolink links when in text-only mode. when I switch text-only off, the addresses are no longer linked.
(also, text-only mode removes the formatting bbcode too, like [b] and [i]. Is that normal? I'm new to setting up Vanilla)
Comments
For those that want to do it:
Add this to your BBCode.php extension (at the bottom.. anywhere really, just not in another function):
function AutoLink($String) {
// autolink example from www.zend.com (Code Gallery ) by http://www.zend.com/search_code_author.php?author=goten
return preg_replace("/(?<!<a href=\")(?<!\")(?<!\">)((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+)/","\\1",$String);
}
Then search for this:
}
return $String;
and above that add:
$String = $this->AutoLink($String);
That's it.