Skip to content
Snippets Groups Projects
Commit d2bc8ef5 authored by Fabian Galinski's avatar Fabian Galinski :pouting_cat:
Browse files

Merge branch '74compatibility' into 'master'

TYPO3 7.4 compatibility



See merge request !3
parents bec914e6 0edc3eba
No related branches found
No related tags found
No related merge requests found
Showing
with 1647 additions and 1689 deletions
This diff is collapsed.
<?php
namespace SGalinski\Tinymce4Rte\Controller;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Recordlist\Browser\ElementBrowser;
use TYPO3\CMS\Recordlist\Controller\ElementBrowserController;
use SGalinski\Tinymce4Rte\BrowseLinks;
/**
* Script class for the Element Browser window.
*/
class BrowseLinksController {
public $mode = 'rte';
class BrowseLinksController extends ElementBrowserController {
/**
* @var string
*/
public $button = 'link';
protected $content = '';
/**
* Initialize language files
* @var BrowseLinks
*/
public function __construct() {
$GLOBALS['LANG']->includeLLFile('EXT:tinymce4_rte/mod3/locallang.xlf');
}
public $browser;
/**
* Main function, rendering the element browser in RTE mode.
*
* @return void
* @todo Define visibility
* Initialize controller
*/
public function main() {
// Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
// Clear temporary DB mounts
$tmpMount = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('setTempDBmount');
if (isset($tmpMount)) {
$GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', (int) $tmpMount);
}
// Set temporary DB mounts
$tempDBmount = (int) $GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint');
if ($tempDBmount) {
$altMountPoints = $tempDBmount;
}
if ($altMountPoints) {
$GLOBALS['BE_USER']->groupData['webmounts'] = implode(
',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints))
);
$GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
}
// Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
if ($altMountPoints) {
$altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
// @todo: add this feature for FAL and TYPO3 6.2
}
}
// Render type by user function
$browserRendered = FALSE;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
$browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists(
$browserRenderObj, 'render'
)
) {
if ($browserRenderObj->isValid($this->mode, $this)) {
$this->content .= $browserRenderObj->render($this->mode, $this);
$browserRendered = TRUE;
break;
}
}
}
}
// If type was not rendered, use default rendering functions
if (!$browserRendered) {
$GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'SGalinski\\Tinymce4Rte\\BrowseLinks'
);
$GLOBALS['SOBE']->browser->init();
$modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
$GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
$this->content = $GLOBALS['SOBE']->browser->main_rte();
}
protected function init() {
parent::init();
$lang = $this->getLanguageService();
$lang->includeLLFile('EXT:tinymce4_rte/Resources/Private/Language/locallang_browselinkscontroller.xlf');
$lang->includeLLFile('EXT:tinymce4_rte/Resources/Private/Language/locallang_dialogs.xlf');
$this->mode = 'rte';
}
/**
* Print module content
* Get instance of ElementBrowser
*
* This method shall be overwritten in subclasses
*
* @return void
* @todo Define visibility
* @return ElementBrowser
*/
public function printContent() {
echo $this->content;
protected function getElementBrowserInstance() {
return GeneralUtility::makeInstance(BrowseLinks::class);
}
}
<?php
namespace SGalinski\Tinymce4Rte\Controller;
/**
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
......@@ -15,8 +14,8 @@ namespace SGalinski\Tinymce4Rte\Controller;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Resource;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Resource;
/**
* Render the image attributes and reconstruct magic images, if necessary (and possible)
......@@ -66,27 +65,28 @@ class ImageRenderingController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
* @return string HTML output
*/
public function renderImageAttributes($content = '', $conf) {
$imageAttributes = $this->getImageAttributes();
// It is pretty rare to be in presence of an external image as the default behaviour
// of the RTE is to download the external image and create a local image.
// However, it may happen if the RTE has the flag "disable"
if (!$this->isExternalImage()) {
$fileUid = (int) $imageAttributes['data-htmlarea-file-uid'];
$fileUid = (int)$imageAttributes['data-htmlarea-file-uid'];
if ($fileUid) {
try {
$file = Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
if ($imageAttributes['src'] !== $file->getPublicUrl()) {
// Source file is a processed image
$imageConfiguration = array(
'width' => (int) $imageAttributes['width'],
'height' => (int) $imageAttributes['height']
'width' => (int)$imageAttributes['width'],
'height' => (int)$imageAttributes['height']
);
$processedFile = $this->getMagicImageService()->createMagicImage($file, $imageConfiguration);
$additionalAttributes = array(
'src' => $processedFile->getPublicUrl(),
'title' => $imageAttributes['title'] ? : $file->getProperty('title'),
'alt' => $imageAttributes['alt'] ? : $file->getProperty('alternative'),
'title' => $imageAttributes['title'] ?: $file->getProperty('title'),
'alt' => $imageAttributes['alt'] ?: $file->getProperty('alternative'),
'width' => $processedFile->getProperty('width'),
'height' => $processedFile->getProperty('height'),
);
......@@ -119,12 +119,12 @@ class ImageRenderingController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
protected function getMagicImageService() {
/** @var $magicImageService Resource\Service\MagicImageService */
$magicImageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Service\\MagicImageService');
$magicImageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Service\MagicImageService::class);
// Get RTE configuration
$pageTSConfig = $this->getFrontendObject()->getPagesTSconfig();
if (is_array($pageTSConfig) && is_array($pageTSConfig['RTE.'])) {
$magicImageService->setMagicImageMaximumDimensions($pageTSConfig['RTE.']);
$pageTSConfig = $this->frontendController->getPagesTSconfig();
if (is_array($pageTSConfig) && is_array($pageTSConfig['RTE.']['default.'])) {
$magicImageService->setMagicImageMaximumDimensions($pageTSConfig['RTE.']['default.']);
}
return $magicImageService;
......@@ -146,17 +146,9 @@ class ImageRenderingController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
protected function getLogger() {
/** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
$logManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
$logManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class);
return $logManager->getLogger(get_class($this));
}
/**
* Returns an instance of the Frontend object.
*
* @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
*/
protected function getFrontendObject() {
return $GLOBALS['TSFE'];
}
}
<?php
namespace SGalinski\Tinymce4Rte\Controller;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Recordlist\Browser\ElementBrowser;
use TYPO3\CMS\Recordlist\Controller\ElementBrowserController;
use SGalinski\Tinymce4Rte\SelectImage;
/**
* Script class for the Element Browser window.
* Script class for the Element Browser window to select images in RTE
*/
class SelectImageController {
public $mode = 'rte';
class SelectImageController extends ElementBrowserController {
/**
* @var string
*/
public $button = 'image';
protected $content = '';
/**
* Initialize language files
* @var SelectImage
*/
public function __construct() {
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.xlf');
$GLOBALS['LANG']->includeLLFile('EXT:tinymce4_rte/mod4/locallang.xlf');
}
public $browser;
/**
* Main function, rendering the element browser in RTE mode.
*
* @return void
* @todo Define visibility
* Initialize controller
*/
public function main() {
// Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
if ($altMountPoints) {
$altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
// @todo: add this feature for FAL and TYPO3 6.2
}
}
// Rendering type by user function
$browserRendered = FALSE;
if (is_array(
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering']
)
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) {
$browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists(
$browserRenderObj, 'render'
)
) {
if ($browserRenderObj->isValid($this->mode, $this)) {
$this->content .= $browserRenderObj->render($this->mode, $this);
$browserRendered = TRUE;
break;
}
}
}
}
// If type was not rendered, use default rendering functions
if (!$browserRendered) {
$GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'SGalinski\\Tinymce4Rte\\SelectImage'
);
$GLOBALS['SOBE']->browser->init();
$modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
$GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
$this->content = $GLOBALS['SOBE']->browser->main_rte();
}
protected function init() {
parent::init();
$lang = $this->getLanguageService();
$lang->includeLLFile('EXT:tinymce4_rte/Resources/Private/Language/locallang_selectimagecontroller.xlf');
$lang->includeLLFile('EXT:tinymce4_rte/Resources/Private/Language/locallang_dialogs.xlf');
$this->mode = 'rte';
}
/**
* Print module content
* Get instance of ElementBrowser
*
* This method shall be overwritten in subclasses
*
* @return void
* @todo Define visibility
* @return ElementBrowser
*/
public function printContent() {
echo $this->content;
protected function getElementBrowserInstance() {
return GeneralUtility::makeInstance(SelectImage::class);
}
}
<?php
namespace SGalinski\Tinymce4Rte\Editors;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\Tinymce\Loader;
use TYPO3\CMS\Backend\Form\FormEngine;
use TYPO3\CMS\Backend\Rte\AbstractRte;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
/**
* A RTE using TinyMCE
*/
class RteBase extends AbstractRte {
/**
* Indicates that the tinymce is loaded
*
* @var bool
*/
static protected $coreLoaded = FALSE;
/**
* Draws the RTE as a form field or whatever is needed (inserts JavaApplet, creates iframe, renders ....)
* Default is to output the transformed content in a plain textarea field. This mode is great for debugging transformations!
*
* @param FormEngine $parentObject Reference to parent object, which is an instance of the TCEforms.
* @param string $table The table name
* @param string $field The field name
* @param array $row The current row from which field is being rendered
* @param array $PA Array of standard content for rendering form fields from TCEforms. See TCEforms for details on this. Includes for instance the value and the form field name, java script actions and more.
* @param array $specConf "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
* @param array $thisConfig Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
* @param string $RTEtypeVal Record "type" field value.
* @param string $RTErelPath Relative path for images/links in RTE; this is used when the RTE edits content from static files where the path of such media has to be transformed forth and back!
* @param integer $thePidValue PID value of record (true parent page id)
* @return string HTML code for RTE!
*/
public function drawRTE(
FormEngine $parentObject, $table, $field, $row, $PA, $specConf,
$thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue
) {
/** @var PageRenderer $pageRenderer */
$pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
// render the tinymce textarea
$value = $this->transformContent(
'rte', $PA['itemFormElValue'], $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $thePidValue
);
// render RTE field
$editorId = uniqid();
$width = (GeneralUtility::_GP('M') === 'wizard_rte' ? '100%' : '650px');
$code = $this->triggerField($PA['itemFormElName']);
$code .= '<div style="width: ' . $width . '"><textarea id="editor' . $editorId . '" class="tinymce4_rte"
name="' . htmlspecialchars($PA['itemFormElName']) . '"
rows="20" cols="100">' . GeneralUtility::formatForTextarea($value) . '</textarea></div>';
// add the tinymce code and it's configuration
if (!self::$coreLoaded) {
self::$coreLoaded = TRUE;
$userOrPageProperties = BackendUtility::getModTSconfig($thePidValue, 'RTE');
/** @var Loader $tinyMCE */
$tinyMCE = GeneralUtility::makeInstance('SGalinski\\Tinymce\\Loader');
$tinyMCE->loadConfiguration($userOrPageProperties['properties']['default.']['tinymceConfiguration']);
if ($userOrPageProperties['properties']['default.']['contentCSS'] !== '') {
$contentCssFile = GeneralUtility::getFileAbsFileName(
$userOrPageProperties['properties']['default.']['contentCSS']
);
if (is_file($contentCssFile)) {
$contentCssFile = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') .
PathUtility::stripPathSitePrefix($contentCssFile) . '?' . filemtime($contentCssFile);
$tinyMCE->addConfigurationOption('content_css', $contentCssFile);
}
}
$tinyMCE->addConfigurationOption(
'changeMethod', 'function() {
var TBE_EDITOR = window.TBE_EDITOR || null;
if (TBE_EDITOR && TBE_EDITOR.fieldChanged && typeof TBE_EDITOR.fieldChanged === \'function\') {
TBE_EDITOR.fieldChanged();
}
}'
);
$tinyMCE->loadJsViaPageRenderer($pageRenderer, TRUE);
$imageModule = BackendUtility::getModuleUrl('rtehtmlarea_wizard_select_image');
$linkModule = BackendUtility::getModuleUrl('rtehtmlarea_wizard_element_browser');
$pageRenderer->addJsInlineCode(
'RTEbasic',
'window.RTE = window.RTE || {};
window.RTE.linkToImageModule = ' . GeneralUtility::quoteJSvalue($imageModule) . ';
window.RTE.linkToLinkModule = ' . GeneralUtility::quoteJSvalue($linkModule) . ';'
);
}
// calculate the dedicated RTE configuration
$elementParts = preg_replace('/^(TSFE_EDIT\\[data\\]\\[|data\\[)/', '', $PA['itemFormElName']);
$elementParts = preg_replace('/\\]$/', '', $elementParts);
$elementParts = explode('][', $elementParts);
list($typoscriptConfigurationPid, $pid) = BackendUtility::getTSCpid(
trim($elementParts[0]), trim($elementParts[1]), $thePidValue
);
$rteConfiguration = rawurlencode(
$this->getRteConfiguration($specConf, $RTEtypeVal, $pid, $typoscriptConfigurationPid, $elementParts)
);
// add RTE specific configuration data
$languageId = max($row['sys_language_uid'], 0);
$language = ($GLOBALS['LANG']->lang === '' ? 'default' : $GLOBALS['LANG']->lang);
$pageRenderer->addJsInlineCode(
'RTE' . $editorId,
'window.RTE = window.RTE || {};
window.RTE["editor' . $editorId . '"] = {};
window.RTE["editor' . $editorId . '"].rteConfiguration = "' . $rteConfiguration . '";
window.RTE["editor' . $editorId . '"].typo3ContentLanguage = "' . $language . '";
window.RTE["editor' . $editorId . '"].sys_language_content = parseInt(' . $languageId . ');
'
);
return $code;
}
/**
* @param array $configuration
* @param string $typeValue
* @param int $pid
* @param int $typoscriptConfigurationPid
* @param array $elementParts
* @return string
*/
public function getRteConfiguration(
array $configuration, $typeValue, $pid, $typoscriptConfigurationPid, array $elementParts
) {
$parameters = BackendUtility::getSpecConfParametersFromArray($configuration['rte_transform']['parameters']);
return $elementParts[0] . ':' . $elementParts[1] . ':' . $elementParts[2] . ':' . (int) $pid . ':' .
$typeValue . ':' . (int) $typoscriptConfigurationPid . ':' . $parameters['imgpath'];
}
}
?>
\ No newline at end of file
<?php
namespace SGalinski\Tinymce4Rte;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
/*
* This file is part of the TYPO3 CMS project.
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Base extension class which generates the folder tree.
* Used directly by the RTE.
* RTE class which generates the folder tree.
*/
class FolderTree extends \localFolderTree {
class FolderTree extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView {
/**
* Constructor function of the class
* Will create and return the HTML code for a browsable tree of folders.
* Is based on the mounts found in the internal array ->MOUNTS (set in the constructor)
*
* @return string HTML code for the browsable tree
*/
public function __construct() {
// The backpath is set here to fix problems with relatives path when used in ajax scope
$GLOBALS['BACK_PATH'] = isset($GLOBALS['ajaxID']) ? '../../../' : $GLOBALS['BACK_PATH'];
parent::__construct();
public function getBrowsableTree() {
// TYPO3\CMS\Backend\Controller\FileSystemNavigationFrameController does not set custom parameters on an Ajax expand/collapse request
if (!$GLOBALS['SOBE']->browser->editorNo) {
$scopeData = (string)GeneralUtility::_GP('scopeData');
$scopeHash = (string)GeneralUtility::_GP('scopeHash');
if (!empty($scopeData) && GeneralUtility::hmac($scopeData) === $scopeHash) {
$scopeData = unserialize($scopeData);
if ($scopeData['browser']['editorNo']) {
$GLOBALS['SOBE']->browser->editorNo = $scopeData['browser']['editorNo'];
}
if ($scopeData['browser']['sys_language_content']) {
$GLOBALS['SOBE']->browser->sys_language_content = $scopeData['browser']['sys_language_content'];
}
if ($scopeData['browser']['contentTypo3Language']) {
$GLOBALS['SOBE']->browser->contentTypo3Language = $scopeData['browser']['contentTypo3Language'];
}
}
}
return parent::getBrowsableTree();
}
/**
......@@ -49,17 +54,21 @@ class FolderTree extends \localFolderTree {
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record"
* @return string Wrapping title string.
* @todo Define visibility
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(\'' . $this->getThisScript(
) . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&contentTypo3Charset=' . $GLOBALS['SOBE']->browser->contentTypo3Charset . '&expandFolder=' . rawurlencode(
$folderObject->getCombinedIdentifier()
) . '\');';
$aOnClick = 'return jumpToUrl(\''
. $this->getThisScript()
. 'act=' . $GLOBALS['SOBE']->browser->act
. '&mode=' . $GLOBALS['SOBE']->browser->mode
. '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo
. ($GLOBALS['SOBE']->browser->sys_language_content ? '&sys_language_content=' . $GLOBALS['SOBE']->browser->sys_language_content : '')
. ($GLOBALS['SOBE']->browser->contentTypo3Language ? '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language : '')
. '&expandFolder=' . $this->getJumpToParam($folderObject)
. '\');';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
} else {
return '<span class="typo3-dimmed">' . $title . '</span>';
return '<span class="text-muted">' . $title . '</span>';
}
}
......@@ -68,12 +77,11 @@ class FolderTree extends \localFolderTree {
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param boolean $isExpand If expanded
* @param bool $isExpand If expanded
* @return string Link-wrapped input string
* @access private
*/
public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
if (empty($this->scope)) {
$this->scope = array(
'class' => get_class($this),
......@@ -81,27 +89,20 @@ class FolderTree extends \localFolderTree {
'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
'browser' => array(
'mode' => $GLOBALS['SOBE']->browser->mode,
'act' => $GLOBALS['SOBE']->browser->act,
'editorNo' => $GLOBALS['SOBE']->browser->editorNo
),
);
}
if ($this->thisScript) {
// Activates dynamic AJAX based tree
$scopeData = serialize($this->scope);
$scopeHash = GeneralUtility::hmac($scopeData);
$js = htmlspecialchars(
'Tree.load(' . GeneralUtility::quoteJSvalue(
$cmd
) . ', ' . (int) $isExpand . ', this, ' . GeneralUtility::quoteJSvalue(
$scopeData
) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');'
'act' => $GLOBALS['SOBE']->browser->act
)
);
return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
} else {
return $icon;
if ($GLOBALS['SOBE']->browser->editorNo) {
$this->scope['browser']['editorNo'] = $GLOBALS['SOBE']->browser->editorNo;
}
if ($GLOBALS['SOBE']->browser->sys_language_content) {
$this->scope['browser']['sys_language_content'] = $GLOBALS['SOBE']->browser->sys_language_content;
}
if ($GLOBALS['SOBE']->browser->contentTypo3Language) {
$this->scope['browser']['contentTypo3Language'] = $GLOBALS['SOBE']->browser->contentTypo3Language;
}
}
return parent::PMiconATagWrap($icon, $cmd, $isExpand);
}
}
<?php
namespace SGalinski\Tinymce4Rte\Form\Element;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Html\RteHtmlParser;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use SGalinski\Tinymce\Loader;
/**
* Render rich text editor in FormEngine
*/
class RichTextElement extends AbstractFormElement {
/**
* Main result array as defined in initializeResultArray() of AbstractNode
*
* @var array
*/
protected $resultArray;
/**
* pid of page record the TSconfig is located at.
* This is pid of record if table is not pages, or uid if table is pages
*
* @var int
*/
protected $pidOfPageRecord;
/**
* pid of fixed versioned record.
* This is the pid of the record in normal cases, but is changed to the pid
* of the "mother" record in case the handled record is a versioned overlay
* and "mother" is located at a different pid.
*
* @var int
*/
protected $pidOfVersionedMotherRecord;
/**
* Native, not further processed TsConfig of RTE section for this record on given pid.
*
* Example:
*
* RTE = foo
* RTE.bar = xy
*
* array(
* 'value' => 'foo',
* 'properties' => array(
* 'bar' => 'xy',
* ),
* );
*
* @var array
*/
protected $vanillaRteTsConfig;
/**
* Based on $vanillaRteTsConfig, this property contains "processed" configuration
* where table and type specific RTE setup is merged into 'default.' array.
*
* @var array
*/
protected $processedRteConfiguration;
/**
* Parsed "defaultExtras" TCA
*
* @var array
*/
protected $defaultExtras;
/**
* Indicates that the tinymce is loaded
*
* @var bool
*/
static protected $coreLoaded = FALSE;
/**
* This will render a <textarea> OR RTE area form field,
* possibly with various control/validation features
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render() {
$table = $this->globalOptions['table'];
$fieldName = $this->globalOptions['fieldName'];
$row = $this->globalOptions['databaseRow'];
$parameterArray = $this->globalOptions['parameterArray'];
$backendUser = $this->getBackendUserAuthentication();
$this->resultArray = $this->initializeResultArray();
$this->defaultExtras = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
$this->pidOfPageRecord = $table === 'pages' && MathUtility::canBeInterpretedAsInteger($row['uid']) ? (int)$row['uid'] : (int)$row['pid'];
BackendUtility::fixVersioningPid($table, $row);
$this->pidOfVersionedMotherRecord = (int)$row['pid'];
$this->vanillaRteTsConfig = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pidOfPageRecord));
$this->processedRteConfiguration = BackendUtility::RTEsetup(
$this->vanillaRteTsConfig['properties'],
$table,
$fieldName,
$this->globalOptions['recordTypeValue']
);
$this->resultArray['html'] = $this->getMainHtml($parameterArray, $row);
return $this->resultArray;
}
/**
* Create main HTML elements
*
* @return string Main RTE html
*/
protected function getMainHtml($parameterArray, $row) {
/** @var PageRenderer $pageRenderer */
$pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
// render the tinymce textarea
$value = $this->transformDatabaseContentToEditor($parameterArray['itemFormElValue']);
// This seems to result in:
// _TRANSFORM_bodytext (the handled field name) in case the field is a direct DB field
// _TRANSFORM_vDEF (constant string) in case the RTE is within a flex form
$triggerFieldName = preg_replace('/\\[([^]]+)\\]$/', '[_TRANSFORM_\\1]', $parameterArray['itemFormElName']);
// render RTE field
$editorId = uniqid();
$width = (GeneralUtility::_GP('M') === 'wizard_rte' ? '100%' : '650px');
$code = '<input type="hidden" name="' . htmlspecialchars($triggerFieldName) . '" value="RTE" />';
$code .= '<div style="width: ' . $width . '"><textarea id="editor' . $editorId . '" class="tinymce4_rte"
name="' . htmlspecialchars($parameterArray['itemFormElName']) . '"
rows="20" cols="100">' . GeneralUtility::formatForTextarea($value) . '</textarea></div>';
// add the tinymce code and it's configuration
if (!self::$coreLoaded) {
self::$coreLoaded = TRUE;
/** @var Loader $tinyMCE */
$tinyMCE = GeneralUtility::makeInstance('SGalinski\\Tinymce\\Loader');
$tinyMCE->loadConfiguration($this->processedRteConfiguration['tinymceConfiguration']);
if ($this->processedRteConfiguration['contentCSS'] !== '') {
$contentCssFile = GeneralUtility::getFileAbsFileName(
$this->processedRteConfiguration['contentCSS']
);
if (is_file($contentCssFile)) {
$contentCssFile = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') .
PathUtility::stripPathSitePrefix($contentCssFile) . '?' . filemtime($contentCssFile);
$tinyMCE->addConfigurationOption('content_css', $contentCssFile);
}
}
$tinyMCE->addConfigurationOption(
'changeMethod', 'function() {
var TBE_EDITOR = window.TBE_EDITOR || null;
if (TBE_EDITOR && TBE_EDITOR.fieldChanged && typeof TBE_EDITOR.fieldChanged === \'function\') {
TBE_EDITOR.fieldChanged();
}
}'
);
$tinyMCE->loadJsViaPageRenderer($pageRenderer, TRUE);
$imageModule = BackendUtility::getModuleUrl('rtehtmlarea_wizard_select_image');
$linkModule = BackendUtility::getModuleUrl('rtehtmlarea_wizard_browse_links');
$pageRenderer->addJsInlineCode(
'RTEbasic',
'window.RTEarea = window.RTEarea || {};
window.RTEarea.linkToImageModule = ' . GeneralUtility::quoteJSvalue($imageModule) . ';
window.RTEarea.linkToLinkModule = ' . GeneralUtility::quoteJSvalue($linkModule) . ';'
);
}
// add RTE specific configuration data
$languageId = max($row['sys_language_uid'], 0);
$language = ($GLOBALS['LANG']->lang === '' ? 'default' : $GLOBALS['LANG']->lang);
$pageRenderer->addJsInlineCode(
'RTE' . $editorId,
'window.RTEarea = window.RTEarea || {};
window.RTEarea["editor' . $editorId . '"] = {};
window.RTEarea["editor' . $editorId . '"].rteConfiguration = "' . rawurlencode($this->RTEtsConfigParams()) . '";
window.RTEarea["editor' . $editorId . '"].typo3ContentLanguage = "' . $language . '";
window.RTEarea["editor' . $editorId . '"].editorNo = "editor' . $editorId . '";
window.RTEarea["editor' . $editorId . '"].sys_language_content = parseInt(' . $languageId . ');
'
);
return $code;
}
/**
* A list of parameters that is mostly given as GET/POST to other RTE controllers.
*
* @return string
*/
protected function RTEtsConfigParams() {
$parameters = BackendUtility::getSpecConfParametersFromArray($this->defaultExtras['rte_transform']['parameters']);
$result = array(
$this->globalOptions['table'],
$this->globalOptions['databaseRow']['uid'],
$this->globalOptions['fieldName'],
$this->pidOfVersionedMotherRecord,
$this->globalOptions['recordTypeValue'],
$this->pidOfPageRecord,
$parameters['imgpath'],
);
return implode(':', $result);
}
/**
* Performs transformation of content from database to richtext editor
*
* @param string $value Value to transform.
* @return string Transformed content
*/
protected function transformDatabaseContentToEditor($value) {
// change <strong> to <b>
$value = preg_replace('/<(\\/?)strong/i', '<$1b', $value);
// change <em> to <i>
$value = preg_replace('/<(\\/?)em([^b>]*>)/i', '<$1i$2', $value);
if ($this->defaultExtras['rte_transform']) {
$parameters = BackendUtility::getSpecConfParametersFromArray($this->defaultExtras['rte_transform']['parameters']);
// There must be a mode set for transformation
if ($parameters['mode']) {
/** @var RteHtmlParser $parseHTML */
$parseHTML = GeneralUtility::makeInstance(RteHtmlParser::class);
$parseHTML->init($this->globalOptions['table'] . ':' . $this->globalOptions['fieldName'], $this->pidOfVersionedMotherRecord);
$parseHTML->setRelPath('');
$value = $parseHTML->RTE_transform($value, $this->defaultExtras, 'rte', $this->processedRteConfiguration);
}
}
return $value;
}
/**
* @return BackendUserAuthentication
*/
protected function getBackendUserAuthentication() {
return $GLOBALS['BE_USER'];
}
}
<?php
namespace SGalinski\Tinymce4Rte\Form\Resolver;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Form\NodeResolverInterface;
use SGalinski\Tinymce4Rte\Form\Element\RichTextElement;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Backend\Utility\BackendUtility;
/**
* This resolver will return the RichTextElement render class of ext:rtehtmlarea if RTE is enabled for this field.
*/
class RichTextNodeResolver implements NodeResolverInterface {
/**
* Global options from NodeFactory
*
* @var array
*/
protected $globalOptions;
/**
* Set global options from parent instance
*
* @param array $globalOptions Global options like 'readonly' for all elements
* @return $this
*/
public function setGlobalOptions(array $globalOptions) {
$this->globalOptions = $globalOptions;
return $this;
}
/**
* Returns RichTextElement as class name if RTE widget should be rendered.
*
* @return string|void New class name or void if this resolver does not change current class name.
*/
public function resolve() {
$table = $this->globalOptions['table'];
$fieldName = $this->globalOptions['fieldName'];
$row = $this->globalOptions['databaseRow'];
$parameterArray = $this->globalOptions['parameterArray'];
$backendUser = $this->getBackendUserAuthentication();
if (
// Whole thing is not read only
empty($this->globalOptions['renderReadonly'])
// This field is not read only
&& !$parameterArray['fieldConf']['config']['readOnly']
// If RTE is generally enabled by user settings and RTE object registry can return something valid
&& $backendUser->isRTE()
) {
$specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
// If "richtext" is within defaultExtras
if (isset($specialConfiguration['richtext'])) {
// Operates by reference on $row! 'pid' is changed ...
BackendUtility::fixVersioningPid($table, $row);
list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']);
// If the pid-value is not negative (that is, a pid could NOT be fetched)
if ($tsConfigPid >= 0) {
// Fetch page ts config and do some magic with it to find out if RTE is disabled on TS level.
$rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid));
$rteTcaTypeValue = BackendUtility::getTCAtypeValue($table, $row);
$rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue);
if (!$rteSetupConfiguration['disabled']) {
// Finally, we're sure the editor should really be rendered ...
return RichtextElement::class;
}
}
}
}
return NULL;
}
/**
* @return BackendUserAuthentication
*/
protected function getBackendUserAuthentication() {
return $GLOBALS['BE_USER'];
}
}
<?php
namespace SGalinski\Tinymce4Rte;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Displays the page/file tree for browsing database records or files.
* Used from TCEFORMS an other elements
* In other words: This is the ELEMENT BROWSER!
*
* Adapted for htmlArea RTE by Stanislas Rolland
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class which generates the page tree
*/
class PageTree extends \localPageTree {
class PageTree extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserPageTreeView {
/**
* Create the page navigation tree in HTML
*
* @param array Tree array
* @return string HTML output.
* @todo Define visibility
* @param array Tree array
* @return string HTML output.
*/
public function printTree($treeArr = '') {
$titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
$titleLen = (int)$GLOBALS['BE_USER']->uc['titleLen'];
if (!is_array($treeArr)) {
$treeArr = $this->tree;
}
$out = '';
$c = 0;
foreach ($treeArr as $k => $v) {
$c++;
$bgColorClass = ($c + 1) % 2 ? 'bgColor' : 'bgColor-10';
if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
$arrCol = '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(
$GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"'
) . ' class="c-blinkArrowR" alt="" /></td>';
$bgColorClass = 'bgColor4';
} else {
$arrCol = '<td></td>';
$closeDepth = array();
foreach ($treeArr as $treeItem) {
$classAttr = $treeItem['row']['_CSSCLASS'];
if ($treeItem['isFirst']) {
$out .= '<ul class="list-tree">';
}
$aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue(
$this->getThisScript(
) . 'act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid']
) . ');';
$cEbullet = $this->ext_isLinkable(
$v['row']['doktype'], $v['row']['uid']
) ? '<a href="#" onclick="' . htmlspecialchars(
$aOnClick
) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(
$GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"'
) . ' alt="" /></a>' : '';
// Add CSS classes to the list item
if ($treeItem['hasSub']) {
$classAttr .= ' list-tree-control-open';
}
$selected = '';
if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $treeItem['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
$classAttr .= ' active';
}
$aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $treeItem['row']['uid']) . ');';
$cEbullet = $this->ext_isLinkable($treeItem['row']['doktype'], $treeItem['row']['uid']) ? '<a href="#" class="list-tree-show" onclick="' . htmlspecialchars($aOnClick) . '"><i class="fa fa-caret-square-o-right"></i></a>' : '';
$out .= '
<tr class="' . $bgColorClass . '">
<td nowrap="nowrap"' . ($v['row']['_CSSCLASS'] ? ' class="' . $v['row']['_CSSCLASS'] . '"' : '') . '>' . $v['HTML'] . $this->wrapTitle(
$this->getTitleStr($v['row'], $titleLen), $v['row'], $this->ext_pArrPages
) . '</td>' . $arrCol . '<td>' . $cEbullet . '</td>
</tr>';
}
$out = '
<li' . ($classAttr ? ' class="' . trim($classAttr) . '"' : '') . '>
<span class="list-tree-group">
' . $cEbullet . '
<span class="list-tree-icon">' . $treeItem['HTML'] . '</span>
' . $this->wrapTitle($this->getTitleStr($treeItem['row'], $titleLen), $treeItem['row'], $this->ext_pArrPages) . '
</span>
';
if (!$treeItem['hasSub']) {
$out .= '</li>';
}
<!--
Navigation Page Tree:
-->
<table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
' . $out . '
</table>';
// We have to remember if this is the last one
// on level X so the last child on level X+1 closes the <ul>-tag
if ($treeItem['isLast']) {
$closeDepth[$treeItem['invertedDepth']] = 1;
}
// If this is the last one and does not have subitems, we need to close
// the tree as long as the upper levels have last items too
if ($treeItem['isLast'] && !$treeItem['hasSub']) {
for ($i = $treeItem['invertedDepth']; $closeDepth[$i] == 1; $i++) {
$closeDepth[$i] = 0;
$out .= '</ul></li>';
}
}
}
$out = '<ul class="list-tree list-tree-root">' . $out . '</ul>';
return $out;
}
......
This diff is collapsed.
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
// Registering soft reference parser for img tags in RTE content
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser']['rtehtmlarea_images'] =
'&SGalinski\Tinymce4Rte\Hook\SoftReferenceHook';
?>
\ No newline at end of file
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
// Adding soft reference keys in tt_content configuration
// htmlArea RTE soft reference keys are inserted in front so that their tokens are inserted first
$GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] = 'typolink_tag' .
($GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] ? ',' .
$GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] : '');
$tempTables = array('pages', 'tt_content');
foreach ($tempTables as $table) {
foreach ($GLOBALS['TCA'][$table]['columns'] as $column => $config) {
if ($config['config']['softref']) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['config']['softref'], 'images')) {
// Remove obsolete soft reference key 'images'
// The references from RTE content to the original images are handled with the key 'rtehtmlarea_images'.
$softReferences = 'rtehtmlarea_images,' . \TYPO3\CMS\Core\Utility\GeneralUtility::rmFromList(
'images', $config['config']['softref']
);
$GLOBALS['TCA'][$table]['columns'][$column]['config']['softref'] = $softReferences;
}
} else {
if ($config['config']['type'] == 'text') {
$GLOBALS['TCA'][$table]['columns'][$column]['config']['softref'] = 'rtehtmlarea_images,typolink_tag';
}
}
}
}
unset($tempTables);
?>
\ No newline at end of file
<?php
defined('TYPO3_MODE') or die();
// Adding soft reference keys in pages configuration
// htmlArea RTE soft reference keys are inserted in front so that their tokens are inserted first
foreach ($GLOBALS['TCA']['pages']['columns'] as $column => $config) {
if ($config['config']['softref']) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['config']['softref'], 'images')) {
// Remove obsolete soft reference key 'images'
// The references from RTE content to the original images are handled with the key 'rtehtmlarea_images'.
$softReferences = 'rtehtmlarea_images,' . \TYPO3\CMS\Core\Utility\GeneralUtility::rmFromList('images', $config['config']['softref']);
$GLOBALS['TCA']['pages']['columns'][$column]['config']['softref'] = $softReferences;
}
} else {
if ($config['config']['type'] === 'text') {
$GLOBALS['TCA']['pages']['columns'][$column]['config']['softref'] = 'rtehtmlarea_images,typolink_tag';
}
}
}
<?php
defined('TYPO3_MODE') or die();
// Adding soft reference keys in tt_content configuration
// htmlArea RTE soft reference keys are inserted in front so that their tokens are inserted first
$GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] = 'typolink_tag' . ($GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] ? ',' . $GLOBALS['TCA']['tt_content']['columns']['header']['config']['softref'] : '');
foreach ($GLOBALS['TCA']['tt_content']['columns'] as $column => $config) {
if ($config['config']['softref']) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($config['config']['softref'], 'images')) {
// Remove obsolete soft reference key 'images'
// The references from RTE content to the original images are handled with the key 'rtehtmlarea_images'.
$softReferences = 'rtehtmlarea_images,' . \TYPO3\CMS\Core\Utility\GeneralUtility::rmFromList('images', $config['config']['softref']);
$GLOBALS['TCA']['tt_content']['columns'][$column]['config']['softref'] = $softReferences;
}
} else {
if ($config['config']['type'] === 'text') {
$GLOBALS['TCA']['tt_content']['columns'][$column]['config']['softref'] = 'rtehtmlarea_images,typolink_tag';
}
}
}
<?php
$MCONF['name'] = 'rtehtmlarea_wizard_element_browser';
$MCONF['name'] = 'rtehtmlarea_wizard_browse_links';
$MCONF['script'] = '_DISPATCH';
$MCONF['access'] = '';
<?php
/**
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
......@@ -11,18 +11,16 @@
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Displays the page/file tree for browsing database records or files.
* Used from TCEFORMS an other elements
* In other words: This is the ELEMENT BROWSER!
*
* Adapted for htmlArea RTE by Stanislas Rolland
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
* @author Stanislas Rolland <typo3(arobas)sjbr.ca>
*/
// Make instance:
$SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('SGalinski\\Tinymce4Rte\\Controller\\BrowseLinksController');
$SOBE->main();
$SOBE->printContent();
$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\SGalinski\Tinymce4Rte\Controller\BrowseLinksController::class);
$elementBrowserController->main();
$elementBrowserController->printContent();
File moved
<?php
/**
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
......@@ -11,14 +11,12 @@
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Displays image selector for the RTE
*
* @author Kasper Skårhøj <kasper@typo3.com>
* @author Stanislas Rolland <typo3(arobas)jbr.ca>
*/
// Make instance:
$SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('SGalinski\\Tinymce4Rte\\Controller\\SelectImageController');
$SOBE->main();
$SOBE->printContent();
$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\SGalinski\Tinymce4Rte\Controller\SelectImageController::class);
$elementBrowserController->main();
$elementBrowserController->printContent();
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:36Z" product-name="rtehtmlarea">
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file t3:id="1415814975" source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:36Z" product-name="rtehtmlarea">
<header/>
<body>
<trans-unit id="removeLink" xml:space="preserve">
<trans-unit id="removeLink">
<source>Remove link</source>
</trans-unit>
<trans-unit id="uploadImage" xml:space="preserve">
<trans-unit id="uploadImage">
<source>Upload Image</source>
</trans-unit>
<trans-unit id="update" xml:space="preserve">
<trans-unit id="update">
<source>Update</source>
</trans-unit>
<trans-unit id="path" xml:space="preserve">
<trans-unit id="path">
<source>Path</source>
</trans-unit>
<trans-unit id="page" xml:space="preserve">
<trans-unit id="page">
<source>Page</source>
</trans-unit>
<trans-unit id="file" xml:space="preserve">
<trans-unit id="file">
<source>File</source>
</trans-unit>
<trans-unit id="extUrl" xml:space="preserve">
<trans-unit id="extUrl">
<source>External URL</source>
</trans-unit>
<trans-unit id="email" xml:space="preserve">
<trans-unit id="email">
<source>Email</source>
</trans-unit>
<trans-unit id="special" xml:space="preserve">
<trans-unit id="special">
<source>Special</source>
</trans-unit>
<trans-unit id="folderTree" xml:space="preserve">
<trans-unit id="folderTree">
<source>Folder Tree</source>
</trans-unit>
<trans-unit id="files" xml:space="preserve">
<trans-unit id="files">
<source>Files</source>
</trans-unit>
<trans-unit id="target" xml:space="preserve">
<trans-unit id="folders">
<source>Folders</source>
</trans-unit>
<trans-unit id="target">
<source>Target</source>
</trans-unit>
<trans-unit id="linkRelationship" xml:space="preserve">
<trans-unit id="linkRelationship">
<source>Relationship</source>
</trans-unit>
<trans-unit id="target_popUpWindow" xml:space="preserve">
<trans-unit id="target_popUpWindow">
<source>Open in window</source>
</trans-unit>
<trans-unit id="target_popUpWindow_width" xml:space="preserve">
<trans-unit id="target_popUpWindow_width">
<source>Width</source>
</trans-unit>
<trans-unit id="target_popUpWindow_height" xml:space="preserve">
<trans-unit id="target_popUpWindow_height">
<source>Height</source>
</trans-unit>
<trans-unit id="anchor_class" xml:space="preserve">
<trans-unit id="anchor_class">
<source>Style</source>
</trans-unit>
<trans-unit id="anchor_title" xml:space="preserve">
<trans-unit id="anchor_title">
<source>Title</source>
</trans-unit>
<trans-unit id="newWindow" xml:space="preserve">
<trans-unit id="newWindow">
<source>New window</source>
</trans-unit>
<trans-unit id="top" xml:space="preserve">
<trans-unit id="top">
<source>Top</source>
</trans-unit>
<trans-unit id="none" xml:space="preserve">
<trans-unit id="none">
<source>None - new link!</source>
</trans-unit>
<trans-unit id="pageTree" xml:space="preserve">
<trans-unit id="pageTree">
<source>Page tree</source>
</trans-unit>
<trans-unit id="contentElements" xml:space="preserve">
<trans-unit id="contentElements">
<source>Content elements</source>
</trans-unit>
<trans-unit id="selectRecords" xml:space="preserve">
<trans-unit id="selectRecords">
<source>Select Records</source>
</trans-unit>
<trans-unit id="addToList" xml:space="preserve">
<trans-unit id="addToList">
<source>Add to list...</source>
</trans-unit>
<trans-unit id="info" xml:space="preserve">
<trans-unit id="info">
<source>Info</source>
</trans-unit>
<trans-unit id="emailAddress" xml:space="preserve">
<trans-unit id="emailAddress">
<source>Email address</source>
</trans-unit>
<trans-unit id="setLink" xml:space="preserve">
<trans-unit id="setLink">
<source>Set Link</source>
</trans-unit>
<trans-unit id="clickToRedrawFullSize" xml:space="preserve">
<trans-unit id="clickToRedrawFullSize">
<source>Image is larger than shown here! Click to redraw with full size.</source>
</trans-unit>
<trans-unit id="findDragDrop" xml:space="preserve">
<trans-unit id="findDragDrop">
<source>Find your image, then click on the image and drag it into the editor in the main window!</source>
</trans-unit>
<trans-unit id="noWebFolder" xml:space="preserve">
<trans-unit id="noWebFolder">
<source>You cannot drag images from this folder (yellow) because it is internal on the server.</source>
</trans-unit>
<trans-unit id="currentLink" xml:space="preserve">
<trans-unit id="currentLink">
<source>Current Link</source>
</trans-unit>
<trans-unit id="invalidChar" xml:space="preserve">
<trans-unit id="invalidChar">
<source>ERROR: Invalid character found in file path (%s). Cannot add the file!</source>
</trans-unit>
<trans-unit id="page_id" xml:space="preserve">
<trans-unit id="page_id">
<source>Page Id</source>
</trans-unit>
<trans-unit id="query_parameters" xml:space="preserve">
<trans-unit id="query_parameters">
<source>Query parameters</source>
</trans-unit>
</body>
......
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file t3:id="1415814933" source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:35Z" product-name="rtehtmlarea">
<header/>
<body>
<trans-unit id="OK">
<source>OK</source>
</trans-unit>
<trans-unit id="Cancel">
<source>Cancel</source>
</trans-unit>
<trans-unit id="Delete">
<source>Delete</source>
</trans-unit>
<trans-unit id="Close">
<source>Close</source>
</trans-unit>
<trans-unit id="Not set">
<source>Not set</source>
</trans-unit>
<trans-unit id="General">
<source>General</source>
</trans-unit>
<trans-unit id="Alignment:">
<source>Text alignment:</source>
</trans-unit>
<trans-unit id="Alignment not set">
<source>Not set</source>
</trans-unit>
<trans-unit id="Left">
<source>Left</source>
</trans-unit>
<trans-unit id="Center">
<source>Center</source>
</trans-unit>
<trans-unit id="Right">
<source>Right</source>
</trans-unit>
<trans-unit id="Texttop">
<source>Texttop</source>
</trans-unit>
<trans-unit id="Absmiddle">
<source>Absmiddle</source>
</trans-unit>
<trans-unit id="Baseline">
<source>Baseline</source>
</trans-unit>
<trans-unit id="Absbottom">
<source>Absbottom</source>
</trans-unit>
<trans-unit id="Bottom">
<source>Bottom</source>
</trans-unit>
<trans-unit id="Middle">
<source>Middle</source>
</trans-unit>
<trans-unit id="Top">
<source>Top</source>
</trans-unit>
<trans-unit id="Justify">
<source>Justify</source>
</trans-unit>
<trans-unit id="Float:">
<source>Float:</source>
</trans-unit>
<trans-unit id="Non-floating">
<source>Non-floating</source>
</trans-unit>
<trans-unit id="Layout">
<source>Layout</source>
</trans-unit>
<trans-unit id="Spacing and padding">
<source>Spacing and padding</source>
</trans-unit>
<trans-unit id="Horizontal:">
<source>Horizontal:</source>
</trans-unit>
<trans-unit id="Horizontal padding">
<source>Horizontal padding</source>
</trans-unit>
<trans-unit id="Vertical:">
<source>Vertical:</source>
</trans-unit>
<trans-unit id="Vertical padding">
<source>Vertical padding</source>
</trans-unit>
<trans-unit id="Border">
<source>Border</source>
</trans-unit>
<trans-unit id="Border thickness:">
<source>Border thickness:</source>
</trans-unit>
<trans-unit id="Leave empty for no border">
<source>Leave empty for no border</source>
</trans-unit>
<trans-unit id="Insert/Modify Link">
<source>Insert/Modify Link</source>
</trans-unit>
<trans-unit id="Insert link">
<source>Insert link</source>
</trans-unit>
<trans-unit id="Modify link">
<source>Modify link</source>
</trans-unit>
<trans-unit id="URL:">
<source>URL:</source>
</trans-unit>
<trans-unit id="link_href_tooltip">
<source>Enter the link URL here</source>
</trans-unit>
<trans-unit id="link_url_required">
<source>Please enter the URL where this link points to</source>
</trans-unit>
<trans-unit id="Title (tooltip):">
<source>Title:</source>
</trans-unit>
<trans-unit id="link_title_tooltip">
<source>Enter the link tooltip here</source>
</trans-unit>
<trans-unit id="Target:">
<source>Target:</source>
</trans-unit>
<trans-unit id="link_target_tooltip">
<source>Select the name of the target frame</source>
</trans-unit>
<trans-unit id="target_none">
<source>None (use implicit)</source>
</trans-unit>
<trans-unit id="target_blank">
<source>New window (_blank)</source>
</trans-unit>
<trans-unit id="target_self">
<source>Same frame (_self)</source>
</trans-unit>
<trans-unit id="target_top">
<source>Top frame (_top)</source>
</trans-unit>
<trans-unit id="target_other">
<source>Other frame</source>
</trans-unit>
<trans-unit id="Insert Custom Element">
<source>Insert Custom Element</source>
</trans-unit>
<trans-unit id="Insert Table">
<source>Insert Table</source>
</trans-unit>
<trans-unit id="Dimension">
<source>Dimension</source>
</trans-unit>
<trans-unit id="Rows:">
<source>Rows:</source>
</trans-unit>
<trans-unit id="Number of rows">
<source>Number of rows</source>
</trans-unit>
<trans-unit id="You must enter a number of rows">
<source>You must enter a number of rows</source>
</trans-unit>
<trans-unit id="Cols:">
<source>Cols:</source>
</trans-unit>
<trans-unit id="Number of columns">
<source>Number of columns</source>
</trans-unit>
<trans-unit id="You must enter a number of columns">
<source>You must enter a number of columns</source>
</trans-unit>
<trans-unit id="Width:">
<source>Width:</source>
</trans-unit>
<trans-unit id="Width of the table">
<source>Width of the table</source>
</trans-unit>
<trans-unit id="Percent">
<source>Percent</source>
</trans-unit>
<trans-unit id="Pixels">
<source>Pixels</source>
</trans-unit>
<trans-unit id="Em">
<source>Em</source>
</trans-unit>
<trans-unit id="Width unit">
<source>Width unit</source>
</trans-unit>
<trans-unit id="Text alignment">
<source>Text alignment</source>
</trans-unit>
<trans-unit id="Where the table should float">
<source>Specifies where the table should float</source>
</trans-unit>
<trans-unit id="Cell spacing:">
<source>Cell spacing:</source>
</trans-unit>
<trans-unit id="Space between adjacent cells">
<source>Space between adjacent cells</source>
</trans-unit>
<trans-unit id="Cell padding:">
<source>Cell padding:</source>
</trans-unit>
<trans-unit id="Space between content and border in cell">
<source>Space between content and border in cell</source>
</trans-unit>
<trans-unit id="Insert Image">
<source>Insert/Modify Image</source>
</trans-unit>
<trans-unit id="Insert image">
<source>Insert image</source>
</trans-unit>
<trans-unit id="Modify image">
<source>Modify image</source>
</trans-unit>
<trans-unit id="Image URL:">
<source>Image URL:</source>
</trans-unit>
<trans-unit id="Enter the image URL here">
<source>Enter the image URL here</source>
</trans-unit>
<trans-unit id="Preview">
<source>Preview</source>
</trans-unit>
<trans-unit id="Preview the image in a new window">
<source>Preview the image in a new window</source>
</trans-unit>
<trans-unit id="Alternate text:">
<source>Alternate text:</source>
</trans-unit>
<trans-unit id="For browsers that dont support images">
<source>For browsers that don't support images</source>
</trans-unit>
<trans-unit id="Where the image should float">
<source>Specifies where the image should float</source>
</trans-unit>
<trans-unit id="Image alignment:">
<source>Image alignment:</source>
</trans-unit>
<trans-unit id="Positioning of this image">
<source>Positioning of this image relative to text</source>
</trans-unit>
<trans-unit id="Image Preview">
<source>Image Preview</source>
</trans-unit>
<trans-unit id="image_url_first">
<source>You have to enter the image URL first</source>
</trans-unit>
<trans-unit id="image_url_required">
<source>You must enter the image URL</source>
</trans-unit>
<trans-unit id="Select Color">
<source>Select Color</source>
</trans-unit>
<trans-unit id="Insert/Modify Acronym">
<source>Insert/Modify Acronym or Abbreviation</source>
</trans-unit>
<trans-unit id="About HTMLArea">
<source>About htmlArea RTE</source>
</trans-unit>
<trans-unit id="About">
<source>About</source>
</trans-unit>
<trans-unit id="free_editor">
<source>A free and open-source editor for &lt;textarea&gt; fields, featuring integration with TYPO3.</source>
</trans-unit>
<trans-unit id="Browser support">
<source>Browser support</source>
</trans-unit>
<trans-unit id="Mozilla_or_IE">
<source>For Firefox 1.5+, SeaMonkey 1.0+, Safari 3.0.4+, Google Chrome 1.0+ and Opera 9.62+ on any platform, and for Internet Explorer 9.0+ on Windows.</source>
</trans-unit>
<trans-unit id="product_documentation">
<source>For more information, please visit:</source>
</trans-unit>
<trans-unit id="All rights reserved.">
<source>All Rights Reserved.</source>
</trans-unit>
<trans-unit id="License">
<source>License</source>
</trans-unit>
<trans-unit id="htmlArea License (based on BSD license)">
<source>htmlArea RTE License, based on BSD License</source>
</trans-unit>
<trans-unit id="Plugins">
<source>Plugins</source>
</trans-unit>
<trans-unit id="Name">
<source>Name</source>
</trans-unit>
<trans-unit id="Developer">
<source>Developer</source>
</trans-unit>
<trans-unit id="Sponsored by">
<source>Sponsored by</source>
</trans-unit>
<trans-unit id="The following plugins have been loaded.">
<source>The following plugins have been loaded.</source>
</trans-unit>
<trans-unit id="No plugins have been loaded.">
<source>No plugins have been loaded.</source>
</trans-unit>
<trans-unit id="User agent reports:">
<source>User agent reports:</source>
</trans-unit>
<trans-unit id="style">
<source>Paragraph:</source>
</trans-unit>
<trans-unit id="Block style label">
<source>Block style:</source>
</trans-unit>
<trans-unit id="text_style">
<source>Text style:</source>
</trans-unit>
<trans-unit id="LeftToRight">
<source>Left to right</source>
</trans-unit>
<trans-unit id="RightToLeft">
<source>Right to left</source>
</trans-unit>
<trans-unit id="Language">
<source>Language</source>
</trans-unit>
<trans-unit id="Text direction">
<source>Text direction</source>
</trans-unit>
<trans-unit id="Language:">
<source>Language:</source>
</trans-unit>
<trans-unit id="Text direction:">
<source>Text direction:</source>
</trans-unit>
<trans-unit id="No language mark">
<source>No language</source>
</trans-unit>
<trans-unit id="Remove language mark">
<source>Remove language</source>
</trans-unit>
<trans-unit id="statusBarStyle">
<source>Style</source>
</trans-unit>
<trans-unit id="statusBarReady">
<source>Ready</source>
</trans-unit>
<trans-unit id="word">
<source>word</source>
</trans-unit>
<trans-unit id="words">
<source>words</source>
</trans-unit>
</body>
</file>
</xliff>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment