-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjquery_update.patch
53 lines (50 loc) · 1.98 KB
/
jquery_update.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 53ffa1332d90b4bf2e5576d8ea3075c744d6f08e Mon Sep 17 00:00:00 2001
From: harryxu <harryzhxu@gmail.com>
Date: Fri, 1 Oct 2010 20:17:04 +0800
Subject: [PATCH] patch for last jquery
---
includes/common.inc | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/includes/common.inc b/includes/common.inc
index 2ca8c72..81552f0 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2496,9 +2496,33 @@ function drupal_to_js($var) {
return $var;
case 'resource':
case 'string':
- return '"'. str_replace(array("\r", "\n", "<", ">", "&"),
- array('\r', '\n', '\x3c', '\x3e', '\x26'),
- addslashes($var)) .'"';
+ // <<<< patch for last jquery
+ // see http://echodittolabs.org/blog/2010/08/drupal-6x-jquery-142-new-possibilities
+ // just install jquery_update module and copy last jquery to replace floder
+ //return '"'. str_replace(array("\r", "\n", "<", ">", "&"),
+ //array('\r', '\n', '\x3c', '\x3e', '\x26'),
+ //addslashes($var)) .'"';
+ static $replace_pairs;
+
+ if (!isset($replace_pairs)) {
+ $replace_pairs = array(
+ '\\' => '\u005c',
+ '<' => '\u003c',
+ '>' => '\u003e',
+ '&' => '\u0026',
+ '"' => '\u0022',
+ '/' => '\u002f',
+ "'" => '\u0027',
+ "\xe2\x80\xa8" => '\u2028', // Line Separator
+ "\xe2\x80\xa9" => '\u2029', // Paragraph Separator
+ );
+ // Remaining unicode replacements.
+ for ($i = 0; $i < 32; $i++) {
+ $replace_pairs[chr($i)] = '\u00' . sprintf("%02s", dechex($i));
+ }
+ }
+ return '"'. strtr($var, $replace_pairs) .'"';
+ // end patch >>>>
case 'array':
// Arrays in JSON can't be associative. If the array is empty or if it
// has sequential whole number keys starting with 0, it's not associative
--
1.7.1