API - XOOPS 2.5.11 Beta 2
By monxoops.fr
Smarty Class Reference
Inheritance diagram for Smarty:

Public Member Functions

 __construct ()
 
 assign ($tpl_var, $value=null)
 
 assign_by_ref ($tpl_var, &$value)
 
 append ($tpl_var, $value=null, $merge=false)
 
 append_by_ref ($tpl_var, &$value, $merge=false)
 
 clear_assign ($tpl_var)
 
 register_function ($function, $function_impl, $cacheable=true, $cache_attrs=null)
 
 unregister_function ($function)
 
 register_object ($object, &$object_impl, $allowed=array(), $smarty_args=true, $block_methods=array())
 
 unregister_object ($object)
 
 register_block ($block, $block_impl, $cacheable=true, $cache_attrs=null)
 
 unregister_block ($block)
 
 register_compiler_function ($function, $function_impl, $cacheable=true)
 
 unregister_compiler_function ($function)
 
 register_modifier ($modifier, $modifier_impl)
 
 unregister_modifier ($modifier)
 
 register_resource ($type, $functions)
 
 unregister_resource ($type)
 
 register_prefilter ($function)
 
 unregister_prefilter ($function)
 
 register_postfilter ($function)
 
 unregister_postfilter ($function)
 
 register_outputfilter ($function)
 
 unregister_outputfilter ($function)
 
 load_filter ($type, $name)
 
 clear_cache ($tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
 
 clear_all_cache ($exp_time=null)
 
 is_cached ($tpl_file, $cache_id=null, $compile_id=null)
 
 clear_all_assign ()
 
 clear_compiled_tpl ($tpl_file=null, $compile_id=null, $exp_time=null)
 
 template_exists ($tpl_file)
 
get_template_vars ($name=null)
 
get_config_vars ($name=null)
 
 trigger_error ($error_msg, $error_type=E_USER_WARNING)
 
 display ($resource_name, $cache_id=null, $compile_id=null)
 
 fetch ($resource_name, $cache_id=null, $compile_id=null, $display=false)
 
 config_load ($file, $section=null, $scope='global')
 
get_registered_object ($name)
 
 clear_config ($var=null)
 
 _get_plugin_filepath ($type, $name)
 
 _is_compiled ($resource_name, $compile_path)
 
 _compile_resource ($resource_name, $compile_path)
 
 _compile_source ($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
 
 _get_compile_path ($resource_name)
 
 _fetch_resource_info (&$params)
 
 _parse_resource_name (&$params)
 
 _run_mod_handler ()
 
 _dequote ($string)
 
 _read_file ($filename)
 
 _get_auto_filename ($auto_base, $auto_source=null, $auto_id=null)
 
 _unlink ($resource, $exp_time=null)
 
 _get_auto_id ($cache_id=null, $compile_id=null)
 
 _trigger_fatal_error ($error_msg, $tpl_file=null, $tpl_line=null, $file=null, $line=null, $error_type=E_USER_ERROR)
 
 _process_compiled_include_callback ($match)
 
 _smarty_include ($params)
 
_smarty_cache_attrs ($cache_serial, $count)
 
 _include ($filename, $once=false, $params=null)
 
 _eval ($code, $params=null)
 
 _get_filter_name ($function)
 

Data Fields

 $template_dir = 'templates'
 
 $compile_dir = 'templates_c'
 
 $config_dir = 'configs'
 
 $plugins_dir = array('plugins')
 
 $debugging = false
 
 $error_reporting = null
 
 $debug_tpl = ''
 
 $debugging_ctrl = 'NONE'
 
 $compile_check = true
 
 $force_compile = false
 
 $caching = 0
 
 $cache_dir = 'cache'
 
 $cache_lifetime = 3600
 
 $cache_modified_check = false
 
 $php_handling = SMARTY_PHP_PASSTHRU
 
 $security = false
 
 $secure_dir = array()
 
 $security_settings
 
 $trusted_dir = array()
 
 $left_delimiter = '{'
 
 $right_delimiter = '}'
 
 $request_vars_order = 'EGPCS'
 
 $request_use_auto_globals = true
 
 $compile_id = null
 
 $use_sub_dirs = false
 
 $default_modifiers = array()
 
 $default_resource_type = 'file'
 
 $cache_handler_func = null
 
 $autoload_filters = array()
 
 $config_overwrite = true
 
 $config_booleanize = true
 
 $config_read_hidden = false
 
 $config_fix_newlines = true
 
 $default_template_handler_func = ''
 
 $compiler_file = 'Smarty_Compiler.class.php'
 
 $compiler_class = 'Smarty_Compiler'
 
 $config_class = 'Config_File'
 
 $_tpl_vars = array()
 
 $_smarty_vars = null
 
 $_sections = array()
 
 $_foreach = array()
 
 $_tag_stack = array()
 
 $_conf_obj = null
 
 $_config = array(array('vars' => array(), 'files' => array()))
 
 $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'
 
 $_version = '2.6.32'
 
 $_inclusion_depth = 0
 
 $_compile_id = null
 
 $_smarty_debug_id = 'SMARTY_DEBUG'
 
 $_smarty_debug_info = array()
 
 $_cache_info = array()
 
 $_file_perms = 0644
 
 $_dir_perms = 0771
 
 $_reg_objects = array()
 
 $_plugins
 
 $_cache_serials = array()
 
 $_cache_include = null
 
 $_cache_including = false
 
 $_filepaths_cache = array()
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

#- The class constructor.

Reimplemented in XoopsTpl.

Here is the call graph for this function:

Member Function Documentation

◆ _compile_resource()

_compile_resource (   $resource_name,
  $compile_path 
)

compile the template

Parameters
string$resource_name
string$compile_path
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _compile_source()

_compile_source (   $resource_name,
$source_content,
$compiled_content,
  $cache_include_path = null 
)

compile the given source

Parameters
string$resource_name
string$source_content
string$compiled_content
Returns
boolean
Here is the caller graph for this function:

◆ _dequote()

_dequote (   $string)

Remove starting and ending quotes from the string

Parameters
string$string
Returns
string

◆ _eval()

_eval (   $code,
  $params = null 
)

wrapper for eval() retaining $this

Returns
mixed

◆ _fetch_resource_info()

_fetch_resource_info ( $params)

fetch the template info. Gets timestamp, and source if get_source is true

sets $source_content to the source of the template, and $resource_timestamp to its time stamp

Parameters
string$resource_name
string$source_content
integer$resource_timestamp
boolean$get_source
boolean$quiet
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _get_auto_filename()

_get_auto_filename (   $auto_base,
  $auto_source = null,
  $auto_id = null 
)

get a concrete filename for automagically created content

Parameters
string$auto_base
string$auto_source
string$auto_id
Returns
string @staticvar string|null @staticvar string|null
Here is the caller graph for this function:

◆ _get_auto_id()

_get_auto_id (   $cache_id = null,
  $compile_id = null 
)

returns an auto_id for auto-file-functions

Parameters
string$cache_id
string$compile_id
Returns
string|null

Reimplemented in XoopsTpl.

Here is the caller graph for this function:

◆ _get_compile_path()

_get_compile_path (   $resource_name)

Get the compile path for this resource

Parameters
string$resource_name
Returns
string results of _get_auto_filename()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _get_filter_name()

_get_filter_name (   $function)

Extracts the filter name from the given callback

Parameters
callback$function
Returns
string
Here is the caller graph for this function:

◆ _get_plugin_filepath()

_get_plugin_filepath (   $type,
  $name 
)

get filepath of requested plugin

Parameters
string$type
string$name
Returns
string|false
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _include()

_include (   $filename,
  $once = false,
  $params = null 
)

wrapper for include() retaining $this

Returns
mixed

◆ _is_compiled()

_is_compiled (   $resource_name,
  $compile_path 
)

test if resource needs compiling

Parameters
string$resource_name
string$compile_path
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parse_resource_name()

_parse_resource_name ( $params)

parse out the type and name from the resource

Parameters
string$resource_base_path
string$resource_name
string$resource_type
string$resource_name
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _process_compiled_include_callback()

_process_compiled_include_callback (   $match)

callback function for preg_replace, to call a non-cacheable block

Returns
string

◆ _read_file()

_read_file (   $filename)

read in a file

Parameters
string$filename
Returns
string
Here is the caller graph for this function:

◆ _run_mod_handler()

_run_mod_handler ( )

Handle modifiers

Parameters
string | null$modifier_name
array | null$map_array
Returns
string result of modifiers

◆ _smarty_cache_attrs()

& _smarty_cache_attrs (   $cache_serial,
  $count 
)

get or set an array of cached attributes for function that is not cacheable

Returns
array

◆ _smarty_include()

_smarty_include (   $params)

called for included templates

Parameters
string$_smarty_include_tpl_file
string$_smarty_include_vars
Here is the call graph for this function:

◆ _trigger_fatal_error()

_trigger_fatal_error (   $error_msg,
  $tpl_file = null,
  $tpl_line = null,
  $file = null,
  $line = null,
  $error_type = E_USER_ERROR 
)

trigger Smarty plugin error

Parameters
string$error_msg
string$tpl_file
integer$tpl_line
string$file
integer$line
integer$error_type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _unlink()

_unlink (   $resource,
  $exp_time = null 
)

unlink a file, possibly using expiration time

Parameters
string$resource
integer$exp_time

◆ append()

append (   $tpl_var,
  $value = null,
  $merge = false 
)

appends values to template variables

Parameters
array | string$tpl_varthe template variable name(s)
mixed$valuethe value to append

◆ append_by_ref()

append_by_ref (   $tpl_var,
$value,
  $merge = false 
)

appends values to template variables by reference

Parameters
string$tpl_varthe template variable name
mixed$valuethe referenced value to append

◆ assign()

assign (   $tpl_var,
  $value = null 
)

assigns values to template variables

Parameters
array | string$tpl_varthe template variable name(s)
mixed$valuethe value to assign
Here is the caller graph for this function:

◆ assign_by_ref()

assign_by_ref (   $tpl_var,
$value 
)

assigns values to template variables by reference

Parameters
string$tpl_varthe template variable name
mixed$valuethe referenced value to assign

◆ clear_all_assign()

clear_all_assign ( )

clear all the assigned template variables.

◆ clear_all_cache()

clear_all_cache (   $exp_time = null)

clear the entire contents of cache (all templates)

Parameters
string$exp_timeexpire time
Returns
boolean results of smarty_core_rm_auto()
Here is the call graph for this function:

◆ clear_assign()

clear_assign (   $tpl_var)

clear the given assigned template variable.

Parameters
string$tpl_varthe template variable to clear

◆ clear_cache()

clear_cache (   $tpl_file = null,
  $cache_id = null,
  $compile_id = null,
  $exp_time = null 
)

clear cached content for the given template and cache id

Parameters
string$tpl_filename of template file
string$cache_idname of cache_id
string$compile_idname of compile_id
string$exp_timeexpiration time
Returns
boolean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_compiled_tpl()

clear_compiled_tpl (   $tpl_file = null,
  $compile_id = null,
  $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.

Parameters
string$tpl_file
string$compile_id
string$exp_time
Returns
boolean results of smarty_core_rm_auto()
Here is the call graph for this function:

◆ clear_config()

clear_config (   $var = null)

clear configuration values

Parameters
string$var

◆ config_load()

config_load (   $file,
  $section = null,
  $scope = 'global' 
)

load configuration values

Parameters
string$file
string$section
string$scope
Here is the call graph for this function:

◆ display()

display (   $resource_name,
  $cache_id = null,
  $compile_id = null 
)

executes & displays the template results

Parameters
string$resource_name
string$cache_id
string$compile_id
Here is the call graph for this function:

◆ fetch()

fetch (   $resource_name,
  $cache_id = null,
  $compile_id = null,
  $display = false 
)

executes & returns or displays the template results

Parameters
string$resource_name
string$cache_id
string$compile_id
boolean$display
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_config_vars()

& get_config_vars (   $name = null)

Returns an array containing config variables

Parameters
string$name
string$type
Returns
array

◆ get_registered_object()

& get_registered_object (   $name)

return a reference to a registered object

Parameters
string$name
Returns
object
Here is the call graph for this function:

◆ get_template_vars()

& get_template_vars (   $name = null)

Returns an array containing template variables

Parameters
string$name
string$type
Returns
array

◆ is_cached()

is_cached (   $tpl_file,
  $cache_id = null,
  $compile_id = null 
)

test to see if valid cache exists for this template

Parameters
string$tpl_filename of template file
string$cache_id
string$compile_id
Returns
string|false results of _read_cache_file()
Here is the call graph for this function:

◆ load_filter()

load_filter (   $type,
  $name 
)

load a filter of specified type and name

Parameters
string$typefilter type
string$namefilter name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_block()

register_block (   $block,
  $block_impl,
  $cacheable = true,
  $cache_attrs = null 
)

Registers block function to be used in templates

Parameters
string$blockname of template block
string$block_implPHP function to register

◆ register_compiler_function()

register_compiler_function (   $function,
  $function_impl,
  $cacheable = true 
)

Registers compiler function

Parameters
string$functionname of template function
string$function_implname of PHP function to register

◆ register_function()

register_function (   $function,
  $function_impl,
  $cacheable = true,
  $cache_attrs = null 
)

Registers custom function to be used in templates

Parameters
string$functionthe name of the template function
string$function_implthe name of the PHP function to register

◆ register_modifier()

register_modifier (   $modifier,
  $modifier_impl 
)

Registers modifier to be used in templates

Parameters
string$modifiername of template modifier
string$modifier_implname of PHP function to register

◆ register_object()

register_object (   $object,
$object_impl,
  $allowed = array(),
  $smarty_args = true,
  $block_methods = array() 
)

Registers object to be used in templates

Parameters
string$objectname of template object
object&$object_implthe referenced PHP object to register
null | array$allowedlist of allowed methods (empty = all)
boolean$smarty_argssmarty argument format, else traditional
null | array$block_functslist of methods that are block format

◆ register_outputfilter()

register_outputfilter (   $function)

Registers an output filter function to apply to a template output

Parameters
callback$function
Here is the call graph for this function:

◆ register_postfilter()

register_postfilter (   $function)

Registers a postfilter function to apply to a compiled template after compilation

Parameters
callback$function
Here is the call graph for this function:

◆ register_prefilter()

register_prefilter (   $function)

Registers a prefilter function to apply to a template before compiling

Parameters
callback$function
Here is the call graph for this function:

◆ register_resource()

register_resource (   $type,
  $functions 
)

Registers a resource to fetch a template

Parameters
string$typename of resource
array$functionsarray of functions to handle resource
Here is the call graph for this function:

◆ template_exists()

template_exists (   $tpl_file)

Checks whether requested template exists.

Parameters
string$tpl_file
Returns
boolean
Here is the call graph for this function:

◆ trigger_error()

trigger_error (   $error_msg,
  $error_type = E_USER_WARNING 
)

trigger Smarty error

Parameters
string$error_msg
integer$error_type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unregister_block()

unregister_block (   $block)

Unregisters block function

Parameters
string$blockname of template function

◆ unregister_compiler_function()

unregister_compiler_function (   $function)

Unregisters compiler function

Parameters
string$functionname of template function

◆ unregister_function()

unregister_function (   $function)

Unregisters custom function

Parameters
string$functionname of template function

◆ unregister_modifier()

unregister_modifier (   $modifier)

Unregisters modifier

Parameters
string$modifiername of template modifier

◆ unregister_object()

unregister_object (   $object)

Unregisters object

Parameters
string$objectname of template object

◆ unregister_outputfilter()

unregister_outputfilter (   $function)

Unregisters an outputfilter function

Parameters
callback$function
Here is the call graph for this function:

◆ unregister_postfilter()

unregister_postfilter (   $function)

Unregisters a postfilter function

Parameters
callback$function
Here is the call graph for this function:

◆ unregister_prefilter()

unregister_prefilter (   $function)

Unregisters a prefilter function

Parameters
callback$function
Here is the call graph for this function:

◆ unregister_resource()

unregister_resource (   $type)

Unregisters a resource

Parameters
string$typename of resource

Field Documentation

◆ $_cache_include

$_cache_include = null

◆ $_cache_including

$_cache_including = false

◆ $_cache_info

$_cache_info = array()

◆ $_cache_serials

$_cache_serials = array()

◆ $_compile_id

$_compile_id = null

◆ $_conf_obj

$_conf_obj = null

◆ $_config

$_config = array(array('vars' => array(), 'files' => array()))

◆ $_dir_perms

$_dir_perms = 0771

◆ $_file_perms

$_file_perms = 0644

◆ $_filepaths_cache

$_filepaths_cache = array()

◆ $_foreach

$_foreach = array()

◆ $_inclusion_depth

$_inclusion_depth = 0

◆ $_plugins

$_plugins
Initial value:
= array(
'modifier' => array(),
'function' => array(),
'block' => array(),
'compiler' => array(),
'prefilter' => array(),
'postfilter' => array(),
'outputfilter' => array(),
'resource' => array(),
'insert' => array())

◆ $_reg_objects

$_reg_objects = array()

◆ $_sections

$_sections = array()

◆ $_smarty_debug_id

$_smarty_debug_id = 'SMARTY_DEBUG'

◆ $_smarty_debug_info

$_smarty_debug_info = array()

◆ $_smarty_md5

$_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'

◆ $_smarty_vars

$_smarty_vars = null

◆ $_tag_stack

$_tag_stack = array()

◆ $_tpl_vars

$_tpl_vars = array()

◆ $_version

$_version = '2.6.32'

◆ $autoload_filters

$autoload_filters = array()

◆ $cache_dir

$cache_dir = 'cache'

◆ $cache_handler_func

$cache_handler_func = null

◆ $cache_lifetime

$cache_lifetime = 3600

◆ $cache_modified_check

$cache_modified_check = false

◆ $caching

$caching = 0

◆ $compile_check

$compile_check = true

◆ $compile_dir

$compile_dir = 'templates_c'

◆ $compile_id

$compile_id = null

◆ $compiler_class

$compiler_class = 'Smarty_Compiler'

◆ $compiler_file

$compiler_file = 'Smarty_Compiler.class.php'

◆ $config_booleanize

$config_booleanize = true

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.

◆ $config_class

$config_class = 'Config_File'

◆ $config_dir

$config_dir = 'configs'

◆ $config_fix_newlines

$config_fix_newlines = true

This tells whether or not automatically fix newlines in config files. It basically converts \r (mac) or \r
(dos) to

◆ $config_overwrite

$config_overwrite = true

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.

◆ $config_read_hidden

$config_read_hidden = false

This tells whether hidden sections [.foobar] are readable from the tempalates or not. Normally you would never allow this since that is the point behind hidden sections: the application can access them, but the templates cannot.

◆ $debug_tpl

$debug_tpl = ''

◆ $debugging

$debugging = false

◆ $debugging_ctrl

$debugging_ctrl = 'NONE'

◆ $default_modifiers

$default_modifiers = array()

◆ $default_resource_type

$default_resource_type = 'file'

◆ $default_template_handler_func

$default_template_handler_func = ''

◆ $error_reporting

$error_reporting = null

◆ $force_compile

$force_compile = false

◆ $left_delimiter

$left_delimiter = '{'

◆ $php_handling

$php_handling = SMARTY_PHP_PASSTHRU

◆ $plugins_dir

$plugins_dir = array('plugins')

◆ $request_use_auto_globals

$request_use_auto_globals = true

◆ $request_vars_order

$request_vars_order = 'EGPCS'

◆ $right_delimiter

$right_delimiter = '}'

◆ $secure_dir

$secure_dir = array()

◆ $security

$security = false

◆ $security_settings

$security_settings
Initial value:
= 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
)

◆ $template_dir

$template_dir = 'templates'

◆ $trusted_dir

$trusted_dir = array()

◆ $use_sub_dirs

$use_sub_dirs = false

The documentation for this class was generated from the following file: