本文整理汇总了PHP中TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::getVal方法的典型用法代码示例。如果您正苦于以下问题:PHP TypoScriptParser::getVal方法的具体用法?PHP TypoScriptParser::getVal怎么用?PHP TypoScriptParser::getVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
的用法示例。
在下文中一共展示了TypoScriptParser::getVal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveTypoScriptReferences
/**
* Render a TypoScript and resolve all references (eg. " < plugin.tx_form...") recursively
*
* @param array $typoScript
* @return array
* @todo Extract to core then...
*/
protected function resolveTypoScriptReferences(array $typoScript)
{
$ignoreKeys = array();
foreach ($typoScript as $key => $value) {
if (isset($ignoreKeys[$key])) {
continue;
}
// i am a reference
if ($value[0] === '<') {
if (isset($typoScript[$key . '.'])) {
$oldTypoScript = $typoScript[$key . '.'];
} else {
$oldTypoScript = array();
}
// detect search level
$referencePath = trim(substr($value, 1));
$dotPosition = strpos($referencePath, '.');
if ($dotPosition === 0) {
// same position x =< .y
list($flatValue, $arrayValue) = $this->typoScriptParser->getVal(substr($referencePath, 1), $typoScript);
} else {
list($flatValue, $arrayValue) = $this->typoScriptParser->getVal($referencePath, $GLOBALS['TSFE']->tmpl->setup);
}
if (is_array($arrayValue)) {
$typoScript[$key . '.'] = array_replace_recursive($arrayValue, $oldTypoScript);
}
if ($flatValue[0] === '<') {
$temporaryTypoScript = array('temp' => $flatValue, 'temp.' => $typoScript[$key . '.']);
$temporaryTypoScript = $this->resolveTypoScriptReferences($temporaryTypoScript);
$arrayValue = array_replace_recursive($temporaryTypoScript['temp.'], $arrayValue, $oldTypoScript);
}
if (is_array($arrayValue)) {
$typoScript[$key . '.'] = array_replace_recursive($arrayValue, $oldTypoScript);
} elseif (isset($flatValue)) {
$typoScript[$key] = $flatValue;
} else {
$typoScript[$key . '.'] = $oldTypoScript;
}
}
// if array, then look deeper
if (isset($typoScript[$key . '.'])) {
$ignoreKeys[$key . '.'] = true;
$typoScript[$key . '.'] = $this->resolveTypoScriptReferences($typoScript[$key . '.']);
} elseif (is_array($typoScript[$key])) {
// if array, then look deeper
$typoScript[$key] = $this->resolveTypoScriptReferences($typoScript[$key]);
}
}
return $typoScript;
}
示例2: __construct
/**
* SitemapRepository constructor.
* @SuppressWarnings(superglobals)
*/
public function __construct()
{
$this->typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class);
$this->pluginConfig = $this->typoScriptParser->getVal('plugin.tx_sitemapgenerator', $GLOBALS['TSFE']->tmpl->setup);
}
示例3: substituteConstantsCallBack
/**
* Call back method for preg_replace_callback in substituteConstants
*
* @param $matches
* @return string Replacement
* @see substituteConstants()
*/
public function substituteConstantsCallBack($matches)
{
$s = $this->parser->getVal($matches[1], $this->parser->setup);
return isset($s[0]) ? $s[0] : $matches[0];
}