1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

JS helper - a bit more flexible

This commit is contained in:
secretr
2012-01-30 10:46:59 +00:00
parent 1c34c00f95
commit 3f4b7c7f20

View File

@@ -182,7 +182,7 @@ class e_jshelper
$this->addResponseAction($action, $data_array); $this->addResponseAction($action, $data_array);
} }
echo $this->buildXmlResponse(); if(null !== $action) echo $this->buildXmlResponse();
exit; exit;
} }
@@ -191,8 +191,9 @@ class e_jshelper
* *
* @return string JSON response * @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*/"; return "/*-secure-\n".json_encode($this->getResponseActions(true))."\n*/";
} }
@@ -209,7 +210,7 @@ class e_jshelper
{ {
$this->addResponseAction($action, $data_array); $this->addResponseAction($action, $data_array);
} }
echo $this->buildJSONResponse(); if(null !== $action) echo $this->buildJSONResponse();
exit; exit;
} }