本文整理匯總了PHP中XenForo_Template_Compiler::compileNamedParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Template_Compiler::compileNamedParams方法的具體用法?PHP XenForo_Template_Compiler::compileNamedParams怎麽用?PHP XenForo_Template_Compiler::compileNamedParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_Template_Compiler
的用法示例。
在下文中一共展示了XenForo_Template_Compiler::compileNamedParams方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compile
/**
* Compiles the phrase call.
*
* @param XenForo_Template_Compiler The invoking compiler
* @param string Name of the function called
* @param array Arguments to the function (should have at least 1)
* @param array Compilation options
*
* @return string
*/
public function compile(XenForo_Template_Compiler $compiler, $function, array $arguments, array $options)
{
$argc = count($arguments);
if ($argc < 1) {
throw $compiler->getNewCompilerArgumentException();
}
$phraseName = $compiler->getArgumentLiteralValue(array_shift($arguments));
if ($phraseName === false) {
throw $compiler->getNewCompilerException(new XenForo_Phrase('phrase_name_must_be_literal'));
}
$phraseValue = $compiler->getPhraseValue($phraseName);
if ($phraseValue === false) {
return "'" . $compiler->escapeSingleQuotedString($phraseName) . "'";
}
$this->_params = $compiler->compileNamedParams($compiler->parseNamedArguments($arguments), $options);
$phraseValueEscaped = $compiler->escapeSingleQuotedString($phraseValue);
$phraseValueEscaped = preg_replace_callback('/\\{([a-z0-9_-]+)\\}/i', array($this, '_replaceParam'), $phraseValueEscaped);
if ($phraseValueEscaped === '') {
return '';
}
$this->_params = array();
return "'" . $phraseValueEscaped . "'";
}
示例2: _compileRowOptions
/**
* Helper to compile the standard row options with the default options.
*
* @param XenForo_Template_Compiler $compiler
* @param array $rowOptions
* @param array $compilerOptions
*
* @return string
*/
protected function _compileRowOptions(XenForo_Template_Compiler $compiler, array $rowOptions, array $compilerOptions, &$htmlCode = '', &$htmlOutputVar = '')
{
if (isset($rowOptions['html'])) {
$htmlCode = $compiler->compileIntoVariable($rowOptions['html'], $htmlOutputVar, $compilerOptions);
unset($rowOptions['html']);
} else {
$htmlCode = '';
$htmlOutputVar = '';
}
$params = $compiler->compileNamedParams($rowOptions, $compilerOptions, array('labelHidden'));
if ($htmlCode !== '' && !empty($htmlOutputVar)) {
$params["html"] = '$' . $htmlOutputVar;
}
return $compiler->buildNamedParamCode($params);
}