@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | public function process($root, $file, $app) { |
92 | - $path = explode('/', $root . '/' . $file); |
|
92 | + $path = explode('/', $root.'/'.$file); |
|
93 | 93 | |
94 | 94 | $fileNameSCSS = array_pop($path); |
95 | 95 | $fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS); |
96 | 96 | |
97 | 97 | $path = implode('/', $path); |
98 | 98 | |
99 | - $webDir = substr($path, strlen($this->serverRoot)+1); |
|
99 | + $webDir = substr($path, strlen($this->serverRoot) + 1); |
|
100 | 100 | |
101 | 101 | try { |
102 | 102 | $folder = $this->appData->getFolder($app); |
103 | - } catch(NotFoundException $e) { |
|
103 | + } catch (NotFoundException $e) { |
|
104 | 104 | // creating css appdata folder |
105 | 105 | $folder = $this->appData->newFolder($app); |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { |
|
109 | + if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { |
|
110 | 110 | return true; |
111 | 111 | } |
112 | 112 | return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | try { |
133 | 133 | $cachedFile = $folder->getFile($fileNameCSS); |
134 | 134 | if ($cachedFile->getSize() > 0) { |
135 | - $depFileName = $fileNameCSS . '.deps'; |
|
136 | - $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); |
|
135 | + $depFileName = $fileNameCSS.'.deps'; |
|
136 | + $deps = $this->depsCache->get($folder->getName().'-'.$depFileName); |
|
137 | 137 | if ($deps === null) { |
138 | 138 | $depFile = $folder->getFile($depFileName); |
139 | 139 | $deps = $depFile->getContent(); |
140 | 140 | //Set to memcache for next run |
141 | - $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); |
|
141 | + $this->depsCache->set($folder->getName().'-'.$depFileName, $deps); |
|
142 | 142 | } |
143 | 143 | $deps = json_decode($deps, true); |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | return true; |
152 | - } catch(NotFoundException $e) { |
|
152 | + } catch (NotFoundException $e) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function variablesChanged() { |
162 | 162 | $injectedVariables = $this->getInjectedVariables(); |
163 | - if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
163 | + if ($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
164 | 164 | $this->resetCache(); |
165 | 165 | $this->config->setAppValue('core', 'scss.variables', md5($injectedVariables)); |
166 | 166 | return true; |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $scss = new Compiler(); |
182 | 182 | $scss->setImportPaths([ |
183 | 183 | $path, |
184 | - \OC::$SERVERROOT . '/core/css/', |
|
184 | + \OC::$SERVERROOT.'/core/css/', |
|
185 | 185 | ]); |
186 | - if($this->config->getSystemValue('debug')) { |
|
186 | + if ($this->config->getSystemValue('debug')) { |
|
187 | 187 | // Debug mode |
188 | 188 | $scss->setFormatter(Expanded::class); |
189 | 189 | $scss->setLineNumberStyle(Compiler::LINE_COMMENTS); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | |
195 | 195 | try { |
196 | 196 | $cachedfile = $folder->getFile($fileNameCSS); |
197 | - } catch(NotFoundException $e) { |
|
197 | + } catch (NotFoundException $e) { |
|
198 | 198 | $cachedfile = $folder->newFile($fileNameCSS); |
199 | 199 | } |
200 | 200 | |
201 | - $depFileName = $fileNameCSS . '.deps'; |
|
201 | + $depFileName = $fileNameCSS.'.deps'; |
|
202 | 202 | try { |
203 | 203 | $depFile = $folder->getFile($depFileName); |
204 | 204 | } catch (NotFoundException $e) { |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | // Compile |
209 | 209 | try { |
210 | 210 | $compiledScss = $scss->compile( |
211 | - '@import "variables.scss";' . |
|
212 | - $this->getInjectedVariables() . |
|
211 | + '@import "variables.scss";'. |
|
212 | + $this->getInjectedVariables(). |
|
213 | 213 | '@import "'.$fileNameSCSS.'";'); |
214 | - } catch(ParserException $e) { |
|
214 | + } catch (ParserException $e) { |
|
215 | 215 | $this->logger->error($e, ['app' => 'core']); |
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // Gzip file |
220 | 220 | try { |
221 | - $gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz |
|
221 | + $gzipFile = $folder->getFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz |
|
222 | 222 | } catch (NotFoundException $e) { |
223 | - $gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz |
|
223 | + $gzipFile = $folder->newFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | try { |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | $cachedfile->putContent($data); |
229 | 229 | $deps = json_encode($scss->getParsedFiles()); |
230 | 230 | $depFile->putContent($deps); |
231 | - $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); |
|
231 | + $this->depsCache->set($folder->getName().'-'.$depFileName, $deps); |
|
232 | 232 | $gzipFile->putContent(gzencode($data, 9)); |
233 | 233 | $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); |
234 | 234 | return true; |
235 | - } catch(NotPermittedException $e) { |
|
235 | + } catch (NotPermittedException $e) { |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function resetCache() { |
245 | 245 | $appDirectory = $this->appData->getDirectoryListing(); |
246 | - if(empty($appDirectory)){ |
|
246 | + if (empty($appDirectory)) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | foreach ($appDirectory as $folder) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | private function getInjectedVariables() { |
262 | 262 | $variables = ''; |
263 | 263 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
264 | - $variables .= '$' . $key . ': ' . $value . ';'; |
|
264 | + $variables .= '$'.$key.': '.$value.';'; |
|
265 | 265 | } |
266 | 266 | return $variables; |
267 | 267 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | private function rebaseUrls($css, $webDir) { |
276 | 276 | $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x'; |
277 | 277 | // OC\Route\Router:75 |
278 | - if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
278 | + if (($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
279 | 279 | $subst = 'url(\'../../'.$webDir.'/$1\')'; |
280 | 280 | } else { |
281 | 281 | $subst = 'url(\'../../../'.$webDir.'/$1\')'; |