Fixed bug #12230: Function tslib_cObj::crop() is not fully multibyte safe (Thanks...
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_content.php
index 1d21afa..68535ab 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  * Copyright notice
  *
- * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
+ * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
  * All rights reserved
  *
  * This script is part of the TYPO3 project. The TYPO3 project is
  * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
  */
 class tslib_cObj {
 
@@ -582,7 +581,7 @@ class tslib_cObj {
 
                                if (!($hookObject instanceof tslib_content_stdWrapHook)) {
                                        throw new UnexpectedValueException(
-                                               '$hookObject must implement interface tslib_content_stdWrapHook',
+                                               $classData . ' must implement interface tslib_content_stdWrapHook',
                                                1195043965
                                        );
                                }
@@ -597,7 +596,7 @@ class tslib_cObj {
 
                                if (!($postInitializationProcessor instanceof tslib_content_PostInitHook)) {
                                        throw new UnexpectedValueException(
-                                               '$postInitializationProcessor must implement interface tslib_content_PostInitHook',
+                                               $classData . ' must implement interface tslib_content_PostInitHook',
                                                1274563549
                                        );
                                }
@@ -729,7 +728,6 @@ class tslib_cObj {
         * @param       array           The array with TypoScript properties for the content object
         * @param       string          A string label used for the internal debugging tracking.
         * @return      string          cObject output
-        * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
         */
        function cObjGetSingle($name, $conf, $TSkey = '__') {
                global $TYPO3_CONF_VARS;
@@ -836,6 +834,7 @@ class tslib_cObj {
                        'SEARCHRESULT' => 'SearchResult',
                        'PHP_SCRIPT' => 'PhpScript',
                        'PHP_SCRIPT_INT' => 'PhpScriptInternal',
+                       'PHP_SCRIPT_EXT' => 'PhpScriptExternal',
                        'TEMPLATE' => 'Template',
                        'FLUIDTEMPLATE' => 'FluidTemplate',
                        'MULTIMEDIA' => 'Multimedia',
@@ -1127,7 +1126,8 @@ class tslib_cObj {
         */
        function PHP_SCRIPT($conf, $ext = '') {
                if ($ext === 'INT' || $ext === 'EXT') {
-                       return $this->getContentObject('PHP_SCRIPT_INT')->render($conf, $ext);
+                       $conf['scriptSuffix'] = $ext;
+                       return $this->getContentObject('PHP_SCRIPT_INT')->render($conf);
                } else {
                        return $this->getContentObject('PHP_SCRIPT')->render($conf);
                }
@@ -1264,7 +1264,9 @@ class tslib_cObj {
         * @access private
         */
        function getSlidePids($pidList, $pidConf) {
-               $pidList = trim($this->stdWrap($pidList, $pidConf));
+               $pidList = isset($pidConf)
+                       ? trim($this->stdWrap($pidList, $pidConf))
+                       : trim($pidList);
                if (!strcmp($pidList, '')) {
                        $pidList = 'this';
                }
@@ -1335,31 +1337,47 @@ class tslib_cObj {
                        }
 
                        $altParam = $this->getAltParam($conf);
+                       if($conf['params'] && !isset($conf['params.'])) {
+                               $params = ' ' . $conf['params'];
+                       } else {
+                               $params = isset($conf['params.'])
+                                       ? ' ' . $this->stdWrap($conf['params'], $conf['params.'])
+                                       : '';
+                       }
                        $theValue = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix .
                                t3lib_div::rawUrlEncodeFP($info[3])) . '" width="' . $info[0] . '" height="' . $info[1] . '"' .
                                $this->getBorderAttr(' border="' . intval($conf['border']) . '"') .
-                               (($conf['params'] || is_array($conf['params.'])) ? ' ' . $this->stdWrap($conf['params'], $conf['params.']) : '') .
+                               $params .
                                ($altParam) . ' />';
-                       if ($conf['linkWrap']) {
-                               $theValue = $this->linkWrap($theValue, $conf['linkWrap']);
+                       $linkWrap = isset($conf['linkWrap.'])
+                               ? $this->stdWrap($conf['linkWrap'], $conf['linkWrap.'])
+                               : $conf['linkWrap'];
+                       if ($linkWrap) {
+                               $theValue = $this->linkWrap($theValue, $linkWrap);
                        } elseif ($conf['imageLinkWrap']) {
                                $theValue = $this->imageLinkWrap($theValue, $info['origFile'], $conf['imageLinkWrap.']);
                        }
-                       return $this->wrap($theValue, $conf['wrap']);
+                       $wrap = isset($conf['wrap.'])
+                               ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                               : $conf['wrap'];
+                       if($wrap) {
+                               $theValue = $this->wrap($theValue, $conf['wrap']);
+                       }
+                       return $theValue;
                }
        }
 
        /**
-        * Returns the 'border' attribute for an <img> tag only if the doctype is not xhtml_strict,xhtml_11 or xhtml_2
+        * Returns the 'border' attribute for an <img> tag only if the doctype is not xhtml_strict, xhtml_11, xhtml_2 or html5
         * or if the config parameter 'disableImgBorderAttr' is not set.
         *
         * @param       string          the border attribute
         * @return      string          the border attribute
         */
        function getBorderAttr($borderAttr) {
-               if (!t3lib_div::inList( 'xhtml_strict,xhtml_11,xhtml_2',
-                       $GLOBALS['TSFE']->xhtmlDoctype)
-                       && !$GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
+               if (! t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype) &&
+                               $GLOBALS['TSFE']->config['config']['doctype'] != 'html5' &&
+                               ! $GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
                        return $borderAttr;
                }
        }
@@ -1372,61 +1390,61 @@ class tslib_cObj {
         * @param       array           TypoScript properties for the "imageLinkWrap" function
         * @return      string          The input string, $string, wrapped as configured.
         * @see cImage()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=316&cHash=2848266da6
         */
        function imageLinkWrap($string, $imageFile, $conf) {
                $a1 = '';
                $a2 = '';
                $content = $string;
-               if ($this->stdWrap($conf['enable'], $conf['enable.'])) {
+               $enable = isset($conf['enable.'])
+                       ? $this->stdWrap($conf['enable'], $conf['enable.'])
+                       : $conf['enable'];
+               if ($enable) {
                        $content = $this->typolink($string, $conf['typolink.']);
-                       $imageFile = $this->stdWrap($imageFile, $conf['file.']);
+                       if(isset($conf['file.'])) {
+                               $imageFile = $this->stdWrap($imageFile, $conf['file.']);
+                       }
 
                                // imageFileLink:
                        if ($content == $string && @is_file($imageFile)) {
-                               $params = '';
-                               if ($conf['width']) {
-                                       $params .= '&width=' . rawurlencode($conf['width']);
-                               }
-                               if ($conf['height']) {
-                                       $params .= '&height=' . rawurlencode($conf['height']);
+                               $parameterNames = array('width', 'height', 'effects', 'alternativeTempPath', 'bodyTag', 'title', 'wrap');
+                               $parameters = array();
+
+                               $sample = isset($conf['sample.'])
+                                       ? $this->stdWrap($conf['sample'], $conf['sample.'])
+                                       : $conf['sample'];
+                               if ($sample) {
+                                       $parameters['sample'] = 1;
                                }
-                               if ($conf['effects']) {
-                                       $params .= '&effects=' . rawurlencode($conf['effects']);
-                               }
-                               if ($conf['sample']) {
-                                       $params .= '&sample=1';
+
+                               foreach ($parameterNames as $parameterName) {
+                                       if(isset($conf[$parameterName.'.'])) {
+                                               $conf[$parameterName] = $this->stdWrap($conf[$parameterName], $conf[$parameterName.'.']);
+                                       }
+                                       if (isset($conf[$parameterName]) && $conf[$parameterName]) {
+                                               $parameters[$parameterName] = $conf[$parameterName];
+                                       }
                                }
-                               if ($conf['alternativeTempPath']) {
-                                       $params .= '&alternativeTempPath=' . rawurlencode($conf['alternativeTempPath']);
+
+                               $parametersEncoded = base64_encode(serialize($parameters));
+
+                               $md5_value = t3lib_div::hmac(
+                                       implode(
+                                               '|',
+                                               array($imageFile, $parametersEncoded)
+                                       )
+                               );
+
+                               $params = '&md5=' . $md5_value;
+                               foreach (str_split($parametersEncoded, 64) as $index => $chunk) {
+                                       $params .= '&parameters[' . $index . ']=' . rawurlencode($chunk);
                                }
 
-                                       // includes lines above in cache
-                               $showPicContent = '
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-       <title>' . htmlspecialchars($conf['title'] ? $conf['title'] : 'Image') . '</title>
-       ' . ($conf['title'] ? '' : '<meta name="robots" content="noindex,follow" />') . '
-</head>
-               ' . ($conf['bodyTag'] ? $conf['bodyTag'] : '<body>');
-
-                               $wrapParts = explode('|', $conf['wrap']);
-                               $showPicContent .= trim($wrapParts[0]) . '###IMAGE###' . trim($wrapParts[1]);
-                               $showPicContent .= '
-               </body>
-               </html>';
-                               $contentHash = md5('showpic' . $showPicContent);
-                               t3lib_pageSelect::storeHash($contentHash, $showPicContent, 'showpic');
-
-                               $md5_value = md5($imageFile . '|' . $conf['width'] . '|' . $conf['height'] . '|' .
-                                       $conf['effects'] . '||||' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|');
-
-                               $params .= '&md5=' . $md5_value . '&contentHash=' . $contentHash;
                                $url = $GLOBALS['TSFE']->absRefPrefix . 'index.php?eID=tx_cms_showpic&file=' . rawurlencode($imageFile) . $params;
 
-                               if ($conf['directImageLink']) {
+                               $directImageLink = isset($conf['directImageLink.'])
+                                       ? $this->stdWrap($conf['directImageLink'], $conf['directImageLink.'])
+                                       : $conf['directImageLink'];
+                               if ($directImageLink) {
                                        $imgResourceConf = array(
                                                'file' => $imageFile,
                                                'file.' => $conf
@@ -1440,18 +1458,25 @@ class tslib_cObj {
 
                                        // Create TARGET-attribute only if the right doctype is used
                                if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
-                                       if (isset($conf['target'])) {
-                                               $target = sprintf(' target="%s"', $conf['target']);
+                                       $target = isset($conf['target.'])
+                                               ? $this-stdWrap($conf['target'], $conf['target.'])
+                                               : $conf['target'];
+                                       if(!$target) {
+                                               $target = sprintf(' target="%s"', $target);
                                        } else {
                                                $target = ' target="thePicture"';
                                        }
                                } else {
                                        $target = '';
                                }
-                               $conf['JSwindow'] = $this->stdWrap($conf['JSwindow'], $conf['JSwindow.']);
+                               $conf['JSwindow'] = isset($conf['JSwindow.'])
+                                       ? $this->stdWrap($conf['JSwindow'], $conf['JSwindow.'])
+                                       : $conf['JSwindow'];
                                if ($conf['JSwindow']) {
                                        if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.']) {
-                                               $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
+                                               $altUrl = isset($conf['JSwindow.']['altUrl.'])
+                                                       ? $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.'])
+                                                       : $conf['JSwindow.']['altUrl'];
                                                if ($altUrl) {
                                                        $url = $altUrl .
                                                                ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file=' .
@@ -1461,12 +1486,19 @@ class tslib_cObj {
                                        $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
                                        $gifCreator->init();
                                        $gifCreator->mayScaleUp = 0;
-                                       $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile), $conf['width'], $conf['height'], '');
-                                       $offset = t3lib_div::intExplode(',', $conf['JSwindow.']['expand'] . ',');
 
+                                       $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile), $conf['width'], $conf['height'], '');
+                                       $JSwindowExpand = isset($conf['JSwindow.']['expand.'])
+                                               ? $this->stdWrap($conf['JSwindow.']['expand'], $conf['JSwindow.']['expand.'])
+                                               : $conf['JSwindow.']['expand'];
+                                       $offset = t3lib_div::intExplode(',', $JSwindowExpand . ',');
+
+                                       $newWindow = isset($conf['JSwindow.']['newWindow.'])
+                                               ? $this->stdWrap($conf['JSwindow.']['newWindow'], $conf['JSwindow.']['newWindow.'])
+                                               : $conf['JSwindow.']['newWindow'];
                                        $a1 = '<a href="' . htmlspecialchars($url) . '" onclick="' .
                                                htmlspecialchars('openPic(\'' . $GLOBALS['TSFE']->baseUrlWrap($url) . '\',\'' .
-                                               ($conf['JSwindow.']['newWindow'] ? md5($url) : 'thePicture') . '\',\'width=' .
+                                               ($newWindow ? md5($url) : 'thePicture') . '\',\'width=' .
                                                ($dims[0] + $offset[0]) . ',height=' . ($dims[1] + $offset[1]) .
                                                ',status=0,menubar=0\'); return false;') . '"' .
                                                $target . $GLOBALS['TSFE']->ATagParams . '>';
@@ -1477,7 +1509,9 @@ class tslib_cObj {
                                        $string = $this->typoLink($string, $conf['linkParams.']);
                                }
 
-                               $string = $this->stdWrap($string, $conf['stdWrap.']);
+                               if(isset($conf['stdWrap.'])) {
+                                       $string = $this->stdWrap($string, $conf['stdWrap.']);
+                               }
 
                                $content = $a1 . $string . $a2;
                        }
@@ -1534,7 +1568,6 @@ class tslib_cObj {
         * @param       string          A string where the first two parts separated by "|" (vertical line) will be wrapped around the input string
         * @return      string          Wrapped output string
         * @see wrap(), cImage(), FILE()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=282&cHash=831a95115d
         */
        function linkWrap($content, $wrap) {
                $wrapArr = explode('|', $wrap);
@@ -1556,19 +1589,25 @@ class tslib_cObj {
         * @see IMGTEXT(), FILE(), FORM(), cImage(), filelink()
         */
        function getAltParam($conf, $longDesc = TRUE) {
-               $altText = trim($this->stdWrap($conf['altText'], $conf['altText.']));
-               $titleText = trim($this->stdWrap($conf['titleText'], $conf['titleText.']));
-               $longDesc = trim($this->stdWrap($conf['longdescURL'], $conf['longdescURL.']));
+               $altText = isset($conf['altText.'])
+                       ? trim($this->stdWrap($conf['altText'], $conf['altText.']))
+                       : trim($conf['altText']);
+               $titleText = isset($conf['titleText.'])
+                       ? trim($this->stdWrap($conf['titleText'], $conf['titleText.']))
+                       : trim($conf['titleText']);
+               $longDesc = isset($conf['longdescURL.'])
+                       ? trim($this->stdWrap($conf['longdescURL'], $conf['longdescURL.']))
+                       : trim($conf['longdescURL']);
 
                        // "alt":
                $altParam = ' alt="' . htmlspecialchars($altText) . '"';
 
                        // "title":
                $emptyTitleHandling = 'useAlt';
-               if ($conf['emptyTitleHandling']) {
+               $emptyTitleHandling = isset($conf['emptyTitleHandling.'])
+                       ? $this->stdWrap($conf['emptyTitleHandling'], $conf['emptyTitleHandling.'])
+                       : $conf['emptyTitleHandling'];
                                // choices: 'keepEmpty' | 'useAlt' | 'removeAttr'
-                       $emptyTitleHandling = $conf['emptyTitleHandling'];
-               }
                if ($titleText || $emptyTitleHandling == 'keepEmpty') {
                        $altParam .= ' title="' . htmlspecialchars($titleText) . '"';
                } elseif (!$titleText && $emptyTitleHandling == 'useAlt') {
@@ -1996,7 +2035,7 @@ class tslib_cObj {
                                        }
 
                                        // hand over the whole $conf array to the stdWrapHookObjects
-                                       if ($conf[$functionName] == 'stdWrapHookObject') {
+                                       if ($functionType === 'hook') {
                                                $singleConf = $conf;
                                        }
                                        // check if key is still containing something, since it might have been changed by next level stdWrap before
@@ -2048,6 +2087,7 @@ class tslib_cObj {
         */
        public function stdWrap_setContentToCurrent($content = '', $conf = array()) {
                $this->data[$this->currentValKey] = $content;
+               return $content;
        }
 
        /**
@@ -2060,6 +2100,7 @@ class tslib_cObj {
         */
        public function stdWrap_setCurrent($content = '', $conf = array()) {
                $this->data[$this->currentValKey] = $conf['setCurrent'];
+               return $content;
        }
 
        /**
@@ -3055,10 +3096,14 @@ class tslib_cObj {
        public function stdWrap_offsetWrap($content = '', $conf = array()) {
                $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
                if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {
-                       $controlTable->tableParams = $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.']);
+                       $controlTable->tableParams = isset($conf['offsetWrap.']['tableParams.'])
+                               ? $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.'])
+                               : $conf['offsetWrap.']['tableParams'];
                }
                if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {
-                       $controlTable->tdParams = ' ' . $this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.']);
+                       $controlTable->tdParams = ' ' . isset($conf['offsetWrap.']['tdParams.'])
+                               ? $this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.'])
+                               : $conf['offsetWrap.']['tdParams'];
                }
                $content = $controlTable->start($content, $conf['offsetWrap']);
                if ($conf['offsetWrap.']['stdWrap.']) {
@@ -3122,7 +3167,10 @@ class tslib_cObj {
         * @return      string          The processed input value
         */
        public function stdWrap_editIcons($content = '', $conf = array()) {
-               if ($GLOBALS['TSFE']->beUserLogin) {
+               if ($GLOBALS['TSFE']->beUserLogin && $conf['editIcons']) {
+                       if(!is_array($conf['editIcons.'])) {
+                               $conf['editIcons.'] = array();
+                       }
                        $content = $this->editIcons($content, $conf['editIcons'], $conf['editIcons.']);
                }
                return $content;
@@ -3210,8 +3258,6 @@ class tslib_cObj {
         * @param       array           TypoScript properties for the property (see link to "numRows")
         * @return      integer         The number of rows found by the select (FALSE on error)
         * @access private
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=317&cHash=e28e53e634
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6
         * @see stdWrap()
         */
        function numRows($conf) {
@@ -3255,7 +3301,6 @@ class tslib_cObj {
         *
         * @param       array           TypoScript properties defining what to compare
         * @return      boolean
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=320&cHash=da01618eab
         * @see HMENU(), CASEFUNC(), IMAGE(), COLUMN(), stdWrap(), _parseFunc()
         */
        function checkIf($conf) {
@@ -3267,46 +3312,62 @@ class tslib_cObj {
                }
                $flag = TRUE;
                if (isset($conf['isTrue']) || isset($conf['isTrue.'])) {
-                       $isTrue = trim($this->stdWrap($conf['isTrue'], $conf['isTrue.']));
+                       $isTrue = isset($conf['isTrue.'])
+                               ? trim($this->stdWrap($conf['isTrue'], $conf['isTrue.']))
+                               : trim($conf['isTrue']);
                        if (!$isTrue) {
                                $flag = 0;
                        }
                }
                if (isset($conf['isFalse']) || isset($conf['isFalse.'])) {
-                       $isFalse = trim($this->stdWrap($conf['isFalse'], $conf['isFalse.']));
+                       $isFalse = isset($conf['isFalse.'])
+                               ? trim($this->stdWrap($conf['isFalse'], $conf['isFalse.']))
+                               : trim($conf['isFalse']);
                        if ($isFalse) {
                                $flag = 0;
                        }
                }
                if (isset($conf['isPositive']) || isset($conf['isPositive.'])) {
-                       $number = $this->calc($this->stdWrap($conf['isPositive'], $conf['isPositive.']));
+                       $number = isset($conf['isPositive.'])
+                               ? $this->calc($this->stdWrap($conf['isPositive'], $conf['isPositive.']))
+                               : $this->calc($conf['isPositive']);
                        if ($number < 1) {
                                $flag = 0;
                        }
                }
                if ($flag) {
-                       $value = trim($this->stdWrap($conf['value'], $conf['value.']));
+                       $value = isset($conf['value.'])
+                               ? trim($this->stdWrap($conf['value'], $conf['value.']))
+                               : trim($conf['value']);
 
                        if (isset($conf['isGreaterThan']) || isset($conf['isGreaterThan.'])) {
-                               $number = trim($this->stdWrap($conf['isGreaterThan'], $conf['isGreaterThan.']));
+                               $number = isset($conf['isGreaterThan.'])
+                                       ? trim($this->stdWrap($conf['isGreaterThan'], $conf['isGreaterThan.']))
+                                       : trim($conf['isGreaterThan']);
                                if ($number <= $value) {
                                        $flag = 0;
                                }
                        }
                        if (isset($conf['isLessThan']) || isset($conf['isLessThan.'])) {
-                               $number = trim($this->stdWrap($conf['isLessThan'], $conf['isLessThan.']));
+                               $number = isset($conf['isLessThan.'])
+                                       ? trim($this->stdWrap($conf['isLessThan'], $conf['isLessThan.']))
+                                       : trim($conf['isLessThan']);
                                if ($number >= $value) {
                                        $flag = 0;
                                }
                        }
                        if (isset($conf['equals']) || isset($conf['equals.'])) {
-                               $number = trim($this->stdWrap($conf['equals'], $conf['equals.']));
+                               $number = isset($conf['equals.'])
+                                       ? trim($this->stdWrap($conf['equals'], $conf['equals.']))
+                                       : trim($conf['equals']);
                                if ($number != $value) {
                                        $flag = 0;
                                }
                        }
                        if (isset($conf['isInList']) || isset($conf['isInList.'])) {
-                               $number = trim($this->stdWrap($conf['isInList'], $conf['isInList.']));
+                               $number = isset($conf['isInList.'])
+                                       ? trim($this->stdWrap($conf['isInList'], $conf['isInList.']))
+                                       : trim($conf['isInList']);
                                if (!t3lib_div::inList($value, $number)) {
                                        $flag = 0;
                                }
@@ -3428,7 +3489,6 @@ class tslib_cObj {
         * @param       string          The value to parse by the class "t3lib_parsehtml"
         * @param       array           TypoScript properties for the parser. See link.
         * @return      string          Return value.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=330&cHash=664e0296bf
         * @see stdWrap(), t3lib_parsehtml::HTMLparserConfig(), t3lib_parsehtml::HTMLcleaner()
         */
        function HTMLparser_TSbridge($theValue, $conf) {
@@ -3456,7 +3516,6 @@ class tslib_cObj {
         * @param       string          Input value
         * @return      string          Processed input value
         * @see getData(), stdWrap(), dataWrap()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=314&cHash=02ab044c7b
         */
        function insertData($str) {
                $inside = 0;
@@ -3535,15 +3594,20 @@ class tslib_cObj {
                $afterstring = trim($options[1]);
                $crop2space = trim($options[2]);
                if ($chars) {
-                       if (strlen($content) > abs($chars)) {
+                       if ($GLOBALS['TSFE']->csConvObj->strlen($GLOBALS['TSFE']->renderCharset, $content) > abs($chars)) {
+                               $truncatePosition = FALSE;
                                if ($chars < 0) {
                                        $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset, $content, $chars);
-                                       $trunc_at = strpos($content, ' ');
-                                       $content = ($trunc_at && $crop2space) ? $afterstring . substr($content, $trunc_at) : $afterstring . $content;
+                                       if ($crop2space) {
+                                               $truncatePosition = strpos($content, ' ');
+                                       }
+                                       $content = ($truncatePosition) ? $afterstring . substr($content, $truncatePosition) : $afterstring . $content;
                                } else {
                                        $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset, $content, 0, $chars);
-                                       $trunc_at = strrpos($content, ' ');
-                                       $content = ($trunc_at && $crop2space) ? substr($content, 0, $trunc_at) . $afterstring : $content . $afterstring;
+                                       if ($crop2space) {
+                                               $truncatePosition = strrpos($content, ' ');
+                                       }
+                                       $content = ($truncatePosition) ? substr($content, 0, $truncatePosition) . $afterstring : $content . $afterstring;
                                }
                        }
                }
@@ -3724,7 +3788,6 @@ class tslib_cObj {
         * @return      string          The processed output value
         * @access private
         * @see stdWrap()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=322&cHash=a14b745a18
         */
        function textStyle($theValue, $conf) {
                $conf['face.'][1] = 'Times New Roman';
@@ -3757,7 +3820,9 @@ class tslib_cObj {
                $align = $this->data[$conf['align.']['field']];
                $properties = $this->data[$conf['properties.']['field']];
                if (!$properties) {
-                       $properties = $this->stdWrap($conf['properties.']['default'], $conf['properties.']['default.']);
+                       $properties = isset($conf['properties.']['default.'])
+                               ? $this->stdWrap($conf['properties.']['default'], $conf['properties.']['default.'])
+                               : $conf['properties.']['default'];
                }
 
                        // properties
@@ -3775,9 +3840,26 @@ class tslib_cObj {
                }
 
                        // Fonttag
-               $theFace = $conf['face.'][$face] ? $conf['face.'][$face] : $this->stdWrap($conf['face.']['default'], $conf['face.']['default.']);
-               $theSize = $conf['size.'][$size] ? $conf['size.'][$size] : $this->stdWrap($conf['size.']['default'], $conf['size.']['default.']);
-               $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $this->stdWrap($conf['color.']['default'], $conf['color.']['default.']);
+               $theFace = $conf['face.'][$face];
+               if(!$theFace) {
+                       $theFace = isset($conf['face.']['default.'])
+                               ? $this->stdWrap($conf['face.']['default'], $conf['face.']['default.'])
+                               : $conf['face.']['default'];
+               }
+
+               $theSize = $conf['size.'][$size];
+               if(!$theSize) {
+                       $theSize = isset($conf['size.']['default.'])
+                               ? $this->stdWrap($conf['size.']['default'], $conf['size.']['default.'])
+                               : $conf['size.']['default'];
+               }
+
+               $theColor = $conf['color.'][$color];
+               if(!$theColor) {
+                       $theColor = isset($conf['color.']['default.'])
+                               ? $this->stdWrap($conf['color.']['default'], $conf['color.']['default.'])
+                               : $conf['color.']['default.'];
+               }
 
                if ($conf['altWrap']) {
                        $theValue = $this->wrap($theValue, $conf['altWrap']);
@@ -3804,7 +3886,6 @@ class tslib_cObj {
         * @return      string          The processed output value
         * @access private
         * @see stdWrap()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=324&cHash=34410ebff3
         */
        function tableStyle($theValue, $conf) {
                $conf['color.'][240] = 'black';
@@ -3813,10 +3894,18 @@ class tslib_cObj {
                $conf['color.'][243] = 'gray';
                $conf['color.'][244] = 'silver';
 
-               $align = $this->stdWrap($conf['align'], $conf['align.']);
-               $border = intval($this->stdWrap($conf['border'], $conf['border.']));
-               $cellspacing = intval($this->stdWrap($conf['cellspacing'], $conf['cellspacing.']));
-               $cellpadding = intval($this->stdWrap($conf['cellpadding'], $conf['cellpadding.']));
+               $align = isset($conf['align.'])
+                       ? $this->stdWrap($conf['align'], $conf['align.'])
+                       : $conf['align'];
+               $border = isset($conf['border.'])
+                       ? intval($this->stdWrap($conf['border'], $conf['border.']))
+                       : intval($conf['border']);
+               $cellspacing = isset($conf['cellspacing.'])
+                       ? intval($this->stdWrap($conf['cellspacing'], $conf['cellspacing.']))
+                       : intval($conf['cellspacing']);
+               $cellpadding = isset($conf['cellpadding.'])
+                       ? intval($this->stdWrap($conf['cellpadding'], $conf['cellpadding.']))
+                       : intval($conf['cellpadding']);
 
                $color = $this->data[$conf['color.']['field']];
                $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $conf['color.']['default'];
@@ -3851,7 +3940,6 @@ class tslib_cObj {
         * @param       array           The TypoScript configuration properties
         * @return      string          The modified string
         * @todo        Make it XHTML compatible. Will not present "/>" endings of tags right now. Further getting the tagname might fail if it is not separated by a normal space from the attributes.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=325&cHash=ae4272e694
         */
        function addParams($content, $conf) {
                $lowerCaseAttributes = TRUE; // For XHTML compliance.
@@ -3873,7 +3961,9 @@ class tslib_cObj {
                                // adds/overrides attributes
                        foreach ($conf as $pkey => $val) {
                                if (substr($pkey, -1) != '.' && substr($pkey, 0, 1) != '_') {
-                                       $tmpVal = $this->stdWrap($conf[$pkey], $conf[$pkey . '.']);
+                                       $tmpVal = isset($conf[$pkey . '.'])
+                                               ? $this->stdWrap($conf[$pkey], $conf[$pkey . '.'])
+                                               : $conf[$pkey];
                                        if ($lowerCaseAttributes) {
                                                $pkey = strtolower($pkey);
                                        }
@@ -3899,18 +3989,21 @@ class tslib_cObj {
         * @param       array           TypoScript parameters for the TypoScript function ->filelink
         * @return      string          The link to the file possibly with icons, thumbnails, size in bytes shown etc.
         * @access private
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=326&cHash=5618043c18
         * @see stdWrap()
         */
        function filelink($theValue, $conf) {
-               $conf['path'] = $this->stdWrap($conf['path'], $conf['path.']);
+               $conf['path'] = isset($conf['path.'])
+                       ? $this->stdWrap($conf['path'], $conf['path.'])
+                       : $conf['path'];
                $theFile = trim($conf['path']) . $theValue;
                if (@is_file($theFile)) {
                        $theFileEnc = str_replace('%2F', '/', rawurlencode($theFile));
 
                                // the jumpURL feature will be taken care of by typoLink, only "jumpurl.secure = 1" is applyable needed for special link creation
                        if ($conf['jumpurl.']['secure']) {
-                               $alternativeJumpUrlParameter = $this->stdWrap($conf['jumpurl.']['parameter'], $conf['jumpurl.']['parameter.']);
+                               $alternativeJumpUrlParameter = isset($conf['jumpurl.']['parameter.'])
+                                       ? $this->stdWrap($conf['jumpurl.']['parameter'], $conf['jumpurl.']['parameter.'])
+                                       : $conf['jumpurl.']['parameter'];
                                $typoLinkConf = array(
                                        'parameter' => ($alternativeJumpUrlParameter ? $alternativeJumpUrlParameter : ($GLOBALS['TSFE']->id . ',' . $GLOBALS['TSFE']->type)),
                                        'fileTarget' => $conf['target'],
@@ -3945,7 +4038,9 @@ class tslib_cObj {
                                $iconP = t3lib_extMgm::siteRelPath('cms') . 'tslib/media/fileicons/';
                                $icon = @is_file($iconP . $fI['fileext'] . '.gif') ? $iconP . $fI['fileext'] . '.gif' : $iconP . 'default.gif';
                                        // Checking for images: If image, then return link to thumbnail.
-                               $IEList = $this->stdWrap($conf['icon_image_ext_list'], $conf['icon_image_ext_list.']);
+                               $IEList = isset($conf['icon_image_ext_list.'])
+                                       ? $this->stdWrap($conf['icon_image_ext_list'], $conf['icon_image_ext_list.'])
+                                       : $conf['icon_image_ext_list'];
                                $image_ext_list = str_replace(' ', '', strtolower($IEList));
                                if ($fI['fileext'] && t3lib_div::inList($image_ext_list, $fI['fileext'])) {
                                        if ($conf['iconCObject']) {
@@ -3954,7 +4049,9 @@ class tslib_cObj {
                                                if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
                                                        $thumbSize = '';
                                                        if ($conf['icon_thumbSize'] || $conf['icon_thumbSize.']) {
-                                                               $thumbSize = '&size=' . $this->stdWrap($conf['icon_thumbSize'], $conf['icon_thumbSize.']);
+                                                               $thumbSize = '&size=' . isset($conf['icon_thumbSize.'])
+                                                                       ? $this->stdWrap($conf['icon_thumbSize'], $conf['icon_thumbSize.'])
+                                                                       : $conf['icon_thumbSize'];
                                                        }
                                                        $check = basename($theFile) . ':' . filemtime($theFile) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
                                                        $md5sum = '&md5sum=' . t3lib_div::shortMD5($check);
@@ -3974,27 +4071,43 @@ class tslib_cObj {
                                if ($conf['icon_link']) {
                                        $icon = $this->wrap($icon, $theLinkWrap);
                                }
-                               $icon = $this->stdWrap($icon, $conf['icon.']);
+                               $icon = isset($conf['icon.'])
+                                       ? $this->stdWrap($icon, $conf['icon.'])
+                                       : $icon;
                        }
                        if ($conf['size']) {
-                               $size = $this->stdWrap($theSize, $conf['size.']);
+                               $size = isset($conf['size.'])
+                                       ? $this->stdWrap($theSize, $conf['size.'])
+                                       : $theSize;
                        }
 
                                // Wrapping file label
                        if ($conf['removePrependedNumbers']) {
                                $theValue = preg_replace('/_[0-9][0-9](\.[[:alnum:]]*)$/', '\1', $theValue);
                        }
-                       $theValue = $this->stdWrap($theValue, $conf['labelStdWrap.']);
+                       if(isset($conf['labelStdWrap.'])) {
+                               $theValue = $this->stdWrap($theValue, $conf['labelStdWrap.']);
+                       }
 
                                // Wrapping file
+                       $wrap = isset($conf['wrap.'])
+                               ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                               : $conf['wrap'];
                        if ($conf['ATagBeforeWrap']) {
-                               $theValue = $this->wrap($this->wrap($theValue, $conf['wrap']), $theLinkWrap);
+                               $theValue = $this->wrap($this->wrap($theValue, $wrap), $theLinkWrap);
                        } else {
-                               $theValue = $this->wrap($this->wrap($theValue, $theLinkWrap), $conf['wrap']);
+                               $theValue = $this->wrap($this->wrap($theValue, $theLinkWrap), $wrap);
                        }
-                       $file = $this->stdWrap($theValue, $conf['file.']);
+                       $file = isset($conf['file.'])
+                               ? $this->stdWrap($theValue, $conf['file.'])
+                               : $theValue;
                                // output
-                       return $this->stdWrap($icon . $file . $size, $conf['stdWrap.']);
+                       $output = $icon . $file . $size;
+                       if(isset($conf['stdWrap.'])) {
+                               $output = $this->stdWrap($output, $conf['stdWrap.']);
+                       }
+
+                       return $output;
                }
        }
 
@@ -4094,35 +4207,54 @@ class tslib_cObj {
         * @return      string          Compiled result
         * @access private
         * @see stdWrap(), t3lib_menu::procesItemStates()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=319&cHash=1871864c8f
         */
        function splitObj($value, $conf) {
-               $conf['token'] = $this->stdWrap($conf['token'], $conf['token.']);
+               $conf['token'] = isset($conf['token.'])
+                       ? $this->stdWrap($conf['token'], $conf['token.'])
+                       : $conf['token'];
                if (!$conf['token']) {
                        return $value;
                }
-               $conf['max'] = intval($this->stdWrap($conf['max'], $conf['max.']));
-               $conf['min'] = intval($this->stdWrap($conf['min'], $conf['min.']));
+               $conf['max'] = isset($conf['max.'])
+                       ? intval($this->stdWrap($conf['max'], $conf['max.']))
+                       : intval($conf['max']);
+               $conf['min'] = isset($conf['min.'])
+                       ? intval($this->stdWrap($conf['min'], $conf['min.']))
+                       : intval($conf['min']);
 
                $valArr = explode($conf['token'], $value);
 
                if (count($valArr) && (t3lib_div::testInt($conf['returnKey']) || $conf['returnKey.'])) {
-                       $key = intval($this->stdWrap($conf['returnKey'], $conf['returnKey.']));
+                       $key = isset($conf['returnKey.'])
+                               ? intval($this->stdWrap($conf['returnKey'], $conf['returnKey.']))
+                               : intval($conf['returnKey']);
                        $content = isset($valArr[$key]) ? $valArr[$key] : '';
                } else {
                                // calculate splitCount
                        $splitCount = count($valArr);
-                       if ($conf['max'] && $splitCount > $conf['max']) {
-                               $splitCount = $conf['max'];
-                       }
-                       if ($conf['min'] && $splitCount < $conf['min']) {
-                               $splitCount = $conf['min'];
-                       }
-
-                       if ($conf['wrap'] || $conf['cObjNum']) {
+                       $max = isset($conf['max.'])
+                               ? $this->stdWrap($conf['max'],$conf['max.'])
+                               : $conf['max'];
+                       if ($max && $splitCount > $max) {
+                               $splitCount = $max;
+                       }
+                       $min = isset($conf['min.'])
+                               ? $this->stdWrap($conf['min'],$conf['min.'])
+                               : $conf['min'];
+                       if ($min && $splitCount < $min) {
+                               $splitCount = $min;
+                       }
+
+                       $wrap = isset($conf['wrap.'])
+                               ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                               : $conf['wrap'];
+                       $cObjNum = isset($conf['cObjNum.'])
+                               ? $this->stdWrap($conf['cObjNum'], $conf['cObjNum.'])
+                               : $conf['cObjNum'];
+                       if ($wrap || $cObjNum) {
                                $splitArr = array();
-                               $splitArr['wrap'] = $conf['wrap'];
-                               $splitArr['cObjNum'] = $conf['cObjNum'];
+                               $splitArr['wrap'] = $wrap;
+                               $splitArr['cObjNum'] = $cObjNum;
                                $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr, $splitCount);
                        }
 
@@ -4133,10 +4265,15 @@ class tslib_cObj {
                                $this->data[$this->currentValKey] = $value;
                                if ($splitArr[$a]['cObjNum']) {
                                        $objName = intval($splitArr[$a]['cObjNum']);
-                                       $value = $this->stdWrap($this->cObjGet($conf[$objName . '.'], $objName . '.'), $conf[$objName . '.']);
+                                       $value = isset($conf[$objName . '.'])
+                                               ? $this->stdWrap($this->cObjGet($conf[$objName . '.'], $objName . '.'), $conf[$objName . '.'])
+                                               : $this->cObjGet($conf[$objName . '.'], $objName . '.');
                                }
-                               if ($splitArr[$a]['wrap']) {
-                                       $value = $this->wrap($value, $splitArr[$a]['wrap']);
+                               $wrap = isset($splitArr[$a]['wrap.'])
+                                       ? $this->stdWrap($splitArr[$a]['wrap'], $splitArr[$a]['wrap.'])
+                                       : $splitArr[$a]['wrap'];
+                               if ($wrap) {
+                                       $value = $this->wrap($value, $wrap);
                                }
                                $content .= $value;
                        }
@@ -4153,9 +4290,15 @@ class tslib_cObj {
         * @return      string  The formated number
         */
        function numberFormat($content, $conf) {
-               $decimals = $this->stdWrap($conf['decimals'], $conf['decimals.']);
-               $dec_point = $this->stdWrap($conf['dec_point'], $conf['dec_point.']);
-               $thousands_sep = $this->stdWrap($conf['thousands_sep'], $conf['thousands_sep.']);
+               $decimals = isset($conf['decimals.'])
+                       ? $this->stdWrap($conf['decimals'], $conf['decimals.'])
+                       : $conf['decimals'];
+               $dec_point = isset($conf['dec_point.'])
+                       ? $this->stdWrap($conf['dec_point'], $conf['dec_point.'])
+                       : $conf['dec_point'];
+               $thousands_sep = isset($conf['thousands_sep.'])
+                       ? $this->stdWrap($conf['thousands_sep'], $conf['thousands_sep.'])
+                       : $conf['thousands_sep'];
                return number_format($content, $decimals, $dec_point, $thousands_sep);
        }
 
@@ -4177,7 +4320,6 @@ class tslib_cObj {
         * @param       array           TypoScript configuration for parseFunc
         * @param       string          Reference to get configuration from. Eg. "< lib.parseFunc" which means that the configuration of the object path "lib.parseFunc" will be retrieved and MERGED with what is in $conf!
         * @return      string          The processed value
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=327&cHash=33331f0396
         * @see _parseFunc()
         */
        function parseFunc($theValue, $conf, $ref = '') {
@@ -4418,7 +4560,7 @@ class tslib_cObj {
                                                $contentAccumP++;
                                                $treated = 1;
                                                        // in-out-tag: img and other empty tags
-                                               if ($tag[0] == 'img' || substr($tag[1], -3, 2) == ' /') {
+                                               if (preg_match('/^(area|base|br|col|hr|img|input|meta|param)$/i', $tag[0])) {
                                                        $tag['out'] = 1;
                                                }
                                        }
@@ -4509,31 +4651,43 @@ class tslib_cObj {
         * @param       array           TypoScript options
         * @return      string          The processed input value being returned; Splitted lines imploded by LF again.
         * @access private
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=323&cHash=a19312be78
         */
        function encaps_lineSplit($theValue, $conf) {
                $lParts = explode(LF, $theValue);
 
                $encapTags = t3lib_div::trimExplode(',', strtolower($conf['encapsTagList']), 1);
                $nonWrappedTag = $conf['nonWrappedTag'];
-               $defaultAlign = trim($this->stdWrap($conf['defaultAlign'], $conf['defaultAlign.']));
+               $defaultAlign = isset($conf['defaultAlign.'])
+                       ? trim($this->stdWrap($conf['defaultAlign'], $conf['defaultAlign.']))
+                       : trim($conf['defaultAlign']);
 
                if (!strcmp('', $theValue))
                        return '';
 
                foreach ($lParts as $k => $l) {
                        $sameBeginEnd = 0;
+                       $emptyTag = 0;
                        $l = trim($l);
                        $attrib = array();
                        $nWrapped = 0;
-                       $byPass = 0;
                        if (substr($l, 0, 1) == '<' && substr($l, -1) == '>') {
                                $fwParts = explode('>', substr($l, 1), 2);
-                               $backParts = t3lib_div::revExplode('<', substr($fwParts[1], 0, -1), 2);
-                               $attrib = t3lib_div::get_tag_attributes('<' . $fwParts[0] . '>');
-                               list ($tagName) = explode(' ', $fwParts[0]);
-                               $str_content = $backParts[0];
-                               $sameBeginEnd = (substr(strtolower($backParts[1]), 1, strlen($tagName)) == strtolower($tagName));
+                               list($tagName, $tagParams) = explode(' ',$fwParts[0], 2);
+                               if (!$fwParts[1]) {
+                                       if (substr($tagName, -1) == '/') {
+                                               $tagName = substr($tagName, 0, -1);
+                                       }
+                                       if (substr($fwParts[0], -1) == '/') {
+                                               $sameBeginEnd = 1;
+                                               $emptyTag = 1;
+                                               $attrib = t3lib_div::get_tag_attributes('<'.substr($fwParts[0], 0, -1).'>');
+                                       }
+                               } else {
+                                       $backParts = t3lib_div::revExplode('<', substr($fwParts[1],0,-1), 2);
+                                       $attrib = t3lib_div::get_tag_attributes('<'.$fwParts[0].'>');
+                                       $str_content = $backParts[0];
+                                       $sameBeginEnd = (substr(strtolower($backParts[1]),1,strlen($tagName))==strtolower($tagName));
+                               }
                        }
 
                        if ($sameBeginEnd && in_array(strtolower($tagName), $encapTags)) {
@@ -4541,6 +4695,8 @@ class tslib_cObj {
                                $uTagName = strtoupper($conf['remapTag.'][$uTagName] ? $conf['remapTag.'][$uTagName] : $uTagName);
                        } else {
                                $uTagName = strtoupper($nonWrappedTag);
+                                       // The line will be wrapped: $uTagName should not be an empty tag
+                               $emptyTag = 0;
                                $str_content = $lParts[$k];
                                $nWrapped = 1;
                                $attrib = array();
@@ -4577,12 +4733,14 @@ class tslib_cObj {
                                        $attrib['align'] = $defaultAlign;
 
                                $params = t3lib_div::implodeAttributes($attrib, 1);
-                               if ($conf['removeWrapping']) {
+                               if ($conf['removeWrapping'] && !($emptyTag && $conf['removeWrapping.']['keepSingleTag'])) {
                                        $str_content = $str_content;
                                } else {
-                                       $str_content = '<' . strtolower($uTagName) . (trim($params) ? ' ' . trim($params) : '') . '>' .
-                                               $str_content .
-                                               '</' . strtolower($uTagName) . '>';
+                                       if ($emptyTag) {
+                                               $str_content='<'.strtolower($uTagName).(trim($params)?' '.trim($params):'').' />';
+                                       } else {
+                                               $str_content='<'.strtolower($uTagName).(trim($params)?' '.trim($params):'').'>'.$str_content.'</'.strtolower($uTagName).'>';
+                                       }
                                }
                        }
 
@@ -4602,7 +4760,6 @@ class tslib_cObj {
         * @param       string          The string in which to search for "http://"
         * @param       array           Configuration for makeLinks, see link
         * @return      string          The processed input string, being returned.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=328&cHash=c1135706d7
         * @see _parseFunc()
         */
        function http_makelinks($data, $conf) {
@@ -4653,10 +4810,13 @@ class tslib_cObj {
                                                $aTagParams . $this->extLinkATagParams('http://' . $parts[0], 'url') .
                                                '>';
                                }
+                               $wrap = isset($conf['wrap.'])
+                                       ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                                       : $conf['wrap'];
                                if ($conf['ATagBeforeWrap']) {
-                                       $res = $res . $this->wrap($linktxt, $conf['wrap']) . '</a>';
+                                       $res = $res . $this->wrap($linktxt, $wrap) . '</a>';
                                } else {
-                                       $res = $this->wrap($res . $linktxt . '</a>', $conf['wrap']);
+                                       $res = $this->wrap($res . $linktxt . '</a>', $wrap);
                                }
                                $textstr .= $res . $parts[1];
                        } else {
@@ -4673,7 +4833,6 @@ class tslib_cObj {
         * @param       string          The string in which to search for "mailto:"
         * @param       array           Configuration for makeLinks, see link
         * @return      string          The processed input string, being returned.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=328&cHash=c1135706d7
         * @see _parseFunc()
         */
        function mailto_makelinks($data, $conf) {
@@ -4697,10 +4856,13 @@ class tslib_cObj {
                                list ($mailToUrl, $linktxt) = $this->getMailTo($parts[0], $linktxt, $initP);
                                $mailToUrl = $GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii' ? $mailToUrl : htmlspecialchars($mailToUrl);
                                $res = '<a href="' . $mailToUrl . '"' . $aTagParams . '>';
+                               $wrap = isset($conf['wrap.'])
+                                       ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                                       : $conf['wrap'];
                                if ($conf['ATagBeforeWrap']) {
-                                       $res = $res . $this->wrap($linktxt, $conf['wrap']) . '</a>';
+                                       $res = $res . $this->wrap($linktxt, $wrap) . '</a>';
                                } else {
-                                       $res = $this->wrap($res . $linktxt . '</a>', $conf['wrap']);
+                                       $res = $this->wrap($res . $linktxt . '</a>', $wrap);
                                }
                                $textstr .= $res . $parts[1];
                        } else {
@@ -4720,7 +4882,6 @@ class tslib_cObj {
         * @param       string          A "imgResource" TypoScript data type. Either a TypoScript file resource or the string GIFBUILDER. See description above.
         * @param       array           TypoScript properties for the imgResource type
         * @return      array           Returns info-array. info[origFile] = original file.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=315&cHash=63b593a934
         * @see IMG_RESOURCE(), cImage(), tslib_gifBuilder
         */
        function getImgResource($file, $fileArray) {
@@ -4745,14 +4906,30 @@ class tslib_cObj {
                                        }
                                        $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
                                        if ($theImage) {
-                                               $fileArray['width'] = $this->stdWrap($fileArray['width'], $fileArray['width.']);
-                                               $fileArray['height'] = $this->stdWrap($fileArray['height'], $fileArray['height.']);
-                                               $fileArray['ext'] = $this->stdWrap($fileArray['ext'], $fileArray['ext.']);
-                                               $fileArray['maxW'] = intval($this->stdWrap($fileArray['maxW'], $fileArray['maxW.']));
-                                               $fileArray['maxH'] = intval($this->stdWrap($fileArray['maxH'], $fileArray['maxH.']));
-                                               $fileArray['minW'] = intval($this->stdWrap($fileArray['minW'], $fileArray['minW.']));
-                                               $fileArray['minH'] = intval($this->stdWrap($fileArray['minH'], $fileArray['minH.']));
-                                               $fileArray['noScale'] = $this->stdWrap($fileArray['noScale'], $fileArray['noScale.']);
+                                               $fileArray['width'] = isset($fileArray['width.'])
+                                                       ? $this->stdWrap($fileArray['width'], $fileArray['width.'])
+                                                       : $fileArray['width'];
+                                               $fileArray['height'] = isset($fileArray['height.'])
+                                                       ? $this->stdWrap($fileArray['height'], $fileArray['height.'])
+                                                       : $fileArray['height'];
+                                               $fileArray['ext'] = isset($fileArray['ext.'])
+                                                       ? $this->stdWrap($fileArray['ext'], $fileArray['ext.'])
+                                                       : $fileArray['ext'];
+                                               $fileArray['maxW'] = isset($fileArray['maxW.'])
+                                                       ? intval($this->stdWrap($fileArray['maxW'], $fileArray['maxW.']))
+                                                       : intval($fileArray['maxW']);
+                                               $fileArray['maxH'] = isset($fileArray['maxH.'])
+                                                       ? intval($this->stdWrap($fileArray['maxH'], $fileArray['maxH.']))
+                                                       : intval($fileArray['maxH']);
+                                               $fileArray['minW'] = isset($fileArray['minW.'])
+                                                       ? intval($this->stdWrap($fileArray['minW'], $fileArray['minW.']))
+                                                       : intval($fileArray['minW']);
+                                               $fileArray['minH'] = isset($fileArray['minH.'])
+                                                       ? intval($this->stdWrap($fileArray['minH'], $fileArray['minH.']))
+                                                       : intval($fileArray['minH']);
+                                               $fileArray['noScale'] = isset($fileArray['noScale.'])
+                                                       ? $this->stdWrap($fileArray['noScale'], $fileArray['noScale.'])
+                                                       : $fileArray['noScale'];
                                                $maskArray = $fileArray['m.'];
                                                $maskImages = array();
                                                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!
@@ -4968,7 +5145,6 @@ class tslib_cObj {
         * @param       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)
         * @param       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.
         * @return      string          The value fetched
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=282&cHash=831a95115d
         * @see getFieldVal()
         */
        function getData($string, $fieldArray) {
@@ -5245,16 +5421,19 @@ class tslib_cObj {
         * @param       array           TypoScript configuration (see link below)
         * @return      string          A link-wrapped string.
         * @see stdWrap(), tslib_pibase::pi_linkTP()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=321&cHash=59bd727a5e
         */
        function typoLink($linktxt, $conf) {
                $LD = array();
                $finalTagParts = array();
                $finalTagParts['aTagParams'] = $this->getATagParams($conf);
 
-               $link_param = trim($this->stdWrap($conf['parameter'], $conf['parameter.']));
+               $link_param = isset($conf['parameter.'])
+                       ? trim($this->stdWrap($conf['parameter'], $conf['parameter.']))
+                       : trim($conf['parameter']);
 
-               $sectionMark = trim($this->stdWrap($conf['section'], $conf['section.']));
+               $sectionMark = isset($conf['section.'])
+                       ? trim($this->stdWrap($conf['section'], $conf['section.']))
+                       : trim($conf['section']);
                $sectionMark = $sectionMark ? (t3lib_div::testInt($sectionMark) ? '#c' : '#') . $sectionMark : '';
                $initP = '?id=' . $GLOBALS['TSFE']->id . '&type=' . $GLOBALS['TSFE']->type;
                $this->lastTypoLinkUrl = '';
@@ -5476,7 +5655,9 @@ class tslib_cObj {
 
                                                        // Query Params:
                                                $addQueryParams = $conf['addQueryString'] ? $this->getQueryArguments($conf['addQueryString.']) : '';
-                                               $addQueryParams .= trim($this->stdWrap($conf['additionalParams'], $conf['additionalParams.']));
+                                               $addQueryParams .= isset($conf['additionalParams.'])
+                                                       ? trim($this->stdWrap($conf['additionalParams'], $conf['additionalParams.']))
+                                                       : trim($conf['additionalParams']);
                                                if ($addQueryParams == '&' || substr($addQueryParams, 0, 1) != '&') {
                                                        $addQueryParams = '';
                                                }
@@ -5757,10 +5938,13 @@ class tslib_cObj {
                                }
                        }
 
+                       $wrap = isset($conf['wrap.'])
+                               ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
+                               : $conf['wrap'];
                        if ($conf['ATagBeforeWrap']) {
-                               return $res . $this->wrap($linktxt, $conf['wrap']) . '</a>';
+                               return $res . $this->wrap($linktxt, $wrap) . '</a>';
                        } else {
-                               return $this->wrap($res . $linktxt . '</a>', $conf['wrap']);
+                               return $this->wrap($res . $linktxt . '</a>', $wrap);
                        }
                } else {
                        return $linktxt;
@@ -7180,7 +7364,6 @@ class tslib_cObj {
         * @return      mixed           A SELECT query if $returnQueryArray is FALSE, otherwise the SELECT query in an array as parts.
         * @access private
         * @see CONTENT(), numRows()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6
         */
        function getQuery($table, $conf, $returnQueryArray = FALSE) {
 
@@ -7200,7 +7383,9 @@ class tslib_cObj {
                }
 
                        // Construct WHERE clause:
-               $conf['pidInList'] = trim($this->stdWrap($conf['pidInList'], $conf['pidInList.']));
+               $conf['pidInList'] = isset($conf['pidInList.'])
+                       ? trim($this->stdWrap($conf['pidInList'], $conf['pidInList.']))
+                       : trim($conf['pidInList']);
 
                        // Handle recursive function for the pidInList
                if (isset($conf['recursive'])) {
@@ -7299,7 +7484,6 @@ class tslib_cObj {
         * @param       boolean         If set, the function will return the query not as a string but array with the various parts. RECOMMENDED!
         * @return      mixed           A WHERE clause based on the relevant parts of the TypoScript properties for a "select" function in TypoScript, see link. If $returnQueryArray is FALSE the where clause is returned as a string with WHERE, GROUP BY and ORDER BY parts, otherwise as an array with these parts.
         * @access private
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6
         * @see getQuery()
         */
        function getWhere($table, $conf, $returnQueryArray = FALSE) {
@@ -7360,7 +7544,9 @@ class tslib_cObj {
                        $query .= ' AND ' . $conf['languageField'] . ' IN (' . $sys_language_content . ')';
                }
 
-               $andWhere = trim($this->stdWrap($conf['andWhere'], $conf['andWhere.']));
+               $andWhere = isset($conf['andWhere.'])
+                       ? trim($this->stdWrap($conf['andWhere'], $conf['andWhere.']))
+                       : trim($conf['andWhere']);
                if ($andWhere) {
                        $query .= ' AND ' . $andWhere;
                }
@@ -7380,13 +7566,16 @@ class tslib_cObj {
 
                        // GROUP BY
                if (trim($conf['groupBy'])) {
-                       $queryParts['GROUPBY'] = trim($conf['groupBy']);
-                       $query .= ' GROUP BY ' . $queryParts['GROUPBY'];
+                       $queryParts['GROUPBY'] = isset($conf['groupBy.'])
+                               ? trim($this->stdWrap($conf['groupBy'], $conf['groupBy.']))
+                               : trim($conf['groupBy']);
                }
 
                        // ORDER BY
                if (trim($conf['orderBy'])) {
-                       $queryParts['ORDERBY'] = trim($conf['orderBy']);
+                       $queryParts['ORDERBY'] = isset($conf['orderBy.'])
+                               ? trim($this->stdWrap($conf['orderBy'], $conf['orderBy.']))
+                               : trim($conf['orderBy']);
                        $query .= ' ORDER BY ' . $queryParts['ORDERBY'];
                }
 
@@ -7464,7 +7653,9 @@ class tslib_cObj {
                                $marker = rtrim($dottedMarker, '.');
                                if ($dottedMarker == $marker . '.') {
                                                // parse definition
-                                       $tempValue = $this->stdWrap($conf['markers.'][$dottedMarker]['value'], $conf['markers.'][$dottedMarker]);
+                                       $tempValue = isset($conf['markers.'][$dottedMarker])
+                                               ? $this->stdWrap($conf['markers.'][$dottedMarker]['value'], $conf['markers.'][$dottedMarker])
+                                               : $conf['markers.'][$dottedMarker]['value'];
                                                // quote/escape if needed
                                        if (is_numeric($tempValue)) {
                                                if ((int) $tempValue == $tempValue) {
@@ -7534,7 +7725,6 @@ class tslib_cObj {
         * @param       string          The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
         * @param       array           Alternative data array to use. Default is $this->data
         * @return      string          The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508
         */
        function editPanel($content, $conf, $currentRecord = '', $dataArr = array()) {
 
@@ -7566,7 +7756,7 @@ class tslib_cObj {
         * @param       string          Additional URL parameters for the link pointing to alt_doc.php
         * @return      string          The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
         */
-       function editIcons($content, $params, $conf = array(), $currentRecord = '', $dataArr = array(), $addUrlParamStr = '') {
+       function editIcons($content, $params, array $conf = array(), $currentRecord = '', $dataArr = array(), $addUrlParamStr = '') {
                if ($GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit)) {
                        if (!$currentRecord) {
                                $currentRecord = $this->currentRecord;
@@ -7634,7 +7824,6 @@ class tslib_frameset {
         * @param       array           The TypoScript properties of the PAGE object property "frameSet.". See link.
         * @return      string          A <frameset> tag.
         * @see TSpagegen::renderContentWithHeader()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=343&cHash=41ca925386
         */
        function make($setup) {
                $content = '';
@@ -7871,7 +8060,6 @@ class tslib_controlTable {
         * @param       string          List of margin parameters; left, top, right, bottom
         * @return      string          The content strings wrapped in a <table> as the parameters defined
         * @see tslib_cObj::CTABLE()
-        * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7
         */
        function start($offset, $cMargins) {
                $offArr = t3lib_div::intExplode(',', $offset);