PHP Класс Smarty, shudong-share

Наследование: extends Smarty_Internal_TemplateBase
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_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?

Открытые методы

Метод Описание
__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

Описание методов

__clone() публичный метод

<> set selfpointer on cloned object
public __clone ( )

__construct() публичный метод

Initialize new Smarty object
public __construct ( )

__destruct() публичный метод

Class destructor
public __destruct ( )

__get() публичный метод

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
Результат mixed

__set() публичный метод

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() публичный метод

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
Результат Smarty current Smarty instance for chaining

addConfigDir() публичный метод

Add config directory(s)
public addConfigDir ( string | array $config_dir, $key = null ) : Smarty
$config_dir string | array directory(s) of config sources
Результат Smarty current Smarty instance for chaining

addDefaultModifiers() публичный метод

Add default modifiers
public addDefaultModifiers ( array | string $modifiers ) : Smarty
$modifiers array | string modifier or list of modifiers to add
Результат Smarty current Smarty instance for chaining

addPluginsDir() публичный метод

Adds directory of plugin files
public addPluginsDir ( $plugins_dir ) : Smarty
Результат Smarty current Smarty instance for chaining

addTemplateDir() публичный метод

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
Результат Smarty current Smarty instance for chaining

clearAllCache() публичный метод

Empty cache folder
public clearAllCache ( integer $exp_time = null, string $type = null ) : integer
$exp_time integer expiration time
$type string resource type
Результат integer number of cache files deleted

clearCache() публичный метод

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
Результат integer number of cache files deleted

clearCompiledTemplate() публичный метод

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
Результат integer number of template files deleted

compileAllConfig() публичный метод

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
Результат integer number of template files recompiled

compileAllTemplates() публичный метод

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
Результат integer number of template files recompiled

createTemplate() публичный метод

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
Результат object template object

disableSecurity() публичный метод

Disable security
public disableSecurity ( ) : Smarty
Результат Smarty current Smarty instance for chaining

enableSecurity() публичный метод

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
Результат Smarty current Smarty instance for chaining

getAutoloadFilters() публичный метод

Get autoload filters
public getAutoloadFilters ( string $type = null ) : array
$type string type of filter to get autoloads for. Defaults to all autoload filters
Результат array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified

getCacheDir() публичный метод

Get cache directory
public getCacheDir ( ) : string
Результат string path of cache directory

getCompileDir() публичный метод

Get compiled directory
public getCompileDir ( ) : string
Результат string path to compiled templates

getConfigDir() публичный метод

Get config directory
public getConfigDir ( $index = null ) : array | string
Результат array | string configuration directory

getDebugTemplate() публичный метод

return name of debugging template
public getDebugTemplate ( ) : string
Результат string

getDefaultModifiers() публичный метод

Get default modifiers
public getDefaultModifiers ( ) : array
Результат array list of default modifiers

getGlobal() публичный метод

Returns a single or all global variables
public getGlobal ( string $varname = null ) : string
$varname string variable name or null
Результат string variable value or or array of variables

getPluginsDir() публичный метод

Get plugin directories
public getPluginsDir ( ) : array
Результат array list of plugin directories

getTags() публичный метод

Return array of tag/attributes of all tags used by an template
public getTags ( Smarty_Internal_Template $template ) : array
$template Smarty_Internal_Template
Результат array of tag/attributes

getTemplateDir() публичный метод

Get template directories
public getTemplateDir ( $index = null ) : array | string
Результат array | string list of template directories, or directory of $index

loadPlugin() публичный метод

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
Результат string | boolean |boolean filepath of loaded file or false

muteExpectedErrors() публичный статический метод

Enable error handler to mute expected messages
public static muteExpectedErrors ( ) : void
Результат void

mutingErrorHandler() публичный статический метод

Error Handler to mute expected messages
public static mutingErrorHandler ( integer $errno, $errstr, $errfile, $errline, $errcontext ) : boolean
$errno integer Error level
Результат boolean

setAutoloadFilters() публичный метод

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
Результат Smarty current Smarty instance for chaining

setCacheDir() публичный метод

Set cache directory
public setCacheDir ( string $cache_dir ) : Smarty
$cache_dir string directory to store cached templates in
Результат Smarty current Smarty instance for chaining

setCompileDir() публичный метод

Set compile directory
public setCompileDir ( string $compile_dir ) : Smarty
$compile_dir string directory to store compiled templates in
Результат Smarty current Smarty instance for chaining

setConfigDir() публичный метод

Set config directory
public setConfigDir ( $config_dir ) : Smarty
Результат Smarty current Smarty instance for chaining

setDebugTemplate() публичный метод

set the debug template
public setDebugTemplate ( string $tpl_name ) : Smarty
$tpl_name string
Результат Smarty current Smarty instance for chaining

setDefaultModifiers() публичный метод

Set default modifiers
public setDefaultModifiers ( array | string $modifiers ) : Smarty
$modifiers array | string modifier or list of modifiers to set
Результат Smarty current Smarty instance for chaining

setPluginsDir() публичный метод

Set plugins directory
public setPluginsDir ( string | array $plugins_dir ) : Smarty
$plugins_dir string | array directory(s) of plugins
Результат Smarty current Smarty instance for chaining

setTemplateDir() публичный метод

Set template directory
public setTemplateDir ( string | array $template_dir ) : Smarty
$template_dir string | array directory(s) of template sources
Результат Smarty current Smarty instance for chaining

templateExists() публичный метод

Check if a template resource exists
public templateExists ( string $resource_name ) : boolean
$resource_name string template name
Результат boolean status

testInstall() публичный метод

Run installation test
public testInstall ( array &$errors = null ) : boolean
$errors array Array to write errors into, rather than outputting them
Результат boolean true if setup is fine, false if something is wrong

unmuteExpectedErrors() публичный статический метод

Disable error handler muting expected messages
public static unmuteExpectedErrors ( ) : void
Результат void

Описание свойств

$_CHARSET публичное статическое свойство

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

$_DATE_FORMAT публичное статическое свойство

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

$_IS_WINDOWS публичное статическое свойство

Flag denoting if operating system is windows
public static $_IS_WINDOWS

$_MBSTRING публичное статическое свойство

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

$_UTF8_MODIFIER публичное статическое свойство

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

$_cacheresource_handlers публичное свойство

cache resource handler cache
public array $_cacheresource_handlers
Результат array

$_current_file публичное свойство

required by the compiler for BC
public string $_current_file
Результат string

$_dir_perms публичное свойство

default dir permissions
public int $_dir_perms
Результат integer

$_file_perms публичное свойство

default file permissions
public int $_file_perms
Результат integer

$_muted_directories публичное статическое свойство

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

$_parserdebug публичное свойство

internal flag to enable parser debugging
public bool $_parserdebug
Результат boolean

$_previous_error_handler публичное статическое свойство

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

$_resource_handlers публичное свойство

resource handler cache
public array $_resource_handlers
Результат array

$_smarty_vars публичное статическое свойство

global internal smarty vars
public static array $_smarty_vars
Результат array

$_tag_stack публичное свойство

block tag hierarchy
public array $_tag_stack
Результат array

$allow_ambiguous_resources публичное свойство

allow ambiguous resources (that are made unique by the resource handler)
public bool $allow_ambiguous_resources
Результат boolean

$allow_php_templates публичное свойство

controls if the php template file resource is allowed
public bool $allow_php_templates
Результат boolean

$auto_literal публичное свойство

auto literal on delimiters with whitspace
public bool $auto_literal
Результат boolean

$autoload_filters публичное свойство

autoload filter
public array $autoload_filters
Результат array

$cache_id публичное свойство

Set this if you want different sets of cache files for the same templates.
public string $cache_id
Результат string

$cache_lifetime публичное свойство

cache lifetime in seconds
public int $cache_lifetime
Результат integer

$cache_locking публичное свойство

Controls whether cache resources should emply locking mechanism
public bool $cache_locking
Результат boolean

$cache_modified_check публичное свойство

check If-Modified-Since headers
public bool $cache_modified_check
Результат boolean

$caching публичное свойство

caching enabled
public bool $caching
Результат boolean

$caching_type публичное свойство

Must be an element of $cache_resource_types.
public string $caching_type
Результат string

$compile_check публичное свойство

check template for modifications?
public bool $compile_check
Результат boolean

$compile_id публичное свойство

Set this if you want different sets of compiled files for the same templates.
public string $compile_id
Результат string

$compile_locking публичное свойство

locking concurrent compiles
public bool $compile_locking
Результат boolean

$config_booleanize публичное свойство

Controls whether config values of on/true/yes and off/false/no get converted to boolean.
public bool $config_booleanize
Результат boolean

$config_overwrite публичное свойство

Controls whether variables with the same name overwrite each other.
public bool $config_overwrite
Результат boolean

$config_read_hidden публичное свойство

Controls whether hidden config sections/vars are read from the file.
public bool $config_read_hidden
Результат boolean

$debug_tpl публичное свойство

Path of debug template.
public string $debug_tpl
Результат string

$debugging публичное свойство

Setting this to true enables the debug-console.
public bool $debugging
Результат boolean

$debugging_ctrl публичное свойство

  • NONE => no debugging control allowed
  • URL => enable debugging when SMARTY_DEBUG is found in the URL.
public string $debugging_ctrl
Результат string

$default_config_handler_func публичное свойство

default config handler
public callable $default_config_handler_func
Результат callable

$default_config_type публичное свойство

config type
public string $default_config_type
Результат string

$default_modifiers публичное свойство

default modifier
public array $default_modifiers
Результат array

$default_plugin_handler_func публичное свойство

default plugin handler
public callable $default_plugin_handler_func
Результат callable

$default_resource_type публичное свойство

Must be an valid key of $registered_resources.
public string $default_resource_type
Результат string

$default_template_handler_func публичное свойство

default template handler
public callable $default_template_handler_func
Результат callable

$direct_access_security публичное свойство

{@internal Currently used by Smarty_Internal_Template only.}}
public bool $direct_access_security
Результат boolean

$error_reporting публичное свойство

When set, smarty uses this value as error_reporting-level.
public int $error_reporting
Результат integer

$error_unassigned публичное свойство

display error on not assigned variables
public bool $error_unassigned
Результат boolean

$escape_html публичное свойство

autoescape variable output
public bool $escape_html
Результат boolean

$force_cache публичное свойство

force cache file creation
public bool $force_cache
Результат boolean

$force_compile публичное свойство

force template compiling?
public bool $force_compile
Результат boolean

$get_used_tags публичное свойство

Internal flag for getTags()
public bool $get_used_tags
Результат boolean

$global_tpl_vars публичное статическое свойство

assigned global tpl vars
public static $global_tpl_vars

$inheritance_merge_compiled_includes публичное свойство

template inheritance merge compiled includes
public bool $inheritance_merge_compiled_includes
Результат boolean

$joined_config_dir публичное свойство

joined config directory string used in cache keys
public string $joined_config_dir
Результат string

$joined_template_dir публичное свойство

joined template directory string used in cache keys
public string $joined_template_dir
Результат string

$left_delimiter публичное свойство

template left-delimiter
public string $left_delimiter
Результат string

$locking_timeout публичное свойство

seconds to wait for acquiring a lock before ignoring the write lock
public float $locking_timeout
Результат float

$merge_compiled_includes публичное свойство

merge compiled includes
public bool $merge_compiled_includes
Результат boolean

$merged_templates_func публичное свойство

Saved parameter of merged templates during compilation
public array $merged_templates_func
Результат array

$php_handling публичное свойство

controls handling of PHP-blocks
public int $php_handling
Результат integer

$plugin_search_order публичное свойство

plugin search order
public array $plugin_search_order
Результат array

$properties публичное свойство

internal config properties
public array $properties
Результат array

$registered_cache_resources публичное свойство

registered cache resources
public array $registered_cache_resources
Результат array

$registered_classes публичное свойство

registered classes
public array $registered_classes
Результат array

$registered_filters публичное свойство

registered filters
public array $registered_filters
Результат array

$registered_objects публичное свойство

registered objects
public array $registered_objects
Результат array

$registered_plugins публичное свойство

registered plugins
public array $registered_plugins
Результат array

$registered_resources публичное свойство

registered resources
public array $registered_resources
Результат array

$right_delimiter публичное свойство

template right-delimiter
public string $right_delimiter
Результат string

$security_class публичное свойство

This should be instance of Smarty_Security.
См. также: Smarty_Security
public string $security_class
Результат string

$security_policy публичное свойство

implementation of security class
public Smarty_Security $security_policy
Результат Smarty_Security

$smarty публичное свойство

self pointer to Smarty object
public Smarty $smarty
Результат Smarty

$smarty_debug_id публичное свойство

Only used when $debugging_ctrl is set to 'URL'. The name of the URL-parameter that activates debugging.
public type $smarty_debug_id
Результат type

$start_time публичное свойство

start time for execution time calculation
public int $start_time
Результат integer

$template_functions публичное свойство

global template functions
public array $template_functions
Результат array

$template_objects публичное свойство

cached template objects
public array $template_objects
Результат array

$use_include_path публичное свойство

look up relative filepaths in include_path
public bool $use_include_path
Результат boolean

$use_sub_dirs публичное свойство

use sub dirs for compiled/cached files?
public bool $use_sub_dirs
Результат boolean