[TASK] Remove @author lines
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / Controller / SelectImageController.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea\Controller;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Script class for the Element Browser window.
19 */
20 class SelectImageController {
21
22 public $mode = 'rte';
23
24 public $button = 'image';
25
26 protected $content = '';
27
28 /**
29 * Initialize language files
30 */
31 public function __construct() {
32 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_browse_links.xlf');
33 $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/Resources/Private/Language/locallang_selectimagecontroller.xlf');
34 $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/Resources/Private/Language/locallang_dialogs.xlf');
35 }
36
37 /**
38 * Main function, rendering the element browser in RTE mode.
39 *
40 * @return void
41 */
42 public function main() {
43 // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
44 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
45 if ($altMountPoints) {
46 $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
47 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
48 // @todo: add this feature for FAL and TYPO3 6.2
49 }
50 }
51 // Rendering type by user function
52 $browserRendered = FALSE;
53 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'])) {
54 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) {
55 $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
56 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
57 if ($browserRenderObj->isValid($this->mode, $this)) {
58 $this->content .= $browserRenderObj->render($this->mode, $this);
59 $browserRendered = TRUE;
60 break;
61 }
62 }
63 }
64 }
65 // If type was not rendered, use default rendering functions
66 if (!$browserRendered) {
67 $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\SelectImage::class);
68 $GLOBALS['SOBE']->browser->init();
69 $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
70 list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
71 $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
72 $this->content = $GLOBALS['SOBE']->browser->main_rte();
73 }
74 }
75
76 /**
77 * Print module content
78 *
79 * @return void
80 */
81 public function printContent() {
82 echo $this->content;
83 }
84
85 }