/** * Compile the function and return PHP handle it. * * @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) { if (count($arguments) < 1) { throw $compiler->getNewCompilerArgumentException(); } $noEscapeOptions = array_merge($options, array('varEscape' => false)); $functionCompiled = $compiler->compileAndCombineSegments(array_shift($arguments), $noEscapeOptions); $outputArgs = array(); foreach ($arguments as $argument) { $outputArgs[] = $compiler->compileAndCombineSegments($argument, $noEscapeOptions); } $argumentsCompiled = $compiler->buildNamedParamCode($outputArgs); return 'XenForo_Template_Helper_Core::callHelper(' . $functionCompiled . ', ' . $argumentsCompiled . ')'; }
/** * 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); }