Class Smarty

Description

This is the main Smarty class

Located in /libs/Smarty.class.php (line 101)

Smarty_Internal_Data
   |
   --Smarty_Internal_TemplateBase
      |
      --Smarty
Direct descendents
Class Description
SmartyBC Smarty Backward Compatability Wrapper Class
Class Constant Summary
Variable Summary
static mixed $global_tpl_vars
static mixed $_muted_directories
static array $_smarty_vars
boolean $auto_literal
string $cache_dir
string $cache_id
integer $cache_lifetime
boolean $cache_locking
boolean $caching
string $caching_type
boolean $compile_check
string $compile_dir
string $compile_id
string $config_dir
boolean $debugging
string $debug_tpl
boolean $escape_html
boolean $force_cache
boolean $force_compile
boolean $get_used_tags
integer $php_handling
string $plugins_dir
array $properties
string $template_dir
boolean $use_sub_dirs
array $_tag_stack
Method Summary
static void muteExpectedErrors ()
static boolean mutingErrorHandler (integer $errno,  $errstr,  $errfile,  $errline,  $errcontext)
static void unmuteExpectedErrors ()
Smarty __construct ()
void __destruct ()
Smarty addAutoloadFilters (array $filters, [string $type = null])
Smarty addConfigDir (string|array $config_dir, [string $key = null])
Smarty addDefaultModifiers (array|string $modifiers)
Smarty addPluginsDir ( $plugins_dir, object $smarty, string $)
Smarty addTemplateDir (string|array $template_dir, [string $key = null])
integer clearAllCache ([integer $exp_time = null], [string $type = null])
integer clearCache (string $template_name, [string $cache_id = null], [string $compile_id = null], [integer $exp_time = null], [string $type = null])
integer clearCompiledTemplate ([string $resource_name = null], [string $compile_id = null], [integer $exp_time = null])
integer compileAllConfig ([ $extention = '.conf'], [bool $force_compile = false], [int $time_limit = 0], [int $max_errors = null], string $extension)
integer compileAllTemplates ([ $extention = '.tpl'], [bool $force_compile = false], [int $time_limit = 0], [int $max_errors = null], string $extension)
object template createTemplate (string $template, [mixed $cache_id = null], [mixed $compile_id = null], [object $parent = null], [boolean $do_clone = true])
Smarty enableSecurity ([string|Smarty_Security $security_class = null])
array getAutoloadFilters ([string $type = null])
string getCacheDir ()
string getCompileDir ()
array|string getConfigDir ([mixed $index = null])
string getDebugTemplate ()
string getGlobal ([string $varname = null], object $smarty)
array getPluginsDir ()
array getTags (Smarty_Internal_Template $template, object $templae)
array|string getTemplateDir ([mixed $index = null])
string loadPlugin (string $plugin_name, [bool $check = true])
Smarty setAutoloadFilters (array $filters, [string $type = null])
Smarty setCacheDir (string $cache_dir)
Smarty setCompileDir (string $compile_dir)
Smarty setConfigDir ( $config_dir, string|array $template_dir)
Smarty setDebugTemplate (string $tpl_name)
Smarty setDefaultModifiers (array|string $modifiers)
Smarty setPluginsDir (string|array $plugins_dir)
Smarty setTemplateDir (string|array $template_dir)
boolean templateExists (string $resource_name)
boolean testInstall ([ &$errors = null], array $errors)
void __clone ()
mixed __get (string $name)
void __set (string $name, mixed $value)
Variables
static mixed $global_tpl_vars = array() (line 159)

assigned global tpl vars

  • access: public
static mixed $_muted_directories = array() (line 168)

contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()

  • access: public
static mixed $_previous_error_handler = null (line 164)

error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()

  • access: public
static array $_smarty_vars = array() (line 509)

global internal smarty vars

  • access: public
bool $allow_php_templates = false (line 317)

controls if the php template file resource is allowed

security

  • access: public
array $autoload_filters = array() (line 494)

autoload filter

  • access: public
boolean $auto_literal = true (line 178)

auto literal on delimiters with whitspace

variables

  • access: public
string $cache_dir = null (line 223)

cache directory

variables

  • access: protected
string $cache_id = null (line 270)

Set this if you want different sets of cache files for the same templates.

variables

  • access: public
integer $cache_lifetime = 3600 (line 258)

cache lifetime in seconds

variables

  • access: public
boolean $cache_locking = false (line 406)

Controls whether cache resources should emply locking mechanism

resource locking

  • access: public
boolean $cache_modified_check = false (line 454)

check If-Modified-Since headers

  • access: public
boolean $caching = false (line 248)

caching enabled

variables

  • access: public
string $caching_type = 'file' (line 434)

caching type

Must be an element of $cache_resource_types.

  • access: public
boolean $compile_check = true (line 238)

check template for modifications?

variables

  • access: public
string $compile_dir = null (line 213)

compile directory

variables

  • access: protected
string $compile_id = null (line 277)

Set this if you want different sets of compiled files for the same templates.

variables

  • access: public
boolean $compile_locking = true (line 401)

locking concurrent compiles

resource locking

  • access: public
boolean $config_booleanize = true (line 384)

Controls whether config values of on/true/yes and off/false/no get converted to boolean.

config var settings

  • access: public
string $config_dir = null (line 228)

config directory

variables

  • access: protected
boolean $config_overwrite = true (line 379)

Controls whether variables with the same name overwrite each other.

config var settings

  • access: public
boolean $config_read_hidden = false (line 389)

Controls whether hidden config sections/vars are read from the file.

config var settings

  • access: public
boolean $debugging = false (line 336)

debug mode

Setting this to true enables the debug-console.

  • access: public
string $debugging_ctrl = 'NONE' (line 345)

This determines if debugging is enable-able from the browser.

  • NONE => no debugging control allowed
  • URL => enable debugging when SMARTY_DEBUG is found in the URL.

  • access: public
string $debug_tpl = null (line 359)

Path of debug template.

  • access: public
callable $default_config_handler_func = null (line 203)

default config handler

variables

  • access: public
string $default_config_type = 'file' (line 444)

config type

  • access: public
array $default_modifiers = array() (line 499)

default modifier

  • access: public
callable $default_plugin_handler_func = null (line 208)

default plugin handler

variables

  • access: public
string $default_resource_type = 'file' (line 426)

resource type used if none given

Must be an valid key of $registered_resources.

  • access: public
callable $default_template_handler_func = null (line 198)

default template handler

variables

  • access: public
boolean $direct_access_security = true (line 327)

Should compiled-templates be prevented from being called directly?

security

  • access: public
int $error_reporting = null (line 364)

When set, smarty uses this value as error_reporting-level.

  • access: public
boolean $error_unassigned = false (line 183)

display error on not assigned variables

variables

  • access: public
boolean $escape_html = false (line 504)

autoescape variable output

  • access: public
boolean $force_cache = false (line 263)

force cache file creation

variables

  • access: public
boolean $force_compile = false (line 233)

force template compiling?

variables

  • access: public
boolean $get_used_tags = false (line 369)

Internal flag for getTags()

  • access: public
string $left_delimiter = "{" (line 282)

template left-delimiter

variables

  • access: public
float $locking_timeout = 10 (line 411)

seconds to wait for acquiring a lock before ignoring the write lock

resource locking

  • access: public
array $merged_templates_func = array() (line 550)

Saved parameter of merged templates during compilation

  • access: public
boolean $merge_compiled_includes = false (line 253)

merge compiled includes

variables

  • access: public
integer $php_handling = self::PHP_PASSTHRU (line 311)

controls handling of PHP-blocks

security

  • access: public
string $plugins_dir = null (line 218)

plugins directory

variables

  • access: protected
array $plugin_search_order = array('function', 'block', 'compiler', 'class') (line 464)

plugin search order

  • access: public
array $properties = array() (line 439)

internal config properties

  • access: public
array $registered_cache_resources = array() (line 489)

registered cache resources

  • access: public
array $registered_classes = array() (line 474)

registered classes

  • access: public
array $registered_filters = array() (line 479)

registered filters

  • access: public
array $registered_objects = array() (line 469)

registered objects

  • access: public
array $registered_plugins = array() (line 459)

registered plugins

  • access: public
array $registered_resources = array() (line 484)

registered resources

  • access: public
string $right_delimiter = "}" (line 287)

template right-delimiter

variables

  • access: public
string $security_class = 'Smarty_Security' (line 299)

class name

security This should be instance of Smarty_Security.

Smarty_Security $security_policy = null (line 305)

implementation of security class

security

  • access: public
Smarty $smarty (line 534)

self pointer to Smarty object

  • access: public
type $smarty_debug_id = 'SMARTY_DEBUG' (line 354)

Name of debugging URL-param.

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

  • access: public
int $start_time = 0 (line 514)

start time for execution time calculation

  • access: public
string $template_dir = null (line 193)

template directory

variables

  • access: protected
array $template_functions = array() (line 419)

global template functions

  • access: public
array $template_objects = array() (line 449)

cached template objects

  • access: public
boolean $use_include_path = false (line 188)

look up relative filepaths in include_path

variables

  • access: public
boolean $use_sub_dirs = false (line 243)

use sub dirs for compiled/cached files?

variables

  • access: public
string $_current_file = null (line 539)

required by the compiler for BC

  • access: public
int $_dir_perms = 0771 (line 524)

default dir permissions

  • access: public
int $_file_perms = 0644 (line 519)

default file permissions

  • access: public
bool $_parserdebug = false (line 544)

internal flag to enable parser debugging

  • access: public
array $_tag_stack = array() (line 529)

block tag hierarchy

  • access: public

Inherited Variables

Inherited from Smarty_Internal_Data

Smarty_Internal_Data::$config_vars
Smarty_Internal_Data::$parent
Smarty_Internal_Data::$template_class
Smarty_Internal_Data::$tpl_vars
Methods
static method muteExpectedErrors (line 1354)

Enable error handler to mute expected messages

  • access: public
static void muteExpectedErrors ()
static method mutingErrorHandler (line 1309)

Error Handler to mute expected messages

static boolean mutingErrorHandler (integer $errno,  $errstr,  $errfile,  $errline,  $errcontext)
  • integer $errno: Error level
  • $errstr
  • $errfile
  • $errline
  • $errcontext
static method unmuteExpectedErrors (line 1386)

Disable error handler muting expected messages

  • access: public
static void unmuteExpectedErrors ()
Constructor __construct (line 557)

Initialize new Smarty object

  • access: public
Smarty __construct ()

Redefined in descendants as:
Destructor __destruct (line 581)

Class destructor

  • access: public
void __destruct ()
addAutoloadFilters (line 1062)

Add autoload filters

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

Add config directory(s)

  • return: current Smarty instance for chaining
  • access: public
Smarty addConfigDir (string|array $config_dir, [string $key = null])
  • string|array $config_dir: directory(s) of config sources
  • string $key: key of the array element to assign the config dir to
addDefaultModifiers (line 1015)

Add default modifiers

  • return: current Smarty instance for chaining
  • access: public
Smarty addDefaultModifiers (array|string $modifiers)
  • array|string $modifiers: modifier or list of modifiers to add
addPluginsDir (line 913)

Adds directory of plugin files

  • return: current Smarty instance for chaining
  • access: public
Smarty addPluginsDir ( $plugins_dir, object $smarty, string $)
  • object $smarty
  • string $: |array $ plugins folder
  • $plugins_dir
addTemplateDir (line 785)

Add template directory(s)

  • return: current Smarty instance for chaining
  • throws: SmartyException when the given template directory is not valid
  • access: public
Smarty addTemplateDir (string|array $template_dir, [string $key = null])
  • string|array $template_dir: directory(s) of template sources
  • string $key: of the array element to assign the template dir to
clearAllCache (line 695)

Empty cache folder

  • return: number of cache files deleted
integer clearAllCache ([integer $exp_time = null], [string $type = null])
  • integer $exp_time: expiration time
  • string $type: resource type
clearCache (line 713)

Empty cache for a specific template

  • return: number of cache files deleted
  • access: public
integer clearCache (string $template_name, [string $cache_id = null], [string $compile_id = null], [integer $exp_time = null], [string $type = null])
  • string $template_name: template name
  • string $cache_id: cache id
  • string $compile_id: compile id
  • integer $exp_time: expiration time
  • string $type: resource type
clearCompiledTemplate (line 1274)

Delete compiled template file

  • return: number of template files deleted
  • access: public
integer clearCompiledTemplate ([string $resource_name = null], [string $compile_id = null], [integer $exp_time = null])
  • string $resource_name: template name
  • string $compile_id: compile id
  • integer $exp_time: expiration time
compileAllConfig (line 1261)

Compile all config files

  • return: number of template files recompiled
  • access: public
integer compileAllConfig ([ $extention = '.conf'], [bool $force_compile = false], [int $time_limit = 0], [int $max_errors = null], string $extension)
  • string $extension: file extension
  • bool $force_compile: force all to recompile
  • int $time_limit
  • int $max_errors
  • $extention
compileAllTemplates (line 1247)

Compile all template files

  • return: number of template files recompiled
  • access: public
integer compileAllTemplates ([ $extention = '.tpl'], [bool $force_compile = false], [int $time_limit = 0], [int $max_errors = null], string $extension)
  • string $extension: file extension
  • bool $force_compile: force all to recompile
  • int $time_limit
  • int $max_errors
  • $extention
createTemplate (line 1135)

creates a template object

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

Disable security

  • return: current Smarty instance for chaining
  • access: public
Smarty disableSecurity ()
enableSecurity (line 728)

Loads security class and enables security

  • return: current Smarty instance for chaining
  • throws: SmartyException when an invalid class name is provided
  • access: public
Smarty enableSecurity ([string|Smarty_Security $security_class = null])
  • string|Smarty_Security $security_class: if a string is used, it must be class-name
getAutoloadFilters (line 1089)

Get autoload filters

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

Get cache directory

  • return: path of cache directory
  • access: public
string getCacheDir ()
getCompileDir (line 967)

Get compiled directory

  • return: path to compiled templates
  • access: public
string getCompileDir ()
getConfigDir (line 881)

Get config directory

  • return: configuration directory
  • access: public
array|string getConfigDir ([mixed $index = null])
  • mixed $index: index of directory to get, null to get all
getDebugTemplate (line 1103)

return name of debugging template

  • access: public
string getDebugTemplate ()
getDefaultModifiers (line 1031)

Get default modifiers

  • return: list of default modifiers
  • access: public
array getDefaultModifiers ()
getGlobal (line 671)

Returns a single or all global variables

  • return: variable value or or array of variables
  • access: public
string getGlobal ([string $varname = null], object $smarty)
  • object $smarty
  • string $varname: variable name or null
getPluginsDir (line 942)

Get plugin directories

  • return: list of plugin directories
  • access: public
array getPluginsDir ()
getTags (line 1286)

Return array of tag/attributes of all tags used by an template

  • return: of tag/attributes
  • access: public
array getTags (Smarty_Internal_Template $template, object $templae)
getTemplateDir (line 817)

Get template directories

  • return: list of template directories, or directory of $index
  • access: public
array|string getTemplateDir ([mixed $index = null])
  • mixed $index: index of directory to get, null to get all
loadPlugin (line 1189)

Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName plugin filename format: plugintype.pluginname.php

  • return: |boolean filepath of loaded file or false
  • access: public
string loadPlugin (string $plugin_name, [bool $check = true])
  • string $plugin_name: class plugin name to load
  • bool $check: check if already loaded
setAutoloadFilters (line 1044)

Set autoload filters

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

Set cache directory

  • return: current Smarty instance for chaining
  • access: public
Smarty setCacheDir (string $cache_dir)
  • string $cache_dir: directory to store cached templates in
setCompileDir (line 953)

Set compile directory

  • return: current Smarty instance for chaining
  • access: public
Smarty setCompileDir (string $compile_dir)
  • string $compile_dir: directory to store compiled templates in
setConfigDir (line 832)

Set config directory

  • return: current Smarty instance for chaining
  • access: public
Smarty setConfigDir ( $config_dir, string|array $template_dir)
  • string|array $template_dir: directory(s) of configuration sources
  • $config_dir
setDebugTemplate (line 1115)

set the debug template

  • return: current Smarty instance for chaining
  • throws: SmartyException if file is not readable
  • access: public
Smarty setDebugTemplate (string $tpl_name)
  • string $tpl_name
setDefaultModifiers (line 1003)

Set default modifiers

  • return: current Smarty instance for chaining
  • access: public
Smarty setDefaultModifiers (array|string $modifiers)
  • array|string $modifiers: modifier or list of modifiers to set
setPluginsDir (line 896)

Set plugins directory

  • return: current Smarty instance for chaining
  • access: public
Smarty setPluginsDir (string|array $plugins_dir)
  • string|array $plugins_dir: directory(s) of plugins
setTemplateDir (line 767)

Set template directory

  • return: current Smarty instance for chaining
  • access: public
Smarty setTemplateDir (string|array $template_dir)
  • string|array $template_dir: directory(s) of template sources
templateExists (line 653)

Check if a template resource exists

  • return: status
  • access: public
boolean templateExists (string $resource_name)
  • string $resource_name: template name
testInstall (line 1297)

Run installation test

  • return: true if setup is fine, false if something is wrong
  • access: public
boolean testInstall ([ &$errors = null], array $errors)
  • array $errors: Array to write errors into, rather than outputting them
  • &$errors
__clone (line 589)

magic>> set selfpointer on cloned object

  • access: public
void __clone ()
__get (line 604)

magic>> Generic getter.

Calls the appropriate getter function. Issues an E_USER_NOTICE if no valid getter is found.

  • access: public
mixed __get (string $name)
  • string $name: property name
__set (line 630)

magic>> Generic setter.

Calls the appropriate setter function. Issues an E_USER_NOTICE if no valid setter is found.

  • access: public
void __set (string $name, mixed $value)
  • string $name: property name
  • mixed $value: parameter passed to setter

Inherited Methods

Inherited From Smarty_Internal_TemplateBase

Smarty_Internal_TemplateBase::createData()
Smarty_Internal_TemplateBase::display()
Smarty_Internal_TemplateBase::fetch()
Smarty_Internal_TemplateBase::getRegisteredObject()
Smarty_Internal_TemplateBase::isCached()
Smarty_Internal_TemplateBase::loadFilter()
Smarty_Internal_TemplateBase::registerCacheResource()
Smarty_Internal_TemplateBase::registerClass()
Smarty_Internal_TemplateBase::registerDefaultConfigHandler()
Smarty_Internal_TemplateBase::registerDefaultPluginHandler()
Smarty_Internal_TemplateBase::registerDefaultTemplateHandler()
Smarty_Internal_TemplateBase::registerFilter()
Smarty_Internal_TemplateBase::registerObject()
Smarty_Internal_TemplateBase::registerPlugin()
Smarty_Internal_TemplateBase::registerResource()
Smarty_Internal_TemplateBase::unregisterCacheResource()
Smarty_Internal_TemplateBase::unregisterFilter()
Smarty_Internal_TemplateBase::unregisterObject()
Smarty_Internal_TemplateBase::unregisterPlugin()
Smarty_Internal_TemplateBase::unregisterResource()
Smarty_Internal_TemplateBase::_get_filter_name()
Smarty_Internal_TemplateBase::__call()

Inherited From Smarty_Internal_Data

Smarty_Internal_Data::append()
Smarty_Internal_Data::appendByRef()
Smarty_Internal_Data::assign()
Smarty_Internal_Data::assignByRef()
Smarty_Internal_Data::assignGlobal()
Smarty_Internal_Data::clearAllAssign()
Smarty_Internal_Data::clearAssign()
Smarty_Internal_Data::clearConfig()
Smarty_Internal_Data::configLoad()
Smarty_Internal_Data::getConfigVariable()
Smarty_Internal_Data::getConfigVars()
Smarty_Internal_Data::getStreamVariable()
Smarty_Internal_Data::getTemplateVars()
Smarty_Internal_Data::getVariable()
Class Constants
CACHING_LIFETIME_CURRENT = 1 (line 123)

constant definitions

CACHING_LIFETIME_SAVED = 2 (line 124)

constant definitions

CACHING_OFF = 0 (line 122)

define caching modes

constant definitions

COMPILECHECK_CACHEMISS = 2 (line 130)

constant definitions

COMPILECHECK_OFF = 0 (line 128)

define compile check modes

constant definitions

COMPILECHECK_ON = 1 (line 129)

constant definitions

FILTER_OUTPUT = 'output' (line 143)

constant definitions

FILTER_POST = 'post' (line 141)

filter types

constant definitions

FILTER_PRE = 'pre' (line 142)

constant definitions

FILTER_VARIABLE = 'variable' (line 144)

constant definitions

PHP_ALLOW = 3 (line 137)

constant definitions

PHP_PASSTHRU = 0 (line 134)

modes for handling of "<?php ... ?>" tags in templates.

constant definitions

PHP_QUOTE = 1 (line 135)

constant definitions

PHP_REMOVE = 2 (line 136)

constant definitions

PLUGIN_BLOCK = 'block' (line 149)

constant definitions

PLUGIN_COMPILER = 'compiler' (line 150)

constant definitions

PLUGIN_FUNCTION = 'function' (line 148)

plugin types

constant definitions

PLUGIN_MODIFIER = 'modifier' (line 151)

constant definitions

PLUGIN_MODIFIERCOMPILER = 'modifiercompiler' (line 152)

constant definitions

SCOPE_GLOBAL = 3 (line 118)

constant definitions

SCOPE_LOCAL = 0 (line 115)

define variable scopes

constant definitions

SCOPE_PARENT = 1 (line 116)

constant definitions

SCOPE_ROOT = 2 (line 117)

constant definitions

SMARTY_VERSION = 'Smarty 3.1-DEV' (line 110)

smarty version

constant definitions

Documentation generated on Sat, 24 Sep 2011 20:23:19 +0200 by phpDocumentor 1.4.1