Ticket #4411: clean_url.diff
| File clean_url.diff, 1.7 KB (added by ryan, 5 years ago) |
|---|
-
wp-includes/formatting.php
1075 1075 return apply_filters('richedit_pre', $output); 1076 1076 } 1077 1077 1078 function clean_url( $url, $protocols = null ) {1078 function clean_url( $url, $protocols = null, $context = 'display' ) { 1079 1079 if ('' == $url) return $url; 1080 1080 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url); 1081 1081 $strip = array('%0d', '%0a'); … … 1085 1085 if ( strpos($url, '://') === false && 1086 1086 substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) 1087 1087 $url = 'http://' . $url; 1088 1089 $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); 1088 1089 if ( 'display' == $context ) 1090 $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); 1090 1091 if ( !is_array($protocols) ) 1091 1092 $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'); 1092 1093 if ( wp_kses_bad_protocol( $url, $protocols ) != $url ) -
wp-includes/widgets.php
872 872 $options = $newoptions = get_option('widget_rss'); 873 873 if ( $_POST["rss-submit-$number"] ) { 874 874 $newoptions[$number]['items'] = (int) $_POST["rss-items-$number"]; 875 $url = clean_url(strip_tags(stripslashes($_POST["rss-url-$number"])) );875 $url = clean_url(strip_tags(stripslashes($_POST["rss-url-$number"])), '', 'save'); 876 876 $newoptions[$number]['title'] = trim(strip_tags(stripslashes($_POST["rss-title-$number"]))); 877 877 if ( $url !== $options[$number]['url'] ) { 878 878 require_once(ABSPATH . WPINC . '/rss.php');
