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

class.tslib_content.php File Reference

Go to the source code of this file.

Namespaces

namespace  TYPO3

Classes

class  tslib_cObj

Functions

 SEARCHRESULT ($conf)
 Rendering the cObject, SEARCHRESULT.
 PHP_SCRIPT ($conf, $ext='')
 Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT.
 TEMPLATE ($conf)
 Rendering the cObject, TEMPLATE.
 MULTIMEDIA ($conf)
 Rendering the cObject, MULTIMEDIA.
 netprintApplication_offsiteLinkWrap ($str, $imgConf, $conf)
 Creates a link to a netprint application on another website (where the "netprint" extension is running") Related to the extension "netprint".
 getFieldDefaultValue ($noValueInsert, $fieldName, $defaultVal)
 Returns a default value for a form field in the FORM cObject.
 cImage ($file, $conf)
 Returns a tag with the image file defined by $file and processed according to the properties in the TypoScript array.
 imageLinkWrap ($string, $imageFile, $conf)
 Wraps the input string in link-tags that opens the image in a new window.
 fileResource ($fName, $addParams='alt=""title=""')
 Returns content of a file.
 lastChanged ($tstamp)
 Sets the SYS_LASTCHANGED timestamp if input timestamp is larger than current value.
 linkWrap ($content, $wrap)
 Wraps the input string by the $wrap value and implements the "linkWrap" data type as well.
 getAltParam ($conf)
 An abstraction method which creates an alt or title parameter for an HTML img tag.
 getSubpart ($content, $marker)
 Returns a subpart from the input content stream.
 substituteSubpart ($content, $marker, $subpartContent, $recursive=1)
 Substitute subpart in input template stream.
 substituteMarker ($content, $marker, $markContent)
 Substitutes a marker string in the input content (by a simple str_replace()).
 substituteMarkerArrayCached ($content, $markContentArray=array(), $subpartContentArray=array(), $wrappedSubpartContentArray=array())
 Multi substitution function with caching.
 substituteMarkerArray ($content, $markContentArray, $wrap='', $uppercase=0)
 Traverses the input $markContentArray array and for each key the marker by the same name (possibly wrapped and in upper case) will be substituted with the keys value in the array.
 substituteMarkerInObject (&$tree, $markContentArray)
 Substitute marker array in an array of values.
 fillInMarkerArray ($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE)
 Adds elements to the input $markContentArray based on the values from the fields from $fieldList found in $row.
 stdWrap ($content, $conf)
 The "stdWrap" function.
 numRows ($conf)
 Returns number of rows selected by the query made by the properties set.
 listNum ($content, $listNum, $char)
 Exploding a string by the $char value (if integer its an ASCII value) and returning index $listNum.
 checkIf ($conf)
 Compares values together based on the settings in the input TypoScript array and returns true or false based on the comparison result.
 filelist ($data)
 Reads a directory for files and returns the filepaths in a string list separated by comma.
 clean_directory ($theDir)
 Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.
 HTMLparser_TSbridge ($theValue, $conf)
 Passes the input value, $theValue, to an instance of "t3lib_parsehtml" together with the TypoScript options which are first converted from a TS style array to a set of arrays with options for the t3lib_parsehtml class.
 dataWrap ($content, $wrap)
 Wrapping input value in a regular "wrap" but parses the wrapping value first for "insertData" codes.
 insertData ($str)
 Implements the "insertData" property of stdWrap meaning that if strings matching {...} is found in the input string they will be substituted with the return value from getData (datatype) which is passed the content of the curly braces.
 prefixComment ($str, $conf, $content)
 Returns a HTML comment with the second part of input string (divided by "|") where first part is an integer telling how many trailing tabs to put before the comment on a new line.
 substring ($content, $options)
 Implements the stdWrap property "substring" which is basically a TypoScript implementation of the PHP function, substr().
 crop ($content, $options)
 Implements the stdWrap property "crop" which is a modified "substr" function allowing to limit a string lenght to a certain number of chars (from either start or end of string) and having a pre/postfix applied if the string really was cropped.
 removeBadHTML ($text, $conf)
 Function for removing malicious HTML code when you want to provide some HTML code user-editable.
 getData ($string, $fieldArray)
 Implements the TypoScript data type "getText".
 rootLineValue ($key, $field, $slideBack=0, $altRootLine='')
 Returns a value from the current rootline (site) from $GLOBALS['TSFE']->tmpl->rootLine;.
 getGlobal ($var, $source=NULL)
 Returns a value from the array, $GLOBALS where the input key, $val, is splitted by "|" first and each part points to a key in the $GLOBALS array.
 getKey ($key, $arr)
 Processing of key values pointing to entries in $arr; Here negative values are converted to positive keys pointer to an entry in the array but from behind (based on the negative value).
 typoLink ($linktxt, $conf)
 Implements the "typolink" property of stdWrap (and others) Basically the input string, $linktext, is (typically) wrapped in a -tag linking to some page, email address, file or URL based on a parameter defined by the configuration array $conf.

Variables

 $theRedirect = $this->stdWrap($conf['redirect'], $conf['redirect.'])
 $page = $GLOBALS['TSFE']->page
 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']))
 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']))
 $action = $LD_A['totalURL']
 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.'])
 $hiddenfields = '<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />'
 $formname = $GLOBALS['TSFE']->uniqueHash()
$GLOBALS['TSFE'] additionalHeaderData ['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>'
else $validateForm = ''
 $theTarget = ($theRedirect?$LD['target']:$LD_A['target'])
 $content


Function Documentation

checkIf conf  ) 
 

Compares values together based on the settings in the input TypoScript array and returns true or false based on the comparison result.

Implements the "if" function in TYPO3 TypoScript

Parameters:
array TypoScript properties defining what to compare
Returns:
boolean &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=320&cHash=da01618eab HMENU(), CASEFUNC(), IMAGE(), COLUMN(), stdWrap(), _parseFunc()

Definition at line 3185 of file class.tslib_content.php.

Referenced by tslib_cObj::CASEFUNC(), tslib_cObj::COBJ_ARRAY(), tslib_cObj::COLUMNS(), tslib_cObj::HMENU(), tslib_cObj::IMAGE(), and stdWrap().

03185                            {
03186       if (!is_array($conf))   {return true;}
03187       if (isset($conf['directReturn']))   {return $conf['directReturn'] ? 1 : 0;}
03188       $flag = true;
03189          if (isset($conf['isTrue']) || isset($conf['isTrue.']))   {
03190             $isTrue = trim($this->stdWrap($conf['isTrue'],$conf['isTrue.']));
03191             if (!$isTrue)  {
03192                $flag=0;
03193             }
03194          }
03195          if (isset($conf['isFalse']) || isset($conf['isFalse.'])) {
03196             $isFalse = trim($this->stdWrap($conf['isFalse'],$conf['isFalse.']));
03197             if ($isFalse)  {
03198                $flag=0;
03199             }
03200          }
03201          if (isset($conf['isPositive']) || isset($conf['isPositive.'])) {
03202             $number = $this->calc($this->stdWrap($conf['isPositive'],$conf['isPositive.']));
03203             if ($number<1) {
03204                $flag=0;
03205             }
03206          }
03207          if ($flag)  {
03208             $value = trim($this->stdWrap($conf['value'],$conf['value.']));
03209 
03210             if (isset($conf['isGreaterThan']) || isset($conf['isGreaterThan.'])) {
03211                $number = trim($this->stdWrap($conf['isGreaterThan'],$conf['isGreaterThan.']));
03212                if ($number<=$value) {
03213                   $flag=0;
03214                }
03215             }
03216             if (isset($conf['isLessThan']) || isset($conf['isLessThan.'])) {
03217                $number = trim($this->stdWrap($conf['isLessThan'],$conf['isLessThan.']));
03218                if ($number>=$value) {
03219                   $flag=0;
03220                }
03221             }
03222             if (isset($conf['equals']) || isset($conf['equals.']))   {
03223                $number = trim($this->stdWrap($conf['equals'],$conf['equals.']));
03224                if ($number!=$value) {
03225                   $flag=0;
03226                }
03227             }
03228             if (isset($conf['isInList']) || isset($conf['isInList.']))  {
03229                $number = trim($this->stdWrap($conf['isInList'],$conf['isInList.']));
03230                if (!t3lib_div::inList($value,$number))   {
03231                   $flag=0;
03232                }
03233             }
03234          }
03235       if ($conf['negate']) {$flag = $flag ? 0 : 1;}
03236       return $flag;
03237    }

cImage file,
conf
 

Returns a tag with the image file defined by $file and processed according to the properties in the TypoScript array.

Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript. This function is called by "$this->cImage($conf['file'],$conf);" from IMAGE().

Parameters:
string File TypoScript resource
array TypoScript configuration properties
Returns:
string tag, (possibly wrapped in links and other HTML) if any image found. private
See also:
IMAGE()

Definition at line 2470 of file class.tslib_content.php.

References getAltParam(), imageLinkWrap(), and linkWrap().

Referenced by tslib_cObj::IMAGE().

02470                                 {
02471       $info = $this->getImgResource($file,$conf['file.']);
02472       $GLOBALS['TSFE']->lastImageInfo=$info;
02473       if (is_array($info)) {
02474          $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
02475          $GLOBALS['TSFE']->imagesOnPage[]=$info[3];      // This array is used to collect the image-refs on the page...
02476 
02477          if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {  // Backwards compatible:
02478             $conf['altText'] = $conf['alttext'];
02479             $conf['altText.'] = $conf['alttext.'];
02480          }
02481          $altParam = $this->getAltParam($conf);
02482 
02483          $theValue = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"  border="'.intval($conf['border']).'"'.($conf['params']?' '.$conf['params']:'').($altParam).' />';
02484          if ($conf['linkWrap'])  {
02485             $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
02486          } elseif ($conf['imageLinkWrap']) {
02487             $theValue = $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
02488          }
02489          return $this->wrap($theValue,$conf['wrap']);
02490       }
02491    }

clean_directory theDir  ) 
 

Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.

Parameters:
string Absolute path to directory
Returns:
string The directory path if it existed as was valid to access. private
See also:
filelist()

Definition at line 3327 of file class.tslib_content.php.

Referenced by filelist().

03327                                        {
03328       if (t3lib_div::validPathStr($theDir))  {     // proceeds if no '//', '..' or '\' is in the $theFile
03329          $theDir = ereg_replace("[\/\. ]*$",'',$theDir);    // Removes all dots, slashes and spaces after a path...
03330          if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir))  {
03331             return $theDir;
03332          }
03333       }
03334    }

crop content,
options
 

Implements the stdWrap property "crop" which is a modified "substr" function allowing to limit a string lenght to a certain number of chars (from either start or end of string) and having a pre/postfix applied if the string really was cropped.

Parameters:
string The string to perform the operation on
string The parameters splitted by "|": First parameter is the max number of chars of the string. Negative value means cropping from end of string. Second parameter is the pre/postfix string to apply if cropping occurs.
Returns:
string The processed input value. private
See also:
stdWrap()

Definition at line 3444 of file class.tslib_content.php.

References $content.

Referenced by tslib_gifBuilder::make(), tslib_gifBuilder::start(), and stdWrap().

03444                                     {
03445       $options = explode('|',$options);
03446       $chars = intval($options[0]);
03447       $afterstring = trim($options[1]);
03448       $crop2space = trim($options[2]);
03449       if ($chars) {
03450          if (strlen($content)>abs($chars))   {
03451             if ($chars<0)  {
03452                $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$chars);
03453                $trunc_at = strpos($content, ' ');
03454                $content = ($trunc_at&&$crop2space) ? $afterstring.substr($content,$trunc_at) : $afterstring.$content;
03455             } else {
03456                $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,0,$chars);
03457                $trunc_at = strrpos($content, ' ');
03458                $content = ($trunc_at&&$crop2space) ? substr($content, 0, $trunc_at).$afterstring : $content.$afterstring;
03459             }
03460          }
03461       }
03462       return $content;
03463    }

dataWrap content,
wrap
 

Wrapping input value in a regular "wrap" but parses the wrapping value first for "insertData" codes.

Parameters:
string Input string being wrapped
string The wrap string, eg. "<b></b>" or more likely here '| ' which will wrap the input string in a tag linking to the current page.
Returns:
string Output string wrapped in the wrapping value.
See also:
insertData(), stdWrap()

Definition at line 3359 of file class.tslib_content.php.

Referenced by stdWrap().

03359                                        {
03360       return $this->wrap($content,$this->insertData($wrap));
03361    }

filelist data  ) 
 

Reads a directory for files and returns the filepaths in a string list separated by comma.

Implements the stdWrap property "filelist"

Parameters:
string The command which contains information about what files/directory listing to return. See the "filelist" property of stdWrap for details.
Returns:
string Comma list of files. private
See also:
stdWrap()

Definition at line 3248 of file class.tslib_content.php.

References clean_directory().

Referenced by t3lib_TCEmain::extFileFunctions(), SC_file_list::main(), and stdWrap().

03248                               {
03249       $data = trim($data);
03250       if ($data)  {
03251          $data_arr = explode('|',$data);
03252             // read directory:
03253          if ($GLOBALS['TSFE']->lockFilePath) {     // MUST exist!
03254             $path = $this->clean_directory($data_arr[0]);   // Cleaning name..., only relative paths accepted.
03255             $path = substr($path,0,strlen($GLOBALS['TSFE']->lockFilePath))==$GLOBALS['TSFE']->lockFilePath ? $path : '';
03256          }
03257          if ($path)  {
03258             $items = Array('files'=>array(), 'sorting'=>array());
03259             $ext_list = strtolower(t3lib_div::uniqueList($data_arr[1]));
03260             $sorting = trim($data_arr[2]);
03261                // read dir:
03262             $d = @dir($path);
03263             $tempArray=Array();
03264             if (is_object($d))   {
03265                $count=0;
03266                while($entry=$d->read()) {
03267                   if ($entry!='.' && $entry!='..') {
03268                      $wholePath = $path.'/'.$entry;      // Because of odd PHP-error where  <br />-tag is sometimes placed after a filename!!
03269                      if (@file_exists($wholePath) && filetype($wholePath)=='file')  {
03270                         $info = t3lib_div::split_fileref($wholePath);
03271                         if (!$ext_list || t3lib_div::inList($ext_list,$info['fileext']))  {
03272                            $items['files'][] = $info['file'];
03273                            switch($sorting)  {
03274                               case 'name':
03275                                  $items['sorting'][] = strtolower($info['file']);
03276                               break;
03277                               case 'size':
03278                                  $items['sorting'][] = filesize($wholePath);
03279                               break;
03280                               case 'ext':
03281                                  $items['sorting'][] = $info['fileext'];
03282                               break;
03283                               case 'date':
03284                                  $items['sorting'][] = filectime($wholePath);
03285                               break;
03286                               default:
03287                                  $items['sorting'][] = $count;
03288                               break;
03289                            }
03290                            $count++;
03291                         }
03292                      }
03293                   }
03294                }
03295                $d->close();
03296             }
03297                // Sort if required
03298             if (count($items['sorting'])) {
03299                if (strtolower(trim($data_arr[3]))!='r')  {
03300                   asort($items['sorting']);
03301                } else {
03302                   arsort($items['sorting']);
03303                }
03304             }
03305             if (count($items['files']))   {
03306                   // make list
03307                reset($items['sorting']);
03308                $fullPath = trim($data_arr[4]);
03309                $list_arr=Array();
03310                while(list($key,)=each($items['sorting']))   {
03311                   $list_arr[]=  $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key];
03312                }
03313                return implode(',',$list_arr);
03314             }
03315          }
03316       }
03317    }

fileResource fName,
addParams = 'alt="" title=""'
 

Returns content of a file.

If it's an image the content of the file is not returned but rather an image tag is.

Parameters:
string The filename, being a TypoScript resource data type
string Additional parameters (attributes). Default is empty alt and title tags.
Returns:
string If jpg,gif,jpeg,png: returns image_tag with picture in. If html,txt: returns content string
See also:
FILE()

Definition at line 2568 of file class.tslib_content.php.

Referenced by tslib_cObj::FILE().

02568                                                                {
02569       $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
02570       if ($incFile)  {
02571          $fileinfo = t3lib_div::split_fileref($incFile);
02572          if (t3lib_div::inList('jpg,gif,jpeg,png',$fileinfo['fileext']))   {
02573             $imgFile = $incFile;
02574             $imgInfo = @getImageSize($imgFile);
02575             return '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$imgFile.'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'" border="0" '.$addParams.' />';
02576          } elseif (filesize($incFile)<1024*1024) {
02577             return $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02578          }
02579       }
02580    }

fillInMarkerArray markContentArray,
row,
fieldList = '',
nl2br = TRUE,
prefix = 'FIELD_',
HSC = FALSE
 

Adds elements to the input $markContentArray based on the values from the fields from $fieldList found in $row.

Parameters:
array Array with key/values being marker-strings/substitution values.
array An array with keys found in the $fieldList (typically a record) which values should be moved to the $markContentArray
string A list of fields from the $row array to add to the $markContentArray array. If empty all fields from $row will be added (unless they are integers)
boolean If set, all values added to $markContentArray will be nl2br()'ed
string Prefix string to the fieldname before it is added as a key in the $markContentArray. Notice that the keys added to the $markContentArray always start and end with "###"
boolean If set, all values are passed through htmlspecialchars() - RECOMMENDED to avoid most obvious XSS and maintain XHTML compliance.
Returns:
array The modified $markContentArray

Definition at line 2916 of file class.tslib_content.php.

02916                                                                                                                   {
02917       if ($fieldList)   {
02918          $fArr = t3lib_div::trimExplode(',',$fieldList,1);
02919          foreach($fArr as $field)   {
02920             $markContentArray['###'.$prefix.$field.'###'] = $nl2br?nl2br($row[$field]):$row[$field];
02921          }
02922       } else {
02923          if (is_array($row))  {
02924             foreach($row as $field => $value)   {
02925                if (!t3lib_div::testInt($field)) {
02926                   if ($HSC)   $value = htmlspecialchars($value);
02927                   $markContentArray['###'.$prefix.$field.'###'] = $nl2br ? nl2br($value) : $value;
02928                }
02929             }
02930          }
02931       }
02932 
02933       return $markContentArray;
02934    }

getAltParam conf  ) 
 

An abstraction method which creates an alt or title parameter for an HTML img tag.

From the $conf array it implements the properties "altText", "titleText" and "longdescURL"

Parameters:
array TypoScript configuration properties
Returns:
string Parameter string containing alt and title parameters (if any)
See also:
IMGTEXT(), cImage()

Definition at line 2626 of file class.tslib_content.php.

Referenced by cImage().

02626                                  {
02627       $altText = trim($this->stdWrap($conf['altText'], $conf['altText.']));
02628       $titleText = trim($this->stdWrap($conf['titleText'],$conf['titleText.']));
02629       $longDesc = trim($this->stdWrap($conf['longdescURL'],$conf['longdescURL.']));
02630 
02631          // "alt":
02632       $altParam = ' alt="'.htmlspecialchars(strip_tags($altText)).'"';
02633 
02634          // "title":
02635       if ($titleText) {
02636          $altParam.= ' title="'.htmlspecialchars(strip_tags($titleText)).'"';
02637       } else {
02638          $altParam.= ' title="'.htmlspecialchars(strip_tags($altText)).'"';
02639       }
02640 
02641          // "longDesc" URL
02642       if ($longDesc) {
02643          $altParam.= ' longdesc="'.htmlspecialchars($longDesc).'"';
02644       }
02645 
02646       return $altParam;
02647    }

getData string,
fieldArray
 

Implements the TypoScript data type "getText".

This takes a string with parameters and based on those a value from somewhere in the system is returned.

Parameters:
string The parameter string, eg. "field : title" or "field : navtitle // field : title" (in the latter case and example of how the value is FIRST splitted by "//" is shown)
mixed Alternative field array; If you set this to an array this variable will be used to look up values for the "field" key. Otherwise the current page record in $GLOBALS['TSFE']->page is used.
Returns:
string The value fetched &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=282&cHash=831a95115d getFieldVal()

Definition at line 4580 of file class.tslib_content.php.

Referenced by insertData(), and stdWrap().

04580                                           {
04581       if (!is_array($fieldArray))   {
04582          $fieldArray=$GLOBALS['TSFE']->page;
04583       }
04584       $retVal = '';
04585       $sections = explode('//',$string);
04586 
04587       while (!$retVal AND list($secKey, $secVal)=each($sections)) {
04588          $parts = explode(':',$secVal,2);
04589          $key = trim($parts[1]);
04590          if ((string)$key!='')   {
04591             switch(strtolower(trim($parts[0]))) {
04592                case 'gpvar':
04593                   list($firstKey, $rest) = explode('|', $key, 2);
04594                   if (strlen(trim($firstKey)))  {
04595                      $retVal = t3lib_div::_GP(trim($firstKey));
04596                         // Look for deeper levels:
04597                      if (strlen(trim($rest)))   {
04598                         $retVal = is_array($retVal) ? $this->getGlobal($rest, $retVal) : '';
04599                      }
04600                         // Check that output is not an array:
04601                      if (is_array($retVal))  $retVal = '';
04602                   }
04603                break;
04604                case 'tsfe':
04605                   $retVal = $GLOBALS['TSFE']->$key;
04606                break;
04607                case 'getenv':
04608                   $retVal = getenv($key);
04609                break;
04610                case 'getindpenv':
04611                   $retVal = t3lib_div::getIndpEnv($key);
04612                break;
04613                case 'field':
04614                   $retVal = $fieldArray[$key];
04615                break;
04616                case 'parameters':
04617                   $retVal = $this->parameters[$key];
04618                break;
04619                case 'register':
04620                   $retVal = $GLOBALS['TSFE']->register[$key];
04621                break;
04622                case 'global':
04623                   $retVal = $this->getGlobal($key);
04624                break;
04625                case 'leveltitle':
04626                   $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04627                   $retVal = $this->rootLineValue($nkey,'title',stristr($key,'slide'));
04628                break;
04629                case 'levelmedia':
04630                   $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04631                   $retVal = $this->rootLineValue($nkey,'media',stristr($key,'slide'));
04632                break;
04633                case 'leveluid':
04634                   $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04635                   $retVal = $this->rootLineValue($nkey,'uid',stristr($key,'slide'));
04636                break;
04637                case 'levelfield':
04638                   $keyP = t3lib_div::trimExplode(',',$key);
04639                   $nkey = $this->getKey($keyP[0],$GLOBALS['TSFE']->tmpl->rootLine);
04640                   $retVal = $this->rootLineValue($nkey,$keyP[1],strtolower($keyP[2])=='slide');
04641                break;
04642                case 'fullrootline':
04643                   $keyP = t3lib_div::trimExplode(',',$key);
04644                   $fullKey = intval($keyP[0])-count($GLOBALS['TSFE']->tmpl->rootLine)+count($GLOBALS['TSFE']->rootLine);
04645                   if ($fullKey>=0)  {
04646                      $retVal = $this->rootLineValue($fullKey,$keyP[1],stristr($keyP[2],'slide'),$GLOBALS['TSFE']->rootLine);
04647                   }
04648                break;
04649                case 'date':
04650                   if (!$key) {$key = 'd/m Y';}
04651                   $retVal = date($key, time());
04652                break;
04653                case 'page':
04654                   $retVal = $GLOBALS['TSFE']->page[$key];
04655                break;
04656                case 'current':
04657                   $retVal = $this->data[$this->currentValKey];
04658                break;
04659                case 'level':
04660                   $retVal = count($GLOBALS['TSFE']->tmpl->rootLine)-1;
04661                break;
04662                case 'db':
04663                   $selectParts = t3lib_div::trimExplode(':',$key);
04664                   $db_rec = $GLOBALS['TSFE']->sys_page->getRawRecord($selectParts[0],$selectParts[1]);
04665                   if (is_array($db_rec) && $selectParts[2]) {$retVal = $db_rec[$selectParts[2]];}
04666                break;
04667                case 'lll':
04668                   $retVal = $GLOBALS['TSFE']->sL('LLL:'.$key);
04669                break;
04670                case 'cobj':
04671                   switch((string)$key) {
04672                      case 'parentRecordNumber':
04673                         $retVal = $this->parentRecordNumber;
04674                      break;
04675                   }
04676                break;
04677                case 'debug':
04678                   switch((string)$key) {
04679                      case 'rootLine':
04680                         $retVal = t3lib_div::view_array($GLOBALS['TSFE']->tmpl->rootLine);
04681                      break;
04682                      case 'fullRootLine':
04683                         $retVal = t3lib_div::view_array($GLOBALS['TSFE']->rootLine);
04684                      break;
04685                      case 'data':
04686                         $retVal = t3lib_div::view_array($this->data);
04687                      break;
04688                   }
04689                break;
04690             }
04691          }
04692       }
04693       return $retVal;
04694    }

getFieldDefaultValue noValueInsert,
fieldName,
defaultVal
 

Returns a default value for a form field in the FORM cObject.

Page CANNOT be cached because that would include the inserted value for the current user.

Parameters:
boolean If noValueInsert OR if the no_cache flag for this page is NOT set, the original default value is returned.
string $fieldName: The POST var name to get default value for
string $defaultVal: The current default value
Returns:
string The default value, either from INPUT var or the current default, based on whether caching is enabled or not. private

Definition at line 2452 of file class.tslib_content.php.

Referenced by tslib_cObj::FORM().

02452                                                                           {
02453       if (!$GLOBALS['TSFE']->no_cache || (!isset($_POST[$fieldName]) && !isset($_GET[$fieldName])) || $noValueInsert)   {
02454          return $defaultVal;
02455       } else {
02456          return t3lib_div::_GP($fieldName);
02457       }
02458    }

getGlobal var,
source = NULL
 

Returns a value from the array, $GLOBALS where the input key, $val, is splitted by "|" first and each part points to a key in the $GLOBALS array.

Example: $var = "HTTP_SERVER_VARS | something" will return the value $GLOBALS['HTTP_SERVER_VARS']['something'] value

Parameters:
string Key, see description of functon
array If you want another array that $GLOBALS used, then just put it in here!
Returns:
mixed Value from $GLOBALS private
See also:
getData()

Definition at line 4729 of file class.tslib_content.php.

References $a.

04729                                           {
04730       $vars = explode('|', $var);
04731       $c = count($vars);
04732       $theVar = isset($source) ? $source[trim($vars[0])] : $GLOBALS[trim($vars[0])];
04733       for ($a=1;$a<$c;$a++) {
04734          if (!isset($theVar)) {break;}
04735          $theVar = $theVar[trim($vars[$a])];
04736       }
04737       if (!is_array($theVar)) {
04738          return $theVar;
04739       } else {
04740          return '';
04741       }
04742    }

getKey key,
arr
 

Processing of key values pointing to entries in $arr; Here negative values are converted to positive keys pointer to an entry in the array but from behind (based on the negative value).

Example: entrylevel = -1 means that entryLevel ends up pointing at the outermost-level, -2 means the level before the outermost...

Parameters:
integer The integer to transform
array Array in which the key should be found.
Returns:
integer The processed integer key value. private
See also:
getData()

Definition at line 4754 of file class.tslib_content.php.

References $key.

Referenced by tslib_menu::makeMenu(), tslib_feUserAuth::record_registration(), SEARCHRESULT(), and tslib_menu::start().

04754                               {
04755       $key = intval($key);
04756       if (is_array($arr))  {
04757          if ($key < 0)  {
04758             $key = count($arr)+$key;
04759          }
04760          if ($key < 0)  {
04761             $key=0;
04762          }
04763       }
04764       return $key;
04765    }

getSubpart content,
marker
 

Returns a subpart from the input content stream.

A subpart is a part of the input stream which is encapsulated in a string matching the input string, $marker. If this string is found inside of HTML comment tags the start/end points of the content block returned will be that right outside that comment block. Example: The contennt string is "Hello World. How are you?" If $marker is "###sub1###" then the content returned is " World. How are ". The input content string could just as well have been "Hello ###sub1### World. How are ###sub1### you?" and the result would be the same

Parameters:
string The content stream, typically HTML template content.
string The marker string, typically on the form "###[the marker string]###"
Returns:
string The subpart found, if found.
See also:
substituteSubpart(), t3lib_parsehtml::getSubpart()

Definition at line 2683 of file class.tslib_content.php.

Referenced by TEMPLATE().

02683                                           {
02684       if ($marker && strstr($content,$marker))  {
02685          $start = strpos($content, $marker)+strlen($marker);
02686          $stop = @strpos($content, $marker, $start+1);
02687          $sub = substr($content, $start, $stop-$start);
02688 
02689          $reg=Array();
02690          ereg('^[^<]*-->',$sub,$reg);
02691          $start+=strlen($reg[0]);
02692 
02693          $reg=Array();
02694          ereg('<!--[^>]*$',$sub,$reg);
02695          $stop-=strlen($reg[0]);
02696 
02697          return substr($content, $start, $stop-$start);
02698       }
02699    }

HTMLparser_TSbridge theValue,
conf
 

Passes the input value, $theValue, to an instance of "t3lib_parsehtml" together with the TypoScript options which are first converted from a TS style array to a set of arrays with options for the t3lib_parsehtml class.

Parameters:
string The value to parse by the class "t3lib_parsehtml"
array TypoScript properties for the parser. See link.
Returns:
string Return value. &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=330&cHash=664e0296bf stdWrap(), t3lib_parsehtml::HTMLparserConfig(), t3lib_parsehtml::HTMLcleaner()

Definition at line 3345 of file class.tslib_content.php.

Referenced by stdWrap().

03345                                                    {
03346       $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
03347       $htmlParserCfg =  $htmlParser->HTMLparserConfig($conf);
03348       return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2],$htmlParserCfg[3]);
03349    }

imageLinkWrap string,
imageFile,
conf
 

Wraps the input string in link-tags that opens the image in a new window.

Parameters:
string String to wrap, probably an tag
string The original image file
array TypoScript properties for the "imageLinkWrap" function
Returns:
string The input string, $string, wrapped as configured.
See also:
cImage() &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=316&cHash=2848266da6

Definition at line 2503 of file class.tslib_content.php.

References $content, and stdWrap().

Referenced by cImage().

02503                                                     {
02504       $a1='';
02505       $a2='';
02506       $content=$string;
02507       if ($this->stdWrap($conf['enable'],$conf['enable.'])) {
02508          $content=$this->typolink($string, $conf['typolink.']);
02509             // imageFileLink:
02510          if ($content==$string && @is_file($imageFile)) {
02511             $params = '';
02512             if ($conf['width']) {$params.='&width='.rawurlencode($conf['width']);}
02513             if ($conf['height']) {$params.='&height='.rawurlencode($conf['height']);}
02514             if ($conf['effects']) {$params.='&effects='.rawurlencode($conf['effects']);}
02515             if ($conf['sample']) {$params.='&sample=1';}
02516             if ($conf['alternativeTempPath']) {$params.='&alternativeTempPath='.rawurlencode($conf['alternativeTempPath']);}
02517 
02518             if ($conf['bodyTag']) {$params.='&bodyTag='.rawurlencode($conf['bodyTag']);}
02519             if ($conf['title']) {$params.='&title='.rawurlencode($conf['title']);}
02520             if ($conf['wrap']) {$params.='&wrap='.rawurlencode($conf['wrap']);}
02521 
02522             $md5_value = md5($imageFile.'|'.$conf['width'].'|'.$conf['height'].'|'.$conf['effects'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
02523 
02524             $params.= '&md5='.$md5_value;
02525             $url = $GLOBALS['TSFE']->absRefPrefix.'showpic.php?file='.rawurlencode($imageFile).$params;
02526             if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.'])   {
02527                $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
02528                if ($altUrl)   {
02529                   $url=$altUrl;
02530                }
02531             }
02532 
02533             if ($conf['JSwindow'])  {
02534                $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02535                $gifCreator->init();
02536                $gifCreator->mayScaleUp = 0;
02537                $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile),$conf['width'],$conf['height'],'');
02538                $offset = t3lib_div::intExplode(',',$conf['JSwindow.']['expand'].',');
02539 
02540                $a1='<a href="#" onclick="'.
02541                   htmlspecialchars('openPic(\''.$GLOBALS['TSFE']->baseUrlWrap($url).'\',\''.($conf['JSwindow.']['newWindow']?md5($url):'thePicture').'\',\'width='.($dims[0]+$offset[0]).',height='.($dims[1]+$offset[1]).',status=0,menubar=0\'); return false;').
02542                   '"'.$GLOBALS['TSFE']->ATagParams.'>';
02543                $a2='</a>';
02544                $GLOBALS['TSFE']->setJS('openPic');
02545             } else {
02546                $target = ' target="thePicture"';
02547                if (isset($conf['target'])) {
02548                   $target= $conf['target'] ? ' target="'.$conf['target'].'"' : '';
02549                }
02550                $a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02551                $a2='</a>';
02552             }
02553             $content=$a1.$string.$a2;
02554          }
02555       }
02556 
02557       return $content;
02558    }

insertData str  ) 
 

Implements the "insertData" property of stdWrap meaning that if strings matching {...} is found in the input string they will be substituted with the return value from getData (datatype) which is passed the content of the curly braces.

Example: If input string is "This is the page title: {page:title}" then the part, '{page:title}', will be substituted with the current pages title field value.

Parameters:
string Input value
Returns:
string Processed input value
See also:
getData(), stdWrap(), dataWrap() &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=314&cHash=02ab044c7b

Definition at line 3372 of file class.tslib_content.php.

References getData().

Referenced by stdWrap().

03372                               {
03373       $inside=0;
03374       $newVal='';
03375       $pointer=0;
03376       $totalLen = strlen($str);
03377       do {
03378          if (!$inside)  {
03379             $len = strcspn(substr($str,$pointer),'{');
03380             $newVal.= substr($str,$pointer,$len);
03381             $inside = 1;
03382          } else {
03383             $len = strcspn(substr($str,$pointer),'}')+1;
03384             $newVal.= $this->getData(substr($str,$pointer+1,$len-2),$this->data);
03385             $inside = 0;
03386          }
03387          $pointer+=$len;
03388       } while($pointer<$totalLen);
03389       return $newVal;
03390    }

lastChanged tstamp  ) 
 

Sets the SYS_LASTCHANGED timestamp if input timestamp is larger than current value.

The SYS_LASTCHANGED timestamp can be used by various caching/indexing applications to determine if the page has new content. Therefore you should call this function with the last-changed timestamp of any element you display.

Parameters:
integer Unix timestamp (number of seconds since 1970)
Returns:
void
See also:
tslib_fe::setSysLastChanged()

Definition at line 2591 of file class.tslib_content.php.

Referenced by tslib_cObj::CONTENT(), and tslib_cObj::RECORDS().

02591                                  {
02592       $tstamp = intval($tstamp);
02593       if ($tstamp>intval($GLOBALS['TSFE']->register['SYS_LASTCHANGED']))   {
02594          $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] = $tstamp;
02595       }
02596    }

linkWrap content,
wrap
 

Wraps the input string by the $wrap value and implements the "linkWrap" data type as well.

The "linkWrap" data type means that this function will find any integer encapsulated in {} (curly braces) in the first wrap part and substitute it with the corresponding page uid from the rootline where the found integer is pointing to the key in the rootline. See link below.

Parameters:
string Input string
string A string where the first two parts separated by "|" (vertical line) will be wrapped around the input string
Returns:
string Wrapped output string
See also:
wrap(), cImage(), FILE() &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=282&cHash=831a95115d

Definition at line 2608 of file class.tslib_content.php.

Referenced by cImage(), tslib_cObj::FILE(), and tslib_tmenu::writeMenu().

02608                                        {
02609       $wrapArr = explode('|', $wrap);
02610       if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg))   {
02611          if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid'])   {
02612             $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
02613          }
02614       }
02615       return trim($wrapArr[0]).$content.trim($wrapArr[1]);
02616    }

listNum content,
listNum,
char
 

Exploding a string by the $char value (if integer its an ASCII value) and returning index $listNum.

Parameters:
string String to explode
string Index-number. You can place the word "last" in it and it will be substituted with the pointer to the last value. You can use math operators like "+-/*" (passed to calc())
string Either a string used to explode the content string or an integer value which will then be changed into a character, eg. "10" for a linebreak char.
Returns:
string

Definition at line 3165 of file class.tslib_content.php.

References listNum().

Referenced by listNum(), and stdWrap().

03165                                              {
03166       $char = $char ? $char : ',';
03167       if (t3lib_div::testInt($char))   {
03168          $char = chr($char);
03169       }
03170       $temp = explode($char,$content);
03171       $last = ''.(count($temp)-1);
03172       $index=$this->calc(eregi_replace('last',$last,$listNum));
03173       return $temp[$index];
03174    }

MULTIMEDIA conf  ) 
 

Rendering the cObject, MULTIMEDIA.

Parameters:
array Array of TypoScript properties
Returns:
string Output &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=374&cHash=efd88ab4a9

Definition at line 2322 of file class.tslib_content.php.

References $content, and stdWrap().

Referenced by tslib_cObj::cObjGetSingle().

02322                               {
02323       $content='';
02324       $filename=$this->stdWrap($conf['file'],$conf['file.']);
02325       $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
02326       if ($incFile)  {
02327          $fileinfo = t3lib_div::split_fileref($incFile);
02328          if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) {
02329             $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02330          } else {
02331                // default params...
02332             $parArray=array();
02333                // src is added
02334             $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"';
02335             if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext']))   {
02336             }
02337             if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext']))   {
02338                $parArray['width'] = 'width="200"';
02339                $parArray['height'] = 'height="200"';
02340             }
02341             if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext']))  {
02342                $parArray['quality'] = 'quality="high"';
02343             }
02344             if (t3lib_div::inList('class',$fileinfo['fileext']))  {
02345                $parArray['width'] = 'width="200"';
02346                $parArray['height'] = 'height="200"';
02347             }
02348 
02349                // fetching params
02350             $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
02351             while(list(,$l)=each($lines)) {
02352                $parts = explode('=', $l);
02353                $parameter = strtolower(trim($parts[0]));
02354                $value = trim($parts[1]);
02355                if ((string)$value!='') {
02356                   $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"';
02357                } else {
02358                   unset($parArray[$parameter]);
02359                }
02360             }
02361             if ($fileinfo['fileext']=='class')  {
02362                unset($parArray['src']);
02363                $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"';
02364                $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"';
02365                $content='<applet '.implode(' ',$parArray).'></applet>';
02366             } else {
02367                $content='<embed '.implode(' ',$parArray).'></embed>';
02368             }
02369          }
02370       }
02371 
02372       if ($conf['stdWrap.']) {
02373          $content=$this->stdWrap($content, $conf['stdWrap.']);
02374       }
02375 
02376       return $content;
02377    }

netprintApplication_offsiteLinkWrap str,
imgConf,
conf
 

Creates a link to a netprint application on another website (where the "netprint" extension is running") Related to the extension "netprint".

Parameters:
string The input string to add the link to.
array Array with information about the image.
array TypoScript properties for the netprint application.
Returns:
string The input string possibly with the netprint link before/after private

Definition at line 2411 of file class.tslib_content.php.

References tslib_cObj::cObjGetSingle(), and stdWrap().

Referenced by tslib_cObj::IMGTEXT().

02411                                                                      {
02412       if ($conf['url'] && @is_file($imgConf['origFile']))   {
02413          $thisUrl = $conf['thisUrl'] ? $conf['thisUrl'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
02414          $origFile=$thisUrl.$imgConf['origFile'];
02415             // Original file dimensions:
02416          $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02417          $gifCreator->init();
02418          $origDim = $gifCreator->getImageDimensions($imgConf['origFile']);
02419          if (!$conf['linkOnlyPixelsAbove'] || $origDim[0]*$origDim[1]>$conf['linkOnlyPixelsAbove'])   {
02420                // Set parameters
02421             $thumbFile=$thisUrl.$imgConf['3'].'|'.$imgConf[0].'x'.$imgConf[1].'|'.$origDim[0].'x'.$origDim[1].'|'.filesize($imgConf['origFile']).'|'.filemtime($imgConf['origFile']);
02422                // Set url:
02423             $url = $conf['url']
02424                .'&NP[offsite][1]='.rawurlencode($origFile)
02425                .'&NP[offsite_thumb][1]='.rawurlencode($thumbFile);
02426             $linkCObject = $this->cObjGetSingle($conf['cObject'],$conf['cObject.']);
02427             if ($linkCObject) {
02428                $ATagParams = trim($conf['ATagParams']) ? ' '.trim($conf['ATagParams']) : '';
02429                $linkCObject='<a href="'.htmlspecialchars($url).'"'.$ATagParams.'>'.$linkCObject.'</a>';
02430                $linkCObject=$this->stdWrap($linkCObject,$conf['outerStdWrap.']);
02431                if ($conf['before']) {
02432                   $str=$linkCObject.$str;
02433                } else {
02434                   $str=$str.$linkCObject;
02435                }
02436             }
02437          }
02438       }
02439       return $str;
02440    }

numRows conf  ) 
 

Returns number of rows selected by the query made by the properties set.

Implements the stdWrap "numRows" property

Parameters:
array TypoScript properties for the property (see link to "numRows")
Returns:
integer The number of rows found by the select private &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=317&cHash=e28e53e634 http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6 stdWrap()

Definition at line 3144 of file class.tslib_content.php.

References error(), and table().

Referenced by t3lib_dmailer::dmailer_masssend(), and stdWrap().

03144                            {
03145       $conf['select.']['selectFields'] = 'count(*)';
03146 
03147       $res = $this->exec_getQuery($conf['table'],$conf['select.']);
03148 
03149       if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
03150          $GLOBALS['TT']->setTSlogMessage($error,3);
03151       } else {
03152          $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
03153          return intval($row[0]);
03154       }
03155    }

PHP_SCRIPT conf,
ext = ''
 

Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT.

Parameters:
array Array of TypoScript properties
string If "INT", then rendering "PHP_SCRIPT_INT"; If "EXT", then rendering "PHP_SCRIPT_EXT"; Default is rendering "PHP_SCRIPT" (cached)
Returns:
string Output &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=370&cHash=aa107f2ad8 http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=371&cHash=53f71d025e http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=372&cHash=91fe391e1c

Definition at line 2128 of file class.tslib_content.php.

References $content.

Referenced by tslib_cObj::cObjGetSingle().

02128                                        {
02129       $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
02130       $content='';
02131       if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile))  {
02132          switch($ext)   {
02133             case 'INT':
02134             case 'EXT':
02135                $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
02136                $content.='<!--'.$substKey.'-->';
02137                $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
02138                   'file'=>$incFile,
02139                   'conf'=>$conf,
02140                   'type'=>'SCRIPT'
02141                );
02142                if ($ext=='INT')  {
02143                   $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
02144                } else {
02145                   $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data;
02146                }
02147             break;
02148             default:
02149                   // Added 31-12-00: Make backup...
02150                $this->oldData = $this->data;
02151                   // Include file..
02152                include('./'.$incFile);
02153                   // Added 31-12-00: restore...
02154                if ($RESTORE_OLD_DATA)  {
02155                   $this->data = $this->oldData;
02156                }
02157             break;
02158          }
02159       }
02160       return $content;
02161    }

prefixComment str,
conf,
content
 

Returns a HTML comment with the second part of input string (divided by "|") where first part is an integer telling how many trailing tabs to put before the comment on a new line.

Notice; this function (used by stdWrap) can be disabled by a "config.disablePrefixComment" setting in TypoScript.

Parameters:
string Input value
array TypoScript Configuration (not used at this point.)
string The content to wrap the comment around.
Returns:
string Processed input value
See also:
stdWrap()

Definition at line 3402 of file class.tslib_content.php.

References $content.

Referenced by stdWrap().

03402                                                 {
03403       $parts = explode('|',$str);
03404 
03405       $output =
03406          chr(10).str_pad('',$parts[0],chr(9)).
03407          '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [begin] -->'.
03408          chr(10).str_pad('',$parts[0]+1,chr(9)).
03409             $content.
03410          chr(10).str_pad('',$parts[0],chr(9)).
03411          '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [end] -->'.
03412          chr(10).str_pad('',$parts[0]+1,chr(9));
03413 
03414       return $output;
03415    }

removeBadHTML text,
conf
 

Function for removing malicious HTML code when you want to provide some HTML code user-editable.

The purpose is to avoid XSS attacks and the code will be continously modified to remove such code. For a complete reference with javascript-on-events, see http://www.wdvl.com/Authoring/JavaScript/Events/events_target.html

Parameters:
string Input string to be cleaned.
array TypoScript configuration.
Returns:
string Return string
Author:
Thomas Bley (all from moregroupware cvs code / readmessage.inc.php, published under gpl by Thomas)

Kasper Skårhøj

Will find all strings prefixed with "mailto:" in the $data string and make them into a link, linking to the email address they point to.

Parameters:
string The string in which to search for "mailto:"
array Configuration for makeLinks, see link
Returns:
string The processed input string, being returned. &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=328&cHash=c1135706d7 _parseFunc() Creates and returns a TypoScript "imgResource". The value ($file) can either be a file reference (TypoScript resource) or the string "GIFBUILDER". In the first case a current image is returned, possibly scaled down or otherwise processed. In the latter case a GIFBUILDER image is returned; This means an image is made by TYPO3 from layers of elements as GIFBUILDER defines. In the function IMG_RESOURCE() this function is called like $this->getImgResource($conf['file'],$conf['file.']); string A "imgResource" TypoScript data type. Either a TypoScript file resource or the string GIFBUILDER. See description above. array TypoScript properties for the imgResource type array Returns info-array. info[origFile] = original file. http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=315&cHash=63b593a934 IMG_RESOURCE(), cImage(), tslib_gifBuilder Returns the value for the field from $this->data. If "//" is found in the $field value that token will split the field values apart and the first field having a non-blank value will be returned. string The fieldname, eg. "title" or "navtitle // title" (in the latter case the value of $this->data[navtitle] is returned if not blank, otherwise $this->data[title] will be) string

Definition at line 3476 of file class.tslib_content.php.

Referenced by stdWrap().

03476                                           {
03477 
03478          // Copyright 2002-2003 Thomas Bley
03479       $text = preg_replace(
03480          array(
03481             "'<script[^>]*?>.*?</script[^>]*?>'si",
03482             "'<applet[^>]*?>.*?</applet[^>]*?>'si",
03483             "'<object[^>]*?>.*?</object[^>]*?>'si",
03484             "'<iframe[^>]*?>.*?</iframe[^>]*?>'si",
03485             "'<frameset[^>]*?>.*?</frameset[^>]*?>'si",
03486             "'<style[^>]*?>.*?</style[^>]*?>'si",
03487             "'<marquee[^>]*?>.*?</marquee[^>]*?>'si",
03488             "'<script[^>]*?>'si",
03489             "'<meta[^>]*?>'si",
03490             "'<base[^>]*?>'si",
03491             "'<applet[^>]*?>'si",
03492             "'<object[^>]*?>'si",
03493             "'<link[^>]*?>'si",
03494             "'<iframe[^>]*?>'si",
03495             "'<frame[^>]*?>'si",
03496             "'<frameset[^>]*?>'si",
03497             "'<input[^>]*?>'si",
03498             "'<form[^>]*?>'si",
03499             "'<embed[^>]*?>'si",
03500             "'background-image:url'si",
03501             "'<\w+.*?(onabort|onbeforeunload|onblur|onchange|onclick|ondblclick|ondragdrop|onerror|onfilterchange|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onmove|onreadystatechange|onreset|onresize|onscroll|onselect|onselectstart|onsubmit|onunload).*?>'si",
03502          ), '', $text);
03503 
03504          $text = eregi_replace('<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text);
03505 
03506          // Return clean content
03507       return $text;
03508    }
03509 
03520    function textStyle($theValue, $conf) {
03521       $conf['face.'][1] = 'Times New Roman';
03522       $conf['face.'][2] = 'Verdana,Arial,Helvetica,Sans serif';
03523       $conf['face.'][3] = 'Arial,Helvetica,Sans serif';
03524 
03525       $conf['size.'][1] = 1;
03526       $conf['size.'][2] = 2;
03527       $conf['size.'][3] = 3;
03528       $conf['size.'][4] = 4;
03529       $conf['size.'][5] = 5;
03530       $conf['size.'][10] = '+1';
03531       $conf['size.'][11] = '-1';
03532 
03533       $conf['color.'][240] = 'black';
03534       $conf['color.'][241] = 'white';
03535       $conf['color.'][242] = '#333333';
03536       $conf['color.'][243] = 'gray';
03537       $conf['color.'][244] = 'silver';
03538       $conf['color.'][245] = 'red';
03539       $conf['color.'][246] = 'navy';
03540       $conf['color.'][247] = 'yellow';
03541       $conf['color.'][248] = 'green';
03542       $conf['color.'][249] = 'olive';
03543       $conf['color.'][250] = 'maroon';
03544 
03545       $face = $this->data[$conf['face.']['field']];
03546       $size = $this->data[$conf['size.']['field']];
03547       $color = $this->data[$conf['color.']['field']];
03548       $align = $this->data[$conf['align.']['field']];
03549       $properties = $this->data[$conf['properties.']['field']];
03550       if (!$properties) {
03551          $properties=$this->stdWrap($conf['properties.']['default'],$conf['properties.']['default.']);
03552       }
03553 
03554          // properties
03555       if (($properties&8)) {$theValue=$this->HTMLcaseshift($theValue, 'upper');}
03556       if (($properties&1)) {$theValue='<b>'.$theValue.'</b>';}
03557       if (($properties&2)) {$theValue='<i>'.$theValue.'</i>';}
03558       if (($properties&4)) {$theValue='<u>'.$theValue.'</u>';}
03559 
03560          // Fonttag
03561       $theFace = $conf['face.'][$face] ? $conf['face.'][$face] : $this->stdWrap($conf['face.']['default'],$conf['face.']['default.']);
03562       $theSize = $conf['size.'][$size] ? $conf['size.'][$size] : $this->stdWrap($conf['size.']['default'],$conf['size.']['default.']);
03563       $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $this->stdWrap($conf['color.']['default'],$conf['color.']['default.']);
03564 
03565       if ($conf['altWrap'])   {
03566          $theValue=$this->wrap($theValue, $conf['altWrap']);
03567       } elseif ($theFace || $theSize || $theColor) {
03568          $fontWrap = '<font'.($theFace?' face="'.$theFace.'"':'').($theSize?' size="'.$theSize.'"':'').($theColor?' color="'.$theColor.'"':'').'>|</font>';
03569          $theValue=$this->wrap($theValue, $fontWrap);
03570       }
03571          // align
03572       if ($align) {$theValue=$this->wrap($theValue, '<div align="'.$align.'">|</div>');}
03573          // return
03574       return $theValue;
03575    }
03576 
03587    function tableStyle($theValue, $conf) {
03588       $conf['color.'][240] = 'black';
03589       $conf['color.'][241] = 'white';
03590       $conf['color.'][242] = '#333333';
03591       $conf['color.'][243] = 'gray';
03592       $conf['color.'][244] = 'silver';
03593 
03594       $align = $this->stdWrap($conf['align'],$conf['align.']);
03595       $border = intval($this->stdWrap($conf['border'],$conf['border.']));
03596       $cellspacing = intval($this->stdWrap($conf['cellspacing'],$conf['cellspacing.']));
03597       $cellpadding = intval($this->stdWrap($conf['cellpadding'],$conf['cellpadding.']));
03598 
03599       $color = $this->data[$conf['color.']['field']];
03600       $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $conf['color.']['default'];
03601          // Assembling the table tag
03602       $tableTagArray = Array('<table');
03603       $tableTagArray[]='border="'.$border.'"';
03604       $tableTagArray[]='cellspacing="'.$cellspacing.'"';
03605       $tableTagArray[]='cellpadding="'.$cellpadding.'"';
03606       if ($align) {$tableTagArray[]='align="'.$align.'"';}
03607       if ($theColor) {$tableTagArray[]='bgcolor="'.$theColor.'"';}
03608 
03609       if ($conf['params']) {
03610          $tableTagArray[] = $conf['params'];
03611       }
03612 
03613       $tableWrap = implode(' ',$tableTagArray).'> | </table>';
03614       $theValue=$this->wrap($theValue, $tableWrap);
03615          // return
03616       return $theValue;
03617    }
03618 
03628    function addParams($content,$conf) {
03629       $lowerCaseAttributes = TRUE;  // For XHTML compliance.
03630 
03631       if (!is_array($conf))   { return $content; }
03632 
03633       $key = 1;
03634       $parts = explode('<',$content);
03635       if (intval($conf['_offset'])) $key = intval($conf['_offset'])<0 ? count($parts)+intval($conf['_offset']) : intval($conf['_offset']);
03636       $subparts=explode('>',$parts[$key]);
03637       if (trim($subparts[0])) {
03638             // Get attributes and name
03639          $attribs = t3lib_div::get_tag_attributes('<'.$subparts[0].'>');
03640          if (!is_array($attribs))   {$attribs=array();}
03641          list($tagName) = explode(' ',$subparts[0],2);
03642             // adds/overrides attributes
03643          reset($conf);
03644          while(list($pkey,$val)=each($conf)) {
03645             if (substr($pkey,-1)!='.' && substr($pkey,0,1)!='_')  {
03646                $tmpVal=$this->stdWrap($conf[$pkey],$conf[$pkey.'.']);
03647                if ($lowerCaseAttributes)  { $pkey = strtolower($pkey); }
03648                if (strcmp($tmpVal,'')) {$attribs[$pkey]=$tmpVal;}
03649             }
03650          }
03651 
03652             // Re-assembles the tag and content
03653          $subparts[0]=trim($tagName.' '.t3lib_div::implodeAttributes($attribs));
03654          $parts[$key] = implode('>',$subparts);
03655          $content = implode('<',$parts);
03656       }
03657       return $content;
03658    }
03659 
03671    function filelink($theValue, $conf) {
03672       $output = '';
03673       $aTagParams = $GLOBALS['TSFE']->ATagParams.($conf['ATagParams']?' '.$conf['ATagParams']:'');
03674       $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
03675       $conf['path'] = $this->stdWrap($conf['path'],$conf['path.']);
03676       $theFile = trim($conf['path']).$theValue;
03677       if (@is_file($theFile)) {
03678          $theFileEnc = str_replace('%2F', '/', rawurlencode($theFile));
03679          $locDataAdd = $conf['jumpurl.']['secure'] ? $this->locDataJU($theFileEnc,$conf['jumpurl.']['secure.']) : '';
03680          $url = ($conf['jumpurl']) ? $GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($theFileEnc).$locDataAdd.$GLOBALS['TSFE']->getMethodUrlIdToken : $theFileEnc;    // && $GLOBALS['TSFE']->config['config']['jumpurl_enable']
03681          $theLinkWrap = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$url).'"'.($conf['target']?' target="'.$conf['target'].'"':'').$aTagParams.'>|</a>';
03682 
03683          $theSize = filesize($theFile);
03684          $fI = t3lib_div::split_fileref($theFile);
03685          if ($conf['icon'])   {
03686             $iconP = 't3lib/gfx/fileicons/';
03687             $icon = @is_file($iconP.$fI['fileext'].'.gif') ? $iconP.$fI['fileext'].'.gif' : $iconP.'default.gif';
03688                // Checking for images: If image, then return link to thumbnail.
03689             $IEList = $this->stdWrap($conf['icon_image_ext_list'],$conf['icon_image_ext_list.']);
03690             $image_ext_list = str_replace(' ','',strtolower($IEList));
03691             if ($fI['fileext'] && t3lib_div::inList($image_ext_list, $fI['fileext']))  {
03692                if ($conf['iconCObject'])  {
03693                   $icon = $this->cObjGetSingle($conf['iconCObject'],$conf['iconCObject.'],'iconCObject');
03694                } else {
03695                   if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
03696                      $icon = 't3lib/thumbs.php?&dummy='.$GLOBALS['EXEC_TIME'].'&file='.rawurlencode('../'.$theFile);
03697                   } else {
03698                      $icon = 't3lib/gfx/notfound_thumb.gif';
03699                   }
03700                   $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'" border="0"'.$this->getAltParam($conf).' />';
03701                }
03702             } else {
03703                $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'" width="18" height="16" border="0"'.$this->getAltParam($conf).' />';
03704             }
03705             if ($conf['icon_link']) {$icon = $this->wrap($icon, $theLinkWrap);}
03706             $icon = $this->stdWrap($icon,$conf['icon.']);
03707          }
03708          if ($conf['size'])   {
03709             $size = $this->stdWrap($theSize,$conf['size.']);
03710          }
03711 
03712             // Wrapping file label
03713          if ($conf['removePrependedNumbers']) $theValue=ereg_replace('_[0-9][0-9](\.[[:alnum:]]*)$','\1',$theValue);
03714          $theValue = $this->stdWrap($theValue,$conf['labelStdWrap.']);
03715 
03716             // Wrapping file
03717          if ($conf['ATagBeforeWrap'])  {
03718             $theValue = $this->wrap($this->wrap($theValue, $conf['wrap']), $theLinkWrap);
03719          } else {
03720             $theValue = $this->wrap($this->wrap($theValue, $theLinkWrap), $conf['wrap']);
03721          }
03722          $file = $this->stdWrap($theValue,$conf['file.']);
03723             // output
03724          return $this->stdWrap($icon.$file.$size, $conf['stdWrap.']);
03725       }
03726    }
03727 
03738    function locDataJU($jumpUrl,$conf)  {
03739       $fI = pathinfo($jumpUrl);
03740       $mimetype='';
03741       if ($fI['extension'])   {
03742          $mimeTypes = t3lib_div::trimExplode(',',$conf['mimeTypes'],1);
03743          reset($mimeTypes);
03744          while(list(,$v)=each($mimeTypes))   {
03745             $parts = explode('=',$v,2);
03746             if (strtolower($fI['extension']) == strtolower(trim($parts[0])))  {
03747                $mimetype = '&mimeType='.rawurlencode(trim($parts[1]));
03748             }
03749          }
03750       }
03751       $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
03752       $rec='&locationData='.$locationData;
03753       $hArr = array(
03754          $jumpUrl,
03755          $locationData,
03756          $GLOBALS['TSFE']->TYPO3_CONF_VARS['SYS']['encryptionKey']
03757       );
03758       $juHash='&juHash='.t3lib_div::shortMD5(serialize($hArr));
03759       return '&juSecure=1'.$mimetype.$rec.$juHash;
03760    }
03761 
03769    function calc($val)  {
03770       $parts= t3lib_div::splitCalc($val,'+-*/');
03771       $value=0;
03772       reset($parts);
03773       while(list(,$part)=each($parts)) {
03774          $theVal = $part[1];
03775          $sign =  $part[0];
03776          if ((string)intval($theVal)==(string)$theVal)   {
03777             $theVal = intval($theVal);
03778          } else {
03779             $theVal =0;
03780          }
03781          if ($sign=='-')   {$value-=$theVal;}
03782          if ($sign=='+')   {$value+=$theVal;}
03783          if ($sign=='/')   {if (intval($theVal)) $value/=intval($theVal);}
03784          if ($sign=='*')   {$value*=$theVal;}
03785       }
03786       return $value;
03787    }
03788 
03798    function calcIntExplode($delim, $string)  {
03799       $temp = explode($delim,$string);
03800       while(list($key,$val)=each($temp))  {
03801          $temp[$key]=intval(tslib_cObj::calc($val));
03802       }
03803       return $temp;
03804    }
03805 
03818    function splitObj($value, $conf) {
03819       $conf['token']=$this->stdWrap($conf['token'],$conf['token.']);
03820 
03821       if ($conf['token'])  {
03822          $conf['max']=intval($this->stdWrap($conf['max'],$conf['max.']));
03823          $conf['min']=intval($this->stdWrap($conf['min'],$conf['min.']));
03824 
03825          $valArr=explode($conf['token'],$value);
03826             // calculate splitCount
03827          $splitCount = count($valArr);
03828          if ($conf['max'] && $splitCount>$conf['max']) {
03829             $splitCount=$conf['max'];
03830          }
03831          if ($conf['min'] && $splitCount<$conf['min']) {
03832             $splitCount=$conf['min'];
03833          }
03834 
03835          if ($conf['wrap'] || $conf['cObjNum']) {
03836             $splitArr=array();
03837             $splitArr['wrap']=$conf['wrap'];
03838             $splitArr['cObjNum']=$conf['cObjNum'];
03839             $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$splitCount);
03840          }
03841 
03842          $content='';
03843          for($a=0;$a<$splitCount;$a++) {
03844             $GLOBALS['TSFE']->register['SPLIT_COUNT']=$a;
03845             $value = ''.$valArr[$a];
03846             $this->data[$this->currentValKey] = $value;
03847             if ($splitArr[$a]['cObjNum']) {
03848                $objName=intval($splitArr[$a]['cObjNum']);
03849                $value = $this->stdWrap($this->cObjGet($conf[$objName.'.'],$objName.'.'),$conf[$objName.'.']);
03850             }
03851             if ($splitArr[$a]['wrap']) {
03852                $value=$this->wrap($value,$splitArr[$a]['wrap']);
03853             }
03854             $content.=$value;
03855          }
03856       }
03857       return $content;
03858    }
03859 
03874    function parseFunc($theValue, $conf, $ref='') {
03875 
03876          // Fetch / merge reference, if any
03877       if ($ref)   {
03878          $temp_conf = array(
03879                         'parseFunc' => $ref,
03880                         'parseFunc.' => $conf
03881                      );
03882          $temp_conf = $this->mergeTSRef($temp_conf, 'parseFunc');
03883          $conf = $temp_conf['parseFunc.'];
03884       }
03885 
03886          // Process:
03887       if (strcmp($conf['externalBlocks'],''))   {
03888          $tags = strtolower(implode(',',t3lib_div::trimExplode(',',$conf['externalBlocks'])));
03889          $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
03890          $parts = $htmlParser->splitIntoBlock($tags,$theValue);
03891 
03892          reset($parts);
03893          while(list($k,$v)=each($parts))  {
03894             if ($k%2)   {  // font:
03895                $tagName=strtolower($htmlParser->getFirstTagName($v));
03896                $cfg=$conf['externalBlocks.'][$tagName.'.'];
03897                if ($cfg['stripNLprev'] || $cfg['stripNL'])  {
03898                   $parts[$k-1]=ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $parts[$k-1]);
03899                }
03900                if ($cfg['stripNLnext'] || $cfg['stripNL'])  {
03901                   $parts[$k+1]=ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $parts[$k+1]);
03902                }
03903             }
03904          }
03905 
03906          reset($parts);
03907          while(list($k,$v)=each($parts))  {
03908             if ($k%2)   {
03909                $tag=$htmlParser->getFirstTag($v);
03910                $tagName=strtolower($htmlParser->getFirstTagName($v));
03911                $cfg=$conf['externalBlocks.'][$tagName.'.'];
03912                if ($cfg['callRecursive']) {
03913                   $parts[$k]=$this->parseFunc($htmlParser->removeFirstAndLastTag($v), $conf);
03914                   if (!$cfg['callRecursive.']['dontWrapSelf']) {
03915                      if ($cfg['callRecursive.']['alternativeWrap'])  {
03916                         $parts[$k] = $this->wrap($parts[$k], $cfg['callRecursive.']['alternativeWrap']);
03917                      } else {
03918                         if (is_array($cfg['callRecursive.']['tagStdWrap.']))  {
03919                            $tag = $this->stdWrap($tag,$cfg['callRecursive.']['tagStdWrap.']);
03920                         }
03921                         $parts[$k]=$tag.$parts[$k].'</'.$tagName.'>';
03922                      }
03923                   }
03924                } elseif($cfg['HTMLtableCells']) {
03925                   $rowParts = $htmlParser->splitIntoBlock('tr',$parts[$k]);
03926                   reset($rowParts);
03927                   while(list($kk,$vv)=each($rowParts))   {
03928                      if ($kk%2)  {
03929                         $colParts = $htmlParser->splitIntoBlock('td',$vv);
03930                         reset($colParts);
03931                         $cc=0;
03932                         while(list($kkk,$vvv)=each($colParts)) {
03933                            if ($kkk%2) {
03934                               $cc++;
03935                               $tag=$htmlParser->getFirstTag($vvv);
03936                               $tagName=strtolower($htmlParser->getFirstTagName($vvv));
03937                               $colParts[$kkk] = $htmlParser->removeFirstAndLastTag($vvv);
03938 
03939                               if ($cfg['HTMLtableCells.'][$cc.'.']['callRecursive'] || (!isset($cfg['HTMLtableCells.'][$cc.'.']['callRecursive']) && $cfg['HTMLtableCells.']['default.']['callRecursive'])) {
03940                                  if ($cfg['HTMLtableCells.']['addChr10BetweenParagraphs'])   $colParts[$kkk]=str_replace('</p><p>','</p>'.chr(10).'<p>',$colParts[$kkk]);
03941                                  $colParts[$kkk] = $this->parseFunc($colParts[$kkk], $conf);
03942                               }
03943 
03944                               $tagStdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.']:$cfg['HTMLtableCells.']['default.']['tagStdWrap.'];
03945                               if (is_array($tagStdWrap)) {
03946                                  $tag = $this->stdWrap($tag,$tagStdWrap);
03947                               }
03948 
03949                               $stdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['stdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['stdWrap.']:$cfg['HTMLtableCells.']['default.']['stdWrap.'];
03950                               if (is_array($stdWrap)) {
03951                                  $colParts[$kkk] = $this->stdWrap($colParts[$kkk],$stdWrap);
03952                               }
03953 
03954                               $colParts[$kkk]=$tag.$colParts[$kkk].'</'.$tagName.'>';
03955                            }
03956                         }
03957                         $rowParts[$kk] = implode('',$colParts);
03958                      }
03959                   }
03960                   $parts[$k] = implode('',$rowParts);
03961                }
03962 
03963                if (is_array($cfg['stdWrap.']))  {
03964                   $parts[$k] = $this->stdWrap($parts[$k],$cfg['stdWrap.']);
03965                }
03966             } else {
03967                $parts[$k]=$this->_parseFunc($parts[$k], $conf);
03968             }
03969          }
03970 
03971          return implode('',$parts);
03972       } else return $this->_parseFunc($theValue, $conf);
03973    }
03974 
03984    function _parseFunc ($theValue, $conf) {
03985       if (!$this->checkIf($conf['if.']))  {
03986          return $theValue;
03987       }
03988       $inside=0;  // Indicates that the data is from within a tag.
03989       $pointer=0; // Pointer to the total string position
03990       $currentTag='';   // Loaded with the current typo-tag if any.
03991       $stripNL=0;
03992       $contentAccum=array();
03993       $contentAccumP=0;
03994 
03995       $allowTags=strtolower(str_replace(' ','',$conf['allowTags']));
03996       $denyTags=strtolower(str_replace(' ','',$conf['denyTags']));
03997 
03998       $totalLen = strlen($theValue);
03999       do {
04000          if (!$inside)  {
04001             if (!is_array($currentTag))   {        // These operations should only be performed on code outside the typotags...
04002                   // data: this checks that we enter tags ONLY if the first char in the tag is alphanumeric OR '/'
04003                $len_p=0;
04004                $c=100;
04005                do    {
04006                   $len = strcspn(substr($theValue,$pointer+$len_p),'<');
04007                   $len_p+=$len+1;
04008                   $endChar = ord(strtolower(substr($theValue,$pointer+$len_p,1)));
04009                   $c--;
04010                } while ($c>0 && $endChar && ($endChar<97 || $endChar>122) && $endChar!=47);
04011                $len = $len_p-1;
04012             } else {
04013                   // If we're inside a currentTag, just take it to the end of that tag!
04014                $tempContent = strtolower(substr($theValue,$pointer));
04015                $len = strpos ($tempContent, '</'.$currentTag[0]);
04016                if (is_string ($len) && !$len) {
04017                   $len = strlen($tempContent);
04018                }
04019             }
04020 
04021             $data = substr($theValue,$pointer,$len);  // $data is the content until the next <tag-start or end is detected. In case of a currentTag set, this would mean all data between the start- and end-tags
04022             if ($data!='') {
04023                if ($stripNL)  {     // If the previous tag was set to strip NewLines in the beginning of the next data-chunk.
04024                   $data = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $data);
04025                }
04026 
04027                if (!is_array($currentTag))   {        // These operations should only be performed on code outside the tags...
04028                      // Constants
04029                   if ($conf['constants'] && is_array($GLOBALS['TSFE']->tmpl->setup['constants.'])) {
04030                      reset($GLOBALS['TSFE']->tmpl->setup['constants.']);
04031                      while(list($key,$val)=each($GLOBALS['TSFE']->tmpl->setup['constants.']))   {
04032                         if (is_string($val)) {
04033                            $data = str_replace('###'.$key.'###', $val, $data);
04034                         }
04035                      }
04036                   }
04037                      // Short
04038                   if (is_array($conf['short.']))   {
04039                      $shortWords = $conf['short.'];
04040                      krsort($shortWords);
04041                      reset($shortWords);
04042                      while(list($key,$val)=each($shortWords))  {
04043                         if (is_string($val)) {
04044                            $data = str_replace($key, $val, $data);
04045                         }
04046                      }
04047                   }
04048 
04049                      // stdWrap
04050                   if (is_array($conf['plainTextStdWrap.'])) {$data = $this->stdWrap($data,$conf['plainTextStdWrap.']);}
04051                      // userFunc
04052                   if ($conf['userFunc'])  {$data = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'], $data);}
04053 
04054                      // Makelinks: (Before search-words as we need the links to be generated when searchwords go on...!)
04055                   if ($conf['makelinks']) {
04056                      $data = $this->http_makelinks($data,$conf['makelinks.']['http.']);
04057                      $data = $this->mailto_makelinks($data,$conf['makelinks.']['mailto.']);
04058                   }
04059 
04060                      // Search Words:
04061                   if ($GLOBALS['TSFE']->no_cache && $conf['sword'] && is_array($GLOBALS['TSFE']->sWordList) && $GLOBALS['TSFE']->sWordRegEx) {
04062                      $newstring = '';
04063                      do {
04064                         $pieces = split($GLOBALS['TSFE']->sWordRegEx,$data,2);
04065                         $newstring.=$pieces[0];
04066                         $match_len = strlen($data)-(strlen($pieces[0])+strlen($pieces[1]));
04067                         if (strstr($pieces[0],'<') || strstr($pieces[0],'>')) {
04068                            $inTag = strrpos($pieces[0],'<') > strrpos($pieces[0],'>');    // Returns true, if a '<' is closer to the string-end than '>'. This is the case if we're INSIDE a tag (that could have been made by makelinks...) and we must secure, that the inside of a tag is not marked up.
04069                         }
04070                            // The searchword:
04071                         $match = substr($data,strlen($pieces[0]),$match_len);
04072 
04073                         if (trim($match) && strlen($match)>1 && !$inTag)   {
04074                            $match = $this->wrap($match, $conf['sword']);
04075                         }
04076                            // Concatenate the Search Word again.
04077                         $newstring.= $match;
04078                         $data=$pieces[1];
04079                      } while ($pieces[1]);
04080                      $data = $newstring;
04081                   }
04082                }
04083                $contentAccum[$contentAccumP].=$data;
04084             }
04085             $inside = 1;
04086          } else {
04087                // tags
04088             $len = strcspn(substr($theValue,$pointer),'>')+1;
04089             $data = substr($theValue,$pointer,$len);
04090 
04091             $tag = explode(' ',trim(substr($data,1,-1)),2);
04092             $tag[0]=strtolower($tag[0]);
04093             if (substr($tag[0],0,1)=='/') {
04094                $tag[0]=substr($tag[0],1);
04095                $tag['out']=1;
04096             }
04097             if($conf['tags.'][$tag[0]])   {
04098                $treated=0;
04099                $stripNL = 0;
04100                   // in-tag
04101                if (!$currentTag && !$tag['out'])   {
04102                   $currentTag = $tag;     // $currentTag er lig med det tag (array!), man er igang med!
04103                   $contentAccumP++;
04104                   $treated=1;
04105                }
04106                   // out-tag
04107                if ($currentTag[0]==$tag[0] && $tag['out'])  {
04108                   $theName = $conf['tags.'][$tag[0]];
04109                   $theConf = $conf['tags.'][$tag[0].'.'];
04110                   $stripNL = ($theConf['stripNL'] ? 1 : 0); // This flag indicates, that NL- (13-10-chars) should be stripped first and last.
04111                   $breakOut = ($theConf['breakoutTypoTagContent'] ? 1 : 0);   // This flag indicates, that this TypoTag section should NOT be included in the nonTypoTag content.
04112 
04113                   $this->parameters=Array();
04114                   if ($currentTag[1])  {
04115                      $params=t3lib_div::get_tag_attributes($currentTag[1]);
04116                      if (is_array($params))  {
04117                         reset($params);
04118                         while(list($option,$val)=each($params))   {
04119                            $this->parameters[strtolower($option)]=$val;
04120                         }
04121                      }
04122                   }
04123                   $this->parameters['allParams']=trim($currentTag[1]);
04124                   if ($stripNL)  {  // Removes NL in the beginning and end of the tag-content AND at the end of the currentTagBuffer. $stripNL depends on the configuration of the current tag
04125                      $contentAccum[$contentAccumP-1] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP-1]);
04126                      $contentAccum[$contentAccumP] = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $contentAccum[$contentAccumP]);
04127                      $contentAccum[$contentAccumP] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP]);
04128                   }
04129                   $this->data[$this->currentValKey] = $contentAccum[$contentAccumP];
04130                   $newInput=$this->cObjGetSingle($theName,$theConf,'/parseFunc/.tags.'.$tag[0]);   // fetch the content object
04131 
04132                   $contentAccum[$contentAccumP]=$newInput;
04133                   $contentAccumP++;
04134 
04135                      // If the TypoTag section
04136                   if (!$breakOut)   {
04137                      $contentAccum[$contentAccumP-2].=$contentAccum[$contentAccumP-1].$contentAccum[$contentAccumP];
04138                      unset($contentAccum[$contentAccumP]);
04139                      unset($contentAccum[$contentAccumP-1]);
04140                      $contentAccumP-=2;
04141                   }
04142 
04143                   unset($currentTag);
04144                   $treated=1;
04145                }
04146                   // other tags...
04147                if (!$treated) {
04148                   $contentAccum[$contentAccumP].=$data;
04149                }
04150             } else {
04151                   // If a tag was not a typo tag, then it is just added to the content
04152                $stripNL = 0;
04153                if (t3lib_div::inList($allowTags,$tag[0]) || ($denyTags!='*' && !t3lib_div::inList($denyTags,$tag[0])))  {
04154                   $contentAccum[$contentAccumP].=$data;
04155                } else {
04156                   $contentAccum[$contentAccumP].=HTMLSpecialChars($data);
04157                }
04158             }
04159             $inside = 0;
04160          }
04161          $pointer+=$len;
04162       } while($pointer<$totalLen);
04163 
04164          // Parsing nonTypoTag content (all even keys):
04165       reset($contentAccum);
04166       for ($a=0;$a<count($contentAccum);$a++)   {
04167          if ($a%2 != 1) {
04168                // stdWrap
04169             if (is_array($conf['nonTypoTagStdWrap.']))   {$contentAccum[$a] = $this->stdWrap($contentAccum[$a],$conf['nonTypoTagStdWrap.']);}
04170                // userFunc
04171             if ($conf['nonTypoTagUserFunc']) {$contentAccum[$a] = $this->callUserFunction($conf['nonTypoTagUserFunc'], $conf['nonTypoTagUserFunc.'], $contentAccum[$a]);}
04172          }
04173       }
04174       return implode('',$contentAccum);
04175    }
04176 
04186    function encaps_lineSplit($theValue, $conf)  {
04187       $lParts = explode(chr(10),$theValue);
04188 
04189       $encapTags = t3lib_div::trimExplode(',',strtolower($conf['encapsTagList']),1);
04190       $nonWrappedTag = $conf['nonWrappedTag'];
04191       $defaultAlign=trim($this->stdWrap($conf['defaultAlign'],$conf['defaultAlign.']));
04192 
04193       if (!strcmp('',$theValue)) return '';
04194 
04195       while(list($k,$l)=each($lParts)) {
04196          $sameBeginEnd=0;
04197          $l=trim($l);
04198          $attrib=array();
04199          $nWrapped=0;
04200          $byPass=0;
04201          if (substr($l,0,1)=='<' && substr($l,-1)=='>')  {
04202             $fwParts = explode('>',substr($l,1),2);
04203             $backParts = t3lib_div::revExplode('<', substr($fwParts[1],0,-1), 2);
04204             $attrib = t3lib_div::get_tag_attributes('<'.$fwParts[0].'>');
04205             list($tagName) = explode(' ',$fwParts[0]);
04206             $str_content = $backParts[0];
04207             $sameBeginEnd = (substr(strtolower($backParts[1]),1,strlen($tagName))==strtolower($tagName));
04208          }
04209 
04210          if ($sameBeginEnd && in_array(strtolower($tagName),$encapTags))   {
04211             $uTagName = strtoupper($tagName);
04212             $uTagName = strtoupper($conf['remapTag.'][$uTagName]?$conf['remapTag.'][$uTagName]:$uTagName);
04213          } else {
04214             $uTagName = strtoupper($nonWrappedTag);
04215             $str_content = $lParts[$k];
04216             $nWrapped=1;
04217             $attrib=array();
04218          }
04219 
04220             // Wrapping all inner-content:
04221          if (is_array($conf['innerStdWrap_all.'])) {$str_content = $this->stdWrap($str_content,$conf['innerStdWrap_all.']);}
04222 
04223          if ($uTagName) {
04224                // Setting common attributes
04225             if (is_array($conf['addAttributes.'][$uTagName.'.'])) {
04226                reset($conf['addAttributes.'][$uTagName.'.']);
04227                while(list($kk,$vv)=each($conf['addAttributes.'][$uTagName.'.'])) {
04228                   if (!is_array($vv))  {
04229                      if ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='blank') {
04230                         if (!strcmp($attrib[$kk],'')) $attrib[$kk]=$vv;
04231                      } elseif ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='exists')   {
04232                         if (!isset($attrib[$kk]))  $attrib[$kk]=$vv;
04233                      } else {
04234                         $attrib[$kk]=$vv;
04235                      }
04236                   }
04237                }
04238             }
04239                // Wrapping all inner-content:
04240             if (is_array($conf['encapsLinesStdWrap.'][$uTagName.'.']))  {$str_content = $this->stdWrap($str_content,$conf['encapsLinesStdWrap.'][$uTagName.'.']);}
04241                // Default align
04242             if (!$attrib['align'] && $defaultAlign)   $attrib['align']=$defaultAlign;
04243 
04244             $params = t3lib_div::implodeAttributes($attrib,1);
04245             if ($conf['removeWrapping'])  {
04246                $str_content=$str_content;
04247             } else {
04248                $str_content='<'.strtolower($uTagName).(trim($params)?' '.trim($params):'').'>'.$str_content.'</'.strtolower($uTagName).'>';
04249             }
04250          }
04251 
04252          if ($nWrapped && $conf['wrapNonWrappedLines'])  {$str_content = $this->wrap($str_content,$conf['wrapNonWrappedLines']);}
04253          $lParts[$k] = $str_content;
04254       }
04255 
04256       return implode(chr(10),$lParts);
04257    }
04258 
04269    function http_makelinks($data,$conf)   {
04270       $aTagParams = $GLOBALS['TSFE']->ATagParams.($conf['ATagParams']?' '.$conf['ATagParams']:'');
04271       $textpieces = explode('http://', $data);
04272       $pieces = count($textpieces);
04273       $textstr = $textpieces[0];
04274       $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04275       for($i=1; $i<$pieces; $i++)   {
04276          $len=strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04277          if (trim(substr($textstr,-1))=='' && $len)   {
04278 
04279             $lastChar=substr($textpieces[$i],$len-1,1);
04280             if (!ereg('[A-Za-z0-9\/#_-]',$lastChar)) {$len--;}    // Included '\/' 3/12
04281 
04282             $parts[0]=substr($textpieces[$i],0,$len);
04283             $parts[1]=substr($textpieces[$i],$len);
04284 
04285             $keep=$conf['keep'];
04286             $linkParts=parse_url('http://'.$parts[0]);
04287             $linktxt='';
04288             if (strstr($keep,'scheme'))   {
04289                $linktxt='http://';
04290             }
04291             $linktxt.= $linkParts['host'];
04292             if (strstr($keep,'path'))  {
04293                $linktxt.= $linkParts['path'];
04294                if (strstr($keep,'query') && $linkParts['query'])  {     // added $linkParts['query'] 3/12
04295                   $linktxt.= '?'.$linkParts['query'];
04296                } elseif ($linkParts['path']=='/')  {  // If query is NOT added and the path is '/' then remove the slash ('/')   (added 3/12)
04297                   $linktxt=substr($linktxt,0,-1);
04298                }
04299             }
04300             $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
04301             if ($GLOBALS['TSFE']->config['config']['jumpurl_enable'])   {
04302                $res = '<a'.
04303                      ' href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.
04304                      ($target ? ' target="'.$target.'"' : '').
04305                      $aTagParams.
04306                      '>';
04307             } else {
04308                $res = '<a'.
04309                      ' href="http://'.htmlspecialchars($parts[0]).'"'.
04310                      ($target ? ' target="'.$target.'"' : '').
04311                      $aTagParams.
04312                      '>';
04313             }
04314             if ($conf['ATagBeforeWrap'])  {
04315                $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04316             } else {
04317                $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04318             }
04319             $textstr.=$res.$parts[1];
04320          } else {
04321             $textstr.='http://'.$textpieces[$i];
04322          }
04323       }
04324       return $textstr;
04325    }
04326 
04336    function mailto_makelinks($data,$conf) {
04337       // http-split
04338       $aTagParams = $GLOBALS['TSFE']->ATagParams.($conf['ATagParams']?' '.$conf['ATagParams']:'');
04339       $textpieces = explode('mailto:', $data);
04340       $pieces = count($textpieces);
04341       $textstr = $textpieces[0];
04342       $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04343       for($i=1; $i<$pieces; $i++)   {
04344          $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04345          if (trim(substr($textstr,-1))=='' && $len)   {
04346             $lastChar = substr($textpieces[$i],$len-1,1);
04347             if (!ereg('[A-Za-z0-9]',$lastChar)) {$len--;}
04348 
04349             $parts[0] = substr($textpieces[$i],0,$len);
04350             $parts[1] = substr($textpieces[$i],$len);
04351             $linktxt = ereg_replace('\?.*','',$parts[0]);
04352             if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
04353                if ($GLOBALS['TSFE']->spamProtectEmailAddresses)   {
04354                   $mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail('mailto:'.$parts[0])."');";
04355                   $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
04356                   $linktxt = str_replace('@',$atLabel ? $atLabel : '(at)', $linktxt);
04357                } else {
04358                   $mailToUrl = 'mailto:'.$parts[0];
04359                }
04360                $res = '<a href="'.htmlspecialchars($mailToUrl).'"'.$aTagParams.'>';
04361             } else {
04362                $res = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('mailto:'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.$aTagParams.'>';
04363             }
04364             if ($conf['ATagBeforeWrap'])  {
04365                $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04366             } else {
04367                $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04368             }
04369             $textstr.=$res.$parts[1];
04370          } else {
04371             $textstr.='mailto:'.$textpieces[$i];
04372          }
04373       }
04374       return $textstr;
04375    }
04376 
04388    function getImgResource($file,$fileArray) {
04389       if (is_array($fileArray))  {
04390          switch($file)  {
04391             case 'GIFBUILDER':
04392                $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04393                $gifCreator->init();
04394                $theImage='';
04395                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'])   {
04396                   $gifCreator->start($fileArray,$this->data);
04397                   $theImage = $gifCreator->gifBuild();
04398                }
04399                return $gifCreator->getImageDimensions($theImage);
04400             break;
04401             default:
04402                if ($fileArray['import.']) {
04403                   $ifile = $this->stdWrap('',$fileArray['import.']);
04404                   if ($ifile) {$file = $fileArray['import'].$ifile;}
04405                }
04406                $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04407                if ($theImage) {
04408                   $fileArray['width']= $this->stdWrap($fileArray['width'],$fileArray['width.']);
04409                   $fileArray['height']= $this->stdWrap($fileArray['height'],$fileArray['height.']);
04410                   $fileArray['ext']= $this->stdWrap($fileArray['ext'],$fileArray['ext.']);
04411                   $fileArray['maxW']= intval($this->stdWrap($fileArray['maxW'],$fileArray['maxW.']));
04412                   $fileArray['maxH']= intval($this->stdWrap($fileArray['maxH'],$fileArray['maxH.']));
04413                   $fileArray['minW']= intval($fileArray['minW']);
04414                   $fileArray['minH']= intval($fileArray['minH']);
04415                   $maskArray= $fileArray['m.'];
04416                   $maskImages=array();
04417                   if (is_array($fileArray['m.']))  {  // Must render mask images and include in hash-calculating - else we cannot be sure the filename is unique for the setup!
04418                      $maskImages['m_mask'] = $this->getImgResource($maskArray['mask'],$maskArray['mask.']);
04419                      $maskImages['m_bgImg'] = $this->getImgResource($maskArray['bgImg'],$maskArray['bgImg.']);
04420                      $maskImages['m_bottomImg'] = $this->getImgResource($maskArray['bottomImg'],$maskArray['bottomImg.']);
04421                      $maskImages['m_bottomImg_mask'] = $this->getImgResource($maskArray['bottomImg_mask'],$maskArray['bottomImg_mask.']);
04422                   }
04423                   $hash = t3lib_div::shortMD5($theImage.serialize($fileArray).serialize($maskImages));
04424                   if (!isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
04425                      $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04426                      $gifCreator->init();
04427                      if ($fileArray['sample'])  {
04428                         $gifCreator->scalecmd = '-sample';
04429                         $GLOBALS['TT']->setTSlogMessage('Sample option: Images are scaled with -sample.');
04430                      }
04431                      if ($fileArray['alternativeTempPath'] && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['allowedTempPaths'],$fileArray['alternativeTempPath']))  {
04432                         $gifCreator->tempPath = $fileArray['alternativeTempPath'];
04433                         $GLOBALS['TT']->setTSlogMessage('Set alternativeTempPath: '.$fileArray['alternativeTempPath']);
04434                      }
04435 
04436                      if (!trim($fileArray['ext'])){$fileArray['ext']='web';}
04437                      $options = Array();
04438                      if ($fileArray['maxW']) {$options['maxW']=$fileArray['maxW'];}
04439                      if ($fileArray['maxH']) {$options['maxH']=$fileArray['maxH'];}
04440                      if ($fileArray['minW']) {$options['minW']=$fileArray['minW'];}
04441                      if ($fileArray['minH']) {$options['minH']=$fileArray['minH'];}
04442 
04443                         // checks to see if m (the mask array) is defined
04444                      if (is_array($maskArray) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'])   {
04445                            // Filename:
04446                         $fI = t3lib_div::split_fileref($theImage);
04447                         $dest = $gifCreator->tempPath.$hash.'.'.($fI['fileext']==$gifCreator->gifExtension ? $gifCreator->gifExtension : 'jpg');
04448                         if (!@file_exists($dest))  {     // Generate!
04449                            $m_mask= $maskImages['m_mask'];
04450                            $m_bgImg = $maskImages['m_bgImg'];
04451                            if ($m_mask && $m_bgImg)   {
04452                               $negate = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] ? ' -negate' : '';
04453 
04454                               $temp_ext='png';
04455                               if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif'])   {     // If ImageMagick version 5+
04456                                  $temp_ext=$gifCreator->gifExtension;
04457                               }
04458 
04459                               $tempFileInfo = $gifCreator->imageMagickConvert($theImage,$temp_ext,$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04460                               if (is_array($tempFileInfo))  {
04461                                  $m_bottomImg = $maskImages['m_bottomImg'];
04462                                  if ($m_bottomImg) {
04463                                     $m_bottomImg_mask = $maskImages['m_bottomImg_mask'];
04464                                  }
04465                                     // Scaling: ****
04466                                  $tempScale=array();
04467                                  $command = '-geometry '.$tempFileInfo[0].'x'.$tempFileInfo[1].'!';
04468                                  $tmpStr = $gifCreator->randomName();
04469 
04470                                     // m_mask
04471                                  $tempScale['m_mask']=$tmpStr.'_mask.'.$temp_ext;
04472                                  $gifCreator->imageMagickExec($m_mask[3],$tempScale['m_mask'],$command.$negate);
04473                                     // m_bgImg
04474                                  $tempScale['m_bgImg']=$tmpStr.'_bgImg.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
04475                                  $gifCreator->imageMagickExec($m_bgImg[3],$tempScale['m_bgImg'],$command);
04476 
04477                                     // m_bottomImg / m_bottomImg_mask
04478                                  if ($m_bottomImg && $m_bottomImg_mask) {
04479                                     $tempScale['m_bottomImg']=$tmpStr.'_bottomImg.'.$temp_ext;
04480                                     $gifCreator->imageMagickExec($m_bottomImg[3],$tempScale['m_bottomImg'],$command);
04481                                     $tempScale['m_bottomImg_mask']=$tmpStr.'_bottomImg_mask.'.$temp_ext;
04482                                     $gifCreator->imageMagickExec($m_bottomImg_mask[3],$tempScale['m_bottomImg_mask'],$command.$negate);
04483 
04484                                        // BEGIN combining:
04485                                        // The image onto the background
04486                                     $gifCreator->combineExec($tempScale['m_bgImg'],$tempScale['m_bottomImg'],$tempScale['m_bottomImg_mask'],$tempScale['m_bgImg']);
04487                                  }
04488                                     // The image onto the background
04489                                  $gifCreator->combineExec($tempScale['m_bgImg'],$tempFileInfo[3],$tempScale['m_mask'],$dest);
04490                                     // Unlink the temp-images...
04491                                  reset($tempScale);
04492                                  while(list(,$file)=each($tempScale))   {
04493                                     if (@is_file($file)) {
04494                                        unlink($file);
04495                                     }
04496                                  }
04497                                     // t3lib_div::print_array($GLOBALS['TSFE']->tmpl->fileCache[$hash]);
04498                               }
04499                            }
04500                         }
04501                            // Finish off
04502                         $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->getImageDimensions($dest);
04503                      } else {    // Normal situation:
04504                         $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->imageMagickConvert($theImage,$fileArray['ext'],$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04505                      }
04506                      $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile'] = $theImage;
04507                      $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile_mtime'] = @filemtime($theImage); // This is needed by tslib_gifbuilder, ln 100ff in order for the setup-array to create a unique filename hash.
04508                   }
04509                   return $GLOBALS['TSFE']->tmpl->fileCache[$hash];
04510                }
04511 
04512             break;
04513          }
04514       }
04515       $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04516       if ($theImage) {
04517          $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04518          $gifCreator->init();
04519          $info= $gifCreator->imageMagickConvert($theImage,'WEB','','','','','');
04520          $info['origFile'] = $theImage;
04521          $info['origFile_mtime'] = @filemtime($theImage);   // This is needed by tslib_gifbuilder, ln 100ff in order for the setup-array to create a unique filename hash.
04522          return $info;
04523       }
04524    }
04525 
04526 
04527 
04528 
04529 
04530 
04531 
04532 
04533 
04534 
04535 
04536 
04537 
04538 
04539 
04540 
04541 
04542 
04543 
04544 
04545 
04546 
04547    /***********************************************
04548     *
04549     * Data retrieval etc.
04550     *
04551     ***********************************************/
04552 
04553 
04560    function getFieldVal($field)  {
04561       if (!strstr($field,'//'))  {
04562          return $this->data[trim($field)];
04563       } else {
04564          $sections = t3lib_div::trimExplode('//',$field,1);
04565          while (list(,$k)=each($sections)) {
04566             if (strcmp($this->data[$k],''))  return $this->data[$k];
04567          }
04568       }
04569    }

rootLineValue key,
field,
slideBack = 0,
altRootLine = ''
 

Returns a value from the current rootline (site) from $GLOBALS['TSFE']->tmpl->rootLine;.

Parameters:
string Which level in the root line
string The field in the rootline record to return (a field from the pages table)
boolean If set, then we will traverse through the rootline from outer level towards the root level until the value found is true
mixed If you supply an array for this it will be used as an alternative root line array
Returns:
string The value from the field of the rootline. private
See also:
getData()

Definition at line 4707 of file class.tslib_content.php.

References $a, and $val.

04707                                                                      {
04708       $rootLine = is_array($altRootLine) ? $altRootLine : $GLOBALS['TSFE']->tmpl->rootLine;
04709       if (!$slideBack)  {
04710          return $rootLine[$key][$field];
04711       } else {
04712          for ($a=$key;$a>=0;$a--)   {
04713             $val = $rootLine[$a][$field];
04714             if ($val)   {return $val;}
04715          }
04716       }
04717    }

SEARCHRESULT conf  ) 
 

Rendering the cObject, SEARCHRESULT.

Parameters:
array Array of TypoScript properties
Returns:
string Output &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=368&cHash=d00731cd7b

Definition at line 1963 of file class.tslib_content.php.

References $content, $key, $LD, $val, tslib_cObj::cObjGetSingle(), getKey(), and stdWrap().

Referenced by tslib_cObj::cObjGetSingle().

01963                                  {
01964       if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols'))  {
01965          $search = t3lib_div::makeInstance('tslib_search');
01966          $search->register_and_explode_search_string(t3lib_div::_GP('sword'));
01967          $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']);
01968             // depth
01969          $depth=100;
01970             // the startId is found
01971          $theStartId=0;
01972          if (t3lib_div::testInt(t3lib_div::_GP('stype')))   {
01973             $temp_theStartId=t3lib_div::_GP('stype');
01974             $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
01975                // The page MUST have a rootline with the Level0-page of the current site inside!!
01976             while(list(,$val)=each($rootLine))  {
01977                if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
01978                   $theStartId=$temp_theStartId;
01979                }
01980             }
01981          } else if (t3lib_div::_GP('stype')) {
01982             if (substr(t3lib_div::_GP('stype'),0,1)=='L')   {
01983                $pointer = intval(substr(t3lib_div::_GP('stype'),1));
01984                $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine;
01985                   // location Data:
01986                $locDat_arr = explode(':',t3lib_div::_POST('locationData'));
01987                $pId = intval($locDat_arr[0]);
01988                if ($pId)   {
01989                   $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
01990                   ksort($altRootLine);
01991                   if (count($altRootLine))   {
01992                         // check if the rootline has the real Level0 in it!!
01993                      reset($altRootLine);
01994                      $hitRoot=0;
01995                      $theNewRoot=array();
01996                      while(list(,$val)=each($altRootLine))  {
01997                         if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
01998                            $hitRoot=1;
01999                            $theNewRoot[]=$val;
02000                         }
02001                      }
02002                      if ($hitRoot)  {
02003                         $theRootLine = $theNewRoot;      // Override the real rootline if any thing
02004                      }
02005                   }
02006                }
02007                $key = $this->getKey($pointer,$theRootLine);
02008                $theStartId = $theRootLine[$key]['uid'];
02009             }
02010          }
02011          if (!$theStartId) {
02012                // If not set, we use current page
02013             $theStartId = $GLOBALS['TSFE']->id;
02014          }
02015             // generate page-tree
02016          $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth);
02017 
02018          $endClause = 'pages.uid IN ('.$search->pageIdList.')
02019             AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').')
02020             AND pages.no_search=0'.
02021             $this->enableFields($search->fTable).
02022             $this->enableFields('pages');
02023 
02024          if ($conf['languageField.'][$search->fTable])   {
02025             $endClause.= ' AND '.$search->fTable.'.'.$conf['languageField.'][$search->fTable].' = '.intval($GLOBALS['TSFE']->sys_language_uid); // (using sys_language_uid which is the ACTUAL language of the page. sys_language_content is only for selecting DISPLAY content!)
02026          }
02027 
02028             // build query
02029          $search->build_search_query($endClause);
02030 
02031             // count...
02032          if (t3lib_div::testInt(t3lib_div::_GP('scount')))  {
02033             $search->res_count = t3lib_div::_GP('scount');
02034          } else {
02035             $search->count_query();
02036          }
02037 
02038             // range
02039          $spointer = intval(t3lib_div::_GP('spointer'));
02040          if (isset($conf['range'])) {
02041             $theRange = intval($conf['range']);
02042          } else {
02043             $theRange = 20;
02044          }
02045 
02046             // Order By:
02047          if (!$conf['noOrderBy'])   {
02048             $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
02049          }
02050 
02051          $search->queryParts['LIMIT'] = $spointer.','.$theRange;
02052 
02053             // search...
02054          $search->execute_query();
02055          if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) {
02056             $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords();
02057 
02058             $total = $search->res_count;
02059             $rangeLow = t3lib_div::intInRange($spointer+1,1,$total);
02060             $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total);
02061                // prev/next url:
02062             $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']));
02063             $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : '';
02064             $urlParams = $this->URLqMark($LD['totalURL'],
02065                   '&sword='.rawurlencode(t3lib_div::_GP('sword')).
02066                   '&scols='.rawurlencode(t3lib_div::_GP('scols')).
02067                   '&stype='.rawurlencode(t3lib_div::_GP('stype')).
02068                   '&scount='.$total);
02069                // substitution:
02070             $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
02071             $result = str_replace('###RANGELOW###',$rangeLow,$result);
02072             $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
02073             $result = str_replace('###TOTAL###',$total,$result);
02074 
02075             if ($rangeHigh<$total)  {
02076                $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
02077                $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$next.'</a>';
02078             } else $next='';
02079             $result = str_replace('###NEXT###',$next,$result);
02080 
02081             if ($rangeLow>1)  {
02082                $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
02083                $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$prev.'</a>';
02084             } else $prev='';
02085             $result = str_replace('###PREV###',$prev,$result);
02086 
02087                // searching result
02088             $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
02089             $cObj = t3lib_div::makeInstance('tslib_cObj');
02090             $cObj->setParent($this->data,$this->currentRecord);
02091             $renderCode='';
02092             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result))   {
02093                $cObj->start($row);
02094                $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
02095             }
02096             $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
02097             $theValue = str_replace('###RESULT###',$theValue,$result);
02098          } else {
02099             $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
02100          }
02101 
02102          $GLOBALS['TT']->setTSlogMessage('Search in fields:   '.$search->listOfSearchFields);
02103 
02104             // wrapping
02105          $content=$theValue;
02106          if ($conf['wrap']) {
02107             $content=$this->wrap($content, $conf['wrap']);
02108          }
02109          if ($conf['stdWrap.']) {
02110             $content=$this->stdWrap($content, $conf['stdWrap.']);
02111          }
02112             // returning
02113          $GLOBALS['TSFE']->set_no_cache();
02114          return $content;
02115       }
02116    }

stdWrap content,
conf
 

The "stdWrap" function.

This is the implementation of what is known as "stdWrap properties" in TypoScript. Basically "stdWrap" performs some processing of a value based on properties in the input $conf array (holding the TypoScript "stdWrap properties") See the link below for a complete list of properties and what they do. The order of the table with properties found in TSref (the link) follows the actual order of implementation in this function.

If $this->alternativeData is an array it's used instead of the $this->data array in ->getData

Parameters:
string Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
array TypoScript "stdWrap properties".
Returns:
string The processed input value &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=314&cHash=02ab044c7b

Definition at line 2979 of file class.tslib_content.php.

References $content, checkIf(), tslib_cObj::cObjGetSingle(), crop(), dataWrap(), debug(), filelist(), getData(), HTMLparser_TSbridge(), insertData(), listNum(), numRows(), prefixComment(), removeBadHTML(), stdWrap(), and substring().

Referenced by tslib_cObj::CASEFUNC(), tslib_cObj::CLEARGIF(), tslib_cObj::COBJ_ARRAY(), tslib_cObj::COLUMNS(), tslib_cObj::CONTENT(), tslib_cObj::FORM(), tslib_cObj::HMENU(), tslib_cObj::HRULER(), tslib_cObj::HTML(), tslib_cObj::IMAGE(), imageLinkWrap(), tslib_cObj::IMG_RESOURCE(), tslib_cObj::IMGTEXT(), tslib_cObj::LOAD_REGISTER(), MULTIMEDIA(), netprintApplication_offsiteLinkWrap(), SC_wizard_tsconfig::printTable(), tslib_cObj::RECORDS(), TSpagegen::renderContent(), SEARCHRESULT(), stdWrap(), tslib_cObj::TEXT(), typoLink(), and tslib_tmenu::writeMenu().

02979                                     {
02980       if (is_array($conf)) {
02981 
02982             // Setting current value, if so
02983          if ($conf['setContentToCurrent']){$this->data[$this->currentValKey]=$content;}
02984          if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
02985 
02986             // Getting data:
02987          if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
02988             $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
02989          }
02990          if ($conf['data']){$content=$this->getData($conf['data'], is_array($this->alternativeData)?$this->alternativeData:$this->data);}
02991             $this->alternativeData='';    // This must be unset directly after
02992          if ($conf['field']) {$content=$this->getFieldVal($conf['field']);}
02993          if ($conf['current']) {$content=$this->data[$this->currentValKey];}
02994          if ($conf['cObject']) {$content=$this->cObjGetSingle($conf['cObject'],$conf['cObject.'],'/stdWrap/.cObject');}
02995          if ($conf['numRows.']) {$content=$this->numRows($conf['numRows.']);}
02996          if ($conf['filelist'] || $conf['filelist.']) {$content=$this->filelist($this->stdWrap($conf['filelist'], $conf['filelist.']));}
02997          if ($conf['preUserFunc'])  {$content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);}
02998 
02999             // Overriding values, evaluating conditions
03000          if ($conf['override'] || $conf['override.']){
03001             $override = $this->stdWrap($conf['override'], $conf['override.']);
03002             if (trim($override)) {$content=$override;}
03003          }
03004          if (isset($conf['preIfEmptyListNum']) || isset($conf['preIfEmptyListNum.']['stdWrap.'])) {
03005             $preIfEmptyListNumber = isset($conf['preIfEmptyListNum.']['stdWrap.'])  ?  $this->stdWrap($conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['stdWrap.'])  :  $conf['preIfEmptyListNum'];
03006             $content=$this->listNum($content,$preIfEmptyListNumber,$conf['preIfEmptyListNum.']['splitChar']);
03007          }
03008          if (!trim($content) && ($conf['ifEmpty'] || $conf['ifEmpty.'])){ $content = $this->stdWrap($conf['ifEmpty'], $conf['ifEmpty.']);}
03009 
03010 
03011             // values...
03012          if (isset($conf['listNum']) || isset($conf['listNum.']['stdWrap.'])) {
03013             $listNumber = isset($conf['listNum.']['stdWrap.'])  ?  $this->stdWrap($conf['listNum'], $conf['listNum.']['stdWrap.'])  :  $conf['listNum'];
03014             $content=$this->listNum($content,$listNumber,$conf['listNum.']['splitChar']);
03015          }
03016 
03017          if ($conf['trim']){$content=trim($content);}
03018          if (   ($conf['required'] && (string)$content=='') || ($conf['if.'] && !$this->checkIf($conf['if.'])) || ($conf['fieldRequired'] && !trim($this->data[$conf['fieldRequired']]))    ){
03019             $content = '';
03020          } else {
03021                // Perform data processing:
03022             if ($conf['csConv']) { $content=$GLOBALS['TSFE']->csConv($content,$conf['csConv']); }
03023             if ($conf['parseFunc.'] || $conf['parseFunc']) {$content=$this->parseFunc($content,$conf['parseFunc.'],$conf['parseFunc']);}
03024             if ($conf['HTMLparser'] && is_array($conf['HTMLparser.'])) {$content=$this->HTMLparser_TSbridge($content,$conf['HTMLparser.']);}
03025             if ($conf['split.']){$content=$this->splitObj($content,$conf['split.']);}
03026             if ($conf['prioriCalc']){$content=t3lib_div::calcParenthesis($content); if ($conf['prioriCalc']=='intval') $content=intval($content);}
03027             if ((string)$conf['char']!=''){$content=chr(intval($conf['char']));}
03028             if ($conf['intval']){$content=intval($content);}
03029             if ($conf['date']){$content=date($conf['date'], $content);}
03030             if ($conf['strftime']){
03031                $content = strftime($conf['strftime'], $content);
03032                $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
03033                if ($tmp_charset) {
03034                   $content = $GLOBALS['TSFE']->csConv($content,$tmp_charset);
03035                }
03036             }
03037             if ($conf['age']){$content=$this->calcAge(time()-$content,$conf['age']);}
03038 
03039             if ($conf['case']){$content=$this->HTMLcaseshift($content, $conf['case']);}
03040             if ($conf['bytes']){$content=$this->bytes($content,$conf['bytes.']['labels']);}
03041             if ($conf['substring']){$content=$this->substring($content,$conf['substring']);}
03042             if ($conf['removeBadHTML'])   {$content = $this->removeBadHTML($content, $conf['removeBadHTML.']);}
03043             if ($conf['stripHtml']){$content = strip_tags($content);}
03044             if ($conf['crop']){$content=$this->crop($content, $conf['crop']);}
03045             if ($conf['rawUrlEncode']){$content = rawurlencode($content);}
03046             if ($conf['htmlSpecialChars']){
03047                $content=htmlSpecialChars($content);
03048                if ($conf['htmlSpecialChars.']['preserveEntities'])   $content = t3lib_div::deHSCentities($content);
03049             }
03050 
03051             if ($conf['doubleBrTag']) {
03052                $content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
03053             }
03054             if ($conf['br']) {$content=nl2br($content);}
03055             if ($conf['brTag']) {$content= ereg_replace(chr(10),$conf['brTag'],$content);}
03056             if ($conf['encapsLines.']) {$content=$this->encaps_lineSplit($content,$conf['encapsLines.']);}
03057             if ($conf['keywords']) {$content= $this->keywords($content);}
03058             if ($conf['innerWrap'] || $conf['innerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.']));}
03059             if ($conf['innerWrap2'] || $conf['innerWrap2.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap2'], $conf['innerWrap2.']));}
03060             if ($conf['fontTag']){$content=$this->wrap($content, $conf['fontTag']);}
03061             if ($conf['addParams.']) {$content=$this->addParams($content,$conf['addParams.']);}
03062             if ($conf['textStyle.']) {$content=$this->textStyle($content,$conf['textStyle.']);}
03063             if ($conf['tableStyle.']) {$content=$this->tableStyle($content,$conf['tableStyle.']);}
03064             if ($conf['filelink.']) {$content=$this->filelink($content,$conf['filelink.']);}
03065             if ($conf['preCObject']) {$content=$this->cObjGetSingle($conf['preCObject'],$conf['preCObject.'],'/stdWrap/.preCObject').$content;}
03066             if ($conf['postCObject']) {$content.=$this->cObjGetSingle($conf['postCObject'],$conf['postCObject.'],'/stdWrap/.postCObject');}
03067 
03068             if ($conf['wrapAlign'] || $conf['wrapAlign.']){
03069                $wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.']));
03070                if ($wrapAlign)   {$content=$this->wrap($content, '<div align="'.$wrapAlign.'">|</div>');}
03071             }
03072             if ($conf['typolink.']){$content=$this->typolink($content, $conf['typolink.']);}
03073 
03074                // Spacing
03075             if ($conf['space']){$content=$this->wrapSpace($content, $conf['space']);}
03076             $spaceBefore = '';
03077             if ($conf['spaceBefore'] || $conf['spaceBefore.']) {$spaceBefore = trim($this->stdWrap($conf['spaceBefore'], $conf['spaceBefore.']));}
03078             $spaceAfter = '';
03079             if ($conf['spaceAfter'] || $conf['spaceAfter.'])   {$spaceAfter = trim($this->stdWrap($conf['spaceAfter'], $conf['spaceAfter.']));}
03080             if ($spaceBefore || $spaceAfter) {$content=$this->wrapSpace($content, $spaceBefore.'|'.$spaceAfter);}
03081 
03082                // Wraps
03083             if ($conf['wrap']){$content=$this->wrap($content, $conf['wrap'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03084             if ($conf['noTrimWrap']){$content=$this->noTrimWrap($content, $conf['noTrimWrap']);}
03085             if ($conf['wrap2']){$content=$this->wrap($content, $conf['wrap2'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03086             if ($conf['dataWrap']){$content=$this->dataWrap($content, $conf['dataWrap']);}
03087             if ($conf['prepend']){$content=$this->cObjGetSingle($conf['prepend'],$conf['prepend.'],'/stdWrap/.prepend').$content;}
03088             if ($conf['append']){$content.=$this->cObjGetSingle($conf['append'],$conf['append.'],'/stdWrap/.append');}
03089             if ($conf['wrap3']){$content=$this->wrap($content, $conf['wrap3'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03090             if ($conf['outerWrap'] || $conf['outerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['outerWrap'], $conf['outerWrap.']));}
03091             if ($conf['insertData'])   {$content = $this->insertData($content);}
03092             if ($conf['offsetWrap']){
03093                $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
03094                if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {$controlTable->tableParams = $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.']);}
03095                if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {$controlTable->tdParams = ' '.$this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.']);}
03096                $content=$controlTable->start($content,$conf['offsetWrap']);
03097                if ($conf['offsetWrap.']['stdWrap.'])  {  $content=$this->stdWrap($content,$conf['offsetWrap.']['stdWrap.']);  }
03098             }
03099             if ($conf['postUserFunc']) {$content = $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $content);}
03100             if ($conf['postUserFuncInt']) {
03101                $substKey = 'INT_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
03102                $GLOBALS['TSFE']->config['INTincScript'][$substKey] = array(
03103                   'content' => $content,
03104                   'postUserFunc' => $conf['postUserFuncInt'],
03105                   'conf' => $conf['postUserFuncInt.'],
03106                   'type' => 'POSTUSERFUNC',
03107                   'cObj' => serialize($this),
03108                );
03109                $content ='<!--'.$substKey.'-->';
03110             }
03111                // Various:
03112             if ($conf['prefixComment'] && !$GLOBALS['TSFE']->config['config']['disablePrefixComment'])   {$content = $this->prefixComment($conf['prefixComment'], $conf['prefixComment.'], $content);}
03113 
03114             if ($conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editIcons($content,$conf['editIcons'],$conf['editIcons.']);}
03115             if ($conf['editPanel'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editPanel($content, $conf['editPanel.']);}
03116          }
03117 
03118             //Debug:
03119          if ($conf['debug'])  {$content = '<pre>'.htmlspecialchars($content).'</pre>';}
03120          if ($conf['debugFunc']) {debug($conf['debugFunc']==2?array($content):$content);}
03121          if ($conf['debugData']) {
03122             echo '<b>$cObj->data:</b>';
03123             debug($this->data,'$cObj->data:');
03124             if (is_array($this->alternativeData))  {
03125                echo '<b>$cObj->alternativeData:</b>';
03126                debug($this->alternativeData,'$this->alternativeData');
03127             }
03128          }
03129       }
03130       return $content;
03131    }

substituteMarker content,
marker,
markContent
 

Substitutes a marker string in the input content (by a simple str_replace()).

Parameters:
string The content stream, typically HTML template content.
string The marker string, typically on the form "###[the marker string]###"
mixed The content to insert instead of the marker string found.
Returns:
string The processed HTML content string.
See also:
substituteSubpart()

Definition at line 2754 of file class.tslib_content.php.

02754                                                             {
02755       return str_replace($marker,$markContent,$content);
02756    }

substituteMarkerArray content,
markContentArray,
wrap = '',
uppercase = 0
 

Traverses the input $markContentArray array and for each key the marker by the same name (possibly wrapped and in upper case) will be substituted with the keys value in the array.

This is very useful if you have a data-record to substitute in some content. In particular when you use the $wrap and $uppercase values to pre-process the markers. Eg. a key name like "myfield" could effectively be represented by the marker "###MYFIELD###" if the wrap value was "###|###" and the $uppercase boolean true.

Parameters:
string The content stream, typically HTML template content.
array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content stream with the content.
string A wrap value - [part 1] | [part 2] - for the markers before substitution
boolean If set, all marker string substitution is done with upper-case markers.
Returns:
string The processed output stream
See also:
substituteMarker(), substituteMarkerInObject(), TEMPLATE()

Definition at line 2872 of file class.tslib_content.php.

References $content.

Referenced by substituteMarkerArrayCached(), substituteMarkerInObject(), and TEMPLATE().

02872                                                                                     {
02873       if (is_array($markContentArray)) {
02874          reset($markContentArray);
02875          $wrapArr=t3lib_div::trimExplode('|',$wrap);
02876          while(list($marker,$markContent)=each($markContentArray))   {
02877             if($uppercase) $marker=strtoupper($marker);
02878             if(strcmp($wrap,''))    $marker=$wrapArr[0].$marker.$wrapArr[1];
02879             $content=str_replace($marker,$markContent,$content);
02880          }
02881       }
02882       return $content;
02883    }

substituteMarkerArrayCached content,
markContentArray = array(),
subpartContentArray = array(),
wrappedSubpartContentArray = array()
 

Multi substitution function with caching.

This function should be a one-stop substitution function for working with HTML-template. It does not substitute by str_replace but by splitting. This secures that the value inserted does not themselves contain markers or subparts. This function takes three kinds of substitutions in one: $markContentArray is a regular marker-array where the 'keys' are substituted in $content with their values $subpartContentArray works exactly like markContentArray only is whole subparts substituted and not only a single marker. $wrappedSubpartContentArray is an array of arrays with 0/1 keys where the subparts pointed to by the main key is wrapped with the 0/1 value alternating.

Parameters:
string The content stream, typically HTML template content.
array Regular marker-array where the 'keys' are substituted in $content with their values
array Exactly like markContentArray only is whole subparts substituted and not only a single marker.
array An array of arrays with 0/1 keys where the subparts pointed to by the main key is wrapped with the 0/1 value alternating.
Returns:
string The output content stream
See also:
substituteSubpart(), substituteMarker(), substituteMarkerInObject(), TEMPLATE()

Definition at line 2774 of file class.tslib_content.php.

References $content, substituteMarkerArray(), and substituteSubpart().

Referenced by TEMPLATE().

02774                                                                                                                                              {
02775       $GLOBALS['TT']->push('/substituteMarkerArray/');
02776 
02777          // If not arrays then set them
02778       if (!is_array($markContentArray))   $markContentArray=array(); // Plain markers
02779       if (!is_array($subpartContentArray))   $subpartContentArray=array(); // Subparts being directly substituted
02780       if (!is_array($wrappedSubpartContentArray))  $wrappedSubpartContentArray=array();   // Subparts being wrapped
02781          // Finding keys and check hash:
02782       $sPkeys = array_keys($subpartContentArray);
02783       $wPkeys = array_keys($wrappedSubpartContentArray);
02784       $aKeys = array_merge(array_keys($markContentArray),$sPkeys,$wPkeys);
02785       if (!count($aKeys))  {
02786          $GLOBALS['TT']->pull();
02787          return $content;
02788       }
02789       asort($aKeys);
02790       $storeKey = md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content,$aKeys)));
02791       if ($this->substMarkerCache[$storeKey])   {
02792          $storeArr = $this->substMarkerCache[$storeKey];
02793          $GLOBALS['TT']->setTSlogMessage('Cached',0);
02794       } else {
02795          $storeArrDat = $GLOBALS['TSFE']->sys_page->getHash($storeKey,0);
02796          if (!isset($storeArrDat))  {
02797                // Initialize storeArr
02798             $storeArr=array();
02799 
02800                // Finding subparts and substituting them with the subpart as a marker
02801             reset($sPkeys);
02802             while(list(,$sPK)=each($sPkeys)) {
02803                $content =$this->substituteSubpart($content,$sPK,$sPK);
02804             }
02805 
02806                // Finding subparts and wrapping them with markers
02807             reset($wPkeys);
02808             while(list(,$wPK)=each($wPkeys)) {
02809                $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK));
02810             }
02811 
02812                // traverse keys and quote them for reg ex.
02813             reset($aKeys);
02814             while(list($tK,$tV)=each($aKeys))   {
02815                $aKeys[$tK]=quotemeta($tV);
02816             }
02817             $regex = implode('|',$aKeys);
02818                // Doing regex's
02819             $storeArr['c'] = split($regex,$content);
02820             preg_match_all('/'.$regex.'/',$content,$keyList);
02821             $storeArr['k']=$keyList[0];
02822                // Setting cache:
02823             $this->substMarkerCache[$storeKey] = $storeArr;
02824 
02825                // Storing the cached data:
02826             $GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
02827 
02828             $GLOBALS['TT']->setTSlogMessage('Parsing',0);
02829          } else {
02830                // Unserializing
02831             $storeArr = unserialize($storeArrDat);
02832                // Setting cache:
02833             $this->substMarkerCache[$storeKey] = $storeArr;
02834             $GLOBALS['TT']->setTSlogMessage('Cached from DB',0);
02835          }
02836       }
02837 
02838          // Substitution/Merging:
02839          // Merging content types together, resetting
02840       $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
02841 
02842       $wSCA_reg=array();
02843       reset($storeArr['k']);
02844       $content = '';
02845          // traversin the keyList array and merging the static and dynamic content
02846       while(list($n,$keyN)=each($storeArr['k']))   {
02847          $content.=$storeArr['c'][$n];
02848          if (!is_array($valueArr[$keyN])) {
02849             $content.=$valueArr[$keyN];
02850          } else {
02851             $content.=$valueArr[$keyN][(intval($wSCA_reg[$keyN])%2)];
02852             $wSCA_reg[$keyN]++;
02853          }
02854       }
02855       $content.=$storeArr['c'][count($storeArr['k'])];
02856 
02857       $GLOBALS['TT']->pull();
02858       return $content;
02859    }

substituteMarkerInObject &$  tree,
markContentArray
 

Substitute marker array in an array of values.

Parameters:
mixed If string, then it just calls substituteMarkerArray. If array (and even multi-dim) then for each key/value pair the marker array will be substituted (by calling this function recursively)
array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content string/array values.
Returns:
mixed The processed input variable.
See also:
substituteMarker()

Definition at line 2893 of file class.tslib_content.php.

References substituteMarkerArray().

02893                                                                 {
02894       if (is_array ($tree))   {
02895          reset($tree);
02896          while(list($key,$value)=each($tree))   {
02897             $this->substituteMarkerInObject ($tree[$key], $markContentArray);
02898          }
02899       } else {
02900          $tree = $this->substituteMarkerArray($tree,$markContentArray);
02901       }
02902       return $tree;
02903    }

substituteSubpart content,
marker,
subpartContent,
recursive = 1
 

Substitute subpart in input template stream.

This function substitutes a subpart in $content with the content of $subpartContent.

Parameters:
string The content stream, typically HTML template content.
string The marker string, typically on the form "###[the marker string]###"
mixed The content to insert instead of the subpart found. If a string, then just plain substitution happens (includes removing the HTML comments of the subpart if found). If $subpartContent happens to be an array, it's [0] and [1] elements are wrapped around the EXISTING content of the subpart (fetched by getSubpart()) thereby not removing the original content.
boolean If $recursive is set, the function calls itself with the content set to the remaining part of the content after the second marker. This means that proceding subparts are ALSO substituted!
Returns:
string The processed HTML content string.
See also:
getSubpart(), t3lib_parsehtml::substituteSubpart()

Definition at line 2712 of file class.tslib_content.php.

Referenced by substituteMarkerArrayCached(), and TEMPLATE().

02712                                                                               {
02713       $start = strpos($content, $marker);
02714       $stop = @strpos($content, $marker, $start+1)+strlen($marker);
02715       if ($start && $stop>$start)   {
02716             // code before
02717          $before = substr($content, 0, $start);
02718          $reg=Array();
02719          ereg('<!--[^>]*$',$before,$reg);
02720          $start-=strlen($reg[0]);
02721          $before = substr($content, 0, $start);
02722             // code after
02723          $after = substr($content, $stop);
02724          $reg=Array();
02725          ereg('^[^<]*-->',$after,$reg);
02726          $stop+=strlen($reg[0]);
02727          $after = substr($content, $stop);
02728             // replace?
02729          if (is_array($subpartContent))   {
02730             $substContent=$subpartContent[0].$this->getSubpart($content,$marker).$subpartContent[1];
02731          } else {
02732             $substContent=$subpartContent;
02733          }
02734 
02735          if ($recursive && strpos($after, $marker))   {
02736             return $before.$substContent.$this->substituteSubpart($after,$marker,$subpartContent);
02737          } else {
02738             return $before.$substContent.$after;
02739          }
02740       } else {
02741          return $content;
02742       }
02743    }

substring content,
options
 

Implements the stdWrap property "substring" which is basically a TypoScript implementation of the PHP function, substr().

Parameters:
string The string to perform the operation on
string The parameters to substring, given as a comma list of integers where the first and second number is passed as arg 1 and 2 to substr().
Returns:
string The processed input value. private
See also:
stdWrap()

Definition at line 3426 of file class.tslib_content.php.

Referenced by stdWrap().

03426                                           {
03427       $options = t3lib_div::intExplode(',',$options.',');
03428       if ($options[1])  {
03429          return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0],$options[1]);
03430       } else {
03431          return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0]);
03432       }
03433    }

TEMPLATE conf  ) 
 

Rendering the cObject, TEMPLATE.

Parameters:
array Array of TypoScript properties
Returns:
string Output &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=373&cHash=109a171b1e substituteMarkerArrayCached()

Definition at line 2171 of file class.tslib_content.php.

References $content, tslib_cObj::cObjGetSingle(), getSubpart(), tslib_cObj::setCurrentVal(), substituteMarkerArray(), substituteMarkerArrayCached(), and substituteSubpart().

Referenced by tslib_cObj::cObjGetSingle().

02171                               {
02172       $subparts = Array();
02173       $marks = Array();
02174       $wraps = Array();
02175       $content='';
02176 
02177       list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###');
02178       $POST = trim($POST);
02179       $PRE  = trim($PRE);
02180 
02181          // Getting the content
02182       $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
02183       if ($conf['workOnSubpart'])   {
02184          $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
02185       }
02186 
02187          // Fixing all relative paths found:
02188       if ($conf['relPathPrefix'])   {
02189          $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
02190          $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
02191       }
02192 
02193       if ($content)  {
02194          if ($conf['nonCachedSubst'])  {     // NON-CACHED:
02195                // Getting marks
02196             if (is_array($conf['marks.']))   {
02197                reset($conf['marks.']);
02198                while(list($theKey,$theValue)=each($conf['marks.']))  {
02199                   if (!strstr($theKey,'.'))  {
02200                      $content = str_replace(
02201                         $PRE.$theKey.$POST,
02202                         $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
02203                         $content);
02204                   }
02205                }
02206             }
02207 
02208                // Getting subparts.
02209             if (is_array($conf['subparts.']))   {
02210                reset($conf['subparts.']);
02211                while(list($theKey,$theValue)=each($conf['subparts.']))  {
02212                   if (!strstr($theKey,'.'))  {
02213                      $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02214                      if ($subpart)  {
02215                         $this->setCurrentVal($subpart);
02216                         $content = $this->substituteSubpart(
02217                            $content,
02218                            $PRE.$theKey.$POST,
02219                            $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
02220                            1
02221                         );
02222                      }
02223                   }
02224                }
02225             }
02226                // Getting subpart wraps
02227             if (is_array($conf['wraps.']))   {
02228                reset($conf['wraps.']);
02229                while(list($theKey,$theValue)=each($conf['wraps.']))  {
02230                   if (!strstr($theKey,'.'))  {
02231                      $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02232                      if ($subpart)  {
02233                         $this->setCurrentVal($subpart);
02234                         $content = $this->substituteSubpart(
02235                            $content,
02236                            $PRE.$theKey.$POST,
02237                            explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
02238                            1
02239                         );
02240                      }
02241                   }
02242                }
02243             }
02244          } else { // CACHED
02245                // Getting subparts.
02246             if (is_array($conf['subparts.']))   {
02247                reset($conf['subparts.']);
02248                while(list($theKey,$theValue)=each($conf['subparts.']))  {
02249                   if (!strstr($theKey,'.'))  {
02250                      $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02251                      if ($subpart)  {
02252                         $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
02253                         $subparts[$theKey]['name'] = $theValue;
02254                         $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
02255                      }
02256                   }
02257                }
02258             }
02259                // Getting marks
02260             if (is_array($conf['marks.']))   {
02261                reset($conf['marks.']);
02262                while(list($theKey,$theValue)=each($conf['marks.']))  {
02263                   if (!strstr($theKey,'.'))  {
02264                      $marks[$theKey]['name'] = $theValue;
02265                      $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
02266                   }
02267                }
02268             }
02269                // Getting subpart wraps
02270             if (is_array($conf['wraps.']))   {
02271                reset($conf['wraps.']);
02272                while(list($theKey,$theValue)=each($conf['wraps.']))  {
02273                   if (!strstr($theKey,'.'))  {
02274                      $wraps[$theKey]['name'] = $theValue;
02275                      $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
02276                   }
02277                }
02278             }
02279                // Getting subparts
02280             $subpartArray =array();
02281             reset($subparts);
02282             while(list($theKey,$theValue)=each($subparts))  {
02283                   // Set current with the content of the subpart...
02284                $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
02285                   // Get subpart cObject and substitute it!
02286                $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
02287             }
02288             $this->data[$this->currentValKey] = '';   // Reset current to empty
02289 
02290                // Getting marks
02291             $markerArray =array();
02292             reset($marks);
02293             while(list($theKey,$theValue)=each($marks))  {
02294                $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
02295             }
02296                // Getting wraps
02297             $subpartWraps =array();
02298             reset($wraps);
02299             while(list($theKey,$theValue)=each($wraps))  {
02300                $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
02301             }
02302 
02303                // Substitution
02304             if ($conf['substMarksSeparately'])  {
02305                $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
02306                $content = $this->substituteMarkerArray($content, $markerArray);
02307             } else {
02308                $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
02309             }
02310          }
02311       }
02312       return $content;
02313    }

typoLink linktxt,
conf
 

Implements the "typolink" property of stdWrap (and others) Basically the input string, $linktext, is (typically) wrapped in a -tag linking to some page, email address, file or URL based on a parameter defined by the configuration array $conf.

This function is best used from internal functions as is. There are some API functions defined after this function which is more suited for general usage in external applications. Generally the concept "typolink" should be used in your own applications as an API for making links to pages with parameters and more. The reason for this is that you will then automatically make links compatible with all the centralized functions for URL simulation and manipulation of parameters into hashes and more. For many more details on the parameters and how they are intepreted, please see the link to TSref below.

Parameters:
string The string (text) to link
array TypoScript configuration (see link below)
Returns:
string A link-wrapped string.
See also:
stdWrap(), tslib_pibase::pi_linkTP() &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=321&cHash=59bd727a5e Based on the input "TypoLink" TypoScript configuration this will return the generated URL ' typoLink() array TypoScript properties for "typolink" string The URL of the link-tag that typolink() would by itself return Returns a linked string made from typoLink parameters. This function takes $label as a string, wraps it in a link-tag based on the $params string, which should contain data like that you would normally pass to the popular -tag in the TSFE. Optionally you can supply $urlParameters which is an array with key/value pairs that are rawurlencoded and appended to the resulting url. string Text string being wrapped by the link. string Link parameter; eg. "123" for page id, "kasperYYYY@typo3.com" for email address, "http://...." for URL, "fileadmin/blabla.txt" for file. array An array with key/value pairs representing URL parameters to set. Values NOT URL-encoded yet. string Specific target set, if any. (Default is using the current) string The wrapped $label-text string getTypoLink_URL() Returns the URL of a "typolink" create from the input parameter string, url-parameters and target string Link parameter; eg. "123" for page id, "kasperYYYY@typo3.com" for email address, "http://...." for URL, "fileadmin/blabla.txt" for file. array An array with key/value pairs representing URL parameters to set. Values NOT URL-encoded yet. string Specific target set, if any. (Default is using the current) string The URL getTypoLink() Generates a typolink and returns the two link tags - start and stop - in an array array "typolink" TypoScript properties array An array with two values in key 0+1, each value being the start and close -tag of the typolink properties being inputted in $conf typolink() Returns the current page URL array Optionally you can specify additional URL parameters. An array with key/value pairs representing URL parameters to set. Values NOT URL-encoded yet. integer An alternative ID to the current id ($GLOBALS['TSFE']->id) string The URL getTypoLink_URL() Returns the &MP variable value for a page id. The function will do its best to find a MP value that will keep the page id inside the current Mount Point rootline if any. integer page id boolean If true, the MPvalue is returned raw. Normally it is encoded as &MP=... variable string MP value, prefixed with &MP= (depending on $raw) typolink() Wrapping a string. Implements the TypoScript "wrap" property. Example: $content = "HELLO WORLD" and $wrap = "<b> | </b>", result: "<b>HELLO WORLD</b>" string The content to wrap string The wrap value, eg. "<b> | </b>" string The char used to split the wrapping value, default is "|" string Wrapped input string noTrimWrap() Wrapping a string, preserving whitespace in wrap value. Notice that the wrap value uses part 1/2 to wrap (and not 0/1 which wrap() does) string The content to wrap, eg. "HELLO WORLD" string The wrap value, eg. " | <b> | </b>" string Wrapped input string, eg. " <b> HELLO WORD </b>" wrap() Adds space above/below the input HTML string. It is done by adding a clear-gif and <br /> tag before and/or after the content. string The content to add space above/below to. string A value like "10 | 20" where the first part denotes the space BEFORE and the second part denotes the space AFTER (in pixels) string Wrapped string Calling a user function/class-method Notice: For classes the instantiated object will have the internal variable, $cObj, set to be a *reference* to $this (the parent/calling object). string The functionname, eg "user_myfunction" or "user_myclass->main". Notice that there are rules for the names of functions/classes you can instantiate. If a function cannot be called for some reason it will be seen in the TypoScript log in the AdminPanel. array The TypoScript configuration to pass the function string The content string to pass the function string The return content from the function call. Should probably be a string. USER(), stdWrap(), typoLink(), _parseFunc() Parses a set of text lines with "[parameters] = [values]" into an array with parameters as keys containing the value If lines are empty or begins with "/" or "#" then they are ignored. string Text which the parameters array Array with the parameters as key/value pairs Cleans up a string of keywords. Keywords at splitted by "," (comma) ";" (semi colon) and linebreak string String of keywords string Cleaned up string, keywords will be separated by a comma only. Changing character case of a string, converting typically used western charset characters as well. string The string to change case for. string The direction; either "upper" or "lower" string HTMLcaseshift() Shifts the case of characters outside of HTML tags in the input string string The string to change case for. string The direction; either "upper" or "lower" string caseshift() Formats a number to GB, Mb or Kb or just bytes integer Number of bytes to format. string Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value) string t3lib_div::formatSize(), stdWrap() Use t3lib_div::formatSize() instead Returns the 'age' of the tstamp $seconds integer Seconds to return age for. Example: "70" => "1 min", "3601" => "1 hrs" string $labels are the labels of the individual units. Defaults to : ' min| hrs| days| yrs' string The formatted string

Definition at line 4806 of file class.tslib_content.php.

References $content, $key, $LD, $out, $page, $pid, PATH_site, processParams(), section(), stdWrap(), and table().


Variable Documentation

$action = $LD_A['totalURL']
 

Definition at line 1892 of file class.tslib_content.php.

$content
 

Initial value:

 Array(
         '<form'.
            ' action="'.htmlspecialchars($action).'"'.
            ' name="'.$formname.'"'.
            ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
            ' method="'.($conf['method']?$conf['method']:'post').'"'.
            ($theTarget ? ' target="'.$theTarget.'"' : '').
            $validateForm.
            '>',
         $hiddenfields.$content,
         '</form>'
      )

Definition at line 1935 of file class.tslib_content.php.

Referenced by t3lib_formmail::addAttachment(), t3lib_htmlmail::addPlain(), t3lib_extMgm::addTypoScript(), alterPasswordForm(), SC_mod_tools_em_index::alterSettings(), tslib_cObj::CASEFUNC(), t3lib_superadmin::changeAdminPasswordsForm(), tx_install::checkPassword(), tx_install::checkTheDatabase(), tx_install::cleanupManager(), tslib_cObj::COBJ_ARRAY(), tslib_cObj::cObjGet(), tslib_cObj::cObjGetSingle(), tslib_cObj::COLUMNS(), crop(), t3lib_tsStyleConfig::ext_getForm(), SC_mod_tools_em_index::extBackup(), SC_mod_tools_em_index::extDelete(), SC_mod_tools_em_index::extensionList_import(), SC_mod_tools_em_index::extensionList_installed(), SC_mod_tools_em_index::extensionList_loaded(), SC_mod_tools_em_index::extUpdateEMCONF(), tslib_cObj::FORM(), SC_wizard_forms::formsWizard(), t3lib_extFileFunctions::func_edit(), tx_install::generateUpdateDatabaseForm(), getContextMenuCode(), getDynTabMenu(), SC_wizard_forms::getFormHTML(), SC_mod_tools_em_index::getRepositoryUploadForm(), t3lib_xml::getResult(), getSingleField_typeFlex_sheetMenu(), t3lib_htmlmail::getStrippedURL(), tx_cms_layout::getTable_tt_content(), getTabMenu(), getTabMenuRaw(), t3lib_htmlmail::getURL(), tslib_cObj::HMENU(), tslib_cObj::HRULER(), tslib_cObj::IMAGE(), imageLinkWrap(), tslib_cObj::IMGTEXT(), SC_mod_tools_em_index::importExtFromRep(), SC_mod_tools_em_index::importExtInfo(), tx_install::init(), t3lib_superadmin::initProcess(), insertStylesAndJS(), SC_wizard_colorpicker::main(), tx_funcwizards_webfunc::main(), localFolderTree::SC_browse_links::main_db(), localFolderTree::SC_browse_links::main_file(), localFolderTree::SC_browse_links::main_rte(), t3lib_superadmin::make(), SC_mod_tools_em_index::makeDetailedExtensionAnalysis(), SC_index::makeLoginForm(), SC_index::makeLogoutForm(), MULTIMEDIA(), t3lib_TCEmain::newFieldArray(), PHP_SCRIPT(), tslib_pibase::pi_getEditIcon(), prefixComment(), t3lib_TCEmain::printLogErrorMessages(), t3lib_extFileFunctions::printLogErrorMessages(), formRender::printPalette(), transferData::regItem(), user_various::reverseString(), t3lib_superadmin::rmCachedFiles(), SEARCHRESULT(), t3lib_superadmin::setNewPasswords(), SC_alt_doc::shortCutLink(), SC_mod_tools_em_index::showExtDetails(), t3lib_superadmin::singleSite(), stdWrap(), tx_install::stepOutput(), t3lib_htmlmail::substHTTPurlsInPlainText(), substituteMarkerArray(), substituteMarkerArrayCached(), SC_wizard_table::tableWizard(), TEMPLATE(), tslib_fe::tidyHTML(), tx_install::typo3TempManager(), typoLink(), tslib_cObj::USER(), user_reverseString(), tx_cms_layout::wordWrapper(), and SC_index::wrapLoginForm().

$formname = $GLOBALS['TSFE']->uniqueHash()
 

Definition at line 1927 of file class.tslib_content.php.

$hiddenfields = '<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />'
 

Definition at line 1921 of file class.tslib_content.php.

Referenced by tslib_cObj::FORM().

$LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']))
 

Definition at line 1871 of file class.tslib_content.php.

Referenced by tslib_menu::link(), tslib_imgmenu::makeImageMap(), SEARCHRESULT(), and typoLink().

$LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']))
 

Definition at line 1882 of file class.tslib_content.php.

$page = $GLOBALS['TSFE']->page
 

Definition at line 1866 of file class.tslib_content.php.

Referenced by tslib_fe::getPageShortcut(), t3lib_parsehtml_proc::TS_links_rte(), and typoLink().

$theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.'])
 

Definition at line 1896 of file class.tslib_content.php.

$theRedirect = $this->stdWrap($conf['redirect'], $conf['redirect.'])
 

Definition at line 1865 of file class.tslib_content.php.

$theTarget = ($theRedirect?$LD['target']:$LD_A['target'])
 

Definition at line 1934 of file class.tslib_content.php.

Referenced by t3lib_extFileFunctions::func_edit(), t3lib_extFileFunctions::func_newfile(), t3lib_extFileFunctions::func_newfolder(), t3lib_extFileFunctions::func_rename(), and t3lib_extFileFunctions::func_upload().

else $validateForm = ''
 

Definition at line 1931 of file class.tslib_content.php.

$GLOBALS ['TSFE'] additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>'
 

Definition at line 1930 of file class.tslib_content.php.

Referenced by tslib_fe::INTincScript(), tslib_fe::INTincScript_loadJSCode(), and TSpagegen::renderContentWithHeader().


Generated on Sun Oct 3 01:06:17 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913