Class Smarty
Copyright: 2001-2005 New Digital Group, Inc.
Author: Monte Ohrt
Author: Andrei Zmievski andrei@php.net
Located at lass/smarty/Smarty.class.php
public
|
|
public
|
|
public
|
#
assign_by_ref( string $tpl_var, mixed & $value )
assigns values to template variables by reference |
public
|
|
public
|
#
append_by_ref( string $tpl_var, mixed & $value, $merge = false )
appends values to template variables by reference |
public
|
|
public
|
#
register_function( string $function, string $function_impl, $cacheable = true, $cache_attrs = null )
Registers custom function to be used in templates |
public
|
|
public
|
#
register_object( string $object, object & $object_impl, null|array $allowed = array(), boolean $smarty_args = true, null|array $block_methods = array() )
Registers object to be used in templates |
public
|
|
public
|
#
register_block( string $block, string $block_impl, $cacheable = true, $cache_attrs = null )
Registers block function to be used in templates |
public
|
|
public
|
#
register_compiler_function( string $function, string $function_impl, $cacheable = true )
Registers compiler function |
public
|
|
public
|
#
register_modifier( string $modifier, string $modifier_impl )
Registers modifier to be used in templates |
public
|
|
public
|
|
public
|
|
public
|
#
register_prefilter( callable $function )
Registers a prefilter function to apply to a template before compiling |
public
|
|
public
|
#
register_postfilter( callable $function )
Registers a postfilter function to apply to a compiled template after compilation |
public
|
|
public
|
#
register_outputfilter( callable $function )
Registers an output filter function to apply to a template output |
public
|
|
public
|
|
public
boolean
|
#
clear_cache( string $tpl_file = null, string $cache_id = null, string $compile_id = null, string $exp_time = null )
clear cached content for the given template and cache id |
public
boolean
|
|
public
string|false
|
|
public
|
|
public
boolean
|
#
clear_compiled_tpl( string $tpl_file = null, string $compile_id = null, string $exp_time = null )
clears compiled version of specified template resource, or all compiled template files if one is not specified. This function is for advanced use only, not normally needed. |
public
boolean
|
|
public
array
&
|
#
get_template_vars( string $name = null, string $type,… )
Returns an array containing template variables |
public
array
&
|
#
get_config_vars( string $name = null, string $type,… )
Returns an array containing config variables |
public
|
|
public
|
|
public
|
|
public
|
#
config_load( string $file, string $section = null, string $scope = 'global' )
load configuration values |
public
object
&
|
|
public
|
|
public
string|false
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
#
_compile_source( string $resource_name, string & $source_content, string & $compiled_content, $cache_include_path = null )
compile the given source |
public
string
|
|
public
boolean
|
#
_fetch_resource_info( string & $params, string $source_content,…, integer $resource_timestamp,…, boolean $get_source,…, boolean $quiet,… )
fetch the template info. Gets timestamp, and source if get_source is true |
public
boolean
|
#
_parse_resource_name( string & $params, string $resource_name,…, string $resource_type,…, string $resource_name,… )
parse out the type and name from the resource |
public
string
|
|
public
string
|
|
public
string
|
|
public
string
|
#
_get_auto_filename( string $auto_base, string $auto_source = null, string $auto_id = null )
get a concrete filename for automagically created content |
public
|
|
public
string|null
|
#
_get_auto_id( string $cache_id = null, string $compile_id = null )
returns an auto_id for auto-file-functions |
public
|
#
_trigger_fatal_error( string $error_msg, string $tpl_file = null, integer $tpl_line = null, string $file = null, integer $line = null, integer $error_type = E_USER_ERROR )
trigger Smarty plugin error |
public
string
|
#
_process_compiled_include_callback( $match )
callback function for preg_replace, to call a non-cacheable block |
public
|
|
public
array
&
|
#
_smarty_cache_attrs( $cache_serial, $count )
get or set an array of cached attributes for function that is not cacheable |
public
mixed
|
|
public
mixed
|
|
public
string
|
public
string
|
$template_dir
The name of the directory where templates are located. |
#
'templates'
|
public
string
|
$compile_dir
The directory where compiled templates are located. |
#
'templates_c'
|
public
string
|
$config_dir
The directory where config files are located. |
#
'configs'
|
public
array
|
$plugins_dir
An array of directories searched for plugins. |
#
array('plugins')
|
public
boolean
|
$debugging
If debugging is enabled, a debug console window will display when the page loads (make sure your browser allows unrequested popup windows) |
#
false
|
public
integer
|
$error_reporting
When set, smarty does uses this value as error_reporting-level. |
#
null
|
public
string
|
$debug_tpl
This is the path to the debug console template. If not set, the default one will be used. |
#
''
|
public
string
|
$debugging_ctrl
This determines if debugging is enable-able from the browser.
|
#
'NONE'
|
public
boolean
|
$compile_check
This tells Smarty whether to check for recompiling or not. Recompiling does not need to happen unless a template or config file is changed. Typically you enable this during development, and disable for production. |
#
true
|
public
boolean
|
$force_compile
This forces templates to compile every time. Useful for development or debugging. |
#
false
|
public
integer
|
$caching
This enables template caching.
|
#
0
|
public
string
|
$cache_dir
The name of the directory for cache files. |
#
'cache'
|
public
integer
|
$cache_lifetime
This is the number of seconds cached content will persist.
|
#
3600
|
public
boolean
|
$cache_modified_check
Only used when $caching is enabled. If true, then If-Modified-Since headers are respected with cached content, and appropriate HTTP headers are sent. This way repeated hits to a cached page do not send the entire page to the client every time. |
#
false
|
public
integer
|
$php_handling
This determines how Smarty handles "" tags in templates. possible values:
|
#
SMARTY_PHP_PASSTHRU
|
public
boolean
|
$security
This enables template security. When enabled, many things are restricted in the templates that normally would go unchecked. This is useful when untrusted parties are editing templates and you want a reasonable level of security. (no direct execution of PHP in templates for example) |
#
false
|
public
array
|
$secure_dir
This is the list of template directories that are considered secure. This
is used only if |
#
array()
|
public
array
|
$security_settings
These are the security settings for Smarty. They are used only when
|
#
array(
'PHP_HANDLING' => false,
'IF_FUNCS' => array('array', 'list',
'isset', 'empty',
'count', 'sizeof',
'in_array', 'is_array',
'true', 'false', 'null'),
'INCLUDE_ANY' => false,
'PHP_TAGS' => false,
'MODIFIER_FUNCS' => array('count'),
'ALLOW_CONSTANTS' => false,
'ALLOW_SUPER_GLOBALS' => true
)
|
public
array
|
$trusted_dir
This is an array of directories where trusted php scripts reside.
|
#
array()
|
public
string
|
$left_delimiter
The left delimiter used for the template tags. |
#
'{'
|
public
string
|
$right_delimiter
The right delimiter used for the template tags. |
#
'}'
|
public
string
|
$request_vars_order
The order in which request variables are registered, similar to variables_order in php.ini E = Environment, G = GET, P = POST, C = Cookies, S = Server |
#
'EGPCS'
|
public
boolean
|
$request_use_auto_globals
Indicates wether $HTTP_VARS[] (request_use_auto_globals=false) are uses as request-vars or $[]-vars. note: if request_use_auto_globals is true, then $request_vars_order has no effect, but the php-ini-value "gpc_order" |
#
true
|
public
string
|
$compile_id
Set this if you want different sets of compiled files for the same templates. This is useful for things like different languages. Instead of creating separate sets of templates per language, you set different compile_ids like 'en' and 'de'. |
#
null
|
public
boolean
|
$use_sub_dirs
This tells Smarty whether or not to use sub dirs in the cache/ and templates_c/ directories. sub directories better organized, but may not work well with PHP safe mode enabled. |
#
false
|
public
array
|
$default_modifiers
This is a list of the modifiers to apply to all template variables. Put each modifier in a separate array element in the order you want them applied. example: array('escape:"htmlall"'); |
#
array()
|
public
array
|
$default_resource_type
This is the resource type to be used when not specified at the beginning of the resource path. examples: $smarty->display('file:index.tpl'); $smarty->display('db:index.tpl'); $smarty->display('index.tpl'); // will use default resource type {include file="file:index.tpl"} {include file="db:index.tpl"} {include file="index.tpl"} {* will use default resource type *} |
#
'file'
|
public
null|string
|
$cache_handler_func
The function used for cache file handling. If not set, built-in caching is used. |
#
null
|
public
array
|
$autoload_filters
This indicates which filters are automatically loaded into Smarty. |
#
array()
|
public
boolean
|
$config_overwrite
This tells if config file vars of the same name overwrite each other or not. if disabled, same name variables are accumulated in an array. |
#
true
|
public
boolean
|
$config_booleanize
This tells whether or not to automatically booleanize config file variables. If enabled, then the strings "on", "true", and "yes" are treated as boolean true, and "off", "false" and "no" are treated as boolean false. |
#
true
|
public
boolean
|
$config_fix_newlines
This tells whether or not automatically fix newlines in config files. It basically converts \r (mac) or \r\n (dos) to \n |
#
true
|
public
string
|
$default_template_handler_func
If a template cannot be found, this PHP function will be executed. Useful for creating templates on-the-fly or other special action. |
#
''
|
public
string
|
$compiler_file
The file that contains the compiler class. This can a full pathname, or relative to the php_include path. |
#
'Smarty_Compiler.class.php'
|
public
string
|
$compiler_class
The class used for compiling templates. |
#
'Smarty_Compiler'
|
public
string
|
$config_class
The class used to load config vars. |
#
'Config_File'
|
public
array
|
$_tpl_vars
where assigned template vars are kept |
#
array()
|
public
null|array
|
$_smarty_vars
stores run-time $smarty.* vars |
#
null
|
public
array
|
$_sections
keeps track of sections |
#
array()
|
public
array
|
$_foreach
keeps track of foreach blocks |
#
array()
|
public
array
|
$_tag_stack
keeps track of tag hierarchy |
#
array()
|
public
Config_file
|
$_conf_obj
configuration object |
#
null
|
public
array
|
$_config
loaded configuration settings |
#
array(array('vars' => array(), 'files' => array()))
|
public
string
|
$_smarty_md5
md5 checksum of the string 'Smarty' |
#
'f8d698aea36fcbead2b9d5359ffca76f'
|
public
string
|
$_version
Smarty version number |
#
'2.6.30'
|
public
integer
|
$_inclusion_depth
current template inclusion depth |
#
0
|
public
string
|
$_compile_id
for different compiled templates |
#
null
|
public
string
|
$_smarty_debug_id
text in URL to enable debug mode |
#
'SMARTY_DEBUG'
|
public
array
|
$_smarty_debug_info
debugging information for debug console |
#
array()
|
public
array
|
$_cache_info
info that makes up a cache file |
#
array()
|
public
integer
|
$_file_perms
default file permissions |
#
0644
|
public
integer
|
$_dir_perms
default dir permissions |
#
0771
|
public
array
|
$_reg_objects
registered objects |
#
array()
|
public
array
|
$_plugins
table keeping track of plugins |
#
array(
'modifier' => array(),
'function' => array(),
'block' => array(),
'compiler' => array(),
'prefilter' => array(),
'postfilter' => array(),
'outputfilter' => array(),
'resource' => array(),
'insert' => array())
|
public
array
|
$_cache_serials
cache serials |
#
array()
|
public
string
|
$_cache_include
name of optional cache include file |
#
null
|
public
string
|
$_cache_including
indicate if the current code is used in a compiled include |
#
false
|
public
array
|
$_filepaths_cache
plugin filepath cache |
#
array()
|