Changeset 16948
- Timestamp:
- 12/15/2010 01:43:30 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r16692 r16948 1313 1313 function _make_url_clickable_cb($matches) { 1314 1314 $url = $matches[2]; 1315 $suffix = ''; 1316 1317 /** Include parentheses in the URL only if paired **/ 1318 while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { 1319 $suffix = strrchr( $url, ')' ) . $suffix; 1320 $url = substr( $url, 0, strrpos( $url, ')' ) ); 1321 } 1315 1322 1316 1323 $url = esc_url($url); … … 1318 1325 return $matches[0]; 1319 1326 1320 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" ;1327 return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; 1321 1328 } 1322 1329 … … 1380 1387 $ret = ' ' . $ret; 1381 1388 // in testing, using arrays here was found to be faster 1382 $ret = preg_replace_callback('#(?< =[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](!+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);1389 $ret = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 1383 1390 $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 1384 1391 $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
Note: See TracChangeset
for help on using the changeset viewer.