From 5182614fa41364ebf677a7cee3e7d0765a823b17 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 9 Sep 2014 10:39:16 +0200 Subject: [PATCH 1/2] Use native json pretty printing if available --- includes/Wpup/UpdateServer.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/Wpup/UpdateServer.php b/includes/Wpup/UpdateServer.php index b868f36..f550785 100644 --- a/includes/Wpup/UpdateServer.php +++ b/includes/Wpup/UpdateServer.php @@ -256,9 +256,13 @@ protected function filterLogInfo($columns) { */ protected function outputAsJson($response) { header('Content-Type: application/json'); - $output = json_encode($response); - if ( function_exists('wsh_pretty_json') ) { - $output = wsh_pretty_json($output); + $output = ''; + if ( defined('JSON_PRETTY_PRINT') && JSON_PRETTY_PRINT ) { + $output = json_encode($response, JSON_PRETTY_PRINT); + } elseif ( function_exists('wsh_pretty_json') ) { + $output = wsh_pretty_json(json_encode($response)); + } else { + $output = json_encode($response); } echo $output; } From e799ef3a4439da1525d2e00efb6757046abbf091 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 9 Sep 2014 19:04:45 +0200 Subject: [PATCH 2/2] Constant not ini variable... --- includes/Wpup/UpdateServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Wpup/UpdateServer.php b/includes/Wpup/UpdateServer.php index f550785..f6c6530 100644 --- a/includes/Wpup/UpdateServer.php +++ b/includes/Wpup/UpdateServer.php @@ -257,7 +257,7 @@ protected function filterLogInfo($columns) { protected function outputAsJson($response) { header('Content-Type: application/json'); $output = ''; - if ( defined('JSON_PRETTY_PRINT') && JSON_PRETTY_PRINT ) { + if ( defined('JSON_PRETTY_PRINT') ) { $output = json_encode($response, JSON_PRETTY_PRINT); } elseif ( function_exists('wsh_pretty_json') ) { $output = wsh_pretty_json(json_encode($response));