From 418ba348e83b526b62cdcae001c1984960e99d4b Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 6 Jul 2006 02:31:06 +0000 Subject: [PATCH] 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 --- wp-includes/functions-formatting.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 20eca83fd1..cd1493bddd 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -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); }