@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | $content = stream_get_contents($file->fopen('r')); |
48 | 48 | if (substr($content, 0, 5) !== '<?xml') { |
49 | - $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; |
|
49 | + $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$content; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Do not parse SVG files with references |
@@ -32,50 +32,50 @@ |
||
32 | 32 | use Psr\Log\LoggerInterface; |
33 | 33 | |
34 | 34 | class SVG extends ProviderV2 { |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - */ |
|
38 | - public function getMimeType(): string { |
|
39 | - return '/image\/svg\+xml/'; |
|
40 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + */ |
|
38 | + public function getMimeType(): string { |
|
39 | + return '/image\/svg\+xml/'; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * {@inheritDoc} |
|
44 | - */ |
|
45 | - public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { |
|
46 | - try { |
|
47 | - $svg = new \Imagick(); |
|
48 | - $svg->setBackgroundColor(new \ImagickPixel('transparent')); |
|
42 | + /** |
|
43 | + * {@inheritDoc} |
|
44 | + */ |
|
45 | + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { |
|
46 | + try { |
|
47 | + $svg = new \Imagick(); |
|
48 | + $svg->setBackgroundColor(new \ImagickPixel('transparent')); |
|
49 | 49 | |
50 | - $content = stream_get_contents($file->fopen('r')); |
|
51 | - if (substr($content, 0, 5) !== '<?xml') { |
|
52 | - $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; |
|
53 | - } |
|
50 | + $content = stream_get_contents($file->fopen('r')); |
|
51 | + if (substr($content, 0, 5) !== '<?xml') { |
|
52 | + $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; |
|
53 | + } |
|
54 | 54 | |
55 | - // Do not parse SVG files with references |
|
56 | - if (stripos($content, 'xlink:href') !== false) { |
|
57 | - return null; |
|
58 | - } |
|
55 | + // Do not parse SVG files with references |
|
56 | + if (stripos($content, 'xlink:href') !== false) { |
|
57 | + return null; |
|
58 | + } |
|
59 | 59 | |
60 | - $svg->readImageBlob($content); |
|
61 | - $svg->setImageFormat('png32'); |
|
62 | - } catch (\Exception $e) { |
|
63 | - \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [ |
|
64 | - 'exception' => $e, |
|
65 | - 'app' => 'core', |
|
66 | - ]); |
|
67 | - return null; |
|
68 | - } |
|
60 | + $svg->readImageBlob($content); |
|
61 | + $svg->setImageFormat('png32'); |
|
62 | + } catch (\Exception $e) { |
|
63 | + \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [ |
|
64 | + 'exception' => $e, |
|
65 | + 'app' => 'core', |
|
66 | + ]); |
|
67 | + return null; |
|
68 | + } |
|
69 | 69 | |
70 | - //new image object |
|
71 | - $image = new \OCP\Image(); |
|
72 | - $image->loadFromData((string) $svg); |
|
73 | - //check if image object is valid |
|
74 | - if ($image->valid()) { |
|
75 | - $image->scaleDownToFit($maxX, $maxY); |
|
70 | + //new image object |
|
71 | + $image = new \OCP\Image(); |
|
72 | + $image->loadFromData((string) $svg); |
|
73 | + //check if image object is valid |
|
74 | + if ($image->valid()) { |
|
75 | + $image->scaleDownToFit($maxX, $maxY); |
|
76 | 76 | |
77 | - return $image; |
|
78 | - } |
|
79 | - return null; |
|
80 | - } |
|
77 | + return $image; |
|
78 | + } |
|
79 | + return null; |
|
80 | + } |
|
81 | 81 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class XBitmap extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/x-xbitmap/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/x-xbitmap/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class PNG extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/png/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/png/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | //.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m) |
25 | 25 | class MSOffice2003 extends Office { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/application\/vnd.ms-.*/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/application\/vnd.ms-.*/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | namespace OC\Preview; |
24 | 24 | |
25 | 25 | class JPEG extends Image { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/image\/jpeg/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/image\/jpeg/'; |
|
31 | + } |
|
32 | 32 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\CloudFederationAPI\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\CloudFederationAPI\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\WorkflowEngine\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\WorkflowEngine\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |