Completed
Push — master ( 20fd3a...8b87e8 )
by Fabien
50:38
created
Classes/FileUpload/ImageOptimizer.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -17,81 +17,81 @@
 block discarded – undo
17 17
  */
18 18
 class ImageOptimizer implements SingletonInterface
19 19
 {
20
-    /**
21
-     * @var array
22
-     */
23
-    protected $optimizers = [];
20
+	/**
21
+	 * @var array
22
+	 */
23
+	protected $optimizers = [];
24 24
 
25
-    /**
26
-     * @var ResourceStorage
27
-     */
28
-    protected $storage;
25
+	/**
26
+	 * @var ResourceStorage
27
+	 */
28
+	protected $storage;
29 29
 
30
-    /**
31
-     * Returns a class instance.
32
-     *
33
-     * @return ImageOptimizer
34
-     * @throws \InvalidArgumentException
35
-     * @param ResourceStorage $storage
36
-     */
37
-    public static function getInstance($storage = null)
38
-    {
39
-        return GeneralUtility::makeInstance(self::class, $storage);
40
-    }
30
+	/**
31
+	 * Returns a class instance.
32
+	 *
33
+	 * @return ImageOptimizer
34
+	 * @throws \InvalidArgumentException
35
+	 * @param ResourceStorage $storage
36
+	 */
37
+	public static function getInstance($storage = null)
38
+	{
39
+		return GeneralUtility::makeInstance(self::class, $storage);
40
+	}
41 41
 
42
-    /**
43
-     * Constructor
44
-     *
45
-     * @return ImageOptimizer
46
-     * @param ResourceStorage $storage
47
-     */
48
-    public function __construct($storage = null)
49
-    {
50
-        $this->storage = $storage;
51
-        $this->add('Fab\Media\FileUpload\Optimizer\Resize');
52
-        $this->add('Fab\Media\FileUpload\Optimizer\Rotate');
53
-    }
42
+	/**
43
+	 * Constructor
44
+	 *
45
+	 * @return ImageOptimizer
46
+	 * @param ResourceStorage $storage
47
+	 */
48
+	public function __construct($storage = null)
49
+	{
50
+		$this->storage = $storage;
51
+		$this->add('Fab\Media\FileUpload\Optimizer\Resize');
52
+		$this->add('Fab\Media\FileUpload\Optimizer\Rotate');
53
+	}
54 54
 
55
-    /**
56
-     * Register a new optimizer
57
-     *
58
-     * @param string $className
59
-     * @return void
60
-     */
61
-    public function add($className)
62
-    {
63
-        $this->optimizers[] = $className;
64
-    }
55
+	/**
56
+	 * Register a new optimizer
57
+	 *
58
+	 * @param string $className
59
+	 * @return void
60
+	 */
61
+	public function add($className)
62
+	{
63
+		$this->optimizers[] = $className;
64
+	}
65 65
 
66
-    /**
67
-     * Un-register a new optimizer
68
-     *
69
-     * @param string $className
70
-     * @return void
71
-     */
72
-    public function remove($className)
73
-    {
74
-        if (in_array($className, $this->optimizers)) {
75
-            $key = array_search($className, $this->optimizers);
76
-            unset($this->optimizers[$key]);
77
-        }
78
-    }
66
+	/**
67
+	 * Un-register a new optimizer
68
+	 *
69
+	 * @param string $className
70
+	 * @return void
71
+	 */
72
+	public function remove($className)
73
+	{
74
+		if (in_array($className, $this->optimizers)) {
75
+			$key = array_search($className, $this->optimizers);
76
+			unset($this->optimizers[$key]);
77
+		}
78
+	}
79 79
 
80
-    /**
81
-     * Optimize an image
82
-     *
83
-     * @param UploadedFileInterface $uploadedFile
84
-     * @return UploadedFileInterface
85
-     * @throws \InvalidArgumentException
86
-     */
87
-    public function optimize(UploadedFileInterface $uploadedFile)
88
-    {
89
-        foreach ($this->optimizers as $optimizer) {
90
-            /** @var $optimizer \Fab\Media\FileUpload\ImageOptimizerInterface */
91
-            $optimizer = GeneralUtility::makeInstance($optimizer, $this->storage);
92
-            $uploadedFile = $optimizer->optimize($uploadedFile);
93
-        }
80
+	/**
81
+	 * Optimize an image
82
+	 *
83
+	 * @param UploadedFileInterface $uploadedFile
84
+	 * @return UploadedFileInterface
85
+	 * @throws \InvalidArgumentException
86
+	 */
87
+	public function optimize(UploadedFileInterface $uploadedFile)
88
+	{
89
+		foreach ($this->optimizers as $optimizer) {
90
+			/** @var $optimizer \Fab\Media\FileUpload\ImageOptimizerInterface */
91
+			$optimizer = GeneralUtility::makeInstance($optimizer, $this->storage);
92
+			$uploadedFile = $optimizer->optimize($uploadedFile);
93
+		}
94 94
 
95
-        return $uploadedFile;
96
-    }
95
+		return $uploadedFile;
96
+	}
97 97
 }
Please login to merge, or discard this patch.
Classes/FileUpload/Optimizer/Resize.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -22,110 +22,110 @@
 block discarded – undo
22 22
  */
23 23
 class Resize implements ImageOptimizerInterface
24 24
 {
25
-    /**
26
-     * @var GifBuilder
27
-     */
28
-    protected $gifCreator;
25
+	/**
26
+	 * @var GifBuilder
27
+	 */
28
+	protected $gifCreator;
29 29
 
30
-    /**
31
-     * @var ResourceStorage
32
-     */
33
-    protected $storage;
30
+	/**
31
+	 * @var ResourceStorage
32
+	 */
33
+	protected $storage;
34 34
 
35
-    /**
36
-     * Constructor
37
-     */
38
-    public function __construct($storage = null)
39
-    {
40
-        $this->storage = $storage;
41
-        $this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
42
-        $this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
43
-    }
35
+	/**
36
+	 * Constructor
37
+	 */
38
+	public function __construct($storage = null)
39
+	{
40
+		$this->storage = $storage;
41
+		$this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
42
+		$this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
43
+	}
44 44
 
45
-    /**
46
-     * Optimize the given uploaded image.
47
-     *
48
-     * @param UploadedFileInterface $uploadedFile
49
-     * @return UploadedFileInterface
50
-     */
51
-    public function optimize($uploadedFile)
52
-    {
53
-        $imageInfo = getimagesize($uploadedFile->getFileWithAbsolutePath());
45
+	/**
46
+	 * Optimize the given uploaded image.
47
+	 *
48
+	 * @param UploadedFileInterface $uploadedFile
49
+	 * @return UploadedFileInterface
50
+	 */
51
+	public function optimize($uploadedFile)
52
+	{
53
+		$imageInfo = getimagesize($uploadedFile->getFileWithAbsolutePath());
54 54
 
55
-        $currentWidth = $imageInfo[0];
56
-        $currentHeight = $imageInfo[1];
55
+		$currentWidth = $imageInfo[0];
56
+		$currentHeight = $imageInfo[1];
57 57
 
58
-        // resize an image if this one is bigger than telling by the settings.
59
-        if (is_object($this->storage)) {
60
-            $storageRecord = $this->storage->getStorageRecord();
61
-        } else {
62
-            // Will only work in the BE for now.
63
-            $storage = $this->getMediaModule()->getCurrentStorage();
64
-            $storageRecord = $storage->getStorageRecord();
65
-        }
58
+		// resize an image if this one is bigger than telling by the settings.
59
+		if (is_object($this->storage)) {
60
+			$storageRecord = $this->storage->getStorageRecord();
61
+		} else {
62
+			// Will only work in the BE for now.
63
+			$storage = $this->getMediaModule()->getCurrentStorage();
64
+			$storageRecord = $storage->getStorageRecord();
65
+		}
66 66
 
67
-        if (strlen($storageRecord['maximum_dimension_original_image']) > 0) {
68
-            /** @var Dimension $imageDimension */
69
-            $imageDimension = GeneralUtility::makeInstance(Dimension::class, $storageRecord['maximum_dimension_original_image']);
70
-            if ($currentWidth > $imageDimension->getWidth() || $currentHeight > $imageDimension->getHeight()) {
71
-                // resize taking the width as reference
72
-                $this->resize($uploadedFile->getFileWithAbsolutePath(), $imageDimension->getWidth(), $imageDimension->getHeight());
73
-            }
74
-        }
75
-        return $uploadedFile;
76
-    }
67
+		if (strlen($storageRecord['maximum_dimension_original_image']) > 0) {
68
+			/** @var Dimension $imageDimension */
69
+			$imageDimension = GeneralUtility::makeInstance(Dimension::class, $storageRecord['maximum_dimension_original_image']);
70
+			if ($currentWidth > $imageDimension->getWidth() || $currentHeight > $imageDimension->getHeight()) {
71
+				// resize taking the width as reference
72
+				$this->resize($uploadedFile->getFileWithAbsolutePath(), $imageDimension->getWidth(), $imageDimension->getHeight());
73
+			}
74
+		}
75
+		return $uploadedFile;
76
+	}
77 77
 
78
-    /**
79
-     * Resize an image according to given parameter.
80
-     *
81
-     * @throws \Exception
82
-     * @param string $fileNameAndPath
83
-     * @param int $width
84
-     * @param int $height
85
-     * @return void
86
-     */
87
-    public function resize($fileNameAndPath, $width = 0, $height = 0)
88
-    {
89
-        // Skip profile of the image
90
-        $imParams = '###SkipStripProfile###';
91
-        $options = array(
92
-            'maxW' => $width,
93
-            'maxH' => $height,
94
-        );
78
+	/**
79
+	 * Resize an image according to given parameter.
80
+	 *
81
+	 * @throws \Exception
82
+	 * @param string $fileNameAndPath
83
+	 * @param int $width
84
+	 * @param int $height
85
+	 * @return void
86
+	 */
87
+	public function resize($fileNameAndPath, $width = 0, $height = 0)
88
+	{
89
+		// Skip profile of the image
90
+		$imParams = '###SkipStripProfile###';
91
+		$options = array(
92
+			'maxW' => $width,
93
+			'maxH' => $height,
94
+		);
95 95
 
96
-        $tempFileInfo = $this->gifCreator->imageMagickConvert($fileNameAndPath, '', '', '', $imParams, '', $options, true);
97
-        if ($tempFileInfo) {
98
-            // Overwrite original file
99
-            @unlink($fileNameAndPath);
100
-            @rename($tempFileInfo[3], $fileNameAndPath);
101
-        }
102
-    }
96
+		$tempFileInfo = $this->gifCreator->imageMagickConvert($fileNameAndPath, '', '', '', $imParams, '', $options, true);
97
+		if ($tempFileInfo) {
98
+			// Overwrite original file
99
+			@unlink($fileNameAndPath);
100
+			@rename($tempFileInfo[3], $fileNameAndPath);
101
+		}
102
+	}
103 103
 
104
-    /**
105
-     * Escapes a file name so it can safely be used on the command line.
106
-     *
107
-     * @see \TYPO3\CMS\Core\Imaging\GraphicalFunctions
108
-     * @param string $inputName filename to safeguard, must not be empty
109
-     * @return string $inputName escaped as needed
110
-     */
111
-    protected function wrapFileName($inputName)
112
-    {
113
-        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
114
-            $currentLocale = setlocale(LC_CTYPE, 0);
115
-            setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
116
-        }
117
-        $escapedInputName = escapeshellarg($inputName);
118
-        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
119
-            setlocale(LC_CTYPE, $currentLocale);
120
-        }
121
-        return $escapedInputName;
122
-    }
104
+	/**
105
+	 * Escapes a file name so it can safely be used on the command line.
106
+	 *
107
+	 * @see \TYPO3\CMS\Core\Imaging\GraphicalFunctions
108
+	 * @param string $inputName filename to safeguard, must not be empty
109
+	 * @return string $inputName escaped as needed
110
+	 */
111
+	protected function wrapFileName($inputName)
112
+	{
113
+		if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
114
+			$currentLocale = setlocale(LC_CTYPE, 0);
115
+			setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
116
+		}
117
+		$escapedInputName = escapeshellarg($inputName);
118
+		if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
119
+			setlocale(LC_CTYPE, $currentLocale);
120
+		}
121
+		return $escapedInputName;
122
+	}
123 123
 
124
-    /**
125
-     * @return MediaModule|object
126
-     */
127
-    protected function getMediaModule()
128
-    {
129
-        return GeneralUtility::makeInstance(MediaModule::class);
130
-    }
124
+	/**
125
+	 * @return MediaModule|object
126
+	 */
127
+	protected function getMediaModule()
128
+	{
129
+		return GeneralUtility::makeInstance(MediaModule::class);
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     {
40 40
         $this->storage = $storage;
41 41
         $this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
42
-        $this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
42
+        $this->gifCreator->absPrefix = Environment::getPublicPath().'/';
43 43
     }
44 44
 
45 45
     /**
Please login to merge, or discard this patch.
Classes/FileUpload/Optimizer/Rotate.php 2 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -19,152 +19,152 @@
 block discarded – undo
19 19
  */
20 20
 class Rotate implements ImageOptimizerInterface
21 21
 {
22
-    /**
23
-     * @var GifBuilder
24
-     */
25
-    protected $gifCreator;
22
+	/**
23
+	 * @var GifBuilder
24
+	 */
25
+	protected $gifCreator;
26 26
 
27
-    /**
28
-     * Constructor
29
-     */
30
-    public function __construct()
31
-    {
32
-        $this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
33
-        $this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
34
-    }
27
+	/**
28
+	 * Constructor
29
+	 */
30
+	public function __construct()
31
+	{
32
+		$this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
33
+		$this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
34
+	}
35 35
 
36
-    /**
37
-     * Optimize the given uploaded image
38
-     *
39
-     * @param UploadedFileInterface $uploadedFile
40
-     * @return UploadedFileInterface
41
-     */
42
-    public function optimize($uploadedFile)
43
-    {
44
-        $orientation = $this->getOrientation($uploadedFile->getFileWithAbsolutePath());
45
-        $isRotated = $this->isRotated($orientation);
36
+	/**
37
+	 * Optimize the given uploaded image
38
+	 *
39
+	 * @param UploadedFileInterface $uploadedFile
40
+	 * @return UploadedFileInterface
41
+	 */
42
+	public function optimize($uploadedFile)
43
+	{
44
+		$orientation = $this->getOrientation($uploadedFile->getFileWithAbsolutePath());
45
+		$isRotated = $this->isRotated($orientation);
46 46
 
47
-        // Only rotate image if necessary!
48
-        if ($isRotated > 0) {
49
-            $transformation = $this->getTransformation($orientation);
47
+		// Only rotate image if necessary!
48
+		if ($isRotated > 0) {
49
+			$transformation = $this->getTransformation($orientation);
50 50
 
51
-            $imParams = '###SkipStripProfile###';
52
-            if ($transformation !== '') {
53
-                $imParams .= ' ' . $transformation;
54
-            }
51
+			$imParams = '###SkipStripProfile###';
52
+			if ($transformation !== '') {
53
+				$imParams .= ' ' . $transformation;
54
+			}
55 55
 
56
-            $tempFileInfo = $this->gifCreator->imageMagickConvert($uploadedFile->getFileWithAbsolutePath(), '', '', '', $imParams, '', [], true);
57
-            if ($tempFileInfo) {
58
-                // Replace original file
59
-                @unlink($uploadedFile->getFileWithAbsolutePath());
60
-                @rename($tempFileInfo[3], $uploadedFile->getFileWithAbsolutePath());
56
+			$tempFileInfo = $this->gifCreator->imageMagickConvert($uploadedFile->getFileWithAbsolutePath(), '', '', '', $imParams, '', [], true);
57
+			if ($tempFileInfo) {
58
+				// Replace original file
59
+				@unlink($uploadedFile->getFileWithAbsolutePath());
60
+				@rename($tempFileInfo[3], $uploadedFile->getFileWithAbsolutePath());
61 61
 
62
-                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] === 'gm') {
63
-                    $this->resetOrientation($uploadedFile->getFileWithAbsolutePath());
64
-                }
65
-            }
66
-        }
67
-        return $uploadedFile;
68
-    }
62
+				if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] === 'gm') {
63
+					$this->resetOrientation($uploadedFile->getFileWithAbsolutePath());
64
+				}
65
+			}
66
+		}
67
+		return $uploadedFile;
68
+	}
69 69
 
70
-    /**
71
-     * Returns the EXIF orientation of a given picture.
72
-     *
73
-     * @param string $filename
74
-     * @return integer
75
-     */
76
-    protected function getOrientation($filename)
77
-    {
78
-        $extension = strtolower(substr($filename, strrpos($filename, '.') + 1));
79
-        $orientation = 1; // Fallback to "straight"
80
-        if (GeneralUtility::inList('jpg,jpeg,tif,tiff', $extension) && function_exists('exif_read_data')) {
81
-            try {
82
-                $exif = exif_read_data($filename);
83
-                if ($exif) {
84
-                    $orientation = $exif['Orientation'];
85
-                }
86
-            } catch (\Exception $e) {
87
-            }
88
-        }
89
-        return $orientation;
90
-    }
70
+	/**
71
+	 * Returns the EXIF orientation of a given picture.
72
+	 *
73
+	 * @param string $filename
74
+	 * @return integer
75
+	 */
76
+	protected function getOrientation($filename)
77
+	{
78
+		$extension = strtolower(substr($filename, strrpos($filename, '.') + 1));
79
+		$orientation = 1; // Fallback to "straight"
80
+		if (GeneralUtility::inList('jpg,jpeg,tif,tiff', $extension) && function_exists('exif_read_data')) {
81
+			try {
82
+				$exif = exif_read_data($filename);
83
+				if ($exif) {
84
+					$orientation = $exif['Orientation'];
85
+				}
86
+			} catch (\Exception $e) {
87
+			}
88
+		}
89
+		return $orientation;
90
+	}
91 91
 
92
-    /**
93
-     * Returns true if the given picture is rotated.
94
-     *
95
-     * @param integer $orientation EXIF orientation
96
-     * @return integer
97
-     * @see http://www.impulseadventure.com/photo/exif-orientation.html
98
-     */
99
-    protected function isRotated($orientation)
100
-    {
101
-        $ret = false;
102
-        switch ($orientation) {
103
-            case 2: // horizontal flip
104
-            case 3: // 180°
105
-            case 4: // vertical flip
106
-            case 5: // vertical flip + 90 rotate right
107
-            case 6: // 90° rotate right
108
-            case 7: // horizontal flip + 90 rotate right
109
-            case 8: // 90° rotate left
110
-                $ret = true;
111
-                break;
112
-        }
113
-        return $ret;
114
-    }
92
+	/**
93
+	 * Returns true if the given picture is rotated.
94
+	 *
95
+	 * @param integer $orientation EXIF orientation
96
+	 * @return integer
97
+	 * @see http://www.impulseadventure.com/photo/exif-orientation.html
98
+	 */
99
+	protected function isRotated($orientation)
100
+	{
101
+		$ret = false;
102
+		switch ($orientation) {
103
+			case 2: // horizontal flip
104
+			case 3: // 180°
105
+			case 4: // vertical flip
106
+			case 5: // vertical flip + 90 rotate right
107
+			case 6: // 90° rotate right
108
+			case 7: // horizontal flip + 90 rotate right
109
+			case 8: // 90° rotate left
110
+				$ret = true;
111
+				break;
112
+		}
113
+		return $ret;
114
+	}
115 115
 
116
-    /**
117
-     * Returns a command line parameter to fix the orientation of a rotated picture.
118
-     *
119
-     * @param integer $orientation
120
-     * @return string
121
-     */
122
-    protected function getTransformation($orientation)
123
-    {
124
-        $transformation = '';
125
-        if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] !== 'gm') {
126
-            // ImageMagick
127
-            if ($orientation >= 2 && $orientation <= 8) {
128
-                $transformation = '-auto-orient';
129
-            }
130
-        } else {
131
-            // GraphicsMagick
132
-            switch ($orientation) {
133
-                case 2: // horizontal flip
134
-                    $transformation = '-flip horizontal';
135
-                    break;
136
-                case 3: // 180°
137
-                    $transformation = '-rotate 180';
138
-                    break;
139
-                case 4: // vertical flip
140
-                    $transformation = '-flip vertical';
141
-                    break;
142
-                case 5: // vertical flip + 90 rotate right
143
-                    $transformation = '-transpose';
144
-                    break;
145
-                case 6: // 90° rotate right
146
-                    $transformation = '-rotate 90';
147
-                    break;
148
-                case 7: // horizontal flip + 90 rotate right
149
-                    $transformation = '-transverse';
150
-                    break;
151
-                case 8: // 90° rotate left
152
-                    $transformation = '-rotate 270';
153
-                    break;
154
-            }
155
-        }
156
-        return $transformation;
157
-    }
116
+	/**
117
+	 * Returns a command line parameter to fix the orientation of a rotated picture.
118
+	 *
119
+	 * @param integer $orientation
120
+	 * @return string
121
+	 */
122
+	protected function getTransformation($orientation)
123
+	{
124
+		$transformation = '';
125
+		if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] !== 'gm') {
126
+			// ImageMagick
127
+			if ($orientation >= 2 && $orientation <= 8) {
128
+				$transformation = '-auto-orient';
129
+			}
130
+		} else {
131
+			// GraphicsMagick
132
+			switch ($orientation) {
133
+				case 2: // horizontal flip
134
+					$transformation = '-flip horizontal';
135
+					break;
136
+				case 3: // 180°
137
+					$transformation = '-rotate 180';
138
+					break;
139
+				case 4: // vertical flip
140
+					$transformation = '-flip vertical';
141
+					break;
142
+				case 5: // vertical flip + 90 rotate right
143
+					$transformation = '-transpose';
144
+					break;
145
+				case 6: // 90° rotate right
146
+					$transformation = '-rotate 90';
147
+					break;
148
+				case 7: // horizontal flip + 90 rotate right
149
+					$transformation = '-transverse';
150
+					break;
151
+				case 8: // 90° rotate left
152
+					$transformation = '-rotate 270';
153
+					break;
154
+			}
155
+		}
156
+		return $transformation;
157
+	}
158 158
 
159
-    /**
160
-     * Resets the EXIF orientation flag of a picture.
161
-     *
162
-     * @param string $filename
163
-     * @return void
164
-     * @see http://sylvana.net/jpegcrop/exif_orientation.html
165
-     */
166
-    protected function resetOrientation($filename)
167
-    {
168
-        JpegExifOrient::setOrientation($filename, 1);
169
-    }
159
+	/**
160
+	 * Resets the EXIF orientation flag of a picture.
161
+	 *
162
+	 * @param string $filename
163
+	 * @return void
164
+	 * @see http://sylvana.net/jpegcrop/exif_orientation.html
165
+	 */
166
+	protected function resetOrientation($filename)
167
+	{
168
+		JpegExifOrient::setOrientation($filename, 1);
169
+	}
170 170
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function __construct()
31 31
     {
32 32
         $this->gifCreator = GeneralUtility::makeInstance(GifBuilder::class);
33
-        $this->gifCreator->absPrefix = Environment::getPublicPath() . '/';
33
+        $this->gifCreator->absPrefix = Environment::getPublicPath().'/';
34 34
     }
35 35
 
36 36
     /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
             $imParams = '###SkipStripProfile###';
52 52
             if ($transformation !== '') {
53
-                $imParams .= ' ' . $transformation;
53
+                $imParams .= ' '.$transformation;
54 54
             }
55 55
 
56 56
             $tempFileInfo = $this->gifCreator->imageMagickConvert($uploadedFile->getFileWithAbsolutePath(), '', '', '', $imParams, '', [], true);
Please login to merge, or discard this patch.
Classes/FileUpload/UploadedFileInterface.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -14,83 +14,83 @@
 block discarded – undo
14 14
  */
15 15
 interface UploadedFileInterface
16 16
 {
17
-    /**
18
-     * Save the file to the specified path.
19
-     *
20
-     * @return boolean true on success
21
-     */
22
-    public function save();
17
+	/**
18
+	 * Save the file to the specified path.
19
+	 *
20
+	 * @return boolean true on success
21
+	 */
22
+	public function save();
23 23
 
24
-    /**
25
-     * Get the original filename.
26
-     *
27
-     * @return string filename
28
-     */
29
-    public function getOriginalName();
24
+	/**
25
+	 * Get the original filename.
26
+	 *
27
+	 * @return string filename
28
+	 */
29
+	public function getOriginalName();
30 30
 
31
-    /**
32
-     * Get the file size.
33
-     *
34
-     * @return int
35
-     */
36
-    public function getSize();
31
+	/**
32
+	 * Get the file size.
33
+	 *
34
+	 * @return int
35
+	 */
36
+	public function getSize();
37 37
 
38
-    /**
39
-     * Get the file name.
40
-     *
41
-     * @return int
42
-     */
43
-    public function getName();
38
+	/**
39
+	 * Get the file name.
40
+	 *
41
+	 * @return int
42
+	 */
43
+	public function getName();
44 44
 
45
-    /**
46
-     * Get the file type.
47
-     *
48
-     * @return int
49
-     */
50
-    public function getType();
45
+	/**
46
+	 * Get the file type.
47
+	 *
48
+	 * @return int
49
+	 */
50
+	public function getType();
51 51
 
52
-    /**
53
-     * Get the mime type of the file.
54
-     *
55
-     * @return int
56
-     */
57
-    public function getMimeType();
52
+	/**
53
+	 * Get the mime type of the file.
54
+	 *
55
+	 * @return int
56
+	 */
57
+	public function getMimeType();
58 58
 
59
-    /**
60
-     * Get the file with its absolute path.
61
-     *
62
-     * @return string
63
-     */
64
-    public function getFileWithAbsolutePath();
59
+	/**
60
+	 * Get the file with its absolute path.
61
+	 *
62
+	 * @return string
63
+	 */
64
+	public function getFileWithAbsolutePath();
65 65
 
66
-    /**
67
-     * Get the file's public URL.
68
-     *
69
-     * @return string
70
-     */
71
-    public function getPublicUrl();
66
+	/**
67
+	 * Get the file's public URL.
68
+	 *
69
+	 * @return string
70
+	 */
71
+	public function getPublicUrl();
72 72
 
73
-    /**
74
-     * Set the file input name from the DOM.
75
-     *
76
-     * @param string $inputName
77
-     * @return \Fab\Media\FileUpload\UploadedFileInterface
78
-     */
79
-    public function setInputName($inputName);
73
+	/**
74
+	 * Set the file input name from the DOM.
75
+	 *
76
+	 * @param string $inputName
77
+	 * @return \Fab\Media\FileUpload\UploadedFileInterface
78
+	 */
79
+	public function setInputName($inputName);
80 80
 
81
-    /**
82
-     * Set the upload folder
83
-     *
84
-     * @param string $uploadFolder
85
-     * @return \Fab\Media\FileUpload\UploadedFileInterface
86
-     */
87
-    public function setUploadFolder($uploadFolder);
81
+	/**
82
+	 * Set the upload folder
83
+	 *
84
+	 * @param string $uploadFolder
85
+	 * @return \Fab\Media\FileUpload\UploadedFileInterface
86
+	 */
87
+	public function setUploadFolder($uploadFolder);
88 88
 
89
-    /**
90
-     * Set the file name to be saved
91
-     *
92
-     * @param string $name
93
-     * @return \Fab\Media\FileUpload\UploadedFileInterface
94
-     */
95
-    public function setName($name);
89
+	/**
90
+	 * Set the file name to be saved
91
+	 *
92
+	 * @param string $name
93
+	 * @return \Fab\Media\FileUpload\UploadedFileInterface
94
+	 */
95
+	public function setName($name);
96 96
 }
Please login to merge, or discard this patch.
Classes/FileUpload/MultipartedFile.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -16,48 +16,48 @@
 block discarded – undo
16 16
  */
17 17
 class MultipartedFile extends UploadedFileAbstract
18 18
 {
19
-    /**
20
-     * @var string
21
-     */
22
-    protected $inputName = 'qqfile';
19
+	/**
20
+	 * @var string
21
+	 */
22
+	protected $inputName = 'qqfile';
23 23
 
24
-    /**
25
-     * Save the file to the specified path
26
-     *
27
-     * @return boolean true on success
28
-     */
29
-    public function save()
30
-    {
31
-        return move_uploaded_file($_FILES[$this->inputName]['tmp_name'], $this->getFileWithAbsolutePath());
32
-    }
24
+	/**
25
+	 * Save the file to the specified path
26
+	 *
27
+	 * @return boolean true on success
28
+	 */
29
+	public function save()
30
+	{
31
+		return move_uploaded_file($_FILES[$this->inputName]['tmp_name'], $this->getFileWithAbsolutePath());
32
+	}
33 33
 
34
-    /**
35
-     * Get the original filename
36
-     *
37
-     * @return string filename
38
-     */
39
-    public function getOriginalName()
40
-    {
41
-        return $_FILES[$this->inputName]['name'];
42
-    }
34
+	/**
35
+	 * Get the original filename
36
+	 *
37
+	 * @return string filename
38
+	 */
39
+	public function getOriginalName()
40
+	{
41
+		return $_FILES[$this->inputName]['name'];
42
+	}
43 43
 
44
-    /**
45
-     * Get the file size
46
-     *
47
-     * @return integer file-size in byte
48
-     */
49
-    public function getSize()
50
-    {
51
-        return $_FILES[$this->inputName]['size'];
52
-    }
44
+	/**
45
+	 * Get the file size
46
+	 *
47
+	 * @return integer file-size in byte
48
+	 */
49
+	public function getSize()
50
+	{
51
+		return $_FILES[$this->inputName]['size'];
52
+	}
53 53
 
54
-    /**
55
-     * Get the mime type of the file.
56
-     *
57
-     * @return int
58
-     */
59
-    public function getMimeType()
60
-    {
61
-        return $_FILES[$this->inputName]['type'];
62
-    }
54
+	/**
55
+	 * Get the mime type of the file.
56
+	 *
57
+	 * @return int
58
+	 */
59
+	public function getMimeType()
60
+	{
61
+		return $_FILES[$this->inputName]['type'];
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Classes/DataHandler/FileDataHandler.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -21,126 +21,126 @@
 block discarded – undo
21 21
  */
22 22
 class FileDataHandler extends AbstractDataHandler
23 23
 {
24
-    /**
25
-     * Process File with action "update".
26
-     *
27
-     * @param Content $content
28
-     * @throws \Exception
29
-     * @return bool
30
-     */
31
-    public function processUpdate(Content $content)
32
-    {
33
-        throw new \Exception('Not yet implemented', 1409988673);
34
-    }
35
-
36
-    /**
37
-     * Process File with action "remove".
38
-     *
39
-     * @param Content $content
40
-     * @return bool|void
41
-     */
42
-    public function processRemove(Content $content)
43
-    {
44
-        $file = $this->getResourceFactory()->getFileObject($content->getUid());
45
-
46
-        $numberOfReferences = $this->getFileReferenceService()->countTotalReferences($file);
47
-        if ($numberOfReferences === 0) {
48
-            $file->delete();
49
-        } else {
50
-            $message = sprintf('I could not delete file "%s" as it is has %s reference(s).', $file->getUid(), $numberOfReferences);
51
-            $this->errorMessages = $message;
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Process File with action "copy".
57
-     *
58
-     * @param Content $content
59
-     * @param string $target
60
-     * @throws \Exception
61
-     * @return bool
62
-     */
63
-    public function processCopy(Content $content, $target)
64
-    {
65
-        $file = $this->getResourceFactory()->getFileObject($content->getUid());
66
-
67
-        if ($this->getMediaModule()->hasFolderTree()) {
68
-            $targetFolder = $this->getMediaModule()->getCurrentFolder();
69
-
70
-            // Move file
71
-            $file->copyTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
72
-        }
73
-        return true;
74
-    }
75
-
76
-    /**
77
-     * Process File with action "move".
78
-     *
79
-     * @param Content $content
80
-     * @param string $target
81
-     * @throws \Exception
82
-     * @return bool
83
-     */
84
-    public function processMove(Content $content, $target)
85
-    {
86
-        $file = $this->getResourceFactory()->getFileObject($content->getUid());
87
-
88
-        if ($this->getMediaModule()->hasFolderTree()) {
89
-            $targetFolder = $this->getMediaModule()->getCurrentFolder();
90
-            if ($targetFolder->getIdentifier() !== $file->getParentFolder()->getIdentifier()) {
91
-                // Move file
92
-                $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
93
-            }
94
-        } else {
95
-            // Only process if the storage is different.
96
-            if ((int)$file->getStorage()->getUid() !== (int)$target) {
97
-                $targetStorage = $this->getResourceFactory()->getStorageObject((int)$target);
98
-
99
-                // Retrieve target directory in the new storage. The folder will only be returned if the User has the correct permission.
100
-                $targetFolder = $this->getMediaModule()->getDefaultFolderInStorage($targetStorage, $file);
101
-
102
-                try {
103
-                    // Move file
104
-                    $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
105
-                } catch (\Exception $e) {
106
-                    $this->errorMessages = $e->getMessage();
107
-                }
108
-            }
109
-        }
110
-        return true;
111
-    }
112
-
113
-    /**
114
-     * @return FileReferenceService|object
115
-     */
116
-    protected function getFileReferenceService()
117
-    {
118
-        return GeneralUtility::makeInstance(FileReferenceService::class);
119
-    }
120
-
121
-    /**
122
-     * Process Content with action "localize".
123
-     *
124
-     * @param Content $content
125
-     * @param int $language
126
-     * @throws \Exception
127
-     * @return bool
128
-     */
129
-    public function processLocalize(Content $content, $language)
130
-    {
131
-        throw new \Exception('Nothing to implement here. Localization is done by the Core DataHandler', 1412760788);
132
-    }
133
-
134
-    /**
135
-     * @return MediaModule|object
136
-     */
137
-    protected function getMediaModule()
138
-    {
139
-        return GeneralUtility::makeInstance(MediaModule::class);
140
-    }
141
-
142
-    protected function getResourceFactory(): ResourceFactory
143
-    {
144
-        return GeneralUtility::makeInstance(ResourceFactory::class);
145
-    }
24
+	/**
25
+	 * Process File with action "update".
26
+	 *
27
+	 * @param Content $content
28
+	 * @throws \Exception
29
+	 * @return bool
30
+	 */
31
+	public function processUpdate(Content $content)
32
+	{
33
+		throw new \Exception('Not yet implemented', 1409988673);
34
+	}
35
+
36
+	/**
37
+	 * Process File with action "remove".
38
+	 *
39
+	 * @param Content $content
40
+	 * @return bool|void
41
+	 */
42
+	public function processRemove(Content $content)
43
+	{
44
+		$file = $this->getResourceFactory()->getFileObject($content->getUid());
45
+
46
+		$numberOfReferences = $this->getFileReferenceService()->countTotalReferences($file);
47
+		if ($numberOfReferences === 0) {
48
+			$file->delete();
49
+		} else {
50
+			$message = sprintf('I could not delete file "%s" as it is has %s reference(s).', $file->getUid(), $numberOfReferences);
51
+			$this->errorMessages = $message;
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Process File with action "copy".
57
+	 *
58
+	 * @param Content $content
59
+	 * @param string $target
60
+	 * @throws \Exception
61
+	 * @return bool
62
+	 */
63
+	public function processCopy(Content $content, $target)
64
+	{
65
+		$file = $this->getResourceFactory()->getFileObject($content->getUid());
66
+
67
+		if ($this->getMediaModule()->hasFolderTree()) {
68
+			$targetFolder = $this->getMediaModule()->getCurrentFolder();
69
+
70
+			// Move file
71
+			$file->copyTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
72
+		}
73
+		return true;
74
+	}
75
+
76
+	/**
77
+	 * Process File with action "move".
78
+	 *
79
+	 * @param Content $content
80
+	 * @param string $target
81
+	 * @throws \Exception
82
+	 * @return bool
83
+	 */
84
+	public function processMove(Content $content, $target)
85
+	{
86
+		$file = $this->getResourceFactory()->getFileObject($content->getUid());
87
+
88
+		if ($this->getMediaModule()->hasFolderTree()) {
89
+			$targetFolder = $this->getMediaModule()->getCurrentFolder();
90
+			if ($targetFolder->getIdentifier() !== $file->getParentFolder()->getIdentifier()) {
91
+				// Move file
92
+				$file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
93
+			}
94
+		} else {
95
+			// Only process if the storage is different.
96
+			if ((int)$file->getStorage()->getUid() !== (int)$target) {
97
+				$targetStorage = $this->getResourceFactory()->getStorageObject((int)$target);
98
+
99
+				// Retrieve target directory in the new storage. The folder will only be returned if the User has the correct permission.
100
+				$targetFolder = $this->getMediaModule()->getDefaultFolderInStorage($targetStorage, $file);
101
+
102
+				try {
103
+					// Move file
104
+					$file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME);
105
+				} catch (\Exception $e) {
106
+					$this->errorMessages = $e->getMessage();
107
+				}
108
+			}
109
+		}
110
+		return true;
111
+	}
112
+
113
+	/**
114
+	 * @return FileReferenceService|object
115
+	 */
116
+	protected function getFileReferenceService()
117
+	{
118
+		return GeneralUtility::makeInstance(FileReferenceService::class);
119
+	}
120
+
121
+	/**
122
+	 * Process Content with action "localize".
123
+	 *
124
+	 * @param Content $content
125
+	 * @param int $language
126
+	 * @throws \Exception
127
+	 * @return bool
128
+	 */
129
+	public function processLocalize(Content $content, $language)
130
+	{
131
+		throw new \Exception('Nothing to implement here. Localization is done by the Core DataHandler', 1412760788);
132
+	}
133
+
134
+	/**
135
+	 * @return MediaModule|object
136
+	 */
137
+	protected function getMediaModule()
138
+	{
139
+		return GeneralUtility::makeInstance(MediaModule::class);
140
+	}
141
+
142
+	protected function getResourceFactory(): ResourceFactory
143
+	{
144
+		return GeneralUtility::makeInstance(ResourceFactory::class);
145
+	}
146 146
 }
Please login to merge, or discard this patch.
Classes/Grid/FrontendPermissionRenderer.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
  */
17 17
 class FrontendPermissionRenderer extends ColumnRendererAbstract
18 18
 {
19
-    /**
20
-     * Render permission in the grid.
21
-     *
22
-     * @return string
23
-     */
24
-    public function render()
25
-    {
26
-        $result = '';
19
+	/**
20
+	 * Render permission in the grid.
21
+	 *
22
+	 * @return string
23
+	 */
24
+	public function render()
25
+	{
26
+		$result = '';
27 27
 
28
-        $frontendUserGroups = $this->object['metadata']['fe_groups'];
29
-        if (!empty($frontendUserGroups)) {
30
-            /** @var $frontendUserGroup \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup */
31
-            foreach ($frontendUserGroups as $frontendUserGroup) {
32
-                $result .= sprintf('<li style="list-style: disc">%s</li>', $frontendUserGroup['title']);
33
-            }
34
-            $result = sprintf('<ul>%s</ul>', $result);
35
-        }
36
-        return $result;
37
-    }
28
+		$frontendUserGroups = $this->object['metadata']['fe_groups'];
29
+		if (!empty($frontendUserGroups)) {
30
+			/** @var $frontendUserGroup \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup */
31
+			foreach ($frontendUserGroups as $frontendUserGroup) {
32
+				$result .= sprintf('<li style="list-style: disc">%s</li>', $frontendUserGroup['title']);
33
+			}
34
+			$result = sprintf('<ul>%s</ul>', $result);
35
+		}
36
+		return $result;
37
+	}
38 38
 }
Please login to merge, or discard this patch.
Classes/Grid/MetadataRenderer.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -19,76 +19,76 @@
 block discarded – undo
19 19
  */
20 20
 class MetadataRenderer extends ColumnRendererAbstract
21 21
 {
22
-    /**
23
-     * Renders a configurable metadata property of a file in the Grid.
24
-     *
25
-     * @throws \Exception
26
-     * @return string
27
-     */
28
-    public function render()
29
-    {
30
-        if (empty($this->gridRendererConfiguration['property'])) {
31
-            throw new \Exception('Missing property value for Grid Renderer Metadata', 1390391042);
32
-        }
22
+	/**
23
+	 * Renders a configurable metadata property of a file in the Grid.
24
+	 *
25
+	 * @throws \Exception
26
+	 * @return string
27
+	 */
28
+	public function render()
29
+	{
30
+		if (empty($this->gridRendererConfiguration['property'])) {
31
+			throw new \Exception('Missing property value for Grid Renderer Metadata', 1390391042);
32
+		}
33 33
 
34
-        $file = $this->getFileConverter()->convert($this->object);
35
-        $propertyName = $this->gridRendererConfiguration['property'];
34
+		$file = $this->getFileConverter()->convert($this->object);
35
+		$propertyName = $this->gridRendererConfiguration['property'];
36 36
 
37
-        if ($propertyName === 'uid') {
38
-            $metadata = $file->getMetaData();
39
-            $result = $metadata['uid']; // make an exception here to retrieve the uid of the metadata.
40
-        } else {
41
-            $result = $file->getProperty($propertyName);
42
-        }
37
+		if ($propertyName === 'uid') {
38
+			$metadata = $file->getMetaData();
39
+			$result = $metadata['uid']; // make an exception here to retrieve the uid of the metadata.
40
+		} else {
41
+			$result = $file->getProperty($propertyName);
42
+		}
43 43
 
44
-        // Avoid bad surprise, converts characters to HTML.
45
-        $fieldType = Tca::table('sys_file_metadata')->field($propertyName)->getType();
46
-        if ($fieldType !== FieldType::TEXTAREA) {
47
-            $result = htmlentities($result);
48
-        } elseif ($fieldType === FieldType::TEXTAREA && !$this->isClean($result)) {
49
-            $result = htmlentities($result);
50
-        } elseif ($fieldType === FieldType::TEXTAREA && !$this->hasHtml($result)) {
51
-            $result = nl2br($result);
52
-        }
44
+		// Avoid bad surprise, converts characters to HTML.
45
+		$fieldType = Tca::table('sys_file_metadata')->field($propertyName)->getType();
46
+		if ($fieldType !== FieldType::TEXTAREA) {
47
+			$result = htmlentities($result);
48
+		} elseif ($fieldType === FieldType::TEXTAREA && !$this->isClean($result)) {
49
+			$result = htmlentities($result);
50
+		} elseif ($fieldType === FieldType::TEXTAREA && !$this->hasHtml($result)) {
51
+			$result = nl2br($result);
52
+		}
53 53
 
54
-        return $result;
55
-    }
54
+		return $result;
55
+	}
56 56
 
57
-    /**
58
-     * Check whether a string contains HTML tags.
59
-     *
60
-     * @param string $content the content to be analyzed
61
-     * @return boolean
62
-     */
63
-    protected function hasHtml($content)
64
-    {
65
-        $result = false;
57
+	/**
58
+	 * Check whether a string contains HTML tags.
59
+	 *
60
+	 * @param string $content the content to be analyzed
61
+	 * @return boolean
62
+	 */
63
+	protected function hasHtml($content)
64
+	{
65
+		$result = false;
66 66
 
67
-        // We compare the length of the string with html tags and without html tags.
68
-        if (strlen($content) != strlen(strip_tags($content))) {
69
-            $result = true;
70
-        }
71
-        return $result;
72
-    }
67
+		// We compare the length of the string with html tags and without html tags.
68
+		if (strlen($content) != strlen(strip_tags($content))) {
69
+			$result = true;
70
+		}
71
+		return $result;
72
+	}
73 73
 
74
-    /**
75
-     * Check whether a string contains potential XSS
76
-     *
77
-     * @param string $content the content to be analyzed
78
-     * @return boolean
79
-     */
80
-    protected function isClean($content)
81
-    {
82
-        // @todo implement me!
83
-        $result = true;
84
-        return $result;
85
-    }
74
+	/**
75
+	 * Check whether a string contains potential XSS
76
+	 *
77
+	 * @param string $content the content to be analyzed
78
+	 * @return boolean
79
+	 */
80
+	protected function isClean($content)
81
+	{
82
+		// @todo implement me!
83
+		$result = true;
84
+		return $result;
85
+	}
86 86
 
87
-    /**
88
-     * @return ContentToFileConverter|object
89
-     */
90
-    protected function getFileConverter()
91
-    {
92
-        return GeneralUtility::makeInstance(ContentToFileConverter::class);
93
-    }
87
+	/**
88
+	 * @return ContentToFileConverter|object
89
+	 */
90
+	protected function getFileConverter()
91
+	{
92
+		return GeneralUtility::makeInstance(ContentToFileConverter::class);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Classes/Grid/CategoryRenderer.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
  */
17 17
 class CategoryRenderer extends ColumnRendererAbstract
18 18
 {
19
-    /**
20
-     * Renders category list of an asset in the grid.
21
-     *
22
-     * @return string
23
-     */
24
-    public function render()
25
-    {
26
-        $result = '';
19
+	/**
20
+	 * Renders category list of an asset in the grid.
21
+	 *
22
+	 * @return string
23
+	 */
24
+	public function render()
25
+	{
26
+		$result = '';
27 27
 
28
-        $categories = $this->object['metadata']['categories'];
29
-        if (!empty($categories)) {
30
-            /** @var $category \TYPO3\CMS\Extbase\Domain\Model\Category */
31
-            foreach ($categories as $category) {
32
-                $result .= sprintf('<li>%s</li>', $category['title']);
33
-            }
34
-            $result = sprintf('<ul class="category-list">%s</ul>', $result);
35
-        }
36
-        return $result;
37
-    }
28
+		$categories = $this->object['metadata']['categories'];
29
+		if (!empty($categories)) {
30
+			/** @var $category \TYPO3\CMS\Extbase\Domain\Model\Category */
31
+			foreach ($categories as $category) {
32
+				$result .= sprintf('<li>%s</li>', $category['title']);
33
+			}
34
+			$result = sprintf('<ul class="category-list">%s</ul>', $result);
35
+		}
36
+		return $result;
37
+	}
38 38
 }
Please login to merge, or discard this patch.