Ticket #3515: proto.diff

File proto.diff, 0.9 kB (added by andy, 2 years ago)
  • wp-includes/formatting.php

    old new  
    10561056        return apply_filters('richedit_pre', $output); 
    10571057} 
    10581058 
    1059 function clean_url( $url ) { 
     1059function clean_url( $url, $protocols = null ) { 
    10601060        if ('' == $url) return $url; 
    10611061        $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url); 
    10621062        $strip = array('%0d', '%0a'); 
     
    10641064        $url = str_replace(';//', '://', $url); 
    10651065        $url = (!strstr($url, '://')) ? 'http://'.$url : $url; 
    10661066        $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); 
     1067        if ( !is_array($protocols) ) 
     1068                $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');  
     1069        if ( wp_kses_bad_protocol( $url, $protocols ) != $url ) 
     1070                return ''; 
    10671071        return $url; 
    10681072} 
    10691073