* Added API for custom RTE transformations. Documented in upcoming "TYPO3 Core API".
authorKasper Skårhøj <kasper@typo3.org>
Mon, 24 May 2004 14:53:43 +0000 (14:53 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Mon, 24 May 2004 14:53:43 +0000 (14:53 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@324 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
TODO.txt
t3lib/class.t3lib_parsehtml_proc.php

index fada54f..e49d3c2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-05-24  Kasper Skårhøj,,,  <kasper@typo3.com>
+
+       * Added API for custom RTE transformations. Documented in upcoming "TYPO3 Core API".
+
 2004-05-20  Kasper Skårhøj,,,  <kasper@typo3.com>
 
        * Fixed remaining issues with styles in the backend regarding the TCEforms. There has been added additional possibilities of styling forms, now with classes in stylesheets, using $TBE_STYLES to set them up. Documentation of $TBE_STYLES for TCeforms has been updated in TYPo3 Core Api as well.
index eff8942..4a52056 100755 (executable)
--- a/TODO.txt
+++ b/TODO.txt
@@ -166,11 +166,8 @@ Element Browser:
 - Some quick-lookup feature (like we have on TER)
 
 Wizards:
-- Finish the colorpicker! Some other person can be in charge of this (See "APPENDIX: Colorpicker")
 - Add wizard icon to TSconfig and Setup/Constants fields for immediate syntax highlighting (in popup window)
 - Add wizard icon to see/clean up FlexForm data?
-- wizard_add, _edit and _list can be used fantastic to lead the user through multiple 1:n relations but than he starts to be confused if the records he created apear somewhere else, tries to edit them directly there, relations get lost, phone rings. (Peter K?hn).
-- forms and table wizards should be configurable for making XML structures alternatively to the currently formatting (programming wise ok, needs implementation)
 
 Interface:
 - Showing in "frameset-modules" which submodule you are currently inside. And ability to change submodule in the rightmost frame anyways - maybe as a panel in top of the pages (must be cached so all submodules must not be loaded each time...)? (Message-ID: <3ADE655892793D499E2FBF623045AF4B54E9A4@dbwdfx2f.wdf.sap-ag.de>)
index 7239071..ed5e496 100755 (executable)
@@ -239,23 +239,27 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
 
                        // Setting modes:
                if (strcmp($this->procOptions['overruleMode'],''))      {
-                       $modes=array_unique(t3lib_div::trimExplode(',',$this->procOptions['overruleMode']));
+                       $modes = array_unique(t3lib_div::trimExplode(',',$this->procOptions['overruleMode']));
                } else {
-                       $modes=array_unique(t3lib_div::trimExplode('-',$p['mode']));
+                       $modes = array_unique(t3lib_div::trimExplode('-',$p['mode']));
                }
-               $revmodes=array_flip($modes);
+               $revmodes = array_flip($modes);
 
                        // Find special modes and extract them:
                if (isset($revmodes['ts']))     {
-                       $modes[$revmodes['ts']]='ts_transform,ts_preserve,ts_images,ts_links';
+                       $modes[$revmodes['ts']] = 'ts_transform,ts_preserve,ts_images,ts_links';
                }
                        // Find special modes and extract them:
                if (isset($revmodes['ts_css'])) {
-                       $modes[$revmodes['ts_css']]='css_transform,ts_images,ts_links';
+                       $modes[$revmodes['ts_css']] = 'css_transform,ts_images,ts_links';
                }
+
+                       // Make list unique
                $modes = array_unique(t3lib_div::trimExplode(',',implode(',',$modes),1));
+
+                       // Reverse order if direction is "rte"
                if ($direction=='rte')  {
-                       $modes=array_reverse($modes);
+                       $modes = array_reverse($modes);
                }
 
                        // Getting additional HTML cleaner configuration. These are applied either before or after the main transformation is done and is thus totally independant processing options you can set up:
@@ -276,54 +280,69 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                foreach($modes as $cmd) {
                                // ->DB
                        if ($direction=='db')   {
-                               switch($cmd)    {
-                                       case 'ts_images':
-                                               $value=$this->TS_images_db($value);
-                                       break;
-                                       case 'ts_reglinks':
-                                               $value=$this->TS_reglinks($value,'db');
-                                       break;
-                                       case 'ts_links':
-                                               $value=$this->TS_links_db($value);
-                                       break;
-                                       case 'ts_preserve':
-                                               $value=$this->TS_preserve_db($value);
-                                       break;
-                                       case 'ts_transform':
-                                       case 'css_transform':
-                                               $value = str_replace(chr(13),'',$value);        // Has a very disturbing effect, so just remove all '13' - depend on '10'
-                                               $this->allowedClasses = t3lib_div::trimExplode(',',strtoupper($this->procOptions['allowedClasses']),1);
-                                               $value=$this->TS_transform_db($value,$cmd=='css_transform');
-                                       break;
-                                       case 'ts_strip':
-                                               $value=$this->TS_strip_db($value);
-                                       break;
-                                       case 'dummy':
-                                       break;
+                                       // Checking for user defined transformation:
+                               if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd])     {
+                                       $_procObj = &t3lib_div::getUserObj($_classRef);
+                                       $_procObj->pObj = &$this;
+                                       $_procObj->transformationKey = $cmd;
+                                       $value = $_procObj->transform_db($value,$this);
+                               } else {        // ... else use defaults:
+                                       switch($cmd)    {
+                                               case 'ts_images':
+                                                       $value = $this->TS_images_db($value);
+                                               break;
+                                               case 'ts_reglinks':
+                                                       $value = $this->TS_reglinks($value,'db');
+                                               break;
+                                               case 'ts_links':
+                                                       $value = $this->TS_links_db($value);
+                                               break;
+                                               case 'ts_preserve':
+                                                       $value = $this->TS_preserve_db($value);
+                                               break;
+                                               case 'ts_transform':
+                                               case 'css_transform':
+                                                       $value = str_replace(chr(13),'',$value);        // Has a very disturbing effect, so just remove all '13' - depend on '10'
+                                                       $this->allowedClasses = t3lib_div::trimExplode(',',strtoupper($this->procOptions['allowedClasses']),1);
+                                                       $value = $this->TS_transform_db($value,$cmd=='css_transform');
+                                               break;
+                                               case 'ts_strip':
+                                                       $value = $this->TS_strip_db($value);
+                                               break;
+                                               default:
+                                               break;
+                                       }
                                }
                        }
                                // ->RTE
                        if ($direction=='rte')  {
-                               switch($cmd)    {
-                                       case 'ts_images':
-                                               $value=$this->TS_images_rte($value);
-                                       break;
-                                       case 'ts_reglinks':
-                                               $value=$this->TS_reglinks($value,'rte');
-                                       break;
-                                       case 'ts_links':
-                                               $value=$this->TS_links_rte($value);
-                                       break;
-                                       case 'ts_preserve':
-                                               $value=$this->TS_preserve_rte($value);
-                                       break;
-                                       case 'ts_transform':
-                                       case 'css_transform':
-                                               $value = str_replace(chr(13),'',$value);        // Has a very disturbing effect, so just remove all '13' - depend on '10'
-                                               $value=$this->TS_transform_rte($value,$cmd=='css_transform');
-                                       break;
-                                       case 'dummy':
-                                       break;
+                                       // Checking for user defined transformation:
+                               if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd])     {
+                                       $_procObj = &t3lib_div::getUserObj($_classRef);
+                                       $_procObj->pObj = &$this;
+                                       $value = $_procObj->transform_rte($value,$this);
+                               } else {        // ... else use defaults:
+                                       switch($cmd)    {
+                                               case 'ts_images':
+                                                       $value = $this->TS_images_rte($value);
+                                               break;
+                                               case 'ts_reglinks':
+                                                       $value = $this->TS_reglinks($value,'rte');
+                                               break;
+                                               case 'ts_links':
+                                                       $value = $this->TS_links_rte($value);
+                                               break;
+                                               case 'ts_preserve':
+                                                       $value = $this->TS_preserve_rte($value);
+                                               break;
+                                               case 'ts_transform':
+                                               case 'css_transform':
+                                                       $value = str_replace(chr(13),'',$value);        // Has a very disturbing effect, so just remove all '13' - depend on '10'
+                                                       $value = $this->TS_transform_rte($value,$cmd=='css_transform');
+                                               break;
+                                               default:
+                                               break;
+                                       }
                                }
                        }
                }