Feature #17714 » rtehtmlarea_extension_v4.patch
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (working copy) | ||
---|---|---|
'showhelp', // Has no content yet
|
||
);
|
||
|
||
// Hide these toolbar buttons not implemented in Safari
|
||
var $conf_toolbar_safari_hide = array (
|
||
'strikethrough',
|
||
'line',
|
||
'orderedlist',
|
||
'unorderedlist',
|
||
);
|
||
// Hide toolbar buttons not implemented in client browsers
|
||
var $hideButtonsFromClient = array (
|
||
'safari' => array('strikethrough', 'line', 'orderedlist', 'unorderedlist'),
|
||
'opera' => array('copy', 'cut', 'paste'),
|
||
);
|
||
|
||
// Hide these toolbar buttons not implemented in Opera
|
||
var $conf_toolbar_opera_hide = array (
|
||
'copy',
|
||
'cut',
|
||
'paste',
|
||
);
|
||
|
||
// Always show these toolbar buttons (TYPO3 button name)
|
||
var $conf_toolbar_show = array (
|
||
'undo',
|
||
... | ... | |
var $defaultHotKeyList = 'selectall, bold, italic, underline, strikethrough, left, center, right, justifyfull, formatblock, paste, cleanword, undo, redo';
|
||
// Conversion array: TYPO3 button names to htmlArea button names
|
||
var $conf_toolbar_convert = array (
|
||
var $convertToolbarForHtmlAreaArray = array (
|
||
// 'TYPO3 name' => 'htmlArea name'
|
||
'fontstyle' => 'FontName',
|
||
'fontsize' => 'FontSize',
|
||
... | ... | |
var $spellCheckerMode;
|
||
var $quickTagHideTags;
|
||
var $specConf;
|
||
var $toolBar = array(); // Save the buttons for the toolbar
|
||
var $toolbar_level_size; // The size for each level in the toolbar:
|
||
var $toolbar = array(); // Save the buttons for the toolbar
|
||
var $toolbar_level_size; // The size for each level in the toolbar:
|
||
var $toolbarOrderArray = array();
|
||
var $pluginEnableList;
|
||
var $pluginEnableArray = array();
|
||
var $pluginEnableArrayMultiple = array();
|
||
private $pluginEnabledArray = array(); // Array of plugin id's enabled in the current RTE editing area
|
||
private $pluginEnabledCumulativeArray = array();// Cumulative array of plugin id's enabled so far in any of the RTE editing areas of the form
|
||
private $registeredPlugins = array(); // Array of registered plugins indexed by their plugin Id's
|
||
|
||
/**
|
||
* Returns true if the RTE is available. Here you check if the browser requirements are met.
|
||
* If there are reasons why the RTE cannot be displayed you simply enter them as text in ->errorLog
|
||
... | ... | |
$rteConfBrowser = $this->conf_supported_browser;
|
||
if (!$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['enableInOpera9']) unset($rteConfBrowser['opera']);
|
||
if (is_array($rteConfBrowser)) {
|
||
reset($rteConfBrowser);
|
||
while(list ($browser, $browserConf) = each($rteConfBrowser)){
|
||
foreach ($rteConfBrowser as $browser => $browserConf) {
|
||
if ($browser == $this->client['BROWSER']) {
|
||
// Config for Browser found, check it:
|
||
if (is_array($browserConf)) {
|
||
reset($browserConf);
|
||
while(list ($browserConfNr, $browserConfSub) = each($browserConf)){
|
||
foreach ($browserConf as $browserConfNr => $browserConfSub) {
|
||
if ($browserConfSub['version'] <= $this->client['VERSION'] || empty($browserConfSub['version'])) {
|
||
// Version is correct
|
||
if ($browserConfSub['system'] == $this->client['SYSTEM'] || empty($browserConfSub['system'])) {
|
||
... | ... | |
$rteIsAvailable = 1;
|
||
}// End of System
|
||
}// End of Version
|
||
}// End of while-BrowserSubpart
|
||
}// End of foreach-BrowserSubpart
|
||
} else {
|
||
// no config for this browser found, so all versions or system with this browsers are allow
|
||
$rteIsAvailable = 1;
|
||
}
|
||
} // End of Browser Check
|
||
} // while: Browser Check
|
||
} // foreach: Browser Check
|
||
} else {
|
||
// no Browser config for this RTE-Editor, so all Clients are allow
|
||
}
|
||
... | ... | |
* @param integer PID value of record (true parent page id)
|
||
* @return string HTML code for RTE!
|
||
*/
|
||
function drawRTE(&$pObj,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue) {
|
||
global $BE_USER,$LANG, $TYPO3_DB, $TYPO3_CONF_VARS;
|
||
$this->TCEform = $pObj;
|
||
|
||
function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue) {
|
||
global $BE_USER, $LANG, $TYPO3_DB, $TYPO3_CONF_VARS;
|
||
|
||
$this->TCEform =& $parentObject;
|
||
$inline =& $this->TCEform->inline;
|
||
$LANG->includeLLFile('EXT:' . $this->ID . '/locallang.xml');
|
||
$this->client = $this->clientInfo();
|
||
$this->typoVersion = t3lib_div::int_from_ver(TYPO3_version);
|
||
... | ... | |
|
||
// Draw form element:
|
||
if ($this->debugMode) { // Draws regular text area (debug mode)
|
||
$item = parent::drawRTE($pObj,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue);
|
||
$item = parent::drawRTE($this->TCEform, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue);
|
||
} else { // Draw real RTE
|
||
|
||
/* =======================================
|
||
... | ... | |
* TOOLBAR CONFIGURATION
|
||
* =======================================
|
||
*/
|
||
// Traverse registered plugins
|
||
if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'])) {
|
||
foreach($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['plugins'] as $pluginId => $pluginObjectConfiguration) {
|
||
$plugin = &t3lib_div::getUserObj($pluginObjectConfiguration['objectReference']);
|
||
if (is_object($plugin)) {
|
||
if ($plugin->main($this)) {
|
||
$this->registeredPlugins[$pluginId] = $plugin;
|
||
$this->pluginButton[$pluginId] = $plugin->getPluginButtons();
|
||
$this->pluginList .= ','.$pluginId;
|
||
$this->convertToolbarForHtmlAreaArray = array_unique(array_merge($this->convertToolbarForHtmlAreaArray, $plugin->getConvertToolbarForHtmlAreaArray()));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// htmlArea plugins list
|
||
$this->pluginEnableArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
|
||
$this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
|
||
$hidePlugins = array();
|
||
if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
|
||
if ($this->client['BROWSER'] == 'msie') $hidePlugins[] = 'Acronym';
|
||
... | ... | |
$this->thisConfig['hideTableOperationsInToolbar'] = 0;
|
||
$this->thisConfig['disableEnterParagraphs'] = 1;
|
||
}
|
||
$this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
|
||
$this->pluginEnabledArray = array_diff($this->pluginEnabledArray, $hidePlugins);
|
||
// Toolbar
|
||
$this->setToolBar();
|
||
$this->setToolbar();
|
||
// Check if some plugins need to be disabled
|
||
$this->setPlugins();
|
||
|
||
// Merge the list of enabled plugins with the lists from the previous RTE editing areas on the same form
|
||
$this->pluginEnableArrayMultiple[$pObj->RTEcounter] = $this->pluginEnableArray;
|
||
if ($pObj->RTEcounter > 1 && isset($this->pluginEnableArrayMultiple[$pObj->RTEcounter-1]) && is_array($this->pluginEnableArrayMultiple[$pObj->RTEcounter-1])) {
|
||
$this->pluginEnableArrayMultiple[$pObj->RTEcounter] = array_unique(array_values(array_merge($this->pluginEnableArray,$this->pluginEnableArrayMultiple[$pObj->RTEcounter-1])));
|
||
$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = $this->pluginEnabledArray;
|
||
if ($this->TCEform->RTEcounter > 1 && isset($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1]) && is_array($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])) {
|
||
$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] = array_unique(array_values(array_merge($this->pluginEnabledArray,$this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter-1])));
|
||
}
|
||
|
||
/* =======================================
|
||
* PLUGIN-SPECIFIC CONFIGURATION
|
||
* =======================================
|
||
*/
|
||
|
||
if ($this->isPluginEnable('SpellChecker')) {
|
||
if ($this->isPluginEnabled('SpellChecker')) {
|
||
// Set the language of the content for the SpellChecker
|
||
$this->spellCheckerLanguage = $this->contentISOLanguage;
|
||
$this->spellCheckerTypo3Language = $this->contentTypo3Language;
|
||
... | ... | |
$RTEWidth = isset($BE_USER->userTS['options.']['RTESmallWidth']) ? $BE_USER->userTS['options.']['RTESmallWidth'] : '530';
|
||
$RTEHeight = isset($BE_USER->userTS['options.']['RTESmallHeight']) ? $BE_USER->userTS['options.']['RTESmallHeight'] : '380';
|
||
$RTEWidth = $RTEWidth + ($pObj->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeWidthIncrement']) ? $BE_USER->userTS['options.']['RTELargeWidthIncrement'] : '150') : 0);
|
||
$RTEWidth = $RTEWidth + ($this->TCEform->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeWidthIncrement']) ? $BE_USER->userTS['options.']['RTELargeWidthIncrement'] : '150') : 0);
|
||
$RTEWidth -= ($inline->getStructureDepth() > 0 ? ($inline->getStructureDepth()+1)*$inline->getLevelMargin() : 0);
|
||
$RTEHeight = $RTEHeight + ($pObj->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeHeightIncrement']) ? $BE_USER->userTS['options.']['RTELargeHeightIncrement'] : 0) : 0);
|
||
$RTEHeight = $RTEHeight + ($this->TCEform->docLarge ? (isset($BE_USER->userTS['options.']['RTELargeHeightIncrement']) ? $BE_USER->userTS['options.']['RTELargeHeightIncrement'] : 0) : 0);
|
||
$editorWrapWidth = $RTEWidth . 'px';
|
||
$editorWrapHeight = $RTEHeight . 'px';
|
||
$this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:' . $RTEHeight . 'px; width:'.$RTEWidth.'px; border: 1px solid black; padding: 2px 0px 2px 2px;';
|
||
... | ... | |
// Preloading the pageStyle
|
||
$filename = trim($this->thisConfig['contentCSS']) ? trim($this->thisConfig['contentCSS']) : 'EXT:' . $this->ID . '/htmlarea/plugins/DynamicCSS/dynamiccss.css';
|
||
$pObj->additionalCode_pre['loadCSS'] = '
|
||
$this->TCEform->additionalCode_pre['loadCSS'] = '
|
||
<link rel="alternate stylesheet" type="text/css" href="' . $this->getFullFileName($filename) . '" />';
|
||
// Loading the editor skin
|
||
... | ... | |
}
|
||
$this->editorCSS = $skinFilename;
|
||
$this->editedContentCSS = $skinDir . '/htmlarea-edited-content.css';
|
||
$pObj->additionalCode_pre['loadCSS'] .= '
|
||
$this->TCEform->additionalCode_pre['loadCSS'] .= '
|
||
<link rel="alternate stylesheet" type="text/css" href="' . $this->editedContentCSS . '" />';
|
||
$pObj->additionalCode_pre['loadCSS'] .= '
|
||
|
||
// Additional icons from registered plugins
|
||
foreach ($this->pluginEnabledCumulativeArray[$this->TCEform->RTEcounter] as $pluginId) {
|
||
if (is_object($this->registeredPlugins[$pluginId])) {
|
||
$pathToSkin = $this->registeredPlugins[$pluginId]->getPathToSkin();
|
||
if ($pathToSkin) {
|
||
$this->TCEform->additionalCode_pre['loadCSS'] .= '
|
||
<link rel="stylesheet" type="text/css" href="' . $this->httpTypo3Path . t3lib_extMgm::siteRelPath($this->registeredPlugins[$pluginId]->getExtensionKey()) . $pathToSkin . '" />';
|
||
}
|
||
}
|
||
}
|
||
// Main skin
|
||
$this->TCEform->additionalCode_pre['loadCSS'] .= '
|
||
<link rel="stylesheet" type="text/css" href="' . $this->editorCSS . '" />';
|
||
|
||
// Loading JavaScript files and code
|
||
$pObj->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($pObj->RTEcounter);
|
||
$pObj->additionalJS_pre['loadJScode'] = $this->loadJScode($pObj->RTEcounter);
|
||
$this->TCEform->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter);
|
||
$this->TCEform->additionalJS_pre['loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
|
||
/* =======================================
|
||
* DRAW THE EDITOR
|
||
... | ... | |
}
|
||
// Register RTE windows
|
||
$pObj->RTEwindows[] = $PA['itemFormElName'];
|
||
$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
|
||
// Check if wizard_rte called this for fullscreen edtition; if so, change the size of the RTE to fullscreen using JS
|
||
if (basename(PATH_thisScript) == 'wizard_rte.php') {
|
||
... | ... | |
$editorWrapWidth = '100%';
|
||
$editorWrapHeight = '100%';
|
||
$this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border: 1px solid black; padding: 2px 0px 2px 2px;';
|
||
$pObj->additionalJS_post[] = $this->setRTEsizeByJS('RTEarea'.$pObj->RTEcounter, $height, $width);
|
||
$this->TCEform->additionalJS_post[] = $this->setRTEsizeByJS('RTEarea'.$this->TCEform->RTEcounter, $height, $width);
|
||
}
|
||
// Register RTE in JS:
|
||
$pObj->additionalJS_post[] = $this->registerRTEinJS($pObj->RTEcounter, $table, $row['uid'], $field);
|
||
$this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field);
|
||
// Set the save option for the RTE:
|
||
$pObj->additionalJS_submit[] = $this->setSaveRTE($pObj->RTEcounter, $pObj->formName, htmlspecialchars($PA['itemFormElName']));
|
||
$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, htmlspecialchars($PA['itemFormElName']));
|
||
// Draw the textarea
|
||
$visibility = 'hidden';
|
||
$item = $this->triggerField($PA['itemFormElName']).'
|
||
<div id="pleasewait' . $pObj->RTEcounter . '" class="pleasewait" style="display: none;" >' . $LANG->getLL('Please wait') . '</div>
|
||
<div id="editorWrap' . $pObj->RTEcounter . '" class="editorWrap" style="width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
|
||
<textarea id="RTEarea'.$pObj->RTEcounter.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div::deHSCentities(htmlspecialchars($this->RTEdivStyle)).'">'.t3lib_div::formatForTextarea($value).'</textarea>
|
||
<div id="pleasewait' . $this->TCEform->RTEcounter . '" class="pleasewait" style="display: none;" >' . $LANG->getLL('Please wait') . '</div>
|
||
<div id="editorWrap' . $this->TCEform->RTEcounter . '" class="editorWrap" style="width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
|
||
<textarea id="RTEarea'.$this->TCEform->RTEcounter.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div::deHSCentities(htmlspecialchars($this->RTEdivStyle)).'">'.t3lib_div::formatForTextarea($value).'</textarea>
|
||
</div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '<div id="HTMLAreaLog"></div>' : '') . '
|
||
';
|
||
}
|
||
... | ... | |
*
|
||
*/
|
||
function setToolBar() {
|
||
function setToolbar() {
|
||
global $BE_USER;
|
||
|
||
$this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
|
||
... | ... | |
columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
|
||
cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
|
||
}
|
||
|
||
// Additional buttons from registered plugins
|
||
foreach($this->registeredPlugins as $pluginId => $plugin) {
|
||
if ($this->isPluginEnabled($pluginId)) {
|
||
$this->defaultToolbarOrder = $plugin->addButtonsToToolbar();
|
||
}
|
||
}
|
||
$toolbarOrder = $this->thisConfig['toolbarOrder'] ? $this->thisConfig['toolbarOrder'] : $this->defaultToolbarOrder;
|
||
// Getting rid of undefined buttons
|
||
... | ... | |
}
|
||
}
|
||
if (is_array($this->thisConfig['showButtons.'])) {
|
||
reset($this->thisConfig['showButtons.']);
|
||
while(list($button,$value) = each($this->thisConfig['showButtons.'])) {
|
||
if ($value) $show[] = $button;
|
||
foreach ($this->thisConfig['showButtons.'] as $buttonId => $value) {
|
||
if ($value) $show[] = $buttonId;
|
||
}
|
||
$show = array_unique($show);
|
||
}
|
||
... | ... | |
|
||
// Hiding buttons of disabled plugins
|
||
$hideButtons = array('space', 'bar', 'linebreak');
|
||
reset($this->pluginButton);
|
||
while(list($plugin, $buttonList) = each($this->pluginButton) ) {
|
||
if(!$this->isPluginEnable($plugin)) {
|
||
foreach ($this->pluginButton as $pluginId => $buttonList) {
|
||
if (!$this->isPluginEnabled($pluginId)) {
|
||
$buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
|
||
foreach($buttonArray as $button) {
|
||
foreach ($buttonArray as $button) {
|
||
$hideButtons[] = $button;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Hiding labels of disabled plugins
|
||
reset($this->pluginLabel);
|
||
while(list($plugin, $label) = each($this->pluginLabel) ) {
|
||
if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
|
||
}
|
||
// Hiding buttons not implemented in Safari
|
||
if ($this->client['BROWSER'] == 'safari') {
|
||
reset($this->conf_toolbar_safari_hide);
|
||
while(list(, $button) = each($this->conf_toolbar_safari_hide) ) {
|
||
$hideButtons[] = $button;
|
||
foreach ($this->pluginLabel as $pluginId => $label) {
|
||
if (!$this->isPluginEnabled($pluginId)) {
|
||
$hideButtons[] = $label;
|
||
}
|
||
}
|
||
|
||
// Hiding buttons not implemented in Opera
|
||
if ($this->client['BROWSER'] == 'opera') {
|
||
reset($this->conf_toolbar_opera_hide);
|
||
while(list(, $button) = each($this->conf_toolbar_opera_hide) ) {
|
||
$hideButtons[] = $button;
|
||
// Hiding buttons not implemented in some clients
|
||
foreach ($this->hideButtonsFromClient as $client => $buttonArray) {
|
||
if ($this->client['BROWSER'] == $client) {
|
||
foreach($buttonArray as $buttonId) {
|
||
$hideButtons[] = $buttonId;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Hiding the buttons
|
||
$show = array_diff($show, $this->conf_toolbar_hide, $hideButtons, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1));
|
||
// Adding the always show buttons
|
||
$show = array_unique(array_merge($show, $this->conf_toolbar_show));
|
||
$toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show));
|
||
reset($this->conf_toolbar_show);
|
||
while(list(,$button) = each($this->conf_toolbar_show)) {
|
||
if(!in_array($button, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $button;
|
||
foreach ($this->conf_toolbar_show as $buttonId) {
|
||
if (!in_array($buttonId, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $buttonId;
|
||
}
|
||
|
||
// Getting rid of the buttons for which we have no position
|
||
$show = array_intersect($show, $toolbarOrder);
|
||
$this->toolBar = $show;
|
||
$this->toolbar = $show;
|
||
}
|
||
/**
|
||
... | ... | |
global $TYPO3_CONF_VARS;
|
||
|
||
$hideButtons = array();
|
||
|
||
// Disabling the plugins if their buttons are not in the toolbar
|
||
$hidePlugins = array();
|
||
reset($this->pluginButton);
|
||
while(list($plugin, $buttonList) = each($this->pluginButton) ) {
|
||
$buttonArray = t3lib_div::trimExplode(',',$buttonList,1);
|
||
foreach ($this->pluginButton as $pluginId => $buttonList) {
|
||
$buttonArray = t3lib_div::trimExplode(',', $buttonList, 1);
|
||
$showPlugin = false;
|
||
while(list(,$button) = each($buttonArray) ) {
|
||
if (in_array($button,$this->toolBar)) $showPlugin = true;
|
||
foreach ($buttonArray as $button) {
|
||
if (in_array($button, $this->toolbar)) {
|
||
$showPlugin = true;
|
||
}
|
||
}
|
||
if (!$showPlugin) $hidePlugins[] = $plugin;
|
||
if (!$showPlugin) {
|
||
$hidePlugins[] = $pluginId;
|
||
}
|
||
}
|
||
|
||
if($this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']) $hidePlugins[] = 'ContextMenu';
|
||
if($this->thisConfig['disableSelectColor']) $hidePlugins[] = 'SelectColor';
|
||
if($this->thisConfig['disableTYPO3Browsers']) $hidePlugins[] = 'TYPO3Browsers';
|
||
if(!$this->thisConfig['enableWordClean'] || !is_array($this->thisConfig['enableWordClean.'])) $hidePlugins[] = 'TYPO3HtmlParser';
|
||
if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
|
||
$this->pluginEnabledArray = array_diff($this->pluginEnabledArray, $hidePlugins);
|
||
|
||
$this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins);
|
||
|
||
// Hiding labels of disabled plugins
|
||
reset($this->pluginLabel);
|
||
while(list($plugin, $label) = each($this->pluginLabel) ) {
|
||
if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label;
|
||
foreach ($this->pluginLabel as $pluginId => $label) {
|
||
if (!$this->isPluginEnabled($pluginId)) {
|
||
$hideButtons[] = $label;
|
||
}
|
||
}
|
||
$this->toolBar = array_diff($this->toolBar, $hideButtons);
|
||
$this->toolbar = array_diff($this->toolbar, $hideButtons);
|
||
|
||
// Renaming buttons of replacement plugins
|
||
if( $this->isPluginEnable('SelectColor') ) {
|
||
$this->conf_toolbar_convert['textcolor'] = 'CO-forecolor';
|
||
$this->conf_toolbar_convert['bgcolor'] = 'CO-hilitecolor';
|
||
if( $this->isPluginEnabled('SelectColor') ) {
|
||
$this->convertToolbarForHtmlAreaArray['textcolor'] = 'CO-forecolor';
|
||
$this->convertToolbarForHtmlAreaArray['bgcolor'] = 'CO-hilitecolor';
|
||
}
|
||
}
|
||
... | ... | |
* @return string buttonname (htmlarea-name)
|
||
*/
|
||
function convertToolBarForHTMLArea($button) {
|
||
return $this->conf_toolbar_convert[$button];
|
||
function convertToolbarForHTMLArea($button) {
|
||
return $this->convertToolbarForHtmlAreaArray[$button];
|
||
}
|
||
/**
|
||
... | ... | |
}
|
||
/**
|
||
* Return the HTML-Code for loading the Javascript-Files
|
||
* Return the HTML code for loading the Javascript files
|
||
*
|
||
* @return string the html-code for loading the Javascript-Files
|
||
*/
|
||
function loadJSfiles($number) {
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string the html code for loading the Javascript Files
|
||
*/
|
||
function loadJSfiles($RTEcounter) {
|
||
global $TYPO3_CONF_VARS;
|
||
|
||
return '
|
||
$loadJavascriptCode = '
|
||
<script type="text/javascript">
|
||
/*<![CDATA[*/
|
||
var i=1;
|
||
... | ... | |
var _spellChecker_charset = "' . $this->spellCheckerCharset . '";
|
||
var _spellChecker_mode = "' . $this->spellCheckerMode . '";
|
||
/*]]>*/
|
||
</script>
|
||
<script type="text/javascript" src="' . $this->buildJSMainLangFile($number) . '"></script>
|
||
</script>';
|
||
$loadJavascriptCode .= '
|
||
<script type="text/javascript" src="' . $this->buildJSMainLangFile($RTEcounter) . '"></script>
|
||
<script type="text/javascript" src="' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"></script>
|
||
';
|
||
return $loadJavascriptCode;
|
||
}
|
||
|
||
/**
|
||
* Return the JS-Code to initialize the Editor
|
||
* Return the inline Javascript code for initializing the RTE
|
||
*
|
||
* @return string the html-code for loading the Javascript-Files
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string the inline Javascript code for initializing the RTE
|
||
*/
|
||
|
||
function loadJScode($number) {
|
||
function loadJScode($RTEcounter) {
|
||
global $TSFE, $TYPO3_CONF_VARS;
|
||
|
||
$loadPluginCode = '';
|
||
$pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
|
||
while( list(,$plugin) = each($pluginArray) ) {
|
||
if (in_array($plugin, $this->pluginEnableArrayMultiple[$number])) {
|
||
$loadPluginCode .= '
|
||
HTMLArea.loadPlugin("' . $plugin . '", true, "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/plugins/' . $plugin . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $plugin)) . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', $plugin, $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '");';
|
||
}
|
||
foreach ($this->pluginEnabledCumulativeArray[$RTEcounter] as $pluginId) {
|
||
$extensionKey = is_object($this->registeredPlugins[$pluginId]) ? $this->registeredPlugins[$pluginId]->getExtensionKey() : $this->ID;
|
||
$loadPluginCode .= '
|
||
HTMLArea.loadPlugin("' . $pluginId . '", true, "' . $this->writeJSFileToTypo3tempDir('EXT:' . $extensionKey . '/htmlarea/plugins/' . $pluginId . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $pluginId)) . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', $pluginId, $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '");';
|
||
}
|
||
return (!$this->is_FE() ? '' : '
|
||
' . '/*<![CDATA[*/') . ($this->is_FE() ? '' : '
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Return the JS-Code for Register the RTE in JS
|
||
* Return the Javascript code for configuring the RTE
|
||
*
|
||
* @param integer $number: The index number of the RTE.
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
* @param string $table: The table that includes this RTE (optional, necessary for IRRE).
|
||
* @param string $uid: The uid of that table that includes this RTE (optional, necessary for IRRE).
|
||
* @param string $field: The field of that record that includes this RTE (optional).
|
||
*
|
||
* @return string the JS-Code for Register the RTE in JS
|
||
* @return string the Javascript code for configuring the RTE
|
||
*/
|
||
|
||
function registerRTEinJS($number, $table='', $uid='', $field='') {
|
||
global $TSFE, $TYPO3_CONF_VARS;
|
||
$registerRTEinJSString = (!$this->is_FE() ? '' : '
|
||
function registerRTEinJS($RTEcounter, $table='', $uid='', $field='') {
|
||
global $TYPO3_CONF_VARS;
|
||
|
||
$configureRTEInJavascriptString = (!$this->is_FE() ? '' : '
|
||
' . '/*<![CDATA[*/') . '
|
||
RTEarea['.$number.'] = new Object();
|
||
RTEarea['.$number.']["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
|
||
RTEarea['.$number.']["number"] = '.$number.';
|
||
RTEarea['.$number.']["id"] = "RTEarea'.$number.'";
|
||
RTEarea['.$number.']["enableWordClean"] = ' . (trim($this->thisConfig['enableWordClean'])?'true':'false') . ';
|
||
RTEarea['.$number.']["htmlRemoveComments"] = ' . (trim($this->thisConfig['removeComments'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disableEnterParagraphs"] = ' . (trim($this->thisConfig['disableEnterParagraphs'])?'true':'false') . ';
|
||
RTEarea['.$number.']["removeTrailingBR"] = ' . (trim($this->thisConfig['removeTrailingBR'])?'true':'false') . ';
|
||
RTEarea['.$number.']["useCSS"] = ' . (trim($this->thisConfig['useCSS'])?'true':'false') . ';
|
||
RTEarea['.$number.']["keepButtonGroupTogether"] = ' . (trim($this->thisConfig['keepButtonGroupTogether'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
|
||
RTEarea['.$number.']["statusBar"] = ' . (trim($this->thisConfig['showStatusBar'])?'true':'false') . ';
|
||
RTEarea['.$number.']["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
|
||
RTEarea['.$number.']["useHTTPS"] = ' . ((trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'])?'true':'false') . ';
|
||
RTEarea['.$number.']["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';
|
||
RTEarea['.$number.']["tceformsNested"] = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(true) : '[]') . ';';
|
||
RTEarea['.$RTEcounter.'] = new Object();
|
||
RTEarea['.$RTEcounter.']["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
|
||
RTEarea['.$RTEcounter.']["number"] = '.$RTEcounter.';
|
||
RTEarea['.$RTEcounter.']["id"] = "RTEarea'.$RTEcounter.'";
|
||
RTEarea['.$RTEcounter.']["enableWordClean"] = ' . (trim($this->thisConfig['enableWordClean'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["htmlRemoveComments"] = ' . (trim($this->thisConfig['removeComments'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableEnterParagraphs"] = ' . (trim($this->thisConfig['disableEnterParagraphs'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["removeTrailingBR"] = ' . (trim($this->thisConfig['removeTrailingBR'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["useCSS"] = ' . (trim($this->thisConfig['useCSS'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["keepButtonGroupTogether"] = ' . (trim($this->thisConfig['keepButtonGroupTogether'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["statusBar"] = ' . (trim($this->thisConfig['showStatusBar'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["useHTTPS"] = ' . ((trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["tceformsNested"] = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(true) : '[]') . ';';
|
||
// The following properties apply only to the backend
|
||
if (!$this->is_FE()) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["sys_language_content"] = "' . $this->contentLanguageUid . '";
|
||
RTEarea['.$number.']["typo3ContentLanguage"] = "' . $this->contentTypo3Language . '";
|
||
RTEarea['.$number.']["typo3ContentCharset"] = "' . $this->contentCharset . '";
|
||
RTEarea['.$number.']["enablePersonalDicts"] = ' . ($this->spellCheckerPersonalDicts ? 'true' : 'false') . ';
|
||
RTEarea['.$number.']["userUid"] = "' . $this->userUid . '";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["sys_language_content"] = "' . $this->contentLanguageUid . '";
|
||
RTEarea['.$RTEcounter.']["typo3ContentLanguage"] = "' . $this->contentTypo3Language . '";
|
||
RTEarea['.$RTEcounter.']["typo3ContentCharset"] = "' . $this->contentCharset . '";
|
||
RTEarea['.$RTEcounter.']["enablePersonalDicts"] = ' . ($this->spellCheckerPersonalDicts ? 'true' : 'false') . ';
|
||
RTEarea['.$RTEcounter.']["userUid"] = "' . $this->userUid . '";';
|
||
}
|
||
|
||
// Setting the plugin flags
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["plugin"] = new Object();';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["plugin"] = new Object();';
|
||
$pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
|
||
reset($pluginArray);
|
||
while( list(,$plugin) = each($pluginArray) ) {
|
||
if ($this->isPluginEnable($plugin)) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["plugin"]["'.$plugin.'"] = true;';
|
||
foreach ($pluginArray as $pluginId) {
|
||
if ($this->isPluginEnabled($pluginId)) {
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["plugin"]["'.$pluginId.'"] = true;';
|
||
}
|
||
}
|
||
|
||
// Setting the buttons configuration
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"] = new Object();';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"] = new Object();';
|
||
if (is_array($this->thisConfig['buttons.'])) {
|
||
reset($this->thisConfig['buttons.']);
|
||
while( list($buttonIndex,$conf) = each($this->thisConfig['buttons.']) ) {
|
||
foreach ($this->thisConfig['buttons.'] as $buttonIndex => $conf) {
|
||
$button = substr($buttonIndex, 0, -1);
|
||
if (in_array($button,$this->toolBar)) {
|
||
if (in_array($button,$this->toolbar)) {
|
||
$indexButton = 0;
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"]["'.$button.'"] = {';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"]["'.$button.'"] = {';
|
||
if (is_array($conf)) {
|
||
reset($conf);
|
||
while (list($propertyName,$conf1) = each($conf)) {
|
||
foreach ($conf as $propertyName => $conf1) {
|
||
$property = $propertyName;
|
||
if ($indexButton) {
|
||
$registerRTEinJSString .= ', ';
|
||
$configureRTEInJavascriptString .= ', ';
|
||
}
|
||
if (is_array($conf1)) {
|
||
$property = substr($property, 0, -1);
|
||
$indexProperty = 0;
|
||
$registerRTEinJSString .= '"'.$property.'" : {';
|
||
reset($conf1);
|
||
while (list($property1Name,$conf2) = each($conf1)) {
|
||
$configureRTEInJavascriptString .= '"'.$property.'" : {';
|
||
foreach ($conf1 as $property1Name => $conf2) {
|
||
$property1 = $property1Name;
|
||
if ($indexProperty) {
|
||
$registerRTEinJSString .= ', ';
|
||
$configureRTEInJavascriptString .= ', ';
|
||
}
|
||
if (is_array($conf2)) {
|
||
$property1 = substr($property1, 0, -1);
|
||
$indexProperty1 = 0;
|
||
$registerRTEinJSString .= '"'.$property1.'" : {';
|
||
reset($conf2);
|
||
while (list($property2Name,$conf3) = each($conf2)) {
|
||
$configureRTEInJavascriptString .= '"'.$property1.'" : {';
|
||
foreach ($conf2 as $property2Name => $conf3) {
|
||
$property2 = $property2Name;
|
||
if ($indexProperty1) {
|
||
$registerRTEinJSString .= ', ';
|
||
$configureRTEInJavascriptString .= ', ';
|
||
}
|
||
if (is_array($conf3)) {
|
||
$property2 = substr($property2, 0, -1);
|
||
$indexProperty2 = 0;
|
||
$registerRTEinJSString .= '"'.$property2.'" : {';
|
||
reset($conf3);
|
||
while (list($property3Name,$conf4) = each($conf3)) {
|
||
$configureRTEInJavascriptString .= '"'.$property2.'" : {';
|
||
foreach($conf3 as $property3Name => $conf4) {
|
||
$property3 = $property3Name;
|
||
if ($indexProperty2) {
|
||
$registerRTEinJSString .= ', ';
|
||
$configureRTEInJavascriptString .= ', ';
|
||
}
|
||
if (!is_array($conf4)) {
|
||
$registerRTEinJSString .= '"'.$property3.'" : '.($conf4?'"'.$conf4.'"':'false');
|
||
$configureRTEInJavascriptString .= '"'.$property3.'" : '.($conf4?'"'.$conf4.'"':'false');
|
||
}
|
||
$indexProperty2++;
|
||
}
|
||
$registerRTEinJSString .= '}';
|
||
$configureRTEInJavascriptString .= '}';
|
||
} else {
|
||
$registerRTEinJSString .= '"'.$property2.'" : '.($conf3?'"'.$conf3.'"':'false');
|
||
$configureRTEInJavascriptString .= '"'.$property2.'" : '.($conf3?'"'.$conf3.'"':'false');
|
||
}
|
||
$indexProperty1++;
|
||
}
|
||
$registerRTEinJSString .= '}';
|
||
$configureRTEInJavascriptString .= '}';
|
||
} else {
|
||
$registerRTEinJSString .= '"'.$property1.'" : '.($conf2?'"'.$conf2.'"':'false');
|
||
$configureRTEInJavascriptString .= '"'.$property1.'" : '.($conf2?'"'.$conf2.'"':'false');
|
||
}
|
||
$indexProperty++;
|
||
}
|
||
$registerRTEinJSString .= '}';
|
||
$configureRTEInJavascriptString .= '}';
|
||
} else {
|
||
$registerRTEinJSString .= '"'.$property.'" : '.($conf1?'"'.$conf1.'"':'false');
|
||
$configureRTEInJavascriptString .= '"'.$property.'" : '.($conf1?'"'.$conf1.'"':'false');
|
||
}
|
||
$indexButton++;
|
||
}
|
||
}
|
||
$registerRTEinJSString .= '};';
|
||
$configureRTEInJavascriptString .= '};';
|
||
}
|
||
}
|
||
}
|
||
|
||
// Deprecated inserttag button configuration
|
||
if (in_array('inserttag', $this->toolBar) && trim($this->thisConfig['hideTags'])) {
|
||
if (in_array('inserttag', $this->toolbar) && trim($this->thisConfig['hideTags'])) {
|
||
if (!is_array($this->thisConfig['buttons.']['inserttag.'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"]["inserttag"] = new Object();
|
||
RTEarea['.$number.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"]["inserttag"] = new Object();
|
||
RTEarea['.$RTEcounter.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
|
||
} elseif (!$this->thisConfig['buttons.']['inserttag.']['denyTags']) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"]["inserttag"]["denyTags"] = "'.implode(',', t3lib_div::trimExplode(',', $this->thisConfig['hideTags'], 1)).'";';
|
||
}
|
||
}
|
||
|
||
// Setting the list of tags to be removed if specified in the RTE config
|
||
if (trim($this->thisConfig['removeTags'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["htmlRemoveTags"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTags'], 1)) . ')$/i;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["htmlRemoveTags"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTags'], 1)) . ')$/i;';
|
||
}
|
||
|
||
// Setting the list of tags to be removed with their contents if specified in the RTE config
|
||
if (trim($this->thisConfig['removeTagsAndContents'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["htmlRemoveTagsAndContents"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTagsAndContents'], 1)) . ')$/i;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["htmlRemoveTagsAndContents"] = /^(' . implode('|', t3lib_div::trimExplode(',', $this->thisConfig['removeTagsAndContents'], 1)) . ')$/i;';
|
||
}
|
||
|
||
// Process default style configuration
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["defaultPageStyle"] = "' . $this->hostURL . $this->buildJSFile('css', $this->buildStyleSheet(), 'css') . '";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["defaultPageStyle"] = "' . $this->hostURL . $this->buildJSFile('css', $this->buildStyleSheet(), 'css') . '";';
|
||
|
||
// Setting the pageStyle
|
||
$filename = trim($this->thisConfig['contentCSS']) ? trim($this->thisConfig['contentCSS']) : 'EXT:' . $this->ID . '/htmlarea/plugins/DynamicCSS/dynamiccss.css';
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["pageStyle"] = "' . $this->getFullFileName($filename) .'";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["pageStyle"] = "' . $this->getFullFileName($filename) .'";';
|
||
|
||
// Process colors configuration
|
||
if ( $this->isPluginEnable('SelectColor') ) {
|
||
$registerRTEinJSString .= $this->buildJSColorsConfig($number);
|
||
if ( $this->isPluginEnabled('SelectColor') ) {
|
||
$configureRTEInJavascriptString .= $this->buildJSColorsConfig($RTEcounter);
|
||
}
|
||
|
||
// Process classes configuration
|
||
if ($this->isPluginEnable('InlineCSS') || $this->isPluginEnable('DynamicCSS')) {
|
||
$registerRTEinJSString .= $this->buildJSClassesConfig($number);
|
||
if ($this->isPluginEnabled('InlineCSS') || $this->isPluginEnabled('DynamicCSS')) {
|
||
$configureRTEInJavascriptString .= $this->buildJSClassesConfig($RTEcounter);
|
||
}
|
||
|
||
// Process font faces configuration
|
||
if (in_array('fontstyle',$this->toolBar)) {
|
||
$registerRTEinJSString .= $this->buildJSFontFacesConfig($number);
|
||
if (in_array('fontstyle',$this->toolbar)) {
|
||
$configureRTEInJavascriptString .= $this->buildJSFontFacesConfig($RTEcounter);
|
||
}
|
||
|
||
// Process paragraphs configuration
|
||
if (in_array('formatblock',$this->toolBar)) {
|
||
$registerRTEinJSString .= $this->buildJSParagraphsConfig($number);
|
||
if (in_array('formatblock',$this->toolbar)) {
|
||
$configureRTEInJavascriptString .= $this->buildJSParagraphsConfig($RTEcounter);
|
||
}
|
||
|
||
// Process font sizes configuration
|
||
if (in_array('fontsize',$this->toolBar)) {
|
||
$registerRTEinJSString .= $this->buildJSFontSizesConfig($number);
|
||
if (in_array('fontsize',$this->toolbar)) {
|
||
$configureRTEInJavascriptString .= $this->buildJSFontSizesConfig($RTEcounter);
|
||
}
|
||
|
||
if ($this->isPluginEnable('TableOperations')) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["hideTableOperationsInToolbar"] = ' . (trim($this->thisConfig['hideTableOperationsInToolbar']) ? 'true' : 'false') . ';
|
||
RTEarea['.$number.']["disableLayoutFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableLayoutFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disableAlignmentFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableAlignmentFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disableSpacingFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableSpacingFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disableBordersFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableBordersFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$number.']["disableColorFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableColorFieldsetInTableOperations'])?'true':'false') . ';';
|
||
if ($this->isPluginEnabled('TableOperations')) {
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["hideTableOperationsInToolbar"] = ' . (trim($this->thisConfig['hideTableOperationsInToolbar']) ? 'true' : 'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableLayoutFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableLayoutFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableAlignmentFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableAlignmentFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableSpacingFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableSpacingFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableBordersFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableBordersFieldsetInTableOperations'])?'true':'false') . ';
|
||
RTEarea['.$RTEcounter.']["disableColorFieldsetInTableOperations"] = ' . (trim($this->thisConfig['disableColorFieldsetInTableOperations'])?'true':'false') . ';';
|
||
// // Deprecated toggleborders button configuration
|
||
if (in_array('toggleborders',$this->toolBar) && $this->thisConfig['keepToggleBordersInToolbar']) {
|
||
if (in_array('toggleborders',$this->toolbar) && $this->thisConfig['keepToggleBordersInToolbar']) {
|
||
if (!is_array($this->thisConfig['buttons.']['toggleborders.'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"]["toggleborders"] = new Object();
|
||
RTEarea['.$number.']["buttons"]["toggleborders"]["keepInToolbar"] = true;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"]["toggleborders"] = new Object();
|
||
RTEarea['.$RTEcounter.']["buttons"]["toggleborders"]["keepInToolbar"] = true;';
|
||
} elseif (!$this->thisConfig['buttons.']['toggleborders.']['keepInToolbar']) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["buttons"]["toggleborders"]["keepInToolbar"] = true;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["buttons"]["toggleborders"]["keepInToolbar"] = true;';
|
||
}
|
||
}
|
||
}
|
||
|
||
if ($this->isPluginEnable('Acronym')) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["acronymUrl"] = "' . $this->buildJSFile('acronym_'.$this->contentLanguageUid, $this->buildJSAcronymArray()) . '";';
|
||
if ($this->isPluginEnabled('Acronym')) {
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["acronymUrl"] = "' . $this->buildJSFile('acronym_'.$this->contentLanguageUid, $this->buildJSAcronymArray()) . '";';
|
||
}
|
||
|
||
if ($this->isPluginEnable('TYPO3Browsers')) {
|
||
$registerRTEinJSString .= $this->buildJSClassesAnchorConfig($number);
|
||
if ($this->isPluginEnabled('TYPO3Browsers')) {
|
||
$configureRTEInJavascriptString .= $this->buildJSClassesAnchorConfig($RTEcounter);
|
||
}
|
||
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["toolbar"] = '.$this->getJSToolbarArray().';
|
||
HTMLArea.initEditor('.$number.');' . (!$this->is_FE() ? '' : '
|
||
// Add Javascript configuration for registered plugins
|
||
foreach ($this->registeredPlugins as $pluginId => $plugin) {
|
||
if ($this->isPluginEnabled($pluginId)) {
|
||
$configureRTEInJavascriptString .= $plugin->buildJavascriptConfiguration($RTEcounter);
|
||
}
|
||
}
|
||
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["toolbar"] = '.$this->getJSToolbarArray().';
|
||
HTMLArea.initEditor('.$RTEcounter.');' . (!$this->is_FE() ? '' : '
|
||
/*]]>*/');
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
/**
|
||
* Return ture, if the plugin can loaded
|
||
* Return true, if the plugin can be loaded
|
||
*
|
||
* @return boolean 1 if the plugin can be loaded
|
||
* @param string $pluginId: The identification string of the plugin
|
||
*
|
||
* @return boolean true if the plugin can be loaded
|
||
*/
|
||
function isPluginEnable($plugin) {
|
||
return in_array($plugin, $this->pluginEnableArray);
|
||
|
||
function isPluginEnabled($plugin) {
|
||
return in_array($plugin, $this->pluginEnabledArray);
|
||
}
|
||
|
||
|
||
/**
|
||
* Return JS configuration of font sizes
|
||
* Return Javascript configuration of font sizes
|
||
*
|
||
* @return string JS font sizes configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript font sizes configuration
|
||
*/
|
||
function buildJSFontSizesConfig($number) {
|
||
function buildJSFontSizesConfig($RTEcounter) {
|
||
global $LANG, $TSFE;
|
||
$registerRTEinJSString = '';
|
||
$configureRTEInJavascriptString = '';
|
||
|
||
// Builing JS array of default font sizes
|
||
$HTMLAreaFontSizes = array();
|
||
... | ... | |
} else {
|
||
$HTMLAreaFontSizes[0] = $LANG->getLL('No size');
|
||
}
|
||
reset($this->defaultFontSizes);
|
||
while( list($FontSizeItem,$FontSizeLabel) = each($this->defaultFontSizes)) {
|
||
|
||
foreach ($this->defaultFontSizes as $FontSizeItem => $FontSizeLabel) {
|
||
if ($this->client['BROWSER'] == 'safari') {
|
||
$HTMLAreaFontSizes[$this->defaultFontSizes_safari[$FontSizeItem]] = $FontSizeLabel;
|
||
} else {
|
||
... | ... | |
}
|
||
if ($this->thisConfig['hideFontSizes'] ) {
|
||
$hideFontSizes = t3lib_div::trimExplode(',', $this->cleanList($this->thisConfig['hideFontSizes']), 1);
|
||
foreach($hideFontSizes as $item) {
|
||
foreach ($hideFontSizes as $item) {
|
||
if ($HTMLAreaFontSizes[strtolower($item)]) {
|
||
if ($this->client['BROWSER'] == 'safari') {
|
||
unset($HTMLAreaFontSizes[$this->defaultFontSizes_safari[strtolower($item)]]);
|
||
... | ... | |
|
||
$HTMLAreaJSFontSize = '{';
|
||
if ($this->cleanList($this->thisConfig['hideFontSizes']) != '*') {
|
||
reset($HTMLAreaFontSizes);
|
||
$HTMLAreaParagraphIndex = 0;
|
||
while( list($FontSizeItem,$FontSizeLabel) = each($HTMLAreaFontSizes)) {
|
||
$HTMLAreaFontSizeIndex = 0;
|
||
foreach ($HTMLAreaFontSizes as $FontSizeItem => $FontSizeLabel) {
|
||
if($HTMLAreaFontSizeIndex) {
|
||
$HTMLAreaJSFontSize .= ',';
|
||
}
|
||
... | ... | |
}
|
||
}
|
||
$HTMLAreaJSFontSize .= '};';
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["fontsize"] = '. $HTMLAreaJSFontSize;
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["fontsize"] = '. $HTMLAreaJSFontSize;
|
||
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
/**
|
||
* Return JS configuration of paragraphs
|
||
* Return Javascript configuration of block elements
|
||
*
|
||
* @return string JS paragraphs configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript configuration of block elements
|
||
*/
|
||
function buildJSParagraphsConfig($number) {
|
||
function buildJSParagraphsConfig($RTEcounter) {
|
||
global $TSFE, $LANG;
|
||
$registerRTEinJSString = '';
|
||
$configureRTEInJavascriptString = '';
|
||
|
||
// Paragraphs
|
||
$HTMLAreaParagraphs = $this->defaultParagraphs;
|
||
... | ... | |
}
|
||
$HTMLAreaJSParagraph = '{';
|
||
if ($this->cleanList($this->thisConfig['hidePStyleItems']) != '*') {
|
||
reset($HTMLAreaParagraphs);
|
||
$HTMLAreaParagraphIndex = 0;
|
||
while( list($PStyleItem,$PStyleLabel) = each($HTMLAreaParagraphs)) {
|
||
foreach ($HTMLAreaParagraphs as $PStyleItem => $PStyleLabel) {
|
||
if($HTMLAreaParagraphIndex) {
|
||
$HTMLAreaJSParagraph .= ',';
|
||
}
|
||
... | ... | |
}
|
||
}
|
||
$HTMLAreaJSParagraph .= '};';
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["paragraphs"] = '. $HTMLAreaJSParagraph;
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["paragraphs"] = '. $HTMLAreaJSParagraph;
|
||
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
|
||
/**
|
||
* Return JS configuration of font faces
|
||
* Return Javascript configuration of font faces
|
||
*
|
||
* @return string JS font faces configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript configuration of font faces
|
||
*/
|
||
*/
|
||
function buildJSFontfacesConfig($number) {
|
||
function buildJSFontfacesConfig($RTEcounter) {
|
||
global $TSFE, $LANG;
|
||
|
||
if ($this->is_FE()) {
|
||
... | ... | |
$RTEProperties = $this->RTEsetup['properties'];
|
||
}
|
||
|
||
$registerRTEinJSString = '';
|
||
$configureRTEInJavascriptString = '';
|
||
|
||
// Builing JS array of default font faces
|
||
$HTMLAreaFontname = array();
|
||
... | ... | |
$hideFontFaces = $this->cleanList($this->thisConfig['hideFontFaces']);
|
||
if ($hideFontFaces != '*') {
|
||
$index = 0;
|
||
reset($this->defaultFontFaces);
|
||
while (list($fontName,$fontValue) = each($this->defaultFontFaces)) {
|
||
foreach ($this->defaultFontFaces as $fontName => $fontValue) {
|
||
if (!t3lib_div::inList($hideFontFaces, $index+1)) {
|
||
$HTMLAreaFontname[$fontName] = '
|
||
"' . $fontName . '" : "' . $this->cleanList($fontValue) . '"';
|
||
... | ... | |
|
||
// Adding configured font faces
|
||
if (is_array($RTEProperties['fonts.'])) {
|
||
reset($RTEProperties['fonts.']);
|
||
while(list($fontName,$conf)=each($RTEProperties['fonts.'])) {
|
||
foreach ($RTEProperties['fonts.'] as $fontName => $conf) {
|
||
$fontName = substr($fontName,0,-1);
|
||
$fontLabel = $this->getPageConfigLabel($conf['name'],0);
|
||
$HTMLAreaFontname[$fontName] = '
|
||
... | ... | |
// Setting the list of font faces
|
||
$HTMLAreaJSFontface = '{';
|
||
$HTMLAreaFontface = t3lib_div::trimExplode(',' , $this->cleanList($defaultFontFacesList . ',' . $this->thisConfig['fontFace']));
|
||
reset($HTMLAreaFontface);
|
||
$HTMLAreaFontfaceIndex = 0;
|
||
while( list(,$fontName) = each($HTMLAreaFontface)) {
|
||
foreach ($HTMLAreaFontface as $fontName) {
|
||
if($HTMLAreaFontfaceIndex) {
|
||
$HTMLAreaJSFontface .= ',';
|
||
}
|
||
... | ... | |
}
|
||
$HTMLAreaJSFontface .= '};';
|
||
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["fontname"] = '. $HTMLAreaJSFontface;
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["fontname"] = '. $HTMLAreaJSFontface;
|
||
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
|
||
/**
|
||
* Return JS configuration of colors
|
||
* Return Javascript configuration of colors
|
||
*
|
||
* @return string JS colors configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript configuration of colors
|
||
*/
|
||
function buildJSColorsConfig($number) {
|
||
function buildJSColorsConfig($RTEcounter) {
|
||
global $TSFE, $LANG;
|
||
|
||
if ($this->is_FE()) {
|
||
... | ... | |
$RTEProperties = $this->RTEsetup['properties'];
|
||
}
|
||
|
||
$registerRTEinJSString = '';
|
||
$configureRTEInJavascriptString = '';
|
||
|
||
if(trim($this->thisConfig['disableColorPicker'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["disableColorPicker"] = true;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["disableColorPicker"] = true;';
|
||
} else {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["disableColorPicker"] = false;';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["disableColorPicker"] = false;';
|
||
}
|
||
|
||
// Building JS array of configured colors
|
||
if (is_array($RTEProperties['colors.']) ) {
|
||
$HTMLAreaColorname = array();
|
||
reset($RTEProperties['colors.']);
|
||
while(list($colorName,$conf)=each($RTEProperties['colors.'])) {
|
||
foreach ($RTEProperties['colors.'] as $colorName => $conf) {
|
||
$colorName=substr($colorName,0,-1);
|
||
$colorLabel = $this->getPageConfigLabel($conf['name']);
|
||
$HTMLAreaColorname[$colorName] = '
|
||
... | ... | |
if ($this->thisConfig['colors'] ) {
|
||
$HTMLAreaJSColors = '[';
|
||
$HTMLAreaColors = t3lib_div::trimExplode(',' , $this->cleanList($this->thisConfig['colors']));
|
||
reset($HTMLAreaColors);
|
||
$HTMLAreaColorsIndex = 0;
|
||
while( list(,$colorName) = each($HTMLAreaColors)) {
|
||
foreach ($HTMLAreaColors as $colorName) {
|
||
if($HTMLAreaColorsIndex && $HTMLAreaColorname[$colorName]) {
|
||
$HTMLAreaJSColors .= ',';
|
||
}
|
||
... | ... | |
$HTMLAreaColorsIndex++;
|
||
}
|
||
$HTMLAreaJSColors .= '];';
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["colors"] = '. $HTMLAreaJSColors;
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["colors"] = '. $HTMLAreaJSColors;
|
||
}
|
||
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
$mainElements = array();
|
||
$mainElements['P'] = $this->thisConfig['mainStyleOverride_add.']['P'];
|
||
$elList = explode(',','H1,H2,H3,H4,H5,H6,PRE');
|
||
reset($elList);
|
||
while(list(,$elListName)=each($elList)) {
|
||
foreach ($elList as $elListName) {
|
||
if ($this->thisConfig['mainStyleOverride_add.'][$elListName]) {
|
||
$mainElements[$elListName] = $this->thisConfig['mainStyleOverride_add.'][$elListName];
|
||
}
|
||
}
|
||
|
||
$addElementCode = '';
|
||
reset($mainElements);
|
||
while(list($elListName,$elValue)=each($mainElements)) {
|
||
foreach ($mainElements as $elListName => $elValue) {
|
||
$addElementCode .= strToLower($elListName) . ' {' . $elValue . '}' . chr(10);
|
||
}
|
||
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Return JS configuration of classes
|
||
* Return Javascript configuration of classes
|
||
*
|
||
* @return string JS classes configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript configuration of classes
|
||
*/
|
||
function buildJSClassesConfig($number) {
|
||
|
||
function buildJSClassesConfig($RTEcounter) {
|
||
// Build JS array of lists of classes
|
||
$classesTagList = 'classesCharacter, classesParagraph, classesImage, classesTable, classesLinks, classesTD';
|
||
$classesTagConvert = array( 'classesCharacter' => 'span', 'classesParagraph' => 'p', 'classesImage' => 'img', 'classesTable' => 'table', 'classesLinks' => 'a', 'classesTD' => 'td');
|
||
$classesTagArray = t3lib_div::trimExplode(',' , $classesTagList);
|
||
$registerRTEinJSString = '
|
||
RTEarea['.$number.']["classesTag"] = new Object();';
|
||
while( list(,$classesTagName) = each($classesTagArray)) {
|
||
$configureRTEInJavascriptString = '
|
||
RTEarea['.$RTEcounter.']["classesTag"] = new Object();';
|
||
foreach ($classesTagArray as $classesTagName) {
|
||
$HTMLAreaJSClasses = ($this->thisConfig[$classesTagName])?('"' . $this->cleanList($this->thisConfig[$classesTagName]) . '";'):'null;';
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["classesTag"]["'. $classesTagConvert[$classesTagName] .'"] = '. $HTMLAreaJSClasses;
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["classesTag"]["'. $classesTagConvert[$classesTagName] .'"] = '. $HTMLAreaJSClasses;
|
||
}
|
||
|
||
// Include JS arrays of configured classes
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["classesUrl"] = "' . $this->hostURL . $this->buildJSFile('classes_'.$this->contentLanguageUid, $this->buildJSClassesArray()) . '";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["classesUrl"] = "' . $this->hostURL . $this->buildJSFile('classes_'.$this->language, $this->buildJSClassesArray()) . '";';
|
||
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
// Scanning the list of classes if specified in the RTE config
|
||
if (is_array($RTEProperties['classes.'])) {
|
||
$stylesheet = '';
|
||
reset($RTEProperties['classes.']);
|
||
while(list($className,$conf)=each($RTEProperties['classes.'])) {
|
||
foreach ($RTEProperties['classes.'] as $className => $conf) {
|
||
$className = substr($className,0,-1);
|
||
$classLabel = $this->getPageConfigLabel($conf['name']);
|
||
$JSClassesLabelsArray .= (($index)?',':'') . '"' . $className . '": ' . $classLabel . $linebreak;
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Return a JS language array for htmlArea RTE
|
||
* Return a Javascript localization array for htmlArea RTE
|
||
*
|
||
* @return string JS language array
|
||
* @return string Javascript localization array
|
||
*/
|
||
function buildJSMainLangArray() {
|
||
global $TSFE, $LANG, $TYPO3_CONF_VARS;
|
||
... | ... | |
/**
|
||
* Return an acronym array for the Acronym plugin
|
||
*
|
||
* @return string acronym array
|
||
* @return string acronym Javascript array
|
||
*/
|
||
function buildJSAcronymArray() {
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Return JS configuration of special anchor classes
|
||
* Return Javascript configuration of special anchor classes
|
||
*
|
||
* @return string JS special anchor classes configuration
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string Javascript configuration of special anchor classes
|
||
*/
|
||
function buildJSClassesAnchorConfig($number) {
|
||
global $TSFE;
|
||
function buildJSClassesAnchorConfig($RTEcounter) {
|
||
|
||
if ($this->is_FE()) {
|
||
$RTEProperties = $this->RTEsetup;
|
||
... | ... | |
$RTEProperties = $this->RTEsetup['properties'];
|
||
}
|
||
|
||
$registerRTEinJSString = '';
|
||
$configureRTEInJavascriptString = '';
|
||
if (is_array($RTEProperties['classesAnchor.'])) {
|
||
$registerRTEinJSString .= '
|
||
RTEarea['.$number.']["classesAnchorUrl"] = "' . $this->buildJSFile('classesAnchor_'.$this->contentLanguageUid, $this->buildJSClassesAnchorArray()) . '";';
|
||
$configureRTEInJavascriptString .= '
|
||
RTEarea['.$RTEcounter.']["classesAnchorUrl"] = "' . $this->buildJSFile('classesAnchor_'.$this->contentLanguageUid, $this->buildJSClassesAnchorArray()) . '";';
|
||
}
|
||
return $registerRTEinJSString;
|
||
return $configureRTEInJavascriptString;
|
||
}
|
||
|
||
/**
|
||
* Return a JS array for special anchor classes
|
||
*
|
||
* @return string classesAnchor array definition
|
||
* @return string classesAnchor array definition
|
||
*/
|
||
function buildJSClassesAnchorArray() {
|
||
global $LANG, $TYPO3_CONF_VARS;
|
||
... | ... | |
$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
|
||
$JSClassesAnchorArray .= 'editor.classesAnchorSetup = [ ' . $linebreak;
|
||
$classesAnchorIndex = 0;
|
||
reset($this->RTEsetup['properties']['classesAnchor.']);
|
||
while(list($label,$conf)=each($this->RTEsetup['properties']['classesAnchor.'])) {
|
||
foreach ($this->RTEsetup['properties']['classesAnchor.'] as $label => $conf) {
|
||
if (is_array($conf) && $conf['class']) {
|
||
$JSClassesAnchorArray .= (($classesAnchorIndex++)?',':'') . ' { ' . $linebreak;
|
||
$index = 0;
|
||
... | ... | |
/**
|
||
* Return a file name containing the main JS language array for HTMLArea
|
||
*
|
||
* @return string filename
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
*
|
||
* @return string filename
|
||
*/
|
||
|
||
function buildJSMainLangFile($number) {
|
||
function buildJSMainLangFile($RTEcounter) {
|
||
$contents = $this->buildJSMainLangArray() . chr(10);
|
||
$pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1);
|
||
while( list(,$plugin) = each($pluginArray) ) {
|
||
if (in_array($plugin, $this->pluginEnableArrayMultiple[$number])) {
|
||
$pluginArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
|
||
foreach ($pluginArray as $plugin) {
|
||
if (in_array($plugin, $this->pluginEnabledCumulativeArray[$RTEcounter])) {
|
||
$contents .= $this->buildJSLangArray($plugin) . chr(10);
|
||
}
|
||
}
|
||
... | ... | |
}
|
||
/**
|
||
* Return a JS language array for the plugin
|
||
* Return a Javascript localization array for the plugin
|
||
*
|
||
* @return string JS language array
|
||
* @param string $plugin: identification string of the plugin
|
||
*
|
||
* @return string Javascript localization array
|
||
*/
|
||
|
||
function buildJSLangArray($plugin) {
|
||
global $TSFE, $LANG, $TYPO3_CONF_VARS;
|
||
|
||
$extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
|
||
|
||
$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
|
||
if($this->is_FE()) {
|
||
$LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language);
|
||
$LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language);
|
||
if(!empty($LOCAL_LANG['default'])) $TSFE->csConvObj->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset);
|
||
if(!empty($LOCAL_LANG[$this->language])) $TSFE->csConvObj->convArray($LOCAL_LANG[$this->language], $this->charset, $this->OutputCharset);
|
||
} else {
|
||
$LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/plugins/' . $plugin . '/locallang.xml');
|
||
$LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml');
|
||
if(!empty($LOCAL_LANG['default'])) $LANG->csConvObj->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset);
|
||
if(!empty($LOCAL_LANG[$this->language])) $LANG->csConvObj->convArray($LOCAL_LANG[$this->language], $this->charset, $this->OutputCharset);
|
||
}
|
||
... | ... | |
$previous_is_space = false;
|
||
// process each button in the order list
|
||
reset($this->toolbarOrderArray);
|
||
while (list(, $button) = each($this->toolbarOrderArray) ) {
|
||
foreach ($this->toolbarOrderArray as $button) {
|
||
// check if a new group starts
|
||
if (($button == 'bar' || $button == 'linebreak') && $group_has_button) {
|
||
// New line
|
||
if ($button == 'linebreak') {
|
||
$convertButton = '"' . $this->convertToolBarForHTMLArea('linebreak') . '"';
|
||
$convertButton = '"' . $this->convertToolbarForHTMLArea('linebreak') . '"';
|
||
$group = ($group!='') ? ($group . ', ' . $convertButton) : $convertButton;
|
||
}
|
||
// New group
|
||
... | ... | |
$group = '';
|
||
$previous_is_space = false;
|
||
$group_needs_starting_bar = false;
|
||
$toolbar .= ', "' . $this->convertToolBarForHTMLArea($button) . '"';
|
||
$toolbar .= ', "' . $this->convertToolbarForHTMLArea($button) . '"';
|
||
} elseif ($button == 'bar' && !$group_has_button) {
|
||
$group_needs_starting_bar = true;
|
||
} elseif ($button == 'space' && $group_has_button && !$previous_is_space) {
|
||
$convertButton = $this->convertToolBarForHTMLArea($button);
|
||
$convertButton = $this->convertToolbarForHTMLArea($button);
|
||
$convertButton = '"' . $convertButton . '"';
|
||
$group .= $group ? (', ' . $convertButton) : ($group_needs_starting_bar ? ('"' . $this->convertToolBarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
|
||
$group .= $group ? (', ' . $convertButton) : ($group_needs_starting_bar ? ('"' . $this->convertToolbarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
|
||
$group_needs_starting_bar = false;
|
||
$previous_is_space = true;
|
||
} elseif (in_array($button, $this->toolBar)) {
|
||
} elseif (in_array($button, $this->toolbar)) {
|
||
// Add the button to the group
|
||
$convertButton = $this->convertToolBarForHTMLArea($button);
|
||
$convertButton = $this->convertToolbarForHTMLArea($button);
|
||
if ($convertButton) {
|
||
$convertButton = '"' . $convertButton . '"';
|
||
$group .= $group ? (', ' . $convertButton) : ($group_needs_starting_bar ? ('"' . $this->convertToolBarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
|
||
$group .= $group ? (', ' . $convertButton) : ($group_needs_starting_bar ? ('"' . $this->convertToolbarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
|
||
$group_has_button = true;
|
||
$group_needs_starting_bar = false;
|
||
$previous_is_space = false;
|
||
... | ... | |
}
|
||
/**
|
||
* Return the JS-Code to copy the HTML-Code from the editor in the hidden input field.
|
||
* This is for submit function from the form.
|
||
* Return the Javascript code for copying the HTML code from the editor into the hidden input field.
|
||
* This is for submit function of the form.
|
||
*
|
||
* @return string the JS-Code
|
||
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
|
||
* @param string $formName: the name of the form
|
||
* @param string $textareaId: the id of the textarea
|
||
*
|
||
* @return string Javascript code
|
||
*/
|
||
function setSaveRTE($number, $form, $textarea) {
|
||
function setSaveRTE($RTEcounter, $formName, $textareaId) {
|
||
return '
|
||
editornumber = '.$number.';
|
||
editornumber = '.$RTEcounter.';
|
||
if (RTEarea[editornumber]) {
|
||
document.'.$form.'["'.$textarea.'"].value = RTEarea[editornumber]["editor"].getHTML();
|
||
document.'.$formName.'["'.$textareaId.'"].value = RTEarea[editornumber]["editor"].getHTML();
|
||
}
|
||
else {
|
||
OK=0;
|
||
... | ... | |
*/
|
||
function RTEtsConfigParams() {
|
||
global $TSFE;
|
||
if($this->is_FE()) {
|
||
return '';
|
||
} else {
|
||
... | ... | |
$matchParts = t3lib_div::trimExplode(',',$matchList,1);
|
||
$styleParts = explode(';',$elValue);
|
||
$nStyle=array();
|
||
while(list($k,$p)=each($styleParts)) {
|
||
foreach ($styleParts as $k => $p) {
|
||
$pp = t3lib_div::trimExplode(':',$p);
|
||
if ($pp[0]&&$pp[1]) {
|
||
reset($matchParts);
|
||
while(list(,$el)=each($matchParts)) {
|
||
foreach ($matchParts as $el) {
|
||
$star=substr($el,-1)=='*';
|
||
if (!strcmp($pp[0],$el) || ($star && t3lib_div::isFirstPartOfStr($pp[0],substr($el,0,-1)) )) {
|
||
$nStyle[]=$pp[0].':'.$pp[1];
|
typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
|
||
* 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 2 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!
|
||
***************************************************************/
|
||
/**
|
||
* API for extending htmlArea RTE
|
||
*
|
||
* @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
|
||
*
|
||
* TYPO3 CVS ID: $Id: class.tx_rtehtmlarea_pi1.php 2449 2007-08-15 08:12:19Z ingorenner $
|
||
*
|
||
*/
|
||
require_once(PATH_t3lib.'class.t3lib_div.php');
|
||
abstract class tx_rtehtmlareaapi {
|
||
|
||
protected $extensionKey; // The key of the extension that is extending htmlArea RTE
|
||
protected $relativePathToLocallangFile; // Path to this main locallang file of the extension relative to the extension dir.
|
||
protected $relativePathToSkin; // Path to the skin (css) file relative to the extension dir.
|
||
protected $htmlAreaRTE; // Reference to the invoking object
|
||
protected $thisConfig; // Reference to RTE PageTSConfig
|
||
protected $toolBar; // Refrence to RTE toolbar array
|
||
protected $LOCAL_LANG; // Frontend language array
|
||
protected $pluginButtons = ''; // The comma-seperated list of button names that the extension id adding to the htmlArea RTE tollbar
|
||
protected $convertToolbarForHtmlAreaArray = array(); // The name-converting array, converting the button names used in the RTE PageTSConfing to the button id's used by the JS scripts
|
||
|
||
/**
|
||
* Returns true if the plugin is available and correctly initialized
|
||
*
|
||
* @param object Reference to parent object, which is an instance of the htmlArea RTE
|
||
*
|
||
* @return boolean true if this plugin object should be made available in the current environment and is correctly initialized
|
||
*/
|
||
public function main($parentObject) {
|
||
global $TYPO3_CONF_VARS, $LANG;
|
||
|
||
$this->htmlAreaRTE =& $parentObject;
|
||
$this->thisConfig =& $this->htmlAreaRTE->thisConfig;
|
||
$this->toolbar =& $this->htmlAreaRTE->toolbar;
|
||
|
||
// Check if the plugin should be disabled in frontend
|
||
if ($this->htmlAreaRTE->is_FE() && is_array($TYPO3_CONF_VARS['EXTCONF'][$this->extensionKey]) && $TYPO3_CONF_VARS['EXTCONF'][$this->extensionKey]['disableInFE']) {
|
||
return false;
|
||
}
|
||
|
||
// Localization array must be initialized here
|
||
if ($this->htmlAreaRTE->is_FE()) {
|
||
$this->LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language);
|
||
} else {
|
||
$LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* Returns a modified toolbar order string
|
||
*
|
||
* @return string a modified tollbar order list
|
||
*/
|
||
public function addButtonsToToolbar() {
|
||
return ('bar,'.$this->pluginButtons.',linebreak,'.$this->htmlAreaRTE->defaultToolbarOrder);
|
||
}
|
||
|
||
/**
|
||
* Returns the path to the skin component (button icons) that should be added to linked stylesheets
|
||
*
|
||
* @return string path to the skin (css) file
|
||
*/
|
||
public function getPathToSkin() {
|
||
global $TYPO3_CONF_VARS;
|
||
if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->extensionKey]) && $TYPO3_CONF_VARS['EXTCONF'][$this->extensionKey]['addIconsToSkin']) {
|
||
return $this->relativePathToSkin;
|
||
} else {
|