WordPress.org

Make WordPress Core

Ticket #11211: make_clickable.11211.diff

File make_clickable.11211.diff, 1.1 KB (added by filosofo, 4 years ago)
  • wp-includes/formatting.php

     
    13311331function make_clickable($ret) { 
    13321332        $ret = ' ' . $ret; 
    13331333        // in testing, using arrays here was found to be faster 
    1334         $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
     1334        $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
    13351335        $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 
    13361336        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 
    13371337        // this one is not in an array because we need it to run last, for cleanup of accidental links within links