@@ -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 |
@@ -19,41 +19,41 @@ |
||
| 19 | 19 | class ImageEditorController extends ActionController |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var \TYPO3\CMS\Core\Page\PageRenderer |
|
| 24 | - * @inject |
|
| 25 | - */ |
|
| 26 | - protected $pageRenderer; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Initializes the controller before invoking an action method. |
|
| 30 | - */ |
|
| 31 | - public function initializeAction() |
|
| 32 | - { |
|
| 33 | - $this->pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
| 34 | - |
|
| 35 | - // Configure property mapping to retrieve the file object. |
|
| 36 | - if ($this->arguments->hasArgument('file')) { |
|
| 37 | - |
|
| 38 | - /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 39 | - $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 40 | - |
|
| 41 | - $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 42 | - $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Handle GUI for inserting an image in the RTE. |
|
| 48 | - * |
|
| 49 | - * @param File $file |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function showAction(File $file) |
|
| 53 | - { |
|
| 54 | - $this->view->assign('file', $file); |
|
| 55 | - $moduleSignature = MediaModule::getSignature(); |
|
| 56 | - $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
| 57 | - } |
|
| 22 | + /** |
|
| 23 | + * @var \TYPO3\CMS\Core\Page\PageRenderer |
|
| 24 | + * @inject |
|
| 25 | + */ |
|
| 26 | + protected $pageRenderer; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Initializes the controller before invoking an action method. |
|
| 30 | + */ |
|
| 31 | + public function initializeAction() |
|
| 32 | + { |
|
| 33 | + $this->pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
| 34 | + |
|
| 35 | + // Configure property mapping to retrieve the file object. |
|
| 36 | + if ($this->arguments->hasArgument('file')) { |
|
| 37 | + |
|
| 38 | + /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 39 | + $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 40 | + |
|
| 41 | + $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 42 | + $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Handle GUI for inserting an image in the RTE. |
|
| 48 | + * |
|
| 49 | + * @param File $file |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function showAction(File $file) |
|
| 53 | + { |
|
| 54 | + $this->view->assign('file', $file); |
|
| 55 | + $moduleSignature = MediaModule::getSignature(); |
|
| 56 | + $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | } |
@@ -15,48 +15,48 @@ |
||
| 15 | 15 | class FallBackThumbnailProcessor extends AbstractThumbnailProcessor |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Render a fallback thumbnail if no type was found for the given resource. |
|
| 20 | - * |
|
| 21 | - * @return string |
|
| 22 | - */ |
|
| 23 | - public function create() |
|
| 24 | - { |
|
| 25 | - return sprintf( |
|
| 26 | - '<img src="%s" hspace="2" class="" alt="" />', |
|
| 27 | - Path::getRelativePath('Icons/UnknownMimeType.png') |
|
| 28 | - ); |
|
| 29 | - } |
|
| 18 | + /** |
|
| 19 | + * Render a fallback thumbnail if no type was found for the given resource. |
|
| 20 | + * |
|
| 21 | + * @return string |
|
| 22 | + */ |
|
| 23 | + public function create() |
|
| 24 | + { |
|
| 25 | + return sprintf( |
|
| 26 | + '<img src="%s" hspace="2" class="" alt="" />', |
|
| 27 | + Path::getRelativePath('Icons/UnknownMimeType.png') |
|
| 28 | + ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Render the URI of the thumbnail. |
|
| 33 | - * |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 36 | - public function renderUri() |
|
| 37 | - { |
|
| 38 | - // Nothing to implement. |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Render the URI of the thumbnail. |
|
| 33 | + * |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | + public function renderUri() |
|
| 37 | + { |
|
| 38 | + // Nothing to implement. |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Render the tag image which is the main one for a thumbnail. |
|
| 43 | - * |
|
| 44 | - * @param string $result |
|
| 45 | - * @return string |
|
| 46 | - */ |
|
| 47 | - public function renderTagImage($result) |
|
| 48 | - { |
|
| 49 | - // Nothing to implement. |
|
| 50 | - } |
|
| 41 | + /** |
|
| 42 | + * Render the tag image which is the main one for a thumbnail. |
|
| 43 | + * |
|
| 44 | + * @param string $result |
|
| 45 | + * @return string |
|
| 46 | + */ |
|
| 47 | + public function renderTagImage($result) |
|
| 48 | + { |
|
| 49 | + // Nothing to implement. |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Render a wrapping anchor around the thumbnail. |
|
| 54 | - * |
|
| 55 | - * @param string $result |
|
| 56 | - * @return string |
|
| 57 | - */ |
|
| 58 | - public function renderTagAnchor($result) |
|
| 59 | - { |
|
| 60 | - // Nothing to implement. |
|
| 61 | - } |
|
| 52 | + /** |
|
| 53 | + * Render a wrapping anchor around the thumbnail. |
|
| 54 | + * |
|
| 55 | + * @param string $result |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 58 | + public function renderTagAnchor($result) |
|
| 59 | + { |
|
| 60 | + // Nothing to implement. |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -20,313 +20,313 @@ |
||
| 20 | 20 | class ThumbnailService |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 26 | - protected $allowedOutputTypes = array( |
|
| 27 | - ThumbnailInterface::OUTPUT_IMAGE, |
|
| 28 | - ThumbnailInterface::OUTPUT_IMAGE_WRAPPED, |
|
| 29 | - ThumbnailInterface::OUTPUT_URI, |
|
| 30 | - ); |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Configure the output of the thumbnail service whether it is wrapped or not. |
|
| 34 | - * Default output is: ThumbnailInterface::OUTPUT_IMAGE |
|
| 35 | - * |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 38 | - protected $outputType = ThumbnailInterface::OUTPUT_IMAGE; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var File |
|
| 42 | - */ |
|
| 43 | - protected $file; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Define width, height and all sort of attributes to render a thumbnail. |
|
| 47 | - * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
| 48 | - * @var array |
|
| 49 | - */ |
|
| 50 | - protected $configuration = []; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Define width, height and all sort of attributes to render the anchor file |
|
| 54 | - * which is wrapping the image |
|
| 55 | - * |
|
| 56 | - * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
| 57 | - * @var array |
|
| 58 | - */ |
|
| 59 | - protected $configurationWrap = []; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * DOM attributes to add to the image preview. |
|
| 63 | - * |
|
| 64 | - * @var array |
|
| 65 | - */ |
|
| 66 | - protected $attributes = [ |
|
| 67 | - 'class' => 'thumbnail', |
|
| 68 | - ]; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Define in which window will the thumbnail be opened. |
|
| 72 | - * Does only apply if the thumbnail is wrapped (with an anchor). |
|
| 73 | - * |
|
| 74 | - * @var string |
|
| 75 | - */ |
|
| 76 | - protected $target = ThumbnailInterface::TARGET_BLANK; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * URI of the wrapping anchor pointing to the file. |
|
| 80 | - * replacing the "?" <a href="?">...</a> |
|
| 81 | - * The URI is automatically computed if not set. |
|
| 82 | - * @var string |
|
| 83 | - */ |
|
| 84 | - protected $anchorUri; |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Whether a time stamp is appended to the image. |
|
| 88 | - * Appending the time stamp can prevent caching |
|
| 89 | - * |
|
| 90 | - * @var bool |
|
| 91 | - */ |
|
| 92 | - protected $appendTimeStamp = false; |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Define the processing type for the thumbnail. |
|
| 96 | - * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK. |
|
| 97 | - * |
|
| 98 | - * @var string |
|
| 99 | - */ |
|
| 100 | - protected $processingType; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Constructor |
|
| 104 | - * |
|
| 105 | - * @param File $file |
|
| 106 | - */ |
|
| 107 | - public function __construct(File $file = null) |
|
| 108 | - { |
|
| 109 | - $this->file = $file; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Render a thumbnail of a media |
|
| 114 | - * |
|
| 115 | - * @throws MissingTcaConfigurationException |
|
| 116 | - * @return string |
|
| 117 | - * @throws \InvalidArgumentException |
|
| 118 | - */ |
|
| 119 | - public function create() |
|
| 120 | - { |
|
| 121 | - |
|
| 122 | - if (!$this->file) { |
|
| 123 | - throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - // Default class name |
|
| 127 | - $className = 'Fab\Media\Thumbnail\FallBackThumbnailProcessor'; |
|
| 128 | - if (File::FILETYPE_IMAGE === $this->file->getType()) { |
|
| 129 | - $className = 'Fab\Media\Thumbnail\ImageThumbnailProcessor'; |
|
| 130 | - } elseif (File::FILETYPE_AUDIO === $this->file->getType()) { |
|
| 131 | - $className = 'Fab\Media\Thumbnail\AudioThumbnailProcessor'; |
|
| 132 | - } elseif (File::FILETYPE_VIDEO === $this->file->getType()) { |
|
| 133 | - $className = 'Fab\Media\Thumbnail\VideoThumbnailProcessor'; |
|
| 134 | - } elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) { |
|
| 135 | - $className = 'Fab\Media\Thumbnail\ApplicationThumbnailProcessor'; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */ |
|
| 139 | - $processorInstance = GeneralUtility::makeInstance($className); |
|
| 140 | - |
|
| 141 | - $thumbnail = ''; |
|
| 142 | - if ($this->file->exists()) { |
|
| 143 | - $thumbnail = $processorInstance->setThumbnailService($this)->create(); |
|
| 144 | - } else { |
|
| 145 | - $logger = Logger::getInstance($this); |
|
| 146 | - $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier())); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $thumbnail; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @return array |
|
| 154 | - */ |
|
| 155 | - public function getConfigurationWrap() |
|
| 156 | - { |
|
| 157 | - return $this->configurationWrap; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * @param array $configurationWrap |
|
| 162 | - * @return $this |
|
| 163 | - */ |
|
| 164 | - public function setConfigurationWrap($configurationWrap) |
|
| 165 | - { |
|
| 166 | - $this->configurationWrap = $configurationWrap; |
|
| 167 | - return $this; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * @return mixed |
|
| 172 | - */ |
|
| 173 | - public function getFile() |
|
| 174 | - { |
|
| 175 | - return $this->file; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * @return array |
|
| 180 | - */ |
|
| 181 | - public function getConfiguration() |
|
| 182 | - { |
|
| 183 | - return $this->configuration; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * @param array|ThumbnailConfiguration $configuration |
|
| 188 | - * @return $this |
|
| 189 | - */ |
|
| 190 | - public function setConfiguration($configuration) |
|
| 191 | - { |
|
| 192 | - if ($configuration instanceof ThumbnailConfiguration) { |
|
| 193 | - $configurationObject = $configuration; |
|
| 194 | - $configuration = []; |
|
| 195 | - |
|
| 196 | - if ($configurationObject->getWidth() > 0) { |
|
| 197 | - $configuration['width'] = $configurationObject->getWidth(); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - if ($configurationObject->getHeight() > 0) { |
|
| 201 | - $configuration['height'] = $configurationObject->getHeight(); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - if ($configurationObject->getStyle()) { |
|
| 205 | - $this->attributes['style'] = $configurationObject->getStyle(); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - if ($configurationObject->getClassName()) { |
|
| 209 | - $this->attributes['class'] = $configurationObject->getClassName(); |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - $this->configuration = $configuration; |
|
| 214 | - return $this; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * @return array |
|
| 219 | - */ |
|
| 220 | - public function getAttributes() |
|
| 221 | - { |
|
| 222 | - return $this->attributes; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * @param array $attributes |
|
| 227 | - * @return $this |
|
| 228 | - */ |
|
| 229 | - public function setAttributes($attributes) |
|
| 230 | - { |
|
| 231 | - $this->attributes = $attributes; |
|
| 232 | - return $this; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * @return string |
|
| 237 | - */ |
|
| 238 | - public function getOutputType() |
|
| 239 | - { |
|
| 240 | - return $this->outputType; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * @throws InvalidKeyInArrayException |
|
| 245 | - * @param string $outputType |
|
| 246 | - * @return $this |
|
| 247 | - */ |
|
| 248 | - public function setOutputType($outputType) |
|
| 249 | - { |
|
| 250 | - if (!in_array($outputType, $this->allowedOutputTypes)) { |
|
| 251 | - throw new InvalidKeyInArrayException( |
|
| 252 | - sprintf('Output type "%s" is not allowed', $outputType), |
|
| 253 | - 1373020076 |
|
| 254 | - ); |
|
| 255 | - } |
|
| 256 | - $this->outputType = $outputType; |
|
| 257 | - return $this; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * @return string |
|
| 262 | - */ |
|
| 263 | - public function getTarget() |
|
| 264 | - { |
|
| 265 | - return $this->target; |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * @param string $target |
|
| 270 | - * @return $this |
|
| 271 | - */ |
|
| 272 | - public function setTarget($target) |
|
| 273 | - { |
|
| 274 | - $this->target = $target; |
|
| 275 | - return $this; |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * @return string |
|
| 280 | - */ |
|
| 281 | - public function getAnchorUri() |
|
| 282 | - { |
|
| 283 | - return $this->anchorUri; |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * @param string $anchorUri |
|
| 288 | - * @return $this |
|
| 289 | - */ |
|
| 290 | - public function setAnchorUri($anchorUri) |
|
| 291 | - { |
|
| 292 | - $this->anchorUri = $anchorUri; |
|
| 293 | - return $this; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * @return boolean |
|
| 298 | - */ |
|
| 299 | - public function getAppendTimeStamp() |
|
| 300 | - { |
|
| 301 | - return $this->appendTimeStamp; |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * @param boolean $appendTimeStamp |
|
| 306 | - * @return $this |
|
| 307 | - */ |
|
| 308 | - public function setAppendTimeStamp($appendTimeStamp) |
|
| 309 | - { |
|
| 310 | - $this->appendTimeStamp = (bool)$appendTimeStamp; |
|
| 311 | - return $this; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - /** |
|
| 315 | - * @return string |
|
| 316 | - */ |
|
| 317 | - public function getProcessingType() |
|
| 318 | - { |
|
| 319 | - $this->processingType; |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * @param string $processingType |
|
| 324 | - * @return $this |
|
| 325 | - */ |
|
| 326 | - public function setProcessingType($processingType) |
|
| 327 | - { |
|
| 328 | - $this->processingType = $processingType; |
|
| 329 | - return $this; |
|
| 330 | - } |
|
| 23 | + /** |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | + protected $allowedOutputTypes = array( |
|
| 27 | + ThumbnailInterface::OUTPUT_IMAGE, |
|
| 28 | + ThumbnailInterface::OUTPUT_IMAGE_WRAPPED, |
|
| 29 | + ThumbnailInterface::OUTPUT_URI, |
|
| 30 | + ); |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Configure the output of the thumbnail service whether it is wrapped or not. |
|
| 34 | + * Default output is: ThumbnailInterface::OUTPUT_IMAGE |
|
| 35 | + * |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | + protected $outputType = ThumbnailInterface::OUTPUT_IMAGE; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var File |
|
| 42 | + */ |
|
| 43 | + protected $file; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Define width, height and all sort of attributes to render a thumbnail. |
|
| 47 | + * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
| 48 | + * @var array |
|
| 49 | + */ |
|
| 50 | + protected $configuration = []; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Define width, height and all sort of attributes to render the anchor file |
|
| 54 | + * which is wrapping the image |
|
| 55 | + * |
|
| 56 | + * @see TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::Image |
|
| 57 | + * @var array |
|
| 58 | + */ |
|
| 59 | + protected $configurationWrap = []; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * DOM attributes to add to the image preview. |
|
| 63 | + * |
|
| 64 | + * @var array |
|
| 65 | + */ |
|
| 66 | + protected $attributes = [ |
|
| 67 | + 'class' => 'thumbnail', |
|
| 68 | + ]; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Define in which window will the thumbnail be opened. |
|
| 72 | + * Does only apply if the thumbnail is wrapped (with an anchor). |
|
| 73 | + * |
|
| 74 | + * @var string |
|
| 75 | + */ |
|
| 76 | + protected $target = ThumbnailInterface::TARGET_BLANK; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * URI of the wrapping anchor pointing to the file. |
|
| 80 | + * replacing the "?" <a href="?">...</a> |
|
| 81 | + * The URI is automatically computed if not set. |
|
| 82 | + * @var string |
|
| 83 | + */ |
|
| 84 | + protected $anchorUri; |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Whether a time stamp is appended to the image. |
|
| 88 | + * Appending the time stamp can prevent caching |
|
| 89 | + * |
|
| 90 | + * @var bool |
|
| 91 | + */ |
|
| 92 | + protected $appendTimeStamp = false; |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Define the processing type for the thumbnail. |
|
| 96 | + * As instance for image the default is ProcessedFile::CONTEXT_IMAGECROPSCALEMASK. |
|
| 97 | + * |
|
| 98 | + * @var string |
|
| 99 | + */ |
|
| 100 | + protected $processingType; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Constructor |
|
| 104 | + * |
|
| 105 | + * @param File $file |
|
| 106 | + */ |
|
| 107 | + public function __construct(File $file = null) |
|
| 108 | + { |
|
| 109 | + $this->file = $file; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Render a thumbnail of a media |
|
| 114 | + * |
|
| 115 | + * @throws MissingTcaConfigurationException |
|
| 116 | + * @return string |
|
| 117 | + * @throws \InvalidArgumentException |
|
| 118 | + */ |
|
| 119 | + public function create() |
|
| 120 | + { |
|
| 121 | + |
|
| 122 | + if (!$this->file) { |
|
| 123 | + throw new MissingTcaConfigurationException('Missing File object. Forgotten to set a file?', 1355933144); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + // Default class name |
|
| 127 | + $className = 'Fab\Media\Thumbnail\FallBackThumbnailProcessor'; |
|
| 128 | + if (File::FILETYPE_IMAGE === $this->file->getType()) { |
|
| 129 | + $className = 'Fab\Media\Thumbnail\ImageThumbnailProcessor'; |
|
| 130 | + } elseif (File::FILETYPE_AUDIO === $this->file->getType()) { |
|
| 131 | + $className = 'Fab\Media\Thumbnail\AudioThumbnailProcessor'; |
|
| 132 | + } elseif (File::FILETYPE_VIDEO === $this->file->getType()) { |
|
| 133 | + $className = 'Fab\Media\Thumbnail\VideoThumbnailProcessor'; |
|
| 134 | + } elseif (File::FILETYPE_APPLICATION === $this->file->getType() || File::FILETYPE_TEXT === $this->file->getType()) { |
|
| 135 | + $className = 'Fab\Media\Thumbnail\ApplicationThumbnailProcessor'; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + /** @var $processorInstance \Fab\Media\Thumbnail\ThumbnailProcessorInterface */ |
|
| 139 | + $processorInstance = GeneralUtility::makeInstance($className); |
|
| 140 | + |
|
| 141 | + $thumbnail = ''; |
|
| 142 | + if ($this->file->exists()) { |
|
| 143 | + $thumbnail = $processorInstance->setThumbnailService($this)->create(); |
|
| 144 | + } else { |
|
| 145 | + $logger = Logger::getInstance($this); |
|
| 146 | + $logger->warning(sprintf('Resource not found for File uid "%s" at %s', $this->file->getUid(), $this->file->getIdentifier())); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $thumbnail; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @return array |
|
| 154 | + */ |
|
| 155 | + public function getConfigurationWrap() |
|
| 156 | + { |
|
| 157 | + return $this->configurationWrap; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @param array $configurationWrap |
|
| 162 | + * @return $this |
|
| 163 | + */ |
|
| 164 | + public function setConfigurationWrap($configurationWrap) |
|
| 165 | + { |
|
| 166 | + $this->configurationWrap = $configurationWrap; |
|
| 167 | + return $this; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * @return mixed |
|
| 172 | + */ |
|
| 173 | + public function getFile() |
|
| 174 | + { |
|
| 175 | + return $this->file; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * @return array |
|
| 180 | + */ |
|
| 181 | + public function getConfiguration() |
|
| 182 | + { |
|
| 183 | + return $this->configuration; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * @param array|ThumbnailConfiguration $configuration |
|
| 188 | + * @return $this |
|
| 189 | + */ |
|
| 190 | + public function setConfiguration($configuration) |
|
| 191 | + { |
|
| 192 | + if ($configuration instanceof ThumbnailConfiguration) { |
|
| 193 | + $configurationObject = $configuration; |
|
| 194 | + $configuration = []; |
|
| 195 | + |
|
| 196 | + if ($configurationObject->getWidth() > 0) { |
|
| 197 | + $configuration['width'] = $configurationObject->getWidth(); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + if ($configurationObject->getHeight() > 0) { |
|
| 201 | + $configuration['height'] = $configurationObject->getHeight(); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + if ($configurationObject->getStyle()) { |
|
| 205 | + $this->attributes['style'] = $configurationObject->getStyle(); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + if ($configurationObject->getClassName()) { |
|
| 209 | + $this->attributes['class'] = $configurationObject->getClassName(); |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + $this->configuration = $configuration; |
|
| 214 | + return $this; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * @return array |
|
| 219 | + */ |
|
| 220 | + public function getAttributes() |
|
| 221 | + { |
|
| 222 | + return $this->attributes; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * @param array $attributes |
|
| 227 | + * @return $this |
|
| 228 | + */ |
|
| 229 | + public function setAttributes($attributes) |
|
| 230 | + { |
|
| 231 | + $this->attributes = $attributes; |
|
| 232 | + return $this; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * @return string |
|
| 237 | + */ |
|
| 238 | + public function getOutputType() |
|
| 239 | + { |
|
| 240 | + return $this->outputType; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * @throws InvalidKeyInArrayException |
|
| 245 | + * @param string $outputType |
|
| 246 | + * @return $this |
|
| 247 | + */ |
|
| 248 | + public function setOutputType($outputType) |
|
| 249 | + { |
|
| 250 | + if (!in_array($outputType, $this->allowedOutputTypes)) { |
|
| 251 | + throw new InvalidKeyInArrayException( |
|
| 252 | + sprintf('Output type "%s" is not allowed', $outputType), |
|
| 253 | + 1373020076 |
|
| 254 | + ); |
|
| 255 | + } |
|
| 256 | + $this->outputType = $outputType; |
|
| 257 | + return $this; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * @return string |
|
| 262 | + */ |
|
| 263 | + public function getTarget() |
|
| 264 | + { |
|
| 265 | + return $this->target; |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * @param string $target |
|
| 270 | + * @return $this |
|
| 271 | + */ |
|
| 272 | + public function setTarget($target) |
|
| 273 | + { |
|
| 274 | + $this->target = $target; |
|
| 275 | + return $this; |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * @return string |
|
| 280 | + */ |
|
| 281 | + public function getAnchorUri() |
|
| 282 | + { |
|
| 283 | + return $this->anchorUri; |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * @param string $anchorUri |
|
| 288 | + * @return $this |
|
| 289 | + */ |
|
| 290 | + public function setAnchorUri($anchorUri) |
|
| 291 | + { |
|
| 292 | + $this->anchorUri = $anchorUri; |
|
| 293 | + return $this; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * @return boolean |
|
| 298 | + */ |
|
| 299 | + public function getAppendTimeStamp() |
|
| 300 | + { |
|
| 301 | + return $this->appendTimeStamp; |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * @param boolean $appendTimeStamp |
|
| 306 | + * @return $this |
|
| 307 | + */ |
|
| 308 | + public function setAppendTimeStamp($appendTimeStamp) |
|
| 309 | + { |
|
| 310 | + $this->appendTimeStamp = (bool)$appendTimeStamp; |
|
| 311 | + return $this; |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + /** |
|
| 315 | + * @return string |
|
| 316 | + */ |
|
| 317 | + public function getProcessingType() |
|
| 318 | + { |
|
| 319 | + $this->processingType; |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * @param string $processingType |
|
| 324 | + * @return $this |
|
| 325 | + */ |
|
| 326 | + public function setProcessingType($processingType) |
|
| 327 | + { |
|
| 328 | + $this->processingType = $processingType; |
|
| 329 | + return $this; |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | 332 | } |
@@ -17,96 +17,96 @@ |
||
| 17 | 17 | class VideoThumbnailProcessor extends AbstractThumbnailProcessor |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Render a thumbnail of a resource of type video. |
|
| 22 | - * |
|
| 23 | - * @return string |
|
| 24 | - */ |
|
| 25 | - public function create() |
|
| 26 | - { |
|
| 27 | - $steps = $this->getRenderingSteps(); |
|
| 28 | - |
|
| 29 | - $result = ''; |
|
| 30 | - while ($step = array_shift($steps)) { |
|
| 31 | - $result = $this->$step($result); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - return $result; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Render the URI of the thumbnail. |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function renderUri() |
|
| 43 | - { |
|
| 44 | - |
|
| 45 | - $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
| 46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 47 | - if (!file_exists($fileNameAndPath)) { |
|
| 48 | - $relativePath = 'Icons/UnknownMimeType.png'; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - $uri = Path::getRelativePath($relativePath); |
|
| 52 | - return $this->prefixUri($uri); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Render the tag image which is the main one for a thumbnail. |
|
| 57 | - * |
|
| 58 | - * @param string $result |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function renderTagImage($result) |
|
| 62 | - { |
|
| 63 | - |
|
| 64 | - // Variable $result corresponds to an URL in this case. |
|
| 65 | - // Analyse the URL and compute the adequate separator between arguments. |
|
| 66 | - $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
| 67 | - |
|
| 68 | - return sprintf( |
|
| 69 | - '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
| 70 | - $result, |
|
| 71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 72 | - $this->getTitle(), |
|
| 73 | - $this->getTitle(), |
|
| 74 | - $this->renderAttributes() |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Compute and return the title of the file. |
|
| 80 | - * |
|
| 81 | - * @return string |
|
| 82 | - */ |
|
| 83 | - protected function getTitle() |
|
| 84 | - { |
|
| 85 | - $result = $this->getFile()->getProperty('title'); |
|
| 86 | - if (!$result) { |
|
| 87 | - $result = $this->getFile()->getName(); |
|
| 88 | - } |
|
| 89 | - return htmlspecialchars($result); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Render a wrapping anchor around the thumbnail. |
|
| 94 | - * |
|
| 95 | - * @param string $result |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function renderTagAnchor($result) |
|
| 99 | - { |
|
| 100 | - |
|
| 101 | - $file = $this->getFile(); |
|
| 102 | - |
|
| 103 | - return sprintf( |
|
| 104 | - '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
| 105 | - $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
| 106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 107 | - $this->thumbnailService->getTarget(), |
|
| 108 | - $file->getUid(), |
|
| 109 | - $result |
|
| 110 | - ); |
|
| 111 | - } |
|
| 20 | + /** |
|
| 21 | + * Render a thumbnail of a resource of type video. |
|
| 22 | + * |
|
| 23 | + * @return string |
|
| 24 | + */ |
|
| 25 | + public function create() |
|
| 26 | + { |
|
| 27 | + $steps = $this->getRenderingSteps(); |
|
| 28 | + |
|
| 29 | + $result = ''; |
|
| 30 | + while ($step = array_shift($steps)) { |
|
| 31 | + $result = $this->$step($result); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return $result; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Render the URI of the thumbnail. |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function renderUri() |
|
| 43 | + { |
|
| 44 | + |
|
| 45 | + $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
| 46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 47 | + if (!file_exists($fileNameAndPath)) { |
|
| 48 | + $relativePath = 'Icons/UnknownMimeType.png'; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + $uri = Path::getRelativePath($relativePath); |
|
| 52 | + return $this->prefixUri($uri); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Render the tag image which is the main one for a thumbnail. |
|
| 57 | + * |
|
| 58 | + * @param string $result |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function renderTagImage($result) |
|
| 62 | + { |
|
| 63 | + |
|
| 64 | + // Variable $result corresponds to an URL in this case. |
|
| 65 | + // Analyse the URL and compute the adequate separator between arguments. |
|
| 66 | + $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
| 67 | + |
|
| 68 | + return sprintf( |
|
| 69 | + '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
| 70 | + $result, |
|
| 71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 72 | + $this->getTitle(), |
|
| 73 | + $this->getTitle(), |
|
| 74 | + $this->renderAttributes() |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Compute and return the title of the file. |
|
| 80 | + * |
|
| 81 | + * @return string |
|
| 82 | + */ |
|
| 83 | + protected function getTitle() |
|
| 84 | + { |
|
| 85 | + $result = $this->getFile()->getProperty('title'); |
|
| 86 | + if (!$result) { |
|
| 87 | + $result = $this->getFile()->getName(); |
|
| 88 | + } |
|
| 89 | + return htmlspecialchars($result); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Render a wrapping anchor around the thumbnail. |
|
| 94 | + * |
|
| 95 | + * @param string $result |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function renderTagAnchor($result) |
|
| 99 | + { |
|
| 100 | + |
|
| 101 | + $file = $this->getFile(); |
|
| 102 | + |
|
| 103 | + return sprintf( |
|
| 104 | + '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
| 105 | + $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
| 106 | + $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 107 | + $this->thumbnailService->getTarget(), |
|
| 108 | + $file->getUid(), |
|
| 109 | + $result |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | |
| 45 | 45 | $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
| 46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/'.$relativePath); |
|
| 47 | 47 | if (!file_exists($fileNameAndPath)) { |
| 48 | 48 | $relativePath = 'Icons/UnknownMimeType.png'; |
| 49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return sprintf( |
| 69 | 69 | '<img src="%s%s" title="%s" alt="%s" %s/>', |
| 70 | 70 | $result, |
| 71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getFile()->getProperty('tstamp') : '', |
|
| 72 | 72 | $this->getTitle(), |
| 73 | 73 | $this->getTitle(), |
| 74 | 74 | $this->renderAttributes() |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return sprintf( |
| 104 | 104 | '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
| 105 | 105 | $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
| 106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 106 | + $this->thumbnailService->getAppendTimeStamp() ? '?'.$file->getProperty('tstamp') : '', |
|
| 107 | 107 | $this->thumbnailService->getTarget(), |
| 108 | 108 | $file->getUid(), |
| 109 | 109 | $result |
@@ -15,96 +15,96 @@ |
||
| 15 | 15 | class ThumbnailConfiguration |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var int |
|
| 20 | - */ |
|
| 21 | - protected $width = 0; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @var int |
|
| 25 | - */ |
|
| 26 | - protected $height = 0; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 31 | - protected $style = ''; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - protected $className = ''; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @return int |
|
| 40 | - */ |
|
| 41 | - public function getWidth() |
|
| 42 | - { |
|
| 43 | - return $this->width; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @param int $width |
|
| 48 | - * @return $this |
|
| 49 | - */ |
|
| 50 | - public function setWidth($width) |
|
| 51 | - { |
|
| 52 | - $this->width = $width; |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @return int |
|
| 58 | - */ |
|
| 59 | - public function getHeight() |
|
| 60 | - { |
|
| 61 | - return $this->height; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @param int $height |
|
| 66 | - * @return $this |
|
| 67 | - */ |
|
| 68 | - public function setHeight($height) |
|
| 69 | - { |
|
| 70 | - $this->height = $height; |
|
| 71 | - return $this; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @return string |
|
| 76 | - */ |
|
| 77 | - public function getStyle() |
|
| 78 | - { |
|
| 79 | - return $this->style; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @param string $style |
|
| 84 | - * @return $this |
|
| 85 | - */ |
|
| 86 | - public function setStyle($style) |
|
| 87 | - { |
|
| 88 | - $this->style = $style; |
|
| 89 | - return $this; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 95 | - public function getClassName() |
|
| 96 | - { |
|
| 97 | - return $this->className; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @param string $className |
|
| 102 | - * @return $this |
|
| 103 | - */ |
|
| 104 | - public function setClassName($className) |
|
| 105 | - { |
|
| 106 | - $this->className = $className; |
|
| 107 | - return $this; |
|
| 108 | - } |
|
| 18 | + /** |
|
| 19 | + * @var int |
|
| 20 | + */ |
|
| 21 | + protected $width = 0; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @var int |
|
| 25 | + */ |
|
| 26 | + protected $height = 0; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | + protected $style = ''; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + protected $className = ''; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @return int |
|
| 40 | + */ |
|
| 41 | + public function getWidth() |
|
| 42 | + { |
|
| 43 | + return $this->width; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @param int $width |
|
| 48 | + * @return $this |
|
| 49 | + */ |
|
| 50 | + public function setWidth($width) |
|
| 51 | + { |
|
| 52 | + $this->width = $width; |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @return int |
|
| 58 | + */ |
|
| 59 | + public function getHeight() |
|
| 60 | + { |
|
| 61 | + return $this->height; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @param int $height |
|
| 66 | + * @return $this |
|
| 67 | + */ |
|
| 68 | + public function setHeight($height) |
|
| 69 | + { |
|
| 70 | + $this->height = $height; |
|
| 71 | + return $this; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @return string |
|
| 76 | + */ |
|
| 77 | + public function getStyle() |
|
| 78 | + { |
|
| 79 | + return $this->style; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @param string $style |
|
| 84 | + * @return $this |
|
| 85 | + */ |
|
| 86 | + public function setStyle($style) |
|
| 87 | + { |
|
| 88 | + $this->style = $style; |
|
| 89 | + return $this; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | + public function getClassName() |
|
| 96 | + { |
|
| 97 | + return $this->className; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @param string $className |
|
| 102 | + * @return $this |
|
| 103 | + */ |
|
| 104 | + public function setClassName($className) |
|
| 105 | + { |
|
| 106 | + $this->className = $className; |
|
| 107 | + return $this; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | } |
@@ -17,96 +17,96 @@ |
||
| 17 | 17 | class AudioThumbnailProcessor extends AbstractThumbnailProcessor |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Render a thumbnail of a resource of type audio. |
|
| 22 | - * |
|
| 23 | - * @return string |
|
| 24 | - */ |
|
| 25 | - public function create() |
|
| 26 | - { |
|
| 27 | - $steps = $this->getRenderingSteps(); |
|
| 28 | - |
|
| 29 | - $result = ''; |
|
| 30 | - while ($step = array_shift($steps)) { |
|
| 31 | - $result = $this->$step($result); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - return $result; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Render the URI of the thumbnail. |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function renderUri() |
|
| 43 | - { |
|
| 44 | - |
|
| 45 | - $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
| 46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 47 | - if (!file_exists($fileNameAndPath)) { |
|
| 48 | - $relativePath = 'Icons/UnknownMimeType.png'; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - $uri = Path::getRelativePath($relativePath); |
|
| 52 | - return $this->prefixUri($uri); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Render the tag image which is the main one for a thumbnail. |
|
| 57 | - * |
|
| 58 | - * @param string $result |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function renderTagImage($result) |
|
| 62 | - { |
|
| 63 | - |
|
| 64 | - // Variable $result corresponds to an URL in this case. |
|
| 65 | - // Analyse the URL and compute the adequate separator between arguments. |
|
| 66 | - $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
| 67 | - |
|
| 68 | - return sprintf( |
|
| 69 | - '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
| 70 | - $result, |
|
| 71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 72 | - $this->getTitle(), |
|
| 73 | - $this->getTitle(), |
|
| 74 | - $this->renderAttributes() |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Compute and return the title of the file. |
|
| 80 | - * |
|
| 81 | - * @return string |
|
| 82 | - */ |
|
| 83 | - protected function getTitle() |
|
| 84 | - { |
|
| 85 | - $result = $this->getFile()->getProperty('title'); |
|
| 86 | - if (!$result) { |
|
| 87 | - $result = $this->getFile()->getName(); |
|
| 88 | - } |
|
| 89 | - return htmlspecialchars($result); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Render a wrapping anchor around the thumbnail. |
|
| 94 | - * |
|
| 95 | - * @param string $result |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function renderTagAnchor($result) |
|
| 99 | - { |
|
| 100 | - |
|
| 101 | - $file = $this->getFile(); |
|
| 102 | - |
|
| 103 | - return sprintf( |
|
| 104 | - '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
| 105 | - $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
| 106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 107 | - $this->thumbnailService->getTarget(), |
|
| 108 | - $file->getUid(), |
|
| 109 | - $result |
|
| 110 | - ); |
|
| 111 | - } |
|
| 20 | + /** |
|
| 21 | + * Render a thumbnail of a resource of type audio. |
|
| 22 | + * |
|
| 23 | + * @return string |
|
| 24 | + */ |
|
| 25 | + public function create() |
|
| 26 | + { |
|
| 27 | + $steps = $this->getRenderingSteps(); |
|
| 28 | + |
|
| 29 | + $result = ''; |
|
| 30 | + while ($step = array_shift($steps)) { |
|
| 31 | + $result = $this->$step($result); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return $result; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Render the URI of the thumbnail. |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function renderUri() |
|
| 43 | + { |
|
| 44 | + |
|
| 45 | + $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
|
| 46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 47 | + if (!file_exists($fileNameAndPath)) { |
|
| 48 | + $relativePath = 'Icons/UnknownMimeType.png'; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + $uri = Path::getRelativePath($relativePath); |
|
| 52 | + return $this->prefixUri($uri); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Render the tag image which is the main one for a thumbnail. |
|
| 57 | + * |
|
| 58 | + * @param string $result |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function renderTagImage($result) |
|
| 62 | + { |
|
| 63 | + |
|
| 64 | + // Variable $result corresponds to an URL in this case. |
|
| 65 | + // Analyse the URL and compute the adequate separator between arguments. |
|
| 66 | + $parameterSeparator = strpos($result, '?') === false ? '?' : '&'; |
|
| 67 | + |
|
| 68 | + return sprintf( |
|
| 69 | + '<img src="%s%s" title="%s" alt="%s" %s/>', |
|
| 70 | + $result, |
|
| 71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 72 | + $this->getTitle(), |
|
| 73 | + $this->getTitle(), |
|
| 74 | + $this->renderAttributes() |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Compute and return the title of the file. |
|
| 80 | + * |
|
| 81 | + * @return string |
|
| 82 | + */ |
|
| 83 | + protected function getTitle() |
|
| 84 | + { |
|
| 85 | + $result = $this->getFile()->getProperty('title'); |
|
| 86 | + if (!$result) { |
|
| 87 | + $result = $this->getFile()->getName(); |
|
| 88 | + } |
|
| 89 | + return htmlspecialchars($result); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Render a wrapping anchor around the thumbnail. |
|
| 94 | + * |
|
| 95 | + * @param string $result |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function renderTagAnchor($result) |
|
| 99 | + { |
|
| 100 | + |
|
| 101 | + $file = $this->getFile(); |
|
| 102 | + |
|
| 103 | + return sprintf( |
|
| 104 | + '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
|
| 105 | + $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
|
| 106 | + $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 107 | + $this->thumbnailService->getTarget(), |
|
| 108 | + $file->getUid(), |
|
| 109 | + $result |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | |
| 45 | 45 | $relativePath = sprintf('Icons/MimeType/%s.png', $this->getFile()->getProperty('extension')); |
| 46 | - $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/' . $relativePath); |
|
| 46 | + $fileNameAndPath = GeneralUtility::getFileAbsFileName('EXT:media/Resources/Public/'.$relativePath); |
|
| 47 | 47 | if (!file_exists($fileNameAndPath)) { |
| 48 | 48 | $relativePath = 'Icons/UnknownMimeType.png'; |
| 49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return sprintf( |
| 69 | 69 | '<img src="%s%s" title="%s" alt="%s" %s/>', |
| 70 | 70 | $result, |
| 71 | - $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator . $this->getFile()->getProperty('tstamp') : '', |
|
| 71 | + $this->thumbnailService->getAppendTimeStamp() ? $parameterSeparator.$this->getFile()->getProperty('tstamp') : '', |
|
| 72 | 72 | $this->getTitle(), |
| 73 | 73 | $this->getTitle(), |
| 74 | 74 | $this->renderAttributes() |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return sprintf( |
| 104 | 104 | '<a href="%s%s" target="%s" data-uid="%s">%s</a>', |
| 105 | 105 | $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(true), |
| 106 | - $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '', |
|
| 106 | + $this->thumbnailService->getAppendTimeStamp() ? '?'.$file->getProperty('tstamp') : '', |
|
| 107 | 107 | $this->thumbnailService->getTarget(), |
| 108 | 108 | $file->getUid(), |
| 109 | 109 | $result |