WordPress.org

Make WordPress Core

Ticket #8300: make_clickable_parenthesis.diff

File make_clickable_parenthesis.diff, 982 bytes (added by filosofo, 5 years ago)
  • wp-includes/formatting.php

     
    10351035function make_clickable($ret) { 
    10361036        $ret = ' ' . $ret; 
    10371037        // 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); 
     1038        $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\](+]|(?(1)\)[^\s<]|\)))*)#is', '_make_url_clickable_cb', $ret); 
    10391039        $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_web_ftp_clickable_cb', $ret); 
    10401040        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 
    10411041        // this one is not in an array because we need it to run last, for cleanup of accidental links within links