Properties

$smarty

$smarty : \Smarty

Smarty object

Type

\Smarty

$nocache_hash

$nocache_hash : mixed

hash for nocache sections

Type

mixed

$suppressNocacheProcessing

$suppressNocacheProcessing : boolean

suppress generation of nocache code

Type

boolean

$_tag_objects

$_tag_objects : array

compile tag objects cache

Type

array

$_tag_stack

$_tag_stack : array

tag stack

Type

array

$mergedSubTemplatesData

$mergedSubTemplatesData : array

merged included sub template data

Type

array

$mergedSubTemplatesCode

$mergedSubTemplatesCode : array

merged sub template code

Type

array

$templateProperties

$templateProperties : array

collected template properties during compilation

Type

array

$trace_line_offset

$trace_line_offset : integer

source line offset for error messages

Type

integer

$trace_uid

$trace_uid : string

trace uid

Type

string

$trace_filepath

$trace_filepath : string

trace file path

Type

string

$trace_stack

$trace_stack : array

stack for tracing file and line of nested {block} tags

Type

array

$default_handler_plugins

$default_handler_plugins : array

plugins loaded by default plugin handler

Type

array

$default_modifier_list

$default_modifier_list : mixed

saved preprocessed modifier list

Type

mixed

$forceNocache

$forceNocache : boolean

force compilation of complete template as nocache

Type

boolean

$write_compiled_code

$write_compiled_code : boolean

flag if compiled template file shall we written

Type

boolean

$tpl_function

$tpl_function : array

Template functions

Type

array

$called_functions

$called_functions : array

called sub functions from template function

Type

array

$blockOrFunctionCode

$blockOrFunctionCode : string

compiled template or block function code

Type

string

$php_handling

$php_handling : integer

php_handling setting either from Smarty or security

Type

integer

$modifier_plugins

$modifier_plugins : array

flags for used modifier plugins

Type

array

$known_modifier_type

$known_modifier_type : array

type of already compiled modifier

Type

array

$parent_compiler

$parent_compiler : \Smarty_Internal_TemplateCompilerBase

parent compiler object for merged subtemplates and template functions

Type

\Smarty_Internal_TemplateCompilerBase

$nocache

$nocache : boolean

Flag true when compiling nocache section

Type

boolean

$tag_nocache

$tag_nocache : boolean

Flag true when tag is compiled as nocache

Type

boolean

$prefix_code

$prefix_code : array

Compiled tag prefix code

Type

array

$prefixCodeStack

$prefixCodeStack : array

Prefix code stack

Type

array

$has_code

$has_code : boolean

Tag has compiled code

Type

boolean

$has_variable_string

$has_variable_string : boolean

A variable string was compiled

Type

boolean

$has_output

$has_output : boolean

Tag creates output

Type

boolean

$variable_filter_stack

$variable_filter_stack : array

Stack for {setfilter} {/setfilter}

Type

array

$variable_filters

$variable_filters : array

variable filters for {setfilter} {/setfilter}

Type

array

$loopNesting

$loopNesting : integer

Nesting count of looping tags like {foreach}, {for}, {section}, {while}

Type

integer

$stripRegEx

$stripRegEx : string

Strip preg pattern

Type

string

$plugin_search_order

$plugin_search_order : array

plugin search order

Type

array

$_cache

$_cache : array

General storage area for tag compiler plugins

Type

array

$prefixVariableNumber

$prefixVariableNumber : integer

counter for prefix variable number

Type

integer

$prefixCompiledCode

$prefixCompiledCode : \Smarty_Internal_SmartyTemplateCompiler

= ''

Type

\Smarty_Internal_SmartyTemplateCompiler

$postfixCompiledCode

$postfixCompiledCode : \Smarty_Internal_SmartyTemplateCompiler

= ''

Type

\Smarty_Internal_SmartyTemplateCompiler

Methods

__construct()

__construct(\Smarty  $smarty) 

Initialize compiler

Parameters

\Smarty $smarty

global instance

compileTemplate()

compileTemplate(\Smarty_Internal_Template  $template, boolean  $nocache = null, null|\Smarty_Internal_TemplateCompilerBase  $parent_compiler = null) : boolean

Method to compile a Smarty template

Parameters

\Smarty_Internal_Template $template

template object to compile

boolean $nocache

true is shall be compiled in nocache mode

null|\Smarty_Internal_TemplateCompilerBase $parent_compiler

Throws

\Exception

Returns

boolean —

true if compiling succeeded, false if it failed

compileTemplateSource()

compileTemplateSource(\Smarty_Internal_Template  $template, null|boolean  $nocache = null, \Smarty_Internal_TemplateCompilerBase  $parent_compiler = null) : string

Compile template source and run optional post filter

Parameters

\Smarty_Internal_Template $template
null|boolean $nocache

flag if template must be compiled in nocache mode

\Smarty_Internal_TemplateCompilerBase $parent_compiler

Throws

\Exception

Returns

string

postFilter()

postFilter(string  $code) : string

Optionally process compiled code by post filter

Parameters

string $code

compiled code

Throws

\SmartyException

Returns

string

preFilter()

preFilter(string  $_content) : string

Run optional prefilter

Parameters

string $_content

template source

Throws

\SmartyException

Returns

string

compileTag()

compileTag(string  $tag, array  $args, array  $parameter = array()) : string

Compile Tag This is a call back from the lexer/parser

Save current prefix code Compile tag Merge tag prefix code with saved one (required nested tags in attributes)

Parameters

string $tag

tag name

array $args

array with tag attributes

array $parameter

array with compilation parameter

Throws

\SmartyCompilerException
\SmartyException

Returns

string —

compiled code

compileVariable()

compileVariable(string  $variable) : string

compile variable

Parameters

string $variable

Returns

string

compileConfigVariable()

compileConfigVariable(string  $variable) : string

compile config variable

Parameters

string $variable

Returns

string

compilePHPFunctionCall()

compilePHPFunctionCall(string  $name, array  $parameter) : string

compile PHP function call

Parameters

string $name
array $parameter

Returns

string

processText()

processText(string  $text) : null|\Smarty_Internal_ParseTree_Text

This method is called from parser to process a text content section - remove text from inheritance child templates as they may generate output - strip text if strip is enabled

Parameters

string $text

Returns

null|\Smarty_Internal_ParseTree_Text

callTagCompiler()

callTagCompiler(string  $tag, array  $args, mixed  $param1 = null, mixed  $param2 = null, mixed  $param3 = null) : string|boolean

lazy loads internal compile plugin for tag and calls the compile method compile objects cached for reuse.

class name format: Smarty_Internal_Compile_TagName plugin filename format: Smarty_Internal_TagName.php

Parameters

string $tag

tag name

array $args

list of tag attributes

mixed $param1

optional parameter

mixed $param2

optional parameter

mixed $param3

optional parameter

Returns

string|boolean —

compiled code or false

getTagCompiler()

getTagCompiler(string  $tag) : \Smarty_Internal_CompileBase|boolean

lazy loads internal compile plugin for tag compile objects cached for reuse.

class name format: Smarty_Internal_Compile_TagName plugin filename format: Smarty_Internal_TagName.php

Parameters

string $tag

tag name

Returns

\Smarty_Internal_CompileBase|boolean —

tag compiler object or false if not found

getPlugin()

getPlugin(  $plugin_name, string  $plugin_type) : string

Check for plugins and return function name

Parameters

$plugin_name
string $plugin_type

type of plugin

Returns

string —

call name of function

getPluginFromDefaultHandler()

getPluginFromDefaultHandler(string  $tag, string  $plugin_type) : boolean

Check for plugins by default plugin handler

Parameters

string $tag

name of tag

string $plugin_type

type of plugin

Returns

boolean —

true if found

appendCode()

appendCode(string  $left, string  $right) : string

Append code segments and remove unneeded ?> <?php transitions

Parameters

string $left
string $right

Returns

string

processNocacheCode()

processNocacheCode(string  $content, boolean  $is_code) : string

Inject inline code for nocache template sections This method gets the content of each template element from the parser.

If the content is compiled code and it should be not cached the code is injected into the rendered output.

Parameters

string $content

content of template element

boolean $is_code

true if content is compiled code

Returns

string —

content

getId()

getId(string  $input) : boolean|string

Get Id

Parameters

string $input

Returns

boolean|string

getVariableName()

getVariableName(string  $input) : boolean|string

Get variable name from string

Parameters

string $input

Returns

boolean|string

setNocacheInVariable()

setNocacheInVariable(string  $varName) 

Set nocache flag in variable or create new variable

Parameters

string $varName

convertScope()

convertScope(array  $_attr, array  $validScopes) : integer|string

Parameters

array $_attr

tag attributes

array $validScopes

Throws

\SmartyCompilerException

Returns

integer|string

makeNocacheCode()

makeNocacheCode(string  $code) : string

Generate nocache code string

Parameters

string $code

PHP code

Returns

string

trigger_template_error()

trigger_template_error(string  $args = null, string  $line = null, null|boolean  $tagline = null) 

display compiler error messages without dying If parameter $args is empty it is a parser detected syntax error.

In this case the parser is called to obtain information about expected tokens. If parameter $args contains a string this is used as error message

Parameters

string $args

individual error message or null

string $line

line-number

null|boolean $tagline

if true the line number of last tag

Throws

\SmartyCompilerException

when an unexpected token is found

getVarExport()

getVarExport(mixed  $value) : string

Return var_export() value with all white spaces removed

Parameters

mixed $value

Returns

string

isVariable()

isVariable(mixed  $value) : boolean|integer

Check if $value contains variable elements

Parameters

mixed $value

Returns

boolean|integer

getNewPrefixVariable()

getNewPrefixVariable() : string

Get new prefix variable name

Returns

string

getPrefixVariable()

getPrefixVariable() : string

Get current prefix variable name

Returns

string

appendPrefixCode()

appendPrefixCode(string  $code) 

append code to prefix buffer

Parameters

string $code

getPrefixCode()

getPrefixCode() : string

get prefix code string

Returns

string

registerPostCompileCallback()

registerPostCompileCallback(mixed  $callback, mixed  $parameter = array() : void

, $key = null, $replace = false)

Parameters

mixed $callback
mixed $parameter

unregisterPostCompileCallback()

unregisterPostCompileCallback(mixed  $key) : void

Parameters

mixed $key

doCompile()

doCompile(mixed  $_content, boolean  $isTemplateSource = false) : boolean

method to compile a Smarty template

Parameters

mixed $_content

template source

boolean $isTemplateSource

Returns

boolean —

true if compiling succeeded, false if it failed

compileTag2()

compileTag2(string  $tag, array  $args, array  $parameter) : string

Compile Tag

Parameters

string $tag

tag name

array $args

array with tag attributes

array $parameter

array with compilation parameter

Throws

\SmartyCompilerException
\SmartyException

Returns

string —

compiled code