diff options
author | Thomas BrĂ¼derli | 2007-08-28 15:18:05 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2007-08-28 15:18:05 +0000 |
commit | a61b8eafb5814f51846f93e7c06bf20e9163dc30 (patch) | |
tree | e29da538d685e8a3b36ad529e954182ae0bd1a81 | |
parent | 92d32090f5647ff7daf5945bf15d4fb41382f1ee (diff) | |
download | itools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.tar.gz itools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.tar.bz2 itools-a61b8eafb5814f51846f93e7c06bf20e9163dc30.zip |
Prevent from adding the itjs_call envelope more than once
-rw-r--r-- | itjs.class | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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("; |