@@ -57,41 +57,41 @@ 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 | // Add navigation entry |
| 79 | - $this->assign( 'application', ''); |
|
| 80 | - $this->assign( 'appid', $appId ); |
|
| 79 | + $this->assign('application', ''); |
|
| 80 | + $this->assign('appid', $appId); |
|
| 81 | 81 | $navigation = \OC::$server->getNavigationManager()->getAll(); |
| 82 | - $this->assign( 'navigation', $navigation); |
|
| 82 | + $this->assign('navigation', $navigation); |
|
| 83 | 83 | $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
| 84 | - $this->assign( 'settingsnavigation', $settingsNavigation); |
|
| 85 | - foreach($navigation as $entry) { |
|
| 84 | + $this->assign('settingsnavigation', $settingsNavigation); |
|
| 85 | + foreach ($navigation as $entry) { |
|
| 86 | 86 | if ($entry['active']) { |
| 87 | - $this->assign( 'application', $entry['name'] ); |
|
| 87 | + $this->assign('application', $entry['name']); |
|
| 88 | 88 | break; |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - foreach($settingsNavigation as $entry) { |
|
| 92 | + foreach ($settingsNavigation as $entry) { |
|
| 93 | 93 | if ($entry['active']) { |
| 94 | - $this->assign( 'application', $entry['name'] ); |
|
| 94 | + $this->assign('application', $entry['name']); |
|
| 95 | 95 | break; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $this->assign('user_uid', \OC_User::getUser()); |
| 129 | 129 | } else if ($renderAs == 'public') { |
| 130 | 130 | parent::__construct('core', 'layout.public'); |
| 131 | - $this->assign( 'appid', $appId ); |
|
| 131 | + $this->assign('appid', $appId); |
|
| 132 | 132 | $this->assign('bodyid', 'body-public'); |
| 133 | 133 | $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
| 134 | 134 | } else { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $this->assign('language', $lang); |
| 145 | 145 | $this->assign('locale', $locale); |
| 146 | 146 | |
| 147 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 147 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 148 | 148 | if (empty(self::$versionHash)) { |
| 149 | 149 | $v = \OC_App::getAppVersions(); |
| 150 | 150 | $v['core'] = implode('.', \OCP\Util::getVersion()); |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - foreach($jsFiles as $info) { |
|
| 179 | + foreach ($jsFiles as $info) { |
|
| 180 | 180 | $web = $info[1]; |
| 181 | 181 | $file = $info[2]; |
| 182 | - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 182 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | try { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | // Do not initialise scss appdata until we have a fully installed instance |
| 192 | 192 | // Do not load scss for update, errors, installation or login page |
| 193 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 193 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 194 | 194 | && !\OCP\Util::needUpgrade() |
| 195 | 195 | && $pathInfo !== '' |
| 196 | 196 | && !preg_match('/^\/login/', $pathInfo) |
@@ -207,19 +207,19 @@ discard block |
||
| 207 | 207 | $this->assign('cssfiles', array()); |
| 208 | 208 | $this->assign('printcssfiles', []); |
| 209 | 209 | $this->assign('versionHash', self::$versionHash); |
| 210 | - foreach($cssFiles as $info) { |
|
| 210 | + foreach ($cssFiles as $info) { |
|
| 211 | 211 | $web = $info[1]; |
| 212 | 212 | $file = $info[2]; |
| 213 | 213 | |
| 214 | 214 | if (substr($file, -strlen('print.css')) === 'print.css') { |
| 215 | - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 215 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 216 | 216 | } else { |
| 217 | 217 | $suffix = $this->getVersionHashSuffix($web, $file); |
| 218 | 218 | |
| 219 | 219 | if (strpos($file, '?v=') == false) { |
| 220 | - $this->append( 'cssfiles', $web.'/'.$file . $suffix); |
|
| 220 | + $this->append('cssfiles', $web.'/'.$file.$suffix); |
|
| 221 | 221 | } else { |
| 222 | - $this->append( 'cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); |
|
| 222 | + $this->append('cssfiles', $web.'/'.$file.'-'.substr($suffix, 3)); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | if ($this->config->getSystemValue('installed', false)) { |
| 247 | 247 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
| 248 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 248 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 249 | 249 | } |
| 250 | 250 | $v = \OC_App::getAppVersions(); |
| 251 | 251 | } |
@@ -253,21 +253,21 @@ discard block |
||
| 253 | 253 | // Try the webroot path for a match |
| 254 | 254 | if ($path !== false && $path !== '') { |
| 255 | 255 | $appName = $this->getAppNamefromPath($path); |
| 256 | - if(array_key_exists($appName, $v)) { |
|
| 256 | + if (array_key_exists($appName, $v)) { |
|
| 257 | 257 | $appVersion = $v[$appName]; |
| 258 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 258 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | // fallback to the file path instead |
| 262 | 262 | if ($file !== false && $file !== '') { |
| 263 | 263 | $appName = $this->getAppNamefromPath($file); |
| 264 | - if(array_key_exists($appName, $v)) { |
|
| 264 | + if (array_key_exists($appName, $v)) { |
|
| 265 | 265 | $appVersion = $v[$appName]; |
| 266 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 266 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
| 270 | + return '?v='.self::$versionHash.$themingSuffix; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // Read the selected theme from the config file |
| 279 | 279 | $theme = \OC_Util::getTheme(); |
| 280 | 280 | |
| 281 | - if($compileScss) { |
|
| 281 | + if ($compileScss) { |
|
| 282 | 282 | $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
| 283 | 283 | } else { |
| 284 | 284 | $SCSSCacher = null; |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | $locator = new \OC\Template\CSSResourceLocator( |
| 288 | 288 | \OC::$server->getLogger(), |
| 289 | 289 | $theme, |
| 290 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 291 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 290 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 291 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 292 | 292 | $SCSSCacher |
| 293 | 293 | ); |
| 294 | 294 | $locator->find($styles); |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | $locator = new \OC\Template\JSResourceLocator( |
| 324 | 324 | \OC::$server->getLogger(), |
| 325 | 325 | $theme, |
| 326 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 327 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 326 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 327 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 328 | 328 | \OC::$server->query(JSCombiner::class) |
| 329 | 329 | ); |
| 330 | 330 | $locator->find($scripts); |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public static function convertToRelativePath($filePath) { |
| 341 | 341 | $relativePath = explode(\OC::$SERVERROOT, $filePath); |
| 342 | - if(count($relativePath) !== 2) { |
|
| 342 | + if (count($relativePath) !== 2) { |
|
| 343 | 343 | throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
| 344 | 344 | } |
| 345 | 345 | |