@@ -57,47 +57,47 @@ discard block |
||
| 57 | 57 | * @param string $renderAs |
| 58 | 58 | * @param string $appId application id |
| 59 | 59 | */ |
| 60 | - public function __construct( $renderAs, $appId = '' ) { |
|
| 60 | + public function __construct($renderAs, $appId = '') { |
|
| 61 | 61 | |
| 62 | 62 | // yes - should be injected .... |
| 63 | 63 | $this->config = \OC::$server->getConfig(); |
| 64 | 64 | |
| 65 | - if(\OCP\Util::isIE()) { |
|
| 65 | + if (\OCP\Util::isIE()) { |
|
| 66 | 66 | \OC_Util::addStyle('ie'); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Decide which page we show |
| 70 | - if($renderAs == 'user') { |
|
| 71 | - parent::__construct( 'core', 'layout.user' ); |
|
| 72 | - if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
| 70 | + if ($renderAs == 'user') { |
|
| 71 | + parent::__construct('core', 'layout.user'); |
|
| 72 | + if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { |
|
| 73 | 73 | $this->assign('bodyid', 'body-settings'); |
| 74 | - }else{ |
|
| 74 | + } else { |
|
| 75 | 75 | $this->assign('bodyid', 'body-user'); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Code integrity notification |
| 79 | 79 | $integrityChecker = \OC::$server->getIntegrityCodeChecker(); |
| 80 | - if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
| 80 | + if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
| 81 | 81 | \OCP\Util::addScript('core', 'integritycheck-failed-notification'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Add navigation entry |
| 85 | - $this->assign( 'application', ''); |
|
| 86 | - $this->assign( 'appid', $appId ); |
|
| 85 | + $this->assign('application', ''); |
|
| 86 | + $this->assign('appid', $appId); |
|
| 87 | 87 | $navigation = \OC::$server->getNavigationManager()->getAll(); |
| 88 | - $this->assign( 'navigation', $navigation); |
|
| 88 | + $this->assign('navigation', $navigation); |
|
| 89 | 89 | $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
| 90 | - $this->assign( 'settingsnavigation', $settingsNavigation); |
|
| 91 | - foreach($navigation as $entry) { |
|
| 90 | + $this->assign('settingsnavigation', $settingsNavigation); |
|
| 91 | + foreach ($navigation as $entry) { |
|
| 92 | 92 | if ($entry['active']) { |
| 93 | - $this->assign( 'application', $entry['name'] ); |
|
| 93 | + $this->assign('application', $entry['name']); |
|
| 94 | 94 | break; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - foreach($settingsNavigation as $entry) { |
|
| 98 | + foreach ($settingsNavigation as $entry) { |
|
| 99 | 99 | if ($entry['active']) { |
| 100 | - $this->assign( 'application', $entry['name'] ); |
|
| 100 | + $this->assign('application', $entry['name']); |
|
| 101 | 101 | break; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->assign('bodyid', 'body-login'); |
| 131 | 131 | } else if ($renderAs == 'public') { |
| 132 | 132 | parent::__construct('core', 'layout.public'); |
| 133 | - $this->assign( 'appid', $appId ); |
|
| 133 | + $this->assign('appid', $appId); |
|
| 134 | 134 | $this->assign('bodyid', 'body-public'); |
| 135 | 135 | $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
| 136 | 136 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $this->assign('language', $lang); |
| 147 | 147 | $this->assign('locale', $locale); |
| 148 | 148 | |
| 149 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 149 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 150 | 150 | if (empty(self::$versionHash)) { |
| 151 | 151 | $v = \OC_App::getAppVersions(); |
| 152 | 152 | $v['core'] = implode('.', \OCP\Util::getVersion()); |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | - foreach($jsFiles as $info) { |
|
| 181 | + foreach ($jsFiles as $info) { |
|
| 182 | 182 | $web = $info[1]; |
| 183 | 183 | $file = $info[2]; |
| 184 | - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 184 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | try { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | // Do not initialise scss appdata until we have a fully installed instance |
| 194 | 194 | // Do not load scss for update, errors, installation or login page |
| 195 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 195 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 196 | 196 | && !\OCP\Util::needUpgrade() |
| 197 | 197 | && $pathInfo !== '' |
| 198 | 198 | && !preg_match('/^\/login/', $pathInfo) |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | $this->assign('cssfiles', array()); |
| 210 | 210 | $this->assign('printcssfiles', []); |
| 211 | 211 | $this->assign('versionHash', self::$versionHash); |
| 212 | - foreach($cssFiles as $info) { |
|
| 212 | + foreach ($cssFiles as $info) { |
|
| 213 | 213 | $web = $info[1]; |
| 214 | 214 | $file = $info[2]; |
| 215 | 215 | |
| 216 | 216 | if (substr($file, -strlen('print.css')) === 'print.css') { |
| 217 | - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 217 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 218 | 218 | } else { |
| 219 | - $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file) ); |
|
| 219 | + $this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix($web, $file)); |
|
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | if ($this->config->getSystemValue('installed', false)) { |
| 238 | 238 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
| 239 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 239 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 240 | 240 | } |
| 241 | 241 | $v = \OC_App::getAppVersions(); |
| 242 | 242 | } |
@@ -244,21 +244,21 @@ discard block |
||
| 244 | 244 | // Try the webroot path for a match |
| 245 | 245 | if ($path !== false && $path !== '') { |
| 246 | 246 | $appName = $this->getAppNamefromPath($path); |
| 247 | - if(array_key_exists($appName, $v)) { |
|
| 247 | + if (array_key_exists($appName, $v)) { |
|
| 248 | 248 | $appVersion = $v[$appName]; |
| 249 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 249 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | // fallback to the file path instead |
| 253 | 253 | if ($file !== false && $file !== '') { |
| 254 | 254 | $appName = $this->getAppNamefromPath($file); |
| 255 | - if(array_key_exists($appName, $v)) { |
|
| 255 | + if (array_key_exists($appName, $v)) { |
|
| 256 | 256 | $appVersion = $v[$appName]; |
| 257 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 257 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
| 261 | + return '?v='.self::$versionHash.$themingSuffix; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | // Read the selected theme from the config file |
| 270 | 270 | $theme = \OC_Util::getTheme(); |
| 271 | 271 | |
| 272 | - if($compileScss) { |
|
| 272 | + if ($compileScss) { |
|
| 273 | 273 | $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
| 274 | 274 | } else { |
| 275 | 275 | $SCSSCacher = null; |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | $locator = new \OC\Template\CSSResourceLocator( |
| 279 | 279 | \OC::$server->getLogger(), |
| 280 | 280 | $theme, |
| 281 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 282 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 281 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 282 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 283 | 283 | $SCSSCacher |
| 284 | 284 | ); |
| 285 | 285 | $locator->find($styles); |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | $locator = new \OC\Template\JSResourceLocator( |
| 315 | 315 | \OC::$server->getLogger(), |
| 316 | 316 | $theme, |
| 317 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 318 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 317 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 318 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 319 | 319 | \OC::$server->query(JSCombiner::class) |
| 320 | 320 | ); |
| 321 | 321 | $locator->find($scripts); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public static function convertToRelativePath($filePath) { |
| 332 | 332 | $relativePath = explode(\OC::$SERVERROOT, $filePath); |
| 333 | - if(count($relativePath) !== 2) { |
|
| 333 | + if (count($relativePath) !== 2) { |
|
| 334 | 334 | throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
| 335 | 335 | } |
| 336 | 336 | |