@@ -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 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $this->assign('bodyid', 'body-login'); |
| 125 | 125 | } else if ($renderAs == 'public') { |
| 126 | 126 | parent::__construct('core', 'layout.public'); |
| 127 | - $this->assign( 'appid', $appId ); |
|
| 127 | + $this->assign('appid', $appId); |
|
| 128 | 128 | $this->assign('bodyid', 'body-public'); |
| 129 | 129 | $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
| 130 | 130 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->assign('language', $lang); |
| 141 | 141 | $this->assign('locale', $locale); |
| 142 | 142 | |
| 143 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 143 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
| 144 | 144 | if (empty(self::$versionHash)) { |
| 145 | 145 | $v = \OC_App::getAppVersions(); |
| 146 | 146 | $v['core'] = implode('.', \OCP\Util::getVersion()); |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - foreach($jsFiles as $info) { |
|
| 175 | + foreach ($jsFiles as $info) { |
|
| 176 | 176 | $web = $info[1]; |
| 177 | 177 | $file = $info[2]; |
| 178 | - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 178 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | try { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | // Do not initialise scss appdata until we have a fully installed instance |
| 188 | 188 | // Do not load scss for update, errors, installation or login page |
| 189 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 189 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
| 190 | 190 | && !\OCP\Util::needUpgrade() |
| 191 | 191 | && $pathInfo !== '' |
| 192 | 192 | && !preg_match('/^\/login/', $pathInfo) |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | $this->assign('cssfiles', array()); |
| 204 | 204 | $this->assign('printcssfiles', []); |
| 205 | 205 | $this->assign('versionHash', self::$versionHash); |
| 206 | - foreach($cssFiles as $info) { |
|
| 206 | + foreach ($cssFiles as $info) { |
|
| 207 | 207 | $web = $info[1]; |
| 208 | 208 | $file = $info[2]; |
| 209 | 209 | |
| 210 | 210 | if (substr($file, -strlen('print.css')) === 'print.css') { |
| 211 | - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
| 211 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
| 212 | 212 | } else { |
| 213 | - $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file) ); |
|
| 213 | + $this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix($web, $file)); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | if ($this->config->getSystemValue('installed', false)) { |
| 232 | 232 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
| 233 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 233 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
| 234 | 234 | } |
| 235 | 235 | $v = \OC_App::getAppVersions(); |
| 236 | 236 | } |
@@ -238,21 +238,21 @@ discard block |
||
| 238 | 238 | // Try the webroot path for a match |
| 239 | 239 | if ($path !== false && $path !== '') { |
| 240 | 240 | $appName = $this->getAppNamefromPath($path); |
| 241 | - if(array_key_exists($appName, $v)) { |
|
| 241 | + if (array_key_exists($appName, $v)) { |
|
| 242 | 242 | $appVersion = $v[$appName]; |
| 243 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 243 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | // fallback to the file path instead |
| 247 | 247 | if ($file !== false && $file !== '') { |
| 248 | 248 | $appName = $this->getAppNamefromPath($file); |
| 249 | - if(array_key_exists($appName, $v)) { |
|
| 249 | + if (array_key_exists($appName, $v)) { |
|
| 250 | 250 | $appVersion = $v[$appName]; |
| 251 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
| 251 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
| 255 | + return '?v='.self::$versionHash.$themingSuffix; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | // Read the selected theme from the config file |
| 264 | 264 | $theme = \OC_Util::getTheme(); |
| 265 | 265 | |
| 266 | - if($compileScss) { |
|
| 266 | + if ($compileScss) { |
|
| 267 | 267 | $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
| 268 | 268 | } else { |
| 269 | 269 | $SCSSCacher = null; |
@@ -272,8 +272,8 @@ discard block |
||
| 272 | 272 | $locator = new \OC\Template\CSSResourceLocator( |
| 273 | 273 | \OC::$server->getLogger(), |
| 274 | 274 | $theme, |
| 275 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 276 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 275 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 276 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 277 | 277 | $SCSSCacher |
| 278 | 278 | ); |
| 279 | 279 | $locator->find($styles); |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | $locator = new \OC\Template\JSResourceLocator( |
| 309 | 309 | \OC::$server->getLogger(), |
| 310 | 310 | $theme, |
| 311 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 312 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
| 311 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 312 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
| 313 | 313 | \OC::$server->query(JSCombiner::class) |
| 314 | 314 | ); |
| 315 | 315 | $locator->find($scripts); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public static function convertToRelativePath($filePath) { |
| 326 | 326 | $relativePath = explode(\OC::$SERVERROOT, $filePath); |
| 327 | - if(count($relativePath) !== 2) { |
|
| 327 | + if (count($relativePath) !== 2) { |
|
| 328 | 328 | throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
| 329 | 329 | } |
| 330 | 330 | |