@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * |
32 | 32 | */ |
33 | 33 | |
34 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
34 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
35 | 35 | |
36 | 36 | try { |
37 | - require_once __DIR__ . '/lib/base.php'; |
|
37 | + require_once __DIR__.'/lib/base.php'; |
|
38 | 38 | if (\OCP\Util::needUpgrade()) { |
39 | 39 | // since the behavior of apps or remotes are unpredictable during |
40 | 40 | // an upgrade, return a 503 directly |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $pathInfo = trim($pathInfo, '/'); |
56 | 56 | [$service] = explode('/', $pathInfo); |
57 | 57 | } |
58 | - $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . strip_tags($service)); |
|
58 | + $file = \OC::$server->getConfig()->getAppValue('core', 'public_'.strip_tags($service)); |
|
59 | 59 | if ($file === '') { |
60 | 60 | http_response_code(404); |
61 | 61 | exit; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | OC_App::loadApp($app); |
77 | 77 | OC_User::setIncognitoMode(true); |
78 | 78 | |
79 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
79 | + $baseuri = OC::$WEBROOT.'/public.php/'.$service.'/'; |
|
80 | 80 | |
81 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
81 | + require_once OC_App::getAppPath($app).'/'.$parts[1]; |
|
82 | 82 | } catch (Exception $ex) { |
83 | 83 | $status = 500; |
84 | 84 | if ($ex instanceof \OC\ServiceUnavailableException) { |
@@ -104,24 +104,24 @@ discard block |
||
104 | 104 | * Remove "apps/" from inclusion path for smooth migration to multi app dir |
105 | 105 | */ |
106 | 106 | if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) { |
107 | - \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', ILogger::DEBUG); |
|
107 | + \OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', ILogger::DEBUG); |
|
108 | 108 | $paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]); |
109 | 109 | } |
110 | 110 | } elseif (strpos($class, 'OC_') === 0) { |
111 | - $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); |
|
111 | + $paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php'); |
|
112 | 112 | } elseif (strpos($class, 'OCA\\') === 0) { |
113 | 113 | [, $app, $rest] = explode('\\', $class, 3); |
114 | 114 | $app = strtolower($app); |
115 | 115 | $appPath = \OC_App::getAppPath($app); |
116 | 116 | if ($appPath && stream_resolve_include_path($appPath)) { |
117 | - $paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
117 | + $paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
118 | 118 | // If not found in the root of the app directory, insert '/lib' after app id and try again. |
119 | - $paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
119 | + $paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
120 | 120 | } |
121 | 121 | } elseif ($class === 'Test\\TestCase') { |
122 | 122 | // This File is considered public API, so we make sure that the class |
123 | 123 | // can still be loaded, although the PSR-4 paths have not been loaded. |
124 | - $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php'; |
|
124 | + $paths[] = \OC::$SERVERROOT.'/tests/lib/TestCase.php'; |
|
125 | 125 | } |
126 | 126 | return $paths; |
127 | 127 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function isValidPath(string $fullPath): bool { |
135 | 135 | foreach ($this->validRoots as $root => $true) { |
136 | - if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') { |
|
136 | + if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') { |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $dispatcher = \OC::$server->getEventDispatcher(); |
116 | 116 | foreach ($hooks as $hook) { |
117 | 117 | $this->root->emit('\OC\Files', $hook, $args); |
118 | - $dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args)); |
|
118 | + $dispatcher->dispatch('\OCP\Files::'.$hook, new GenericEvent($args)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @throws \OCP\Files\NotFoundException |
160 | 160 | */ |
161 | 161 | public function getStorage() { |
162 | - [$storage,] = $this->view->resolvePath($this->path); |
|
162 | + [$storage, ] = $this->view->resolvePath($this->path); |
|
163 | 163 | return $storage; |
164 | 164 | } |
165 | 165 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $path = str_replace('\\', '/', $path); |
307 | 307 | //add leading slash |
308 | 308 | if ($path[0] !== '/') { |
309 | - $path = '/' . $path; |
|
309 | + $path = '/'.$path; |
|
310 | 310 | } |
311 | 311 | //remove duplicate slashes |
312 | 312 | while (strpos($path, '//') !== false) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function isValidPath($path) { |
328 | 328 | if (!$path || $path[0] !== '/') { |
329 | - $path = '/' . $path; |
|
329 | + $path = '/'.$path; |
|
330 | 330 | } |
331 | 331 | if (strstr($path, '/../') || strrchr($path, '/') === '/..') { |
332 | 332 | return false; |
@@ -412,14 +412,14 @@ discard block |
||
412 | 412 | $this->sendHooks(['preCopy'], [$this, $nonExisting]); |
413 | 413 | $this->sendHooks(['preWrite'], [$nonExisting]); |
414 | 414 | if (!$this->view->copy($this->path, $targetPath)) { |
415 | - throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath); |
|
415 | + throw new NotPermittedException('Could not copy '.$this->path.' to '.$targetPath); |
|
416 | 416 | } |
417 | 417 | $targetNode = $this->root->get($targetPath); |
418 | 418 | $this->sendHooks(['postCopy'], [$this, $targetNode]); |
419 | 419 | $this->sendHooks(['postWrite'], [$targetNode]); |
420 | 420 | return $targetNode; |
421 | 421 | } else { |
422 | - throw new NotPermittedException('No permission to copy to path ' . $targetPath); |
|
422 | + throw new NotPermittedException('No permission to copy to path '.$targetPath); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $this->sendHooks(['preRename'], [$this, $nonExisting]); |
447 | 447 | $this->sendHooks(['preWrite'], [$nonExisting]); |
448 | 448 | if (!$this->view->rename($this->path, $targetPath)) { |
449 | - throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath); |
|
449 | + throw new NotPermittedException('Could not move '.$this->path.' to '.$targetPath); |
|
450 | 450 | } |
451 | 451 | $targetNode = $this->root->get($targetPath); |
452 | 452 | $this->sendHooks(['postRename'], [$this, $targetNode]); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $this->path = $targetPath; |
455 | 455 | return $targetNode; |
456 | 456 | } else { |
457 | - throw new NotPermittedException('No permission to move to path ' . $targetPath); |
|
457 | + throw new NotPermittedException('No permission to move to path '.$targetPath); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | foreach (\OC_APP::getEnabledApps() as $app) { |
101 | 101 | $appPath = \OC_App::getAppPath($app); |
102 | 102 | if ($appPath !== false) { |
103 | - $file = $appPath . '/appinfo/routes.php'; |
|
103 | + $file = $appPath.'/appinfo/routes.php'; |
|
104 | 104 | if (file_exists($file)) { |
105 | 105 | $this->routingFiles[$app] = $file; |
106 | 106 | } |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | if (isset($this->loadedApps[$app])) { |
132 | 132 | return; |
133 | 133 | } |
134 | - $file = \OC_App::getAppPath($app) . '/appinfo/routes.php'; |
|
134 | + $file = \OC_App::getAppPath($app).'/appinfo/routes.php'; |
|
135 | 135 | if ($file !== false && file_exists($file)) { |
136 | 136 | $routingFiles = [$app => $file]; |
137 | 137 | } else { |
138 | 138 | $routingFiles = []; |
139 | 139 | } |
140 | 140 | } |
141 | - \OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes'); |
|
141 | + \OC::$server->getEventLogger()->start('loadroutes'.$requestedApp, 'Loading Routes'); |
|
142 | 142 | foreach ($routingFiles as $app => $file) { |
143 | 143 | if (!isset($this->loadedApps[$app])) { |
144 | 144 | if (!\OC_App::isAppLoaded($app)) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if (!isset($this->loadedApps['core'])) { |
163 | 163 | $this->loadedApps['core'] = true; |
164 | 164 | $this->useCollection('root'); |
165 | - require_once __DIR__ . '/../../../core/routes.php'; |
|
165 | + require_once __DIR__.'/../../../core/routes.php'; |
|
166 | 166 | |
167 | 167 | // Also add the OCS collection |
168 | 168 | $collection = $this->getCollection('root.ocs'); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $collection->addPrefix('/ocs'); |
175 | 175 | $this->root->addCollection($collection); |
176 | 176 | } |
177 | - \OC::$server->getEventLogger()->end('loadroutes' . $requestedApp); |
|
177 | + \OC::$server->getEventLogger()->end('loadroutes'.$requestedApp); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | public function findMatchingRoute(string $url): array { |
238 | 238 | if (substr($url, 0, 6) === '/apps/') { |
239 | 239 | // empty string / 'apps' / $app / rest of the route |
240 | - [, , $app,] = explode('/', $url, 4); |
|
240 | + [,, $app, ] = explode('/', $url, 4); |
|
241 | 241 | |
242 | 242 | $app = \OC_App::cleanAppId($app); |
243 | 243 | \OC::$REQUESTEDAPP = $app; |
244 | 244 | $this->loadRoutes($app); |
245 | 245 | } elseif (substr($url, 0, 13) === '/ocsapp/apps/') { |
246 | 246 | // empty string / 'ocsapp' / 'apps' / $app / rest of the route |
247 | - [, , , $app,] = explode('/', $url, 5); |
|
247 | + [,,, $app, ] = explode('/', $url, 5); |
|
248 | 248 | |
249 | 249 | $app = \OC_App::cleanAppId($app); |
250 | 250 | \OC::$REQUESTEDAPP = $app; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | // However, since Symfony does not allow empty route names, the route |
271 | 271 | // we need to match is '/', so we need to append the '/' here. |
272 | 272 | try { |
273 | - $parameters = $matcher->match($url . '/'); |
|
273 | + $parameters = $matcher->match($url.'/'); |
|
274 | 274 | } catch (ResourceNotFoundException $newException) { |
275 | 275 | // If we still didn't match a route, we throw the original exception |
276 | 276 | throw $e; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | private function getApplicationClass(string $appName) { |
436 | 436 | $appNameSpace = App::buildAppNamespace($appName); |
437 | 437 | |
438 | - $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; |
|
438 | + $applicationClassName = $appNameSpace.'\\AppInfo\\Application'; |
|
439 | 439 | |
440 | 440 | if (class_exists($applicationClassName)) { |
441 | 441 | $application = \OC::$server->query($applicationClassName); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public static function buildAppNamespace(string $appId, string $topNamespace = 'OCA\\'): string { |
65 | 65 | // Hit the cache! |
66 | 66 | if (isset(self::$nameSpaceCache[$appId])) { |
67 | - return $topNamespace . self::$nameSpaceCache[$appId]; |
|
67 | + return $topNamespace.self::$nameSpaceCache[$appId]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $appInfo = \OC_App::getAppInfo($appId); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - return $topNamespace . self::$nameSpaceCache[$appId]; |
|
89 | + return $topNamespace.self::$nameSpaceCache[$appId]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public static function getAppIdForClass(string $className, string $topNamespace = 'OCA\\'): ?string { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | foreach (self::$nameSpaceCache as $appId => $namespace) { |
98 | - if (strpos($className, $topNamespace . $namespace . '\\') === 0) { |
|
98 | + if (strpos($className, $topNamespace.$namespace.'\\') === 0) { |
|
99 | 99 | return $appId; |
100 | 100 | } |
101 | 101 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if (strpos($controllerName, '\\Controller\\') !== false) { |
133 | 133 | // This is from a global registered app route that is not enabled. |
134 | 134 | [/*OC(A)*/, $app, /* Controller/Name*/] = explode('\\', $controllerName, 3); |
135 | - throw new HintException('App ' . strtolower($app) . ' is not enabled'); |
|
135 | + throw new HintException('App '.strtolower($app).' is not enabled'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if ($appName === 'core') { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } else { |
141 | 141 | $appNameSpace = self::buildAppNamespace($appName); |
142 | 142 | } |
143 | - $controllerName = $appNameSpace . '\\Controller\\' . $controllerName; |
|
143 | + $controllerName = $appNameSpace.'\\Controller\\'.$controllerName; |
|
144 | 144 | $controller = $container->query($controllerName); |
145 | 145 | } |
146 | 146 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | foreach ($responseHeaders as $name => $value) { |
166 | - $io->setHeader($name . ': ' . $value); |
|
166 | + $io->setHeader($name.': '.$value); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | foreach ($responseCookies as $name => $value) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | $emptyResponse = false; |
195 | 195 | if (preg_match('/^HTTP\/\d\.\d (\d{3}) .*$/', $httpHeaders, $matches)) { |
196 | - $status = (int)$matches[1]; |
|
196 | + $status = (int) $matches[1]; |
|
197 | 197 | if ($status === Http::STATUS_NO_CONTENT || $status === Http::STATUS_NOT_MODIFIED) { |
198 | 198 | $emptyResponse = true; |
199 | 199 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if ($response instanceof ICallbackResponse) { |
204 | 204 | $response->callback($io); |
205 | 205 | } elseif (!is_null($output)) { |
206 | - $io->setHeader('Content-Length: ' . strlen($output)); |
|
206 | + $io->setHeader('Content-Length: '.strlen($output)); |
|
207 | 207 | $io->setOutput($output); |
208 | 208 | } |
209 | 209 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | $dispatcher = $container['Dispatcher']; |
230 | 230 | |
231 | - [, , $output] = $dispatcher->dispatch($controller, $methodName); |
|
231 | + [,, $output] = $dispatcher->dispatch($controller, $methodName); |
|
232 | 232 | return $output; |
233 | 233 | } |
234 | 234 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | if ($this->enabled && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) { |
62 | 62 | [$remoteGroup, $serverUrl] = $this->splitGroupRemote($search); |
63 | 63 | $result['exact'][] = [ |
64 | - 'label' => $remoteGroup . " ($serverUrl)", |
|
64 | + 'label' => $remoteGroup." ($serverUrl)", |
|
65 | 65 | 'guid' => $remoteGroup, |
66 | 66 | 'name' => $remoteGroup, |
67 | 67 | 'value' => [ |
@@ -121,24 +121,24 @@ discard block |
||
121 | 121 | $cachedVarsCssFile = $this->folder->newFile($this->fileName); |
122 | 122 | } |
123 | 123 | |
124 | - $icons = $this->getIconsFromCss($currentData . $css); |
|
124 | + $icons = $this->getIconsFromCss($currentData.$css); |
|
125 | 125 | |
126 | 126 | $data = ''; |
127 | 127 | $list = ''; |
128 | 128 | foreach ($icons as $icon => $url) { |
129 | 129 | $list .= "--$icon: url('$url');"; |
130 | - [$location,$color] = $this->parseUrl($url); |
|
130 | + [$location, $color] = $this->parseUrl($url); |
|
131 | 131 | $svg = false; |
132 | 132 | if ($location !== '' && \file_exists($location)) { |
133 | 133 | $svg = \file_get_contents($location); |
134 | 134 | } |
135 | 135 | if ($svg === false) { |
136 | - $this->logger->debug('Failed to get icon file ' . $location); |
|
136 | + $this->logger->debug('Failed to get icon file '.$location); |
|
137 | 137 | $data .= "--$icon: url('$url');"; |
138 | 138 | continue; |
139 | 139 | } |
140 | 140 | $encode = base64_encode($this->colorizeSvg($svg, $color)); |
141 | - $data .= '--' . $icon . ': url(data:image/svg+xml;base64,' . $encode . ');'; |
|
141 | + $data .= '--'.$icon.': url(data:image/svg+xml;base64,'.$encode.');'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (\strlen($data) > 0 && \strlen($list) > 0) { |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | private function parseUrl($url): array { |
161 | 161 | $location = ''; |
162 | 162 | $color = ''; |
163 | - $base = $this->getRoutePrefix() . '/svg/'; |
|
163 | + $base = $this->getRoutePrefix().'/svg/'; |
|
164 | 164 | $cleanUrl = \substr($url, \strlen($base)); |
165 | - if (\strpos($url, $base . 'core') === 0) { |
|
165 | + if (\strpos($url, $base.'core') === 0) { |
|
166 | 166 | $cleanUrl = \substr($cleanUrl, \strlen('core')); |
167 | 167 | if (\preg_match('/\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { |
168 | - [,$cleanUrl,$color] = $matches; |
|
169 | - $location = \OC::$SERVERROOT . '/core/img/' . $cleanUrl . '.svg'; |
|
168 | + [,$cleanUrl, $color] = $matches; |
|
169 | + $location = \OC::$SERVERROOT.'/core/img/'.$cleanUrl.'.svg'; |
|
170 | 170 | } |
171 | 171 | } elseif (\strpos($url, $base) === 0) { |
172 | 172 | if (\preg_match('/([A-z0-9\_\-]+)\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { |
173 | - [,$app,$cleanUrl, $color] = $matches; |
|
174 | - $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; |
|
173 | + [,$app, $cleanUrl, $color] = $matches; |
|
174 | + $location = \OC_App::getAppPath($app).'/img/'.$cleanUrl.'.svg'; |
|
175 | 175 | if ($app === 'settings') { |
176 | - $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; |
|
176 | + $location = \OC::$SERVERROOT.'/settings/img/'.$cleanUrl.'.svg'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | } |
@@ -196,17 +196,17 @@ discard block |
||
196 | 196 | |
197 | 197 | // add fill (fill is not present on black elements) |
198 | 198 | $fillRe = '/<((circle|rect|path)((?!fill)[a-z0-9 =".\-#():;,])+)\/>/mi'; |
199 | - $svg = preg_replace($fillRe, '<$1 fill="#' . $color . '"/>', $svg); |
|
199 | + $svg = preg_replace($fillRe, '<$1 fill="#'.$color.'"/>', $svg); |
|
200 | 200 | |
201 | 201 | // replace any fill or stroke colors |
202 | - $svg = preg_replace('/stroke="#([a-z0-9]{3,6})"/mi', 'stroke="#' . $color . '"', $svg); |
|
203 | - $svg = preg_replace('/fill="#([a-z0-9]{3,6})"/mi', 'fill="#' . $color . '"', $svg); |
|
202 | + $svg = preg_replace('/stroke="#([a-z0-9]{3,6})"/mi', 'stroke="#'.$color.'"', $svg); |
|
203 | + $svg = preg_replace('/fill="#([a-z0-9]{3,6})"/mi', 'fill="#'.$color.'"', $svg); |
|
204 | 204 | return $svg; |
205 | 205 | } |
206 | 206 | |
207 | 207 | private function getRoutePrefix() { |
208 | 208 | $frontControllerActive = (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
209 | - $prefix = \OC::$WEBROOT . '/index.php'; |
|
209 | + $prefix = \OC::$WEBROOT.'/index.php'; |
|
210 | 210 | if ($frontControllerActive) { |
211 | 211 | $prefix = \OC::$WEBROOT; |
212 | 212 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return null; |
43 | 43 | } |
44 | 44 | |
45 | - $content = stream_get_contents($content,3000); |
|
45 | + $content = stream_get_contents($content, 3000); |
|
46 | 46 | |
47 | 47 | //don't create previews of empty text files |
48 | 48 | if (trim($content) === '') { |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | imagecolorallocate($image, 255, 255, 255); |
76 | 76 | $textColor = imagecolorallocate($image, 0, 0, 0); |
77 | 77 | |
78 | - $fontFile = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf'; |
|
79 | - $fontFileBold = __DIR__ . '/../../../core/fonts/NotoSans-Bold.ttf'; |
|
78 | + $fontFile = __DIR__.'/../../../core/fonts/NotoSans-Regular.ttf'; |
|
79 | + $fontFileBold = __DIR__.'/../../../core/fonts/NotoSans-Bold.ttf'; |
|
80 | 80 | |
81 | 81 | $canUseTTF = function_exists('imagettftext'); |
82 | 82 | |
83 | - $textOffset = (int)min($maxX * 0.05, $maxY * 0.05); |
|
83 | + $textOffset = (int) min($maxX * 0.05, $maxY * 0.05); |
|
84 | 84 | $nextLineStart = 0; |
85 | 85 | $y = $textOffset; |
86 | 86 | foreach ($lines as $line) { |
@@ -106,22 +106,22 @@ discard block |
||
106 | 106 | |
107 | 107 | // Add spacing before headlines |
108 | 108 | if ($actualFontSize !== $fontSize && $y !== $textOffset) { |
109 | - $y += (int)($actualFontSize * 2); |
|
109 | + $y += (int) ($actualFontSize * 2); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $x = $textOffset; |
113 | - $y += (int)($nextLineStart + $actualFontSize); |
|
113 | + $y += (int) ($nextLineStart + $actualFontSize); |
|
114 | 114 | |
115 | 115 | if ($canUseTTF === true) { |
116 | - $wordWrap = (int)((1 / $actualFontSize * 1.3) * $maxX); |
|
116 | + $wordWrap = (int) ((1 / $actualFontSize * 1.3) * $maxX); |
|
117 | 117 | |
118 | 118 | // Get rid of markdown symbols that we still needed for the font size |
119 | 119 | $line = preg_replace('/^#*\s/', '', $line); |
120 | 120 | |
121 | - $wrappedText = wordwrap($line, $wordWrap,"\n"); |
|
121 | + $wrappedText = wordwrap($line, $wordWrap, "\n"); |
|
122 | 122 | $linesWrapped = count(explode("\n", $wrappedText)); |
123 | 123 | imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText); |
124 | - $nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2)); |
|
124 | + $nextLineStart = (int) ($linesWrapped * ceil($actualFontSize * 2)); |
|
125 | 125 | if ($actualFontSize !== $fontSize && $y !== $textOffset) { |
126 | 126 | $nextLineStart -= $actualFontSize; |
127 | 127 | } |
@@ -49,20 +49,20 @@ |
||
49 | 49 | |
50 | 50 | $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); |
51 | 51 | |
52 | - $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
52 | + $defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
53 | 53 | $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters); |
54 | 54 | |
55 | - $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); |
|
55 | + $exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath); |
|
56 | 56 | |
57 | 57 | shell_exec($exec); |
58 | 58 | |
59 | 59 | //create imagick object from png |
60 | 60 | $pngPreview = null; |
61 | 61 | try { |
62 | - [$dirname, , , $filename] = array_values(pathinfo($absPath)); |
|
63 | - $pngPreview = $tmpDir . '/' . $filename . '.png'; |
|
62 | + [$dirname,,, $filename] = array_values(pathinfo($absPath)); |
|
63 | + $pngPreview = $tmpDir.'/'.$filename.'.png'; |
|
64 | 64 | |
65 | - $png = new \imagick($pngPreview . '[0]'); |
|
65 | + $png = new \imagick($pngPreview.'[0]'); |
|
66 | 66 | $png->setImageFormat('jpg'); |
67 | 67 | } catch (\Exception $e) { |
68 | 68 | $this->cleanTmpFiles(); |