summaryrefslogtreecommitdiff
path: root/modules/rest
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-13 13:44:09 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-13 13:44:09 -0800
commitda251228cbb54818852c49d37ec7eb31f2313160 (patch)
tree9ef755fc77f037b9eb7b012a8912372ed0b24d87 /modules/rest
parent36702b1397dcac9ba5a607f62e2a1caeb307ac7a (diff)
If the return object is empty still return the empty object in the json response.
Diffstat (limited to 'modules/rest')
-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);
}
}