mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Normalize the UTF-8 and ISO-8859-1 charset strings stored in blog_charset to make them friendlier with PHP functions that accept a charset such as htmlspecialchars().
fixes #23688 git-svn-id: http://core.svn.wordpress.org/trunk@24510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5744245cc3
commit
419fea1a16
@ -179,6 +179,7 @@ add_filter( 'the_author', 'ent2ncr', 8 );
|
|||||||
// Misc filters
|
// Misc filters
|
||||||
add_filter( 'option_ping_sites', 'privacy_ping_filter' );
|
add_filter( 'option_ping_sites', 'privacy_ping_filter' );
|
||||||
add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
|
add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
|
||||||
|
add_filter( 'option_blog_charset', '_canonical_charset' );
|
||||||
add_filter( 'option_home', '_config_wp_home' );
|
add_filter( 'option_home', '_config_wp_home' );
|
||||||
add_filter( 'option_siteurl', '_config_wp_siteurl' );
|
add_filter( 'option_siteurl', '_config_wp_siteurl' );
|
||||||
add_filter( 'tiny_mce_before_init', '_mce_set_direction' );
|
add_filter( 'tiny_mce_before_init', '_mce_set_direction' );
|
||||||
|
@ -3998,3 +3998,25 @@ function get_tag_regex( $tag ) {
|
|||||||
return;
|
return;
|
||||||
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
|
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a canonical form of the provided charset appropriate for passing to PHP
|
||||||
|
* functions such as htmlspecialchars() and charset html attributes.
|
||||||
|
*
|
||||||
|
* @link http://core.trac.wordpress.org/ticket/23688
|
||||||
|
* @since 3.6.0
|
||||||
|
*
|
||||||
|
* @param string A charset name
|
||||||
|
* @return string The canonical form of the charset
|
||||||
|
*/
|
||||||
|
function _canonical_charset( $charset ) {
|
||||||
|
if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
|
||||||
|
'UTF8' === $charset )
|
||||||
|
return 'UTF-8';
|
||||||
|
|
||||||
|
if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
|
||||||
|
'iso8859-1' === $charset || 'ISO8859-1' === $charset )
|
||||||
|
return 'ISO-8859-1';
|
||||||
|
|
||||||
|
return $charset;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user