@@ -16,62 +16,62 @@ |
||
16 | 16 | class SessionUtility implements \TYPO3\CMS\Core\SingletonInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $moduleKey = 'media'; |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $moduleKey = 'media'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Returns a class instance. |
|
26 | - * |
|
27 | - * @return \Fab\Media\Utility\SessionUtility|object |
|
28 | - */ |
|
29 | - static public function getInstance() |
|
30 | - { |
|
31 | - return GeneralUtility::makeInstance(\Fab\Media\Utility\SessionUtility::class); |
|
32 | - } |
|
24 | + /** |
|
25 | + * Returns a class instance. |
|
26 | + * |
|
27 | + * @return \Fab\Media\Utility\SessionUtility|object |
|
28 | + */ |
|
29 | + static public function getInstance() |
|
30 | + { |
|
31 | + return GeneralUtility::makeInstance(\Fab\Media\Utility\SessionUtility::class); |
|
32 | + } |
|
33 | 33 | |
34 | - public function __construct() |
|
35 | - { |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | 36 | |
37 | - // Initialize storage from the current |
|
38 | - if (!is_array($this->getBackendUser()->uc['moduleData'][$this->moduleKey])) { |
|
39 | - $this->getBackendUser()->uc['moduleData'][$this->moduleKey] = []; |
|
40 | - $this->getBackendUser()->writeUC(); |
|
41 | - } |
|
42 | - } |
|
37 | + // Initialize storage from the current |
|
38 | + if (!is_array($this->getBackendUser()->uc['moduleData'][$this->moduleKey])) { |
|
39 | + $this->getBackendUser()->uc['moduleData'][$this->moduleKey] = []; |
|
40 | + $this->getBackendUser()->writeUC(); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Return a value from the Session according to the key |
|
46 | - * |
|
47 | - * @param string $key |
|
48 | - * @return mixed |
|
49 | - */ |
|
50 | - public function get($key) |
|
51 | - { |
|
52 | - return $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key]; |
|
53 | - } |
|
44 | + /** |
|
45 | + * Return a value from the Session according to the key |
|
46 | + * |
|
47 | + * @param string $key |
|
48 | + * @return mixed |
|
49 | + */ |
|
50 | + public function get($key) |
|
51 | + { |
|
52 | + return $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key]; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Set a key to the Session. |
|
57 | - * |
|
58 | - * @param string $key |
|
59 | - * @param mixed $value |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - public function set($key, $value) |
|
63 | - { |
|
64 | - $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key] = $value; |
|
65 | - $this->getBackendUser()->writeUC(); |
|
66 | - } |
|
55 | + /** |
|
56 | + * Set a key to the Session. |
|
57 | + * |
|
58 | + * @param string $key |
|
59 | + * @param mixed $value |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + public function set($key, $value) |
|
63 | + { |
|
64 | + $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key] = $value; |
|
65 | + $this->getBackendUser()->writeUC(); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Returns an instance of the current Backend User. |
|
70 | - * |
|
71 | - * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
72 | - */ |
|
73 | - protected function getBackendUser() |
|
74 | - { |
|
75 | - return $GLOBALS['BE_USER']; |
|
76 | - } |
|
68 | + /** |
|
69 | + * Returns an instance of the current Backend User. |
|
70 | + * |
|
71 | + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
72 | + */ |
|
73 | + protected function getBackendUser() |
|
74 | + { |
|
75 | + return $GLOBALS['BE_USER']; |
|
76 | + } |
|
77 | 77 | } |
@@ -21,127 +21,127 @@ |
||
21 | 21 | class FileDataHandler extends AbstractDataHandler |
22 | 22 | { |
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 = ResourceFactory::getInstance()->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 = ResourceFactory::getInstance()->getFileObject($content->getUid()); |
|
66 | - |
|
67 | - if ($this->getMediaModule()->hasFolderTree()) { |
|
68 | - |
|
69 | - $targetFolder = $this->getMediaModule()->getCurrentFolder(); |
|
70 | - |
|
71 | - // Move file |
|
72 | - $file->copyTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
73 | - } |
|
74 | - return true; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Process File with action "move". |
|
79 | - * |
|
80 | - * @param Content $content |
|
81 | - * @param string $target |
|
82 | - * @throws \Exception |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function processMove(Content $content, $target) |
|
86 | - { |
|
87 | - $file = ResourceFactory::getInstance()->getFileObject($content->getUid()); |
|
88 | - |
|
89 | - if ($this->getMediaModule()->hasFolderTree()) { |
|
90 | - |
|
91 | - $targetFolder = $this->getMediaModule()->getCurrentFolder(); |
|
92 | - if ($targetFolder->getIdentifier() !== $file->getParentFolder()->getIdentifier()) { |
|
93 | - |
|
94 | - // Move file |
|
95 | - $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
96 | - } |
|
97 | - } else { |
|
98 | - |
|
99 | - // Only process if the storage is different. |
|
100 | - if ((int)$file->getStorage()->getUid() !== (int)$target) { |
|
101 | - |
|
102 | - $targetStorage = ResourceFactory::getInstance()->getStorageObject((int)$target); |
|
103 | - |
|
104 | - // Retrieve target directory in the new storage. The folder will only be returned if the User has the correct permission. |
|
105 | - $targetFolder = $this->getMediaModule()->getDefaultFolderInStorage($targetStorage, $file); |
|
106 | - |
|
107 | - try { |
|
108 | - // Move file |
|
109 | - $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
110 | - } catch (\Exception $e) { |
|
111 | - $this->errorMessages = $e->getMessage(); |
|
112 | - } |
|
113 | - } |
|
114 | - } |
|
115 | - return true; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @return \Fab\Media\Resource\FileReferenceService|object |
|
120 | - */ |
|
121 | - protected function getFileReferenceService() |
|
122 | - { |
|
123 | - return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Process Content with action "localize". |
|
128 | - * |
|
129 | - * @param Content $content |
|
130 | - * @param int $language |
|
131 | - * @throws \Exception |
|
132 | - * @return bool |
|
133 | - */ |
|
134 | - public function processLocalize(Content $content, $language) |
|
135 | - { |
|
136 | - throw new \Exception('Nothing to implement here. Localization is done by the Core DataHandler', 1412760788); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @return MediaModule|object |
|
141 | - */ |
|
142 | - protected function getMediaModule() |
|
143 | - { |
|
144 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::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 = ResourceFactory::getInstance()->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 = ResourceFactory::getInstance()->getFileObject($content->getUid()); |
|
66 | + |
|
67 | + if ($this->getMediaModule()->hasFolderTree()) { |
|
68 | + |
|
69 | + $targetFolder = $this->getMediaModule()->getCurrentFolder(); |
|
70 | + |
|
71 | + // Move file |
|
72 | + $file->copyTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
73 | + } |
|
74 | + return true; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Process File with action "move". |
|
79 | + * |
|
80 | + * @param Content $content |
|
81 | + * @param string $target |
|
82 | + * @throws \Exception |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function processMove(Content $content, $target) |
|
86 | + { |
|
87 | + $file = ResourceFactory::getInstance()->getFileObject($content->getUid()); |
|
88 | + |
|
89 | + if ($this->getMediaModule()->hasFolderTree()) { |
|
90 | + |
|
91 | + $targetFolder = $this->getMediaModule()->getCurrentFolder(); |
|
92 | + if ($targetFolder->getIdentifier() !== $file->getParentFolder()->getIdentifier()) { |
|
93 | + |
|
94 | + // Move file |
|
95 | + $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
96 | + } |
|
97 | + } else { |
|
98 | + |
|
99 | + // Only process if the storage is different. |
|
100 | + if ((int)$file->getStorage()->getUid() !== (int)$target) { |
|
101 | + |
|
102 | + $targetStorage = ResourceFactory::getInstance()->getStorageObject((int)$target); |
|
103 | + |
|
104 | + // Retrieve target directory in the new storage. The folder will only be returned if the User has the correct permission. |
|
105 | + $targetFolder = $this->getMediaModule()->getDefaultFolderInStorage($targetStorage, $file); |
|
106 | + |
|
107 | + try { |
|
108 | + // Move file |
|
109 | + $file->moveTo($targetFolder, $file->getName(), DuplicationBehavior::RENAME); |
|
110 | + } catch (\Exception $e) { |
|
111 | + $this->errorMessages = $e->getMessage(); |
|
112 | + } |
|
113 | + } |
|
114 | + } |
|
115 | + return true; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @return \Fab\Media\Resource\FileReferenceService|object |
|
120 | + */ |
|
121 | + protected function getFileReferenceService() |
|
122 | + { |
|
123 | + return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Process Content with action "localize". |
|
128 | + * |
|
129 | + * @param Content $content |
|
130 | + * @param int $language |
|
131 | + * @throws \Exception |
|
132 | + * @return bool |
|
133 | + */ |
|
134 | + public function processLocalize(Content $content, $language) |
|
135 | + { |
|
136 | + throw new \Exception('Nothing to implement here. Localization is done by the Core DataHandler', 1412760788); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @return MediaModule|object |
|
141 | + */ |
|
142 | + protected function getMediaModule() |
|
143 | + { |
|
144 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
@@ -19,36 +19,36 @@ |
||
19 | 19 | class ExistsViewHelper extends AbstractViewHelper |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - } |
|
29 | - |
|
30 | - /** |
|
31 | - * Returns a property value of a file given by the context. |
|
32 | - * |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function render() |
|
36 | - { |
|
37 | - /** @var File|Content|int $file $file */ |
|
38 | - $file = $this->arguments['file']; |
|
39 | - |
|
40 | - if (!$file instanceof File) { |
|
41 | - $file = $this->getFileConverter()->convert($file); |
|
42 | - } |
|
43 | - |
|
44 | - return $file->exists(); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
49 | - */ |
|
50 | - protected function getFileConverter() |
|
51 | - { |
|
52 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
53 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + } |
|
29 | + |
|
30 | + /** |
|
31 | + * Returns a property value of a file given by the context. |
|
32 | + * |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function render() |
|
36 | + { |
|
37 | + /** @var File|Content|int $file $file */ |
|
38 | + $file = $this->arguments['file']; |
|
39 | + |
|
40 | + if (!$file instanceof File) { |
|
41 | + $file = $this->getFileConverter()->convert($file); |
|
42 | + } |
|
43 | + |
|
44 | + return $file->exists(); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
49 | + */ |
|
50 | + protected function getFileConverter() |
|
51 | + { |
|
52 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
53 | + } |
|
54 | 54 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | class PropertyViewHelper extends AbstractViewHelper |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('name', 'string', '', true); |
|
26 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('name', 'string', '', true); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Returns a property value of a file given by the context. |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function render() |
|
34 | - { |
|
35 | - $name = $this->arguments['name']; |
|
28 | + /** |
|
29 | + * Returns a property value of a file given by the context. |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function render() |
|
34 | + { |
|
35 | + $name = $this->arguments['name']; |
|
36 | 36 | |
37 | - /** @var File $file */ |
|
38 | - $file = $this->templateVariableContainer->get('file'); |
|
39 | - return $file->getProperty($name); |
|
40 | - } |
|
37 | + /** @var File $file */ |
|
38 | + $file = $this->templateVariableContainer->get('file'); |
|
39 | + return $file->getProperty($name); |
|
40 | + } |
|
41 | 41 | } |
@@ -21,65 +21,65 @@ |
||
21 | 21 | class ThumbnailViewHelper extends AbstractViewHelper |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function initializeArguments() |
|
28 | - { |
|
29 | - $this->registerArgument('file', 'mixed', 'The source file', false, null); |
|
30 | - $this->registerArgument('configuration', 'array', 'Configuration to be given for the thumbnail processing.', false, []); |
|
31 | - $this->registerArgument('attributes', 'array', 'DOM attributes to add to the thumbnail image', false, ''); |
|
32 | - $this->registerArgument('preset', 'string', 'Image dimension preset', false, ''); |
|
33 | - $this->registerArgument('output', 'string', 'Can be: uri, image, imageWrapped', false, 'image'); |
|
34 | - $this->registerArgument('configurationWrap', 'array', 'The configuration given to the wrap.', false, ''); |
|
35 | - } |
|
24 | + /** |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function initializeArguments() |
|
28 | + { |
|
29 | + $this->registerArgument('file', 'mixed', 'The source file', false, null); |
|
30 | + $this->registerArgument('configuration', 'array', 'Configuration to be given for the thumbnail processing.', false, []); |
|
31 | + $this->registerArgument('attributes', 'array', 'DOM attributes to add to the thumbnail image', false, ''); |
|
32 | + $this->registerArgument('preset', 'string', 'Image dimension preset', false, ''); |
|
33 | + $this->registerArgument('output', 'string', 'Can be: uri, image, imageWrapped', false, 'image'); |
|
34 | + $this->registerArgument('configurationWrap', 'array', 'The configuration given to the wrap.', false, ''); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Returns a configurable thumbnail of an asset |
|
39 | - * |
|
40 | - * @throws \Exception |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function render() |
|
44 | - { |
|
37 | + /** |
|
38 | + * Returns a configurable thumbnail of an asset |
|
39 | + * |
|
40 | + * @throws \Exception |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function render() |
|
44 | + { |
|
45 | 45 | |
46 | - $file = $this->arguments['file']; |
|
47 | - $preset = $this->arguments['preset']; |
|
48 | - $configuration = $this->arguments['configuration']; |
|
49 | - if (!is_array($configuration)) { |
|
50 | - $configuration = array(); |
|
51 | - } |
|
52 | - $configurationWrap = $this->arguments['configurationWrap']; |
|
53 | - $attributes = $this->arguments['attributes']; |
|
54 | - $output = $this->arguments['output']; |
|
46 | + $file = $this->arguments['file']; |
|
47 | + $preset = $this->arguments['preset']; |
|
48 | + $configuration = $this->arguments['configuration']; |
|
49 | + if (!is_array($configuration)) { |
|
50 | + $configuration = array(); |
|
51 | + } |
|
52 | + $configurationWrap = $this->arguments['configurationWrap']; |
|
53 | + $attributes = $this->arguments['attributes']; |
|
54 | + $output = $this->arguments['output']; |
|
55 | 55 | |
56 | - if ($file instanceof Content) { |
|
57 | - $file = $this->getFileConverter()->convert($file); |
|
58 | - } elseif (!($file instanceof File)) { |
|
59 | - $file = ResourceFactory::getInstance()->getFileObject((int)$file); |
|
60 | - } |
|
61 | - if ($preset) { |
|
62 | - $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
63 | - $configuration['width'] = $imageDimension->getWidth(); |
|
64 | - $configuration['height'] = $imageDimension->getHeight(); |
|
65 | - } |
|
66 | - /** @var $thumbnailService \Fab\Media\Thumbnail\ThumbnailService */ |
|
67 | - $thumbnailService = GeneralUtility::makeInstance(\Fab\Media\Thumbnail\ThumbnailService::class, $file); |
|
68 | - $thumbnail = $thumbnailService->setConfiguration($configuration) |
|
69 | - ->setConfigurationWrap($configurationWrap) |
|
70 | - ->setAttributes($attributes) |
|
71 | - ->setOutputType($output) |
|
72 | - ->create(); |
|
56 | + if ($file instanceof Content) { |
|
57 | + $file = $this->getFileConverter()->convert($file); |
|
58 | + } elseif (!($file instanceof File)) { |
|
59 | + $file = ResourceFactory::getInstance()->getFileObject((int)$file); |
|
60 | + } |
|
61 | + if ($preset) { |
|
62 | + $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
63 | + $configuration['width'] = $imageDimension->getWidth(); |
|
64 | + $configuration['height'] = $imageDimension->getHeight(); |
|
65 | + } |
|
66 | + /** @var $thumbnailService \Fab\Media\Thumbnail\ThumbnailService */ |
|
67 | + $thumbnailService = GeneralUtility::makeInstance(\Fab\Media\Thumbnail\ThumbnailService::class, $file); |
|
68 | + $thumbnail = $thumbnailService->setConfiguration($configuration) |
|
69 | + ->setConfigurationWrap($configurationWrap) |
|
70 | + ->setAttributes($attributes) |
|
71 | + ->setOutputType($output) |
|
72 | + ->create(); |
|
73 | 73 | |
74 | - return $thumbnail; |
|
75 | - } |
|
74 | + return $thumbnail; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
79 | - */ |
|
80 | - protected function getFileConverter() |
|
81 | - { |
|
82 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
83 | - } |
|
77 | + /** |
|
78 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
79 | + */ |
|
80 | + protected function getFileConverter() |
|
81 | + { |
|
82 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
@@ -19,37 +19,37 @@ |
||
19 | 19 | class UriViewHelper extends AbstractViewHelper |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Returns a property value of a file given by the context. |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - /** @var File|Content|int $file $file */ |
|
39 | - $file = $this->arguments['file']; |
|
40 | - $relative = $this->arguments['relative']; |
|
31 | + /** |
|
32 | + * Returns a property value of a file given by the context. |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + /** @var File|Content|int $file $file */ |
|
39 | + $file = $this->arguments['file']; |
|
40 | + $relative = $this->arguments['relative']; |
|
41 | 41 | |
42 | - if (!$file instanceof File) { |
|
43 | - $file = $this->getFileConverter()->convert($file); |
|
44 | - } |
|
45 | - return $file->getPublicUrl($relative); |
|
46 | - } |
|
42 | + if (!$file instanceof File) { |
|
43 | + $file = $this->getFileConverter()->convert($file); |
|
44 | + } |
|
45 | + return $file->getPublicUrl($relative); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
50 | - */ |
|
51 | - protected function getFileConverter() |
|
52 | - { |
|
53 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
50 | + */ |
|
51 | + protected function getFileConverter() |
|
52 | + { |
|
53 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
54 | + } |
|
55 | 55 | } |
@@ -20,50 +20,50 @@ |
||
20 | 20 | class StorageViewHelper extends AbstractViewHelper |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function initializeArguments() |
|
27 | - { |
|
28 | - $this->registerArgument('objects', 'array', '', false, []); |
|
29 | - } |
|
23 | + /** |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function initializeArguments() |
|
27 | + { |
|
28 | + $this->registerArgument('objects', 'array', '', false, []); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Render a file upload field |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - $objects = $this->arguments['objects']; |
|
31 | + /** |
|
32 | + * Render a file upload field |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + $objects = $this->arguments['objects']; |
|
39 | 39 | |
40 | - // Check if a storages is selected |
|
41 | - $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
40 | + // Check if a storages is selected |
|
41 | + $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
42 | 42 | |
43 | - $template = '<select name="%s[target]">%s</select>'; |
|
44 | - $options = []; |
|
45 | - foreach ($objects as $storage) { |
|
43 | + $template = '<select name="%s[target]">%s</select>'; |
|
44 | + $options = []; |
|
45 | + foreach ($objects as $storage) { |
|
46 | 46 | |
47 | - /** @var \TYPO3\CMS\Core\Resource\ResourceStorage $storage */ |
|
48 | - $options[] = sprintf('<option value="%s" %s>%s %s</option>', |
|
49 | - $storage->getUid(), |
|
50 | - is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | - $storage->getName(), |
|
52 | - !$storage->isOnline() ? '(offline)' : '' |
|
53 | - ); |
|
54 | - } |
|
55 | - return sprintf($template, |
|
56 | - VidiModule::getParameterPrefix(), |
|
57 | - implode("\n", $options) |
|
58 | - ); |
|
59 | - } |
|
47 | + /** @var \TYPO3\CMS\Core\Resource\ResourceStorage $storage */ |
|
48 | + $options[] = sprintf('<option value="%s" %s>%s %s</option>', |
|
49 | + $storage->getUid(), |
|
50 | + is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | + $storage->getName(), |
|
52 | + !$storage->isOnline() ? '(offline)' : '' |
|
53 | + ); |
|
54 | + } |
|
55 | + return sprintf($template, |
|
56 | + VidiModule::getParameterPrefix(), |
|
57 | + implode("\n", $options) |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return MediaModule|object |
|
63 | - */ |
|
64 | - protected function getMediaModule() |
|
65 | - { |
|
66 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return MediaModule|object |
|
63 | + */ |
|
64 | + protected function getMediaModule() |
|
65 | + { |
|
66 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
@@ -17,31 +17,31 @@ |
||
17 | 17 | class ImageDimensionViewHelper extends AbstractViewHelper |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('preset', 'string', '', true); |
|
26 | - $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('preset', 'string', '', true); |
|
26 | + $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Returns preset values related to an image dimension |
|
31 | - * |
|
32 | - * @return int |
|
33 | - */ |
|
34 | - public function render() |
|
35 | - { |
|
36 | - $preset = $this->arguments['preset']; |
|
37 | - $dimension = $this->arguments['dimension']; |
|
29 | + /** |
|
30 | + * Returns preset values related to an image dimension |
|
31 | + * |
|
32 | + * @return int |
|
33 | + */ |
|
34 | + public function render() |
|
35 | + { |
|
36 | + $preset = $this->arguments['preset']; |
|
37 | + $dimension = $this->arguments['dimension']; |
|
38 | 38 | |
39 | - $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | - if ($dimension === 'width') { |
|
41 | - $result = $imageDimension->getWidth(); |
|
42 | - } else { |
|
43 | - $result = $imageDimension->getHeight(); |
|
44 | - } |
|
45 | - return $result; |
|
46 | - } |
|
39 | + $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | + if ($dimension === 'width') { |
|
41 | + $result = $imageDimension->getWidth(); |
|
42 | + } else { |
|
43 | + $result = $imageDimension->getHeight(); |
|
44 | + } |
|
45 | + return $result; |
|
46 | + } |
|
47 | 47 | } |
@@ -16,33 +16,33 @@ |
||
16 | 16 | class VidiModule |
17 | 17 | { |
18 | 18 | |
19 | - const SIGNATURE = 'file_VidiSysFileM1'; |
|
20 | - const PARAMETER_PREFIX = 'tx_vidi_file_vidisysfilem1'; |
|
21 | - |
|
22 | - const SIGNATURE_FOLDER_TREE_OMITTED = 'content_VidiSysFileM1'; |
|
23 | - const PARAMETER_PREFIX_FOLDER_TREE_OMITTED = 'tx_vidi_content_vidisysfilem1'; |
|
24 | - |
|
25 | - /** |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - static public function getSignature() |
|
29 | - { |
|
30 | - return self::getMediaModule()->hasFolderTree() ? self::SIGNATURE : self::SIGNATURE_FOLDER_TREE_OMITTED; |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - static public function getParameterPrefix() |
|
37 | - { |
|
38 | - return self::getMediaModule()->hasFolderTree() ? self::PARAMETER_PREFIX : self::PARAMETER_PREFIX_FOLDER_TREE_OMITTED; |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @return MediaModule|object |
|
43 | - */ |
|
44 | - static protected function getMediaModule() |
|
45 | - { |
|
46 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
47 | - } |
|
19 | + const SIGNATURE = 'file_VidiSysFileM1'; |
|
20 | + const PARAMETER_PREFIX = 'tx_vidi_file_vidisysfilem1'; |
|
21 | + |
|
22 | + const SIGNATURE_FOLDER_TREE_OMITTED = 'content_VidiSysFileM1'; |
|
23 | + const PARAMETER_PREFIX_FOLDER_TREE_OMITTED = 'tx_vidi_content_vidisysfilem1'; |
|
24 | + |
|
25 | + /** |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + static public function getSignature() |
|
29 | + { |
|
30 | + return self::getMediaModule()->hasFolderTree() ? self::SIGNATURE : self::SIGNATURE_FOLDER_TREE_OMITTED; |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + static public function getParameterPrefix() |
|
37 | + { |
|
38 | + return self::getMediaModule()->hasFolderTree() ? self::PARAMETER_PREFIX : self::PARAMETER_PREFIX_FOLDER_TREE_OMITTED; |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @return MediaModule|object |
|
43 | + */ |
|
44 | + static protected function getMediaModule() |
|
45 | + { |
|
46 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | \ No newline at end of file |