diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-14 07:11:14 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-14 07:11:14 -0800 |
commit | e41a2d4e5226c45a5201df91ca6633a40b357630 (patch) | |
tree | f7c06e2c2495c833028dfcffd1ef90447047b586 /modules/rest/helpers/rest.php | |
parent | dcd7a8fbb8924665a07582aa53f07a86ef922287 (diff) | |
parent | df8273e3f26f35ad87fd6f96610f370bdad7f1e5 (diff) |
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/rest/helpers/rest.php')
-rw-r--r-- | modules/rest/helpers/rest.php | 20 |
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); } } |