Add single/double support to wp_specialchars(). Backported from trunk.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
74302dc057
commit
418ba348e8
|
@ -98,10 +98,14 @@ function seems_utf8($Str) { # by bmorel at ssi dot fr
|
|||
|
||||
function wp_specialchars( $text, $quotes = 0 ) {
|
||||
// Like htmlspecialchars except don't double-encode HTML entities
|
||||
$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);-
|
||||
$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);
|
||||
$text = str_replace('<', '<', $text);
|
||||
$text = str_replace('>', '>', $text);
|
||||
if ( $quotes ) {
|
||||
if ( 'double' === $quotes ) {
|
||||
$text = str_replace('"', '"', $text);
|
||||
} elseif ( 'single' === $quotes ) {
|
||||
$text = str_replace("'", ''', $text);
|
||||
} elseif ( $quotes ) {
|
||||
$text = str_replace('"', '"', $text);
|
||||
$text = str_replace("'", ''', $text);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue