summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2007-08-28 15:18:05 +0000
committerThomas BrĂ¼derli2007-08-28 15:18:05 +0000
commita61b8eafb5814f51846f93e7c06bf20e9163dc30 (patch)
treee29da538d685e8a3b36ad529e954182ae0bd1a81
parent92d32090f5647ff7daf5945bf15d4fb41382f1ee (diff)
downloaditools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.tar.gz
itools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.tar.bz2
itools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.zip
Prevent from adding the itjs_call envelope more than once
-rw-r--r--itjs.class6
1 files changed, 3 insertions, 3 deletions
diff --git a/itjs.class b/itjs.class
index 22c5730..f6da4cb 100644
--- a/itjs.class
+++ b/itjs.class
@@ -30,12 +30,12 @@ function send_headers()
/**
* Serialize the result into a javascript script
* @param $values Array with values to be serialized
- * @param $callback Javascript function to call with data (iframe solution)
+ * @param $envelope Encapsulate the data when callback function is provided (iframe solution)
* @return String with javascript code to be sent to client
*/
-function serialize($values)
+function serialize($values, $envelope = false)
{
- if ($callback = it::replace(array('[^\w.]' => ""), $_REQUEST['itjs_call']))
+ if (($envelope || isset($values['eof'])) && ($callback = it::replace(array('[^\w.]' => ""), $_REQUEST['itjs_call'])))
{
$target = $_REQUEST['itjs_iframe'] ? "parent" : "window";
$header = "$target.it_loader && $target.$callback(";