diff options
Diffstat (limited to 'lib/private/legacy/json.php')
-rw-r--r-- | lib/private/legacy/json.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php index 29d0029a3a0..f83fca0a433 100644 --- a/lib/private/legacy/json.php +++ b/lib/private/legacy/json.php @@ -44,7 +44,7 @@ class OC_JSON{ public static function checkAppEnabled($app) { if( !\OC::$server->getAppManager()->isEnabledForUser($app)) { $l = \OC::$server->getL10N('lib'); - self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ))); + self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]); exit(); } } @@ -60,7 +60,7 @@ class OC_JSON{ || $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { $l = \OC::$server->getL10N('lib'); http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); - self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); + self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); exit(); } } @@ -78,7 +78,7 @@ class OC_JSON{ if( !\OC::$server->getRequest()->passesCSRFCheck()) { $l = \OC::$server->getL10N('lib'); - self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ))); + self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]); exit(); } } @@ -91,7 +91,7 @@ class OC_JSON{ public static function checkAdminUser() { if( !OC_User::isAdminUser(OC_User::getUser())) { $l = \OC::$server->getL10N('lib'); - self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ))); + self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); exit(); } } @@ -101,7 +101,7 @@ class OC_JSON{ * @deprecated Use a AppFramework JSONResponse instead * @suppress PhanDeprecatedFunction */ - public static function error($data = array()) { + public static function error($data = []) { $data['status'] = 'error'; header( 'Content-Type: application/json; charset=utf-8'); echo self::encode($data); @@ -112,7 +112,7 @@ class OC_JSON{ * @deprecated Use a AppFramework JSONResponse instead * @suppress PhanDeprecatedFunction */ - public static function success($data = array()) { + public static function success($data = []) { $data['status'] = 'success'; header( 'Content-Type: application/json; charset=utf-8'); echo self::encode($data); @@ -133,7 +133,7 @@ class OC_JSON{ */ public static function encode($data) { if (is_array($data)) { - array_walk_recursive($data, array('OC_JSON', 'to_string')); + array_walk_recursive($data, ['OC_JSON', 'to_string']); } return json_encode($data, JSON_HEX_TAG); } |