Changeset 4386
- Timestamp:
- 10/13/2006 06:01:33 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r4380 r4386 594 594 } 595 595 596 function make_clickable ($ret) {596 function make_clickable_mine4($ret) { 597 597 $ret = ' ' . $ret; 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); 602 610 $ret = trim($ret); 603 611 return $ret;
Note: See TracChangeset
for help on using the changeset viewer.