PHP 클래스 Haanga

Simple class to call templates efficiently. This class aims to reduce the compilation of a template as less a possible. Also it will not load in memory the compiler, except when there is not cache (compiled template) or it is out-dated.
파일 보기 프로젝트 열기: crodas/haanga 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$has_compiled

보호된 프로퍼티들

프로퍼티 타입 설명
$bootstrap
$cache_dir
$check_get
$check_set
$check_ttl
$compiler
$debug
$hash_filename
$templates_dir
$use_autoload

공개 메소드들

메소드 설명
Load ( string $file, array $vars = [], boolean $return = FALSE, array $blocks = [] ) : string | null Load
Safe_Load ( $file, $vars = [], $return = FALSE, $blocks = [] ) safe_load(string $file, array $vars, bool $return, array $blocks) {{{
checkCacheDir ( ) : void Check the directory where the compiled templates are stored.
compile ( string $tpl, array $context = [] ) : callback($vars=array(), Compile one template and return a PHP function
configure ( array $opts ) : void Configuration to load Haanga
enableDebug ( $bool ) enableDebug($bool) {{{
getTemplateDir ( )
getTemplatePath ( $file ) }}}

보호된 메소드들

메소드 설명
getCompiler ( boolean $checkdir = TRUE ) : Haanga_Compiler_Runtime This function is a singleton for the Haanga_Compiler_Runtime class.

비공개 메소드들

메소드 설명
__construct ( )

메소드 상세

Load() 공개 정적인 메소드

Load template. If the template is already compiled, just the compiled PHP file will be included an used. If the template is new, or it had changed, the Haanga compiler is loaded in memory, and the template is compiled.
public static Load ( string $file, array $vars = [], boolean $return = FALSE, array $blocks = [] ) : string | null
$file string @param array $vars @param bool $return @param array $blocks @return string|NULL
$vars array
$return boolean
$blocks array
리턴 string | null

Safe_Load() 공개 정적인 메소드

safe_load(string $file, array $vars, bool $return, array $blocks) {{{
public static Safe_Load ( $file, $vars = [], $return = FALSE, $blocks = [] )

checkCacheDir() 공개 정적인 메소드

@param string $dir
public static checkCacheDir ( ) : void
리턴 void

compile() 공개 정적인 메소드

@param string $tpl Template body
public static compile ( string $tpl, array $context = [] ) : callback($vars=array(),
$tpl string
$context array Context variables useful to generate efficient code (for array, objects and array) @return callback($vars=array(), $return=TRUE, $block=array())
리턴 callback($vars=array(),

configure() 최종 공개 정적인 메소드

Options: - (string) cache_dir - (string) tempalte_dir - (callback) on_compile - (boolean) debug - (int) check_ttl - (callback) check_get - (callback) check_set - (boolean) autoload - (boolean) use_hash_filename
final public static configure ( array $opts ) : void
$opts array
리턴 void

enableDebug() 공개 정적인 메소드

enableDebug($bool) {{{
public static enableDebug ( $bool )

getCompiler() 보호된 정적인 메소드

The instance is already set up properly and resetted.
protected static getCompiler ( boolean $checkdir = TRUE ) : Haanga_Compiler_Runtime
$checkdir boolean TRUE @return Haanga_Compiler_Runtime
리턴 Haanga_Compiler_Runtime

getTemplateDir() 공개 정적인 메소드

public static getTemplateDir ( )

getTemplatePath() 공개 정적인 메소드

}}}
public static getTemplatePath ( $file )

프로퍼티 상세

$bootstrap 보호되어 있는 정적으로 프로퍼티

protected static $bootstrap

$cache_dir 보호되어 있는 정적으로 프로퍼티

protected static $cache_dir

$check_get 보호되어 있는 정적으로 프로퍼티

protected static $check_get

$check_set 보호되어 있는 정적으로 프로퍼티

protected static $check_set

$check_ttl 보호되어 있는 정적으로 프로퍼티

protected static $check_ttl

$compiler 보호되어 있는 정적으로 프로퍼티

protected static $compiler

$debug 보호되어 있는 정적으로 프로퍼티

protected static $debug

$has_compiled 공개적으로 정적으로 프로퍼티

public static $has_compiled

$hash_filename 보호되어 있는 정적으로 프로퍼티

protected static $hash_filename

$templates_dir 보호되어 있는 정적으로 프로퍼티

protected static $templates_dir

$use_autoload 보호되어 있는 정적으로 프로퍼티

protected static $use_autoload