Changeset 4385
- Timestamp:
- 10/13/2006 06:01:14 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/functions-formatting.php
r4319 r4385 590 590 } 591 591 592 function make_clickable ($ret) {592 function make_clickable_mine4($ret) { 593 593 $ret = ' ' . $ret; 594 $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret); 595 $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret); 596 $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $ret); 597 $ret = substr($ret, 1); 594 // in testing, using arrays here was found to be faster 595 $ret = preg_replace( 596 array( 597 '#([\s>])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', 598 '#([\s>])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', 599 '#([\s>])([a-z0-9\-_.]+)@([^,< \n\r]+)#i'), 600 array( 601 '$1<a href="$2" rel="nofollow">$2</a>', 602 '$1<a href="http://$2" rel="nofollow">$2</a>', 603 '$1<a href="mailto:$2@$3">$2@$3</a>'),$ret); 604 // this one is not in an array because we need it to run last, for cleanup of accidental links within links 605 $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret); 598 606 $ret = trim($ret); 599 607 return $ret;
Note: See TracChangeset
for help on using the changeset viewer.