summaryrefslogtreecommitdiffstats
path: root/lib/private/json.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-12-10 15:32:48 +0100
committerVincent Petry <pvince81@owncloud.com>2013-12-12 10:38:12 +0100
commit335b2f40a631f7188ab921d69289acaf31908c6e (patch)
tree144c2f7233a0b27b6cae5fc0a81f817b968770f1 /lib/private/json.php
parent3084a52a970c83ca35135f490b9bcb06b9900867 (diff)
downloadnextcloud-server-335b2f40a631f7188ab921d69289acaf31908c6e.tar.gz
nextcloud-server-335b2f40a631f7188ab921d69289acaf31908c6e.zip
Fixed download file from URL error messages
- L10N now converted to string to make them work with json_encode - Added specific error message when server doesn't allow fopen on URLs - Fixed client side to correctly show error message in a notification - Added OCP\JSON::encode() method to encode JSON with support for the OC_L10N_String values
Diffstat (limited to 'lib/private/json.php')
-rw-r--r--lib/private/json.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/json.php b/lib/private/json.php
index 6ba0b13806b..8401f7c3a12 100644
--- a/lib/private/json.php
+++ b/lib/private/json.php
@@ -109,7 +109,14 @@ class OC_JSON{
if($setContentType) {
self::setContentTypeHeader();
}
+ echo self::encode($data);
+ }
+
+ /**
+ * Encode JSON
+ */
+ public static function encode($data) {
array_walk_recursive($data, array('OC_JSON', 'to_string'));
- echo json_encode($data);
+ return json_encode($data);
}
}