summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-14 07:31:11 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-14 07:31:11 -0800
commitf37b93a7eb34c766d2d741064a611afd1760c959 (patch)
treefa4419ea94b9bc43582505899c83a370d2f3f8b3 /modules
parent378c7fb45a07601945f1e8f369f1cba68866556b (diff)
If the return object is empty still return the empty object in the json response.
Diffstat (limited to 'modules')
-rw-r--r--modules/rest/helpers/rest.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index a61aba2f..3c53784d 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -21,17 +21,15 @@ class rest_Core {
static function reply($data=array()) {
Session::instance()->abort_save();
- if ($data) {
- if (Input::instance()->get("output") == "html") {
- header("Content-type: text/html");
- $html = preg_replace(
- "#([\w]+?://[\w]+[^ \'\"\n\r\t<]*)#ise", "'<a href=\"\\1\" >\\1</a>'",
- var_export($data, 1));
- print "<pre>$html</pre>";
- } else {
- header("Content-type: application/json");
- print json_encode($data);
- }
+ if (Input::instance()->get("output") == "html") {
+ header("Content-type: text/html");
+ $html = preg_replace(
+ "#([\w]+?://[\w]+[^ \'\"\n\r\t<]*)#ise", "'<a href=\"\\1\" >\\1</a>'",
+ var_export(!empty($data) ? $data : t("Empty response"), 1));
+ print "<pre>$html</pre>";
+ } else {
+ header("Content-type: application/json");
+ print json_encode($data);
}
}