Remove unused methods of OC_Json

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2018-03-12 18:28:46 +01:00
parent c8340ace5c
commit 78211a58e6
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
3 changed files with 6 additions and 39 deletions

View File

@ -110,13 +110,13 @@ class OC_EventSource implements \OCP\IEventSource {
} }
if ($this->fallback) { if ($this->fallback) {
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack(' $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; echo $response;
} else { } else {
if ($type) { if ($type) {
echo 'event: ' . $type . PHP_EOL; echo 'event: ' . $type . PHP_EOL;
} }
echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL; echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
} }
echo PHP_EOL; echo PHP_EOL;
flush(); flush();

View File

@ -37,18 +37,6 @@
* @deprecated Use a AppFramework JSONResponse instead * @deprecated Use a AppFramework JSONResponse instead
*/ */
class OC_JSON{ 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 * 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()) { public static function error($data = array()) {
$data['status'] = 'error'; $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()) { public static function success($data = array()) {
$data['status'] = 'success'; $data['status'] = 'success';
self::encodedPrint($data); header( 'Content-Type: application/json; charset=utf-8');
echo self::encode($data);
} }
/** /**
@ -159,18 +149,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 * Encode JSON
* @deprecated Use a AppFramework JSONResponse instead * @deprecated Use a AppFramework JSONResponse instead

View File

@ -163,15 +163,4 @@ class JSON {
public static function checkAdminUser() { public static function checkAdminUser() {
\OC_JSON::checkAdminUser(); \OC_JSON::checkAdminUser();
} }
/**
* Encode JSON
* @param array $data
* @return string
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/
public static function encode($data) {
return \OC_JSON::encode($data);
}
} }