abstract |
---|
Main abstract compiler class
Methods | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public
|
__construct(Smarty $smarty)
Initialize compiler
Initialize compiler Parameters
Overriden by |
# | ||||||||||||
public
|
compileTemplate(
Smarty_Internal_Template $template,
bool $nocache = null,
null|Smarty_Internal_TemplateCompilerBase $parent_compiler = null,
): bool
Method to compile a Smarty template
Method to compile a Smarty template Parameters
Returnstrue if compiling succeeded, false if it failed Throws
|
# | ||||||||||||
public
|
compileTemplateSource(
Smarty_Internal_Template $template,
null|bool $nocache = null,
Smarty_Internal_TemplateCompilerBase $parent_compiler = null,
): string
Compile template source and run optional post filter
Compile template source and run optional post filter Parameters
Throws
|
# | ||||||||||||
public
|
postFilter(string $code): string
Optionally process compiled code by post filter
Optionally process compiled code by post filter Parameters
Throws
|
# | ||||||||||||
public
|
preFilter(string $_content): string
Run optional prefilter
|
# | ||||||||||||
public
|
compileTag(string $tag, array $args, array $parameter = []): string
Compile Tag
This is a call back from the lexer/parser
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
Returnscompiled code Throws
|
# | ||||||||||||
public
|
compileVariable(string $variable): string
compile variable
compile variable |
# | ||||||||||||
public
|
compileConfigVariable(string $variable): string
compile config variable
compile config variable |
# | ||||||||||||
public
|
compilePHPFunctionCall(string $name, array $parameter): string
compile PHP function call
|
# | ||||||||||||
public
|
processText(string $text): string
This method is called from parser to process a text content section if strip is enabled
- remove text from inheritance…
This method is called from parser to process a text content section if strip is enabled
|
# | ||||||||||||
public
|
callTagCompiler(string $tag, array $args, mixed $param1 = null, mixed $param2 = null, mixed $param3 = null): bool|string
lazy loads internal compile plugin for tag and calls the compile method
compile objects cached for reuse.
class name…
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
Returnscompiled code or false Throws
|
# | ||||||||||||
public
|
getTagCompiler(string $tag): bool|Smarty_Internal_CompileBase
lazy loads internal compile plugin for tag compile objects cached for reuse.
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
Returnstag compiler object or false if not found |
# | ||||||||||||
public
|
getPlugin($plugin_name, string $plugin_type): string
Check for plugins and return function name
Check for plugins and return function name Parameters
Returnscall name of function Throws
|
# | ||||||||||||
public
|
getPluginFromDefaultHandler(string $tag, string $plugin_type): bool
Check for plugins by default plugin handler
Check for plugins by default plugin handler Parameters
Returnstrue if found Throws
|
# | ||||||||||||
public
|
appendCode(string $left, string $right): string
Append code segments and remove unneeded ?> <?php transitions
Append code segments and remove unneeded ?> <?php transitions |
# | ||||||||||||
public
|
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.…
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
Returnscontent |
# | ||||||||||||
public
|
getId(string $input): bool|string
Get Id
Get Id |
# | ||||||||||||
public
|
getVariableName(string $input): bool|string
Get variable name from string
Get variable name from string |
# | ||||||||||||
public
|
setNocacheInVariable(string $varName)
Set nocache flag in variable or create new variable
Set nocache flag in variable or create new variable |
# | ||||||||||||
public
|
convertScope(array $_attr, array $validScopes): int|string
|
# | ||||||||||||
public
|
makeNocacheCode(string $code): string
Generate nocache code string
Generate nocache code string Parameters
|
# | ||||||||||||
public
|
trigger_template_error(string $args = null, string $line = null, null|bool $tagline = null)
display compiler error messages without dying
If parameter $args is empty it is a parser detected syntax error.
In this…
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
Throws
|
# | ||||||||||||
public
|
getVarExport(mixed $value): string
Return var_export() value with all white spaces removed
Return var_export() value with all white spaces removed |
# | ||||||||||||
public
|
enterDoubleQuote()
enter double quoted string
- save tag stack count
enter double quoted string
|
# | ||||||||||||
public
|
getTagStackCount(): int
Return tag stack count
Return tag stack count |
# | ||||||||||||
public
|
replaceDelimiter($lexerPreg): mixed
|
# | ||||||||||||
public
|
initDelimiterPreg()
Build lexer regular expressions for left and right delimiter and user defined literals
Build lexer regular expressions for left and right delimiter and user defined literals |
# | ||||||||||||
public
|
leaveDoubleQuote()
leave double quoted string
- throw exception if block in string was not closed
leave double quoted string
Throws
|
# | ||||||||||||
public
|
getLdelPreg(): string
Get left delimiter preg
Get left delimiter preg |
# | ||||||||||||
public
|
getRdelPreg(): string
Get right delimiter preg
Get right delimiter preg |
# | ||||||||||||
public
|
getLdelLength(): int
Get length of left delimiter
Get length of left delimiter |
# | ||||||||||||
public
|
getRdelLength(): int
Get length of right delimiter
Get length of right delimiter |
# | ||||||||||||
public
|
getOpenBlockTag(): string|boolean
Get name of current open block tag
Get name of current open block tag |
# | ||||||||||||
public
|
isVariable(mixed $value): bool|int
Check if $value contains variable elements
Check if $value contains variable elements |
# | ||||||||||||
public
|
getNewPrefixVariable(): string
Get new prefix variable name
Get new prefix variable name |
# | ||||||||||||
public
|
getPrefixVariable(): string
Get current prefix variable name
Get current prefix variable name |
# | ||||||||||||
public
|
appendPrefixCode(string $code)
append code to prefix buffer
append code to prefix buffer |
# | ||||||||||||
public
|
getPrefixCode(): string
get prefix code string
get prefix code string |
# | ||||||||||||
public
|
saveRequiredPlugins(bool $init = false)
Save current required plugins
Save current required plugins Parameters
|
# | ||||||||||||
public
|
restoreRequiredPlugins()
Restore required plugins
Restore required plugins |
# | ||||||||||||
public
|
compileRequiredPlugins(): string
Compile code to call Smarty_Internal_Template::_checkPlugins()
for required plugins
Compile code to call Smarty_Internal_Template::_checkPlugins() for required plugins |
# | ||||||||||||
public
|
compileCheckPlugins($requiredPlugins): string
Compile code to call Smarty_Internal_Template::_checkPlugins
- checks if plugin is callable require otherwise
Compile code to call Smarty_Internal_Template::_checkPlugins
|
# | ||||||||||||
abstract
protected
|
doCompile(mixed $_content, bool $isTemplateSource = false): bool
method to compile a Smarty template
method to compile a Smarty template Parameters
Returnstrue if compiling succeeded, false if it failed Implemented by |
# | ||||||||||||
public
|
cStyleComment($string)
|
# | ||||||||||||
public
|
registerPostCompileCallback($callback, $parameter = [], $key = null, $replace = false)
|
# | ||||||||||||
public
|
unregisterPostCompileCallback($key)
|
# |
Properties | |||
---|---|---|---|
public
static
|
array
|
$_tag_objects = []
|
# |
public
static
|
int
|
$prefixVariableNumber = 0
|
# |
public
|
Smarty
|
$smarty = null
|
# |
public
|
Smarty_Internal_Templateparser
|
$parser = null
|
# |
public
|
mixed
|
$nocache_hash = null
|
# |
public
|
bool
|
$suppressNocacheProcessing = false
|
# |
public
|
int
|
$caching = 0
|
# |
public
|
array
|
$_tag_stack = []
|
# |
public
|
array
|
$_tag_stack_count = []
|
# |
public
|
array
|
$required_plugins = ['compiled' => [], 'nocache' => []]
|
# |
public
|
array
|
$required_plugins_stack = []
|
# |
public
|
Smarty_Internal_Template
|
$template = null
|
# |
public
|
array
|
$mergedSubTemplatesData = []
|
# |
public
|
array
|
$mergedSubTemplatesCode = []
|
# |
public
|
array
|
$templateProperties = []
|
# |
public
|
int
|
$trace_line_offset = 0
|
# |
public
|
string
|
$trace_uid = ''
|
# |
public
|
string
|
$trace_filepath = ''
|
# |
public
|
array
|
$trace_stack = []
|
# |
public
|
array
|
$default_handler_plugins = []
|
# |
public
|
mixed
|
$default_modifier_list = null
|
# |
public
|
boolean
|
$forceNocache = false
|
# |
public
|
bool
|
$write_compiled_code = true
|
# |
public
|
array
|
$tpl_function = []
|
# |
public
|
array
|
$called_functions = []
|
# |
public
|
string
|
$blockOrFunctionCode = ''
|
# |
public
|
int
|
$php_handling = 0
|
# |
public
|
array
|
$modifier_plugins = []
|
# |
public
|
array
|
$known_modifier_type = []
|
# |
public
|
Smarty_Internal_TemplateCompilerBase
|
$parent_compiler = null
|
# |
public
|
bool
|
$nocache = false
|
# |
public
|
bool
|
$tag_nocache = false
|
# |
public
|
array
|
$prefix_code = []
|
# |
public
|
array
|
$usedPrefixVariables = []
|
# |
public
|
array
|
$prefixCodeStack = []
|
# |
public
|
bool
|
$has_code = false
|
# |
public
|
bool
|
$has_variable_string = false
|
# |
public
|
array
|
$variable_filter_stack = []
|
# |
public
|
array
|
$variable_filters = []
|
# |
public
|
int
|
$loopNesting = 0
|
# |
public
|
string
|
$stripRegEx = '![\t ]*[\r\n]+[\t ]*!'
|
# |
public
|
array
|
$plugin_search_order = ['function', 'block', 'compiler', 'class']
|
# |
public
|
array
|
$_cache = []
|
# |
public
|
Smarty_Internal_SmartyTemplateCompiler
|
$prefixCompiledCode
= ''
= '' |
# |
public
|
Smarty_Internal_SmartyTemplateCompiler
|
$postfixCompiledCode
= ''
= '' |
# |