Smarty_Compiler Class Reference

Inheritance diagram for Smarty_Compiler:

Smarty CMS_Compiler List of all members.

Public Member Functions

 Smarty_Compiler ()
 _compile_file ($resource_name, $source_content, &$compiled_content)
 _compile_tag ($template_tag)
 _compile_compiler_tag ($tag_command, $tag_args, &$output)
 _compile_block_tag ($tag_command, $tag_args, $tag_modifier, &$output)
 _compile_custom_tag ($tag_command, $tag_args, $tag_modifier, &$output)
 _compile_registered_object_tag ($tag_command, $attrs, $tag_modifier)
 _compile_insert_tag ($tag_args)
 _compile_include_tag ($tag_args)
 _compile_include_php_tag ($tag_args)
 _compile_section_start ($tag_args)
 _compile_foreach_start ($tag_args)
 _compile_capture_tag ($start, $tag_args= '')
 _compile_if_tag ($tag_args, $elseif=false)
 _compile_arg_list ($type, $name, $attrs, &$cache_code)
 _parse_is_expr ($is_arg, $tokens)
 _parse_attrs ($tag_args)
 _parse_vars_props (&$tokens)
 _parse_var_props ($val)
 _expand_quoted_text ($var_expr)
 _parse_var ($var_expr)
 _parse_parenth_args ($parenth_args)
 _parse_conf_var ($conf_var_expr)
 _parse_section_prop ($section_prop_expr)
 _parse_modifiers (&$output, $modifier_string)
 _add_plugin ($type, $name, $delayed_loading=null)
 _compile_smarty_ref (&$indexes)
 _compile_plugin_call ($type, $name)
 _load_filters ()
 _quote_replace ($string)
 _syntax_error ($error_msg, $error_type=E_USER_ERROR, $file=null, $line=null)
 _push_cacheable_state ($type, $name)
 _pop_cacheable_state ($type, $name)
 _push_tag ($open_tag)
 _pop_tag ($close_tag)

Public Attributes

 $_folded_blocks = array()
 $_current_file = null
 $_current_line_no = 1
 $_capture_stack = array()
 $_plugin_info = array()
 $_init_smarty_vars = false
 $_permitted_tokens = array('true','false','yes','no','on','off','null')
 $_db_qstr_regexp = null
 $_si_qstr_regexp = null
 $_qstr_regexp = null
 $_func_regexp = null
 $_reg_obj_regexp = null
 $_var_bracket_regexp = null
 $_num_const_regexp = null
 $_dvar_guts_regexp = null
 $_dvar_regexp = null
 $_cvar_regexp = null
 $_svar_regexp = null
 $_avar_regexp = null
 $_mod_regexp = null
 $_var_regexp = null
 $_parenth_param_regexp = null
 $_func_call_regexp = null
 $_obj_ext_regexp = null
 $_obj_start_regexp = null
 $_obj_params_regexp = null
 $_obj_call_regexp = null
 $_cacheable_state = 0
 $_cache_attrs_count = 0
 $_nocache_count = 0
 $_cache_serial = null
 $_cache_include = null
 $_strip_depth = 0
 $_additional_newline = "\n"

Detailed Description

Definition at line 35 of file Smarty_Compiler.class.php.


Member Function Documentation

Smarty_Compiler::Smarty_Compiler (  ) 

The class constructor.

Definition at line 81 of file Smarty_Compiler.class.php.

Smarty_Compiler::_compile_file ( resource_name,
source_content,
&$  compiled_content 
)

compile a resource

sets $compiled_content to the compiled source

Parameters:
string $resource_name
string $source_content
string $compiled_content
Returns:
true

Definition at line 225 of file Smarty_Compiler.class.php.

References _load_filters(), _quote_replace(), and Smarty::_trigger_fatal_error().

Smarty_Compiler::_compile_tag ( template_tag  ) 

Compile a template tag

Parameters:
string $template_tag
Returns:
string

Definition at line 435 of file Smarty_Compiler.class.php.

References _compile_block_tag(), _compile_capture_tag(), _compile_compiler_tag(), _compile_custom_tag(), _compile_foreach_start(), _compile_if_tag(), _compile_include_php_tag(), _compile_include_tag(), _compile_insert_tag(), _compile_registered_object_tag(), _compile_section_start(), _parse_attrs(), _parse_var_props(), _pop_tag(), _push_tag(), and _syntax_error().

Smarty_Compiler::_compile_compiler_tag ( tag_command,
tag_args,
&$  output 
)

compile the custom compiler tag

sets $output to the compiled custom compiler tag

Parameters:
string $tag_command
string $tag_args
string $output
Returns:
boolean

Definition at line 606 of file Smarty_Compiler.class.php.

References Smarty::_get_plugin_filepath(), _pop_cacheable_state(), _push_cacheable_state(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_block_tag ( tag_command,
tag_args,
tag_modifier,
&$  output 
)

compile block function tag

sets $output to compiled block function tag

Parameters:
string $tag_command
string $tag_args
string $tag_modifier
string $output
Returns:
boolean

Definition at line 675 of file Smarty_Compiler.class.php.

References _add_plugin(), _compile_arg_list(), _compile_plugin_call(), Smarty::_get_plugin_filepath(), _parse_attrs(), _parse_modifiers(), _pop_cacheable_state(), _pop_tag(), _push_cacheable_state(), _push_tag(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_custom_tag ( tag_command,
tag_args,
tag_modifier,
&$  output 
)

compile custom function tag

Parameters:
string $tag_command
string $tag_args
string $tag_modifier
Returns:
string

Reimplemented in CMS_Compiler.

Definition at line 766 of file Smarty_Compiler.class.php.

References $_cacheable_state, _add_plugin(), _compile_arg_list(), _compile_plugin_call(), Smarty::_get_plugin_filepath(), _parse_attrs(), _parse_modifiers(), _pop_cacheable_state(), _push_cacheable_state(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_registered_object_tag ( tag_command,
attrs,
tag_modifier 
)

compile a registered object tag

Parameters:
string $tag_command
array $attrs
string $tag_modifier
Returns:
string

Definition at line 839 of file Smarty_Compiler.class.php.

References Smarty::_dequote(), _parse_modifiers(), Smarty::_trigger_fatal_error(), and Smarty::assign().

Referenced by _compile_tag().

Smarty_Compiler::_compile_insert_tag ( tag_args  ) 

Compile {insert ...} tag

Parameters:
string $tag_args
Returns:
string

Definition at line 931 of file Smarty_Compiler.class.php.

References _add_plugin(), Smarty::_dequote(), _parse_attrs(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_include_tag ( tag_args  ) 

Compile {include ...} tag

Parameters:
string $tag_args
Returns:
string

Definition at line 969 of file Smarty_Compiler.class.php.

References _parse_attrs(), _syntax_error(), and Smarty::assign().

Referenced by _compile_tag().

Smarty_Compiler::_compile_include_php_tag ( tag_args  ) 

Compile {include ...} tag

Parameters:
string $tag_args
Returns:
string

Definition at line 1022 of file Smarty_Compiler.class.php.

References Smarty::_dequote(), _parse_attrs(), _syntax_error(), and Smarty::assign().

Referenced by _compile_tag().

Smarty_Compiler::_compile_section_start ( tag_args  ) 

Compile {section ...} tag

Parameters:
string $tag_args
Returns:
string

Definition at line 1054 of file Smarty_Compiler.class.php.

References _parse_attrs(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_foreach_start ( tag_args  ) 

Compile {foreach ...} tag.

Parameters:
string $tag_args
Returns:
string

Definition at line 1159 of file Smarty_Compiler.class.php.

References Smarty::_dequote(), _parse_attrs(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_compile_capture_tag ( start,
tag_args = '' 
)

Compile {capture} .. {/capture} tags

Parameters:
boolean $start true if this is the {capture} tag
string $tag_args
Returns:
string

Definition at line 1220 of file Smarty_Compiler.class.php.

References _parse_attrs(), and Smarty::assign().

Referenced by _compile_tag().

Smarty_Compiler::_compile_if_tag ( tag_args,
elseif = false 
)

Compile {if ...} tag

Parameters:
string $tag_args
boolean $elseif if true, uses elseif instead of if
Returns:
string

Definition at line 1255 of file Smarty_Compiler.class.php.

References _parse_is_expr(), _parse_var_props(), and _syntax_error().

Referenced by _compile_tag().

Smarty_Compiler::_parse_is_expr ( is_arg,
tokens 
)

Parse is expression

Parameters:
string $is_arg
array $tokens
Returns:
array

Definition at line 1460 of file Smarty_Compiler.class.php.

References _parse_var_props(), and _syntax_error().

Referenced by _compile_if_tag().

Smarty_Compiler::_parse_attrs ( tag_args  ) 

Parse attribute string

Parameters:
string $tag_args
Returns:
array

Definition at line 1521 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_capture_tag(), _compile_custom_tag(), CMS_Compiler::_compile_custom_tag(), _compile_foreach_start(), _compile_include_php_tag(), _compile_include_tag(), _compile_insert_tag(), _compile_section_start(), and _compile_tag().

Smarty_Compiler::_parse_vars_props ( &$  tokens  ) 

compile multiple variables and section properties tokens into PHP code

Parameters:
array $tokens

Definition at line 1605 of file Smarty_Compiler.class.php.

References _parse_var_props().

Smarty_Compiler::_parse_var_props ( val  ) 

compile single variable and section properties token into PHP code

Parameters:
string $val
string $tag_attrs
Returns:
string

Definition at line 1620 of file Smarty_Compiler.class.php.

References _expand_quoted_text(), _parse_conf_var(), _parse_modifiers(), _parse_section_prop(), and _parse_var().

Referenced by _compile_if_tag(), _compile_tag(), _parse_is_expr(), and _parse_vars_props().

Smarty_Compiler::_expand_quoted_text ( var_expr  ) 

expand quoted text with embedded variables

Parameters:
string $var_expr
Returns:
string

Definition at line 1680 of file Smarty_Compiler.class.php.

Referenced by _parse_var_props().

Smarty_Compiler::_parse_var ( var_expr  ) 

parse variable expression into PHP code

Parameters:
string $var_expr
string $output
Returns:
string

Definition at line 1706 of file Smarty_Compiler.class.php.

References _compile_smarty_ref(), _parse_parenth_args(), _syntax_error(), and Smarty::trigger_error().

Referenced by _parse_var_props().

Smarty_Compiler::_parse_parenth_args ( parenth_args  ) 

parse arguments in function call parenthesis

Parameters:
string $parenth_args
Returns:
string

Definition at line 1841 of file Smarty_Compiler.class.php.

Referenced by _parse_var().

Smarty_Compiler::_parse_conf_var ( conf_var_expr  ) 

parse configuration variable expression into PHP code

Parameters:
string $conf_var_expr

Definition at line 1858 of file Smarty_Compiler.class.php.

Referenced by _parse_var_props().

Smarty_Compiler::_parse_section_prop ( section_prop_expr  ) 

parse section property expression into PHP code

Parameters:
string $section_prop_expr
Returns:
string

Definition at line 1879 of file Smarty_Compiler.class.php.

Referenced by _parse_var_props().

Smarty_Compiler::_parse_modifiers ( &$  output,
modifier_string 
)

parse modifier chain into PHP code

sets $output to parsed modified chain

Parameters:
string $output
string $modifier_string

Definition at line 1904 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_custom_tag(), CMS_Compiler::_compile_custom_tag(), _compile_registered_object_tag(), and _parse_var_props().

Smarty_Compiler::_add_plugin ( type,
name,
delayed_loading = null 
)

add plugin

Parameters:
string $type
string $name
boolean? $delayed_loading

Definition at line 1973 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_custom_tag(), CMS_Compiler::_compile_custom_tag(), and _compile_insert_tag().

Smarty_Compiler::_compile_smarty_ref ( &$  indexes  ) 

Compiles references of type $smarty.foo

Parameters:
string $indexes
Returns:
string

Definition at line 1992 of file Smarty_Compiler.class.php.

Referenced by _parse_var().

Smarty_Compiler::_compile_plugin_call ( type,
name 
)

compiles call to plugin of type $type with name $name returns a string containing the function-name or method call without the paramter-list that would have follow to make the call valid php-syntax

Parameters:
string $type
string $name
Returns:
string

Definition at line 2148 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_custom_tag(), and CMS_Compiler::_compile_custom_tag().

Smarty_Compiler::_load_filters (  ) 

load pre- and post-filters

Definition at line 2172 of file Smarty_Compiler.class.php.

Referenced by _compile_file().

Smarty_Compiler::_quote_replace ( string  ) 

Quote subpattern references

Parameters:
string $string
Returns:
string

Definition at line 2203 of file Smarty_Compiler.class.php.

Referenced by _compile_file().

Smarty_Compiler::_syntax_error ( error_msg,
error_type = E_USER_ERROR,
file = null,
line = null 
)

display Smarty syntax error

Parameters:
string $error_msg
integer $error_type
string $file
integer $line

Reimplemented in CMS_Compiler.

Definition at line 2216 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_compiler_tag(), _compile_custom_tag(), _compile_foreach_start(), _compile_if_tag(), _compile_include_php_tag(), _compile_include_tag(), _compile_insert_tag(), _compile_section_start(), _compile_tag(), _parse_is_expr(), and _parse_var().

Smarty_Compiler::_push_cacheable_state ( type,
name 
)

check if the compilation changes from cacheable to non-cacheable state with the beginning of the current plugin. return php-code to reflect the transition.

Returns:
string

Definition at line 2228 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_compiler_tag(), _compile_custom_tag(), and CMS_Compiler::_compile_custom_tag().

Smarty_Compiler::_pop_cacheable_state ( type,
name 
)

check if the compilation changes from non-cacheable to cacheable state with the end of the current plugin return php-code to reflect the transition.

Returns:
string

Definition at line 2246 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), _compile_compiler_tag(), _compile_custom_tag(), and CMS_Compiler::_compile_custom_tag().

Smarty_Compiler::_push_tag ( open_tag  ) 

push opening tag-name, file-name and line-number on the tag-stack

Parameters:
string the opening tag's name

Definition at line 2260 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), and _compile_tag().

Smarty_Compiler::_pop_tag ( close_tag  ) 

pop closing tag-name raise an error if this stack-top doesn't match with the closing tag

Parameters:
string the closing tag's name
Returns:
string the opening tag's name

Definition at line 2271 of file Smarty_Compiler.class.php.

Referenced by _compile_block_tag(), and _compile_tag().


Member Data Documentation

Smarty_Compiler::$_folded_blocks = array()

#@+ private

Definition at line 41 of file Smarty_Compiler.class.php.


The documentation for this class was generated from the following file:
Generated on Sun Dec 14 14:20:27 2008 for CMSMS by  doxygen 1.5.1