Add clean_url filter. see #4570

git-svn-id: http://svn.automattic.com/wordpress/trunk@5952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-08-27 23:31:09 +00:00
parent f8d09ad828
commit 788512c881
2 changed files with 6 additions and 2 deletions

View File

@ -1074,6 +1074,8 @@ function wp_richedit_pre($text) {
}
function clean_url( $url, $protocols = null ) {
$original_url = $url;
if ('' == $url) return $url;
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url);
$strip = array('%0d', '%0a');
@ -1089,7 +1091,8 @@ function clean_url( $url, $protocols = null ) {
$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
return '';
return $url;
return apply_filters('clean_url', $url, $original_url);
}
// Borrowed from the PHP Manual user notes. Convert entities, while

View File

@ -1054,7 +1054,8 @@ function update_term_cache($terms, $taxonomy = '') {
//
function _get_term_hierarchy($taxonomy) {
// TODO Make sure taxonomy is hierarchical
if ( !is_taxonomy_hierarchical($taxonomy) )
return array();
$children = get_option("{$taxonomy}_children");
if ( is_array($children) )
return $children;