@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->defaultLogoClaim = ''; |
66 | 66 | $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */ |
67 | 67 | |
68 | - $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; |
|
68 | + $themePath = OC::$SERVERROOT.'/themes/'.OC_Util::getTheme().'/defaults.php'; |
|
69 | 69 | if (file_exists($themePath)) { |
70 | 70 | // prevent defaults.php from printing output |
71 | 71 | ob_start(); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | if ($this->themeExist('getShortFooter')) { |
240 | 240 | $footer = $this->theme->getShortFooter(); |
241 | 241 | } else { |
242 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
243 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
244 | - ' – ' . $this->getSlogan(); |
|
242 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
243 | + ' rel="noreferrer">'.$this->getEntity().'</a>'. |
|
244 | + ' – '.$this->getSlogan(); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $footer; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | if ($this->themeExist('buildDocLinkToKey')) { |
269 | 269 | return $this->theme->buildDocLinkToKey($key); |
270 | 270 | } |
271 | - return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key; |
|
271 | + return $this->getDocBaseUrl().'/server/'.$this->defaultDocVersion.'/go.php?to='.$key; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return array scss variables to overwrite |
288 | 288 | */ |
289 | 289 | public function getScssVariables() { |
290 | - if($this->themeExist('getScssVariables')) { |
|
290 | + if ($this->themeExist('getScssVariables')) { |
|
291 | 291 | return $this->theme->getScssVariables(); |
292 | 292 | } |
293 | 293 | return []; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | public function getShortFooter() { |
114 | 114 | $slogan = $this->getSlogan(); |
115 | - $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . |
|
116 | - ' rel="noreferrer">' .$this->getEntity() . '</a>'. |
|
117 | - ($slogan !== '' ? ' – ' . $slogan : ''); |
|
115 | + $footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'. |
|
116 | + ' rel="noreferrer">'.$this->getEntity().'</a>'. |
|
117 | + ($slogan !== '' ? ' – '.$slogan : ''); |
|
118 | 118 | |
119 | 119 | return $footer; |
120 | 120 | } |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | $file = null; |
141 | 141 | } |
142 | 142 | $logo = $this->config->getAppValue('theming', 'logoMime', false); |
143 | - if(!$logo || $file === null) { |
|
144 | - return $this->urlGenerator->imagePath('core','logo.svg'); |
|
143 | + if (!$logo || $file === null) { |
|
144 | + return $this->urlGenerator->imagePath('core', 'logo.svg'); |
|
145 | 145 | } else { |
146 | 146 | return $this->urlGenerator->linkToRoute('theming.Theming.getLogo'); |
147 | 147 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $file = null; |
160 | 160 | } |
161 | 161 | $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); |
162 | - if(!$backgroundLogo || $file === null) { |
|
163 | - return $this->urlGenerator->imagePath('core','background.jpg'); |
|
162 | + if (!$backgroundLogo || $file === null) { |
|
163 | + return $this->urlGenerator->imagePath('core', 'background.jpg'); |
|
164 | 164 | } else { |
165 | 165 | return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground'); |
166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function getScssVariables() { |
174 | 174 | $cache = $this->cacheFactory->create('theming'); |
175 | - if($value = $cache->get('getScssVariables')) { |
|
175 | + if ($value = $cache->get('getScssVariables')) { |
|
176 | 176 | return $value; |
177 | 177 | } |
178 | 178 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function shouldReplaceIcons() { |
206 | 206 | $cache = $this->cacheFactory->create('theming'); |
207 | - if($value = $cache->get('shouldReplaceIcons')) { |
|
208 | - return (bool)$value; |
|
207 | + if ($value = $cache->get('shouldReplaceIcons')) { |
|
208 | + return (bool) $value; |
|
209 | 209 | } |
210 | 210 | $value = false; |
211 | - if(extension_loaded('imagick')) { |
|
211 | + if (extension_loaded('imagick')) { |
|
212 | 212 | $checkImagick = new \Imagick(); |
213 | 213 | if (count($checkImagick->queryFormats('SVG')) >= 1) { |
214 | 214 | $value = true; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function increaseCacheBuster() { |
226 | 226 | $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); |
227 | - $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); |
|
227 | + $this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1); |
|
228 | 228 | $this->cacheFactory->create('theming')->clear('getScssVariables'); |
229 | 229 | } |
230 | 230 |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | * @return boolean |
76 | 76 | */ |
77 | 77 | public function process($root, $file, $app) { |
78 | - $path = explode('/', $root . '/' . $file); |
|
78 | + $path = explode('/', $root.'/'.$file); |
|
79 | 79 | |
80 | 80 | $fileNameSCSS = array_pop($path); |
81 | 81 | $fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS); |
82 | 82 | |
83 | 83 | $path = implode('/', $path); |
84 | 84 | |
85 | - $webDir = substr($path, strlen($this->serverRoot)+1); |
|
85 | + $webDir = substr($path, strlen($this->serverRoot) + 1); |
|
86 | 86 | |
87 | 87 | try { |
88 | 88 | $folder = $this->appData->getFolder($app); |
89 | - } catch(NotFoundException $e) { |
|
89 | + } catch (NotFoundException $e) { |
|
90 | 90 | // creating css appdata folder |
91 | 91 | $folder = $this->appData->newFolder($app); |
92 | 92 | } |
93 | 93 | |
94 | - if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder, $path)) { |
|
94 | + if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder, $path)) { |
|
95 | 95 | return true; |
96 | 96 | } |
97 | 97 | return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | try { |
109 | 109 | $cachedFile = $folder->getFile($fileNameCSS); |
110 | 110 | if ($cachedFile->getSize() > 0) { |
111 | - $depFile = $folder->getFile($fileNameCSS . '.deps'); |
|
111 | + $depFile = $folder->getFile($fileNameCSS.'.deps'); |
|
112 | 112 | $deps = json_decode($depFile->getContent(), true); |
113 | 113 | |
114 | 114 | foreach ($deps as $file=>$mtime) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | } |
120 | 120 | return true; |
121 | - } catch(NotFoundException $e) { |
|
121 | + } catch (NotFoundException $e) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | private function variablesChanged() { |
133 | 133 | $injectedVariables = $this->getInjectedVariables(); |
134 | - if($injectedVariables !== '' && $this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
134 | + if ($injectedVariables !== '' && $this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
135 | 135 | $this->resetCache(); |
136 | 136 | $this->config->setAppValue('core', 'scss.variables', md5($injectedVariables)); |
137 | 137 | return true; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | $scss = new Compiler(); |
153 | 153 | $scss->setImportPaths([ |
154 | 154 | $path, |
155 | - \OC::$SERVERROOT . '/core/css/', |
|
155 | + \OC::$SERVERROOT.'/core/css/', |
|
156 | 156 | ]); |
157 | - if($this->config->getSystemValue('debug')) { |
|
157 | + if ($this->config->getSystemValue('debug')) { |
|
158 | 158 | // Debug mode |
159 | 159 | $scss->setFormatter(Expanded::class); |
160 | 160 | $scss->setLineNumberStyle(Compiler::LINE_COMMENTS); |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | |
166 | 166 | try { |
167 | 167 | $cachedfile = $folder->getFile($fileNameCSS); |
168 | - } catch(NotFoundException $e) { |
|
168 | + } catch (NotFoundException $e) { |
|
169 | 169 | $cachedfile = $folder->newFile($fileNameCSS); |
170 | 170 | } |
171 | 171 | |
172 | - $depFileName = $fileNameCSS . '.deps'; |
|
172 | + $depFileName = $fileNameCSS.'.deps'; |
|
173 | 173 | try { |
174 | 174 | $depFile = $folder->getFile($depFileName); |
175 | 175 | } catch (NotFoundException $e) { |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | // Compile |
180 | 180 | try { |
181 | 181 | $compiledScss = $scss->compile( |
182 | - '@import "variables.scss";' . |
|
183 | - $this->getInjectedVariables() . |
|
182 | + '@import "variables.scss";'. |
|
183 | + $this->getInjectedVariables(). |
|
184 | 184 | '@import "'.$fileNameSCSS.'";'); |
185 | - } catch(ParserException $e) { |
|
185 | + } catch (ParserException $e) { |
|
186 | 186 | $this->logger->error($e, ['app' => 'core']); |
187 | 187 | return false; |
188 | 188 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $depFile->putContent(json_encode($scss->getParsedFiles())); |
193 | 193 | $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); |
194 | 194 | return true; |
195 | - } catch(NotPermittedException $e) { |
|
195 | + } catch (NotPermittedException $e) { |
|
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | private function resetCache() { |
205 | 205 | foreach ($this->appData->getDirectoryListing() as $folder) { |
206 | 206 | foreach ($folder->getDirectoryListing() as $file) { |
207 | - if(substr($file->getName(), -3) === "css" || substr($file->getName(), -4) === "deps") { |
|
207 | + if (substr($file->getName(), -3) === "css" || substr($file->getName(), -4) === "deps") { |
|
208 | 208 | $file->delete(); |
209 | 209 | } |
210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function getInjectedVariables() { |
218 | 218 | $variables = ''; |
219 | 219 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
220 | - $variables .= '$' . $key . ': ' . $value . ';'; |
|
220 | + $variables .= '$'.$key.': '.$value.';'; |
|
221 | 221 | } |
222 | 222 | return $variables; |
223 | 223 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | private function rebaseUrls($css, $webDir) { |
232 | 232 | $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x'; |
233 | 233 | // OC\Route\Router:75 |
234 | - if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
234 | + if (($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
235 | 235 | $subst = 'url(\'../../'.$webDir.'/$1\')'; |
236 | 236 | } else { |
237 | 237 | $subst = 'url(\'../../../'.$webDir.'/$1\')'; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $appPath = substr(\OC::$server->getAppManager()->getAppPath('theming'), strlen(\OC::$SERVERROOT) + 1); |
354 | 354 | $SCSSCacher->process( |
355 | 355 | \OC::$SERVERROOT, |
356 | - $appPath . '/css/theming.scss', |
|
356 | + $appPath.'/css/theming.scss', |
|
357 | 357 | $cacheBusterValue |
358 | 358 | ); |
359 | 359 | |
@@ -383,12 +383,12 @@ discard block |
||
383 | 383 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
384 | 384 | $responseJS = '(function() { |
385 | 385 | OCA.Theming = { |
386 | - name: ' . json_encode($this->themingDefaults->getName()) . ', |
|
387 | - url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ', |
|
388 | - slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ', |
|
389 | - color: ' . json_encode($this->themingDefaults->getMailHeaderColor()) . ', |
|
390 | - inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getMailHeaderColor())) . ', |
|
391 | - cacheBuster: ' . json_encode($cacheBusterValue) . ' |
|
386 | + name: ' . json_encode($this->themingDefaults->getName()).', |
|
387 | + url: ' . json_encode($this->themingDefaults->getBaseUrl()).', |
|
388 | + slogan: ' . json_encode($this->themingDefaults->getSlogan()).', |
|
389 | + color: ' . json_encode($this->themingDefaults->getMailHeaderColor()).', |
|
390 | + inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getMailHeaderColor())).', |
|
391 | + cacheBuster: ' . json_encode($cacheBusterValue).' |
|
392 | 392 | }; |
393 | 393 | })();'; |
394 | 394 | $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); |