Changeset 4672
- Timestamp:
- 01/02/2007 09:22:41 PM (18 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/comment-functions.php
r4656 r4672 212 212 do_action('wp_set_comment_status', $comment_id, 'delete'); 213 213 return true; 214 }215 216 function clean_url( $url ) {217 if ('' == $url) return $url;218 $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $url);219 $strip = array('%0d', '%0a');220 $url = str_replace($strip, '', $url);221 $url = str_replace(';//', '://', $url);222 $url = (!strstr($url, '://')) ? 'http://'.$url : $url;223 $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);224 return $url;225 214 } 226 215 -
branches/2.0/wp-includes/functions-formatting.php
r4663 r4672 1046 1046 } 1047 1047 1048 function clean_url( $url, $protocols = null ) { 1049 if ('' == $url) return $url; 1050 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url); 1051 $strip = array('%0d', '%0a'); 1052 $url = str_replace($strip, '', $url); 1053 $url = str_replace(';//', '://', $url); 1054 $url = (!strstr($url, '://')) ? 'http://'.$url : $url; 1055 $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); 1056 if ( !is_array($protocols) ) 1057 $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'); 1058 if ( wp_kses_bad_protocol( $url, $protocols ) != $url ) 1059 return ''; 1060 return $url; 1061 } 1062 1048 1063 // Escape single quotes, specialchar double quotes, and fix line endings. 1049 1064 function js_escape($text) { -
trunk/wp-includes/formatting.php
r4669 r4672 1057 1057 } 1058 1058 1059 function clean_url( $url ) {1059 function clean_url( $url, $protocols = null ) { 1060 1060 if ('' == $url) return $url; 1061 1061 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url); … … 1065 1065 $url = (!strstr($url, '://')) ? 'http://'.$url : $url; 1066 1066 $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 ''; 1067 1071 return $url; 1068 1072 }
Note: See TracChangeset
for help on using the changeset viewer.