Ticket #8300: wp-includes--formatting.php.2.diff
| File wp-includes--formatting.php.2.diff, 1.7 KB (added by josephscott, 4 years ago) |
|---|
-
wp-includes/formatting.php
964 964 * @return string HTML A element with URI address. 965 965 */ 966 966 function _make_url_clickable_cb($matches) { 967 // If the URL string started with a ( and ended with a ) then 968 // don't include the trailing ) as part of the URL. 969 $last_char = ''; 970 if( $matches[1] == '(' ) { 971 if( substr( $matches[2], -1 ) == ')' ) { 972 $matches[2] = substr( $matches[2], 0, -1 ); 973 $last_char = ')'; 974 } 975 } 976 967 977 $ret = ''; 968 978 $url = $matches[2]; 969 979 $url = clean_url($url); … … 974 984 $ret = substr($url, -1); 975 985 $url = substr($url, 0, strlen($url)-1); 976 986 } 977 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret ;987 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret . $last_char; 978 988 } 979 989 980 990 /** … … 1035 1045 function make_clickable($ret) { 1036 1046 $ret = ' ' . $ret; 1037 1047 // in testing, using arrays here was found to be faster 1038 $ret = preg_replace_callback('#([\s> ])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_url_clickable_cb', $ret);1048 $ret = preg_replace_callback('#([\s>(])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]()+]*)#is', '_make_url_clickable_cb', $ret); 1039 1049 $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_web_ftp_clickable_cb', $ret); 1040 1050 $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 1041 1051 // this one is not in an array because we need it to run last, for cleanup of accidental links within links
