本文整理匯總了PHP中XenForo_Template_Compiler::lexAndParse方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Template_Compiler::lexAndParse方法的具體用法?PHP XenForo_Template_Compiler::lexAndParse怎麽用?PHP XenForo_Template_Compiler::lexAndParse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_Template_Compiler
的用法示例。
在下文中一共展示了XenForo_Template_Compiler::lexAndParse方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parse
public static function parse($raw)
{
$compiler = new XenForo_Template_Compiler(sprintf('<xen:if is="%s">%s</xen:if>', $raw, md5($raw)));
$compiler->addFunctionHandler('helper', new WidgetFramework_Helper_Conditional_Function_Helper());
$parsed = $compiler->lexAndParse();
$compiler->setFollowExternal(false);
$parsed = $compiler->compileParsed($parsed, __CLASS__, 0, 0);
return $parsed;
}
示例2: _verifyPrepareTemplate
/**
* Verification callback to prepare a template. This isn't actually a verifier;
* it just automatically compiles the template.
*
* @param string $string Uncompiled template
*
* @return boolean
*/
protected function _verifyPrepareTemplate($template)
{
$standardParse = true;
$parsed = null;
if (!$this->get('disable_modifications')) {
$templateWithModifications = $this->_getModificationModel()->applyModificationsToTemplate($this->get('title'), $template, $modificationStatuses);
} else {
$modificationStatuses = null;
$templateWithModifications = $template;
}
if ($modificationStatuses) {
try {
$compiler = new XenForo_Template_Compiler($templateWithModifications);
$parsed = $compiler->lexAndParse();
if ($this->getOption(self::OPTION_TEST_COMPILE)) {
$compiler->setFollowExternal(false);
$compiler->compileParsed($parsed, $this->get('title'), 0, 0);
}
$standardParse = false;
} catch (XenForo_Template_Compiler_Exception $e) {
foreach ($modificationStatuses as &$status) {
if (is_int($status)) {
$status = 'error_compile';
}
}
}
}
if ($standardParse) {
try {
$compiler = new XenForo_Template_Compiler($template);
$parsed = $compiler->lexAndParse();
if ($this->getOption(self::OPTION_TEST_COMPILE)) {
$compiler->setFollowExternal(false);
$compiler->compileParsed($parsed, $this->get('title'), 0, 0);
}
} catch (XenForo_Template_Compiler_Exception $e) {
$this->error($e->getMessage(), 'template');
return false;
}
}
$this->set('template_parsed', serialize($parsed));
$this->_modificationStatuses = $modificationStatuses;
return true;
}
示例3: VerifyTemplate
protected static function VerifyTemplate(array $option, &$value, &$error)
{
try {
$compiler = new XenForo_Template_Compiler($value);
$parsed = $compiler->lexAndParse();
$compiler->setFollowExternal(false);
$compiler->compileParsed($parsed, '', 0, 0);
} catch (XenForo_Template_Compiler_Exception $e) {
$error = $e->getMessage();
return false;
}
return true;
}
示例4: _verifyPrepareTemplate
/**
* Verification callback to prepare a template. This isn't actually a verifier;
* it just automatically compiles the template.
*
* @param string Uncompiled template
*
* @return true
*/
protected function _verifyPrepareTemplate($template)
{
try {
$compiler = new XenForo_Template_Compiler($template);
$parsed = $compiler->lexAndParse();
if ($this->getOption(self::OPTION_TEST_COMPILE)) {
$compiler->setFollowExternal(false);
$compiler->compileParsed($parsed, $this->get('title'), 0, 0);
}
} catch (XenForo_Template_Compiler_Exception $e) {
$this->error($e->getMessage(), 'template');
return false;
}
$this->set('template_parsed', serialize($parsed));
return true;
}