From 48120ed74b24a5ba9fe514671898a39f6025b46a Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 27 Aug 2007 23:31:09 +0000 Subject: [PATCH] Add clean_url filter. see #4570 git-svn-id: https://develop.svn.wordpress.org/trunk@5952 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 5 ++++- wp-includes/taxonomy.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 3a48c2684b..caf2c53439 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -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 diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index d772b388de..ba136ad72a 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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;