function setSmartyVar($smartyVar, $smartyValue) { $smartyVar = preg_replace('/\\.?$/m', '', trim(strtolower($smartyVar))); if (!in_array($smartyVar, array_keys($this->t3_smartyVars))) { return false; } // Exit if no corresponding Smarty class variable exists if (is_array($this->{$smartyVar}) || is_array($smartyValue)) { $smartyValue = is_array($smartyValue) ? tx_smarty_div::removeDotsFromTS($smartyValue) : t3lib_div::trimExplode(',', $smartyValue, 1); $smartyValue = array_map(array('tx_smarty_div', 'booleanize'), $smartyValue); if ($this->t3_smartyVars[$smartyVar]) { $smartyValue = array_map(array('tx_smarty_div', 'getFileAbsName'), $smartyValue); } $this->{$smartyVar} = array_merge_recursive($this->{$smartyVar}, $smartyValue); } else { if ($this->t3_smartyVars[$smartyVar]) { $smartyValue = tx_smarty_div::getFileAbsName($smartyValue); } $this->{$smartyVar} = tx_smarty_div::booleanize($smartyValue); } return true; }
/** * Note: This function is required but not available in earlier TYPO3 versions * Removes dots "." from end of a key identifier of TypoScript styled array. * array('key.' => array('property.' => 'value')) --> array('key' => array('property' => 'value')) * * @param array $ts: TypoScript configuration array * @return array TypoScript configuration array without dots at the end of all keys */ function removeDotsFromTS($ts) { $out = array(); if (is_array($ts)) { foreach ($ts as $key => $value) { if (is_array($value)) { $key = rtrim($key, '.'); $out[$key] = tx_smarty_div::removeDotsFromTS($value); } else { $out[$key] = $value; } } } return $out; }