@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | #[\PHPUnit\Framework\Attributes\DataProvider('dataVersionHash')] |
| 47 | 47 | public function testVersionHash( |
| 48 | - string|false $path, |
|
| 49 | - string|false $file, |
|
| 48 | + string | false $path, |
|
| 49 | + string | false $file, |
|
| 50 | 50 | bool $installed, |
| 51 | 51 | bool $debug, |
| 52 | 52 | string $expected, |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | 'only version hash if not installed' => ['apps/shipped', 'style.css', false, false, '?v=version_hash'], |
| 109 | 109 | 'version hash with cache buster if app not found' => ['unknown/path', '', true, false, '?v=version_hash-42'], |
| 110 | 110 | 'version hash with cache buster if neither path nor file provided' => [false, false, true, false, '?v=version_hash-42'], |
| 111 | - 'app version hash if external app' => ['', 'other/app.css', true, false, '?v=' . substr(md5('other_2'), 0, 8) . '-42'], |
|
| 112 | - 'app version and version hash if shipped app' => ['apps/shipped', 'style.css', true, false, '?v=' . substr(md5('shipped_1-version_hash'), 0, 8) . '-42'], |
|
| 113 | - 'prefer path over file' => ['apps/shipped', 'other/app.css', true, false, '?v=' . substr(md5('shipped_1-version_hash'), 0, 8) . '-42'], |
|
| 111 | + 'app version hash if external app' => ['', 'other/app.css', true, false, '?v='.substr(md5('other_2'), 0, 8).'-42'], |
|
| 112 | + 'app version and version hash if shipped app' => ['apps/shipped', 'style.css', true, false, '?v='.substr(md5('shipped_1-version_hash'), 0, 8).'-42'], |
|
| 113 | + 'prefer path over file' => ['apps/shipped', 'other/app.css', true, false, '?v='.substr(md5('shipped_1-version_hash'), 0, 8).'-42'], |
|
| 114 | 114 | ]; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | switch ($renderAs) { |
| 69 | 69 | case TemplateResponse::RENDER_AS_USER: |
| 70 | 70 | $page = $this->templateManager->getTemplate('core', 'layout.user'); |
| 71 | - if (in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
| 71 | + if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { |
|
| 72 | 72 | $page->assign('bodyid', 'body-settings'); |
| 73 | 73 | } else { |
| 74 | 74 | $page->assign('bodyid', 'body-user'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $this->initialState->provideInitialState('unified-search', 'min-search-length', $this->appConfig->getValueInt(Application::APP_ID, ConfigLexicon::UNIFIED_SEARCH_MIN_SEARCH_LENGTH)); |
| 81 | 81 | if ($this->config->getSystemValueBool('unified_search.enabled', false) || !$this->config->getSystemValueBool('enable_non-accessible_features', true)) { |
| 82 | - $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); |
|
| 82 | + $this->initialState->provideInitialState('unified-search', 'limit-default', (int) $this->config->getAppValue('core', 'unified-search.limit-default', (string) SearchQuery::LIMIT_DEFAULT)); |
|
| 83 | 83 | $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); |
| 84 | 84 | Util::addScript('core', 'legacy-unified-search', 'core'); |
| 85 | 85 | } else { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | foreach ($jsFiles as $info) { |
| 248 | 248 | $web = $info[1]; |
| 249 | 249 | $file = $info[2]; |
| 250 | - $page->append('jsfiles', $web . '/' . $file . $this->getVersionHashSuffix()); |
|
| 250 | + $page->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $request = \OCP\Server::get(IRequest::class); |
@@ -282,14 +282,14 @@ discard block |
||
| 282 | 282 | $file = $info[2]; |
| 283 | 283 | |
| 284 | 284 | if (str_ends_with($file, 'print.css')) { |
| 285 | - $page->append('printcssfiles', $web . '/' . $file . $this->getVersionHashSuffix()); |
|
| 285 | + $page->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 286 | 286 | } else { |
| 287 | 287 | $suffix = $this->getVersionHashSuffix($web, $file); |
| 288 | 288 | |
| 289 | 289 | if (!str_contains($file, '?v=')) { |
| 290 | - $page->append('cssfiles', $web . '/' . $file . $suffix); |
|
| 290 | + $page->append('cssfiles', $web.'/'.$file.$suffix); |
|
| 291 | 291 | } else { |
| 292 | - $page->append('cssfiles', $web . '/' . $file . '-' . substr($suffix, 3)); |
|
| 292 | + $page->append('cssfiles', $web.'/'.$file.'-'.substr($suffix, 3)); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | if ($this->config->getSystemValueBool('installed', false) === false) { |
| 318 | 318 | // if not installed just return the version hash |
| 319 | - return '?v=' . self::$versionHash; |
|
| 319 | + return '?v='.self::$versionHash; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | $hash = false; |
@@ -334,12 +334,12 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // The theming app is force-enabled thus the cache buster is always available |
| 337 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 337 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 338 | 338 | |
| 339 | - return '?v=' . $hash . $themingSuffix; |
|
| 339 | + return '?v='.$hash.$themingSuffix; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - private function getVersionHashByPath(string $path): string|false { |
|
| 342 | + private function getVersionHashByPath(string $path): string | false { |
|
| 343 | 343 | if (array_key_exists($path, self::$cacheBusterCache) === false) { |
| 344 | 344 | // Not yet cached, so lets find the cache buster string |
| 345 | 345 | $appId = $this->getAppNamefromPath($path); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $appVersion = $this->appManager->getAppVersion($appId); |
| 356 | 356 | // For shipped apps the app version is not a single source of truth, we rather also need to consider the Nextcloud version |
| 357 | 357 | if ($this->appManager->isShipped($appId)) { |
| 358 | - $appVersion .= '-' . self::$versionHash; |
|
| 358 | + $appVersion .= '-'.self::$versionHash; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $hash = substr(md5($appVersion), 0, 8); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | return $this->cssLocator->getResources(); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - public function getAppNamefromPath(string $path): string|false { |
|
| 377 | + public function getAppNamefromPath(string $path): string | false { |
|
| 378 | 378 | if ($path !== '') { |
| 379 | 379 | $pathParts = explode('/', $path); |
| 380 | 380 | if ($pathParts[0] === 'css') { |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | if (count($parts) < 2) { |
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | - [$app,$subpath] = $parts; |
|
| 33 | - if ($this->appendIfExist($this->serverroot, $resource . '.css') |
|
| 34 | - || $this->appendIfExist($this->serverroot, 'core/' . $resource . '.css') |
|
| 32 | + [$app, $subpath] = $parts; |
|
| 33 | + if ($this->appendIfExist($this->serverroot, $resource.'.css') |
|
| 34 | + || $this->appendIfExist($this->serverroot, 'core/'.$resource.'.css') |
|
| 35 | 35 | ) { |
| 36 | 36 | return; |
| 37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $app_url = $this->appManager->getAppWebPath($app); |
| 41 | 41 | } catch (AppPathNotFoundException $e) { |
| 42 | 42 | $this->logger->error('Could not find resource {resource} to load', [ |
| 43 | - 'resource' => $app . '/' . $subpath . '.css', |
|
| 43 | + 'resource' => $app.'/'.$subpath.'.css', |
|
| 44 | 44 | 'app' => 'cssresourceloader', |
| 45 | 45 | 'exception' => $e, |
| 46 | 46 | ]); |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | // turned into cwd. |
| 53 | 53 | $app_path = realpath($app_path); |
| 54 | 54 | |
| 55 | - $this->append($app_path, $subpath . '.css', $app_url); |
|
| 55 | + $this->append($app_path, $subpath.'.css', $app_url); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function doFindTheme(string $resource): void { |
| 59 | - $theme_dir = 'themes/' . $this->theme . '/'; |
|
| 60 | - $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $resource . '.css') |
|
| 61 | - || $this->appendIfExist($this->serverroot, $theme_dir . $resource . '.css') |
|
| 62 | - || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $resource . '.css'); |
|
| 59 | + $theme_dir = 'themes/'.$this->theme.'/'; |
|
| 60 | + $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$resource.'.css') |
|
| 61 | + || $this->appendIfExist($this->serverroot, $theme_dir.$resource.'.css') |
|
| 62 | + || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$resource.'.css'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function append(string $root, string $file, ?string $webRoot = null, bool $throw = true, bool $scss = false): void { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $defaultExpireDateEnabled = $this->appConfig->getValueBool('core', ConfigLexicon::SHARE_LINK_EXPIRE_DATE_DEFAULT); |
| 102 | 102 | $defaultExpireDate = $enforceDefaultExpireDate = null; |
| 103 | 103 | if ($defaultExpireDateEnabled) { |
| 104 | - $defaultExpireDate = (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 104 | + $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 105 | 105 | $enforceDefaultExpireDate = $this->appConfig->getValueBool('core', ConfigLexicon::SHARE_LINK_EXPIRE_DATE_ENFORCED); |
| 106 | 106 | } |
| 107 | 107 | $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | $defaultInternalExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; |
| 110 | 110 | $defaultInternalExpireDate = $defaultInternalExpireDateEnforced = null; |
| 111 | 111 | if ($defaultInternalExpireDateEnabled) { |
| 112 | - $defaultInternalExpireDate = (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
| 112 | + $defaultInternalExpireDate = (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
| 113 | 113 | $defaultInternalExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $defaultRemoteExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; |
| 117 | 117 | $defaultRemoteExpireDate = $defaultRemoteExpireDateEnforced = null; |
| 118 | 118 | if ($defaultRemoteExpireDateEnabled) { |
| 119 | - $defaultRemoteExpireDate = (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); |
|
| 119 | + $defaultRemoteExpireDate = (int) $this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); |
|
| 120 | 120 | $defaultRemoteExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $countOfDataLocation = 0; |
| 124 | - $dataLocation = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 124 | + $dataLocation = str_replace(\OC::$SERVERROOT.'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | 125 | if ($countOfDataLocation !== 1 || $uid === null || !$this->groupManager->isAdmin($uid)) { |
| 126 | 126 | $dataLocation = false; |
| 127 | 127 | } |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $firstDay = $this->config->getUserValue($uid, 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK, ''); |
| 145 | 145 | if ($firstDay === '') { |
| 146 | - $firstDay = (int)$this->l->l('firstday', null); |
|
| 146 | + $firstDay = (int) $this->l->l('firstday', null); |
|
| 147 | 147 | } else { |
| 148 | - $firstDay = (int)$firstDay; |
|
| 148 | + $firstDay = (int) $firstDay; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $config = [ |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | '_oc_debug' => $this->config->getSystemValue('debug', false) ? 'true' : 'false', |
| 177 | 177 | '_oc_isadmin' => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', |
| 178 | 178 | 'backendAllowsPasswordConfirmation' => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', |
| 179 | - 'oc_dataURL' => is_string($dataLocation) ? '"' . $dataLocation . '"' : 'false', |
|
| 180 | - '_oc_webroot' => '"' . \OC::$WEBROOT . '"', |
|
| 179 | + 'oc_dataURL' => is_string($dataLocation) ? '"'.$dataLocation.'"' : 'false', |
|
| 180 | + '_oc_webroot' => '"'.\OC::$WEBROOT.'"', |
|
| 181 | 181 | '_oc_appswebroots' => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution |
| 182 | 182 | 'datepickerFormatDate' => json_encode($this->l->l('jsdate', null)), |
| 183 | 183 | 'nc_lastLogin' => $lastConfirmTimestamp, |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | if ($this->currentUser !== null) { |
| 278 | 278 | $array['oc_userconfig'] = json_encode([ |
| 279 | 279 | 'avatar' => [ |
| 280 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 280 | + 'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 281 | 281 | 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true', |
| 282 | 282 | ] |
| 283 | 283 | ]); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | // Echo it |
| 297 | 297 | foreach ($array as $setting => $value) { |
| 298 | - $result .= 'var ' . $setting . '=' . $value . ';' . PHP_EOL; |
|
| 298 | + $result .= 'var '.$setting.'='.$value.';'.PHP_EOL; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | return $result; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | protected function canUserValidatePassword(): bool { |
| 305 | 305 | try { |
| 306 | 306 | $token = $this->tokenProvider->getToken($this->session->getId()); |
| 307 | - } catch (ExpiredTokenException|WipeTokenException|InvalidTokenException|SessionNotAvailableException) { |
|
| 307 | + } catch (ExpiredTokenException | WipeTokenException | InvalidTokenException | SessionNotAvailableException) { |
|
| 308 | 308 | // actually we do not know, so we fall back to this statement |
| 309 | 309 | return true; |
| 310 | 310 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | protected IConfig $config, |
| 30 | 30 | protected LoggerInterface $logger, |
| 31 | 31 | ) { |
| 32 | - $this->depsCache = $this->cacheFactory->createDistributed('JS-' . md5($this->urlGenerator->getBaseUrl())); |
|
| 32 | + $this->depsCache = $this->cacheFactory->createDistributed('JS-'.md5($this->urlGenerator->getBaseUrl())); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function process(string $root, string $file, string $app): bool { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $path = explode('/', $root . '/' . $file); |
|
| 40 | + $path = explode('/', $root.'/'.$file); |
|
| 41 | 41 | |
| 42 | 42 | $fileName = array_pop($path); |
| 43 | 43 | $path = implode('/', $path); |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $fileName = $fileName . '.deps'; |
|
| 65 | + $fileName = $fileName.'.deps'; |
|
| 66 | 66 | try { |
| 67 | - $deps = $this->depsCache->get($folder->getName() . '-' . $fileName); |
|
| 67 | + $deps = $this->depsCache->get($folder->getName().'-'.$fileName); |
|
| 68 | 68 | $fromCache = true; |
| 69 | 69 | if ($deps === null || $deps === '') { |
| 70 | 70 | $fromCache = false; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | // check again |
| 76 | 76 | if ($deps === null || $deps === '') { |
| 77 | - $this->logger->info('JSCombiner: deps file empty: ' . $fileName); |
|
| 77 | + $this->logger->info('JSCombiner: deps file empty: '.$fileName); |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if ($fromCache === false) { |
| 94 | - $this->depsCache->set($folder->getName() . '-' . $fileName, json_encode($deps)); |
|
| 94 | + $this->depsCache->set($folder->getName().'-'.$fileName, json_encode($deps)); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return true; |
@@ -102,17 +102,17 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | protected function cache(string $path, string $fileName, ISimpleFolder $folder): bool { |
| 104 | 104 | $deps = []; |
| 105 | - $fullPath = $path . '/' . $fileName; |
|
| 105 | + $fullPath = $path.'/'.$fileName; |
|
| 106 | 106 | $data = json_decode(file_get_contents($fullPath)); |
| 107 | 107 | $deps[$fullPath] = filemtime($fullPath); |
| 108 | 108 | |
| 109 | 109 | $res = ''; |
| 110 | 110 | foreach ($data as $file) { |
| 111 | - $filePath = $path . '/' . $file; |
|
| 111 | + $filePath = $path.'/'.$file; |
|
| 112 | 112 | |
| 113 | 113 | if (is_file($filePath)) { |
| 114 | 114 | $res .= file_get_contents($filePath); |
| 115 | - $res .= PHP_EOL . PHP_EOL; |
|
| 115 | + $res .= PHP_EOL.PHP_EOL; |
|
| 116 | 116 | $deps[$filePath] = filemtime($filePath); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $cachedfile = $folder->newFile($fileName); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $depFileName = $fileName . '.deps'; |
|
| 127 | + $depFileName = $fileName.'.deps'; |
|
| 128 | 128 | try { |
| 129 | 129 | $depFile = $folder->getFile($depFileName); |
| 130 | 130 | } catch (NotFoundException $e) { |
@@ -132,21 +132,21 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | try { |
| 135 | - $gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz |
|
| 135 | + $gzipFile = $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz |
|
| 136 | 136 | } catch (NotFoundException $e) { |
| 137 | - $gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz |
|
| 137 | + $gzipFile = $folder->newFile($fileName.'.gzip'); # Safari doesn't like .gz |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | try { |
| 141 | 141 | $cachedfile->putContent($res); |
| 142 | 142 | $deps = json_encode($deps); |
| 143 | 143 | $depFile->putContent($deps); |
| 144 | - $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); |
|
| 144 | + $this->depsCache->set($folder->getName().'-'.$depFileName, $deps); |
|
| 145 | 145 | $gzipFile->putContent(gzencode($res, 9)); |
| 146 | - $this->logger->debug('JSCombiner: successfully cached: ' . $fileName); |
|
| 146 | + $this->logger->debug('JSCombiner: successfully cached: '.$fileName); |
|
| 147 | 147 | return true; |
| 148 | - } catch (NotPermittedException|NotFoundException $e) { |
|
| 149 | - $this->logger->error('JSCombiner: unable to cache: ' . $fileName); |
|
| 148 | + } catch (NotPermittedException | NotFoundException $e) { |
|
| 149 | + $this->logger->error('JSCombiner: unable to cache: '.$fileName); |
|
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @return string[] |
| 164 | 164 | */ |
| 165 | 165 | public function getContent(string $root, string $file): array { |
| 166 | - $data = json_decode(file_get_contents($root . '/' . $file)); |
|
| 166 | + $data = json_decode(file_get_contents($root.'/'.$file)); |
|
| 167 | 167 | if (!is_array($data)) { |
| 168 | 168 | return []; |
| 169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $result = []; |
| 176 | 176 | foreach ($data as $f) { |
| 177 | - $result[] = $path . '/' . $f; |
|
| 177 | + $result[] = $path.'/'.$f; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return $result; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->theme = $config->getSystemValueString('theme', ''); |
| 34 | 34 | |
| 35 | 35 | if ($this->theme === '') { |
| 36 | - if (is_dir(\OC::$SERVERROOT . '/themes/default')) { |
|
| 36 | + if (is_dir(\OC::$SERVERROOT.'/themes/default')) { |
|
| 37 | 37 | $this->theme = 'default'; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->doFind($resource); |
| 53 | 53 | } catch (ResourceNotFoundException $e) { |
| 54 | 54 | [$resourceApp] = explode('/', $resource, 2); |
| 55 | - $this->logger->debug('Could not find resource file "' . $e->getResourcePath() . '"', ['app' => $resourceApp]); |
|
| 55 | + $this->logger->debug('Could not find resource file "'.$e->getResourcePath().'"', ['app' => $resourceApp]); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | if (!empty($this->theme)) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->doFindTheme($resource); |
| 62 | 62 | } catch (ResourceNotFoundException $e) { |
| 63 | 63 | [$resourceApp] = explode('/', $resource, 2); |
| 64 | - $this->logger->debug('Could not find resource file in theme "' . $e->getResourcePath() . '"', ['app' => $resourceApp]); |
|
| 64 | + $this->logger->debug('Could not find resource file in theme "'.$e->getResourcePath().'"', ['app' => $resourceApp]); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @return bool True if the resource was found, false otherwise |
| 77 | 77 | */ |
| 78 | 78 | protected function appendIfExist(string $root, string $file, ?string $webRoot = null): bool { |
| 79 | - if (is_file($root . '/' . $file)) { |
|
| 79 | + if (is_file($root.'/'.$file)) { |
|
| 80 | 80 | $this->append($root, $file, $webRoot, false); |
| 81 | 81 | return true; |
| 82 | 82 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | $this->resources[] = [$root, $webRoot, $file]; |
| 154 | 154 | |
| 155 | - if ($throw && !is_file($root . '/' . $file)) { |
|
| 155 | + if ($throw && !is_file($root.'/'.$file)) { |
|
| 156 | 156 | throw new ResourceNotFoundException($file, $webRoot); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function doFind(string $resource): void { |
| 29 | - $theme_dir = 'themes/' . $this->theme . '/'; |
|
| 29 | + $theme_dir = 'themes/'.$this->theme.'/'; |
|
| 30 | 30 | |
| 31 | 31 | // Extracting the appId and the script file name |
| 32 | 32 | [$app] = explode('/', $resource, 2); |
| 33 | 33 | $scriptName = basename($resource); |
| 34 | 34 | // Get the app root path |
| 35 | - $appRoot = $this->serverroot . '/apps/'; |
|
| 35 | + $appRoot = $this->serverroot.'/apps/'; |
|
| 36 | 36 | $appWebRoot = null; |
| 37 | 37 | try { |
| 38 | 38 | // We need the dir name as getAppPath appends the appid |
@@ -51,29 +51,29 @@ discard block |
||
| 51 | 51 | if (str_contains($resource, '/l10n/')) { |
| 52 | 52 | // For language files we try to load them all, so themes can overwrite |
| 53 | 53 | // single l10n strings without having to translate all of them. |
| 54 | - $found = $this->appendScriptIfExist($this->serverroot, 'core/' . $resource) |
|
| 55 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $resource) |
|
| 54 | + $found = $this->appendScriptIfExist($this->serverroot, 'core/'.$resource) |
|
| 55 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.'core/'.$resource) |
|
| 56 | 56 | || $this->appendScriptIfExist($this->serverroot, $resource) |
| 57 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . $resource) |
|
| 57 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.$resource) |
|
| 58 | 58 | || $this->appendScriptIfExist($appRoot, $resource, $appWebRoot) |
| 59 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'apps/' . $resource); |
|
| 59 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.'apps/'.$resource); |
|
| 60 | 60 | |
| 61 | 61 | if ($found) { |
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | - } elseif ($this->appendScriptIfExist($this->serverroot, $theme_dir . 'apps/' . $resource) |
|
| 65 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . $resource) |
|
| 64 | + } elseif ($this->appendScriptIfExist($this->serverroot, $theme_dir.'apps/'.$resource) |
|
| 65 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.$resource) |
|
| 66 | 66 | || $this->appendScriptIfExist($this->serverroot, $resource) |
| 67 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/$app-$scriptName") |
|
| 67 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir."dist/$app-$scriptName") |
|
| 68 | 68 | || $this->appendScriptIfExist($this->serverroot, "dist/$app-$scriptName") |
| 69 | 69 | || $this->appendScriptIfExist($appRoot, $resource, $appWebRoot) |
| 70 | - || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $resource . '.json') |
|
| 71 | - || $this->cacheAndAppendCombineJsonIfExist($appRoot, $resource . '.json', $app) |
|
| 72 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $resource) |
|
| 73 | - || $this->appendScriptIfExist($this->serverroot, 'core/' . $resource) |
|
| 74 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/core-$scriptName") |
|
| 70 | + || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $resource.'.json') |
|
| 71 | + || $this->cacheAndAppendCombineJsonIfExist($appRoot, $resource.'.json', $app) |
|
| 72 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.'core/'.$resource) |
|
| 73 | + || $this->appendScriptIfExist($this->serverroot, 'core/'.$resource) |
|
| 74 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir."dist/core-$scriptName") |
|
| 75 | 75 | || $this->appendScriptIfExist($this->serverroot, "dist/core-$scriptName") |
| 76 | - || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/' . $resource . '.json') |
|
| 76 | + || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$resource.'.json') |
|
| 77 | 77 | ) { |
| 78 | 78 | return; |
| 79 | 79 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $this->logger->error('Could not find resource {resource} to load', [ |
| 87 | - 'resource' => $resource . '.js', |
|
| 87 | + 'resource' => $resource.'.js', |
|
| 88 | 88 | 'app' => 'jsresourceloader', |
| 89 | 89 | ]); |
| 90 | 90 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | * @see appendIfExist() |
| 98 | 98 | */ |
| 99 | 99 | protected function appendScriptIfExist(string $root, string $file, ?string $webRoot = null): bool { |
| 100 | - if (!$this->appendIfExist($root, $file . '.mjs', $webRoot)) { |
|
| 101 | - return $this->appendIfExist($root, $file . '.js', $webRoot); |
|
| 100 | + if (!$this->appendIfExist($root, $file.'.mjs', $webRoot)) { |
|
| 101 | + return $this->appendIfExist($root, $file.'.js', $webRoot); |
|
| 102 | 102 | } |
| 103 | 103 | return true; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | protected function cacheAndAppendCombineJsonIfExist(string $root, string $file, string $app = 'core'): bool { |
| 107 | - if (is_file($root . '/' . $file)) { |
|
| 107 | + if (is_file($root.'/'.$file)) { |
|
| 108 | 108 | if ($this->jsCombiner->process($root, $file, $app)) { |
| 109 | 109 | $this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), null, false); |
| 110 | 110 | } else { |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function getResourcePath(): string { |
| 22 | - return $this->webPath . '/' . $this->resource; |
|
| 22 | + return $this->webPath.'/'.$this->resource; |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $debug = false; |
| 114 | 114 | http_response_code($statusCode); |
| 115 | 115 | try { |
| 116 | - $debug = (bool)Server::get(SystemConfig::class)->getValue('debug', false); |
|
| 116 | + $debug = (bool) Server::get(SystemConfig::class)->getValue('debug', false); |
|
| 117 | 117 | $serverLogsDocumentation = Server::get(SystemConfig::class)->getValue('documentation_url.server_logs', ''); |
| 118 | 118 | $request = Server::get(IRequest::class); |
| 119 | 119 | $content = $this->getTemplate('', 'exception', 'error', false); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | if ($debug) { |
| 165 | 165 | print("\n"); |
| 166 | - print($exception->getMessage() . ' ' . $exception->getFile() . ' at ' . $exception->getLine() . "\n"); |
|
| 166 | + print($exception->getMessage().' '.$exception->getFile().' at '.$exception->getLine()."\n"); |
|
| 167 | 167 | print($this->fakeEscapeForPlainText($exception->getTraceAsString())); |
| 168 | 168 | } |
| 169 | 169 | } |