[TASK] Re-work/simplify copyright header in PHP files - Part 6
[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 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
21 */
22 class SelectImageController {
23
24 public $mode = 'rte';
25
26 public $button = 'image';
27
28 protected $content = '';
29
30 /**
31 * Initialize language files
32 */
33 public function __construct() {
34 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.xlf');
35 $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/mod4/locallang.xlf');
36 $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xlf');
37 }
38
39 /**
40 * Main function, rendering the element browser in RTE mode.
41 *
42 * @return void
43 * @todo Define visibility
44 */
45 public function main() {
46 // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
47 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
48 if ($altMountPoints) {
49 $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
50 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
51 // @todo: add this feature for FAL and TYPO3 6.2
52 }
53 }
54 // Rendering type by user function
55 $browserRendered = FALSE;
56 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'])) {
57 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) {
58 $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
59 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
60 if ($browserRenderObj->isValid($this->mode, $this)) {
61 $this->content .= $browserRenderObj->render($this->mode, $this);
62 $browserRendered = TRUE;
63 break;
64 }
65 }
66 }
67 }
68 // If type was not rendered, use default rendering functions
69 if (!$browserRendered) {
70 $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\SelectImage');
71 $GLOBALS['SOBE']->browser->init();
72 $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
73 list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
74 $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
75 $this->content = $GLOBALS['SOBE']->browser->main_rte();
76 }
77 }
78
79 /**
80 * Print module content
81 *
82 * @return void
83 * @todo Define visibility
84 */
85 public function printContent() {
86 echo $this->content;
87 }
88
89 }