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 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
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 array $_smarty_vars = array() (line 500)

global internal smarty vars

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

controls if the php template file resource is allowed

security

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

autoload filter

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

auto literal on delimiters with whitspace

variables

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

cache directory

variables

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

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

variables

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

cache lifetime in seconds

variables

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

Controls whether cache resources should emply locking mechanism

resource locking

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

check If-Modified-Since headers

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

caching enabled

variables

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

caching type

Must be an element of $cache_resource_types.

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

check template for modifications?

variables

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

compile directory

variables

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

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

variables

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

locking concurrent compiles

resource locking

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

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 219)

config directory

variables

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

Controls whether variables with the same name overwrite each other.

config var settings

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

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

config var settings

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

debug mode

Setting this to true enables the debug-console.

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

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 350)

Path of debug template.

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

default config handler

variables

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

config type

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

default modifier

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

default plugin handler

variables

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

resource type used if none given

Must be an valid key of $registered_resources.

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

default template handler

variables

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

Should compiled-templates be prevented from being called directly?

security

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

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

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

display error on not assigned variables

variables

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

autoescape variable output

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

force cache file creation

variables

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

force template compiling?

variables

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

Internal flag for getTags()

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

template left-delimiter

variables

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

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

resource locking

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

merge compiled includes

variables

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

controls handling of PHP-blocks

security

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

plugins directory

variables

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

plugin search order

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

internal config properties

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

registered cache resources

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

registered classes

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

registered filters

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

registered objects

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

registered plugins

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

registered resources

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

template right-delimiter

variables

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

class name

security This should be instance of Smarty_Security.

Smarty_Security $security_policy = null (line 296)

implementation of security class

security

  • access: public
Smarty $smarty (line 525)

self pointer to Smarty object

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

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 505)

start time for execution time calculation

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

template directory

variables

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

global template functions

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

cached template objects

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

look up relative filepaths in include_path

variables

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

use sub dirs for compiled/cached files?

variables

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

required by the compiler for BC

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

default dir permissions

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

default file permissions

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

internal flag to enable parser debugging

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

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
Constructor __construct (line 542)

Initialize new Smarty object

  • access: public
Smarty __construct ()

Redefined in descendants as:
Destructor __destruct (line 565)

Class destructor

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

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 833)

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 993)

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 897)

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 769)

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 679)

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 697)

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 1247)

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 1234)

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 1220)

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 1113)

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 738)

Disable security

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

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 1067)

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 970)

Get cache directory

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

Get compiled directory

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

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 1081)

return name of debugging template

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

Get default modifiers

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

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 926)

Get plugin directories

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

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 801)

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 1167)

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 1022)

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 959)

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 937)

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 816)

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 1093)

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 981)

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 880)

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 751)

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 637)

Check if a template resource exists

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

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 573)

magic>> set selfpointer on cloned object

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

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 614)

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 Sun, 11 Sep 2011 11:02:48 +0200 by phpDocumentor 1.4.1