PHP Class Smarty, shudong-share

Inheritance: extends Smarty_Internal_TemplateBase
Show file Open project: HFO4/shudong-share Class Usage Examples

Public Properties

Property Type Description
$_CHARSET The character set to adhere to (e.g. "UTF-8")
$_DATE_FORMAT The date format to be used internally (accepts date() and strftime())
$_IS_WINDOWS Flag denoting if operating system is windows
$_MBSTRING Flag denoting if Multibyte String functions are available
$_UTF8_MODIFIER Flag denoting if PCRE should run in UTF-8 mode
$_cacheresource_handlers array cache resource handler cache
$_current_file string required by the compiler for BC
$_dir_perms integer default dir permissions
$_file_perms integer default file permissions
$_muted_directories contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
$_parserdebug boolean internal flag to enable parser debugging
$_previous_error_handler error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()
$_resource_handlers array resource handler cache
$_smarty_vars array global internal smarty vars
$_tag_stack array block tag hierarchy
$allow_ambiguous_resources boolean allow ambiguous resources (that are made unique by the resource handler)
$allow_php_templates boolean controls if the php template file resource is allowed
$auto_literal boolean auto literal on delimiters with whitspace
$autoload_filters array autoload filter
$cache_id string Set this if you want different sets of cache files for the same templates.
$cache_lifetime integer cache lifetime in seconds
$cache_locking boolean Controls whether cache resources should emply locking mechanism
$cache_modified_check boolean check If-Modified-Since headers
$caching boolean caching enabled
$caching_type string Must be an element of $cache_resource_types.
$compile_check boolean check template for modifications?
$compile_id string Set this if you want different sets of compiled files for the same templates.
$compile_locking boolean locking concurrent compiles
$config_booleanize boolean Controls whether config values of on/true/yes and off/false/no get converted to boolean.
$config_overwrite boolean Controls whether variables with the same name overwrite each other.
$config_read_hidden boolean Controls whether hidden config sections/vars are read from the file.
$debug_tpl string Path of debug template.
$debugging boolean Setting this to true enables the debug-console.
$debugging_ctrl string
  • NONE => no debugging control allowed
  • URL => enable debugging when SMARTY_DEBUG is found in the URL.
$default_config_handler_func callable default config handler
$default_config_type string config type
$default_modifiers array default modifier
$default_plugin_handler_func callable default plugin handler
$default_resource_type string Must be an valid key of $registered_resources.
$default_template_handler_func callable default template handler
$direct_access_security boolean {@internal Currently used by Smarty_Internal_Template only.}}
$error_reporting integer When set, smarty uses this value as error_reporting-level.
$error_unassigned boolean display error on not assigned variables
$escape_html boolean autoescape variable output
$force_cache boolean force cache file creation
$force_compile boolean force template compiling?
$get_used_tags boolean Internal flag for getTags()
$global_tpl_vars assigned global tpl vars
$inheritance_merge_compiled_includes boolean template inheritance merge compiled includes
$joined_config_dir string joined config directory string used in cache keys
$joined_template_dir string joined template directory string used in cache keys
$left_delimiter string template left-delimiter
$locking_timeout float seconds to wait for acquiring a lock before ignoring the write lock
$merge_compiled_includes boolean merge compiled includes
$merged_templates_func array Saved parameter of merged templates during compilation
$php_handling integer controls handling of PHP-blocks
$plugin_search_order array plugin search order
$properties array internal config properties
$registered_cache_resources array registered cache resources
$registered_classes array registered classes
$registered_filters array registered filters
$registered_objects array registered objects
$registered_plugins array registered plugins
$registered_resources array registered resources
$right_delimiter string template right-delimiter
$security_class string This should be instance of Smarty_Security.
$security_policy Smarty_Security implementation of security class
$smarty Smarty self pointer to Smarty object
$smarty_debug_id type Only used when $debugging_ctrl is set to 'URL'. The name of the URL-parameter that activates debugging.
$start_time integer start time for execution time calculation
$template_functions array global template functions
$template_objects array cached template objects
$use_include_path boolean look up relative filepaths in include_path
$use_sub_dirs boolean use sub dirs for compiled/cached files?

Public Methods

Method Description
__clone ( ) <> set selfpointer on cloned object
__construct ( ) Initialize new Smarty object
__destruct ( ) Class destructor
__get ( string $name ) : mixed <> Generic getter.
__set ( string $name, mixed $value ) <> Generic setter.
addAutoloadFilters ( array $filters, string $type = null ) : Smarty Add autoload filters
addConfigDir ( string | array $config_dir, $key = null ) : Smarty Add config directory(s)
addDefaultModifiers ( array | string $modifiers ) : Smarty Add default modifiers
addPluginsDir ( $plugins_dir ) : Smarty Adds directory of plugin files
addTemplateDir ( string | array $template_dir, string $key = null ) : Smarty Add template directory(s)
clearAllCache ( integer $exp_time = null, string $type = null ) : integer Empty cache folder
clearCache ( string $template_name, string $cache_id = null, string $compile_id = null, integer $exp_time = null, string $type = null ) : integer Empty cache for a specific template
clearCompiledTemplate ( string $resource_name = null, string $compile_id = null, integer $exp_time = null ) : integer Delete compiled template file
compileAllConfig ( string $extension = '.conf', boolean $force_compile = false, integer $time_limit, integer $max_errors = null ) : integer Compile all config files
compileAllTemplates ( string $extension = '.tpl', boolean $force_compile = false, integer $time_limit, integer $max_errors = null ) : integer Compile all template files
createTemplate ( string $template, mixed $cache_id = null, mixed $compile_id = null, object $parent = null, boolean $do_clone = true ) : object creates a template object
disableSecurity ( ) : Smarty Disable security
enableSecurity ( string | Smarty_Security $security_class = null ) : Smarty Loads security class and enables security
getAutoloadFilters ( string $type = null ) : array Get autoload filters
getCacheDir ( ) : string Get cache directory
getCompileDir ( ) : string Get compiled directory
getConfigDir ( $index = null ) : array | string Get config directory
getDebugTemplate ( ) : string return name of debugging template
getDefaultModifiers ( ) : array Get default modifiers
getGlobal ( string $varname = null ) : string Returns a single or all global variables
getPluginsDir ( ) : array Get plugin directories
getTags ( Smarty_Internal_Template $template ) : array Return array of tag/attributes of all tags used by an template
getTemplateDir ( $index = null ) : array | string Get template directories
loadPlugin ( string $plugin_name, boolean $check = true ) : string | boolean Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName plugin filename format: plugintype.pluginname.php
muteExpectedErrors ( ) : void Enable error handler to mute expected messages
mutingErrorHandler ( integer $errno, $errstr, $errfile, $errline, $errcontext ) : boolean Error Handler to mute expected messages
setAutoloadFilters ( array $filters, string $type = null ) : Smarty Set autoload filters
setCacheDir ( string $cache_dir ) : Smarty Set cache directory
setCompileDir ( string $compile_dir ) : Smarty Set compile directory
setConfigDir ( $config_dir ) : Smarty Set config directory
setDebugTemplate ( string $tpl_name ) : Smarty set the debug template
setDefaultModifiers ( array | string $modifiers ) : Smarty Set default modifiers
setPluginsDir ( string | array $plugins_dir ) : Smarty Set plugins directory
setTemplateDir ( string | array $template_dir ) : Smarty Set template directory
templateExists ( string $resource_name ) : boolean Check if a template resource exists
testInstall ( array &$errors = null ) : boolean Run installation test
unmuteExpectedErrors ( ) : void Disable error handler muting expected messages

Method Details

__clone() public method

<> set selfpointer on cloned object
public __clone ( )

__construct() public method

Initialize new Smarty object
public __construct ( )

__destruct() public method

Class destructor
public __destruct ( )

__get() public method

Calls the appropriate getter function. Issues an E_USER_NOTICE if no valid getter is found.
public __get ( string $name ) : mixed
$name string property name
return mixed

__set() public method

Calls the appropriate setter function. Issues an E_USER_NOTICE if no valid setter is found.
public __set ( string $name, mixed $value )
$name string property name
$value mixed parameter passed to setter

addAutoloadFilters() public method

Add autoload filters
public addAutoloadFilters ( array $filters, string $type = null ) : Smarty
$filters array filters to load automatically
$type string "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
return Smarty current Smarty instance for chaining

addConfigDir() public method

Add config directory(s)
public addConfigDir ( string | array $config_dir, $key = null ) : Smarty
$config_dir string | array directory(s) of config sources
return Smarty current Smarty instance for chaining

addDefaultModifiers() public method

Add default modifiers
public addDefaultModifiers ( array | string $modifiers ) : Smarty
$modifiers array | string modifier or list of modifiers to add
return Smarty current Smarty instance for chaining

addPluginsDir() public method

Adds directory of plugin files
public addPluginsDir ( $plugins_dir ) : Smarty
return Smarty current Smarty instance for chaining

addTemplateDir() public method

Add template directory(s)
public addTemplateDir ( string | array $template_dir, string $key = null ) : Smarty
$template_dir string | array directory(s) of template sources
$key string of the array element to assign the template dir to
return Smarty current Smarty instance for chaining

clearAllCache() public method

Empty cache folder
public clearAllCache ( integer $exp_time = null, string $type = null ) : integer
$exp_time integer expiration time
$type string resource type
return integer number of cache files deleted

clearCache() public method

Empty cache for a specific template
public clearCache ( string $template_name, string $cache_id = null, string $compile_id = null, integer $exp_time = null, string $type = null ) : integer
$template_name string template name
$cache_id string cache id
$compile_id string compile id
$exp_time integer expiration time
$type string resource type
return integer number of cache files deleted

clearCompiledTemplate() public method

Delete compiled template file
public clearCompiledTemplate ( string $resource_name = null, string $compile_id = null, integer $exp_time = null ) : integer
$resource_name string template name
$compile_id string compile id
$exp_time integer expiration time
return integer number of template files deleted

compileAllConfig() public method

Compile all config files
public compileAllConfig ( string $extension = '.conf', boolean $force_compile = false, integer $time_limit, integer $max_errors = null ) : integer
$extension string file extension
$force_compile boolean force all to recompile
$time_limit integer
$max_errors integer
return integer number of template files recompiled

compileAllTemplates() public method

Compile all template files
public compileAllTemplates ( string $extension = '.tpl', boolean $force_compile = false, integer $time_limit, integer $max_errors = null ) : integer
$extension string file extension
$force_compile boolean force all to recompile
$time_limit integer
$max_errors integer
return integer number of template files recompiled

createTemplate() public method

creates a template object
public createTemplate ( string $template, mixed $cache_id = null, mixed $compile_id = null, object $parent = null, boolean $do_clone = true ) : object
$template string the resource handle of the template file
$cache_id mixed cache id to be used with this template
$compile_id mixed compile id to be used with this template
$parent object next higher level of Smarty variables
$do_clone boolean flag is Smarty object shall be cloned
return object template object

disableSecurity() public method

Disable security
public disableSecurity ( ) : Smarty
return Smarty current Smarty instance for chaining

enableSecurity() public method

Loads security class and enables security
public enableSecurity ( string | Smarty_Security $security_class = null ) : Smarty
$security_class string | Smarty_Security if a string is used, it must be class-name
return Smarty current Smarty instance for chaining

getAutoloadFilters() public method

Get autoload filters
public getAutoloadFilters ( string $type = null ) : array
$type string type of filter to get autoloads for. Defaults to all autoload filters
return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified

getCacheDir() public method

Get cache directory
public getCacheDir ( ) : string
return string path of cache directory

getCompileDir() public method

Get compiled directory
public getCompileDir ( ) : string
return string path to compiled templates

getConfigDir() public method

Get config directory
public getConfigDir ( $index = null ) : array | string
return array | string configuration directory

getDebugTemplate() public method

return name of debugging template
public getDebugTemplate ( ) : string
return string

getDefaultModifiers() public method

Get default modifiers
public getDefaultModifiers ( ) : array
return array list of default modifiers

getGlobal() public method

Returns a single or all global variables
public getGlobal ( string $varname = null ) : string
$varname string variable name or null
return string variable value or or array of variables

getPluginsDir() public method

Get plugin directories
public getPluginsDir ( ) : array
return array list of plugin directories

getTags() public method

Return array of tag/attributes of all tags used by an template
public getTags ( Smarty_Internal_Template $template ) : array
$template Smarty_Internal_Template
return array of tag/attributes

getTemplateDir() public method

Get template directories
public getTemplateDir ( $index = null ) : array | string
return array | string list of template directories, or directory of $index

loadPlugin() public method

Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName plugin filename format: plugintype.pluginname.php
public loadPlugin ( string $plugin_name, boolean $check = true ) : string | boolean
$plugin_name string class plugin name to load
$check boolean check if already loaded
return string | boolean |boolean filepath of loaded file or false

muteExpectedErrors() public static method

Enable error handler to mute expected messages
public static muteExpectedErrors ( ) : void
return void

mutingErrorHandler() public static method

Error Handler to mute expected messages
public static mutingErrorHandler ( integer $errno, $errstr, $errfile, $errline, $errcontext ) : boolean
$errno integer Error level
return boolean

setAutoloadFilters() public method

Set autoload filters
public setAutoloadFilters ( array $filters, string $type = null ) : Smarty
$filters array filters to load automatically
$type string "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
return Smarty current Smarty instance for chaining

setCacheDir() public method

Set cache directory
public setCacheDir ( string $cache_dir ) : Smarty
$cache_dir string directory to store cached templates in
return Smarty current Smarty instance for chaining

setCompileDir() public method

Set compile directory
public setCompileDir ( string $compile_dir ) : Smarty
$compile_dir string directory to store compiled templates in
return Smarty current Smarty instance for chaining

setConfigDir() public method

Set config directory
public setConfigDir ( $config_dir ) : Smarty
return Smarty current Smarty instance for chaining

setDebugTemplate() public method

set the debug template
public setDebugTemplate ( string $tpl_name ) : Smarty
$tpl_name string
return Smarty current Smarty instance for chaining

setDefaultModifiers() public method

Set default modifiers
public setDefaultModifiers ( array | string $modifiers ) : Smarty
$modifiers array | string modifier or list of modifiers to set
return Smarty current Smarty instance for chaining

setPluginsDir() public method

Set plugins directory
public setPluginsDir ( string | array $plugins_dir ) : Smarty
$plugins_dir string | array directory(s) of plugins
return Smarty current Smarty instance for chaining

setTemplateDir() public method

Set template directory
public setTemplateDir ( string | array $template_dir ) : Smarty
$template_dir string | array directory(s) of template sources
return Smarty current Smarty instance for chaining

templateExists() public method

Check if a template resource exists
public templateExists ( string $resource_name ) : boolean
$resource_name string template name
return boolean status

testInstall() public method

Run installation test
public testInstall ( array &$errors = null ) : boolean
$errors array Array to write errors into, rather than outputting them
return boolean true if setup is fine, false if something is wrong

unmuteExpectedErrors() public static method

Disable error handler muting expected messages
public static unmuteExpectedErrors ( ) : void
return void

Property Details

$_CHARSET public static property

The character set to adhere to (e.g. "UTF-8")
public static $_CHARSET

$_DATE_FORMAT public static property

The date format to be used internally (accepts date() and strftime())
public static $_DATE_FORMAT

$_IS_WINDOWS public static property

Flag denoting if operating system is windows
public static $_IS_WINDOWS

$_MBSTRING public static property

Flag denoting if Multibyte String functions are available
public static $_MBSTRING

$_UTF8_MODIFIER public static property

Flag denoting if PCRE should run in UTF-8 mode
public static $_UTF8_MODIFIER

$_cacheresource_handlers public property

cache resource handler cache
public array $_cacheresource_handlers
return array

$_current_file public property

required by the compiler for BC
public string $_current_file
return string

$_dir_perms public property

default dir permissions
public int $_dir_perms
return integer

$_file_perms public property

default file permissions
public int $_file_perms
return integer

$_muted_directories public static property

contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
public static $_muted_directories

$_parserdebug public property

internal flag to enable parser debugging
public bool $_parserdebug
return boolean

$_previous_error_handler public static property

error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()
public static $_previous_error_handler

$_resource_handlers public property

resource handler cache
public array $_resource_handlers
return array

$_smarty_vars public static property

global internal smarty vars
public static array $_smarty_vars
return array

$_tag_stack public property

block tag hierarchy
public array $_tag_stack
return array

$allow_ambiguous_resources public property

allow ambiguous resources (that are made unique by the resource handler)
public bool $allow_ambiguous_resources
return boolean

$allow_php_templates public property

controls if the php template file resource is allowed
public bool $allow_php_templates
return boolean

$auto_literal public property

auto literal on delimiters with whitspace
public bool $auto_literal
return boolean

$autoload_filters public property

autoload filter
public array $autoload_filters
return array

$cache_id public property

Set this if you want different sets of cache files for the same templates.
public string $cache_id
return string

$cache_lifetime public property

cache lifetime in seconds
public int $cache_lifetime
return integer

$cache_locking public property

Controls whether cache resources should emply locking mechanism
public bool $cache_locking
return boolean

$cache_modified_check public property

check If-Modified-Since headers
public bool $cache_modified_check
return boolean

$caching public property

caching enabled
public bool $caching
return boolean

$caching_type public property

Must be an element of $cache_resource_types.
public string $caching_type
return string

$compile_check public property

check template for modifications?
public bool $compile_check
return boolean

$compile_id public property

Set this if you want different sets of compiled files for the same templates.
public string $compile_id
return string

$compile_locking public property

locking concurrent compiles
public bool $compile_locking
return boolean

$config_booleanize public property

Controls whether config values of on/true/yes and off/false/no get converted to boolean.
public bool $config_booleanize
return boolean

$config_overwrite public property

Controls whether variables with the same name overwrite each other.
public bool $config_overwrite
return boolean

$config_read_hidden public property

Controls whether hidden config sections/vars are read from the file.
public bool $config_read_hidden
return boolean

$debug_tpl public property

Path of debug template.
public string $debug_tpl
return string

$debugging public property

Setting this to true enables the debug-console.
public bool $debugging
return boolean

$debugging_ctrl public property

  • NONE => no debugging control allowed
  • URL => enable debugging when SMARTY_DEBUG is found in the URL.
public string $debugging_ctrl
return string

$default_config_handler_func public property

default config handler
public callable $default_config_handler_func
return callable

$default_config_type public property

config type
public string $default_config_type
return string

$default_modifiers public property

default modifier
public array $default_modifiers
return array

$default_plugin_handler_func public property

default plugin handler
public callable $default_plugin_handler_func
return callable

$default_resource_type public property

Must be an valid key of $registered_resources.
public string $default_resource_type
return string

$default_template_handler_func public property

default template handler
public callable $default_template_handler_func
return callable

$direct_access_security public property

{@internal Currently used by Smarty_Internal_Template only.}}
public bool $direct_access_security
return boolean

$error_reporting public property

When set, smarty uses this value as error_reporting-level.
public int $error_reporting
return integer

$error_unassigned public property

display error on not assigned variables
public bool $error_unassigned
return boolean

$escape_html public property

autoescape variable output
public bool $escape_html
return boolean

$force_cache public property

force cache file creation
public bool $force_cache
return boolean

$force_compile public property

force template compiling?
public bool $force_compile
return boolean

$get_used_tags public property

Internal flag for getTags()
public bool $get_used_tags
return boolean

$global_tpl_vars public static property

assigned global tpl vars
public static $global_tpl_vars

$inheritance_merge_compiled_includes public property

template inheritance merge compiled includes
public bool $inheritance_merge_compiled_includes
return boolean

$joined_config_dir public property

joined config directory string used in cache keys
public string $joined_config_dir
return string

$joined_template_dir public property

joined template directory string used in cache keys
public string $joined_template_dir
return string

$left_delimiter public property

template left-delimiter
public string $left_delimiter
return string

$locking_timeout public property

seconds to wait for acquiring a lock before ignoring the write lock
public float $locking_timeout
return float

$merge_compiled_includes public property

merge compiled includes
public bool $merge_compiled_includes
return boolean

$merged_templates_func public property

Saved parameter of merged templates during compilation
public array $merged_templates_func
return array

$php_handling public property

controls handling of PHP-blocks
public int $php_handling
return integer

$plugin_search_order public property

plugin search order
public array $plugin_search_order
return array

$properties public property

internal config properties
public array $properties
return array

$registered_cache_resources public property

registered cache resources
public array $registered_cache_resources
return array

$registered_classes public property

registered classes
public array $registered_classes
return array

$registered_filters public property

registered filters
public array $registered_filters
return array

$registered_objects public property

registered objects
public array $registered_objects
return array

$registered_plugins public property

registered plugins
public array $registered_plugins
return array

$registered_resources public property

registered resources
public array $registered_resources
return array

$right_delimiter public property

template right-delimiter
public string $right_delimiter
return string

$security_class public property

This should be instance of Smarty_Security.
See also: Smarty_Security
public string $security_class
return string

$security_policy public property

implementation of security class
public Smarty_Security $security_policy
return Smarty_Security

$smarty public property

self pointer to Smarty object
public Smarty $smarty
return Smarty

$smarty_debug_id public property

Only used when $debugging_ctrl is set to 'URL'. The name of the URL-parameter that activates debugging.
public type $smarty_debug_id
return type

$start_time public property

start time for execution time calculation
public int $start_time
return integer

$template_functions public property

global template functions
public array $template_functions
return array

$template_objects public property

cached template objects
public array $template_objects
return array

$use_include_path public property

look up relative filepaths in include_path
public bool $use_include_path
return boolean

$use_sub_dirs public property

use sub dirs for compiled/cached files?
public bool $use_sub_dirs
return boolean