[TASK] Use fully qualified name resolution in PHP 5.5
[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 */
44 public function main() {
45 // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
46 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
47 if ($altMountPoints) {
48 $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
49 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
50 // @todo: add this feature for FAL and TYPO3 6.2
51 }
52 }
53 // Rendering type by user function
54 $browserRendered = FALSE;
55 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'])) {
56 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) {
57 $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
58 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
59 if ($browserRenderObj->isValid($this->mode, $this)) {
60 $this->content .= $browserRenderObj->render($this->mode, $this);
61 $browserRendered = TRUE;
62 break;
63 }
64 }
65 }
66 }
67 // If type was not rendered, use default rendering functions
68 if (!$browserRendered) {
69 $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\SelectImage::class);
70 $GLOBALS['SOBE']->browser->init();
71 $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
72 list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
73 $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
74 $this->content = $GLOBALS['SOBE']->browser->main_rte();
75 }
76 }
77
78 /**
79 * Print module content
80 *
81 * @return void
82 */
83 public function printContent() {
84 echo $this->content;
85 }
86
87 }