[TASK] Update TYPO3 version in ext_emconf.php and composer.json
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / FolderTree.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea;
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 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * RTE class which generates the folder tree.
21 */
22 class FolderTree extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView {
23
24 /**
25 * Will create and return the HTML code for a browsable tree of folders.
26 * Is based on the mounts found in the internal array ->MOUNTS (set in the constructor)
27 *
28 * @return string HTML code for the browsable tree
29 */
30 public function getBrowsableTree() {
31 // TYPO3\CMS\Backend\Controller\FileSystemNavigationFrameController does not set custom parameters on an Ajax expand/collapse request
32 if (!$GLOBALS['SOBE']->browser->editorNo) {
33 $scopeData = (string)GeneralUtility::_GP('scopeData');
34 $scopeHash = (string)GeneralUtility::_GP('scopeHash');
35 if (!empty($scopeData) && GeneralUtility::hmac($scopeData) === $scopeHash) {
36 $scopeData = unserialize($scopeData);
37 if ($scopeData['browser']['editorNo']) {
38 $GLOBALS['SOBE']->browser->editorNo = $scopeData['browser']['editorNo'];
39 }
40 if ($scopeData['browser']['sys_language_content']) {
41 $GLOBALS['SOBE']->browser->sys_language_content = $scopeData['browser']['sys_language_content'];
42 }
43 if ($scopeData['browser']['contentTypo3Language']) {
44 $GLOBALS['SOBE']->browser->contentTypo3Language = $scopeData['browser']['contentTypo3Language'];
45 }
46 }
47 }
48 return parent::getBrowsableTree();
49 }
50
51 /**
52 * Wrapping the title in a link, if applicable.
53 *
54 * @param string $title Title, ready for output.
55 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record"
56 * @return string Wrapping title string.
57 */
58 public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
59 if ($this->ext_isLinkable($folderObject)) {
60 $aOnClick = 'return jumpToUrl(\''
61 . $this->getThisScript()
62 . 'act=' . $GLOBALS['SOBE']->browser->act
63 . '&mode=' . $GLOBALS['SOBE']->browser->mode
64 . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo
65 . ($GLOBALS['SOBE']->browser->sys_language_content ? '&sys_language_content=' . $GLOBALS['SOBE']->browser->sys_language_content : '')
66 . ($GLOBALS['SOBE']->browser->contentTypo3Language ? '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language : '')
67 . '&expandFolder=' . $this->getJumpToParam($folderObject)
68 . '\');';
69 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
70 } else {
71 return '<span class="typo3-dimmed">' . $title . '</span>';
72 }
73 }
74
75 /**
76 * Wrap the plus/minus icon in a link
77 *
78 * @param string $icon HTML string to wrap, probably an image tag.
79 * @param string $cmd Command for 'PM' get var
80 * @param bool $isExpand If expanded
81 * @return string Link-wrapped input string
82 * @access private
83 */
84 public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
85 if (empty($this->scope)) {
86 $this->scope = array(
87 'class' => get_class($this),
88 'script' => $this->thisScript,
89 'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
90 'browser' => array(
91 'mode' => $GLOBALS['SOBE']->browser->mode,
92 'act' => $GLOBALS['SOBE']->browser->act
93 )
94 );
95 if ($GLOBALS['SOBE']->browser->editorNo) {
96 $this->scope['browser']['editorNo'] = $GLOBALS['SOBE']->browser->editorNo;
97 }
98 if ($GLOBALS['SOBE']->browser->sys_language_content) {
99 $this->scope['browser']['sys_language_content'] = $GLOBALS['SOBE']->browser->sys_language_content;
100 }
101 if ($GLOBALS['SOBE']->browser->contentTypo3Language) {
102 $this->scope['browser']['contentTypo3Language'] = $GLOBALS['SOBE']->browser->contentTypo3Language;
103 }
104 }
105 return parent::PMiconATagWrap($icon, $cmd, $isExpand);
106 }
107
108 }