本文整理匯總了PHP中eZTemplateCompiler::compilationDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZTemplateCompiler::compilationDirectory方法的具體用法?PHP eZTemplateCompiler::compilationDirectory怎麽用?PHP eZTemplateCompiler::compilationDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZTemplateCompiler
的用法示例。
在下文中一共展示了eZTemplateCompiler::compilationDirectory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generatePHPCodeChildren
//.........這裏部分代碼省略.........
/* We always DO need to execute this part if we
* don't have any fallback code. If we can
* generate the fallback code we make the
* included template compile on demand */
if (!$tmpResourceData['compiled-template'] and $resourceCanCache and $tpl->canCompileTemplate($tmpResourceData, $node[5]) and !$useFallbackCode) {
$generateStatus = $tpl->compileTemplate($tmpResourceData, $node[5]);
// Time limit #2:
/* We reset the time limit to 60 seconds to
* ensure that remaining template has
* enough time to compile. However if time
* limit is unlimited (0) we leave it be */
$maxExecutionTime = ini_get('max_execution_time');
if ($maxExecutionTime != 0 && $maxExecutionTime < 60) {
@set_time_limit(60);
}
if ($generateStatus) {
$tmpResourceData['compiled-template'] = true;
}
}
}
$GLOBALS['eZTemplateCompilerResourceCache'][$tmpResourceData['template-filename']] =& $tmpResourceData;
}
}
setlocale(LC_CTYPE, $savedLocale);
$textName = eZTemplateCompiler::currentTextName($parameters);
if ($tmpResourceData['compiled-template']) {
$hasCompiledCode = true;
// if ( !eZTemplateCompiler::isFallbackResourceCodeEnabled() )
// $useFallbackCode = false;
$keyData = $tmpResourceData['key-data'];
$templatePath = $tmpResourceData['template-name'];
$key = $resourceObject->cacheKey($keyData, $tmpResourceData, $templatePath, $node[5]);
$cacheFileName = eZTemplateCompiler::compilationFilename($key, $tmpResourceData);
$directory = eZTemplateCompiler::compilationDirectory();
$phpScript = eZDir::path(array($directory, $cacheFileName));
$phpScriptText = $php->thisVariableText($phpScript, 0, 0, false);
$resourceMap[$uriKey] = array('key' => $uriKey, 'uri' => $uri, 'phpscript' => $phpScript);
}
}
}
if ($useComments) {
$variablePlacement = $node[6];
if ($variablePlacement) {
$originalText = eZTemplateCompiler::fetchTemplatePiece($variablePlacement);
$php->addComment("Resource Acquisition:", true, true, array('spacing' => $spacing));
$php->addComment($originalText, true, true, array('spacing' => $spacing));
}
}
if ($hasCompiledCode) {
if ($resourceVariableName) {
$phpScriptText = '$phpScript';
$phpScriptArray = array();
foreach ($resourceMap as $resourceMapItem) {
$phpScriptArray[$resourceMapItem['key']] = $resourceMapItem['phpscript'];
}
if (!$resourceFilename) {
$php->addVariable("phpScriptArray", $phpScriptArray, eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => $spacing));
$resourceVariableNameText = "\${$resourceVariableName}";
$php->addCodePiece("\$phpScript = isset( \$phpScriptArray[{$resourceVariableNameText}] ) ? \$phpScriptArray[{$resourceVariableNameText}] : false;\n", array('spacing' => $spacing));
} else {
$php->addVariable("phpScript", $phpScriptArray[$node[10]], eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => $spacing));
}
// The default is to only check if it exists
$modificationCheckText = "file_exists( {$phpScriptText} )";
if (eZTemplateCompiler::isDevelopmentModeEnabled()) {
$modificationCheckText = "@filemtime( {$phpScriptText} ) > filemtime( {$uriText} )";
示例2: clearTemplateCompileCache
/**
* Clear Template Compile cache
*/
static function clearTemplateCompileCache()
{
eZDir::recursiveDelete(eZTemplateCompiler::compilationDirectory());
}