aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-03-22 09:54:55 +0100
committerGitHub <noreply@github.com>2018-03-22 09:54:55 +0100
commitbe35b54f69f7c54318adc3bb46d23506afcebd09 (patch)
tree79d0454afcad2ddbba67aa483855dc049a8f2843 /lib/private
parentdc4ba31e7e764b35ddfabe178ddc72a8cda264f3 (diff)
parent78211a58e642b3b4363e9ca21aff398661260b01 (diff)
downloadnextcloud-server-be35b54f69f7c54318adc3bb46d23506afcebd09.tar.gz
nextcloud-server-be35b54f69f7c54318adc3bb46d23506afcebd09.zip
Merge pull request #8791 from nextcloud/cleanup-oc_json
Remove unused methods of OC_Json
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/legacy/eventsource.php4
-rw-r--r--lib/private/legacy/json.php30
2 files changed, 6 insertions, 28 deletions
diff --git a/lib/private/legacy/eventsource.php b/lib/private/legacy/eventsource.php
index 1a8061c0ed2..1e68dd24af0 100644
--- a/lib/private/legacy/eventsource.php
+++ b/lib/private/legacy/eventsource.php
@@ -110,13 +110,13 @@ class OC_EventSource implements \OCP\IEventSource {
}
if ($this->fallback) {
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
- . $this->fallBackId . ',"' . $type . '",' . OCP\JSON::encode($data) . ')</script>' . PHP_EOL;
+ . $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
echo $response;
} else {
if ($type) {
echo 'event: ' . $type . PHP_EOL;
}
- echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL;
+ echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
}
echo PHP_EOL;
flush();
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php
index b02e5c879fc..9588834e934 100644
--- a/lib/private/legacy/json.php
+++ b/lib/private/legacy/json.php
@@ -37,18 +37,6 @@
* @deprecated Use a AppFramework JSONResponse instead
*/
class OC_JSON{
- static protected $send_content_type_header = false;
- /**
- * set Content-Type header to jsonrequest
- * @deprecated Use a AppFramework JSONResponse instead
- */
- public static function setContentTypeHeader($type='application/json') {
- if (!self::$send_content_type_header) {
- // We send json data
- header( 'Content-Type: '.$type . '; charset=utf-8');
- self::$send_content_type_header = true;
- }
- }
/**
* Check if the app is enabled, send json error msg if not
@@ -137,7 +125,8 @@ class OC_JSON{
*/
public static function error($data = array()) {
$data['status'] = 'error';
- self::encodedPrint($data);
+ header( 'Content-Type: application/json; charset=utf-8');
+ echo self::encode($data);
}
/**
@@ -147,7 +136,8 @@ class OC_JSON{
*/
public static function success($data = array()) {
$data['status'] = 'success';
- self::encodedPrint($data);
+ header( 'Content-Type: application/json; charset=utf-8');
+ echo self::encode($data);
}
/**
@@ -160,18 +150,6 @@ class OC_JSON{
}
/**
- * Encode and print $data in json format
- * @deprecated Use a AppFramework JSONResponse instead
- * @suppress PhanDeprecatedFunction
- */
- public static function encodedPrint($data, $setContentType=true) {
- if($setContentType) {
- self::setContentTypeHeader();
- }
- echo self::encode($data);
- }
-
- /**
* Encode JSON
* @deprecated Use a AppFramework JSONResponse instead
*/