@@ -45,8 +45,7 @@ |
||
| 45 | 45 | use OCP\ILogger; |
| 46 | 46 | use OCP\IRequest; |
| 47 | 47 | |
| 48 | -class SettingsController extends Controller |
|
| 49 | -{ |
|
| 48 | +class SettingsController extends Controller { |
|
| 50 | 49 | /** @var string */ |
| 51 | 50 | private $userId; |
| 52 | 51 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function getPersonalWebsites(): DataResponse |
| 116 | 116 | { |
| 117 | - $data = [ 'websites' => $this->websitesService->getWebsitesFromUser($this->userId) ]; |
|
| 117 | + $data = ['websites' => $this->websitesService->getWebsitesFromUser($this->userId)]; |
|
| 118 | 118 | return new DataResponse($data, Http::STATUS_OK); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | } catch (\Exception $e) { |
| 143 | 143 | $data = []; |
| 144 | 144 | if ($e instanceof WebsiteExistsException) { |
| 145 | - $data['form_error'] = [ 'field' => 'site', 'message' => $this->l10n->t('Website exists.') ]; |
|
| 145 | + $data['form_error'] = ['field' => 'site', 'message' => $this->l10n->t('Website exists.')]; |
|
| 146 | 146 | } elseif (($e instanceof WebsiteInvalidDataException) && $e->getField()) { |
| 147 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
| 147 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
| 148 | 148 | } elseif ($e instanceof ThemeNotFoundException) { |
| 149 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
| 149 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
| 150 | 150 | } elseif ($e instanceof TemplateNotFoundException) { |
| 151 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
| 151 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return $this->createErrorResponse($e, $data); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | foreach ($data as $key => $value) { |
| 174 | 174 | switch ($key) { |
| 175 | 175 | case 'type': |
| 176 | - $website->setType((int) $value); |
|
| 176 | + $website->setType((int)$value); |
|
| 177 | 177 | break; |
| 178 | 178 | |
| 179 | 179 | case 'theme': |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | } catch (\Exception $e) { |
| 192 | 192 | $data = []; |
| 193 | 193 | if (($e instanceof WebsiteNotFoundException) || ($e instanceof WebsiteForeignOwnerException)) { |
| 194 | - $data['form_error'] = [ 'field' => 'identifier', 'message' => $this->l10n->t('Website not found.') ]; |
|
| 194 | + $data['form_error'] = ['field' => 'identifier', 'message' => $this->l10n->t('Website not found.')]; |
|
| 195 | 195 | } elseif ($e instanceof WebsiteInvalidDataException) { |
| 196 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
| 196 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
| 197 | 197 | } elseif ($e instanceof ThemeNotFoundException) { |
| 198 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
| 198 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
| 199 | 199 | } elseif ($e instanceof TemplateNotFoundException) { |
| 200 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
| 200 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $this->createErrorResponse($e, $data); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | throw new \UnexpectedValueException(); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $this->websitesService->setLinkMode((int) $data['link_mode']); |
|
| 444 | + $this->websitesService->setLinkMode((int)$data['link_mode']); |
|
| 445 | 445 | |
| 446 | 446 | return new DataResponse([], Http::STATUS_CREATED); |
| 447 | 447 | } catch (\Exception $e) { |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | private function createErrorResponse(\Exception $exception, array $data = []): DataResponse |
| 459 | 459 | { |
| 460 | - $this->logger->logException($exception, [ 'app' => Application::APP_NAME, 'level' => 2 ]); |
|
| 460 | + $this->logger->logException($exception, ['app' => Application::APP_NAME, 'level' => 2]); |
|
| 461 | 461 | |
| 462 | 462 | $data['status'] = 0; |
| 463 | 463 | if (\OC::$server->getSystemConfig()->getValue('debug', false)) { |
@@ -26,8 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | use OCP\AppFramework\Http\EmptyContentSecurityPolicy; |
| 28 | 28 | |
| 29 | -class PicoContentSecurityPolicy extends EmptyContentSecurityPolicy |
|
| 30 | -{ |
|
| 29 | +class PicoContentSecurityPolicy extends EmptyContentSecurityPolicy { |
|
| 31 | 30 | /** @var bool Whether inline JS snippets are allowed */ |
| 32 | 31 | protected $inlineScriptAllowed = true; |
| 33 | 32 | |
@@ -27,8 +27,7 @@ |
||
| 27 | 27 | use OCP\AppFramework\Http; |
| 28 | 28 | use OCP\AppFramework\Http\Response; |
| 29 | 29 | |
| 30 | -class NotModifiedResponse extends Response |
|
| 31 | -{ |
|
| 30 | +class NotModifiedResponse extends Response { |
|
| 32 | 31 | /** @var Response */ |
| 33 | 32 | private $originalResponse; |
| 34 | 33 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $lastModified = $file->getMTime(); |
| 77 | 77 | $mimeType = $file->getMimeType(); |
| 78 | 78 | |
| 79 | - if (($file->getPermissions() & Constants::PERMISSION_READ) !== Constants::PERMISSION_READ) { |
|
| 79 | + if (($file->getPermissions()&Constants::PERMISSION_READ) !== Constants::PERMISSION_READ) { |
|
| 80 | 80 | throw new NotPermittedException(); |
| 81 | 81 | } |
| 82 | 82 | } catch (InvalidPathException $e) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function cacheFor(int $cacheSeconds): self |
| 124 | 124 | { |
| 125 | - if($cacheSeconds > 0) { |
|
| 125 | + if ($cacheSeconds > 0) { |
|
| 126 | 126 | $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', public'); |
| 127 | 127 | $this->addHeader('Pragma', 'public'); |
| 128 | 128 | |
@@ -32,8 +32,7 @@ |
||
| 32 | 32 | use OCP\Files\NotFoundException; |
| 33 | 33 | use OCP\Files\NotPermittedException; |
| 34 | 34 | |
| 35 | -class PicoFileResponse extends DownloadResponse |
|
| 36 | -{ |
|
| 35 | +class PicoFileResponse extends DownloadResponse { |
|
| 37 | 36 | /** @var File */ |
| 38 | 37 | private $file; |
| 39 | 38 | |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | use OCP\AppFramework\Http\EmptyContentSecurityPolicy; |
| 29 | 29 | use OCP\AppFramework\Http\Response; |
| 30 | 30 | |
| 31 | -class PicoPageResponse extends Response |
|
| 32 | -{ |
|
| 31 | +class PicoPageResponse extends Response { |
|
| 33 | 32 | /** @var PicoPage */ |
| 34 | 33 | private $page; |
| 35 | 34 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct(string $message = null) |
| 39 | 39 | { |
| 40 | - parent::__construct(Application::APP_NAME, '404', [ 'message' => $message ], 'guest'); |
|
| 40 | + parent::__construct(Application::APP_NAME, '404', ['message' => $message], 'guest'); |
|
| 41 | 41 | $this->setStatus(Http::STATUS_NOT_FOUND); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | use OCP\AppFramework\Http; |
| 29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
| 30 | 30 | |
| 31 | -class NotFoundResponse extends TemplateResponse |
|
| 32 | -{ |
|
| 31 | +class NotFoundResponse extends TemplateResponse { |
|
| 33 | 32 | /** |
| 34 | 33 | * NotFoundResponse constructor. |
| 35 | 34 | * |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | use OCP\AppFramework\Http; |
| 29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
| 30 | 30 | |
| 31 | -class PicoErrorResponse extends TemplateResponse |
|
| 32 | -{ |
|
| 31 | +class PicoErrorResponse extends TemplateResponse { |
|
| 33 | 32 | /** @var \Exception|null */ |
| 34 | 33 | private $exception; |
| 35 | 34 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct(string $message = null) |
| 39 | 39 | { |
| 40 | - parent::__construct(Application::APP_NAME, '403', [ 'message' => $message ], 'guest'); |
|
| 40 | + parent::__construct(Application::APP_NAME, '403', ['message' => $message], 'guest'); |
|
| 41 | 41 | $this->setStatus(Http::STATUS_FORBIDDEN); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | use OCP\AppFramework\Http; |
| 29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
| 30 | 30 | |
| 31 | -class NotPermittedResponse extends TemplateResponse |
|
| 32 | -{ |
|
| 31 | +class NotPermittedResponse extends TemplateResponse { |
|
| 33 | 32 | /** |
| 34 | 33 | * NotPermittedResponse constructor. |
| 35 | 34 | * |
@@ -178,7 +178,7 @@ |
||
| 178 | 178 | if ($this->htmlPurifier === null) { |
| 179 | 179 | $this->htmlPurifier = new HTMLPurifier(HTMLPurifier_Config::createDefault()); |
| 180 | 180 | |
| 181 | - $this->triggerEvent('onHtmlPurifier', [ &$this->htmlPurifier ]); |
|
| 181 | + $this->triggerEvent('onHtmlPurifier', [&$this->htmlPurifier]); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | return $this->htmlPurifier; |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | use OCA\CMSPico\Model\Website; |
| 35 | 35 | use Symfony\Component\Yaml\Exception\ParseException; |
| 36 | 36 | |
| 37 | -class Pico extends \Pico |
|
| 38 | -{ |
|
| 37 | +class Pico extends \Pico { |
|
| 39 | 38 | /** @var HTMLPurifier */ |
| 40 | 39 | protected $htmlPurifier; |
| 41 | 40 | |