Passed
Push — master ( 18f234...5a0b28 )
by John
16:38 queued 11s
created
core/templates/layout.user.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * @var array $_
5 5
  */
6 6
 
7
-$getUserAvatar = static function (int $size) use ($_): string {
7
+$getUserAvatar = static function(int $size) use ($_): string {
8 8
 	return \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
9 9
 		'userId' => $_['user_uid'],
10 10
 		'size' => $size,
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		<meta charset="utf-8">
19 19
 		<title>
20 20
 			<?php
21
-				p(!empty($_['application'])?$_['application'].' - ':'');
21
+				p(!empty($_['application']) ? $_['application'].' - ' : '');
22 22
 				p($theme->getTitle());
23 23
 			?>
24 24
 		</title>
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		<?php } ?>
29 29
 		<meta name="apple-mobile-web-app-capable" content="yes">
30 30
 		<meta name="apple-mobile-web-app-status-bar-style" content="black">
31
-		<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files')? $_['application']:$theme->getTitle()); ?>">
31
+		<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files') ? $_['application'] : $theme->getTitle()); ?>">
32 32
 		<meta name="mobile-web-app-capable" content="yes">
33 33
 		<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
34 34
 		<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		<?php emit_script_loading_tags($_); ?>
41 41
 		<?php print_unescaped($_['headers']); ?>
42 42
 	</head>
43
-	<body id="<?php p($_['bodyid']);?>" <?php foreach ($_['enabledThemes'] as $themeId) {
43
+	<body id="<?php p($_['bodyid']); ?>" <?php foreach ($_['enabledThemes'] as $themeId) {
44 44
 				p("data-theme-$themeId ");
45 45
 			}?> data-themes=<?php p(join(',', $_['enabledThemes'])) ?>>
46 46
 	<?php include 'layout.noscript.warning.php'; ?>
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 					id="nextcloud">
62 62
 					<div class="logo logo-icon">
63 63
 						<h1 class="hidden-visually">
64
-							<?php p($theme->getName()); ?> <?php p(!empty($_['application'])?$_['application']: $l->t('Apps')); ?>
64
+							<?php p($theme->getName()); ?> <?php p(!empty($_['application']) ? $_['application'] : $l->t('Apps')); ?>
65 65
 						</h1>
66 66
 					</div>
67 67
 				</a>
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 												<circle r="4.5" cx="21" cy="3" fill="black"/>
81 81
 											</mask>
82 82
 										</defs>
83
-										<image x="2" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" style="<?php if ($entry['unread'] !== 0) { ?>mask: url("#hole");<?php } ?>" class="app-icon"></image>
83
+										<image x="2" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" xlink:href="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" style="<?php if ($entry['unread'] !== 0) { ?>mask: url("#hole");<?php } ?>" class="app-icon"></image>
84 84
 										<circle class="app-icon-notification" r="3" cx="21" cy="3" fill="red"/>
85 85
 									</svg>
86 86
 								<div class="unread-counter" aria-hidden="true"><?php p($entry['unread']); ?></div>
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 													<circle r="4.5" cx="17" cy="3" fill="black"/>
118 118
 												</mask>
119 119
 											</defs>
120
-											<image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invertMenuMore-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" style="<?php if ($entry['unread'] !== 0) { ?>mask: url("#hole");<?php } ?>" class="app-icon"></image>
120
+											<image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invertMenuMore-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" style="<?php if ($entry['unread'] !== 0) { ?>mask: url("#hole");<?php } ?>" class="app-icon"></image>
121 121
 											<circle class="app-icon-notification" r="3" cx="17" cy="3" fill="red"/>
122 122
 										</svg>
123 123
 										<div class="unread-counter" aria-hidden="true"><?php p($entry['unread']); ?></div>
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 				<div id="contactsmenu">
139 139
 					<div class="icon-contacts menutoggle" tabindex="0" role="button"
140 140
 					aria-haspopup="true" aria-controls="contactsmenu-menu" aria-expanded="false">
141
-						<span class="hidden-visually"><?php p($l->t('Contacts'));?></span>
141
+						<span class="hidden-visually"><?php p($l->t('Contacts')); ?></span>
142 142
 					</div>
143 143
 					<div id="contactsmenu-menu" class="menu"
144
-						aria-label="<?php p($l->t('Contacts menu'));?>"></div>
144
+						aria-label="<?php p($l->t('Contacts menu')); ?>"></div>
145 145
 				</div>
146 146
 				<div id="settings">
147 147
 					<div id="expand" tabindex="0" role="button" class="menutoggle"
148
-						aria-label="<?php p($l->t('Settings'));?>"
148
+						aria-label="<?php p($l->t('Settings')); ?>"
149 149
 						aria-haspopup="true" aria-controls="expanddiv" aria-expanded="false">
150 150
 						<div id="avatardiv-menu" class="avatardiv<?php if ($_['userAvatarSet']) {
151 151
 				print_unescaped(' avatardiv-shown');
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 							<?php
163 163
 							if ($_['userAvatarSet']) {?>
164 164
 								<img alt="" width="32" height="32"
165
-								src="<?php p($avatar32);?>"
166
-								srcset="<?php p($getUserAvatar(64));?> 2x, <?php p($getUserAvatar(128));?> 4x"
165
+								src="<?php p($avatar32); ?>"
166
+								srcset="<?php p($getUserAvatar(64)); ?> 2x, <?php p($getUserAvatar(128)); ?> 4x"
167 167
 								>
168 168
 							<?php } ?>
169 169
 						</div>
170 170
 					</div>
171 171
 					<nav class="settings-menu" id="expanddiv" style="display:none;"
172
-						aria-label="<?php p($l->t('Settings menu'));?>">
172
+						aria-label="<?php p($l->t('Settings menu')); ?>">
173 173
 					<ul>
174 174
 					<?php foreach ($_['settingsnavigation'] as $entry):?>
175 175
 						<li data-id="<?php p($entry['id']); ?>">
176 176
 							<a href="<?php print_unescaped($entry['href']); ?>"
177 177
 								<?php if ($entry["active"]): ?> class="active"<?php endif; ?>>
178
-								<img alt="" src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>">
178
+								<img alt="" src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>">
179 179
 								<?php p($entry['name']) ?>
180 180
 							</a>
181 181
 						</li>
Please login to merge, or discard this patch.
lib/private/Template/SCSSCacher.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 		$this->defaults = $defaults;
105 105
 		$this->serverRoot = $serverRoot;
106 106
 		$this->cacheFactory = $cacheFactory;
107
-		$this->depsCache = $cacheFactory->createDistributed('SCSS-deps-' . md5($this->urlGenerator->getBaseUrl()));
108
-		$this->isCachedCache = $cacheFactory->createDistributed('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl()));
109
-		$lockingCache = $cacheFactory->createDistributed('SCSS-locks-' . md5($this->urlGenerator->getBaseUrl()));
107
+		$this->depsCache = $cacheFactory->createDistributed('SCSS-deps-'.md5($this->urlGenerator->getBaseUrl()));
108
+		$this->isCachedCache = $cacheFactory->createDistributed('SCSS-cached-'.md5($this->urlGenerator->getBaseUrl()));
109
+		$lockingCache = $cacheFactory->createDistributed('SCSS-locks-'.md5($this->urlGenerator->getBaseUrl()));
110 110
 		if (!($lockingCache instanceof IMemcache)) {
111 111
 			$lockingCache = new NullCache();
112 112
 		}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @throws NotPermittedException
126 126
 	 */
127 127
 	public function process(string $root, string $file, string $app): bool {
128
-		$path = explode('/', $root . '/' . $file);
128
+		$path = explode('/', $root.'/'.$file);
129 129
 
130 130
 		$fileNameSCSS = array_pop($path);
131 131
 		$fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app);
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 			$folder = $this->appData->newFolder($app);
143 143
 		}
144 144
 
145
-		$lockKey = $webDir . '/' . $fileNameSCSS;
145
+		$lockKey = $webDir.'/'.$fileNameSCSS;
146 146
 
147 147
 		if (!$this->lockingCache->add($lockKey, 'locked!', 120)) {
148
-			$this->logger->debug('SCSSCacher::process could not get lock for ' . $lockKey . ' and will wait 10 seconds for cached file to be available', ['app' => 'scss_cacher']);
148
+			$this->logger->debug('SCSSCacher::process could not get lock for '.$lockKey.' and will wait 10 seconds for cached file to be available', ['app' => 'scss_cacher']);
149 149
 			$retry = 0;
150 150
 			sleep(1);
151 151
 			while ($retry < 10) {
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 				sleep(1);
160 160
 				$retry++;
161 161
 			}
162
-			$this->logger->debug('SCSSCacher::process Giving up scss caching for ' . $lockKey, ['app' => 'scss_cacher']);
162
+			$this->logger->debug('SCSSCacher::process Giving up scss caching for '.$lockKey, ['app' => 'scss_cacher']);
163 163
 			return false;
164 164
 		}
165 165
 
166
-		$this->logger->debug('SCSSCacher::process Lock acquired for ' . $lockKey, ['app' => 'scss_cacher']);
166
+		$this->logger->debug('SCSSCacher::process Lock acquired for '.$lockKey, ['app' => 'scss_cacher']);
167 167
 		try {
168 168
 			$cached = $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
169 169
 		} catch (\Exception $e) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 		// Cleaning lock
175 175
 		$this->lockingCache->remove($lockKey);
176
-		$this->logger->debug('SCSSCacher::process Lock removed for ' . $lockKey, ['app' => 'scss_cacher']);
176
+		$this->logger->debug('SCSSCacher::process Lock removed for '.$lockKey, ['app' => 'scss_cacher']);
177 177
 
178 178
 		return $cached;
179 179
 	}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @return boolean
198 198
 	 */
199 199
 	private function isCached(string $fileNameCSS, string $app) {
200
-		$key = $this->config->getSystemValue('version') . '/' . $app . '/' . $fileNameCSS;
200
+		$key = $this->config->getSystemValue('version').'/'.$app.'/'.$fileNameCSS;
201 201
 
202 202
 		// If the file mtime is more recent than our cached one,
203 203
 		// let's consider the file is properly cached
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$cachedFile = $folder->getFile($fileNameCSS);
223 223
 			if ($cachedFile->getSize() > 0) {
224
-				$depFileName = $fileNameCSS . '.deps';
225
-				$deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
224
+				$depFileName = $fileNameCSS.'.deps';
225
+				$deps = $this->depsCache->get($folder->getName().'-'.$depFileName);
226 226
 				if ($deps === null) {
227 227
 					$depFile = $folder->getFile($depFileName);
228 228
 					$deps = $depFile->getContent();
229 229
 					// Set to memcache for next run
230
-					$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
230
+					$this->depsCache->set($folder->getName().'-'.$depFileName, $deps);
231 231
 				}
232 232
 				$deps = json_decode($deps, true);
233 233
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$this->logger->debug("SCSSCacher::isCached $fileNameCSS is not considered as cached cacheValue: $cacheValue", ['app' => 'scss_cacher']);
247 247
 			return false;
248 248
 		} catch (NotFoundException $e) {
249
-			$this->logger->debug("SCSSCacher::isCached NotFoundException " . $e->getMessage(), ['app' => 'scss_cacher']);
249
+			$this->logger->debug("SCSSCacher::isCached NotFoundException ".$e->getMessage(), ['app' => 'scss_cacher']);
250 250
 			return false;
251 251
 		}
252 252
 	}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$cachedVariables = $this->config->getAppValue('core', 'theming.variables', '');
260 260
 		$injectedVariables = $this->getInjectedVariables($cachedVariables);
261 261
 		if ($cachedVariables !== md5($injectedVariables)) {
262
-			$this->logger->debug('SCSSCacher::variablesChanged storedVariables: ' . json_encode($this->config->getAppValue('core', 'theming.variables')) . ' currentInjectedVariables: ' . json_encode($injectedVariables), ['app' => 'scss_cacher']);
262
+			$this->logger->debug('SCSSCacher::variablesChanged storedVariables: '.json_encode($this->config->getAppValue('core', 'theming.variables')).' currentInjectedVariables: '.json_encode($injectedVariables), ['app' => 'scss_cacher']);
263 263
 			$this->config->setAppValue('core', 'theming.variables', md5($injectedVariables));
264 264
 			$this->resetCache();
265 265
 			return true;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$scss = new Compiler();
283 283
 		$scss->setImportPaths([
284 284
 			$path,
285
-			$this->serverRoot . '/core/css/'
285
+			$this->serverRoot.'/core/css/'
286 286
 		]);
287 287
 
288 288
 		// Continue after throw
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			$cachedfile = $folder->newFile($fileNameCSS);
301 301
 		}
302 302
 
303
-		$depFileName = $fileNameCSS . '.deps';
303
+		$depFileName = $fileNameCSS.'.deps';
304 304
 		try {
305 305
 			$depFile = $folder->getFile($depFileName);
306 306
 		} catch (NotFoundException $e) {
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 		// Compile
311 311
 		try {
312 312
 			$compiledScss = $scss->compile(
313
-				'$webroot: \'' . $this->getRoutePrefix() . '\';' .
314
-				$this->getInjectedVariables() .
315
-				'@import "variables.scss";' .
316
-				'@import "functions.scss";' .
317
-				'@import "' . $fileNameSCSS . '";');
313
+				'$webroot: \''.$this->getRoutePrefix().'\';'.
314
+				$this->getInjectedVariables().
315
+				'@import "variables.scss";'.
316
+				'@import "functions.scss";'.
317
+				'@import "'.$fileNameSCSS.'";');
318 318
 		} catch (\Exception $e) {
319 319
 			$this->logger->error($e->getMessage(), ['app' => 'scss_cacher', 'exception' => $e]);
320 320
 
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 
324 324
 		// Gzip file
325 325
 		try {
326
-			$gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
326
+			$gzipFile = $folder->getFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz
327 327
 		} catch (NotFoundException $e) {
328
-			$gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
328
+			$gzipFile = $folder->newFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz
329 329
 		}
330 330
 
331 331
 		try {
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
 			$cachedfile->putContent($data);
334 334
 			$deps = json_encode($scss->getParsedFiles());
335 335
 			$depFile->putContent($deps);
336
-			$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
336
+			$this->depsCache->set($folder->getName().'-'.$depFileName, $deps);
337 337
 			$gzipFile->putContent(gzencode($data, 9));
338
-			$this->logger->debug('SCSSCacher::cache ' . $webDir . '/' . $fileNameSCSS . ' compiled and successfully cached', ['app' => 'scss_cacher']);
338
+			$this->logger->debug('SCSSCacher::cache '.$webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'scss_cacher']);
339 339
 
340 340
 			return true;
341 341
 		} catch (NotPermittedException $e) {
342
-			$this->logger->error('SCSSCacher::cache unable to cache: ' . $fileNameSCSS, ['app' => 'scss_cacher']);
342
+			$this->logger->error('SCSSCacher::cache unable to cache: '.$fileNameSCSS, ['app' => 'scss_cacher']);
343 343
 
344 344
 			return false;
345 345
 		}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				try {
369 369
 					$file->delete();
370 370
 				} catch (NotPermittedException $e) {
371
-					$this->logger->error('SCSSCacher::resetCache unable to delete file: ' . $file->getName(), ['exception' => $e, 'app' => 'scss_cacher']);
371
+					$this->logger->error('SCSSCacher::resetCache unable to delete file: '.$file->getName(), ['exception' => $e, 'app' => 'scss_cacher']);
372 372
 				}
373 373
 			}
374 374
 		}
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		}
387 387
 		$variables = '';
388 388
 		foreach ($this->defaults->getScssVariables() as $key => $value) {
389
-			$variables .= '$' . $key . ': ' . $value . ' !default;';
389
+			$variables .= '$'.$key.': '.$value.' !default;';
390 390
 		}
391 391
 
392 392
 		/*
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 */
419 419
 	private function rebaseUrls(string $css, string $webDir): string {
420 420
 		$re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x';
421
-		$subst = 'url(\'' . $webDir . '/$1\')';
421
+		$subst = 'url(\''.$webDir.'/$1\')';
422 422
 
423 423
 		return preg_replace($re, $subst, $css);
424 424
 	}
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 	 * @return string
448 448
 	 */
449 449
 	private function prependBaseurlPrefix(string $cssFile): string {
450
-		return substr(md5($this->urlGenerator->getBaseUrl() . $this->getRoutePrefix()), 0, 4) . '-' . $cssFile;
450
+		return substr(md5($this->urlGenerator->getBaseUrl().$this->getRoutePrefix()), 0, 4).'-'.$cssFile;
451 451
 	}
452 452
 
453 453
 	private function getRoutePrefix() {
454 454
 		$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
455
-		$prefix = \OC::$WEBROOT . '/index.php';
455
+		$prefix = \OC::$WEBROOT.'/index.php';
456 456
 		if ($frontControllerActive) {
457 457
 			$prefix = \OC::$WEBROOT;
458 458
 		}
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	private function prependVersionPrefix(string $cssFile, string $appId): string {
469 469
 		$appVersion = \OC_App::getAppVersion($appId);
470 470
 		if ($appVersion !== '0') {
471
-			return substr(md5($appVersion), 0, 4) . '-' . $cssFile;
471
+			return substr(md5($appVersion), 0, 4).'-'.$cssFile;
472 472
 		}
473 473
 		$coreVersion = \OC_Util::getVersionString();
474 474
 
475
-		return substr(md5($coreVersion), 0, 4) . '-' . $cssFile;
475
+		return substr(md5($coreVersion), 0, 4).'-'.$cssFile;
476 476
 	}
477 477
 
478 478
 	/**
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 			$appDirectoryPath = explode($appName, $path)[1];
491 491
 			// Remove the webroot
492 492
 
493
-			return str_replace($webRoot, '', $appWebPath . $appDirectoryPath);
493
+			return str_replace($webRoot, '', $appWebPath.$appDirectoryPath);
494 494
 		}
495 495
 
496
-		return $webRoot . substr($path, strlen($serverRoot));
496
+		return $webRoot.substr($path, strlen($serverRoot));
497 497
 	}
498 498
 }
Please login to merge, or discard this patch.