@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | use Fab\Media\Tests\Functional\AbstractFunctionalTestCase; |
18 | 18 | |
19 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
19 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Test case for class \Fab\Media\Utility\Configuration. |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | use Fab\Media\Tests\Functional\AbstractFunctionalTestCase; |
18 | 18 | |
19 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
19 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
20 | 20 | |
21 | 21 | |
22 | 22 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $preset = 'image_large'; |
129 | 129 | $actualWidth = rand(10, 100); |
130 | 130 | $actualHeight = rand(10, 100); |
131 | - \Fab\Media\Utility\ConfigurationUtility::getInstance()->set('image_large', $actualWidth . 'x' . $actualHeight); |
|
131 | + \Fab\Media\Utility\ConfigurationUtility::getInstance()->set('image_large', $actualWidth.'x'.$actualHeight); |
|
132 | 132 | $this->assertSame($actualWidth, $this->fixture->preset($preset)->getWidth()); |
133 | 133 | $this->assertSame($actualHeight, $this->fixture->preset($preset)->getHeight()); |
134 | 134 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function setUp() { |
38 | 38 | $this->fixture = new \Fab\Media\FileUpload\UploadManager(); |
39 | 39 | $this->fakeName = uniqid('name'); |
40 | - $this->fakePrefix= uniqid('prefix'); |
|
40 | + $this->fakePrefix = uniqid('prefix'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function tearDown() { |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * @dataProvider propertyProvider |
50 | 50 | */ |
51 | 51 | public function testProperty($propertyName, $value) { |
52 | - $setter = 'set' . ucfirst($propertyName); |
|
53 | - $getter = 'get' . ucfirst($propertyName); |
|
52 | + $setter = 'set'.ucfirst($propertyName); |
|
53 | + $getter = 'get'.ucfirst($propertyName); |
|
54 | 54 | call_user_func_array(array($this->fixture, $setter), array($value)); |
55 | 55 | $this->assertEquals($value, call_user_func(array($this->fixture, $getter))); |
56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | return array( |
63 | 63 | array('uploadFolder', uniqid()), |
64 | 64 | array('inputName', uniqid()), |
65 | - array('sizeLimit', rand(10,100)), |
|
65 | + array('sizeLimit', rand(10, 100)), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function canResolvesAPath() { |
32 | 32 | $resourceName = uniqid('resource'); |
33 | - $expected = 'media/Resources/Public/' . $resourceName; |
|
33 | + $expected = 'media/Resources/Public/'.$resourceName; |
|
34 | 34 | $actual = \Fab\Media\Utility\Path::resolvePath($resourceName); |
35 | 35 | |
36 | 36 | $this->assertTrue(strpos($actual, $expected) > 0); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function canReturnsAPublicPath() { |
44 | 44 | |
45 | 45 | $resourceName = uniqid('resource'); |
46 | - $expected = 'media/Resources/Public/' . $resourceName; |
|
46 | + $expected = 'media/Resources/Public/'.$resourceName; |
|
47 | 47 | $actual = \Fab\Media\Utility\Path::getRelativePath($resourceName); |
48 | 48 | |
49 | 49 | $this->assertTrue(strpos($actual, $expected) > 0); |
@@ -40,9 +40,9 @@ |
||
40 | 40 | |
41 | 41 | $pageRenderer = $this->getPageRenderer(); |
42 | 42 | $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
43 | - MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; |
|
44 | - MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; |
|
45 | - MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')) . '; |
|
43 | + MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()).'\'; |
|
44 | + MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix().'\'; |
|
45 | + MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')).'; |
|
46 | 46 | }'); |
47 | 47 | } |
48 | 48 |
@@ -18,38 +18,38 @@ |
||
18 | 18 | class FormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * JavaScript bottom code |
|
23 | - * |
|
24 | - * @param string $formname The identification of the form on the page. |
|
25 | - * @return string A section with JavaScript - if $update is false, embedded in <script></script> |
|
26 | - */ |
|
27 | - protected function JSbottom($formname = 'forms[0]') |
|
28 | - { |
|
29 | - |
|
30 | - $out = parent::JSbottom($formname); |
|
31 | - |
|
32 | - $enableMediaFilePicker = (bool)$this->getBackendUser()->getTSConfigVal('options.vidi.enableMediaFilePicker'); |
|
33 | - if ($enableMediaFilePicker) { |
|
34 | - |
|
35 | - $pageRenderer = $this->getPageRenderer(); |
|
36 | - $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
|
21 | + /** |
|
22 | + * JavaScript bottom code |
|
23 | + * |
|
24 | + * @param string $formname The identification of the form on the page. |
|
25 | + * @return string A section with JavaScript - if $update is false, embedded in <script></script> |
|
26 | + */ |
|
27 | + protected function JSbottom($formname = 'forms[0]') |
|
28 | + { |
|
29 | + |
|
30 | + $out = parent::JSbottom($formname); |
|
31 | + |
|
32 | + $enableMediaFilePicker = (bool)$this->getBackendUser()->getTSConfigVal('options.vidi.enableMediaFilePicker'); |
|
33 | + if ($enableMediaFilePicker) { |
|
34 | + |
|
35 | + $pageRenderer = $this->getPageRenderer(); |
|
36 | + $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
|
37 | 37 | MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; |
38 | 38 | MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; |
39 | 39 | MediaFormEngine.browserUrl = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_element_browser')) . '; |
40 | 40 | }'); |
41 | - } |
|
42 | - |
|
43 | - return $out; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Returns an instance of the current Backend User. |
|
48 | - * |
|
49 | - * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
50 | - */ |
|
51 | - protected function getBackendUser() |
|
52 | - { |
|
53 | - return $GLOBALS['BE_USER']; |
|
54 | - } |
|
41 | + } |
|
42 | + |
|
43 | + return $out; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Returns an instance of the current Backend User. |
|
48 | + * |
|
49 | + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
50 | + */ |
|
51 | + protected function getBackendUser() |
|
52 | + { |
|
53 | + return $GLOBALS['BE_USER']; |
|
54 | + } |
|
55 | 55 | } |
@@ -24,142 +24,142 @@ |
||
24 | 24 | abstract class UploadedFileAbstract implements UploadedFileInterface |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected $uploadFolder; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $inputName; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - protected $name; |
|
41 | - |
|
42 | - /** |
|
43 | - * Get the file type. |
|
44 | - * |
|
45 | - * @return int |
|
46 | - */ |
|
47 | - public function getType() |
|
48 | - { |
|
49 | - $this->checkFileExistence(); |
|
50 | - |
|
51 | - // this basically extracts the mimetype and guess the filetype based |
|
52 | - // on the first part of the mimetype works for 99% of all cases, and |
|
53 | - // we don't need to make an SQL statement like EXT:media does currently |
|
54 | - $mimeType = $this->getMimeType(); |
|
55 | - list($fileType) = explode('/', $mimeType); |
|
56 | - switch (strtolower($fileType)) { |
|
57 | - case 'text': |
|
58 | - $type = File::FILETYPE_TEXT; |
|
59 | - break; |
|
60 | - case 'image': |
|
61 | - $type = File::FILETYPE_IMAGE; |
|
62 | - break; |
|
63 | - case 'audio': |
|
64 | - $type = File::FILETYPE_AUDIO; |
|
65 | - break; |
|
66 | - case 'video': |
|
67 | - $type = File::FILETYPE_VIDEO; |
|
68 | - break; |
|
69 | - case 'application': |
|
70 | - case 'software': |
|
71 | - $type = File::FILETYPE_APPLICATION; |
|
72 | - break; |
|
73 | - default: |
|
74 | - $type = File::FILETYPE_UNKNOWN; |
|
75 | - } |
|
76 | - return $type; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Get the file with its absolute path. |
|
81 | - * |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function getFileWithAbsolutePath() |
|
85 | - { |
|
86 | - return $this->uploadFolder . DIRECTORY_SEPARATOR . $this->name; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Get the file's public URL. |
|
91 | - * |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function getPublicUrl() |
|
95 | - { |
|
96 | - $fileNameAndPath = str_replace(PATH_site, '', $this->getFileWithAbsolutePath()); |
|
97 | - return '/' . ltrim($fileNameAndPath, '/'); |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function getInputName() |
|
104 | - { |
|
105 | - return $this->inputName; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @param string $inputName |
|
110 | - * @return UploadedFileInterface |
|
111 | - */ |
|
112 | - public function setInputName($inputName) |
|
113 | - { |
|
114 | - $this->inputName = $inputName; |
|
115 | - return $this; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function getUploadFolder() |
|
122 | - { |
|
123 | - return $this->uploadFolder; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @param string $uploadFolder |
|
128 | - * @return UploadedFileInterface |
|
129 | - */ |
|
130 | - public function setUploadFolder($uploadFolder) |
|
131 | - { |
|
132 | - $this->uploadFolder = $uploadFolder; |
|
133 | - return $this; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @return string |
|
138 | - */ |
|
139 | - public function getName() |
|
140 | - { |
|
141 | - return $this->name; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * @param string $name |
|
146 | - * @return UploadedFileInterface |
|
147 | - */ |
|
148 | - public function setName($name) |
|
149 | - { |
|
150 | - $this->name = $name; |
|
151 | - return $this; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Check whether the file exists. |
|
156 | - */ |
|
157 | - protected function checkFileExistence() |
|
158 | - { |
|
159 | - if (!is_file($this->getFileWithAbsolutePath())) { |
|
160 | - $message = sprintf('File not found at "%s". Did you save it?', $this->getFileWithAbsolutePath()); |
|
161 | - throw new MissingFileException($message, 1361786958); |
|
162 | - } |
|
163 | - } |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected $uploadFolder; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $inputName; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + protected $name; |
|
41 | + |
|
42 | + /** |
|
43 | + * Get the file type. |
|
44 | + * |
|
45 | + * @return int |
|
46 | + */ |
|
47 | + public function getType() |
|
48 | + { |
|
49 | + $this->checkFileExistence(); |
|
50 | + |
|
51 | + // this basically extracts the mimetype and guess the filetype based |
|
52 | + // on the first part of the mimetype works for 99% of all cases, and |
|
53 | + // we don't need to make an SQL statement like EXT:media does currently |
|
54 | + $mimeType = $this->getMimeType(); |
|
55 | + list($fileType) = explode('/', $mimeType); |
|
56 | + switch (strtolower($fileType)) { |
|
57 | + case 'text': |
|
58 | + $type = File::FILETYPE_TEXT; |
|
59 | + break; |
|
60 | + case 'image': |
|
61 | + $type = File::FILETYPE_IMAGE; |
|
62 | + break; |
|
63 | + case 'audio': |
|
64 | + $type = File::FILETYPE_AUDIO; |
|
65 | + break; |
|
66 | + case 'video': |
|
67 | + $type = File::FILETYPE_VIDEO; |
|
68 | + break; |
|
69 | + case 'application': |
|
70 | + case 'software': |
|
71 | + $type = File::FILETYPE_APPLICATION; |
|
72 | + break; |
|
73 | + default: |
|
74 | + $type = File::FILETYPE_UNKNOWN; |
|
75 | + } |
|
76 | + return $type; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Get the file with its absolute path. |
|
81 | + * |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function getFileWithAbsolutePath() |
|
85 | + { |
|
86 | + return $this->uploadFolder . DIRECTORY_SEPARATOR . $this->name; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Get the file's public URL. |
|
91 | + * |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function getPublicUrl() |
|
95 | + { |
|
96 | + $fileNameAndPath = str_replace(PATH_site, '', $this->getFileWithAbsolutePath()); |
|
97 | + return '/' . ltrim($fileNameAndPath, '/'); |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function getInputName() |
|
104 | + { |
|
105 | + return $this->inputName; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @param string $inputName |
|
110 | + * @return UploadedFileInterface |
|
111 | + */ |
|
112 | + public function setInputName($inputName) |
|
113 | + { |
|
114 | + $this->inputName = $inputName; |
|
115 | + return $this; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function getUploadFolder() |
|
122 | + { |
|
123 | + return $this->uploadFolder; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @param string $uploadFolder |
|
128 | + * @return UploadedFileInterface |
|
129 | + */ |
|
130 | + public function setUploadFolder($uploadFolder) |
|
131 | + { |
|
132 | + $this->uploadFolder = $uploadFolder; |
|
133 | + return $this; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @return string |
|
138 | + */ |
|
139 | + public function getName() |
|
140 | + { |
|
141 | + return $this->name; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * @param string $name |
|
146 | + * @return UploadedFileInterface |
|
147 | + */ |
|
148 | + public function setName($name) |
|
149 | + { |
|
150 | + $this->name = $name; |
|
151 | + return $this; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Check whether the file exists. |
|
156 | + */ |
|
157 | + protected function checkFileExistence() |
|
158 | + { |
|
159 | + if (!is_file($this->getFileWithAbsolutePath())) { |
|
160 | + $message = sprintf('File not found at "%s". Did you save it?', $this->getFileWithAbsolutePath()); |
|
161 | + throw new MissingFileException($message, 1361786958); |
|
162 | + } |
|
163 | + } |
|
164 | 164 | |
165 | 165 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getFileWithAbsolutePath() |
85 | 85 | { |
86 | - return $this->uploadFolder . DIRECTORY_SEPARATOR . $this->name; |
|
86 | + return $this->uploadFolder.DIRECTORY_SEPARATOR.$this->name; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getPublicUrl() |
95 | 95 | { |
96 | 96 | $fileNameAndPath = str_replace(PATH_site, '', $this->getFileWithAbsolutePath()); |
97 | - return '/' . ltrim($fileNameAndPath, '/'); |
|
97 | + return '/'.ltrim($fileNameAndPath, '/'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -2,9 +2,9 @@ |
||
2 | 2 | if (!defined('TYPO3_MODE')) die ('Access denied.'); |
3 | 3 | |
4 | 4 | $tca = [ |
5 | - 'ctrl' => [ |
|
6 | - 'rootLevel' => -1, // Otherwise File Reference will not work between files. |
|
7 | - ], |
|
5 | + 'ctrl' => [ |
|
6 | + 'rootLevel' => -1, // Otherwise File Reference will not work between files. |
|
7 | + ], |
|
8 | 8 | ]; |
9 | 9 | |
10 | 10 | // Disable the File Upload in IRRE since it can not be configured the target storage. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined('TYPO3_MODE')) { |
|
3 | + die ('Access denied.'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $tca = [ |
5 | 7 | 'ctrl' => [ |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $tca = [ |
13 | 13 | 'types' => [ |
14 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
14 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'].', |
|
15 | 15 | |
16 | 16 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.upload_settings, |
17 | 17 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $tcaForHiddenFolderTree = [ |
82 | 82 | |
83 | 83 | 'types' => [ |
84 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
84 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'].', |
|
85 | 85 | |
86 | 86 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.media_mount_point, |
87 | 87 | mount_point_file_type_1, mount_point_file_type_2, mount_point_file_type_3, mount_point_file_type_4, mount_point_file_type_5, |
@@ -2,82 +2,82 @@ discard block |
||
2 | 2 | if (!defined('TYPO3_MODE')) die ('Access denied.'); |
3 | 3 | |
4 | 4 | $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
5 | - TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
5 | + TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
6 | 6 | )->get('media'); |
7 | 7 | |
8 | 8 | $tca = [ |
9 | - 'types' => [ |
|
10 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
9 | + 'types' => [ |
|
10 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
11 | 11 | |
12 | 12 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.upload_settings, |
13 | 13 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
14 | 14 | ', |
15 | - ], |
|
16 | - ], |
|
17 | - 'columns' => [ |
|
18 | - 'maximum_dimension_original_image' => [ |
|
19 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.maximum_dimension_original_image', |
|
20 | - 'config' => [ |
|
21 | - 'type' => 'input', |
|
22 | - 'size' => 24, |
|
23 | - 'default' => '1920x1920', |
|
24 | - 'eval' => 'trim', |
|
25 | - ], |
|
26 | - ], |
|
27 | - 'extension_allowed_file_type_1' => [ |
|
28 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_1', |
|
29 | - 'config' => [ |
|
30 | - 'type' => 'input', |
|
31 | - 'size' => 255, |
|
32 | - 'default' => 'txt, html', |
|
33 | - 'eval' => 'trim', |
|
34 | - ], |
|
35 | - ], |
|
36 | - 'extension_allowed_file_type_2' => [ |
|
37 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_2', |
|
38 | - 'config' => [ |
|
39 | - 'type' => 'input', |
|
40 | - 'size' => 255, |
|
41 | - 'default' => 'jpg, jpeg, bmp, png, tiff, tif, gif, eps', |
|
42 | - 'eval' => 'trim', |
|
43 | - ], |
|
44 | - ], |
|
45 | - 'extension_allowed_file_type_3' => [ |
|
46 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_3', |
|
47 | - 'config' => [ |
|
48 | - 'type' => 'input', |
|
49 | - 'size' => 255, |
|
50 | - 'default' => 'mp3, mp4, m4a, wma, f4a', |
|
51 | - 'eval' => 'trim', |
|
52 | - ], |
|
53 | - ], |
|
54 | - 'extension_allowed_file_type_4' => [ |
|
55 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_4', |
|
56 | - 'config' => [ |
|
57 | - 'type' => 'input', |
|
58 | - 'size' => 255, |
|
59 | - 'default' => 'mov, avi, mpeg, mpg, mp4, m4v, flv, f4v, webm, wmv, ogv, 3gp', |
|
60 | - 'eval' => 'trim', |
|
61 | - ], |
|
62 | - ], |
|
63 | - 'extension_allowed_file_type_5' => [ |
|
64 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_5', |
|
65 | - 'config' => [ |
|
66 | - 'type' => 'input', |
|
67 | - 'size' => 255, |
|
68 | - 'default' => 'pdf, zip, doc, docx, dotx, ppt, pptx, pps, ppsx, odt, xls, xlsx, xltx, rtf, xlt', |
|
69 | - 'eval' => 'trim', |
|
70 | - ], |
|
71 | - ], |
|
72 | - ], |
|
15 | + ], |
|
16 | + ], |
|
17 | + 'columns' => [ |
|
18 | + 'maximum_dimension_original_image' => [ |
|
19 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.maximum_dimension_original_image', |
|
20 | + 'config' => [ |
|
21 | + 'type' => 'input', |
|
22 | + 'size' => 24, |
|
23 | + 'default' => '1920x1920', |
|
24 | + 'eval' => 'trim', |
|
25 | + ], |
|
26 | + ], |
|
27 | + 'extension_allowed_file_type_1' => [ |
|
28 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_1', |
|
29 | + 'config' => [ |
|
30 | + 'type' => 'input', |
|
31 | + 'size' => 255, |
|
32 | + 'default' => 'txt, html', |
|
33 | + 'eval' => 'trim', |
|
34 | + ], |
|
35 | + ], |
|
36 | + 'extension_allowed_file_type_2' => [ |
|
37 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_2', |
|
38 | + 'config' => [ |
|
39 | + 'type' => 'input', |
|
40 | + 'size' => 255, |
|
41 | + 'default' => 'jpg, jpeg, bmp, png, tiff, tif, gif, eps', |
|
42 | + 'eval' => 'trim', |
|
43 | + ], |
|
44 | + ], |
|
45 | + 'extension_allowed_file_type_3' => [ |
|
46 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_3', |
|
47 | + 'config' => [ |
|
48 | + 'type' => 'input', |
|
49 | + 'size' => 255, |
|
50 | + 'default' => 'mp3, mp4, m4a, wma, f4a', |
|
51 | + 'eval' => 'trim', |
|
52 | + ], |
|
53 | + ], |
|
54 | + 'extension_allowed_file_type_4' => [ |
|
55 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_4', |
|
56 | + 'config' => [ |
|
57 | + 'type' => 'input', |
|
58 | + 'size' => 255, |
|
59 | + 'default' => 'mov, avi, mpeg, mpg, mp4, m4v, flv, f4v, webm, wmv, ogv, 3gp', |
|
60 | + 'eval' => 'trim', |
|
61 | + ], |
|
62 | + ], |
|
63 | + 'extension_allowed_file_type_5' => [ |
|
64 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.extension_allowed_file_type_5', |
|
65 | + 'config' => [ |
|
66 | + 'type' => 'input', |
|
67 | + 'size' => 255, |
|
68 | + 'default' => 'pdf, zip, doc, docx, dotx, ppt, pptx, pps, ppsx, odt, xls, xlsx, xltx, rtf, xlt', |
|
69 | + 'eval' => 'trim', |
|
70 | + ], |
|
71 | + ], |
|
72 | + ], |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | $tcaForHiddenFolderTree = []; |
76 | 76 | if (!$configuration['has_folder_tree']) { |
77 | - $tcaForHiddenFolderTree = [ |
|
77 | + $tcaForHiddenFolderTree = [ |
|
78 | 78 | |
79 | - 'types' => [ |
|
80 | - 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
79 | + 'types' => [ |
|
80 | + 0 => ['showitem' => $GLOBALS['TCA']['sys_file_storage']['types'][0]['showitem'] . ', |
|
81 | 81 | |
82 | 82 | --div--;LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:tab.media_mount_point, |
83 | 83 | mount_point_file_type_1, mount_point_file_type_2, mount_point_file_type_3, mount_point_file_type_4, mount_point_file_type_5, |
@@ -86,126 +86,126 @@ discard block |
||
86 | 86 | maximum_dimension_original_image, extension_allowed_file_type_1, extension_allowed_file_type_2, extension_allowed_file_type_3, extension_allowed_file_type_4, extension_allowed_file_type_5, |
87 | 87 | ', |
88 | 88 | |
89 | - ], |
|
90 | - ], |
|
91 | - 'columns' => [ |
|
92 | - 'mount_point_file_type_1' => [ |
|
93 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_1', |
|
94 | - 'config' => [ |
|
95 | - 'type' => 'group', |
|
96 | - 'internal_type' => 'db', |
|
97 | - 'allowed' => 'sys_filemounts', |
|
98 | - 'size' => 1, |
|
99 | - 'minitems' => 0, |
|
100 | - 'maxitems' => 1, |
|
101 | - 'wizards' => [ |
|
102 | - 'edit' => [ |
|
103 | - 'type' => 'popup', |
|
104 | - 'module' => [ |
|
105 | - 'name' => 'wizard_edit', |
|
106 | - ], |
|
107 | - 'icon' => 'edit2.gif', |
|
108 | - 'popup_onlyOpenIfSelected' => 1, |
|
109 | - 'notNewRecords' => 1, |
|
110 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
111 | - ], |
|
112 | - ], |
|
113 | - ], |
|
114 | - ], |
|
115 | - 'mount_point_file_type_2' => [ |
|
116 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_2', |
|
117 | - 'config' => [ |
|
118 | - 'type' => 'group', |
|
119 | - 'internal_type' => 'db', |
|
120 | - 'allowed' => 'sys_filemounts', |
|
121 | - 'size' => 1, |
|
122 | - 'minitems' => 0, |
|
123 | - 'maxitems' => 1, |
|
124 | - 'wizards' => [ |
|
125 | - 'edit' => [ |
|
126 | - 'type' => 'popup', |
|
127 | - 'module' => [ |
|
128 | - 'name' => 'wizard_edit', |
|
129 | - ], |
|
130 | - 'icon' => 'edit2.gif', |
|
131 | - 'popup_onlyOpenIfSelected' => 1, |
|
132 | - 'notNewRecords' => 1, |
|
133 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
134 | - ], |
|
135 | - ], |
|
136 | - ], |
|
137 | - ], |
|
138 | - 'mount_point_file_type_3' => [ |
|
139 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_3', |
|
140 | - 'config' => [ |
|
141 | - 'type' => 'group', |
|
142 | - 'internal_type' => 'db', |
|
143 | - 'allowed' => 'sys_filemounts', |
|
144 | - 'size' => 1, |
|
145 | - 'minitems' => 0, |
|
146 | - 'maxitems' => 1, |
|
147 | - 'wizards' => [ |
|
148 | - 'edit' => [ |
|
149 | - 'type' => 'popup', |
|
150 | - 'module' => [ |
|
151 | - 'name' => 'wizard_edit', |
|
152 | - ], |
|
153 | - 'icon' => 'edit2.gif', |
|
154 | - 'popup_onlyOpenIfSelected' => 1, |
|
155 | - 'notNewRecords' => 1, |
|
156 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
157 | - ], |
|
158 | - ], |
|
159 | - ], |
|
160 | - ], |
|
161 | - 'mount_point_file_type_4' => [ |
|
162 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_4', |
|
163 | - 'config' => [ |
|
164 | - 'type' => 'group', |
|
165 | - 'internal_type' => 'db', |
|
166 | - 'allowed' => 'sys_filemounts', |
|
167 | - 'size' => 1, |
|
168 | - 'minitems' => 0, |
|
169 | - 'maxitems' => 1, |
|
170 | - 'wizards' => [ |
|
171 | - 'edit' => [ |
|
172 | - 'type' => 'popup', |
|
173 | - 'module' => [ |
|
174 | - 'name' => 'wizard_edit', |
|
175 | - ], |
|
176 | - 'icon' => 'edit2.gif', |
|
177 | - 'popup_onlyOpenIfSelected' => 1, |
|
178 | - 'notNewRecords' => 1, |
|
179 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
180 | - ], |
|
181 | - ], |
|
182 | - ], |
|
183 | - ], |
|
184 | - 'mount_point_file_type_5' => [ |
|
185 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_5', |
|
186 | - 'config' => [ |
|
187 | - 'type' => 'group', |
|
188 | - 'internal_type' => 'db', |
|
189 | - 'allowed' => 'sys_filemounts', |
|
190 | - 'size' => 1, |
|
191 | - 'minitems' => 0, |
|
192 | - 'maxitems' => 1, |
|
193 | - 'wizards' => [ |
|
194 | - 'edit' => [ |
|
195 | - 'type' => 'popup', |
|
196 | - 'module' => [ |
|
197 | - 'name' => 'wizard_edit', |
|
198 | - ], |
|
199 | - 'icon' => 'edit2.gif', |
|
200 | - 'popup_onlyOpenIfSelected' => 1, |
|
201 | - 'notNewRecords' => 1, |
|
202 | - 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
203 | - ], |
|
204 | - ], |
|
205 | - ], |
|
206 | - ], |
|
207 | - ], |
|
208 | - ]; |
|
89 | + ], |
|
90 | + ], |
|
91 | + 'columns' => [ |
|
92 | + 'mount_point_file_type_1' => [ |
|
93 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_1', |
|
94 | + 'config' => [ |
|
95 | + 'type' => 'group', |
|
96 | + 'internal_type' => 'db', |
|
97 | + 'allowed' => 'sys_filemounts', |
|
98 | + 'size' => 1, |
|
99 | + 'minitems' => 0, |
|
100 | + 'maxitems' => 1, |
|
101 | + 'wizards' => [ |
|
102 | + 'edit' => [ |
|
103 | + 'type' => 'popup', |
|
104 | + 'module' => [ |
|
105 | + 'name' => 'wizard_edit', |
|
106 | + ], |
|
107 | + 'icon' => 'edit2.gif', |
|
108 | + 'popup_onlyOpenIfSelected' => 1, |
|
109 | + 'notNewRecords' => 1, |
|
110 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
111 | + ], |
|
112 | + ], |
|
113 | + ], |
|
114 | + ], |
|
115 | + 'mount_point_file_type_2' => [ |
|
116 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_2', |
|
117 | + 'config' => [ |
|
118 | + 'type' => 'group', |
|
119 | + 'internal_type' => 'db', |
|
120 | + 'allowed' => 'sys_filemounts', |
|
121 | + 'size' => 1, |
|
122 | + 'minitems' => 0, |
|
123 | + 'maxitems' => 1, |
|
124 | + 'wizards' => [ |
|
125 | + 'edit' => [ |
|
126 | + 'type' => 'popup', |
|
127 | + 'module' => [ |
|
128 | + 'name' => 'wizard_edit', |
|
129 | + ], |
|
130 | + 'icon' => 'edit2.gif', |
|
131 | + 'popup_onlyOpenIfSelected' => 1, |
|
132 | + 'notNewRecords' => 1, |
|
133 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
134 | + ], |
|
135 | + ], |
|
136 | + ], |
|
137 | + ], |
|
138 | + 'mount_point_file_type_3' => [ |
|
139 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_3', |
|
140 | + 'config' => [ |
|
141 | + 'type' => 'group', |
|
142 | + 'internal_type' => 'db', |
|
143 | + 'allowed' => 'sys_filemounts', |
|
144 | + 'size' => 1, |
|
145 | + 'minitems' => 0, |
|
146 | + 'maxitems' => 1, |
|
147 | + 'wizards' => [ |
|
148 | + 'edit' => [ |
|
149 | + 'type' => 'popup', |
|
150 | + 'module' => [ |
|
151 | + 'name' => 'wizard_edit', |
|
152 | + ], |
|
153 | + 'icon' => 'edit2.gif', |
|
154 | + 'popup_onlyOpenIfSelected' => 1, |
|
155 | + 'notNewRecords' => 1, |
|
156 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
157 | + ], |
|
158 | + ], |
|
159 | + ], |
|
160 | + ], |
|
161 | + 'mount_point_file_type_4' => [ |
|
162 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_4', |
|
163 | + 'config' => [ |
|
164 | + 'type' => 'group', |
|
165 | + 'internal_type' => 'db', |
|
166 | + 'allowed' => 'sys_filemounts', |
|
167 | + 'size' => 1, |
|
168 | + 'minitems' => 0, |
|
169 | + 'maxitems' => 1, |
|
170 | + 'wizards' => [ |
|
171 | + 'edit' => [ |
|
172 | + 'type' => 'popup', |
|
173 | + 'module' => [ |
|
174 | + 'name' => 'wizard_edit', |
|
175 | + ], |
|
176 | + 'icon' => 'edit2.gif', |
|
177 | + 'popup_onlyOpenIfSelected' => 1, |
|
178 | + 'notNewRecords' => 1, |
|
179 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
180 | + ], |
|
181 | + ], |
|
182 | + ], |
|
183 | + ], |
|
184 | + 'mount_point_file_type_5' => [ |
|
185 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang_db.xlf:sys_file_storage.mount_point_file_type_5', |
|
186 | + 'config' => [ |
|
187 | + 'type' => 'group', |
|
188 | + 'internal_type' => 'db', |
|
189 | + 'allowed' => 'sys_filemounts', |
|
190 | + 'size' => 1, |
|
191 | + 'minitems' => 0, |
|
192 | + 'maxitems' => 1, |
|
193 | + 'wizards' => [ |
|
194 | + 'edit' => [ |
|
195 | + 'type' => 'popup', |
|
196 | + 'module' => [ |
|
197 | + 'name' => 'wizard_edit', |
|
198 | + ], |
|
199 | + 'icon' => 'edit2.gif', |
|
200 | + 'popup_onlyOpenIfSelected' => 1, |
|
201 | + 'notNewRecords' => 1, |
|
202 | + 'JSopenParams' => 'height=500,width=800,status=0,menubar=0,scrollbars=1,resizable=yes' |
|
203 | + ], |
|
204 | + ], |
|
205 | + ], |
|
206 | + ], |
|
207 | + ], |
|
208 | + ]; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Merge first two possible TCA whether the folder tree is displayed or not. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined('TYPO3_MODE')) { |
|
3 | + die ('Access denied.'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
5 | 7 | TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
@@ -82,7 +82,7 @@ |
||
82 | 82 | * Parses $rawValidatorOptions not containing quoted option values. |
83 | 83 | * $rawValidatorOptions will be an empty string afterwards (pass by ref!). |
84 | 84 | * |
85 | - * @param string $rawValidatorOptions |
|
85 | + * @param string $rawConfigurationOptions |
|
86 | 86 | * @return array An array of optionName/optionValue pairs |
87 | 87 | */ |
88 | 88 | protected function parseConfigurationOptions($rawConfigurationOptions) |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | class ConfigurationArrayConverter extends ArrayConverter |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Match configuration options (to parse actual options) |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - const PATTERN_MATCH_CONFIGURATIONOPTIONS = '/ |
|
20 | + /** |
|
21 | + * Match configuration options (to parse actual options) |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + const PATTERN_MATCH_CONFIGURATIONOPTIONS = '/ |
|
25 | 25 | \s* |
26 | 26 | (?P<optionName>[a-z0-9]+) |
27 | 27 | \s*=\s* |
@@ -32,84 +32,84 @@ discard block |
||
32 | 32 | ) |
33 | 33 | /ixS'; |
34 | 34 | |
35 | - /** |
|
36 | - * We can only convert empty strings to array or array to array. |
|
37 | - * |
|
38 | - * @param mixed $source |
|
39 | - * @param string $targetType |
|
40 | - * @return boolean |
|
41 | - */ |
|
42 | - public function canConvertFrom($source, $targetType) |
|
43 | - { |
|
44 | - return is_string($source) || is_array($source); |
|
45 | - } |
|
35 | + /** |
|
36 | + * We can only convert empty strings to array or array to array. |
|
37 | + * |
|
38 | + * @param mixed $source |
|
39 | + * @param string $targetType |
|
40 | + * @return boolean |
|
41 | + */ |
|
42 | + public function canConvertFrom($source, $targetType) |
|
43 | + { |
|
44 | + return is_string($source) || is_array($source); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Convert from $source to $targetType, a noop if the source is an array. |
|
49 | - * If it is an empty string it will be converted to an empty array. |
|
50 | - * |
|
51 | - * @param string|array $source |
|
52 | - * @param string $targetType |
|
53 | - * @param array $convertedChildProperties |
|
54 | - * @param PropertyMappingConfigurationInterface $configuration |
|
55 | - * @return array |
|
56 | - * @api |
|
57 | - */ |
|
58 | - public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
59 | - { |
|
60 | - if (is_string($source)) { |
|
61 | - if ($source === '') { |
|
62 | - $target = []; |
|
63 | - } else { |
|
64 | - $target = $this->parseConfigurationOptions($source); |
|
65 | - } |
|
66 | - } |
|
47 | + /** |
|
48 | + * Convert from $source to $targetType, a noop if the source is an array. |
|
49 | + * If it is an empty string it will be converted to an empty array. |
|
50 | + * |
|
51 | + * @param string|array $source |
|
52 | + * @param string $targetType |
|
53 | + * @param array $convertedChildProperties |
|
54 | + * @param PropertyMappingConfigurationInterface $configuration |
|
55 | + * @return array |
|
56 | + * @api |
|
57 | + */ |
|
58 | + public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
59 | + { |
|
60 | + if (is_string($source)) { |
|
61 | + if ($source === '') { |
|
62 | + $target = []; |
|
63 | + } else { |
|
64 | + $target = $this->parseConfigurationOptions($source); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - if (is_array($source)) { |
|
69 | - $target = $source; |
|
70 | - } |
|
68 | + if (is_array($source)) { |
|
69 | + $target = $source; |
|
70 | + } |
|
71 | 71 | |
72 | - return $target; |
|
73 | - } |
|
72 | + return $target; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Parses $rawValidatorOptions not containing quoted option values. |
|
77 | - * $rawValidatorOptions will be an empty string afterwards (pass by ref!). |
|
78 | - * |
|
79 | - * @param string $rawValidatorOptions |
|
80 | - * @return array An array of optionName/optionValue pairs |
|
81 | - */ |
|
82 | - protected function parseConfigurationOptions($rawConfigurationOptions) |
|
83 | - { |
|
84 | - $configurationOptions = []; |
|
85 | - $parsedConfigurationOptions = []; |
|
86 | - preg_match_all(self::PATTERN_MATCH_CONFIGURATIONOPTIONS, $rawConfigurationOptions, $configurationOptions, PREG_SET_ORDER); |
|
87 | - foreach ($configurationOptions as $configurationOption) { |
|
88 | - $parsedConfigurationOptions[trim($configurationOption['optionName'])] = trim($configurationOption['optionValue']); |
|
89 | - } |
|
90 | - array_walk($parsedConfigurationOptions, array($this, 'unquoteString')); |
|
91 | - return $parsedConfigurationOptions; |
|
92 | - } |
|
75 | + /** |
|
76 | + * Parses $rawValidatorOptions not containing quoted option values. |
|
77 | + * $rawValidatorOptions will be an empty string afterwards (pass by ref!). |
|
78 | + * |
|
79 | + * @param string $rawValidatorOptions |
|
80 | + * @return array An array of optionName/optionValue pairs |
|
81 | + */ |
|
82 | + protected function parseConfigurationOptions($rawConfigurationOptions) |
|
83 | + { |
|
84 | + $configurationOptions = []; |
|
85 | + $parsedConfigurationOptions = []; |
|
86 | + preg_match_all(self::PATTERN_MATCH_CONFIGURATIONOPTIONS, $rawConfigurationOptions, $configurationOptions, PREG_SET_ORDER); |
|
87 | + foreach ($configurationOptions as $configurationOption) { |
|
88 | + $parsedConfigurationOptions[trim($configurationOption['optionName'])] = trim($configurationOption['optionValue']); |
|
89 | + } |
|
90 | + array_walk($parsedConfigurationOptions, array($this, 'unquoteString')); |
|
91 | + return $parsedConfigurationOptions; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Removes escapings from a given argument string and trims the outermost |
|
96 | - * quotes. |
|
97 | - * |
|
98 | - * This method is meant as a helper for regular expression results. |
|
99 | - * |
|
100 | - * @param string &$quotedValue Value to unquote |
|
101 | - * @return void |
|
102 | - */ |
|
103 | - protected function unquoteString(&$quotedValue) |
|
104 | - { |
|
105 | - switch ($quotedValue[0]) { |
|
106 | - case '"': |
|
107 | - $quotedValue = str_replace('\\"', '"', trim($quotedValue, '"')); |
|
108 | - break; |
|
109 | - case '\'': |
|
110 | - $quotedValue = str_replace('\\\'', '\'', trim($quotedValue, '\'')); |
|
111 | - break; |
|
112 | - } |
|
113 | - $quotedValue = str_replace('\\\\', '\\', $quotedValue); |
|
114 | - } |
|
94 | + /** |
|
95 | + * Removes escapings from a given argument string and trims the outermost |
|
96 | + * quotes. |
|
97 | + * |
|
98 | + * This method is meant as a helper for regular expression results. |
|
99 | + * |
|
100 | + * @param string &$quotedValue Value to unquote |
|
101 | + * @return void |
|
102 | + */ |
|
103 | + protected function unquoteString(&$quotedValue) |
|
104 | + { |
|
105 | + switch ($quotedValue[0]) { |
|
106 | + case '"': |
|
107 | + $quotedValue = str_replace('\\"', '"', trim($quotedValue, '"')); |
|
108 | + break; |
|
109 | + case '\'': |
|
110 | + $quotedValue = str_replace('\\\'', '\'', trim($quotedValue, '\'')); |
|
111 | + break; |
|
112 | + } |
|
113 | + $quotedValue = str_replace('\\\\', '\\', $quotedValue); |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | \ No newline at end of file |