Added feature #16284: Optimize stdWrap usage for TypoScript content element LOAD_REGI...
authorSusanne Moog <typo3@susannemoog.de>
Wed, 17 Nov 2010 08:01:40 +0000 (08:01 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Wed, 17 Nov 2010 08:01:40 +0000 (08:01 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9424 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/cms/tslib/content/class.tslib_content_loadregister.php

index 8cc0a04..10132e0 100644 (file)
@@ -44,14 +44,20 @@ class tslib_content_LoadRegister extends tslib_content_Abstract {
         */
        public function render($conf = array()) {
                array_push($GLOBALS['TSFE']->registerStack, $GLOBALS['TSFE']->register);
+
                if (is_array($conf)) {
+                       $isExecuted = array();
                        foreach ($conf as $theKey => $theValue) {
-                               if (!strstr($theKey, '.') || !isset($conf[substr($theKey, 0, -1)])) {
-                                               // Only if 1) the property is set but not the value itself, 2) the value and/or any property
-                                       if (strstr($theKey, '.')) {
-                                               $theKey = substr($theKey, 0, -1);
+                               $register = rtrim($theKey, '.');
+                               if(!$isExecuted[$register]) {
+                                       $registerProperties = $register . '.';
+                                       if(isset($conf[$register]) && isset($conf[$registerProperties])) {
+                                               $theValue = $this->cObj->stdWrap($theValue, $conf[$registerProperties]);
+                                       } else if(isset($conf[$registerProperties])) {
+                                               $theValue = $this->cObj->stdWrap('', $conf[$registerProperties]);
                                        }
-                                       $GLOBALS['TSFE']->register[$theKey] = $this->cObj->stdWrap($conf[$theKey], $conf[$theKey . '.']);
+                                       $GLOBALS['TSFE']->register[$register] = $theValue;
+                                       $isExecuted[$register] = true;
                                }
                        }
                }