Documentation TYPO3 par Ameos

rte.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00059 unset($MCONF);
00060 require ('conf.php');
00061 require ($BACK_PATH.'init.php');
00062 require ($BACK_PATH.'template.php');
00063 
00064 require_once (PATH_t3lib.'class.t3lib_page.php');
00065 
00066 
00067 
00068 
00069 
00070 
00078 class SC_rte_rte {
00079         var $content;
00080 
00081         var $elementId;
00082         var $elementParts;
00083         var $tscPID;
00084         var $typeVal;
00085         var $thePid;
00086         var $RTEsetup;
00087         var $thisConfig;
00088         var $hide;
00089         var $toggleHTML;
00090         var $confValues;
00091         var $siteUrl;
00092         var $language;
00093         var $specConf;
00094 
00098         function init() {
00099                 global $BE_USER,$LANG,$TBE_TEMPLATE,$TCA;
00100 #debug(t3lib_div::_GET());
00101 
00102                         // Element ID + pid
00103                 $this->elementId = t3lib_div::_GP('elementId');
00104                 $this->elementParts = explode('][',ereg_replace('\]$','',ereg_replace('^(TSFE_EDIT\[data\]\[|data\[)','',$this->elementId)));
00105 
00106                         // Find the page PIDs:
00107                 list($this->tscPID,$this->thePid) = t3lib_BEfunc::getTSCpid(trim($this->elementParts[0]),trim($this->elementParts[1]),t3lib_div::_GP('pid'));
00108 
00109                         // Record "types" field value:
00110                 $this->typeVal = t3lib_div::_GP('typeVal');
00111                 if (!isset($_GET['typeVal']))   {
00112                         die ('System Error: No typeVal was sent!');
00113                 }
00114 
00115                         // Find "thisConfig" for record/editor:
00116                 unset($this->RTEsetup);
00117                 $this->thisConfig = array();
00118                 if ($this->thePid >= 0) {
00119                         $this->RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->tscPID));
00120                         $this->thisConfig = t3lib_BEfunc::RTEsetup($this->RTEsetup['properties'],$this->elementParts[0],$this->elementParts[2],$this->typeVal);
00121                 } else {
00122                         die ('System Error: Could not fetch configuration based on the parameters sent to the script. ($this->thePid, $this->elementId)');              // This will prevent the RTE from being used with record who has a pid of zero, so maybe this is not so smart...?
00123                 }
00124 
00125                 if ($this->thisConfig['disabled'])      {
00126                         die ('System Error: Apparently the RTE is disabled and this script should not have been loaded anyway.');
00127                 }
00128 
00129 
00130                         // Special configuration (line) and default extras:
00131                 $en = t3lib_div::_GP('sC');
00132                 $defaultExtras = t3lib_div::_GP('defaultExtras');
00133                 $this->specConf = t3lib_BEfunc::getSpecConfParts($en,$defaultExtras);
00134 
00135                         // Tool bar stuff:
00136                 $this->makeToolBarHide();
00137 
00138                         // bgColor
00139                 $this->confValues['backgroundColor'] = t3lib_div::_GP('bgColor');
00140                 if (!$this->confValues['backgroundColor'])      {
00141                         $this->confValues['backgroundColor'] = $TBE_TEMPLATE->bgColor3;
00142                 }
00143                 $this->confValues['steelBlue'] = $TBE_TEMPLATE->bgColor2;
00144 
00145                         // ***************************
00146                         // Language
00147                         // ***************************
00148                 $this->language = $LANG->lang;
00149                 if ($this->language=='default') {
00150                         $this->language='';
00151                 }
00152 
00153                 $this->siteUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00154         }
00155 
00161         function makeToolBarHide()      {
00162                 global $BE_USER;
00163 
00164                         // ***************************
00165                         // Find list of elements active
00166                         // ***************************
00167                                 // All elements:
00168                 $all = array('cut','copy','paste','bar1','formatblock','class','fontstyle','fontsize','textcolor','bar2','bold','italic','underline','bar3','left','center','right','bar4','orderedlist','unorderedlist','outdent','indent','bar5','link','table','bgcolor','image','bar6','emoticon','line','user');
00169                 $bars = array('bar1','bar2','bar3','bar4','bar5','bar6');
00170 
00171                         // These can never be displayed
00172                 $this->hide=array();    // elements to hide
00173                 //      $this->hide[]='emoticon';
00174                 //      $this->hide[]='bgcolor';
00175 
00176                         // specConf for field from backend
00177                 $pList = is_array($this->specConf['richtext']['parameters']) ? implode(',',$this->specConf['richtext']['parameters']) : '';
00178                 if ($pList!='*')        {       // If not all
00179                         $show = array_merge($this->specConf['richtext']['parameters'],$bars);                   // Merging listed and obligatory elements
00180 
00181                         if ($this->thisConfig['showButtons'])   {
00182                                 $show = array_unique(array_merge($show,t3lib_div::trimExplode(',',$this->thisConfig['showButtons'],1)));
00183                         }
00184                         $this->hide = array_diff($all,$show);
00185                 }
00186 
00187                         // RTEkeyList for backend user
00188                 $RTEkeyList = isset($BE_USER->userTS['options.']['RTEkeyList']) ? $BE_USER->userTS['options.']['RTEkeyList'] : '*';
00189                 if ($RTEkeyList!='*')   {
00190                         $show = t3lib_div::trimExplode(',',$RTEkeyList,1);
00191                         $show = array_merge($show,$bars);                       // Merging listed and obligatory elements
00192                         $this->hide = array_diff($all,$show);
00193                                 // Toggle if 'Source code' button should be displayed.
00194                         $this->toggleHTML = in_array('chMode',$show) ? 1 : 0;
00195                 } else {$this->toggleHTML=1;}
00196 
00197                         // Add removed fields from RTE config
00198                 if ($this->thisConfig['hideButtons'])   {
00199                         $this->hide = array_unique(array_merge($this->hide,t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1)));
00200                 }
00201 
00202                         // Making sure that no illegal keys are in the array
00203                 $this->hide=array_intersect($all,$this->hide);
00204                         // Trying to find out if any bars useless
00205                 $this->hide=$this->detectUselessBar($this->hide,$all);
00206         }
00207 
00213         function getLabels()    {
00214                 global $LANG,$LOCAL_LANG;
00215 
00216                 include (t3lib_extMgm::extPath('rte').'app/locallang.php');
00217 
00218                 $labels='';
00219                 foreach($LOCAL_LANG['default'] as $key => $label)       {
00220                         $labels.= 'var '.$key.' = '.$LANG->JScharCode($LANG->getLL($key)).';'.chr(10);
00221                 }
00222 
00223                 return $labels;
00224         }
00225 
00231         function makeHeader()   {
00232                 $this->content='';
00233                 $this->content.='
00234 <HTML>
00235 <HEAD>
00236         <script language="javascript" type="text/javascript">
00237 
00238 /* Labels: */
00239 '.$this->getLabels().'
00240 
00241         </script>
00242         <script language="javascript" type="text/javascript" src="rte.js"></script>
00243         <STYLE>
00244                 body {margin:0pt;border:none;padding:0pt}
00245                 #tbDBSelect {display:none;text-align:left;width: 100;margin-right: 1pt;margin-bottom: 0pt;margin-top: 0pt;padding: 0pt}
00246                 #DBSelect, #idMode, .userButton {font:8pt arial}
00247                 #DBSelect {width:100}
00248                 #idMode {margin-top:0pt}
00249                 .tbButton {text-align:left;margin:0pt 1pt 0pt 0pt;padding:0pt}
00250                 #EditBox {position: relative}
00251                 select  {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00252                 textarea  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
00253                 input   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00254         </STYLE>
00255         <STYLE ID=skin>
00256                 #EditBox {margin: 0px 0px 0px 0px}
00257                 #tbUpRight, #tbUpLeft {width:110px}
00258                 #idMode {background: '.$this->confValues['backgroundColor'].';margin-left:0px;padding:0pt}
00259                 #idMode LABEL {color: black; font:bold 10px verdana; text-decoration: none}
00260                 #tbTopBar {height:19px}
00261                 #tbButtons, #tbContents {background: '.$this->confValues['backgroundColor'].';vertical-align: top}
00262                 #tbContents {padding:0px 0px}
00263                 #tbBottomBar {height:0px}
00264         </STYLE>
00265         <STYLE ID=defPopupSkin>
00266                 #popup BODY {margin:0px;border-top:none}
00267                 #popup .colorTable TR {height:6px}
00268                 #popup .colorTable TD {width:6px;cursor:hand}
00269                 #popup .colorTable, .CLASSES {font: 10px verdana;}
00270                 #popup #header {width:100%}
00271                 #popup #close {cursor:default;font:bold 8pt system;width:16px;text-align: center}
00272                 #popup #content {padding:10pt}
00273                 #popup TABLE {vertical-align:top}
00274                 #popup .tabBody {border:1px black solid;border-top: none}
00275                 #popup .tabItem, #popup .tabSpace {border-bottom:1px black solid;border-left:1px black solid}
00276                 #popup .tabItem {border-top:1px black solid;font:10pt arial,geneva,sans-serif;}
00277                 #popup .currentColor {width:20px;height:20px; margin: 0pt;margin-right:15pt;border:1px black solid}
00278                 #popup .tabItem DIV {margin:3px;padding:0px;cursor: hand}
00279                 #popup .tabItem DIV.disabled {color: gray;cursor: default}
00280                 #popup .selected {font-weight:bold}
00281                 #popup .emoticon {cursor:hand}
00282                 #popup .specialColors {color:black; font:10px verdana;}
00283 ';
00284 
00285                 if (is_array($this->RTEsetup['properties']['classes.']))        {
00286                         reset($this->RTEsetup['properties']['classes.']);
00287                         while(list($className,$conf)=each($this->RTEsetup['properties']['classes.']))   {
00288                                 $this->content.='#popup .CLASSES'.substr($className,0,-1).' {'.$conf['value']."} \n";
00289                         }
00290                 }
00291                 $this->content.='
00292         </STYLE>
00293         <STYLE ID=popupSkin>
00294                 #popup BODY {border: 1px black solid; background: '.$this->confValues['backgroundColor'].'}
00295                 #popup #header {background:'.$this->confValues['steelBlue'].'; color: black}
00296                 #popup #caption {text-align: left;font: bold 10px verdana}
00297                 #popup .ColorTable, #popup #idList #idListTR TD#current {border: 1px black solid}
00298                 #popup #idList TD{cursor: hand;border: 0px #F1F1F1 solid; background:'.$this->confValues['backgroundColor'].';}
00299                 #idListTR TR{cursor: hand;background:'.$this->confValues['backgroundColor'].';}
00300                 #popup #close {border: 1px black solid;cursor:hand;color: black;font: bold 10px verdana; margin-right: 3px;padding:0px 4px 2px}
00301                 #popup #tableProps .tablePropsTitle {color:#006699;text-align:left;margin:0pt;border-bottom: 1px black solid;margin-bottom:5pt}
00302                 #tableButtons, #tableProps {padding:5px}
00303                 #popup #tableContents {height:175px}
00304                 #popup #tableProps .tablePropsTitle, #popup #tableProps, #popup #tableProps TABLE {font: 10px verdana;}
00305                 #popup #tableOptions  {color: black; font:bold 10px verdana; padding:15pt 5pt; }
00306                 #popup #puDivider {background:black;width:1px}
00307                 #popup #content {margin: 0pt;padding:0pt 0pt 5pt 0pt}
00308                 #popup #ColorPopup {width: 250px}
00309                 #popup .block P,#popup .block H1,#popup .block H2,#popup .block H3,
00310                 #popup .block H4, #popup .block H5,#popup .block H6,#popup .block PRE {margin:0pt;padding:0pt}
00311                 #popup #customFont {font: 10px verdana;text-decoration:italic}
00312                 #popup select  {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00313                 #popup textarea  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
00314                 #popup input   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00315         </STYLE>
00316         <script language="javascript" type="text/javascript">
00317                 var L_EMOTICONPATH_TEXT = "'.$this->siteUrl.'t3lib/gfx/emoticons/";
00318                 var theEditor;
00319                 window.onload = initEditor;
00320                 var theBackGroundColor = "'.$this->confValues['backgroundColor'].'";
00321                 ';
00322 
00323                 $this->content.='
00324                 var BACK_PATH = "'.$GLOBALS['BACK_PATH'].'";
00325                 function spitItOut()    {       //
00326         //              self.parent.TBE_EDITOR_setHiddenContent(getHTML(),"'.$this->elementId.'");
00327                 }
00328                 function spitItIn()     {       //
00329                         self.parent.TBE_EDITOR_setRTEref(self,"'.$this->elementId.'",1);
00330 //                      setHTML(self.parent.'.t3lib_div::_GP('formName').'["'.$this->elementId.'"].value);
00331                 }
00332                 ';
00333 
00334                 $this->content.='
00335                 function setButtons()   {
00336                 ';
00337                 reset($this->hide);
00338                 while(list(,$value)=each($this->hide))  {
00339                         $this->content.='
00340                         setToolbar("tb'.$value.'",0);';
00341                 }
00342                 $this->content.='
00343                 }
00344                 ';
00345         }
00346 
00352         function JSout()        {
00353                 global $LANG;
00354 
00355                 // **********************************************
00356                 // Setting up the available classes for the RTE
00357                 // **********************************************
00358                 $JSout='';
00359 
00360                 $JSout.="var classes_style = new Array(); \n";
00361                 $JSout.="var classes_label = new Array(); \n";
00362                 $JSout.="var classes_noShow = new Array(); \n";
00363                 if (is_array($this->RTEsetup['properties']['classes.']))        {
00364                         reset($this->RTEsetup['properties']['classes.']);
00365                         $cc=0;
00366                         while(list($className,$conf)=each($this->RTEsetup['properties']['classes.']))   {
00367                                 $className = substr($className,0,-1);
00368                                 $JSout.= 'classes_style['.$cc."]=' .".$className." {'+unescape('".t3lib_div::rawUrlEncodeJS($conf['value'])."')+'}'; \n";
00369                                 $JSout.= "classes_label['".$className."']=".$LANG->JScharCode($LANG->sL($conf['name']))."; \n";
00370                                 $JSout.= "classes_noShow['".$className."']=".($conf['noShow']?1:0)."; \n";
00371                                 $cc++;
00372                         }
00373                 }
00374 
00375                 $JSout.="var colors_value = new Array(); \n";
00376                 $JSout.="var colors_label = new Array(); \n";
00377                 if (is_array($this->RTEsetup['properties']['colors.'])) {
00378                         reset($this->RTEsetup['properties']['colors.']);
00379                         while(list($cName,$conf)=each($this->RTEsetup['properties']['colors.']))        {
00380                                 $cName=substr($cName,0,-1);
00381                                 $JSout.= "colors_value['".$cName."']='".$conf['value']."'; \n";
00382                                 $JSout.= "colors_label['".$cName."']=".$LANG->JScharCode($LANG->sL($conf['name']))."; \n";
00383                         }
00384                 }
00385 
00386                 $JSout.="var fonts_value = new Array(); \n";
00387                 $JSout.="var fonts_label = new Array(); \n";
00388                 if (is_array($this->RTEsetup['properties']['fonts.']))  {
00389                         reset($this->RTEsetup['properties']['fonts.']);
00390                         while(list($fontName,$conf)=each($this->RTEsetup['properties']['fonts.']))      {
00391                                 $fontName=substr($fontName,0,-1);
00392                                 $JSout.= "fonts_value['".$fontName."']='".$conf['value']."'; \n";
00393                                 $JSout.= "fonts_label['".$fontName."']=".$LANG->JScharCode($LANG->sL($conf['name']))."; \n";
00394                         }
00395                 }
00396                 $mainStyle_font=($this->thisConfig['mainStyle_font']?$this->thisConfig['mainStyle_font']:'Verdana');
00397 
00398                 $mainElements=array();
00399                 $mainElements['P'] = 'margin-top:0px; margin-bottom:5px;'.$this->thisConfig['mainStyleOverride_add.']['P'];
00400                 $elList=explode(',','H1,H2,H3,H4,H5,H6,PRE');
00401                 while(list(,$elListName)=each($elList)) {
00402                         if ($this->thisConfig['mainStyleOverride_add.'][$elListName])   $mainElements[$elListName]=$this->thisConfig['mainStyleOverride_add.'][$elListName];
00403                 }
00404 
00405                 $JSout.="var main_elements_style = new Array(); \n";
00406                 $addElementCode='';
00407                 reset($mainElements);
00408                 while(list($elListName,$elValue)=each($mainElements))   {
00409                         $addElementCode.=$elListName.' {'.$elValue."}\n";
00410                         $JSout.="main_elements_style['".$elListName."']=unescape('".rawurlencode($this->filterStyleEl($elValue,'color,font*'))."');\n";
00411                 }
00412 
00413                 $styleCode = $this->thisConfig['mainStyleOverride'] ? $this->thisConfig['mainStyleOverride'] : '
00414                 BODY {border: 1px black solid; border-top: none; margin : 2 2 2 2'.
00415                         '; font-family:'.$mainStyle_font.
00416                         '; font-size:'.($this->thisConfig['mainStyle_size']?$this->thisConfig['mainStyle_size']:'10px').
00417                         '; color:'.($this->thisConfig['mainStyle_color']?$this->thisConfig['mainStyle_color']:'black').
00418                         '; background-color:'.($this->thisConfig['mainStyle_bgcolor']?$this->thisConfig['mainStyle_bgcolor']:'white').
00419                         ';'.$this->thisConfig['mainStyleOverride_add.']['BODY'].'}
00420                 TD {font-family:Verdana; font-size:10px;'.$this->thisConfig['mainStyleOverride_add.']['TD'].'}
00421                 DIV {margin-top:0px; margin-bottom:5px;'.$this->thisConfig['mainStyleOverride_add.']['DIV'].'}
00422                 PRE {margin-top:0px; margin-bottom:5px;'.$this->thisConfig['mainStyleOverride_add.']['PRE'].'}
00423                 OL {margin: 5px 10px 5px 30px;'.$this->thisConfig['mainStyleOverride_add.']['OL'].'}
00424                 UL {margin: 5px 10px 5px 30px;'.$this->thisConfig['mainStyleOverride_add.']['UL'].'}
00425                 BLOCKQUOTE {margin-top:0px; margin-bottom:0px;'.$this->thisConfig['mainStyleOverride_add.']['BLOCKQUOTE'].'}
00426                 '.$addElementCode;
00427 
00428                 if (is_array($this->thisConfig['inlineStyle.']))        {
00429                         $styleCode.=chr(10).implode(chr(10),$this->thisConfig['inlineStyle.']).chr(10);
00430                 }
00431 
00432                 $JSout.='var inlineStyle = unescape("'.t3lib_div::rawUrlEncodeJS($styleCode).'");'.chr(10);
00433 
00434                 $JSout.="var conf_classesParagraph = '".$this->cleanList($this->thisConfig['classesParagraph'])."'; \n";
00435                 $JSout.="var conf_classesCharacter = '".$this->cleanList($this->thisConfig['classesCharacter'])."'; \n";
00436                 $JSout.="var conf_classesImage = '".$this->cleanList($this->thisConfig['classesImage'])."'; \n";
00437                 $JSout.="var conf_classesTable = '".$this->cleanList($this->thisConfig['classesTable'])."'; \n";
00438                 $JSout.="var conf_classesLinks = '".$this->cleanList($this->thisConfig['classesLinks'])."'; \n";
00439                 $JSout.="var conf_classesTD = '".$this->cleanList($this->thisConfig['classesTD'])."'; \n";
00440                 $JSout.="var conf_colors = '".$this->cleanList($this->thisConfig['colors'])."'; \n";
00441                 $JSout.="var conf_fontFace = '".$this->cleanList($this->thisConfig['fontFace'])."'; \n";
00442                 $JSout.="var conf_hidePStyleItems = '".$this->cleanList(strtoupper($this->thisConfig['hidePStyleItems']))."'; \n";
00443                 $JSout.="var conf_hideFontFaces = '".$this->cleanList($this->thisConfig['hideFontFaces'])."'; \n";
00444                 $JSout.="var conf_hideFontSizes = '".$this->cleanList($this->thisConfig['hideFontSizes'])."'; \n";
00445                 $JSout.='var conf_disableColorPicker = '.($this->thisConfig['disableColorPicker']?1:0)."; \n";
00446                 $JSout.="var conf_RTEtsConfigParams = '&RTEtsConfigParams=".rawurlencode($this->RTEtsConfigParams())."'; \n";
00447                 $JSout.='var conf_enableRightClick = '.($this->thisConfig['disableRightClick']?0:1).";\n";
00448                 $JSout.="var conf_fontSizeStyle = unescape('font-family:".rawurlencode($mainStyle_font)."');\n";
00449                 $JSout.="var conf_NeutralStyle = 'font-family:Verdana,Arial; font-size:10; font-weight:normal; color:black;';\n";
00450                 $JSout.='var conf_showExampleInPopups = '.($this->thisConfig['disablePCexamples']?0:1).";\n";
00451 
00452 
00453                 /*
00454                 $JSout.='alert(conf_classesParagraph);';
00455                 $JSout.='alert(conf_classesCharacter);';
00456                 $JSout.='alert(conf_colors);';
00457                 $JSout.='alert(conf_fontFace);';
00458                 $JSout.='alert(conf_hidePStyleItems);';
00459                 $JSout.='alert(conf_hideFontFaces);';
00460                 */
00461 
00462                 $this->content.=$JSout;
00463         }
00464 
00470         function main() {
00471                 $this->content.='
00472 </script>
00473 </head>
00474 <body tabindex="-1" scroll="no" oncontextmenu="return false;" onselectstart="return false;" ondragstart="return false;" onscroll="return false;" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
00475         <div id="idEditor" style="visibility: hidden;">
00476                 <table id="idToolbar" border="0" width="100%" cellspacing="0" cellpadding="0" onclick="edHidePopup();">
00477                         <tr>
00478                                 <td id="tbContents"><script language="javascript" type="text/javascript">drawToolbar();</script></td>
00479                         </tr>
00480                         <tr><td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td></tr>
00481                 </table>
00482                 <iframe src="./rte.php" name="idPopup" style="height: 200px; left: 25px; margin-top: 8px; position: absolute; visibility: hidden; width: 200px; z-index: -1"></iframe>
00483                 <iframe src="./rte.php" id="EditBox" name="idEditbox" width="100%" height="100%" onfocus="edHidePopup();" onblur="spitItOut();"></iframe>
00484                 <div id="tbmode"><script language="javascript" type="text/javascript">drawModeSelect('.$this->toggleHTML.');</script></div>
00485         </div>
00486 </body>
00487 </html>';
00488         }
00489 
00495         function printContent() {
00496                 echo $this->content;
00497         }
00498 
00499 
00500 
00501 
00502 
00503 
00504 
00505 
00506 
00507 
00508         /***************************
00509          *
00510          * OTHER FUNCTIONS:
00511          *
00512          ***************************/
00513 
00517         function RTEtsConfigParams()    {
00518                 $p = t3lib_BEfunc::getSpecConfParametersFromArray($this->specConf['rte_transform']['parameters']);
00519                 return $this->elementParts[0].':'.$this->elementParts[1].':'.$this->elementParts[2].':'.$this->thePid.':'.$this->typeVal.':'.$this->tscPID.':'.$p['imgpath'];
00520         }
00521 
00529         function detectUselessBar($hide,$all)   {
00530                 $show = array_diff($all,$hide);
00531                 $items=array();
00532                         // Register all
00533                 $c=0;
00534                 reset($show);
00535                 while(list(,$v)=each($show))    {
00536                         $items[$c]['cur']=substr($v,0,3);
00537                         $items[$c]['prev'] = $items[$c-1]['cur'];
00538                         $items[$c-1]['next'] = $items[$c]['cur'];
00539                         $c++;
00540                 }
00541                         // remove
00542                 $c=0;
00543                 $elAdded=0;
00544                 reset($show);
00545                 while(list(,$v)=each($show))    {
00546         //                      t3lib_div::debug($items[$c]);
00547                         if ($items[$c]['cur']!='bar')   $elAdded=1;
00548                         if ($items[$c]['cur']=='bar' && ($items[$c]['next']=='bar' || $items[$c]['next']=='' || $items[$c]['prev']=='' || !$elAdded))   {
00549                                 $hide[]=$v;
00550                         }
00551                         $c++;
00552                 }
00553                 return $hide;
00554         }
00555 
00562         function cleanList($str)        {
00563                 if (strstr($str,'*'))   {
00564                         $str = '*';
00565                 } else {
00566                         $str = implode(',',array_unique(t3lib_div::trimExplode(',',$str,1)));
00567                 }
00568                 return $str;
00569         }
00570 
00578         function filterStyleEl($elValue,$matchList)     {
00579                 $matchParts = t3lib_div::trimExplode(',',$matchList,1);
00580                 $styleParts = explode(';',$elValue);
00581                 $nStyle=array();
00582                 while(list($k,$p)=each($styleParts))    {
00583                         $pp = t3lib_div::trimExplode(':',$p);
00584                         if ($pp[0]&&$pp[1])     {
00585                                 reset($matchParts);
00586                                 while(list(,$el)=each($matchParts))     {
00587                                         $star=substr($el,-1)=='*';
00588                                         if (!strcmp($pp[0],$el) || ($star && t3lib_div::isFirstPartOfStr($pp[0],substr($el,0,-1)) ))    {
00589                                                 $nStyle[]=$pp[0].':'.$pp[1];
00590                                         } else  unset($styleParts[$k]);
00591                                 }
00592                         } else {
00593                                 unset($styleParts[$k]);
00594                         }
00595                 }
00596                 return implode('; ',$nStyle);
00597         }
00598 }
00599 
00600 // Include extension?
00601 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rte/app/rte.php'])     {
00602         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rte/app/rte.php']);
00603 }
00604 
00605 
00606 
00607 
00608 
00609 
00610 
00611 // Make instance:
00612 $SOBE = t3lib_div::makeInstance('SC_rte_rte');
00613 $SOBE->init();
00614 $SOBE->makeHeader();
00615 $SOBE->JSout();
00616 $SOBE->main();
00617 $SOBE->printContent();
00618 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6