@@ -21,101 +21,101 @@ |
||
21 | 21 | class NewFolder extends AbstractComponentView |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Renders a button to create a new folder. |
|
26 | - * |
|
27 | - * @param Content $object |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function render($object = null) |
|
31 | - { |
|
32 | - $output = ''; |
|
33 | - if ($this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin()) { |
|
34 | - |
|
35 | - $button = $this->makeLinkButton() |
|
36 | - ->setHref($this->getNewFolderUri()) |
|
37 | - ->setTitle($this->getLabel()) |
|
38 | - ->setIcon($this->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)) |
|
39 | - ->render(); |
|
40 | - |
|
41 | - $output = '<div style="float: left;">' . $button . '</div>'; |
|
42 | - } |
|
43 | - return $output; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - protected function getLabel() |
|
50 | - { |
|
51 | - return $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new'); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - protected function getNewFolderUri() |
|
58 | - { |
|
59 | - return BackendUtility::getModuleUrl( |
|
60 | - 'file_newfolder', |
|
61 | - array( |
|
62 | - 'target' => $this->getCombineIdentifier(), |
|
63 | - 'returnUrl' => $this->getReturnUrl(), |
|
64 | - ) |
|
65 | - ); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - protected function getCombineIdentifier() |
|
73 | - { |
|
74 | - $folder = $this->getMediaModule()->getCurrentFolder(); |
|
75 | - return $folder->getCombinedIdentifier(); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * @return string |
|
80 | - */ |
|
81 | - protected function getReturnUrl() |
|
82 | - { |
|
83 | - $returnUrl = BackendUtility::getModuleUrl( |
|
84 | - GeneralUtility::_GP('route'), |
|
85 | - $this->getAdditionalParameters() |
|
86 | - ); |
|
87 | - return $returnUrl; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - protected function getAdditionalParameters() |
|
94 | - { |
|
95 | - |
|
96 | - $additionalParameters = []; |
|
97 | - if (GeneralUtility::_GP('id')) { |
|
98 | - $additionalParameters = [ |
|
99 | - 'id' => urldecode(GeneralUtility::_GP('id')), |
|
100 | - ]; |
|
101 | - } |
|
102 | - return $additionalParameters; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * @return MediaModule|object |
|
107 | - */ |
|
108 | - protected function getMediaModule() |
|
109 | - { |
|
110 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * @return \TYPO3\CMS\Lang\LanguageService |
|
115 | - */ |
|
116 | - protected function getLanguageService() |
|
117 | - { |
|
118 | - return $GLOBALS['LANG']; |
|
119 | - } |
|
24 | + /** |
|
25 | + * Renders a button to create a new folder. |
|
26 | + * |
|
27 | + * @param Content $object |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function render($object = null) |
|
31 | + { |
|
32 | + $output = ''; |
|
33 | + if ($this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin()) { |
|
34 | + |
|
35 | + $button = $this->makeLinkButton() |
|
36 | + ->setHref($this->getNewFolderUri()) |
|
37 | + ->setTitle($this->getLabel()) |
|
38 | + ->setIcon($this->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)) |
|
39 | + ->render(); |
|
40 | + |
|
41 | + $output = '<div style="float: left;">' . $button . '</div>'; |
|
42 | + } |
|
43 | + return $output; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + protected function getLabel() |
|
50 | + { |
|
51 | + return $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new'); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + protected function getNewFolderUri() |
|
58 | + { |
|
59 | + return BackendUtility::getModuleUrl( |
|
60 | + 'file_newfolder', |
|
61 | + array( |
|
62 | + 'target' => $this->getCombineIdentifier(), |
|
63 | + 'returnUrl' => $this->getReturnUrl(), |
|
64 | + ) |
|
65 | + ); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + protected function getCombineIdentifier() |
|
73 | + { |
|
74 | + $folder = $this->getMediaModule()->getCurrentFolder(); |
|
75 | + return $folder->getCombinedIdentifier(); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * @return string |
|
80 | + */ |
|
81 | + protected function getReturnUrl() |
|
82 | + { |
|
83 | + $returnUrl = BackendUtility::getModuleUrl( |
|
84 | + GeneralUtility::_GP('route'), |
|
85 | + $this->getAdditionalParameters() |
|
86 | + ); |
|
87 | + return $returnUrl; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + protected function getAdditionalParameters() |
|
94 | + { |
|
95 | + |
|
96 | + $additionalParameters = []; |
|
97 | + if (GeneralUtility::_GP('id')) { |
|
98 | + $additionalParameters = [ |
|
99 | + 'id' => urldecode(GeneralUtility::_GP('id')), |
|
100 | + ]; |
|
101 | + } |
|
102 | + return $additionalParameters; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * @return MediaModule|object |
|
107 | + */ |
|
108 | + protected function getMediaModule() |
|
109 | + { |
|
110 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * @return \TYPO3\CMS\Lang\LanguageService |
|
115 | + */ |
|
116 | + protected function getLanguageService() |
|
117 | + { |
|
118 | + return $GLOBALS['LANG']; |
|
119 | + } |
|
120 | 120 | |
121 | 121 | } |
@@ -19,75 +19,75 @@ |
||
19 | 19 | class DeleteButton extends AbstractComponentView |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Renders a "delete" button to be placed in the grid. |
|
24 | - * |
|
25 | - * @param \Fab\Vidi\Domain\Model\Content $object |
|
26 | - * @return string |
|
27 | - * @throws \RuntimeException |
|
28 | - * @throws \InvalidArgumentException |
|
29 | - */ |
|
30 | - public function render(Content $object = null) |
|
31 | - { |
|
22 | + /** |
|
23 | + * Renders a "delete" button to be placed in the grid. |
|
24 | + * |
|
25 | + * @param \Fab\Vidi\Domain\Model\Content $object |
|
26 | + * @return string |
|
27 | + * @throws \RuntimeException |
|
28 | + * @throws \InvalidArgumentException |
|
29 | + */ |
|
30 | + public function render(Content $object = null) |
|
31 | + { |
|
32 | 32 | |
33 | - $button = ''; |
|
34 | - $file = $this->getFileConverter()->convert($object); |
|
33 | + $button = ''; |
|
34 | + $file = $this->getFileConverter()->convert($object); |
|
35 | 35 | |
36 | - // Only display the delete icon if the file has no reference. |
|
37 | - if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) { |
|
36 | + // Only display the delete icon if the file has no reference. |
|
37 | + if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) { |
|
38 | 38 | |
39 | - $button = $this->makeLinkButton() |
|
40 | - ->setHref($this->getDeleteUri($object)) |
|
41 | - ->setDataAttributes([ |
|
42 | - 'uid' => $object->getUid(), |
|
43 | - 'toggle' => 'tooltip', |
|
44 | - 'label' => $file->getProperty('title'), |
|
45 | - ]) |
|
46 | - ->setClasses('btn-delete') |
|
47 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete')) |
|
48 | - ->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)) |
|
49 | - ->render(); |
|
50 | - } |
|
39 | + $button = $this->makeLinkButton() |
|
40 | + ->setHref($this->getDeleteUri($object)) |
|
41 | + ->setDataAttributes([ |
|
42 | + 'uid' => $object->getUid(), |
|
43 | + 'toggle' => 'tooltip', |
|
44 | + 'label' => $file->getProperty('title'), |
|
45 | + ]) |
|
46 | + ->setClasses('btn-delete') |
|
47 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete')) |
|
48 | + ->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)) |
|
49 | + ->render(); |
|
50 | + } |
|
51 | 51 | |
52 | - return $button; |
|
53 | - } |
|
52 | + return $button; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param Content $object |
|
57 | - * @return string |
|
58 | - * @throws \InvalidArgumentException |
|
59 | - */ |
|
60 | - protected function getDeleteUri(Content $object) |
|
61 | - { |
|
62 | - $additionalParameters = array( |
|
63 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
64 | - 'controller' => 'Content', |
|
65 | - 'action' => 'delete', |
|
66 | - 'format' => 'json', |
|
67 | - 'matches' => array( |
|
68 | - 'uid' => $object->getUid(), |
|
69 | - ), |
|
70 | - ), |
|
71 | - ); |
|
72 | - return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
73 | - } |
|
55 | + /** |
|
56 | + * @param Content $object |
|
57 | + * @return string |
|
58 | + * @throws \InvalidArgumentException |
|
59 | + */ |
|
60 | + protected function getDeleteUri(Content $object) |
|
61 | + { |
|
62 | + $additionalParameters = array( |
|
63 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
64 | + 'controller' => 'Content', |
|
65 | + 'action' => 'delete', |
|
66 | + 'format' => 'json', |
|
67 | + 'matches' => array( |
|
68 | + 'uid' => $object->getUid(), |
|
69 | + ), |
|
70 | + ), |
|
71 | + ); |
|
72 | + return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @return \Fab\Media\Resource\FileReferenceService|object |
|
77 | - * @throws \InvalidArgumentException |
|
78 | - */ |
|
79 | - protected function getFileReferenceService() |
|
80 | - { |
|
81 | - return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
82 | - } |
|
75 | + /** |
|
76 | + * @return \Fab\Media\Resource\FileReferenceService|object |
|
77 | + * @throws \InvalidArgumentException |
|
78 | + */ |
|
79 | + protected function getFileReferenceService() |
|
80 | + { |
|
81 | + return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
86 | - * @throws \InvalidArgumentException |
|
87 | - */ |
|
88 | - protected function getFileConverter() |
|
89 | - { |
|
90 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
91 | - } |
|
84 | + /** |
|
85 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
86 | + * @throws \InvalidArgumentException |
|
87 | + */ |
|
88 | + protected function getFileConverter() |
|
89 | + { |
|
90 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -18,16 +18,16 @@ |
||
18 | 18 | class UploadButton extends AbstractComponentView |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Renders a button for uploading assets. |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function render() |
|
27 | - { |
|
21 | + /** |
|
22 | + * Renders a button for uploading assets. |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function render() |
|
27 | + { |
|
28 | 28 | |
29 | - /** @var $fileUpload \Fab\Media\Form\FileUpload */ |
|
30 | - $fileUpload = GeneralUtility::makeInstance(\Fab\Media\Form\FileUpload::class); |
|
31 | - return $fileUpload->setPrefix(MediaModule::getParameterPrefix())->render(); |
|
32 | - } |
|
29 | + /** @var $fileUpload \Fab\Media\Form\FileUpload */ |
|
30 | + $fileUpload = GeneralUtility::makeInstance(\Fab\Media\Form\FileUpload::class); |
|
31 | + return $fileUpload->setPrefix(MediaModule::getParameterPrefix())->render(); |
|
32 | + } |
|
33 | 33 | } |
@@ -16,28 +16,28 @@ |
||
16 | 16 | class ClientValidation implements SingletonInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * Returns a class instance |
|
21 | - * |
|
22 | - * @return \Fab\Media\Utility\ClientValidation|object |
|
23 | - */ |
|
24 | - static public function getInstance() |
|
25 | - { |
|
26 | - return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class); |
|
27 | - } |
|
19 | + /** |
|
20 | + * Returns a class instance |
|
21 | + * |
|
22 | + * @return \Fab\Media\Utility\ClientValidation|object |
|
23 | + */ |
|
24 | + static public function getInstance() |
|
25 | + { |
|
26 | + return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get the validation class name given a field. |
|
31 | - * |
|
32 | - * @param string $fieldName |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function get($fieldName) |
|
36 | - { |
|
37 | - $result = ''; |
|
38 | - if (\Fab\Media\Utility\TcaField::getService()->isRequired($fieldName)) { |
|
39 | - $result = ' validate[required]'; |
|
40 | - } |
|
41 | - return $result; |
|
42 | - } |
|
29 | + /** |
|
30 | + * Get the validation class name given a field. |
|
31 | + * |
|
32 | + * @param string $fieldName |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function get($fieldName) |
|
36 | + { |
|
37 | + $result = ''; |
|
38 | + if (\Fab\Media\Utility\TcaField::getService()->isRequired($fieldName)) { |
|
39 | + $result = ' validate[required]'; |
|
40 | + } |
|
41 | + return $result; |
|
42 | + } |
|
43 | 43 | } |
@@ -16,18 +16,18 @@ |
||
16 | 16 | class Logger implements SingletonInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * Returns a logger class instance. |
|
21 | - * |
|
22 | - * @param mixed $instance |
|
23 | - * @return \TYPO3\CMS\Core\Log\Logger |
|
24 | - */ |
|
25 | - static public function getInstance($instance) |
|
26 | - { |
|
27 | - /** @var $loggerManager \TYPO3\CMS\Core\Log\LogManager */ |
|
28 | - $loggerManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class); |
|
19 | + /** |
|
20 | + * Returns a logger class instance. |
|
21 | + * |
|
22 | + * @param mixed $instance |
|
23 | + * @return \TYPO3\CMS\Core\Log\Logger |
|
24 | + */ |
|
25 | + static public function getInstance($instance) |
|
26 | + { |
|
27 | + /** @var $loggerManager \TYPO3\CMS\Core\Log\LogManager */ |
|
28 | + $loggerManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class); |
|
29 | 29 | |
30 | - /** @var $logger \TYPO3\CMS\Core\Log\Logger */ |
|
31 | - return $loggerManager->getLogger(get_class($instance)); |
|
32 | - } |
|
30 | + /** @var $logger \TYPO3\CMS\Core\Log\Logger */ |
|
31 | + return $loggerManager->getLogger(get_class($instance)); |
|
32 | + } |
|
33 | 33 | } |
@@ -20,72 +20,72 @@ |
||
20 | 20 | class PermissionUtility implements SingletonInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Returns a class instance. |
|
25 | - * |
|
26 | - * @return PermissionUtility |
|
27 | - * @throws \InvalidArgumentException |
|
28 | - */ |
|
29 | - static public function getInstance() |
|
30 | - { |
|
31 | - return GeneralUtility::makeInstance(PermissionUtility::class); |
|
32 | - } |
|
23 | + /** |
|
24 | + * Returns a class instance. |
|
25 | + * |
|
26 | + * @return PermissionUtility |
|
27 | + * @throws \InvalidArgumentException |
|
28 | + */ |
|
29 | + static public function getInstance() |
|
30 | + { |
|
31 | + return GeneralUtility::makeInstance(PermissionUtility::class); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Returns allowed extensions given a possible storage. |
|
36 | - * |
|
37 | - * @param null|int|ResourceStorage $storage |
|
38 | - * @return array |
|
39 | - * @throws \InvalidArgumentException |
|
40 | - */ |
|
41 | - public function getAllowedExtensions($storage = null) |
|
42 | - { |
|
34 | + /** |
|
35 | + * Returns allowed extensions given a possible storage. |
|
36 | + * |
|
37 | + * @param null|int|ResourceStorage $storage |
|
38 | + * @return array |
|
39 | + * @throws \InvalidArgumentException |
|
40 | + */ |
|
41 | + public function getAllowedExtensions($storage = null) |
|
42 | + { |
|
43 | 43 | |
44 | - $fieldNames = array( |
|
45 | - 'extension_allowed_file_type_1', |
|
46 | - 'extension_allowed_file_type_2', |
|
47 | - 'extension_allowed_file_type_3', |
|
48 | - 'extension_allowed_file_type_4', |
|
49 | - 'extension_allowed_file_type_5', |
|
50 | - ); |
|
44 | + $fieldNames = array( |
|
45 | + 'extension_allowed_file_type_1', |
|
46 | + 'extension_allowed_file_type_2', |
|
47 | + 'extension_allowed_file_type_3', |
|
48 | + 'extension_allowed_file_type_4', |
|
49 | + 'extension_allowed_file_type_5', |
|
50 | + ); |
|
51 | 51 | |
52 | - if (!is_null($storage)) { |
|
53 | - if (!$storage instanceof ResourceStorage) { |
|
54 | - $storage = ResourceFactory::getInstance()->getStorageObject((int)$storage); |
|
55 | - } |
|
56 | - } else { |
|
57 | - $storage = $this->getMediaModule()->getCurrentStorage(); |
|
58 | - } |
|
52 | + if (!is_null($storage)) { |
|
53 | + if (!$storage instanceof ResourceStorage) { |
|
54 | + $storage = ResourceFactory::getInstance()->getStorageObject((int)$storage); |
|
55 | + } |
|
56 | + } else { |
|
57 | + $storage = $this->getMediaModule()->getCurrentStorage(); |
|
58 | + } |
|
59 | 59 | |
60 | - $storageRecord = $storage->getStorageRecord(); |
|
61 | - $allowedExtensions = []; |
|
62 | - foreach ($fieldNames as $fieldName) { |
|
63 | - $_allowedExtensions = GeneralUtility::trimExplode(',', $storageRecord[$fieldName], true); |
|
64 | - $allowedExtensions = array_merge($allowedExtensions, $_allowedExtensions); |
|
65 | - } |
|
60 | + $storageRecord = $storage->getStorageRecord(); |
|
61 | + $allowedExtensions = []; |
|
62 | + foreach ($fieldNames as $fieldName) { |
|
63 | + $_allowedExtensions = GeneralUtility::trimExplode(',', $storageRecord[$fieldName], true); |
|
64 | + $allowedExtensions = array_merge($allowedExtensions, $_allowedExtensions); |
|
65 | + } |
|
66 | 66 | |
67 | - $uniqueAllowedExtensions = array_unique($allowedExtensions); |
|
68 | - return array_filter($uniqueAllowedExtensions, 'strlen'); |
|
69 | - } |
|
67 | + $uniqueAllowedExtensions = array_unique($allowedExtensions); |
|
68 | + return array_filter($uniqueAllowedExtensions, 'strlen'); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Returns allowed extensions list. |
|
73 | - * |
|
74 | - * @return string |
|
75 | - * @throws \InvalidArgumentException |
|
76 | - */ |
|
77 | - public function getAllowedExtensionList() |
|
78 | - { |
|
79 | - return implode(',', $this->getAllowedExtensions()); |
|
80 | - } |
|
71 | + /** |
|
72 | + * Returns allowed extensions list. |
|
73 | + * |
|
74 | + * @return string |
|
75 | + * @throws \InvalidArgumentException |
|
76 | + */ |
|
77 | + public function getAllowedExtensionList() |
|
78 | + { |
|
79 | + return implode(',', $this->getAllowedExtensions()); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return MediaModule|object |
|
84 | - * @throws \InvalidArgumentException |
|
85 | - */ |
|
86 | - protected function getMediaModule() |
|
87 | - { |
|
88 | - return GeneralUtility::makeInstance(MediaModule::class); |
|
89 | - } |
|
82 | + /** |
|
83 | + * @return MediaModule|object |
|
84 | + * @throws \InvalidArgumentException |
|
85 | + */ |
|
86 | + protected function getMediaModule() |
|
87 | + { |
|
88 | + return GeneralUtility::makeInstance(MediaModule::class); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
@@ -16,57 +16,57 @@ |
||
16 | 16 | class DomElement implements SingletonInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * Returns a class instance |
|
21 | - * |
|
22 | - * @return \Fab\Media\Utility\DomElement|object |
|
23 | - */ |
|
24 | - static public function getInstance() |
|
25 | - { |
|
26 | - return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\DomElement::class); |
|
27 | - } |
|
19 | + /** |
|
20 | + * Returns a class instance |
|
21 | + * |
|
22 | + * @return \Fab\Media\Utility\DomElement|object |
|
23 | + */ |
|
24 | + static public function getInstance() |
|
25 | + { |
|
26 | + return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\DomElement::class); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Format an id given an input string |
|
31 | - * |
|
32 | - * @param string $input |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function formatId($input) |
|
36 | - { |
|
29 | + /** |
|
30 | + * Format an id given an input string |
|
31 | + * |
|
32 | + * @param string $input |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function formatId($input) |
|
36 | + { |
|
37 | 37 | |
38 | - // remove the capital letter from the id |
|
39 | - $segments = preg_split('/(?=[A-Z])/', $input); |
|
40 | - $segments = array_map('strtolower', $segments); |
|
41 | - if ($segments[0] == '') { |
|
42 | - array_shift($segments); |
|
43 | - } |
|
44 | - $result = implode('-', $segments); |
|
38 | + // remove the capital letter from the id |
|
39 | + $segments = preg_split('/(?=[A-Z])/', $input); |
|
40 | + $segments = array_map('strtolower', $segments); |
|
41 | + if ($segments[0] == '') { |
|
42 | + array_shift($segments); |
|
43 | + } |
|
44 | + $result = implode('-', $segments); |
|
45 | 45 | |
46 | - return $this->sanitizeId($result); |
|
47 | - } |
|
46 | + return $this->sanitizeId($result); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Sanitize an id |
|
51 | - * |
|
52 | - * @param string $input |
|
53 | - * @return mixed |
|
54 | - */ |
|
55 | - protected function sanitizeId($input) |
|
56 | - { |
|
49 | + /** |
|
50 | + * Sanitize an id |
|
51 | + * |
|
52 | + * @param string $input |
|
53 | + * @return mixed |
|
54 | + */ |
|
55 | + protected function sanitizeId($input) |
|
56 | + { |
|
57 | 57 | |
58 | - // remove the track of possible namespace |
|
59 | - $searches[] = ' '; |
|
60 | - $searches[] = '_'; |
|
61 | - $searches[] = '--'; |
|
62 | - $searches[] = '['; |
|
63 | - $searches[] = ']'; |
|
64 | - $replaces[] = '-'; |
|
65 | - $replaces[] = '-'; |
|
66 | - $replaces[] = '-'; |
|
67 | - $replaces[] = '-'; |
|
68 | - $replaces[] = ''; |
|
69 | - return str_replace($searches, $replaces, strtolower($input)); |
|
70 | - } |
|
58 | + // remove the track of possible namespace |
|
59 | + $searches[] = ' '; |
|
60 | + $searches[] = '_'; |
|
61 | + $searches[] = '--'; |
|
62 | + $searches[] = '['; |
|
63 | + $searches[] = ']'; |
|
64 | + $replaces[] = '-'; |
|
65 | + $replaces[] = '-'; |
|
66 | + $replaces[] = '-'; |
|
67 | + $replaces[] = '-'; |
|
68 | + $replaces[] = ''; |
|
69 | + return str_replace($searches, $replaces, strtolower($input)); |
|
70 | + } |
|
71 | 71 | |
72 | 72 | } |
@@ -16,92 +16,92 @@ |
||
16 | 16 | class ImagePresetUtility implements \TYPO3\CMS\Core\SingletonInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $store = []; |
|
19 | + /** |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $store = []; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - protected $currentPreset = ''; |
|
24 | + /** |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + protected $currentPreset = ''; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Returns a class instance |
|
31 | - * |
|
32 | - * @return \Fab\Media\Utility\ImagePresetUtility|object |
|
33 | - */ |
|
34 | - static public function getInstance() |
|
35 | - { |
|
36 | - return GeneralUtility::makeInstance(\Fab\Media\Utility\ImagePresetUtility::class); |
|
37 | - } |
|
29 | + /** |
|
30 | + * Returns a class instance |
|
31 | + * |
|
32 | + * @return \Fab\Media\Utility\ImagePresetUtility|object |
|
33 | + */ |
|
34 | + static public function getInstance() |
|
35 | + { |
|
36 | + return GeneralUtility::makeInstance(\Fab\Media\Utility\ImagePresetUtility::class); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Set the current preset value. Preset values come from the settings and can be: |
|
41 | - * image_thumbnail, image_mini, image_small, image_medium, image_large |
|
42 | - * |
|
43 | - * @throws \Fab\Media\Exception\EmptyValueException |
|
44 | - * @param string $preset image_thumbnail, image_mini, ... |
|
45 | - * @return \Fab\Media\Utility\ImagePresetUtility |
|
46 | - */ |
|
47 | - public function preset($preset) |
|
48 | - { |
|
49 | - $size = ConfigurationUtility::getInstance()->get($preset); |
|
50 | - if (is_null($size)) { |
|
51 | - throw new \Fab\Media\Exception\EmptyValueException('No value for preset: ' . $preset, 1362501066); |
|
52 | - } |
|
39 | + /** |
|
40 | + * Set the current preset value. Preset values come from the settings and can be: |
|
41 | + * image_thumbnail, image_mini, image_small, image_medium, image_large |
|
42 | + * |
|
43 | + * @throws \Fab\Media\Exception\EmptyValueException |
|
44 | + * @param string $preset image_thumbnail, image_mini, ... |
|
45 | + * @return \Fab\Media\Utility\ImagePresetUtility |
|
46 | + */ |
|
47 | + public function preset($preset) |
|
48 | + { |
|
49 | + $size = ConfigurationUtility::getInstance()->get($preset); |
|
50 | + if (is_null($size)) { |
|
51 | + throw new \Fab\Media\Exception\EmptyValueException('No value for preset: ' . $preset, 1362501066); |
|
52 | + } |
|
53 | 53 | |
54 | - $this->currentPreset = $preset; |
|
55 | - if (!isset($this->store[$this->currentPreset])) { |
|
56 | - // @todo use object Dimension instead |
|
57 | - $dimensions = GeneralUtility::trimExplode('x', $size); |
|
58 | - $this->store[$this->currentPreset]['width'] = empty($dimensions[0]) ? 0 : $dimensions[0]; |
|
59 | - $this->store[$this->currentPreset]['height'] = empty($dimensions[1]) ? 0 : $dimensions[1]; |
|
60 | - } |
|
61 | - return $this; |
|
62 | - } |
|
54 | + $this->currentPreset = $preset; |
|
55 | + if (!isset($this->store[$this->currentPreset])) { |
|
56 | + // @todo use object Dimension instead |
|
57 | + $dimensions = GeneralUtility::trimExplode('x', $size); |
|
58 | + $this->store[$this->currentPreset]['width'] = empty($dimensions[0]) ? 0 : $dimensions[0]; |
|
59 | + $this->store[$this->currentPreset]['height'] = empty($dimensions[1]) ? 0 : $dimensions[1]; |
|
60 | + } |
|
61 | + return $this; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - public function getStore() |
|
68 | - { |
|
69 | - return $this->store; |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + public function getStore() |
|
68 | + { |
|
69 | + return $this->store; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param array $store |
|
74 | - */ |
|
75 | - public function setStore($store) |
|
76 | - { |
|
77 | - $this->store = $store; |
|
78 | - } |
|
72 | + /** |
|
73 | + * @param array $store |
|
74 | + */ |
|
75 | + public function setStore($store) |
|
76 | + { |
|
77 | + $this->store = $store; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Returns width of the current preset. |
|
82 | - * |
|
83 | - * @throws \Fab\Media\Exception\InvalidKeyInArrayException |
|
84 | - * @return int |
|
85 | - */ |
|
86 | - public function getWidth() |
|
87 | - { |
|
88 | - if (empty($this->store[$this->currentPreset])) { |
|
89 | - throw new \Fab\Media\Exception\InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853); |
|
90 | - } |
|
91 | - return (int)$this->store[$this->currentPreset]['width']; |
|
92 | - } |
|
80 | + /** |
|
81 | + * Returns width of the current preset. |
|
82 | + * |
|
83 | + * @throws \Fab\Media\Exception\InvalidKeyInArrayException |
|
84 | + * @return int |
|
85 | + */ |
|
86 | + public function getWidth() |
|
87 | + { |
|
88 | + if (empty($this->store[$this->currentPreset])) { |
|
89 | + throw new \Fab\Media\Exception\InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853); |
|
90 | + } |
|
91 | + return (int)$this->store[$this->currentPreset]['width']; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Returns height of the current preset. |
|
96 | - * |
|
97 | - * @throws \Fab\Media\Exception\InvalidKeyInArrayException |
|
98 | - * @return int |
|
99 | - */ |
|
100 | - public function getHeight() |
|
101 | - { |
|
102 | - if (empty($this->store[$this->currentPreset])) { |
|
103 | - throw new \Fab\Media\Exception\InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853); |
|
104 | - } |
|
105 | - return (int)$this->store[$this->currentPreset]['height']; |
|
106 | - } |
|
94 | + /** |
|
95 | + * Returns height of the current preset. |
|
96 | + * |
|
97 | + * @throws \Fab\Media\Exception\InvalidKeyInArrayException |
|
98 | + * @return int |
|
99 | + */ |
|
100 | + public function getHeight() |
|
101 | + { |
|
102 | + if (empty($this->store[$this->currentPreset])) { |
|
103 | + throw new \Fab\Media\Exception\InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853); |
|
104 | + } |
|
105 | + return (int)$this->store[$this->currentPreset]['height']; |
|
106 | + } |
|
107 | 107 | } |
@@ -18,75 +18,75 @@ |
||
18 | 18 | class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $extensionKey = 'media'; |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $extensionKey = 'media'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $configuration = []; |
|
26 | + /** |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $configuration = []; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Returns a class instance. |
|
33 | - * |
|
34 | - * @return \Fab\Media\Utility\ConfigurationUtility|object |
|
35 | - */ |
|
36 | - static public function getInstance() |
|
37 | - { |
|
38 | - return GeneralUtility::makeInstance(\Fab\Media\Utility\ConfigurationUtility::class); |
|
39 | - } |
|
31 | + /** |
|
32 | + * Returns a class instance. |
|
33 | + * |
|
34 | + * @return \Fab\Media\Utility\ConfigurationUtility|object |
|
35 | + */ |
|
36 | + static public function getInstance() |
|
37 | + { |
|
38 | + return GeneralUtility::makeInstance(\Fab\Media\Utility\ConfigurationUtility::class); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor |
|
43 | - */ |
|
44 | - public function __construct() |
|
45 | - { |
|
46 | - $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('media'); |
|
41 | + /** |
|
42 | + * Constructor |
|
43 | + */ |
|
44 | + public function __construct() |
|
45 | + { |
|
46 | + $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('media'); |
|
47 | 47 | |
48 | - // Fill up configuration array with relevant values. |
|
49 | - foreach ($configuration as $key => $value) { |
|
50 | - $this->configuration[$key] = $value; |
|
51 | - } |
|
52 | - } |
|
48 | + // Fill up configuration array with relevant values. |
|
49 | + foreach ($configuration as $key => $value) { |
|
50 | + $this->configuration[$key] = $value; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @return ObjectManager|object |
|
56 | - */ |
|
57 | - protected function getObjectManager() |
|
58 | - { |
|
59 | - return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
60 | - } |
|
54 | + /** |
|
55 | + * @return ObjectManager|object |
|
56 | + */ |
|
57 | + protected function getObjectManager() |
|
58 | + { |
|
59 | + return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Returns a setting key. |
|
64 | - * |
|
65 | - * @param string $key |
|
66 | - * @return array |
|
67 | - */ |
|
68 | - public function get($key) |
|
69 | - { |
|
70 | - return isset($this->configuration[$key]) ? trim($this->configuration[$key]) : null; |
|
71 | - } |
|
62 | + /** |
|
63 | + * Returns a setting key. |
|
64 | + * |
|
65 | + * @param string $key |
|
66 | + * @return array |
|
67 | + */ |
|
68 | + public function get($key) |
|
69 | + { |
|
70 | + return isset($this->configuration[$key]) ? trim($this->configuration[$key]) : null; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Set a setting key. |
|
75 | - * |
|
76 | - * @param string $key |
|
77 | - * @param mixed $value |
|
78 | - * @return void |
|
79 | - */ |
|
80 | - public function set($key, $value) |
|
81 | - { |
|
82 | - $this->configuration[$key] = $value; |
|
83 | - } |
|
73 | + /** |
|
74 | + * Set a setting key. |
|
75 | + * |
|
76 | + * @param string $key |
|
77 | + * @param mixed $value |
|
78 | + * @return void |
|
79 | + */ |
|
80 | + public function set($key, $value) |
|
81 | + { |
|
82 | + $this->configuration[$key] = $value; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return array |
|
87 | - */ |
|
88 | - public function getConfiguration() |
|
89 | - { |
|
90 | - return $this->configuration; |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return array |
|
87 | + */ |
|
88 | + public function getConfiguration() |
|
89 | + { |
|
90 | + return $this->configuration; |
|
91 | + } |
|
92 | 92 | } |