js_escape() in onclicks. fixes #2851

git-svn-id: https://develop.svn.wordpress.org/trunk@3907 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-06-24 01:28:08 +00:00
parent ce51707da2
commit deac9fea9d
5 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -1044,6 +1044,8 @@ function htmlentities2($myHTML) {
// Escape single quotes, specialchar double quotes, and fix line endings.
function js_escape($text) {
$text = wp_specialchars($text, 'double');
return preg_replace("/\r?\n/", "\\n", addslashes($text));
$text = str_replace(''', "'", $text);
return preg_replace("/\r?\n/", "\\n", addslashes($text));
}
?>