From a61b8eafb5814f51846f93e7c06bf20e9163dc30 Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Tue, 28 Aug 2007 15:18:05 +0000 Subject: Prevent from adding the itjs_call envelope more than once --- itjs.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'itjs.class') 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("; -- cgit v1.2.3