本文整理汇总了PHP中ezcBaseFile::isAbsolutepath方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFile::isAbsolutepath方法的具体用法?PHP ezcBaseFile::isAbsolutepath怎么用?PHP ezcBaseFile::isAbsolutepath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFile
的用法示例。
在下文中一共展示了ezcBaseFile::isAbsolutepath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Processes the specified template source and returns the output string.
*
* Note: The first time a template is accessed it needs to be compiled so the
* execution time will be higher than subsequent calls.
*
* @param string $location The path to the template file to process, can be a PHP stream.
* @param ezcTemplateConfiguration $config Optional configuration object which overrides
* the default one defined in this object ($configuration).
* @return string
*
* @apichange Remove the test for ezcTemplateLocationInterface as it's deprecated.
*
* @throws ezcTemplateParserException
* If the template could not be compiled.
* @throws ezcTemplateFileNotWriteableException
* If the directory could not be created.
*/
public function process($location, ezcTemplateConfiguration $config = null)
{
if ($config === null) {
$config = $this->configuration;
}
$this->properties["usedConfiguration"] = $config;
$this->properties["tstTree"] = false;
$this->properties["astTree"] = false;
$this->properties["stream"] = $location;
if ($location instanceof ezcTemplateLocation || $location instanceof ezcTemplateLocationInterface) {
$this->properties["file"] = $location;
$this->properties["stream"] = $location->getPath();
} elseif ($config->locator) {
$this->properties["stream"] = $config->locator->translatePath($this->properties["stream"]);
}
if (strlen($this->properties["stream"]) > 0 && !ezcBaseFile::isAbsolutepath($this->properties["stream"])) {
$this->properties["stream"] = $config->templatePath . DIRECTORY_SEPARATOR . $this->properties["stream"];
}
$this->properties["streamStack"][] = $this->properties["stream"];
// lookup compiled code here
$compiled = ezcTemplateCompiledCode::findCompiled($this->properties["stream"], $config->context, $this);
$this->properties["compiledTemplatePath"] = $compiled->path;
$counter = 0;
while (true) {
++$counter;
if ($counter > 3) {
// @todo fix exception
throw new ezcTemplateCompilationFailedException("Failed to create and execute compiled code after " . ($counter - 1) . " tries.");
}
if (file_exists($compiled->path) && (!$config->checkModifiedTemplates || filemtime($this->properties["stream"]) <= filemtime($compiled->path))) {
if (!$config->executeTemplate) {
$this->properties["output"] = "";
return "";
}
try {
// execute compiled code here
$this->properties["output"] = $compiled->execute();
return $this->properties["output"];
} catch (ezcTemplateOutdatedCompilationException $e) {
// The compiled file cannot be used so we need to recompile it
}
}
$this->createDirectory(dirname($compiled->path));
// get the compiled path.
// use parser here
$source = new ezcTemplateSourceCode($this->properties["stream"], $this->properties["stream"]);
$source->load();
$parser = new ezcTemplateParser($source, $this);
$this->properties["tstTree"] = $parser->parseIntoNodeTree();
if ($parser->hasCacheBlocks && !$config->disableCache) {
$fetchCacheInfo = new ezcTemplateFetchCacheInformation();
$this->properties["tstTree"]->accept($fetchCacheInfo);
$tstToAst = new ezcTemplateTstToAstCachedTransformer($parser, $fetchCacheInfo->cacheTst);
} else {
$tstToAst = new ezcTemplateTstToAstTransformer($parser);
}
$this->properties["tstTree"]->accept($tstToAst);
$this->properties["astTree"] = $tstToAst->programNode;
$astToAst = new ezcTemplateAstToAstContextAppender($config->context);
$tstToAst->programNode->accept($astToAst);
// Extra optimization.
$astToAst = new ezcTemplateAstToAstAssignmentOptimizer();
$tstToAst->programNode->accept($astToAst);
$g = new ezcTemplateAstToPhpGenerator($compiled->path, $config);
// Write to the file.
$tstToAst->programNode->accept($g);
// Add to the cache system.
if ($config->cacheManager) {
$config->cacheManager->includeTemplate($this, $this->properties["stream"]);
}
}
// execute compiled code here
throw new ezcTemplateInternalException("Compilation or execution failed");
}