Hi all,
find attached a tiny patch to Javascript::object() for quoting string
values. I ended up with
["He said: "Nevermind." and turned away."]
The patch makes that
["He said: \"Nevermind.\" and turned away."]
Thanks
Markus
--
Markus Bertheau <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---
Index: cake/libs/view/helpers/javascript.php
===================================================================
--- cake/libs/view/helpers/javascript.php (revision 24)
+++ cake/libs/view/helpers/javascript.php (working copy)
@@ -270,7 +270,7 @@
$val = $this->object($val, false, '', '', $stringKeys, $quoteKeys, $q);
} else {
if ((!count($stringKeys) && !is_numeric($val) && !is_bool($val)) || ($quoteKeys && in_array($key, $stringKeys)) || (!$quoteKeys && !in_array($key, $stringKeys))) {
- $val = $q . $val . $q;
+ $val = $q . r($q, "\\".$q, $val) . $q;
}
if (trim($val) == '') {
$val = 'null';
@@ -307,4 +307,4 @@
}
}
-?>
\ No newline at end of file
+?>