WordPress.org

Make WordPress Core

Ticket #16892: 16892.patch

File 16892.patch, 1.2 KB (added by hakre, 3 years ago)

Help the Regex Compiler

  • wp-includes/formatting.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    13861386function make_clickable($ret) { 
    13871387        $ret = ' ' . $ret; 
    13881388        // in testing, using arrays here was found to be faster 
    1389         $ret = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
     1389        $ret = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]{1,4}?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]{1,2000}|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
    13901390        $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 
    13911391        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 
    13921392        // this one is not in an array because we need it to run last, for cleanup of accidental links within links