From 3f4b7c7f207e9f94a56130c43cebcdc466360d9d Mon Sep 17 00:00:00 2001 From: secretr Date: Mon, 30 Jan 2012 10:46:59 +0000 Subject: [PATCH] JS helper - a bit more flexible --- e107_handlers/js_helper.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e107_handlers/js_helper.php b/e107_handlers/js_helper.php index 7a8446d2e..e95cada3f 100644 --- a/e107_handlers/js_helper.php +++ b/e107_handlers/js_helper.php @@ -182,7 +182,7 @@ class e_jshelper $this->addResponseAction($action, $data_array); } - echo $this->buildXmlResponse(); + if(null !== $action) echo $this->buildXmlResponse(); exit; } @@ -191,8 +191,9 @@ class e_jshelper * * @return string JSON response */ - function buildJsonResponse() + function buildJsonResponse($data = null) { + if(null !== $data) return "/*-secure-\n".json_encode($data)."\n*/"; return "/*-secure-\n".json_encode($this->getResponseActions(true))."\n*/"; } @@ -209,7 +210,7 @@ class e_jshelper { $this->addResponseAction($action, $data_array); } - echo $this->buildJSONResponse(); + if(null !== $action) echo $this->buildJSONResponse(); exit; }