Completed
Push — stable10 ( b85e94...1e5021 )
by
unknown
23:18 queued 12:32
created
lib/private/Preview/MP3.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -29,56 +29,56 @@
 block discarded – undo
29 29
 use ID3Parser\ID3Parser;
30 30
 
31 31
 class MP3 extends Provider {
32
-	/**
33
-	 * {@inheritDoc}
34
-	 */
35
-	public function getMimeType() {
36
-		return '/audio\/mpeg/';
37
-	}
32
+    /**
33
+     * {@inheritDoc}
34
+     */
35
+    public function getMimeType() {
36
+        return '/audio\/mpeg/';
37
+    }
38 38
 
39
-	/**
40
-	 * {@inheritDoc}
41
-	 */
42
-	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
43
-		$getID3 = new ID3Parser();
39
+    /**
40
+     * {@inheritDoc}
41
+     */
42
+    public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
43
+        $getID3 = new ID3Parser();
44 44
 
45
-		$tmpPath = $fileview->toTmpFile($path);
46
-		$tags = $getID3->analyze($tmpPath);
47
-		unlink($tmpPath);
48
-		$picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null;
49
-		if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
50
-			$picture = $tags['id3v2']['PIC'][0]['data'];
51
-		}
45
+        $tmpPath = $fileview->toTmpFile($path);
46
+        $tags = $getID3->analyze($tmpPath);
47
+        unlink($tmpPath);
48
+        $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null;
49
+        if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
50
+            $picture = $tags['id3v2']['PIC'][0]['data'];
51
+        }
52 52
 
53
-		if(!is_null($picture)) {
54
-			$image = new \OC_Image();
55
-			$image->loadFromData($picture);
53
+        if(!is_null($picture)) {
54
+            $image = new \OC_Image();
55
+            $image->loadFromData($picture);
56 56
 
57
-			if ($image->valid()) {
58
-				$image->scaleDownToFit($maxX, $maxY);
57
+            if ($image->valid()) {
58
+                $image->scaleDownToFit($maxX, $maxY);
59 59
 
60
-				return $image;
61
-			}
62
-		}
60
+                return $image;
61
+            }
62
+        }
63 63
 
64
-		return $this->getNoCoverThumbnail();
65
-	}
64
+        return $this->getNoCoverThumbnail();
65
+    }
66 66
 
67
-	/**
68
-	 * Generates a default image when the file has no cover
69
-	 *
70
-	 * @return bool|\OCP\IImage false if the default image is missing or invalid
71
-	 */
72
-	private function getNoCoverThumbnail() {
73
-		$icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg';
67
+    /**
68
+     * Generates a default image when the file has no cover
69
+     *
70
+     * @return bool|\OCP\IImage false if the default image is missing or invalid
71
+     */
72
+    private function getNoCoverThumbnail() {
73
+        $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg';
74 74
 
75
-		if(!file_exists($icon)) {
76
-			return false;
77
-		}
75
+        if(!file_exists($icon)) {
76
+            return false;
77
+        }
78 78
 
79
-		$image = new \OC_Image();
80
-		$image->loadFromFile($icon);
81
-		return $image->valid() ? $image : false;
82
-	}
79
+        $image = new \OC_Image();
80
+        $image->loadFromFile($icon);
81
+        return $image->valid() ? $image : false;
82
+    }
83 83
 
84 84
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 		$tags = $getID3->analyze($tmpPath);
47 47
 		unlink($tmpPath);
48 48
 		$picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null;
49
-		if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
49
+		if (is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) {
50 50
 			$picture = $tags['id3v2']['PIC'][0]['data'];
51 51
 		}
52 52
 
53
-		if(!is_null($picture)) {
53
+		if (!is_null($picture)) {
54 54
 			$image = new \OC_Image();
55 55
 			$image->loadFromData($picture);
56 56
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * @return bool|\OCP\IImage false if the default image is missing or invalid
71 71
 	 */
72 72
 	private function getNoCoverThumbnail() {
73
-		$icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg';
73
+		$icon = \OC::$SERVERROOT.'/core/img/filetypes/audio.svg';
74 74
 
75
-		if(!file_exists($icon)) {
75
+		if (!file_exists($icon)) {
76 76
 			return false;
77 77
 		}
78 78
 
Please login to merge, or discard this patch.
lib/private/Preview/MSOffice2003.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
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() {
30
-		return '/application\/vnd.ms-.*/';
31
-	}
26
+    /**
27
+     * {@inheritDoc}
28
+     */
29
+    public function getMimeType() {
30
+        return '/application\/vnd.ms-.*/';
31
+    }
32 32
 }
Please login to merge, or discard this patch.
lib/private/Preview/Provider.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
 use OCP\Preview\IProvider;
29 29
 
30 30
 abstract class Provider implements IProvider {
31
-	private $options;
31
+    private $options;
32 32
 
33
-	/**
34
-	 * Constructor
35
-	 *
36
-	 * @param array $options
37
-	 */
38
-	public function __construct(array $options = []) {
39
-		$this->options = $options;
40
-	}
33
+    /**
34
+     * Constructor
35
+     *
36
+     * @param array $options
37
+     */
38
+    public function __construct(array $options = []) {
39
+        $this->options = $options;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Regex with the mimetypes that are supported by this provider
44
-	 */
45
-	abstract public function getMimeType();
42
+    /**
43
+     * @return string Regex with the mimetypes that are supported by this provider
44
+     */
45
+    abstract public function getMimeType();
46 46
 
47
-	/**
48
-	 * Check if a preview can be generated for $path
49
-	 *
50
-	 * @param \OCP\Files\FileInfo $file
51
-	 * @return bool
52
-	 */
53
-	public function isAvailable(\OCP\Files\FileInfo $file) {
54
-		return true;
55
-	}
47
+    /**
48
+     * Check if a preview can be generated for $path
49
+     *
50
+     * @param \OCP\Files\FileInfo $file
51
+     * @return bool
52
+     */
53
+    public function isAvailable(\OCP\Files\FileInfo $file) {
54
+        return true;
55
+    }
56 56
 
57
-	/**
58
-	 * Generates thumbnail which fits in $maxX and $maxY and keeps the aspect ratio, for file at path $path
59
-	 *
60
-	 * @param string $path Path of file
61
-	 * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
62
-	 * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
63
-	 * @param bool $scalingup Disable/Enable upscaling of previews
64
-	 * @param \OC\Files\View $fileview fileview object of user folder
65
-	 * @return bool|\OCP\IImage false if no preview was generated
66
-	 */
67
-	abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
57
+    /**
58
+     * Generates thumbnail which fits in $maxX and $maxY and keeps the aspect ratio, for file at path $path
59
+     *
60
+     * @param string $path Path of file
61
+     * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
62
+     * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
63
+     * @param bool $scalingup Disable/Enable upscaling of previews
64
+     * @param \OC\Files\View $fileview fileview object of user folder
65
+     * @return bool|\OCP\IImage false if no preview was generated
66
+     */
67
+    abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
68 68
 }
Please login to merge, or discard this patch.
lib/private/Preview/OpenDocument.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 
24 24
 //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt
25 25
 class OpenDocument extends Office {
26
-	/**
27
-	 * {@inheritDoc}
28
-	 */
29
-	public function getMimeType() {
30
-		return '/application\/vnd.oasis.opendocument.*/';
31
-	}
26
+    /**
27
+     * {@inheritDoc}
28
+     */
29
+    public function getMimeType() {
30
+        return '/application\/vnd.oasis.opendocument.*/';
31
+    }
32 32
 }
Please login to merge, or discard this patch.
lib/private/Preview/Photoshop.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 
26 26
 //.psd
27 27
 class Photoshop extends Bitmap {
28
-	/**
29
-	 * {@inheritDoc}
30
-	 */
31
-	public function getMimeType() {
32
-		return '/application\/x-photoshop/';
33
-	}
28
+    /**
29
+     * {@inheritDoc}
30
+     */
31
+    public function getMimeType() {
32
+        return '/application\/x-photoshop/';
33
+    }
34 34
 }
Please login to merge, or discard this patch.
lib/private/Preview/PNG.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 namespace OC\Preview;
24 24
 
25 25
 class PNG extends Image {
26
-	/**
27
-	 * {@inheritDoc}
28
-	 */
29
-	public function getMimeType() {
30
-		return '/image\/png/';
31
-	}
26
+    /**
27
+     * {@inheritDoc}
28
+     */
29
+    public function getMimeType() {
30
+        return '/image\/png/';
31
+    }
32 32
 }
Please login to merge, or discard this patch.
lib/private/Preview/Image.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,42 +29,42 @@
 block discarded – undo
29 29
 
30 30
 abstract class Image extends Provider {
31 31
 
32
-	/**
33
-	 * {@inheritDoc}
34
-	 */
35
-	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
36
-		//get fileinfo
37
-		$fileInfo = $fileview->getFileInfo($path);
38
-		if (!$fileInfo) {
39
-			return false;
40
-		}
32
+    /**
33
+     * {@inheritDoc}
34
+     */
35
+    public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
36
+        //get fileinfo
37
+        $fileInfo = $fileview->getFileInfo($path);
38
+        if (!$fileInfo) {
39
+            return false;
40
+        }
41 41
 
42
-		$maxSizeForImages = \OC::$server->getConfig()->getSystemValue('preview_max_filesize_image', 50);
43
-		$size = $fileInfo->getSize();
42
+        $maxSizeForImages = \OC::$server->getConfig()->getSystemValue('preview_max_filesize_image', 50);
43
+        $size = $fileInfo->getSize();
44 44
 
45
-		if ($maxSizeForImages !== -1 && $size > ($maxSizeForImages * 1024 * 1024)) {
46
-			return false;
47
-		}
45
+        if ($maxSizeForImages !== -1 && $size > ($maxSizeForImages * 1024 * 1024)) {
46
+            return false;
47
+        }
48 48
 
49
-		$image = new \OC_Image();
49
+        $image = new \OC_Image();
50 50
 
51
-		$useTempFile = $fileInfo->isEncrypted() || !$fileInfo->getStorage()->isLocal();
52
-		if ($useTempFile) {
53
-			$fileName = $fileview->toTmpFile($path);
54
-		} else {
55
-			$fileName = $fileview->getLocalFile($path);
56
-		}
57
-		$image->loadFromFile($fileName);
58
-		$image->fixOrientation();
59
-		if ($useTempFile) {
60
-			unlink($fileName);
61
-		}
62
-		if ($image->valid()) {
63
-			$image->scaleDownToFit($maxX, $maxY);
51
+        $useTempFile = $fileInfo->isEncrypted() || !$fileInfo->getStorage()->isLocal();
52
+        if ($useTempFile) {
53
+            $fileName = $fileview->toTmpFile($path);
54
+        } else {
55
+            $fileName = $fileview->getLocalFile($path);
56
+        }
57
+        $image->loadFromFile($fileName);
58
+        $image->fixOrientation();
59
+        if ($useTempFile) {
60
+            unlink($fileName);
61
+        }
62
+        if ($image->valid()) {
63
+            $image->scaleDownToFit($maxX, $maxY);
64 64
 
65
-			return $image;
66
-		}
67
-		return false;
68
-	}
65
+            return $image;
66
+        }
67
+        return false;
68
+    }
69 69
 
70 70
 }
Please login to merge, or discard this patch.
lib/private/Preview/TIFF.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 
26 26
 //.tiff
27 27
 class TIFF extends Bitmap {
28
-	/**
29
-	 * {@inheritDoc}
30
-	 */
31
-	public function getMimeType() {
32
-		return '/image\/tiff/';
33
-	}
28
+    /**
29
+     * {@inheritDoc}
30
+     */
31
+    public function getMimeType() {
32
+        return '/image\/tiff/';
33
+    }
34 34
 }
Please login to merge, or discard this patch.
lib/private/Preview/TXT.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -27,67 +27,67 @@
 block discarded – undo
27 27
 namespace OC\Preview;
28 28
 
29 29
 class TXT extends Provider {
30
-	/**
31
-	 * {@inheritDoc}
32
-	 */
33
-	public function getMimeType() {
34
-		return '/text\/plain/';
35
-	}
30
+    /**
31
+     * {@inheritDoc}
32
+     */
33
+    public function getMimeType() {
34
+        return '/text\/plain/';
35
+    }
36 36
 
37
-	/**
38
-	 * {@inheritDoc}
39
-	 */
40
-	public function isAvailable(\OCP\Files\FileInfo $file) {
41
-		return $file->getSize() > 0;
42
-	}
37
+    /**
38
+     * {@inheritDoc}
39
+     */
40
+    public function isAvailable(\OCP\Files\FileInfo $file) {
41
+        return $file->getSize() > 0;
42
+    }
43 43
 
44
-	/**
45
-	 * {@inheritDoc}
46
-	 */
47
-	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
48
-		$content = $fileview->fopen($path, 'r');
49
-		$content = stream_get_contents($content,3000);
44
+    /**
45
+     * {@inheritDoc}
46
+     */
47
+    public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
48
+        $content = $fileview->fopen($path, 'r');
49
+        $content = stream_get_contents($content,3000);
50 50
 
51
-		//don't create previews of empty text files
52
-		if(trim($content) === '') {
53
-			return false;
54
-		}
51
+        //don't create previews of empty text files
52
+        if(trim($content) === '') {
53
+            return false;
54
+        }
55 55
 
56
-		$lines = preg_split("/\r\n|\n|\r/", $content);
56
+        $lines = preg_split("/\r\n|\n|\r/", $content);
57 57
 
58
-		$fontSize = ($maxX) ? (int) ((5 / 32) * $maxX) : 5; //5px
59
-		$lineSize = ceil($fontSize * 1.25);
58
+        $fontSize = ($maxX) ? (int) ((5 / 32) * $maxX) : 5; //5px
59
+        $lineSize = ceil($fontSize * 1.25);
60 60
 
61
-		$image = imagecreate($maxX, $maxY);
62
-		imagecolorallocate($image, 255, 255, 255);
63
-		$textColor = imagecolorallocate($image, 0, 0, 0);
61
+        $image = imagecreate($maxX, $maxY);
62
+        imagecolorallocate($image, 255, 255, 255);
63
+        $textColor = imagecolorallocate($image, 0, 0, 0);
64 64
 
65
-		$fontFile  = __DIR__;
66
-		$fontFile .= '/../../../core';
67
-		$fontFile .= '/fonts/OpenSans-Regular.ttf';
65
+        $fontFile  = __DIR__;
66
+        $fontFile .= '/../../../core';
67
+        $fontFile .= '/fonts/OpenSans-Regular.ttf';
68 68
 
69
-		$canUseTTF = function_exists('imagettftext');
69
+        $canUseTTF = function_exists('imagettftext');
70 70
 
71
-		foreach($lines as $index => $line) {
72
-			$index = $index + 1;
71
+        foreach($lines as $index => $line) {
72
+            $index = $index + 1;
73 73
 
74
-			$x = (int) 1;
75
-			$y = (int) ($index * $lineSize);
74
+            $x = (int) 1;
75
+            $y = (int) ($index * $lineSize);
76 76
 
77
-			if ($canUseTTF === true) {
78
-				imagettftext($image, $fontSize, 0, $x, $y, $textColor, $fontFile, $line);
79
-			} else {
80
-				$y -= $fontSize;
81
-				imagestring($image, 1, $x, $y, $line, $textColor);
82
-			}
77
+            if ($canUseTTF === true) {
78
+                imagettftext($image, $fontSize, 0, $x, $y, $textColor, $fontFile, $line);
79
+            } else {
80
+                $y -= $fontSize;
81
+                imagestring($image, 1, $x, $y, $line, $textColor);
82
+            }
83 83
 
84
-			if(($index * $lineSize) >= $maxY) {
85
-				break;
86
-			}
87
-		}
84
+            if(($index * $lineSize) >= $maxY) {
85
+                break;
86
+            }
87
+        }
88 88
 
89
-		$image = new \OC_Image($image);
89
+        $image = new \OC_Image($image);
90 90
 
91
-		return $image->valid() ? $image : false;
92
-	}
91
+        return $image->valid() ? $image : false;
92
+    }
93 93
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
48 48
 		$content = $fileview->fopen($path, 'r');
49
-		$content = stream_get_contents($content,3000);
49
+		$content = stream_get_contents($content, 3000);
50 50
 
51 51
 		//don't create previews of empty text files
52
-		if(trim($content) === '') {
52
+		if (trim($content) === '') {
53 53
 			return false;
54 54
 		}
55 55
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$canUseTTF = function_exists('imagettftext');
70 70
 
71
-		foreach($lines as $index => $line) {
71
+		foreach ($lines as $index => $line) {
72 72
 			$index = $index + 1;
73 73
 
74 74
 			$x = (int) 1;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				imagestring($image, 1, $x, $y, $line, $textColor);
82 82
 			}
83 83
 
84
-			if(($index * $lineSize) >= $maxY) {
84
+			if (($index * $lineSize) >= $maxY) {
85 85
 				break;
86 86
 			}
87 87
 		}
Please login to merge, or discard this patch.