mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 23:57:41 +02:00
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:
parent
f8d09ad828
commit
788512c881
@ -1074,6 +1074,8 @@ function wp_richedit_pre($text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clean_url( $url, $protocols = null ) {
|
function clean_url( $url, $protocols = null ) {
|
||||||
|
$original_url = $url;
|
||||||
|
|
||||||
if ('' == $url) return $url;
|
if ('' == $url) return $url;
|
||||||
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url);
|
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url);
|
||||||
$strip = array('%0d', '%0a');
|
$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');
|
$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
|
||||||
if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
|
if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
|
||||||
return '';
|
return '';
|
||||||
return $url;
|
|
||||||
|
return apply_filters('clean_url', $url, $original_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Borrowed from the PHP Manual user notes. Convert entities, while
|
// Borrowed from the PHP Manual user notes. Convert entities, while
|
||||||
|
@ -1054,7 +1054,8 @@ function update_term_cache($terms, $taxonomy = '') {
|
|||||||
//
|
//
|
||||||
|
|
||||||
function _get_term_hierarchy($taxonomy) {
|
function _get_term_hierarchy($taxonomy) {
|
||||||
// TODO Make sure taxonomy is hierarchical
|
if ( !is_taxonomy_hierarchical($taxonomy) )
|
||||||
|
return array();
|
||||||
$children = get_option("{$taxonomy}_children");
|
$children = get_option("{$taxonomy}_children");
|
||||||
if ( is_array($children) )
|
if ( is_array($children) )
|
||||||
return $children;
|
return $children;
|
||||||
|
Loading…
Reference in New Issue
Block a user