2 /***************************************************************
5 * (c) 2004 Kasper Skaarhoj (kasper@typo3.com)
6 * (c) 2004 Philipp Borgmann <philipp.borgmann@gmx.de>
7 * (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
30 * A RTE using the htmlArea editor
32 * @author Philipp Borgmann <philipp.borgmann@gmx.de>
33 * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
38 require_once(PATH_t3lib
.'class.t3lib_rteapi.php');
39 require_once(PATH_t3lib
.'class.t3lib_cs.php');
41 class tx_rtehtmlarea_base
extends t3lib_rteapi
{
43 // Configuration of supported browsers
44 var $conf_supported_browser = array (
68 // Always hide these toolbar buttons (TYPO3 button name)
69 var $conf_toolbar_hide = array (
70 'showhelp', // Has no content yet
73 // Hide toolbar buttons not implemented in client browsers
74 var $hideButtonsFromClient = array (
75 'safari' => array('paste'),
76 'opera' => array('copy', 'cut', 'paste'),
79 // Always show these toolbar buttons (TYPO3 button name)
80 var $conf_toolbar_show = array (
87 // The order of the toolbar: the name is the TYPO3-button name
88 var $defaultToolbarOrder;
90 // The default hotkeys: the name is the TYPO3-button name
91 var $defaultHotKeyList = 'selectall, cleanword, undo, redo';
93 // Conversion array: TYPO3 button names to htmlArea button names
94 var $convertToolbarForHtmlAreaArray = array (
95 'line' => 'InsertHorizontalRule',
99 'chMode' => 'HtmlMode',
100 'showhelp' => 'ShowHelp',
101 'textindicator' => 'TextIndicator',
103 'bar' => 'separator',
104 'linebreak' => 'linebreak',
109 var $pluginList = 'ContextMenu';
110 var $pluginButton = array();
111 var $pluginLabel = array();
114 var $RTEdivStyle; // Alternative style for RTE <div> tag.
115 var $extHttpPath; // full Path to this extension for http (so no Server path). It ends with "/"
116 var $siteURL; // TYPO3 site url
117 var $hostURL; // TYPO3 host url
118 var $typoVersion; // Typo3 version
121 var $ID = 'rtehtmlarea'; // Identifies the RTE as being the one from the "rte" extension if any external code needs to know...
122 var $debugMode = FALSE; // If set, the content goes into a regular TEXT area field - for developing testing of transformations. (Also any browser will load the field!)
128 * Reference to parent object, which is an instance of the TCEforms
130 * @var t3lib_TCEforms
142 public $contentTypo3Language;
143 public $contentISOLanguage;
144 public $contentCharset;
149 var $toolbar = array(); // Save the buttons for the toolbar
150 var $toolbar_level_size; // The size for each level in the toolbar:
151 var $toolbarOrderArray = array();
152 protected $pluginEnabledArray = array(); // Array of plugin id's enabled in the current RTE editing area
153 protected $pluginEnabledCumulativeArray = array(); // Cumulative array of plugin id's enabled so far in any of the RTE editing areas of the form
154 protected $registeredPlugins = array(); // Array of registered plugins indexd by their plugin Id's
157 * Returns true if the RTE is available. Here you check if the browser requirements are met.
158 * If there are reasons why the RTE cannot be displayed you simply enter them as text in ->errorLog
160 * @return boolean TRUE if this RTE object offers an RTE in the current browser environment
163 function isAvailable() {
164 global $TYPO3_CONF_VARS;
166 $this->client
= $this->clientInfo();
167 $this->errorLog
= array();
168 if (!$this->debugMode
) { // If debug-mode, let any browser through
170 $rteConfBrowser = $this->conf_supported_browser
;
171 if (!$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['enableInOpera9']) unset($rteConfBrowser['opera']);
172 if (is_array($rteConfBrowser)) {
173 foreach ($rteConfBrowser as $browser => $browserConf) {
174 if ($browser == $this->client
['BROWSER']) {
175 // Config for Browser found, check it:
176 if (is_array($browserConf)) {
177 foreach ($browserConf as $browserConfNr => $browserConfSub) {
178 if ($browserConfSub['version'] <= $this->client
['VERSION'] ||
empty($browserConfSub['version'])) {
179 // Version is correct
180 if ($browserConfSub['system'] == $this->client
['SYSTEM'] ||
empty($browserConfSub['system'])) {
181 // System is correctly
185 }// End of foreach-BrowserSubpart
187 // no config for this browser found, so all versions or system with this browsers are allow
190 } // End of Browser Check
191 } // foreach: Browser Check
193 // no Browser config for this RTE-Editor, so all Clients are allow
195 if (!$rteIsAvailable) {
196 $this->errorLog
[] = 'rte: Browser not supported. Only msie Version 5 or higher and Mozilla based client 1. and higher.';
198 if (t3lib_div
::int_from_ver(TYPO3_version
) < 4000000) {
200 $this->errorLog
[] = 'rte: This version of htmlArea RTE cannot run under this version of TYPO3.';
203 if ($rteIsAvailable) return true;
207 * Draws the RTE as an iframe
209 * @param object Reference to parent object, which is an instance of the TCEforms.
210 * @param string The table name
211 * @param string The field name
212 * @param array The current row from which field is being rendered
213 * @param array 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.
214 * @param array "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
215 * @param array Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
216 * @param string Record "type" field value.
217 * @param string 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!
218 * @param integer PID value of record (true parent page id)
219 * @return string HTML code for RTE!
222 function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue) {
223 global $BE_USER, $LANG, $TYPO3_DB, $TYPO3_CONF_VARS;
225 $this->TCEform
=& $parentObject;
226 $inline =& $this->TCEform
->inline
;
227 $LANG->includeLLFile('EXT:' . $this->ID
. '/locallang.xml');
228 $this->client
= $this->clientInfo();
229 $this->typoVersion
= t3lib_div
::int_from_ver(TYPO3_version
);
230 $this->userUid
= 'BE_' . $BE_USER->user
['uid'];
232 // Draw form element:
233 if ($this->debugMode
) { // Draws regular text area (debug mode)
234 $item = parent
::drawRTE($this->TCEform
, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue);
235 } else { // Draw real RTE
237 /* =======================================
238 * INIT THE EDITOR-SETTINGS
239 * =======================================
242 // first get the http-path to typo3:
243 $this->httpTypo3Path
= substr( substr( t3lib_div
::getIndpEnv('TYPO3_SITE_URL'), strlen( t3lib_div
::getIndpEnv('TYPO3_REQUEST_HOST') ) ), 0, -1 );
244 if (strlen($this->httpTypo3Path
) == 1) {
245 $this->httpTypo3Path
= '/';
247 $this->httpTypo3Path
.= '/';
249 // Get the path to this extension:
250 $this->extHttpPath
= $this->httpTypo3Path
. t3lib_extMgm
::siteRelPath($this->ID
);
252 $this->siteURL
= t3lib_div
::getIndpEnv('TYPO3_SITE_URL');
254 $this->hostURL
= t3lib_div
::getIndpEnv('TYPO3_REQUEST_HOST');
257 $this->elementId
= $PA['itemFormElName']; // Form element name
258 $this->elementParts
= explode('][',ereg_replace('\]$','',ereg_replace('^(TSFE_EDIT\[data\]\[|data\[)','',$this->elementId
)));
260 // Find the page PIDs:
261 list($this->tscPID
,$this->thePid
) = t3lib_BEfunc
::getTSCpid(trim($this->elementParts
[0]),trim($this->elementParts
[1]),$thePidValue);
263 // Record "types" field value:
264 $this->typeVal
= $RTEtypeVal; // TCA "types" value for record
266 // Find "thisConfig" for record/editor:
267 unset($this->RTEsetup
);
268 $this->RTEsetup
= $BE_USER->getTSConfig('RTE',t3lib_BEfunc
::getPagesTSconfig($this->tscPID
));
269 $this->thisConfig
= $thisConfig;
271 // Special configuration and default extras:
272 $this->specConf
= $specConf;
274 if ($this->thisConfig
['forceHTTPS']) {
275 $this->httpTypo3Path
= preg_replace('/^(http|https)/', 'https', $this->httpTypo3Path
);
276 $this->extHttpPath
= preg_replace('/^(http|https)/', 'https', $this->extHttpPath
);
277 $this->siteURL
= preg_replace('/^(http|https)/', 'https', $this->siteURL
);
278 $this->hostURL
= preg_replace('/^(http|https)/', 'https', $this->hostURL
);
281 /* =======================================
282 * LANGUAGES & CHARACTER SETS
283 * =======================================
286 // Languages: interface and content
287 $this->language
= $LANG->lang
;
288 if ($this->language
=='default' ||
!$this->language
) {
289 $this->language
='en';
291 $this->contentTypo3Language
= $this->language
;
293 $this->contentLanguageUid
= ($row['sys_language_uid'] > 0) ?
$row['sys_language_uid'] : 0;
294 if (t3lib_extMgm
::isLoaded('static_info_tables')) {
295 if ($this->contentLanguageUid
) {
296 $tableA = 'sys_language';
297 $tableB = 'static_languages';
298 $languagesUidsList = $this->contentLanguageUid
;
299 $selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2,' . $tableB . '.lg_typo3';
300 $tableAB = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
301 $whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') ';
302 $whereClause .= t3lib_BEfunc
::BEenableFields($tableA);
303 $whereClause .= t3lib_BEfunc
::deleteClause($tableA);
304 $res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
305 while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
306 $this->contentISOLanguage
= strtolower(trim($languageRow['lg_iso_2']).(trim($languageRow['lg_country_iso_2'])?
'_'.trim($languageRow['lg_country_iso_2']):''));
307 $this->contentTypo3Language
= strtolower(trim($languageRow['lg_typo3']));
310 $this->contentISOLanguage
= trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['defaultDictionary']) ?
trim($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['defaultDictionary']) : 'en';
311 $selectFields = 'lg_iso_2, lg_typo3';
312 $tableAB = 'static_languages';
313 $whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage
), $tableAB);
314 $res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
315 while($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
316 $this->contentTypo3Language
= strtolower(trim($languageRow['lg_typo3']));
321 // Character sets: interface and content
322 $this->charset
= $LANG->csConvObj
->charSetArray
[$this->language
];
323 $this->charset
= $this->charset ?
$this->charset
: 'iso-8859-1';
324 $this->BECharset
= trim($TYPO3_CONF_VARS['BE']['forceCharset']) ?
trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->charset
;
325 $this->OutputCharset
= $this->BECharset
;
327 $this->contentCharset
= $LANG->csConvObj
->charSetArray
[$this->contentTypo3Language
];
328 $this->contentCharset
= $this->contentCharset ?
$this->contentCharset
: 'iso-8859-1';
329 $this->origContentCharSet
= $this->contentCharset
;
330 $this->contentCharset
= (trim($TYPO3_CONF_VARS['BE']['forceCharset']) ?
trim($TYPO3_CONF_VARS['BE']['forceCharset']) : $this->contentCharset
);
332 /* =======================================
333 * TOOLBAR CONFIGURATION
334 * =======================================
337 // htmlArea plugins list
338 $this->pluginEnabledArray
= t3lib_div
::trimExplode(',', $this->pluginList
, 1);
339 $this->enableRegisteredPlugins();
340 $hidePlugins = array();
341 if ($this->client
['BROWSER'] == 'msie') {
342 $this->thisConfig
['keepButtonGroupTogether'] = 0;
344 if ($this->client
['BROWSER'] == 'opera') {
345 $hidePlugins[] = 'ContextMenu';
346 $this->thisConfig
['keepButtonGroupTogether'] = 0;
348 if ($this->client
['BROWSER'] == 'gecko' && $this->client
['VERSION'] == '1.3') {
349 $this->thisConfig
['keepButtonGroupTogether'] = 0;
351 $this->pluginEnabledArray
= array_diff($this->pluginEnabledArray
, $hidePlugins);
356 // Check if some plugins need to be disabled
359 // Merge the list of enabled plugins with the lists from the previous RTE editing areas on the same form
360 $this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
] = $this->pluginEnabledArray
;
361 if ($this->TCEform
->RTEcounter
> 1 && isset($this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
-1]) && is_array($this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
-1])) {
362 $this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
] = array_unique(array_values(array_merge($this->pluginEnabledArray
,$this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
-1])));
365 /* =======================================
367 * =======================================
370 $RTEWidth = isset($BE_USER->userTS
['options.']['RTESmallWidth']) ?
$BE_USER->userTS
['options.']['RTESmallWidth'] : '530';
371 $RTEHeight = isset($BE_USER->userTS
['options.']['RTESmallHeight']) ?
$BE_USER->userTS
['options.']['RTESmallHeight'] : '380';
372 $RTEWidth = $RTEWidth +
($this->TCEform
->docLarge ?
(isset($BE_USER->userTS
['options.']['RTELargeWidthIncrement']) ?
$BE_USER->userTS
['options.']['RTELargeWidthIncrement'] : '150') : 0);
373 $RTEWidth -= ($inline->getStructureDepth() > 0 ?
($inline->getStructureDepth()+
1)*$inline->getLevelMargin() : 0);
374 $RTEHeight = $RTEHeight +
($this->TCEform
->docLarge ?
(isset($BE_USER->userTS
['options.']['RTELargeHeightIncrement']) ?
$BE_USER->userTS
['options.']['RTELargeHeightIncrement'] : 0) : 0);
375 $RTEHeightOverride = intval($this->thisConfig
['RTEHeightOverride']);
376 $RTEHeight = ($RTEHeightOverride > 0) ?
$RTEHeightOverride : $RTEHeight;
377 $editorWrapWidth = $RTEWidth . 'px';
378 $editorWrapHeight = $RTEHeight . 'px';
379 $this->RTEdivStyle
= 'position:relative; left:0px; top:0px; height:' . $RTEHeight . 'px; width:'.$RTEWidth.'px; border: 1px solid black; padding: 2px 0px 2px 2px;';
380 $this->toolbar_level_size
= $RTEWidth;
382 /* =======================================
383 * LOAD CSS AND JAVASCRIPT
384 * =======================================
387 // Preloading the pageStyle
388 $filename = trim($this->thisConfig
['contentCSS']) ?
trim($this->thisConfig
['contentCSS']) : 'EXT:' . $this->ID
. '/res/contentcss/default.css';
389 $this->TCEform
->additionalCode_pre
['loadCSS'] = '
390 <link rel="alternate stylesheet" type="text/css" href="' . $this->getFullFileName($filename) . '" title="HTMLArea RTE Content CSS" />';
392 // Loading the editor skin
393 $skinFilename = trim($this->thisConfig
['skin']) ?
trim($this->thisConfig
['skin']) : 'EXT:' . $this->ID
. '/htmlarea/skins/default/htmlarea.css';
394 if($this->client
['BROWSER'] == 'gecko' && $this->client
['VERSION'] == '1.3' && substr($skinFilename,0,4) == 'EXT:') {
395 $skinFilename = 'EXT:' . $this->ID
. '/htmlarea/skins/default/htmlarea.css';
397 if (substr($skinFilename,0,4) == 'EXT:') { // extension
398 list($extKey,$local) = explode('/',substr($skinFilename,4),2);
400 if (strcmp($extKey,'') && t3lib_extMgm
::isLoaded($extKey) && strcmp($local,'')) {
401 $skinFilename = $this->httpTypo3Path
. t3lib_extMgm
::siteRelPath($extKey) . $local;
402 $skinDir = $this->siteURL
. t3lib_extMgm
::siteRelPath($extKey) . dirname($local);
404 } elseif (substr($skinFilename,0,1) != '/') {
405 $skinDir = $this->siteURL
.dirname($skinFilename);
406 $skinFilename = $this->siteURL
. $skinFilename;
408 $skinDir = substr($this->siteURL
,0,-1) . dirname($skinFilename);
410 $this->editorCSS
= $skinFilename;
411 $this->editedContentCSS
= $skinDir . '/htmlarea-edited-content.css';
412 $this->TCEform
->additionalCode_pre
['loadCSS'] .= '
413 <link rel="alternate stylesheet" type="text/css" href="' . $this->editedContentCSS
. '" />';
416 $this->TCEform
->additionalCode_pre
['loadCSS'] .= '
417 <link rel="stylesheet" type="text/css" href="' . $this->editorCSS
. '" />';
419 // Additional icons from registered plugins
420 foreach ($this->pluginEnabledCumulativeArray
[$this->TCEform
->RTEcounter
] as $pluginId) {
421 if (is_object($this->registeredPlugins
[$pluginId])) {
422 $pathToSkin = $this->registeredPlugins
[$pluginId]->getPathToSkin();
424 $this->TCEform
->additionalCode_pre
['loadCSS'] .= '
425 <link rel="stylesheet" type="text/css" href="' . $this->httpTypo3Path
. t3lib_extMgm
::siteRelPath($this->registeredPlugins
[$pluginId]->getExtensionKey()) . $pathToSkin . '" />';
430 // Loading JavaScript files and code
431 if ($this->TCEform
->RTEcounter
== 1) {
432 $this->TCEform
->additionalCode_pre
['loadJSfiles'] = $this->loadJSfiles($this->TCEform
->RTEcounter
);
433 $this->TCEform
->additionalJS_pre
['loadJScode'] = $this->loadJScode($this->TCEform
->RTEcounter
);
436 /* =======================================
438 * =======================================
442 $value = $this->transformContent('rte',$PA['itemFormElValue'],$table,$field,$row,$specConf,$thisConfig,$RTErelPath,$thePidValue);
444 // Further content transformation by registered plugins
445 foreach ($this->registeredPlugins
as $pluginId => $plugin) {
446 if ($this->isPluginEnabled($pluginId) && method_exists($plugin, "transformContent")) {
447 $value = $plugin->transformContent($value);
450 // Register RTE windows
451 $this->TCEform
->RTEwindows
[] = $PA['itemFormElName'];
453 // Check if wizard_rte called this for fullscreen edtition; if so, change the size of the RTE to fullscreen using JS
454 if (basename(PATH_thisScript
) == 'wizard_rte.php') {
455 $height = 'window.innerHeight';
456 $width = 'window.innerWidth';
457 if ($this->client
['BROWSER'] == 'msie') {
458 $height = 'document.body.offsetHeight';
459 $width = 'document.body.offsetWidth';
461 $editorWrapWidth = '100%';
462 $editorWrapHeight = '100%';
463 $this->RTEdivStyle
= 'position:relative; left:0px; top:0px; height:100%; width:100%; border: 1px solid black; padding: 2px 0px 2px 2px;';
464 $this->TCEform
->additionalJS_post
[] = $this->setRTEsizeByJS('RTEarea'.$this->TCEform
->RTEcounter
, $height, $width);
467 // Register RTE in JS:
468 $this->TCEform
->additionalJS_post
[] = $this->registerRTEinJS($this->TCEform
->RTEcounter
, $table, $row['uid'], $field);
470 // Set the save option for the RTE:
471 $this->TCEform
->additionalJS_submit
[] = $this->setSaveRTE($this->TCEform
->RTEcounter
, $this->TCEform
->formName
, htmlspecialchars($PA['itemFormElName']));
474 $visibility = 'hidden';
475 $item = $this->triggerField($PA['itemFormElName']).'
476 <div id="pleasewait' . $this->TCEform
->RTEcounter
. '" class="pleasewait" style="display: none;" >' . $LANG->getLL('Please wait') . '</div>
477 <div id="editorWrap' . $this->TCEform
->RTEcounter
. '" class="editorWrap" style="width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
478 <textarea id="RTEarea'.$this->TCEform
->RTEcounter
.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div
::deHSCentities(htmlspecialchars($this->RTEdivStyle
)).'">'.t3lib_div
::formatForTextarea($value).'</textarea>
479 </div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableDebugMode'] ?
'<div id="HTMLAreaLog"></div>' : '') . '
488 * Add registered plugins to the array of enabled plugins
491 function enableRegisteredPlugins() {
492 global $TYPO3_CONF_VARS;
493 // Traverse registered plugins
494 if (is_array($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['plugins'])) {
495 foreach($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['plugins'] as $pluginId => $pluginObjectConfiguration) {
496 $plugin = &t3lib_div
::getUserObj($pluginObjectConfiguration['objectReference']);
497 if (is_object($plugin)) {
498 if ($plugin->main($this)) {
499 $this->registeredPlugins
[$pluginId] = $plugin;
500 // Override buttons from previously registered plugins
501 $pluginButtons = t3lib_div
::trimExplode(',', $plugin->getPluginButtons(), 1);
502 foreach ($this->pluginButton
as $previousPluginId => $buttonList) {
503 $this->pluginButton
[$previousPluginId] = implode(',',array_diff(t3lib_div
::trimExplode(',', $this->pluginButton
[$previousPluginId], 1), $pluginButtons));
505 $this->pluginButton
[$pluginId] = $plugin->getPluginButtons();
506 $pluginLabels = t3lib_div
::trimExplode(',', $plugin->getPluginLabels(), 1);
507 foreach ($this->pluginLabel
as $previousPluginId => $labelList) {
508 $this->pluginLabel
[$previousPluginId] = implode(',',array_diff(t3lib_div
::trimExplode(',', $this->pluginLabel
[$previousPluginId], 1), $pluginLabels));
510 $this->pluginLabel
[$pluginId] = $plugin->getPluginLabels();
511 $this->pluginEnabledArray
[] = $pluginId;
517 $hidePlugins = array();
518 foreach ($this->registeredPlugins
as $pluginId => $plugin) {
519 if (!$this->pluginButton
[$pluginId]) {
520 $hidePlugins[] = $pluginId;
523 $this->pluginEnabledArray
= array_diff($this->pluginEnabledArray
, $hidePlugins);
527 * Set the toolbar config (only in this PHP-Object, not in JS):
531 function setToolbar() {
534 $this->defaultToolbarOrder
= 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
535 bar, formattext, bold, strong, italic, emphasis, big, small, insertedtext, deletedtext, citation, code, definition, keyboard, monospaced, quotation, sample, variable, bidioverride, strikethrough, subscript, superscript, underline, span,
536 bar, fontstyle, space, fontsize, bar, formatblock, insertparagraphbefore, insertparagraphafter, blockquote,
537 bar, left, center, right, justifyfull,
538 bar, orderedlist, unorderedlist, outdent, indent, bar, lefttoright, righttoleft,
539 bar, textcolor, bgcolor, textindicator,
540 bar, emoticon, insertcharacter, line, link, unlink, image, table,' . (($this->thisConfig
['hideTableOperationsInToolbar'] && is_array($this->thisConfig
['buttons.']) && is_array($this->thisConfig
['buttons.']['toggleborders.']) && $this->thisConfig
['buttons.']['toggleborders.']['keepInToolbar']) ?
' toggleborders,': '') . ' user, acronym, bar, findreplace, spellcheck,
541 bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
542 ' . ($this->thisConfig
['hideTableOperationsInToolbar'] ?
'': 'bar, toggleborders,') . ' bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
543 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
544 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
546 // Special toolbar for Mozilla Wamcom on Mac OS 9
547 if($this->client
['BROWSER'] == 'gecko' && $this->client
['VERSION'] == '1.3') {
548 $this->defaultToolbarOrder
= $this->TCEform
->docLarge ?
'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
549 bar, fontstyle, space, fontsize, space, formatblock, insertparagraphbefore, insertparagraphafter, blockquote, bar, bold, italic, underline, strikethrough,
550 subscript, superscript, lefttoright, righttoleft, bar, left, center, right, justifyfull, linebreak,
551 bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
552 insertcharacter, line, link, unlink, image, table, user, acronym, bar, findreplace, spellcheck, bar, chMode, inserttag,
553 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
554 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
555 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
556 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'
557 : 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak,
558 bar, fontstyle, space, fontsize, space, formatblock, insertparagraphbefore, insertparagraphafter, blockquote, bar, bold, italic, underline, strikethrough,
559 subscript, superscript, linebreak, bar, lefttoright, righttoleft, bar, left, center, right, justifyfull,
560 orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon,
561 insertcharacter, line, link, unlink, image, table, user, acronym, linebreak, bar, findreplace, spellcheck, bar, chMode, inserttag,
562 removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak,
563 bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar,
564 columninsertbefore, columninsertafter, columndelete, columnsplit, bar,
565 cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
568 // Additional buttons from registered plugins
569 foreach($this->registeredPlugins
as $pluginId => $plugin) {
570 if ($this->isPluginEnabled($pluginId)) {
571 $this->defaultToolbarOrder
= $plugin->addButtonsToToolbar();
574 $toolbarOrder = $this->thisConfig
['toolbarOrder'] ?
$this->thisConfig
['toolbarOrder'] : $this->defaultToolbarOrder
;
576 // Getting rid of undefined buttons
577 $this->toolbarOrderArray
= array_intersect(t3lib_div
::trimExplode(',', $toolbarOrder, 1), t3lib_div
::trimExplode(',', $this->defaultToolbarOrder
, 1));
578 $toolbarOrder = array_unique(array_values($this->toolbarOrderArray
));
580 // Fetching specConf for field from backend
581 $pList = is_array($this->specConf
['richtext']['parameters']) ?
implode(',',$this->specConf
['richtext']['parameters']) : '';
582 if ($pList != '*') { // If not all
583 $show = is_array($this->specConf
['richtext']['parameters']) ?
$this->specConf
['richtext']['parameters'] : array();
584 if ($this->thisConfig
['showButtons']) {
585 if (!t3lib_div
::inList($this->thisConfig
['showButtons'],'*')) {
586 $show = array_unique(array_merge($show,t3lib_div
::trimExplode(',',$this->thisConfig
['showButtons'],1)));
588 $show = array_unique(array_merge($show, $toolbarOrder));
591 if (is_array($this->thisConfig
['showButtons.'])) {
592 foreach ($this->thisConfig
['showButtons.'] as $buttonId => $value) {
593 if ($value) $show[] = $buttonId;
595 $show = array_unique($show);
598 $show = $toolbarOrder;
601 // Resticting to RTEkeyList for backend user
602 if(is_object($BE_USER)) {
603 $RTEkeyList = isset($BE_USER->userTS
['options.']['RTEkeyList']) ?
$BE_USER->userTS
['options.']['RTEkeyList'] : '*';
604 if ($RTEkeyList != '*') { // If not all
605 $show = array_intersect($show, t3lib_div
::trimExplode(',',$RTEkeyList,1));
609 // Hiding buttons of disabled plugins
610 $hideButtons = array('space', 'bar', 'linebreak');
611 foreach ($this->pluginButton
as $pluginId => $buttonList) {
612 if (!$this->isPluginEnabled($pluginId)) {
613 $buttonArray = t3lib_div
::trimExplode(',',$buttonList,1);
614 foreach ($buttonArray as $button) {
615 $hideButtons[] = $button;
620 // Hiding labels of disabled plugins
621 foreach ($this->pluginLabel
as $pluginId => $label) {
622 if (!$this->isPluginEnabled($pluginId)) {
623 $hideButtons[] = $label;
627 // Hiding buttons not implemented in some clients
628 foreach ($this->hideButtonsFromClient
as $client => $buttonArray) {
629 if ($this->client
['BROWSER'] == $client) {
630 foreach($buttonArray as $buttonId) {
631 $hideButtons[] = $buttonId;
636 // Hiding the buttons
637 $show = array_diff($show, $this->conf_toolbar_hide
, $hideButtons, t3lib_div
::trimExplode(',',$this->thisConfig
['hideButtons'],1));
639 // Adding the always show buttons
640 $show = array_unique(array_merge($show, $this->conf_toolbar_show
));
641 $toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show
));
642 foreach ($this->conf_toolbar_show
as $buttonId) {
643 if (!in_array($buttonId, $this->toolbarOrderArray
)) $this->toolbarOrderArray
[] = $buttonId;
646 // Getting rid of the buttons for which we have no position
647 $show = array_intersect($show, $toolbarOrder);
648 $this->toolbar
= $show;
652 * Disable some plugins
656 function setPlugins() {
657 global $TYPO3_CONF_VARS;
659 $hideButtons = array();
661 // Disabling the plugins if their buttons are not in the toolbar
662 $hidePlugins = array();
663 foreach ($this->pluginButton
as $pluginId => $buttonList) {
665 $buttonArray = t3lib_div
::trimExplode(',', $buttonList, 1);
666 foreach ($buttonArray as $button) {
667 if (in_array($button, $this->toolbar
)) {
672 $hidePlugins[] = $pluginId;
675 if ($this->thisConfig
['disableContextMenu'] ||
$this->thisConfig
['disableRightClick']) $hidePlugins[] = 'ContextMenu';
676 $this->pluginEnabledArray
= array_diff($this->pluginEnabledArray
, $hidePlugins);
678 // Hiding labels of disabled plugins
679 foreach ($this->pluginLabel
as $pluginId => $label) {
680 if (!$this->isPluginEnabled($pluginId)) {
681 $hideButtons[] = $label;
684 $this->toolbar
= array_diff($this->toolbar
, $hideButtons);
686 // Completing the toolbar converion array for htmlArea
687 foreach ($this->registeredPlugins
as $pluginId => $plugin) {
688 if ($this->isPluginEnabled($pluginId)) {
689 $this->convertToolbarForHtmlAreaArray
= array_unique(array_merge($this->convertToolbarForHtmlAreaArray
, $plugin->getConvertToolbarForHtmlAreaArray()));
695 * Convert the TYPO3 names of buttons into the names for htmlArea RTE
697 * @param string buttonname (typo3-name)
698 * @return string buttonname (htmlarea-name)
701 function convertToolbarForHTMLArea($button) {
702 return $this->convertToolbarForHtmlAreaArray
[$button];
706 * Return the JS-function for setting the RTE size.
708 * @param string DivID-Name
709 * @param int the height for the RTE
710 * @param int the width for the RTE
711 * @return string Loader function in JS
713 function setRTEsizeByJS($divId, $height, $width) {
715 setRTEsizeByJS(\''.$divId.'\','.$height.', '.$width.');
720 * Return the HTML code for loading the Javascript files
722 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
724 * @return string the html code for loading the Javascript Files
726 function loadJSfiles($RTEcounter) {
727 global $TYPO3_CONF_VARS;
729 $loadJavascriptCode = '
730 <script type="text/javascript">
733 while (document.getElementById("pleasewait" + i)) {
734 document.getElementById("pleasewait" + i).style.display = "block";
735 document.getElementById("editorWrap" + i).style.visibility = "hidden";
738 RTEarea = new Array();
739 RTEarea[0] = new Object();
740 RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['version'] . '";
741 RTEarea[0]["popupwin"] = "' . $this->writeTemporaryFile('EXT:' . $this->ID
. '/htmlarea/popupwin.js', "popupwin") . '";'
742 . (($this->client
['BROWSER'] == 'msie') ?
('
743 RTEarea[0]["htmlarea-ie"] = "' . $this->writeTemporaryFile('EXT:' . $this->ID
. '/htmlarea/htmlarea-ie.js', "htmlarea-ie") . '";')
745 RTEarea[0]["htmlarea-gecko"] = "' . $this->writeTemporaryFile('EXT:' . $this->ID
. '/htmlarea/htmlarea-gecko.js', "htmlarea-gecko") . '";')) . '
746 _editor_url = "' . $this->extHttpPath
. 'htmlarea";
747 _editor_lang = "' . $this->language
. '";
748 _editor_CSS = "' . $this->editorCSS
. '";
749 _editor_skin = "' . dirname($this->editorCSS
) . '";
750 _editor_edited_content_CSS = "' . $this->editedContentCSS
. '";
751 _typo3_host_url = "' . $this->hostURL
. '";
752 _editor_debug_mode = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableDebugMode'] ?
'true' : 'false') . ';
753 _editor_compressed_scripts = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableCompressedScripts'] ?
'true' : 'false') . ';'
754 . (($this->client
['BROWSER'] == 'gecko') ?
('
755 _editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['mozAllowClipboardURL'] ?
$TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['mozAllowClipboardURL'] : '') . '";')
759 $loadJavascriptCode .= '
760 <script type="text/javascript" src="' . $this->buildJSMainLangFile($RTEcounter) . '"></script>
761 <script type="text/javascript" src="' . $this->writeTemporaryFile('EXT:' . $this->ID
. '/htmlarea/htmlarea.js', "htmlarea") . '"></script>
763 return $loadJavascriptCode;
767 * Return the inline Javascript code for initializing the RTE
769 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
771 * @return string the inline Javascript code for initializing the RTE
774 function loadJScode($RTEcounter) {
775 global $TYPO3_CONF_VARS;
777 $loadPluginCode = '';
778 foreach ($this->pluginEnabledCumulativeArray
[$RTEcounter] as $pluginId) {
779 $extensionKey = is_object($this->registeredPlugins
[$pluginId]) ?
$this->registeredPlugins
[$pluginId]->getExtensionKey() : $this->ID
;
781 HTMLArea.loadPlugin("' . $pluginId . '", true, "' . $this->writeTemporaryFile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $pluginId . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $pluginId)) . '.js', $pluginId) . '");';
783 return (!$this->is_FE() ?
'' : '
784 ' . '/*<![CDATA[*/') . ($this->is_FE() ?
'' : '
785 RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";')
786 . $loadPluginCode . '
787 HTMLArea.init();' . (!$this->is_FE() ?
'' : '
793 * Return the Javascript code for configuring the RTE
795 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
796 * @param string $table: The table that includes this RTE (optional, necessary for IRRE).
797 * @param string $uid: The uid of that table that includes this RTE (optional, necessary for IRRE).
798 * @param string $field: The field of that record that includes this RTE (optional).
800 * @return string the Javascript code for configuring the RTE
802 function registerRTEinJS($RTEcounter, $table='', $uid='', $field='') {
803 global $TYPO3_CONF_VARS;
805 $configureRTEInJavascriptString = (!$this->is_FE() ?
'' : '
806 ' . '/*<![CDATA[*/') . '
807 RTEarea['.$RTEcounter.'] = new Object();
808 RTEarea['.$RTEcounter.'].RTEtsConfigParams = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
809 RTEarea['.$RTEcounter.'].number = '.$RTEcounter.';
810 RTEarea['.$RTEcounter.'].id = "RTEarea'.$RTEcounter.'";
811 RTEarea['.$RTEcounter.'].enableWordClean = ' . (trim($this->thisConfig
['enableWordClean'])?
'true':'false') . ';
812 RTEarea['.$RTEcounter.']["htmlRemoveComments"] = ' . (trim($this->thisConfig
['removeComments'])?
'true':'false') . ';
813 RTEarea['.$RTEcounter.']["disableEnterParagraphs"] = ' . (trim($this->thisConfig
['disableEnterParagraphs'])?
'true':'false') . ';
814 RTEarea['.$RTEcounter.']["removeTrailingBR"] = ' . (trim($this->thisConfig
['removeTrailingBR'])?
'true':'false') . ';
815 RTEarea['.$RTEcounter.']["useCSS"] = ' . (trim($this->thisConfig
['useCSS'])?
'true':'false') . ';
816 RTEarea['.$RTEcounter.']["keepButtonGroupTogether"] = ' . (trim($this->thisConfig
['keepButtonGroupTogether'])?
'true':'false') . ';
817 RTEarea['.$RTEcounter.']["disablePCexamples"] = ' . (trim($this->thisConfig
['disablePCexamples'])?
'true':'false') . ';
818 RTEarea['.$RTEcounter.']["statusBar"] = ' . (trim($this->thisConfig
['showStatusBar'])?
'true':'false') . ';
819 RTEarea['.$RTEcounter.']["showTagFreeClasses"] = ' . (trim($this->thisConfig
['showTagFreeClasses'])?
'true':'false') . ';
820 RTEarea['.$RTEcounter.']["useHTTPS"] = ' . ((trim(stristr($this->siteURL
, 'https')) ||
$this->thisConfig
['forceHTTPS'])?
'true':'false') . ';
821 RTEarea['.$RTEcounter.']["enableMozillaExtension"] = ' . (($this->client
['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableMozillaExtension'])?
'true':'false') . ';
822 RTEarea['.$RTEcounter.']["tceformsNested"] = ' . (is_object($this->TCEform
) && method_exists($this->TCEform
, 'getDynNestedStack') ?
$this->TCEform
->getDynNestedStack(true) : '[]') . ';';
824 // The following properties apply only to the backend
825 if (!$this->is_FE()) {
826 $configureRTEInJavascriptString .= '
827 RTEarea['.$RTEcounter.'].sys_language_content = "' . $this->contentLanguageUid
. '";
828 RTEarea['.$RTEcounter.'].typo3ContentLanguage = "' . $this->contentTypo3Language
. '";
829 RTEarea['.$RTEcounter.'].typo3ContentCharset = "' . $this->contentCharset
. '";
830 RTEarea['.$RTEcounter.'].userUid = "' . $this->userUid
. '";';
833 // Setting the plugin flags
834 $configureRTEInJavascriptString .= '
835 RTEarea['.$RTEcounter.'].plugin = new Object();';
836 foreach ($this->pluginEnabledArray
as $pluginId) {
837 $configureRTEInJavascriptString .= '
838 RTEarea['.$RTEcounter.'].plugin.'.$pluginId.' = true;';
841 // Setting the buttons configuration
842 $configureRTEInJavascriptString .= '
843 RTEarea['.$RTEcounter.'].buttons = new Object();';
844 if (is_array($this->thisConfig
['buttons.'])) {
845 foreach ($this->thisConfig
['buttons.'] as $buttonIndex => $conf) {
846 $button = substr($buttonIndex, 0, -1);
847 if (in_array($button,$this->toolbar
)) {
849 $configureRTEInJavascriptString .= '
850 RTEarea['.$RTEcounter.'].buttons.'.$button.' = {';
851 if (is_array($conf)) {
852 foreach ($conf as $propertyName => $conf1) {
853 $property = $propertyName;
855 $configureRTEInJavascriptString .= ', ';
857 if (is_array($conf1)) {
858 $property = substr($property, 0, -1);
860 $configureRTEInJavascriptString .= '"'.$property.'" : {';
861 foreach ($conf1 as $property1Name => $conf2) {
862 $property1 = $property1Name;
863 if ($indexProperty) {
864 $configureRTEInJavascriptString .= ', ';
866 if (is_array($conf2)) {
867 $property1 = substr($property1, 0, -1);
869 $configureRTEInJavascriptString .= '"'.$property1.'" : {';
870 foreach ($conf2 as $property2Name => $conf3) {
871 $property2 = $property2Name;
872 if ($indexProperty1) {
873 $configureRTEInJavascriptString .= ', ';
875 if (is_array($conf3)) {
876 $property2 = substr($property2, 0, -1);
878 $configureRTEInJavascriptString .= '"'.$property2.'" : {';
879 foreach($conf3 as $property3Name => $conf4) {
880 $property3 = $property3Name;
881 if ($indexProperty2) {
882 $configureRTEInJavascriptString .= ', ';
884 if (!is_array($conf4)) {
885 $configureRTEInJavascriptString .= '"'.$property3.'" : '.($conf4?
'"'.$conf4.'"':'false');
889 $configureRTEInJavascriptString .= '}';
891 $configureRTEInJavascriptString .= '"'.$property2.'" : '.($conf3?
'"'.$conf3.'"':'false');
895 $configureRTEInJavascriptString .= '}';
897 $configureRTEInJavascriptString .= '"'.$property1.'" : '.($conf2?
'"'.$conf2.'"':'false');
901 $configureRTEInJavascriptString .= '}';
903 $configureRTEInJavascriptString .= '"'.$property.'" : '.($conf1?
'"'.$conf1.'"':'false');
908 $configureRTEInJavascriptString .= '};';
913 // Setting the list of tags to be removed if specified in the RTE config
914 if (trim($this->thisConfig
['removeTags'])) {
915 $configureRTEInJavascriptString .= '
916 RTEarea['.$RTEcounter.']["htmlRemoveTags"] = /^(' . implode('|', t3lib_div
::trimExplode(',', $this->thisConfig
['removeTags'], 1)) . ')$/i;';
919 // Setting the list of tags to be removed with their contents if specified in the RTE config
920 if (trim($this->thisConfig
['removeTagsAndContents'])) {
921 $configureRTEInJavascriptString .= '
922 RTEarea['.$RTEcounter.']["htmlRemoveTagsAndContents"] = /^(' . implode('|', t3lib_div
::trimExplode(',', $this->thisConfig
['removeTagsAndContents'], 1)) . ')$/i;';
925 // Process default style configuration
926 $configureRTEInJavascriptString .= '
927 RTEarea['.$RTEcounter.'].defaultPageStyle = "' . $this->hostURL
. $this->writeTemporaryFile('', 'defaultPageStyle', 'css', $this->buildStyleSheet()) . '";';
929 // Setting the pageStyle
930 $filename = trim($this->thisConfig
['contentCSS']) ?
trim($this->thisConfig
['contentCSS']) : 'EXT:' . $this->ID
. '/res/contentcss/default.css';
931 $configureRTEInJavascriptString .= '
932 RTEarea['.$RTEcounter.'].pageStyle = "' . $this->getFullFileName($filename) .'";';
934 // Process classes configuration
935 $classesConfigurationRequired = false;
936 foreach ($this->registeredPlugins
as $pluginId => $plugin) {
937 if ($this->isPluginEnabled($pluginId)) {
938 $classesConfigurationRequired = $classesConfigurationRequired ||
$plugin->requiresClassesConfiguration();
941 if ($classesConfigurationRequired) {
942 $configureRTEInJavascriptString .= $this->buildJSClassesConfig($RTEcounter);
945 // Add Javascript configuration for registered plugins
946 foreach ($this->registeredPlugins
as $pluginId => $plugin) {
947 if ($this->isPluginEnabled($pluginId)) {
948 $configureRTEInJavascriptString .= $plugin->buildJavascriptConfiguration($RTEcounter);
952 $configureRTEInJavascriptString .= '
953 RTEarea['.$RTEcounter.'].toolbar = '.$this->getJSToolbarArray().';
954 HTMLArea.initEditor('.$RTEcounter.');' . (!$this->is_FE() ?
'' : '
956 return $configureRTEInJavascriptString;
960 * Return true, if the plugin can be loaded
962 * @param string $pluginId: The identification string of the plugin
964 * @return boolean true if the plugin can be loaded
967 function isPluginEnabled($pluginId) {
968 return in_array($pluginId, $this->pluginEnabledArray
);
972 * Build the default content style sheet
974 * @return string Style sheet
976 function buildStyleSheet() {
978 if (!trim($this->thisConfig
['ignoreMainStyleOverride'])) {
979 $mainStyle_font = $this->thisConfig
['mainStyle_font'] ?
$this->thisConfig
['mainStyle_font']: 'Verdana,sans-serif';
981 $mainElements = array();
982 $mainElements['P'] = $this->thisConfig
['mainStyleOverride_add.']['P'];
983 $elList = explode(',','H1,H2,H3,H4,H5,H6,PRE');
984 foreach ($elList as $elListName) {
985 if ($this->thisConfig
['mainStyleOverride_add.'][$elListName]) {
986 $mainElements[$elListName] = $this->thisConfig
['mainStyleOverride_add.'][$elListName];
990 $addElementCode = '';
991 foreach ($mainElements as $elListName => $elValue) {
992 $addElementCode .= strToLower($elListName) . ' {' . $elValue . '}' . chr(10);
995 $stylesheet = $this->thisConfig
['mainStyleOverride'] ?
$this->thisConfig
['mainStyleOverride'] : chr(10) .
996 'body.htmlarea-content-body { font-family: ' . $mainStyle_font .
997 '; font-size: '.($this->thisConfig
['mainStyle_size'] ?
$this->thisConfig
['mainStyle_size'] : '12px') .
998 '; color: '.($this->thisConfig
['mainStyle_color']?
$this->thisConfig
['mainStyle_color'] : 'black') .
999 '; background-color: '.($this->thisConfig
['mainStyle_bgcolor'] ?
$this->thisConfig
['mainStyle_bgcolor'] : 'white') .
1000 ';'.$this->thisConfig
['mainStyleOverride_add.']['BODY'].'}' . chr(10) .
1001 'td { ' . $this->thisConfig
['mainStyleOverride_add.']['TD'].'}' . chr(10) .
1002 'div { ' . $this->thisConfig
['mainStyleOverride_add.']['DIV'].'}' . chr(10) .
1003 'pre { ' . $this->thisConfig
['mainStyleOverride_add.']['PRE'].'}' . chr(10) .
1004 'ol { ' . $this->thisConfig
['mainStyleOverride_add.']['OL'].'}' . chr(10) .
1005 'ul { ' . $this->thisConfig
['mainStyleOverride_add.']['UL'].'}' . chr(10) .
1006 'blockquote { ' . $this->thisConfig
['mainStyleOverride_add.']['BLOCKQUOTE'].'}' . chr(10) .
1009 if (is_array($this->thisConfig
['inlineStyle.'])) {
1010 $stylesheet .= chr(10) . implode(chr(10), $this->thisConfig
['inlineStyle.']) . chr(10);
1013 $stylesheet = '/* mainStyleOverride and inlineStyle properties ignored. */';
1019 * Return Javascript configuration of classes
1021 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
1023 * @return string Javascript configuration of classes
1025 function buildJSClassesConfig($RTEcounter) {
1026 // Build JS array of lists of classes
1027 $classesTagList = 'classesCharacter, classesParagraph, classesImage, classesTable, classesLinks, classesTD';
1028 $classesTagConvert = array( 'classesCharacter' => 'span', 'classesParagraph' => 'p', 'classesImage' => 'img', 'classesTable' => 'table', 'classesLinks' => 'a', 'classesTD' => 'td');
1029 $classesTagArray = t3lib_div
::trimExplode(',' , $classesTagList);
1030 $configureRTEInJavascriptString = '
1031 RTEarea['.$RTEcounter.']["classesTag"] = new Object();';
1032 foreach ($classesTagArray as $classesTagName) {
1033 $HTMLAreaJSClasses = ($this->thisConfig
[$classesTagName])?
('"' . $this->cleanList($this->thisConfig
[$classesTagName]) . '";'):'null;';
1034 $configureRTEInJavascriptString .= '
1035 RTEarea['.$RTEcounter.']["classesTag"]["'. $classesTagConvert[$classesTagName] .'"] = '. $HTMLAreaJSClasses;
1038 // Include JS arrays of configured classes
1039 $configureRTEInJavascriptString .= '
1040 RTEarea['.$RTEcounter.']["classesUrl"] = "' . $this->hostURL
. $this->writeTemporaryFile('', 'classes_'.$LANG->lang
, 'js', $this->buildJSClassesArray()) . '";';
1042 return $configureRTEInJavascriptString;
1046 * Return JS arrays of classes labels and noShow flags
1048 * @return string JS classes arrays
1050 function buildJSClassesArray() {
1051 global $TSFE, $LANG, $TYPO3_CONF_VARS;
1053 if ($this->is_FE()) {
1054 $RTEProperties = $this->RTEsetup
;
1056 $RTEProperties = $this->RTEsetup
['properties'];
1059 $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableCompressedScripts'] ?
'' : chr(10);
1061 $JSClassesLabelsArray = 'HTMLArea.classesLabels = { ' . $linebreak;
1062 $JSClassesValuesArray = 'HTMLArea.classesValues = { ' . $linebreak;
1063 $JSClassesNoShowArray = 'HTMLArea.classesNoShow = { ' . $linebreak;
1064 $JSClassesXORArray = 'HTMLArea.classesXOR = { ' . $linebreak;
1066 // Scanning the list of classes if specified in the RTE config
1067 if (is_array($RTEProperties['classes.'])) {
1069 foreach ($RTEProperties['classes.'] as $className => $conf) {
1070 $className = substr($className,0,-1);
1071 $classLabel = $this->getPageConfigLabel($conf['name']);
1072 $JSClassesLabelsArray .= (($index)?
',':'') . '"' . $className . '": ' . $classLabel . $linebreak;
1073 $JSClassesValuesArray .= (($index)?
',':'') . '"' . $className . '":"' . str_replace('"', '\"', str_replace('\\\'', '\'', $conf['value'])) . '"' . $linebreak;
1074 $JSClassesNoShowArray .= (($index)?
',':'') . '"' . $className . '":' . ($conf['noShow']?
'true':'false') . $linebreak;
1075 if (is_array($RTEProperties['mutuallyExclusiveClasses.'])) {
1076 foreach ($RTEProperties['mutuallyExclusiveClasses.'] as $listName => $conf) {
1077 if (t3lib_div
::inList($conf, $className)) {
1078 $JSClassesXORArray .= (($index)?
',':'') . '"' . $className . '": /^(' . implode('|', t3lib_div
::trimExplode(',', t3lib_div
::rmFromList($className, $conf), 1)) . ')$/i' . $linebreak;
1086 $JSClassesLabelsArray .= '};' . $linebreak;
1087 $JSClassesValuesArray .= '};' . $linebreak;
1088 $JSClassesNoShowArray .= '};' . $linebreak;
1089 $JSClassesXORArray .= '};' . $linebreak;
1091 return $JSClassesLabelsArray . $JSClassesValuesArray . $JSClassesNoShowArray . $JSClassesXORArray;
1095 * Return a Javascript localization array for htmlArea RTE
1097 * @return string Javascript localization array
1099 function buildJSMainLangArray() {
1100 global $TSFE, $LANG, $TYPO3_CONF_VARS;
1102 $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableCompressedScripts'] ?
'' : chr(10);
1103 $JSLanguageArray .= 'var HTMLArea_langArray = new Object();' . $linebreak;
1104 $JSLanguageArray .= 'HTMLArea_langArray = { ' . $linebreak;
1105 if($this->is_FE()) {
1106 $JSLanguageArray = $TSFE->csConvObj
->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset
);
1108 $JSLanguageArray = $LANG->csConvObj
->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset
);
1111 $subArrays = array( 'tooltips', 'msg' , 'dialogs');
1112 $subArraysIndex = 0;
1113 foreach($subArrays as $labels) {
1114 $JSLanguageArray .= (($subArraysIndex++
)?
',':'') . $labels . ': {' . $linebreak;
1115 if($this->is_FE()) {
1116 $LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm
::extPath($this->ID
).'htmlarea/locallang_' . $labels . '.xml', $this->language
);
1117 $TSFE->csConvObj
->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset
);
1118 if(!empty($LOCAL_LANG[$this->language
])) $TSFE->csConvObj
->convArray($LOCAL_LANG[$this->language
], $this->charset
, $this->OutputCharset
);
1120 $LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm
::extPath($this->ID
).'htmlarea/locallang_' . $labels . '.xml');
1121 $LANG->csConvObj
->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset
);
1122 if(!empty($LOCAL_LANG[$this->language
])) $LANG->csConvObj
->convArray($LOCAL_LANG[$this->language
], $this->charset
, $this->OutputCharset
);
1124 if(!empty($LOCAL_LANG[$this->language
])) {
1125 $LOCAL_LANG[$this->language
] = t3lib_div
::array_merge_recursive_overrule($LOCAL_LANG['default'], $LOCAL_LANG[$this->language
]);
1127 $LOCAL_LANG[$this->language
] = $LOCAL_LANG['default'];
1130 foreach ( $LOCAL_LANG[$this->language
] as $labelKey => $labelValue ) {
1131 $JSLanguageArray .= (($index++
)?
',':'') . '"' . $labelKey . '":"' . str_replace('"', '\"', $labelValue) . '"' . $linebreak;
1133 if($this->is_FE()) {
1134 $JSLanguageArray .= $TSFE->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1136 $JSLanguageArray .= $LANG->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1140 if($this->is_FE()) {
1141 $JSLanguageArray .= $TSFE->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1143 $JSLanguageArray .= $LANG->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1145 return $JSLanguageArray;
1149 * Writes contents in a file in typo3temp/rtehtmlarea directory and returns the file name
1151 * @param string $sourceFileName: The name of the file from which the contents should be extracted
1152 * @param string $label: A label to insert at the beginning of the name of the file
1153 * @param string $fileExtension: The file extension of the file, defaulting to 'js'
1154 * @param string $contents: The contents to write into the file if no $sourceFileName is provided
1156 * @return string The name of the file writtten to typo3temp/rtehtmlarea
1158 public function writeTemporaryFile($sourceFileName='', $label, $fileExtension='js', $contents='') {
1159 global $TYPO3_CONF_VARS;
1161 if ($sourceFileName) {
1163 $source = t3lib_div
::getFileAbsFileName($sourceFileName);
1164 $inputHandle = @fopen
($source, "rb");
1165 while (!feof($inputHandle)) {
1166 $output .= @fread
($inputHandle, 8192);
1168 fclose($inputHandle);
1170 $output = $contents;
1172 $compress = $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableCompressedScripts'] && ($fileExtension == 'js') && ($output != '');
1173 $relativeFilename = 'typo3temp/' . $this->ID
. '/' . str_replace('-','_',$label) . '_' . t3lib_div
::shortMD5(($TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['version'] . ($sourceFileName?
$sourceFileName:$output)), 20) . ($compress ?
'_compressed' : '') . '.' . $fileExtension;
1174 $destination = PATH_site
. $relativeFilename;
1175 if(!file_exists($destination)) {
1176 $compressedJavaScript = '';
1178 $compressedJavaScript = t3lib_div
::minifyJavaScript($output);
1180 $failure = t3lib_div
::writeFileToTypo3tempDir($destination, $compressedJavaScript?
$compressedJavaScript:$output);
1185 return ($this->thisConfig
['forceHTTPS']?
$this->siteURL
:$this->httpTypo3Path
) . $relativeFilename;
1189 * Return a file name containing the main JS language array for HTMLArea
1191 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
1193 * @return string filename
1196 function buildJSMainLangFile($RTEcounter) {
1197 $contents = $this->buildJSMainLangArray() . chr(10);
1198 foreach ($this->pluginEnabledCumulativeArray
[$RTEcounter] as $pluginId) {
1199 $contents .= $this->buildJSLangArray($pluginId) . chr(10);
1201 return $this->writeTemporaryFile('', $this->language
.'_'.$this->OutputCharset
, 'js', $contents);
1205 * Return a Javascript localization array for the plugin
1207 * @param string $plugin: identification string of the plugin
1209 * @return string Javascript localization array
1212 function buildJSLangArray($plugin) {
1213 global $TSFE, $LANG, $TYPO3_CONF_VARS;
1215 $extensionKey = is_object($this->registeredPlugins
[$plugin]) ?
$this->registeredPlugins
[$plugin]->getExtensionKey() : $this->ID
;
1217 $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID
]['enableCompressedScripts'] ?
'' : chr(10);
1218 if($this->is_FE()) {
1219 $LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm
::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language
);
1220 if(!empty($LOCAL_LANG['default'])) $TSFE->csConvObj
->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset
);
1221 if(!empty($LOCAL_LANG[$this->language
])) $TSFE->csConvObj
->convArray($LOCAL_LANG[$this->language
], $this->charset
, $this->OutputCharset
);
1223 $LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm
::extPath($extensionKey).'htmlarea/plugins/' . $plugin . '/locallang.xml');
1224 if(!empty($LOCAL_LANG['default'])) $LANG->csConvObj
->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset
);
1225 if(!empty($LOCAL_LANG[$this->language
])) $LANG->csConvObj
->convArray($LOCAL_LANG[$this->language
], $this->charset
, $this->OutputCharset
);
1228 if(!empty($LOCAL_LANG[$this->language
])) {
1229 $LOCAL_LANG[$this->language
] = t3lib_div
::array_merge_recursive_overrule($LOCAL_LANG['default'],$LOCAL_LANG[$this->language
]);
1231 $LOCAL_LANG[$this->language
] = $LOCAL_LANG['default'];
1234 $JSLanguageArray .= 'var ' . $plugin . '_langArray = new Object();' . $linebreak;
1235 $JSLanguageArray .= $plugin . '_langArray = {' . $linebreak;
1236 if($this->is_FE()) {
1237 $JSLanguageArray = $TSFE->csConvObj
->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset
);
1239 $JSLanguageArray = $LANG->csConvObj
->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset
);
1243 foreach ( $LOCAL_LANG[$this->language
] as $labelKey => $labelValue ) {
1244 $JSLanguageArray .= (($index++
)?
',':'') . '"' . $labelKey . '":"' . str_replace('"', '\"', $labelValue) . '"' . $linebreak;
1247 if($this->is_FE()) {
1248 $JSLanguageArray .= $TSFE->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1250 $JSLanguageArray .= $LANG->csConvObj
->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset
);
1253 return $JSLanguageArray;
1257 * Return the JS-Code for the Toolbar-Config-Array for HTML-Area
1259 * @return string the JS-Code as an JS-Array
1262 function getJSToolbarArray() {
1263 $toolbar = ''; // The JS-Code for the toolbar
1264 $group = ''; // The TS-Code for the group in the moment, each group are between "bar"s
1265 $group_has_button = false; // True if the group has any enabled buttons
1266 $group_needs_starting_bar = false;
1267 $previous_is_space = false;
1269 // process each button in the order list
1270 foreach ($this->toolbarOrderArray
as $button) {
1271 // check if a new group starts
1272 if (($button == 'bar' ||
$button == 'linebreak') && $group_has_button) {
1274 if ($button == 'linebreak') {
1275 $convertButton = '"' . $this->convertToolbarForHTMLArea('linebreak') . '"';
1276 $group = ($group!='') ?
($group . ', ' . $convertButton) : $convertButton;
1279 $toolbar .= $toolbar ?
(', ' . $group) : ('[[' . $group);
1281 $previous_is_space = false;
1282 $group_has_button = false;
1283 $group_needs_starting_bar = true;
1284 } elseif ($toolbar && $button == 'linebreak' && !$group_has_button) {
1285 // Insert linebreak if no group is opened
1287 $previous_is_space = false;
1288 $group_needs_starting_bar = false;
1289 $toolbar .= ', "' . $this->convertToolbarForHTMLArea($button) . '"';
1290 } elseif ($button == 'bar' && !$group_has_button) {
1291 $group_needs_starting_bar = true;
1292 } elseif ($button == 'space' && $group_has_button && !$previous_is_space) {
1293 $convertButton = $this->convertToolbarForHTMLArea($button);
1294 $convertButton = '"' . $convertButton . '"';
1295 $group .= $group ?
(', ' . $convertButton) : ($group_needs_starting_bar ?
('"' . $this->convertToolbarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
1296 $group_needs_starting_bar = false;
1297 $previous_is_space = true;
1298 } elseif (in_array($button, $this->toolbar
)) {
1299 // Add the button to the group
1300 $convertButton = $this->convertToolbarForHTMLArea($button);
1301 if ($convertButton) {
1302 $convertButton = '"' . $convertButton . '"';
1303 $group .= $group ?
(', ' . $convertButton) : ($group_needs_starting_bar ?
('"' . $this->convertToolbarForHTMLArea('bar') . '", ' . $convertButton) : $convertButton);
1304 $group_has_button = true;
1305 $group_needs_starting_bar = false;
1306 $previous_is_space = false;
1311 // add the last group
1312 if($group_has_button) $toolbar .= $toolbar ?
(', ' . $group) : ('[[' . $group);
1313 $toolbar = $toolbar . ']]';
1317 public function getLLContent($string) {
1320 $BE_lang = $LANG->lang
;
1321 $BE_origCharset = $LANG->origCharSet
;
1322 $BE_charSet = $LANG->charSet
;
1323 $LANG->lang
= $this->contentTypo3Language
;
1324 $LANG->origCharSet
= $this->origContentCharSet
;
1325 $LANG->charSet
= $this->contentCharset
;
1326 $LLString = $LANG->JScharCode($LANG->sL($string));
1327 $LANG->lang
= $BE_lang;
1328 $LANG->origCharSet
= $BE_origCharset;
1329 $LANG->charSet
= $BE_charSet;
1333 public function getPageConfigLabel($string,$JScharCode=1) {
1334 global $LANG, $TSFE;
1336 if ($this->is_FE()) {
1337 $label = $TSFE->csConvObj
->conv($TSFE->sL(trim($string)), $TSFE->renderCharset
, $TSFE->metaCharset
);
1338 $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
1339 $label = $JScharCode ?
$this->feJScharCode($label) : $label;
1341 if (strcmp(substr($string,0,4),'LLL:')) {
1344 $label = $LANG->sL(trim($string));
1346 $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
1347 $label = $JScharCode ?
$LANG->JScharCode($label): $label;
1352 function feJScharCode($str) {
1354 // Convert string to UTF-8:
1355 if ($this->OutputCharset
!= 'utf-8') $str = $TSFE->csConvObj
->utf8_encode($str,$this->OutputCharset
);
1356 // Convert the UTF-8 string into a array of char numbers:
1357 $nArr = $TSFE->csConvObj
->utf8_to_numberarray($str);
1358 return 'String.fromCharCode('.implode(',',$nArr).')';
1361 public function getFullFileName($filename) {
1362 if (substr($filename,0,4)=='EXT:') { // extension
1363 list($extKey,$local) = explode('/',substr($filename,4),2);
1365 if (strcmp($extKey,'') && t3lib_extMgm
::isLoaded($extKey) && strcmp($local,'')) {
1366 $newFilename = $this->siteURL
. t3lib_extMgm
::siteRelPath($extKey) . $local;
1368 } elseif (substr($filename,0,1) != '/') {
1369 $newFilename = $this->siteURL
. $filename;
1371 $newFilename = $this->siteURL
. substr($filename,1);
1373 return $newFilename;
1377 * Return the Javascript code for copying the HTML code from the editor into the hidden input field.
1378 * This is for submit function of the form.
1380 * @param integer $RTEcounter: The index number of the current RTE editing area within the form.
1381 * @param string $formName: the name of the form
1382 * @param string $textareaId: the id of the textarea
1384 * @return string Javascript code
1386 function setSaveRTE($RTEcounter, $formName, $textareaId) {
1388 editornumber = '.$RTEcounter.';
1389 if (RTEarea[editornumber]) {
1390 document.'.$formName.'["'.$textareaId.'"].value = RTEarea[editornumber]["editor"].getHTML();
1399 * Return true if we are in the FE, but not in the FE editing feature of BE.
1406 return is_object($TSFE) && !strstr($this->elementId
,'TSFE_EDIT');
1410 * Client Browser Information
1414 * @param string Alternative User Agent string (if empty, t3lib_div::getIndpEnv('HTTP_USER_AGENT') is used)
1415 * @return array Parsed information about the HTTP_USER_AGENT in categories BROWSER, VERSION, SYSTEM and FORMSTYLE
1418 function clientInfo($useragent='') {
1419 global $TYPO3_CONF_VARS;
1421 if (!$useragent) $useragent=t3lib_div
::getIndpEnv('HTTP_USER_AGENT');
1425 if (strstr($useragent,'Konqueror')) {
1426 $bInfo['BROWSER']= 'konqu';
1427 } elseif (strstr($useragent,'Opera')) {
1428 $bInfo['BROWSER']= 'opera';
1429 } elseif (strstr($useragent,'MSIE')) {
1430 $bInfo['BROWSER']= 'msie';
1431 } elseif (strstr($useragent,'Gecko/')) {
1432 $bInfo['BROWSER']='gecko';
1433 } elseif (strstr($useragent,'Safari/')) {
1434 $bInfo['BROWSER']='safari';
1435 } elseif (strstr($useragent,'Mozilla/4')) {
1436 $bInfo['BROWSER']='net';
1439 if ($bInfo['BROWSER']) {
1441 switch($bInfo['BROWSER']) {
1443 $bInfo['VERSION']= doubleval(substr($useragent,8));
1444 if (strstr($useragent,'Netscape6/')) {$bInfo['VERSION']=doubleval(substr(strstr($useragent,'Netscape6/'),10));}
1445 if (strstr($useragent,'Netscape/7')) {$bInfo['VERSION']=doubleval(substr(strstr($useragent,'Netscape/7'),9));}
1448 $tmp = strstr($useragent,'rv:');
1449 $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,3)));
1452 $tmp = strstr($useragent,'MSIE');
1453 $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,4)));
1456 $tmp = strstr($useragent,'Safari/');
1457 $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,3)));
1460 $tmp = strstr($useragent,'Opera');
1461 $bInfo['VERSION'] = doubleval(ereg_replace('^[^0-9]*','',substr($tmp,5)));
1464 $tmp = strstr($useragent,'Konqueror/');
1465 $bInfo['VERSION'] = doubleval(substr($tmp,10));
1470 if (strstr($useragent,'Win')) {
1471 $bInfo['SYSTEM'] = 'win';
1472 } elseif (strstr($useragent,'Mac')) {
1473 $bInfo['SYSTEM'] = 'mac';
1474 } elseif (strstr($useragent,'Linux') ||
strstr($useragent,'X11') ||
strstr($useragent,'SGI') ||
strstr($useragent,' SunOS ') ||
strstr($useragent,' HP-UX ')) {
1475 $bInfo['SYSTEM'] = 'unix';
1479 // Is true if the browser supports css to format forms, especially the width
1480 $bInfo['FORMSTYLE']=($bInfo['BROWSER']=='msie' ||
($bInfo['BROWSER']=='net'&&$bInfo['VERSION']>=5) ||
$bInfo['BROWSER']=='opera' ||
$bInfo['BROWSER']=='konqu');
1484 /***************************
1486 * OTHER FUNCTIONS: (from Classic RTE)
1488 ***************************/
1490 * @return [type] ...
1494 function RTEtsConfigParams() {
1495 if($this->is_FE()) {
1498 $p = t3lib_BEfunc
::getSpecConfParametersFromArray($this->specConf
['rte_transform']['parameters']);
1499 return $this->elementParts
[0].':'.$this->elementParts
[1].':'.$this->elementParts
[2].':'.$this->thePid
.':'.$this->typeVal
.':'.$this->tscPID
.':'.$p['imgpath'];
1503 public function cleanList($str) {
1504 if (strstr($str,'*')) {
1507 $str = implode(',',array_unique(t3lib_div
::trimExplode(',',$str,1)));
1512 function filterStyleEl($elValue,$matchList) {
1513 $matchParts = t3lib_div
::trimExplode(',',$matchList,1);
1514 $styleParts = explode(';',$elValue);
1516 foreach ($styleParts as $k => $p) {
1517 $pp = t3lib_div
::trimExplode(':',$p);
1518 if ($pp[0]&&$pp[1]) {
1519 foreach ($matchParts as $el) {
1520 $star=substr($el,-1)=='*';
1521 if (!strcmp($pp[0],$el) ||
($star && t3lib_div
::isFirstPartOfStr($pp[0],substr($el,0,-1)) )) {
1522 $nStyle[]=$pp[0].':'.$pp[1];
1523 } else unset($styleParts[$k]);
1526 unset($styleParts[$k]);
1529 return implode('; ',$nStyle);
1532 // Hook on lorem_ipsum extension to insert text into the RTE in wysiwyg mode
1533 function loremIpsumInsert($params) {
1535 if (typeof(lorem_ipsum) == 'function' && " . $params['element'] . ".tagName.toLowerCase() == 'textarea' ) lorem_ipsum(" . $params['element'] . ", lipsum_temp_strings[lipsum_temp_pointer]);
1540 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/rtehtmlarea/class.tx_rtehtmlarea_base.php']) {
1541 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/rtehtmlarea/class.tx_rtehtmlarea_base.php']);