Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

t3lib_parsehtml_proc Class Reference

List of all members.

Public Member Functions

 init ($elRef='', $recPid=0)
 Initialize, setting element reference and record PID.
 setRelPath ($path)
 Setting the ->relPath and ->relBackPath to proper values so absolute references to links and images can be converted to relative dittos.
 evalWriteFile ($pArr, $currentRecord)
 Evaluate the environment for editing a staticFileEdit file.
 RTE_transform ($value, $specConf, $direction='rte', $thisConfig=array())
 Transform value for RTE based on specConf in the direction specified by $direction (rte/db) This is the main function called from tcemain and transfer data classes.
 TS_images_db ($value)
 Transformation handler: 'ts_images' / direction: "db" Processing images inserted in the RTE.
 TS_images_rte ($value)
 Transformation handler: 'ts_images' / direction: "rte" Processing images from database content going into the RTE.
 TS_reglinks ($value, $direction)
 Transformation handler: 'ts_reglinks' / direction: "db"+"rte" depending on $direction variable.
 TS_links_db ($value)
 Transformation handler: 'ts_links' / direction: "db" Converting -tags to <link tags="">.
 TS_links_rte ($value)
 Transformation handler: 'ts_links' / direction: "rte" Converting <link tags=""> to -tags.

Public Attributes

 $headListTags = 'PREULOLH1H2H3H4H5H6'
 $recPid = 0
 $elRef = ''
 $relPath = ''
 $relBackPath = ''
 $procOptions = ''
 $TS_transform_db_safecounter = 100
 $rte_p = ''
 $getKeepTags_cache = array()
 $allowedClasses = array()
 $preserveTags = ''

Member Function Documentation

t3lib_parsehtml_proc::evalWriteFile pArr,
currentRecord
 

Evaluate the environment for editing a staticFileEdit file.

Called for almost all fields being saved in the database. Is called without an instance of the object: t3lib_parsehtml_proc::evalWriteFile()

Parameters:
array Parameters for the current field as found in types-config
array Current record we are editing.
Returns:
mixed On success an array with various information is returned, otherwise a string with an error message
See also:
t3lib_TCEmain, t3lib_transferData

Definition at line 173 of file class.t3lib_parsehtml_proc.php.

References PATH_site.

Referenced by t3lib_TCEmain::fillInFieldArray(), getSingleField_typeText(), and t3lib_transferData::renderRecord_typesProc().

00173                                                 {
00174 
00175          // Write file configuration:
00176       if (is_array($pArr)) {
00177          if ($GLOBALS['TYPO3_CONF_VARS']['BE']['staticFileEditPath']
00178             && substr($GLOBALS['TYPO3_CONF_VARS']['BE']['staticFileEditPath'],-1)=='/'
00179             && @is_dir(PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['staticFileEditPath']))   {
00180 
00181             $SW_p = $pArr['parameters'];
00182             $SW_editFileField = trim($SW_p[0]);
00183             $SW_editFile = $currentRecord[$SW_editFileField];
00184             if ($SW_editFileField && $SW_editFile && t3lib_div::validPathStr($SW_editFile))  {
00185                $SW_relpath = $GLOBALS['TYPO3_CONF_VARS']['BE']['staticFileEditPath'].$SW_editFile;
00186                $SW_editFile = PATH_site.$SW_relpath;
00187                if (@is_file($SW_editFile))   {
00188                   return array(
00189                      'editFile' => $SW_editFile,
00190                      'relEditFile' => $SW_relpath,
00191                      'contentField' => trim($SW_p[1]),
00192                      'markerField' => trim($SW_p[2]),
00193                      'loadFromFileField' => trim($SW_p[3]),
00194                      'statusField' => trim($SW_p[4])
00195                   );
00196                } else return "ERROR: Editfile '".$SW_relpath."' did not exist";
00197             } else return "ERROR: Edit file name could not be found or was bad.";
00198          } else return "ERROR: staticFileEditPath was not set, not set correctly or did not exist!";
00199       }
00200    }

t3lib_parsehtml_proc::init elRef = '',
recPid = 0
 

Initialize, setting element reference and record PID.

Parameters:
string Element reference, eg "tt_content:bodytext"
integer PID of the record (page id)
Returns:
void

Definition at line 137 of file class.t3lib_parsehtml_proc.php.

00137                                        {
00138       $this->recPid = $recPid;
00139       $this->elRef = $elRef;
00140    }

t3lib_parsehtml_proc::RTE_transform value,
specConf,
direction = 'rte',
thisConfig = array()
 

Transform value for RTE based on specConf in the direction specified by $direction (rte/db) This is the main function called from tcemain and transfer data classes.

Parameters:
string Input value
array Special configuration for a field; This is coming from the types-configuration of the field in the TCA. In the types-configuration you can setup features for the field rendering and in particular the RTE takes al its major configuration options from there!
string Direction of the transformation. Two keywords are allowed; "db" or "rte". If "db" it means the transformation will clean up content coming from the Rich Text Editor and goes into the database. The other direction, "rte", is of course when content is coming from database and must be transformed to fit the RTE.
array Parsed TypoScript content configuring the RTE, probably coming from Page TSconfig.
Returns:
string Output value
See also:
t3lib_TCEmain::fillInFieldArray(), t3lib_transferData::renderRecord_typesProc()

Definition at line 231 of file class.t3lib_parsehtml_proc.php.

References t3lib_BEfunc::getSpecConfParametersFromArray(), TS_images_db(), TS_images_rte(), TS_links_db(), TS_links_rte(), TS_preserve_db(), TS_preserve_rte(), TS_reglinks(), TS_strip_db(), TS_transform_db(), and TS_transform_rte().

00231                                                                                  {
00232 
00233          // Init:
00234       $this->procOptions = $thisConfig['proc.'];
00235       $this->preserveTags = strtoupper(implode(',',t3lib_div::trimExplode(',',$this->procOptions['preserveTags'])));
00236 
00237          // Get parameters for rte_transformation:
00238       $p = $this->rte_p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
00239 
00240          // Setting modes:
00241       if (strcmp($this->procOptions['overruleMode'],'')) {
00242          $modes = array_unique(t3lib_div::trimExplode(',',$this->procOptions['overruleMode']));
00243       } else {
00244          $modes = array_unique(t3lib_div::trimExplode('-',$p['mode']));
00245       }
00246       $revmodes = array_flip($modes);
00247 
00248          // Find special modes and extract them:
00249       if (isset($revmodes['ts']))   {
00250          $modes[$revmodes['ts']] = 'ts_transform,ts_preserve,ts_images,ts_links';
00251       }
00252          // Find special modes and extract them:
00253       if (isset($revmodes['ts_css']))  {
00254          $modes[$revmodes['ts_css']] = 'css_transform,ts_images,ts_links';
00255       }
00256 
00257          // Make list unique
00258       $modes = array_unique(t3lib_div::trimExplode(',',implode(',',$modes),1));
00259 
00260          // Reverse order if direction is "rte"
00261       if ($direction=='rte')  {
00262          $modes = array_reverse($modes);
00263       }
00264 
00265          // 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:
00266       $entry_HTMLparser = $this->procOptions['entryHTMLparser_'.$direction] ? $this->HTMLparserConfig($this->procOptions['entryHTMLparser_'.$direction.'.']) : '';
00267       $exit_HTMLparser = $this->procOptions['exitHTMLparser_'.$direction] ? $this->HTMLparserConfig($this->procOptions['exitHTMLparser_'.$direction.'.']) : '';
00268 
00269          // Line breaks of content is unified into char-10 only (removing char 13)
00270       if (!$this->procOptions['disableUnifyLineBreaks']) {
00271          $value = str_replace(chr(13).chr(10),chr(10),$value);
00272       }
00273 
00274          // In an entry-cleaner was configured, pass value through the HTMLcleaner with that:
00275       if (is_array($entry_HTMLparser)) {
00276          $value = $this->HTMLcleaner($value,$entry_HTMLparser[0],$entry_HTMLparser[1],$entry_HTMLparser[2],$entry_HTMLparser[3]);
00277       }
00278 
00279          // Traverse modes:
00280       foreach($modes as $cmd) {
00281             // ->DB
00282          if ($direction=='db')   {
00283                // Checking for user defined transformation:
00284             if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd])   {
00285                $_procObj = &t3lib_div::getUserObj($_classRef);
00286                $_procObj->pObj = &$this;
00287                $_procObj->transformationKey = $cmd;
00288                $value = $_procObj->transform_db($value,$this);
00289             } else { // ... else use defaults:
00290                switch($cmd)   {
00291                   case 'ts_images':
00292                      $value = $this->TS_images_db($value);
00293                   break;
00294                   case 'ts_reglinks':
00295                      $value = $this->TS_reglinks($value,'db');
00296                   break;
00297                   case 'ts_links':
00298                      $value = $this->TS_links_db($value);
00299                   break;
00300                   case 'ts_preserve':
00301                      $value = $this->TS_preserve_db($value);
00302                   break;
00303                   case 'ts_transform':
00304                   case 'css_transform':
00305                      $value = str_replace(chr(13),'',$value);  // Has a very disturbing effect, so just remove all '13' - depend on '10'
00306                      $this->allowedClasses = t3lib_div::trimExplode(',',strtoupper($this->procOptions['allowedClasses']),1);
00307                      $value = $this->TS_transform_db($value,$cmd=='css_transform');
00308                   break;
00309                   case 'ts_strip':
00310                      $value = $this->TS_strip_db($value);
00311                   break;
00312                   default:
00313                   break;
00314                }
00315             }
00316          }
00317             // ->RTE
00318          if ($direction=='rte')  {
00319                // Checking for user defined transformation:
00320             if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd])   {
00321                $_procObj = &t3lib_div::getUserObj($_classRef);
00322                $_procObj->pObj = &$this;
00323                $value = $_procObj->transform_rte($value,$this);
00324             } else { // ... else use defaults:
00325                switch($cmd)   {
00326                   case 'ts_images':
00327                      $value = $this->TS_images_rte($value);
00328                   break;
00329                   case 'ts_reglinks':
00330                      $value = $this->TS_reglinks($value,'rte');
00331                   break;
00332                   case 'ts_links':
00333                      $value = $this->TS_links_rte($value);
00334                   break;
00335                   case 'ts_preserve':
00336                      $value = $this->TS_preserve_rte($value);
00337                   break;
00338                   case 'ts_transform':
00339                   case 'css_transform':
00340                      $value = str_replace(chr(13),'',$value);  // Has a very disturbing effect, so just remove all '13' - depend on '10'
00341                      $value = $this->TS_transform_rte($value,$cmd=='css_transform');
00342                   break;
00343                   default:
00344                   break;
00345                }
00346             }
00347          }
00348       }
00349 
00350          // In an exit-cleaner was configured, pass value through the HTMLcleaner with that:
00351       if (is_array($exit_HTMLparser))  {
00352          $value = $this->HTMLcleaner($value,$exit_HTMLparser[0],$exit_HTMLparser[1],$exit_HTMLparser[2],$exit_HTMLparser[3]);
00353       }
00354 
00355          // Final clean up of linebreaks:
00356       if (!$this->procOptions['disableUnifyLineBreaks']) {
00357          $value = str_replace(chr(13).chr(10),chr(10),$value); // Make sure no \r\n sequences has entered in the meantime...
00358          $value = str_replace(chr(10),chr(13).chr(10),$value); // ... and then change all \n into \r\n
00359       }
00360 
00361          // Return value:
00362       return $value;
00363    }

t3lib_parsehtml_proc::setRelPath path  ) 
 

Setting the ->relPath and ->relBackPath to proper values so absolute references to links and images can be converted to relative dittos.

This is used when editing files with the RTE

Parameters:
string The relative path from PATH_site to the place where the file being edited is. Eg. "fileadmin/static".
Returns:
void There is no output, it is set in internal variables. With the above example of "fileadmin/static" as input this will yield ->relPath to be "fileadmin/static/" and ->relBackPath to be "../../"

Definition at line 149 of file class.t3lib_parsehtml_proc.php.

References $a.

00149                               {
00150       $path = trim($path);
00151       $path = ereg_replace('^/','',$path);
00152       $path = ereg_replace('/$','',$path);
00153       if ($path)  {
00154          $this->relPath = $path;
00155          $this->relBackPath = '';
00156          $partsC=count(explode('/',$this->relPath));
00157          for ($a=0;$a<$partsC;$a++) {
00158             $this->relBackPath.='../';
00159          }
00160          $this->relPath.='/';
00161       }
00162    }

t3lib_parsehtml_proc::TS_images_db value  ) 
 

Transformation handler: 'ts_images' / direction: "db" Processing images inserted in the RTE.

This is used when content goes from the RTE to the database. Images inserted in the RTE has an absolute URL applied to the src attribute. This URL is converted to a relative URL If it turns out that the URL is from another website than the current the image is read from that external URL and moved to the local server. Also "magic" images are processed here.

Parameters:
string The content from RTE going to Database
Returns:
string Processed content

Definition at line 397 of file class.t3lib_parsehtml_proc.php.

References getWHFromAttribs(), PATH_site, rteImageStorageDir(), and siteUrl().

Referenced by RTE_transform().

00397                                  {
00398 
00399          // Split content by <img> tags and traverse the resulting array for processing:
00400       $imgSplit = $this->splitTags('img',$value);
00401       foreach($imgSplit as $k => $v)   {
00402          if ($k%2)   {  // image found, do processing:
00403 
00404                // Init
00405             $attribArray = $this->get_tag_attributes_classic($v,1);
00406             $siteUrl = $this->siteUrl();
00407             $absRef = trim($attribArray['src']);      // It's always a absolute URL coming from the RTE into the Database.
00408 
00409                // External image from another URL? In that case, fetch image (unless disabled feature).
00410             if (!t3lib_div::isFirstPartOfStr($absRef,$siteUrl) && !$this->procOptions['dontFetchExtPictures']) {
00411                $externalFile = $this->getUrl($absRef);   // Get it
00412                if ($externalFile)   {
00413                   $pU = parse_url($absRef);
00414                   $pI=pathinfo($pU['path']);
00415 
00416                   if (t3lib_div::inList('gif,png,jpeg,jpg',strtolower($pI['extension']))) {
00417                      $filename = t3lib_div::shortMD5($absRef).'.'.$pI['extension'];
00418                      $origFilePath = PATH_site.$this->rteImageStorageDir().'RTEmagicP_'.$filename;
00419                      $C_origFilePath = PATH_site.$this->rteImageStorageDir().'RTEmagicC_'.$filename.'.'.$pI['extension'];
00420                      if (!@is_file($origFilePath)) {
00421                         t3lib_div::writeFile($origFilePath,$externalFile);
00422                         t3lib_div::writeFile($C_origFilePath,$externalFile);
00423                      }
00424                      $absRef = $siteUrl.$this->rteImageStorageDir().'RTEmagicC_'.$filename.'.'.$pI['extension'];
00425 
00426                      $attribArray['src']=$absRef;
00427                      $params = t3lib_div::implodeAttributes($attribArray,1);
00428                      $imgSplit[$k] = '<img '.$params.' />';
00429                   }
00430                }
00431             }
00432                // Check image as local file (siteURL equals the one of the image)
00433             if (t3lib_div::isFirstPartOfStr($absRef,$siteUrl)) {
00434                $path = rawurldecode(substr($absRef,strlen($siteUrl)));  // Rel-path, rawurldecoded for special characters.
00435                $filepath = t3lib_div::getFileAbsFileName($path);     // Abs filepath, locked to relative path of this project.
00436 
00437                   // Check file existence (in relative dir to this installation!)
00438                if ($filepath && @is_file($filepath))  {
00439 
00440                      // If "magic image":
00441                   $pathPre=$this->rteImageStorageDir().'RTEmagicC_';
00442                   if (t3lib_div::isFirstPartOfStr($path,$pathPre))   {
00443                      // Find original file:
00444                      $pI=pathinfo(substr($path,strlen($pathPre)));
00445                      $filename = substr($pI['basename'],0,-strlen('.'.$pI['extension']));
00446                      $origFilePath = PATH_site.$this->rteImageStorageDir().'RTEmagicP_'.$filename;
00447                      if (@is_file($origFilePath))  {
00448                         $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
00449                         $imgObj->init();
00450                         $imgObj->mayScaleUp=0;
00451                         $imgObj->tempPath=PATH_site.$imgObj->tempPath;
00452 
00453                         $curInfo = $imgObj->getImageDimensions($filepath); // Image dimensions of the current image
00454                         $curWH = $this->getWHFromAttribs($attribArray); // Image dimensions as set in the image tag
00455                            // Compare dimensions:
00456                         if ($curWH[0]!=$curInfo[0] || $curWH[1]!=$curInfo[1]) {
00457                            $origImgInfo = $imgObj->getImageDimensions($origFilePath);  // Image dimensions of the current image
00458                            $cW = $curWH[0];
00459                            $cH = $curWH[1];
00460                               $cH = 1000; // Make the image based on the width solely...
00461                            $imgI = $imgObj->imageMagickConvert($origFilePath,$pI['extension'],$cW.'m',$cH.'m');
00462                            if ($imgI[3])  {
00463                               $fI=pathinfo($imgI[3]);
00464                               @copy($imgI[3],$filepath); // Override the child file
00465                               unset($attribArray['style']);
00466                               $attribArray['width']=$imgI[0];
00467                               $attribArray['height']=$imgI[1];
00468                               if (!$attribArray['border'])  $attribArray['border']=0;
00469                               $params = t3lib_div::implodeAttributes($attribArray,1);
00470                               $imgSplit[$k]='<img '.$params.' />';
00471                            }
00472                         }
00473                      }
00474 
00475                   } elseif ($this->procOptions['plainImageMode']) {  // If "plain image" has been configured:
00476 
00477                         // Image dimensions as set in the image tag
00478                      $curWH = $this->getWHFromAttribs($attribArray);
00479                      $attribArray['width'] = $curWH[0];
00480                      $attribArray['height'] = $curWH[1];
00481 
00482                         // Forcing values for style and border:
00483                      unset($attribArray['style']);
00484                      if (!$attribArray['border'])  $attribArray['border'] = 0;
00485 
00486                         // Finding dimensions of image file:
00487                      $fI = @getimagesize($filepath);
00488 
00489                         // Perform corrections to aspect ratio based on configuration:
00490                      switch((string)$this->procOptions['plainImageMode'])  {
00491                         case 'lockDimensions':
00492                            $attribArray['width']=$fI[0];
00493                            $attribArray['height']=$fI[1];
00494                         break;
00495                         case 'lockRatioWhenSmaller':  // If the ratio has to be smaller, then first set the width...:
00496                            if ($attribArray['width']>$fI[0])   $attribArray['width'] = $fI[0];
00497                         case 'lockRatio':
00498                            if ($fI[0]>0)  {
00499                               $attribArray['height']=round($attribArray['width']*($fI[1]/$fI[0]));
00500                            }
00501                         break;
00502                      }
00503 
00504                         // Compile the image tag again:
00505                      $params = t3lib_div::implodeAttributes($attribArray,1);
00506                      $imgSplit[$k]='<img '.$params.' />';
00507                   }
00508                } else { // Remove image if it was not found in a proper position on the server!
00509 
00510                      // Commented out; removing the image tag might not be that logical...
00511                   #$imgSplit[$k]='';
00512                }
00513             }
00514 
00515                // Convert abs to rel url
00516             if ($imgSplit[$k])   {
00517                $attribArray=$this->get_tag_attributes_classic($imgSplit[$k],1);
00518                $absRef = trim($attribArray['src']);
00519                if (t3lib_div::isFirstPartOfStr($absRef,$siteUrl)) {
00520                   $attribArray['src'] = $this->relBackPath.substr($absRef,strlen($siteUrl));
00521                   if (!isset($attribArray['alt'])) $attribArray['alt']='';    // Must have alt-attribute for XHTML compliance.
00522                   $imgSplit[$k]='<img '.t3lib_div::implodeAttributes($attribArray,1,1).' />';
00523                }
00524             }
00525          }
00526       }
00527       return implode('',$imgSplit);
00528    }

t3lib_parsehtml_proc::TS_images_rte value  ) 
 

Transformation handler: 'ts_images' / direction: "rte" Processing images from database content going into the RTE.

Processing includes converting the src attribute to an absolute URL.

Parameters:
string Content input
Returns:
string Content output

Definition at line 538 of file class.t3lib_parsehtml_proc.php.

References siteUrl().

Referenced by RTE_transform().

00538                                     {
00539 
00540          // Split content by <img> tags and traverse the resulting array for processing:
00541       $imgSplit = $this->splitTags('img',$value);
00542       foreach($imgSplit as $k => $v)   {
00543          if ($k%2)   {  // image found:
00544 
00545                // Init
00546             $attribArray=$this->get_tag_attributes_classic($v,1);
00547             $siteUrl = $this->siteUrl();
00548             $absRef = trim($attribArray['src']);
00549 
00550                // Unless the src attribute is already pointing to an external URL:
00551             if (strtolower(substr($absRef,0,4))!='http') {
00552                $attribArray['src'] = $siteUrl.substr($attribArray['src'],strlen($this->relBackPath));
00553                if (!isset($attribArray['alt'])) $attribArray['alt']='';
00554                $params = t3lib_div::implodeAttributes($attribArray);
00555                $imgSplit[$k]='<img '.$params.' />';
00556             }
00557          }
00558       }
00559 
00560          // return processed content:
00561       return implode('',$imgSplit);
00562    }

t3lib_parsehtml_proc::TS_links_db value  ) 
 

Transformation handler: 'ts_links' / direction: "db" Converting -tags to <link tags="">.

Parameters:
string Content input
Returns:
string Content output
See also:
TS_links_rte()

Definition at line 606 of file class.t3lib_parsehtml_proc.php.

References siteUrl(), and urlInfoForLinkTags().

Referenced by RTE_transform().

00606                                  {
00607 
00608          // Split content into <a> tag blocks and process:
00609       $blockSplit = $this->splitIntoBlock('A',$value);
00610       foreach($blockSplit as $k => $v) {
00611          if ($k%2)   {  // If an A-tag was found:
00612             $attribArray = $this->get_tag_attributes_classic($this->getFirstTag($v),1);
00613             $info = $this->urlInfoForLinkTags($attribArray['href']);
00614 
00615                // Check options:
00616             $attribArray_copy = $attribArray;
00617             unset($attribArray_copy['href']);
00618             unset($attribArray_copy['target']);
00619             unset($attribArray_copy['class']);
00620             if ($attribArray_copy['rteerror'])  {  // Unset "rteerror" and "style" attributes if "rteerror" is set!
00621                unset($attribArray_copy['style']);
00622                unset($attribArray_copy['rteerror']);
00623             }
00624             if (!count($attribArray_copy))   {  // Only if href, target and class are the only attributes, we can alter the link!
00625                   // Creating the TYPO3 pseudo-tag "<LINK>" for the link (includes href/url, target and class attributes):
00626                $bTag='<LINK '.$info['url'].($attribArray['target']?' '.$attribArray['target']:($attribArray['class']?' -':'')).($attribArray['class']?' '.$attribArray['class']:'').'>';
00627                $eTag='</LINK>';
00628                $blockSplit[$k] = $bTag.$this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])).$eTag;
00629             } else { // ... otherwise store the link as a-tag.
00630                   // Unsetting 'rtekeep' attribute if that had been set.
00631                unset($attribArray['rtekeep']);
00632                   // If the url is local, remove url-prefix
00633                $siteURL = $this->siteUrl();
00634                if ($siteURL && substr($attribArray['href'],0,strlen($siteURL))==$siteURL) {
00635                   $attribArray['href']=$this->relBackPath.substr($attribArray['href'],strlen($siteURL));
00636                }
00637                $bTag='<a '.t3lib_div::implodeAttributes($attribArray,1).'>';
00638                $eTag='</a>';
00639                $blockSplit[$k] = $bTag.$this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])).$eTag;
00640             }
00641          }
00642       }
00643       return implode('',$blockSplit);
00644    }

t3lib_parsehtml_proc::TS_links_rte value  ) 
 

Transformation handler: 'ts_links' / direction: "rte" Converting <link tags=""> to -tags.

Parameters:
string Content input
Returns:
string Content output
See also:
TS_links_rte()

Definition at line 654 of file class.t3lib_parsehtml_proc.php.

References $page, t3lib_BEfunc::getRecord(), t3lib_BEfunc::getRecordsByField(), PATH_site, siteUrl(), and TS_AtagToAbs().

Referenced by RTE_transform().

t3lib_parsehtml_proc::TS_reglinks value,
direction
 

Transformation handler: 'ts_reglinks' / direction: "db"+"rte" depending on $direction variable.

Converting -tags to/from abs/rel

Parameters:
string Content input
string Direction of conversion; "rte" (from database to RTE) or "db" (from RTE to database)
Returns:
string Content output

Definition at line 572 of file class.t3lib_parsehtml_proc.php.

References siteUrl(), and TS_AtagToAbs().

Referenced by RTE_transform().

00572                                                 {
00573       switch($direction)   {
00574          case 'rte':
00575             return $this->TS_AtagToAbs($value,1);
00576          break;
00577          case 'db':
00578             $siteURL = $this->siteUrl();
00579             $blockSplit = $this->splitIntoBlock('A',$value);
00580             reset($blockSplit);
00581             while(list($k,$v)=each($blockSplit))   {
00582                if ($k%2)   {  // block:
00583                   $attribArray=$this->get_tag_attributes_classic($this->getFirstTag($v),1);
00584                      // If the url is local, remove url-prefix
00585                   if ($siteURL && substr($attribArray['href'],0,strlen($siteURL))==$siteURL) {
00586                      $attribArray['href']=$this->relBackPath.substr($attribArray['href'],strlen($siteURL));
00587                   }
00588                   $bTag='<a '.t3lib_div::implodeAttributes($attribArray,1).'>';
00589                   $eTag='</a>';
00590                   $blockSplit[$k] = $bTag.$this->TS_reglinks($this->removeFirstAndLastTag($blockSplit[$k]),$direction).$eTag;
00591                }
00592             }
00593             return implode('',$blockSplit);
00594          break;
00595       }
00596    }


Member Data Documentation

t3lib_parsehtml_proc::$allowedClasses = array()
 

Definition at line 118 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$elRef = ''
 

Definition at line 109 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$getKeepTags_cache = array()
 

Definition at line 117 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$headListTags = 'PREULOLH1H2H3H4H5H6'
 

Definition at line 105 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$preserveTags = ''
 

Definition at line 119 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$procOptions = ''
 

Definition at line 112 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$recPid = 0
 

Definition at line 108 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$relBackPath = ''
 

Definition at line 111 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$relPath = ''
 

Definition at line 110 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$rte_p = ''
 

Definition at line 116 of file class.t3lib_parsehtml_proc.php.

t3lib_parsehtml_proc::$TS_transform_db_safecounter = 100
 

Definition at line 115 of file class.t3lib_parsehtml_proc.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:07:03 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913