From 11e9a5460221b6b34f33af0b1227fdf33b5afc70 Mon Sep 17 00:00:00 2001 From: Steffen Kamper Date: Thu, 4 Nov 2010 00:34:14 +0000 Subject: [PATCH] Fixed bug #16191: Optimize stdWrap usage for TypoScript content element CONTENT (Thanks to Jo Hasenau) git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9267 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + .../content/class.tslib_content_content.php | 67 ++++++++++++++++--- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1820d144c59..b8ca55ec935 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-11-03 Steffen Kamper + * Fixed bug #16191: Optimize stdWrap usage for TypoScript content element CONTENT (Thanks to Jo Hasenau) * Fixed bug #16196: Optimize stdWrap usage for TypoScript content element CTABLE (Thanks to Jo Hasenau) * Fixed bug #16197: Optimize stdWrap usage for TypoScript content element FILE (Thanks to Jo Hasenau) * Fixed bug #16199: Optimize stdWrap usage for TypoScript content element HMENU (Thanks to Jo Hasenau) diff --git a/typo3/sysext/cms/tslib/content/class.tslib_content_content.php b/typo3/sysext/cms/tslib/content/class.tslib_content_content.php index 4fa1dcffeae..c3fc3d70c92 100644 --- a/typo3/sysext/cms/tslib/content/class.tslib_content_content.php +++ b/typo3/sysext/cms/tslib/content/class.tslib_content_content.php @@ -49,17 +49,51 @@ class tslib_content_Content extends tslib_content_Abstract { $GLOBALS['TSFE']->recordRegister[$originalRec]++; } - $conf['table'] = trim($this->cObj->stdWrap($conf['table'], $conf['table.'])); - if ($conf['table'] == 'pages' || substr($conf['table'], 0, 3) == 'tt_' || substr($conf['table'], 0, 3) == 'fe_' || substr($conf['table'], 0, 3) == 'tx_' || substr($conf['table'], 0, 4) == 'ttx_' || substr($conf['table'], 0, 5) == 'user_' || substr($conf['table'], 0, 7) == 'static_') { - - $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<' . $conf['table']; - $renderObjKey = $conf['renderObj'] ? 'renderObj' : ''; + $conf['table'] = isset($conf['table.']) + ? trim($this->cObj->stdWrap($conf['table'], $conf['table.'])) + : trim($conf['table']); + $tablePrefix = t3lib_div::trimExplode('_', $conf['table'], TRUE); + if (t3lib_div::inList('pages,tt,fe,tx,ttx,user,static', $tablePrefix[0])) { + + $renderObjName = $conf['renderObj'] + ? $conf['renderObj'] + : '<' . $conf['table']; + $renderObjKey = $conf['renderObj'] + ? 'renderObj' + : ''; $renderObjConf = $conf['renderObj.']; - $slide = intval($conf['slide']) ? intval($conf['slide']) : 0; - $slideCollect = intval($conf['slide.']['collect']) ? intval($conf['slide.']['collect']) : 0; - $slideCollectReverse = intval($conf['slide.']['collectReverse']) ? TRUE : FALSE; - $slideCollectFuzzy = $slideCollect ? (intval($conf['slide.']['collectFuzzy']) ? TRUE : FALSE) : TRUE; + $slide = isset($conf['slide.']) + ? intval($this->cObj->stdWrap($conf['slide'], $conf['slide.'])) + : intval($conf['slide']); + if(!$slide) { + $slide = 0; + } + + if(isset($conf['slide.'])) { + $slideCollect = isset($conf['slide.']['collect.']) + ? intval($this->cObj->stdWrap($conf['slide.']['collect'], $conf['slide.']['collect.'])) + : intval($conf['slide.']['collect']); + if(!$slideCollect) { + $slideCollect = 0; + } + + $slideCollectReverse = isset($conf['slide.']['collectReverse.']) + ? intval($this->cObj->stdWrap($conf['slide.']['collectReverse'], $conf['slide.']['collectReverse.'])) + : intval($conf['slide.']['collectReverse']); + $slideCollectReverse = $slideCollectReverse ? TRUE : FALSE; + + $slideCollectFuzzy = isset($conf['slide.']['collectFuzzy.']) + ? intval($this->cObj->stdWrap($conf['slide.']['collectFuzzy'], $conf['slide.']['collectFuzzy.'])) + : intval($conf['slide.']['collectFuzzy']); + + if(!$slideCollectFuzzy) { + $slideCollectFuzzy = FALSE; + } else if ($slideCollect) { + $slideCollectFuzzy = TRUE; + }; + } + $again = FALSE; do { @@ -97,6 +131,7 @@ class tslib_content_Content extends tslib_content_Abstract { } $GLOBALS['TYPO3_DB']->sql_free_result($res); } + if ($slideCollectReverse) { $theValue = $cobjValue . $theValue; } else { @@ -113,14 +148,24 @@ class tslib_content_Content extends tslib_content_Abstract { $again = strlen($conf['select.']['pidInList']) ? TRUE : FALSE; } } while ($again && (($slide && !strlen($tmpValue) && $slideCollectFuzzy) || ($slide && $slideCollect))); + + } + + $wrap = isset($conf['wrap.']) + ? $this->cObj->stdWrap($conf['wrap'],$conf['wrap.']) + : $conf['wrap']; + if($wrap) { + $theValue = $this->cObj->wrap($theValue, $wrap); } - $theValue = $this->cObj->wrap($theValue, $conf['wrap']); - if ($conf['stdWrap.']) + if (isset($conf['stdWrap.'])) { $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']); + } $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore + return $theValue; + } } -- 2.20.1