Ticket #10990: make_clickable_end_chars.10990.diff
| File make_clickable_end_chars.10990.diff, 1.5 KB (added by , 16 years ago) |
|---|
-
wp-includes/formatting.php
1186 1186 function _make_url_clickable_cb($matches) { 1187 1187 $url = $matches[2]; 1188 1188 1189 $after = '';1190 if ( preg_match( '|(.+?)([).,;:]*)$|', $url, $split ) ) {1191 $url = $split[1];1192 $after = $split[2];1193 }1194 1195 1189 $url = esc_url($url); 1196 1190 if ( empty($url) ) 1197 1191 return $matches[0]; 1198 1192 1199 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a> $after";1193 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>"; 1200 1194 } 1201 1195 1202 1196 /** … … 1258 1252 function make_clickable($ret) { 1259 1253 $ret = ' ' . $ret; 1260 1254 // in testing, using arrays here was found to be faster 1261 $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/ \-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);1255 $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<\)]|$)|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret); 1262 1256 $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 1263 1257 $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 1264 1258 // this one is not in an array because we need it to run last, for cleanup of accidental links within links