本文整理匯總了PHP中eZTemplateCompiler::isExecutionEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZTemplateCompiler::isExecutionEnabled方法的具體用法?PHP eZTemplateCompiler::isExecutionEnabled怎麽用?PHP eZTemplateCompiler::isExecutionEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZTemplateCompiler
的用法示例。
在下文中一共展示了eZTemplateCompiler::isExecutionEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeCompilation
static function executeCompilation($tpl, &$textElements, $key, &$resourceData, $rootNamespace, $currentNamespace)
{
if (!eZTemplateCompiler::isCompilationEnabled()) {
return false;
}
if (!eZTemplateCompiler::isExecutionEnabled()) {
return false;
}
$cacheFileName = eZTemplateCompiler::compilationFilename($key, $resourceData);
$resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();
$directory = eZTemplateCompiler::compilationDirectory();
$phpScript = eZDir::path(array($directory, $cacheFileName));
if (file_exists($phpScript)) {
$text = false;
$helperStatus = eZTemplateCompiler::executeCompilationHelper($phpScript, $text, $tpl, $key, $resourceData, $rootNamespace, $currentNamespace);
if ($helperStatus) {
$textElements[] = $text;
return true;
} else {
eZDebug::writeError("Failed executing compiled template '{$phpScript}'", 'eZTemplateCompiler::executeCompilation');
}
} else {
eZDebug::writeError("Unknown compiled template '{$phpScript}'", 'eZTemplateCompiler::executeCompilation');
}
return false;
}
示例2: executeCompilation
/**
* Tries to execute the compiled template. Returns true if successful,
* returns false if the compilation is disabled or the compiled template
* does not exist.
*
* @param eZTemplate $tpl
* @param array $textElements
* @param string $key
* @param array $resourceData
* @param $rootNamespace
* @param $currentNamespace
*
* @throws eZTemplateFailedExecutingCompiledTemplate if the compiled
* template could not be executed
* @return bool
*/
static function executeCompilation($tpl, &$textElements, $key, &$resourceData, $rootNamespace, $currentNamespace)
{
if (!eZTemplateCompiler::isCompilationEnabled()) {
return false;
}
if (!eZTemplateCompiler::isExecutionEnabled()) {
return false;
}
$cacheFileName = eZTemplateCompiler::compilationFilename($key, $resourceData);
$resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();
$directory = eZTemplateCompiler::compilationDirectory();
$phpScript = eZDir::path(array($directory, $cacheFileName));
if (file_exists($phpScript)) {
$text = false;
$helperStatus = eZTemplateCompiler::executeCompilationHelper($phpScript, $text, $tpl, $key, $resourceData, $rootNamespace, $currentNamespace);
if ($helperStatus) {
$textElements[] = $text;
return true;
} else {
eZDebug::writeError("Failed executing compiled template '{$phpScript}'," . " if this file is valid, then the error is probably" . " related to APC usage, try restarting the webserver", __METHOD__);
throw new eZTemplateFailedExecutingCompiledTemplate("Failed executing a compiled template, see error.log for details");
}
} else {
eZDebug::writeError("Unknown compiled template '{$phpScript}'", __METHOD__);
}
return false;
}