| 598 | | $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret); |
|---|
| 599 | | $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret); |
|---|
| 600 | | $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $ret); |
|---|
| 601 | | $ret = substr($ret, 1); |
|---|
| | 598 | // in testing, using arrays here was found to be faster |
|---|
| | 599 | $ret = preg_replace( |
|---|
| | 600 | array( |
|---|
| | 601 | '#([\s>])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', |
|---|
| | 602 | '#([\s>])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', |
|---|
| | 603 | '#([\s>])([a-z0-9\-_.]+)@([^,< \n\r]+)#i'), |
|---|
| | 604 | array( |
|---|
| | 605 | '$1<a href="$2" rel="nofollow">$2</a>', |
|---|
| | 606 | '$1<a href="http://$2" rel="nofollow">$2</a>', |
|---|
| | 607 | '$1<a href="mailto:$2@$3">$2@$3</a>'),$ret); |
|---|
| | 608 | // this one is not in an array because we need it to run last, for cleanup of accidental links within links |
|---|
| | 609 | $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret); |
|---|