From 70902a4e04310ac6bffe28cf5cd21be656ee1200 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 22 Dec 2006 05:27:45 +0000 Subject: [PATCH] Add js_escape and attribute_escape filters. git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4661 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 19ca1ba1a2..ef5c80b5fd 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -1046,14 +1046,16 @@ function wp_richedit_pre($text) { // Escape single quotes, specialchar double quotes, and fix line endings. function js_escape($text) { - $text = wp_specialchars($text, 'double'); - $text = str_replace(''', "'", $text); - return preg_replace("/\r?\n/", "\\n", addslashes($text)); + $safe_text = wp_specialchars($text, 'double'); + $safe_text = str_replace(''', "'", $safe_text); + $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text)); + return apply_filters('js_escape', $safe_text, $text); } // Escaping for HTML attributes function attribute_escape($text) { - return wp_specialchars($text, true); + $safe_text = wp_specialchars($text, true); + return apply_filters('attribute_escape', $safe_text, $text); } ?>