aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-08-16 19:00:38 -0700
committerredmatrix <git@macgirvin.com>2016-08-16 19:00:38 -0700
commita2873c18ca9507c0128d973215fb3ba26d8da5e7 (patch)
tree54b51da8f5fbd6801c8ca900a3a089c1d57e87f8
parent70150718c55ec5b55dbded26a5159f06f14c6c25 (diff)
downloadvolse-hubzilla-a2873c18ca9507c0128d973215fb3ba26d8da5e7.tar.gz
volse-hubzilla-a2873c18ca9507c0128d973215fb3ba26d8da5e7.tar.bz2
volse-hubzilla-a2873c18ca9507c0128d973215fb3ba26d8da5e7.zip
get rid of ugly code construct
-rw-r--r--include/api.php9
1 files changed, 1 insertions, 8 deletions
diff --git a/include/api.php b/include/api.php
index 043db5921..fb49da9df 100644
--- a/include/api.php
+++ b/include/api.php
@@ -118,11 +118,7 @@ require_once('include/api_auth.php');
break;
case "json":
header ("Content-Type: application/json");
- foreach($r as $rr) {
- if(! $rr)
- $rr = array();
- $json = json_encode($rr);
- }
+ $json = json_encode((is_array($r[0])) ? $r[0] : array());
// Lookup JSONP to understand these lines. They provide cross-domain AJAX ability.
if ($_GET['callback'])
$json = $_GET['callback'] . '(' . $json . ')' ;
@@ -137,9 +133,6 @@ require_once('include/api_auth.php');
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
case "as":
- //header ("Content-Type: application/json");
- //foreach($r as $rr)
- // return json_encode($rr);
return json_encode($r);
break;