Ticket #18268: esc_url-protocols.patch
| File esc_url-protocols.patch, 1.9 KB (added by , 15 years ago) |
|---|
-
formatting.php
2250 2250 2251 2251 if ( '' == $url ) 2252 2252 return $url; 2253 $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);2254 $strip = array( '%0d', '%0a', '%0D', '%0A');2255 $url = _deep_replace( $strip, $url);2256 $url = str_replace( ';//', '://', $url);2253 $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url ); 2254 $strip = array( '%0d', '%0a', '%0D', '%0A' ); 2255 $url = _deep_replace( $strip, $url ); 2256 $url = str_replace( ';//', '://', $url ); 2257 2257 /* If the URL doesn't appear to contain a scheme, we 2258 2258 * presume it needs http:// appended (unless a relative 2259 2259 * link starting with /, # or ? or a php file). 2260 2260 */ 2261 if ( strpos( $url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&2262 ! preg_match( '/^[a-z0-9-]+?\.php/i', $url) )2261 if ( strpos( $url, ':' ) === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && 2262 ! preg_match( '/^[a-z0-9-]+?\.php/i', $url ) ) 2263 2263 $url = 'http://' . $url; 2264 2264 2265 2265 // Replace ampersands and single quotes only when displaying. … … 2269 2269 $url = str_replace( "'", ''', $url ); 2270 2270 } 2271 2271 2272 if ( !is_array( $protocols) )2273 $protocols = a rray ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn');2272 if ( !is_array( $protocols ) ) 2273 $protocols = apply_filters( 'esc_url_protocols', array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'callto', 'tel', 'sms', 'fax' ) ); 2274 2274 if ( wp_kses_bad_protocol( $url, $protocols ) != $url ) 2275 2275 return ''; 2276 2276 2277 return apply_filters( 'clean_url', $url, $original_url, $_context);2277 return apply_filters( 'clean_url', $url, $original_url, $_context ); 2278 2278 } 2279 2279 2280 2280 /**
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)