本文整理汇总了PHP中Dwoo_Compiler::compilerFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo_Compiler::compilerFactory方法的具体用法?PHP Dwoo_Compiler::compilerFactory怎么用?PHP Dwoo_Compiler::compilerFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dwoo_Compiler
的用法示例。
在下文中一共展示了Dwoo_Compiler::compilerFactory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compilerFactory
public static function compilerFactory()
{
if (!isset(static::$_instance_compiler)) {
static::$_instance_compiler = \Dwoo_Compiler::compilerFactory();
}
return static::$_instance_compiler;
}
示例2: getCompiler
/**
* Return the Dwoo compiler object
*
* @return Dwoo_Data
*/
public function getCompiler()
{
if (null === $this->_compiler) {
$this->_compiler = Dwoo_Compiler::compilerFactory();
}
return $this->_compiler;
}
示例3: compilerFactory
/**
* provides a custom compiler to the dwoo renderer with optional settings
* you can set in the agavi output_types.xml config file
*
* @return Dwoo_Compiler
*/
public function compilerFactory()
{
if (class_exists('Dwoo_Compiler', false) === false) {
include DWOO_DIRECTORY . 'Dwoo/Compiler.php';
}
$compiler = Dwoo_Compiler::compilerFactory();
$compiler->setAutoEscape((bool) $this->getParameter('auto_escape', false));
return $compiler;
}
示例4: getCompiledTemplate
/**
* returns the compiled template file name
*
* @param Dwoo $dwoo the dwoo instance that requests it
* @param Dwoo_ICompiler $compiler the compiler that must be used
* @return string
*/
public function getCompiledTemplate(Dwoo $dwoo, Dwoo_ICompiler $compiler = null)
{
$compiledFile = $this->getCompiledFilename($dwoo);
if ($this->compilationEnforced !== true && isset(self::$cache['compiled'][$this->compileId]) === true) {
// already checked, return compiled file
} elseif ($this->compilationEnforced !== true && $this->isValidCompiledFile($compiledFile)) {
// template is compiled
self::$cache['compiled'][$this->compileId] = true;
} else {
// compiles the template
$this->compilationEnforced = false;
if ($compiler === null) {
$compiler = $dwoo->getDefaultCompilerFactory($this->getResourceName());
if ($compiler === null || $compiler === array('Dwoo_Compiler', 'compilerFactory')) {
if (class_exists('Dwoo_Compiler', false) === false) {
include DWOO_DIRECTORY . 'Dwoo/Compiler.php';
}
$compiler = Dwoo_Compiler::compilerFactory();
} else {
$compiler = call_user_func($compiler);
}
}
$this->compiler = $compiler;
$compiler->setCustomPlugins($dwoo->getCustomPlugins());
$compiler->setSecurityPolicy($dwoo->getSecurityPolicy());
$this->makeDirectory(dirname($compiledFile));
file_put_contents($compiledFile, $compiler->compile($dwoo, $this));
if ($this->chmod !== null) {
chmod($compiledFile, $this->chmod);
}
self::$cache['compiled'][$this->compileId] = true;
}
return $compiledFile;
}
示例5: getCompiledTemplate
/**
* returns the compiled template file name
*
* @param Dwoo_Core $dwoo the dwoo instance that requests it
* @param Dwoo_ICompiler $compiler the compiler that must be used
* @return string
*/
public function getCompiledTemplate(Dwoo_Core $dwoo, Dwoo_ICompiler $compiler = null)
{
$compiledFile = $this->getCompiledFilename($dwoo);
if ($this->compilationEnforced !== true && isset(self::$cache['compiled'][$this->compileId]) === true) {
// already checked, return compiled file
} elseif ($this->compilationEnforced !== true && $this->isValidCompiledFile($compiledFile)) {
// template is compiled
self::$cache['compiled'][$this->compileId] = true;
} else {
// compiles the template
$this->compilationEnforced = false;
if ($compiler === null) {
$compiler = $dwoo->getDefaultCompilerFactory($this->getResourceName());
if ($compiler === null || $compiler === array('Dwoo_Compiler', 'compilerFactory')) {
$compiler = Dwoo_Compiler::compilerFactory();
} else {
$compiler = call_user_func($compiler);
}
}
$this->compiler = $compiler;
$compiler->setCustomPlugins($dwoo->getCustomPlugins());
$compiler->setSecurityPolicy($dwoo->getSecurityPolicy());
$this->makeDirectory(dirname($compiledFile), $dwoo->getCompileDir());
file_put_contents($compiledFile, $compiler->compile($dwoo, $this));
if ($this->chmod !== null) {
chmod($compiledFile, $this->chmod);
}
if (extension_loaded('Zend OPcache')) {
opcache_invalidate($compiledFile);
} elseif (extension_loaded('apc')) {
apc_compile_file($compiledFile);
}
self::$cache['compiled'][$this->compileId] = true;
}
return $compiledFile;
}
示例6: compilerFactory
/**
* returns a compiler object when one is required
*
* @return Dwoo_Compiler
*/
public function compilerFactory()
{
$compiler = Dwoo_Compiler::compilerFactory();
$compiler->setDelimiters($this->left_delimiter, $this->right_delimiter);
$compiler->setAutoEscape(true);
return $compiler;
}