mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
update function headers
This commit is contained in:
@@ -118,28 +118,46 @@ function smarty_mod_truncate($string, $length = 80, $etc = '...', $break_words =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_spacify
|
||||||
|
Purpose: add spaces between characters in a string
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_spacify($string, $spacify_char = ' ')
|
function smarty_mod_spacify($string, $spacify_char = ' ')
|
||||||
{
|
{
|
||||||
return implode($spacify_char, preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
|
return implode($spacify_char, preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_date_format
|
||||||
|
Purpose: format datestamps via strftime
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_date_format($string, $format="%b %e, %Y")
|
function smarty_mod_date_format($string, $format="%b %e, %Y")
|
||||||
{
|
{
|
||||||
return strftime($format, $string);
|
return strftime($format, $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_string_format
|
||||||
|
Purpose: format strings via sprintf
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_string_format($string, $format)
|
function smarty_mod_string_format($string, $format)
|
||||||
{
|
{
|
||||||
return sprintf($format, $string);
|
return sprintf($format, $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_replace
|
||||||
|
Purpose: simple search/replace
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_replace($string, $search, $replace)
|
function smarty_mod_replace($string, $search, $replace)
|
||||||
{
|
{
|
||||||
return str_replace($search, $replace, $string);
|
return str_replace($search, $replace, $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_strip_tags
|
||||||
|
Purpose: strip html tags from text
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_strip_tags($string, $replace_with_space = true)
|
function smarty_mod_strip_tags($string, $replace_with_space = true)
|
||||||
{
|
{
|
||||||
if ($replace_with_space)
|
if ($replace_with_space)
|
||||||
@@ -148,6 +166,10 @@ function smarty_mod_strip_tags($string, $replace_with_space = true)
|
|||||||
return strip_tags($string);
|
return strip_tags($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_mod_default
|
||||||
|
Purpose: designate default text for empty variables
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_mod_default($string, $default="")
|
function smarty_mod_default($string, $default="")
|
||||||
{
|
{
|
||||||
if(empty($string))
|
if(empty($string))
|
||||||
@@ -273,6 +295,10 @@ function smarty_func_html_select_date()
|
|||||||
print $html_result;
|
print $html_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_func_math
|
||||||
|
Purpose: allow math computations in template
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_func_math() {
|
function smarty_func_math() {
|
||||||
$args=func_get_arg(0);
|
$args=func_get_arg(0);
|
||||||
|
|
||||||
@@ -320,6 +346,10 @@ function smarty_func_math() {
|
|||||||
eval("echo ".$equation.";");
|
eval("echo ".$equation.";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*======================================================================*\
|
||||||
|
Function: smarty_func_fetch
|
||||||
|
Purpose: fetch file, web or ftp data and display results
|
||||||
|
\*======================================================================*/
|
||||||
function smarty_func_fetch() {
|
function smarty_func_fetch() {
|
||||||
extract(func_get_arg(0));
|
extract(func_get_arg(0));
|
||||||
|
|
||||||
|
@@ -124,7 +124,6 @@ class Smarty
|
|||||||
Function: assign()
|
Function: assign()
|
||||||
Purpose: assigns values to template variables
|
Purpose: assigns values to template variables
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function assign($tpl_var, $value = NULL)
|
function assign($tpl_var, $value = NULL)
|
||||||
{
|
{
|
||||||
if (is_array($tpl_var)){
|
if (is_array($tpl_var)){
|
||||||
@@ -167,7 +166,6 @@ class Smarty
|
|||||||
Function: clear_assign()
|
Function: clear_assign()
|
||||||
Purpose: clear the given assigned template variable.
|
Purpose: clear the given assigned template variable.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_assign($tpl_var)
|
function clear_assign($tpl_var)
|
||||||
{
|
{
|
||||||
if(is_array($tpl_var))
|
if(is_array($tpl_var))
|
||||||
@@ -220,7 +218,6 @@ class Smarty
|
|||||||
Function: clear_cache()
|
Function: clear_cache()
|
||||||
Purpose: clear cached content for the given template and cache id
|
Purpose: clear cached content for the given template and cache id
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_cache($tpl_file, $cache_id = null)
|
function clear_cache($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
$cache_tpl_md5 = md5(realpath($this->template_dir.'/'.$tpl_file));
|
$cache_tpl_md5 = md5(realpath($this->template_dir.'/'.$tpl_file));
|
||||||
@@ -243,7 +240,6 @@ class Smarty
|
|||||||
Function: clear_all_cache()
|
Function: clear_all_cache()
|
||||||
Purpose: clear the entire contents of cache (all templates)
|
Purpose: clear the entire contents of cache (all templates)
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_all_cache()
|
function clear_all_cache()
|
||||||
{
|
{
|
||||||
if (!is_dir($this->cache_dir))
|
if (!is_dir($this->cache_dir))
|
||||||
@@ -267,7 +263,6 @@ class Smarty
|
|||||||
Function: is_cached()
|
Function: is_cached()
|
||||||
Purpose: test to see if valid cache exists for this template
|
Purpose: test to see if valid cache exists for this template
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function is_cached($tpl_file, $cache_id = null)
|
function is_cached($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
if (!$this->caching)
|
if (!$this->caching)
|
||||||
@@ -293,7 +288,6 @@ class Smarty
|
|||||||
Function: clear_all_assign()
|
Function: clear_all_assign()
|
||||||
Purpose: clear all the assigned template variables.
|
Purpose: clear all the assigned template variables.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_all_assign()
|
function clear_all_assign()
|
||||||
{
|
{
|
||||||
$this->_tpl_vars = array();
|
$this->_tpl_vars = array();
|
||||||
@@ -314,7 +308,6 @@ class Smarty
|
|||||||
Function: display()
|
Function: display()
|
||||||
Purpose: executes & displays the template results
|
Purpose: executes & displays the template results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function display($tpl_file, $cache_id = null)
|
function display($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
$this->fetch($tpl_file, $cache_id, true);
|
$this->fetch($tpl_file, $cache_id, true);
|
||||||
@@ -324,7 +317,6 @@ class Smarty
|
|||||||
Function: fetch()
|
Function: fetch()
|
||||||
Purpose: executes & returns or displays the template results
|
Purpose: executes & returns or displays the template results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function fetch($tpl_file, $cache_id = null, $display = false)
|
function fetch($tpl_file, $cache_id = null, $display = false)
|
||||||
{
|
{
|
||||||
global $HTTP_SERVER_VARS;
|
global $HTTP_SERVER_VARS;
|
||||||
@@ -384,7 +376,6 @@ class Smarty
|
|||||||
Function: compile()
|
Function: compile()
|
||||||
Purpose: called to compile the templates
|
Purpose: called to compile the templates
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile($tpl_dir)
|
function _compile($tpl_dir)
|
||||||
{
|
{
|
||||||
if($this->compile_check || $this->force_compile)
|
if($this->compile_check || $this->force_compile)
|
||||||
@@ -433,7 +424,6 @@ class Smarty
|
|||||||
Function: _read_file()
|
Function: _read_file()
|
||||||
Purpose: read in a file
|
Purpose: read in a file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _read_file($filename)
|
function _read_file($filename)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -451,7 +441,6 @@ class Smarty
|
|||||||
Function: _write_file()
|
Function: _write_file()
|
||||||
Purpose: write out a file
|
Purpose: write out a file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _write_file($filename, $contents, $create_dirs = false)
|
function _write_file($filename, $contents, $create_dirs = false)
|
||||||
{
|
{
|
||||||
if($create_dirs)
|
if($create_dirs)
|
||||||
@@ -522,7 +511,6 @@ class Smarty
|
|||||||
Function: _set_error_msg()
|
Function: _set_error_msg()
|
||||||
Purpose: set the error message
|
Purpose: set the error message
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _set_error_msg($error_msg)
|
function _set_error_msg($error_msg)
|
||||||
{
|
{
|
||||||
$this->_error_msg="smarty error: $error_msg";
|
$this->_error_msg="smarty error: $error_msg";
|
||||||
|
@@ -13,7 +13,6 @@ class Smarty_Compiler extends Smarty {
|
|||||||
Function: _traverse_files()
|
Function: _traverse_files()
|
||||||
Purpose: traverse the template files & process each one
|
Purpose: traverse the template files & process each one
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _traverse_files($tpl_dir, $depth)
|
function _traverse_files($tpl_dir, $depth)
|
||||||
{
|
{
|
||||||
$retval = true;
|
$retval = true;
|
||||||
@@ -58,7 +57,6 @@ function _traverse_files($tpl_dir, $depth)
|
|||||||
and execute the compilation for each
|
and execute the compilation for each
|
||||||
one requiring it.
|
one requiring it.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _process_file($filepath)
|
function _process_file($filepath)
|
||||||
{
|
{
|
||||||
if(preg_match("/^(.+)\/([^\/]+)$/", $filepath, $match)) {
|
if(preg_match("/^(.+)\/([^\/]+)$/", $filepath, $match)) {
|
||||||
@@ -92,7 +90,6 @@ function _process_file($filepath)
|
|||||||
Function: _create_dir_structure
|
Function: _create_dir_structure
|
||||||
Purpose: create full directory structure
|
Purpose: create full directory structure
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _create_dir_structure($dir)
|
function _create_dir_structure($dir)
|
||||||
{
|
{
|
||||||
if (!file_exists($dir)) {
|
if (!file_exists($dir)) {
|
||||||
@@ -113,7 +110,6 @@ function _create_dir_structure($dir)
|
|||||||
Function: _modified_file()
|
Function: _modified_file()
|
||||||
Input: return comparison of modification times of files
|
Input: return comparison of modification times of files
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _modified_file($filepath, $compilepath)
|
function _modified_file($filepath, $compilepath)
|
||||||
{
|
{
|
||||||
if (filemtime($filepath) >= filemtime($compilepath))
|
if (filemtime($filepath) >= filemtime($compilepath))
|
||||||
@@ -125,7 +121,6 @@ function _modified_file($filepath, $compilepath)
|
|||||||
Function: _compile_file()
|
Function: _compile_file()
|
||||||
Input: compile a template file
|
Input: compile a template file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_file($filepath, $compilepath)
|
function _compile_file($filepath, $compilepath)
|
||||||
{
|
{
|
||||||
if (!($template_contents = $this->_read_file($filepath)))
|
if (!($template_contents = $this->_read_file($filepath)))
|
||||||
@@ -215,7 +210,6 @@ function _compile_file($filepath, $compilepath)
|
|||||||
Function: _process_cached_inserts
|
Function: _process_cached_inserts
|
||||||
Purpose: Replace cached inserts with the actual results
|
Purpose: Replace cached inserts with the actual results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _process_cached_inserts($results)
|
function _process_cached_inserts($results)
|
||||||
{
|
{
|
||||||
preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
|
preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
|
||||||
@@ -241,7 +235,6 @@ function _process_cached_inserts($results)
|
|||||||
Function: _compile_tag
|
Function: _compile_tag
|
||||||
Purpose: Compile a template tag
|
Purpose: Compile a template tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_tag($template_tag)
|
function _compile_tag($template_tag)
|
||||||
{
|
{
|
||||||
/* Matched comment. */
|
/* Matched comment. */
|
||||||
@@ -333,7 +326,6 @@ function _compile_tag($template_tag)
|
|||||||
Function: _compile_custom_tag
|
Function: _compile_custom_tag
|
||||||
Purpose: compile custom tag
|
Purpose: compile custom tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_custom_tag($tag_command, $tag_args)
|
function _compile_custom_tag($tag_command, $tag_args)
|
||||||
{
|
{
|
||||||
$function = $this->custom_funcs[$tag_command];
|
$function = $this->custom_funcs[$tag_command];
|
||||||
@@ -357,7 +349,6 @@ function _compile_custom_tag($tag_command, $tag_args)
|
|||||||
Function: _compile_insert_tag
|
Function: _compile_insert_tag
|
||||||
Purpose: Compile {insert ...} tag
|
Purpose: Compile {insert ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_insert_tag($tag_args)
|
function _compile_insert_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -381,7 +372,6 @@ function _compile_insert_tag($tag_args)
|
|||||||
Function: _compile_config_load_tag
|
Function: _compile_config_load_tag
|
||||||
Purpose: Compile {config_load ...} tag
|
Purpose: Compile {config_load ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_config_load_tag($tag_args)
|
function _compile_config_load_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -410,7 +400,6 @@ function _compile_config_load_tag($tag_args)
|
|||||||
Function: _compile_include_tag
|
Function: _compile_include_tag
|
||||||
Purpose: Compile {include ...} tag
|
Purpose: Compile {include ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_include_tag($tag_args)
|
function _compile_include_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -450,7 +439,6 @@ function _compile_include_tag($tag_args)
|
|||||||
Function: _compile_section_start
|
Function: _compile_section_start
|
||||||
Purpose: Compile {section ...} tag
|
Purpose: Compile {section ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_section_start($tag_args)
|
function _compile_section_start($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -514,7 +502,6 @@ function _compile_section_start($tag_args)
|
|||||||
Function: _compile_if_tag
|
Function: _compile_if_tag
|
||||||
Purpose: Compile {if ...} tag
|
Purpose: Compile {if ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_if_tag($tag_args, $elseif = false)
|
function _compile_if_tag($tag_args, $elseif = false)
|
||||||
{
|
{
|
||||||
/* Tokenize args for 'if' tag. */
|
/* Tokenize args for 'if' tag. */
|
||||||
@@ -619,7 +606,6 @@ function _compile_if_tag($tag_args, $elseif = false)
|
|||||||
Function: _parse_is_expr
|
Function: _parse_is_expr
|
||||||
Purpose: Parse is expression
|
Purpose: Parse is expression
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_is_expr($is_arg, $tokens)
|
function _parse_is_expr($is_arg, $tokens)
|
||||||
{
|
{
|
||||||
$expr_end = 0;
|
$expr_end = 0;
|
||||||
@@ -679,7 +665,6 @@ function _parse_is_expr($is_arg, $tokens)
|
|||||||
Function: _parse_attrs
|
Function: _parse_attrs
|
||||||
Purpose: Parse attribute string
|
Purpose: Parse attribute string
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_attrs($tag_args, $quote = true)
|
function _parse_attrs($tag_args, $quote = true)
|
||||||
{
|
{
|
||||||
/* Tokenize tag attributes. */
|
/* Tokenize tag attributes. */
|
||||||
@@ -753,7 +738,6 @@ function _parse_attrs($tag_args, $quote = true)
|
|||||||
Function: _preg_grep
|
Function: _preg_grep
|
||||||
Purpose: Emulate PHP's preg_grep()
|
Purpose: Emulate PHP's preg_grep()
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _preg_grep($pattern, $array)
|
function _preg_grep($pattern, $array)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
@@ -770,7 +754,6 @@ function _preg_grep($pattern, $array)
|
|||||||
Function: _parse_vars_props
|
Function: _parse_vars_props
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_vars_props(&$tokens)
|
function _parse_vars_props(&$tokens)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
@@ -811,7 +794,6 @@ function _parse_vars_props(&$tokens)
|
|||||||
Function: _parse_var
|
Function: _parse_var
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_var($var_expr)
|
function _parse_var($var_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', substr($var_expr, 1), 2);
|
list($var_ref, $modifiers) = explode('|', substr($var_expr, 1), 2);
|
||||||
@@ -841,7 +823,6 @@ function _parse_var($var_expr)
|
|||||||
Function: _parse_conf_var
|
Function: _parse_conf_var
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_conf_var($conf_var_expr)
|
function _parse_conf_var($conf_var_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', $conf_var_expr, 2);
|
list($var_ref, $modifiers) = explode('|', $conf_var_expr, 2);
|
||||||
@@ -859,7 +840,6 @@ function _parse_conf_var($conf_var_expr)
|
|||||||
Function: _parse_section_prop
|
Function: _parse_section_prop
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_section_prop($section_prop_expr)
|
function _parse_section_prop($section_prop_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', $section_prop_expr, 2);
|
list($var_ref, $modifiers) = explode('|', $section_prop_expr, 2);
|
||||||
@@ -879,7 +859,6 @@ function _parse_section_prop($section_prop_expr)
|
|||||||
Function: _parse_modifiers
|
Function: _parse_modifiers
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_modifiers(&$output, $modifier_string)
|
function _parse_modifiers(&$output, $modifier_string)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
|
@@ -124,7 +124,6 @@ class Smarty
|
|||||||
Function: assign()
|
Function: assign()
|
||||||
Purpose: assigns values to template variables
|
Purpose: assigns values to template variables
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function assign($tpl_var, $value = NULL)
|
function assign($tpl_var, $value = NULL)
|
||||||
{
|
{
|
||||||
if (is_array($tpl_var)){
|
if (is_array($tpl_var)){
|
||||||
@@ -167,7 +166,6 @@ class Smarty
|
|||||||
Function: clear_assign()
|
Function: clear_assign()
|
||||||
Purpose: clear the given assigned template variable.
|
Purpose: clear the given assigned template variable.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_assign($tpl_var)
|
function clear_assign($tpl_var)
|
||||||
{
|
{
|
||||||
if(is_array($tpl_var))
|
if(is_array($tpl_var))
|
||||||
@@ -220,7 +218,6 @@ class Smarty
|
|||||||
Function: clear_cache()
|
Function: clear_cache()
|
||||||
Purpose: clear cached content for the given template and cache id
|
Purpose: clear cached content for the given template and cache id
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_cache($tpl_file, $cache_id = null)
|
function clear_cache($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
$cache_tpl_md5 = md5(realpath($this->template_dir.'/'.$tpl_file));
|
$cache_tpl_md5 = md5(realpath($this->template_dir.'/'.$tpl_file));
|
||||||
@@ -243,7 +240,6 @@ class Smarty
|
|||||||
Function: clear_all_cache()
|
Function: clear_all_cache()
|
||||||
Purpose: clear the entire contents of cache (all templates)
|
Purpose: clear the entire contents of cache (all templates)
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_all_cache()
|
function clear_all_cache()
|
||||||
{
|
{
|
||||||
if (!is_dir($this->cache_dir))
|
if (!is_dir($this->cache_dir))
|
||||||
@@ -267,7 +263,6 @@ class Smarty
|
|||||||
Function: is_cached()
|
Function: is_cached()
|
||||||
Purpose: test to see if valid cache exists for this template
|
Purpose: test to see if valid cache exists for this template
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function is_cached($tpl_file, $cache_id = null)
|
function is_cached($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
if (!$this->caching)
|
if (!$this->caching)
|
||||||
@@ -293,7 +288,6 @@ class Smarty
|
|||||||
Function: clear_all_assign()
|
Function: clear_all_assign()
|
||||||
Purpose: clear all the assigned template variables.
|
Purpose: clear all the assigned template variables.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function clear_all_assign()
|
function clear_all_assign()
|
||||||
{
|
{
|
||||||
$this->_tpl_vars = array();
|
$this->_tpl_vars = array();
|
||||||
@@ -314,7 +308,6 @@ class Smarty
|
|||||||
Function: display()
|
Function: display()
|
||||||
Purpose: executes & displays the template results
|
Purpose: executes & displays the template results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function display($tpl_file, $cache_id = null)
|
function display($tpl_file, $cache_id = null)
|
||||||
{
|
{
|
||||||
$this->fetch($tpl_file, $cache_id, true);
|
$this->fetch($tpl_file, $cache_id, true);
|
||||||
@@ -324,7 +317,6 @@ class Smarty
|
|||||||
Function: fetch()
|
Function: fetch()
|
||||||
Purpose: executes & returns or displays the template results
|
Purpose: executes & returns or displays the template results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function fetch($tpl_file, $cache_id = null, $display = false)
|
function fetch($tpl_file, $cache_id = null, $display = false)
|
||||||
{
|
{
|
||||||
global $HTTP_SERVER_VARS;
|
global $HTTP_SERVER_VARS;
|
||||||
@@ -384,7 +376,6 @@ class Smarty
|
|||||||
Function: compile()
|
Function: compile()
|
||||||
Purpose: called to compile the templates
|
Purpose: called to compile the templates
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile($tpl_dir)
|
function _compile($tpl_dir)
|
||||||
{
|
{
|
||||||
if($this->compile_check || $this->force_compile)
|
if($this->compile_check || $this->force_compile)
|
||||||
@@ -433,7 +424,6 @@ class Smarty
|
|||||||
Function: _read_file()
|
Function: _read_file()
|
||||||
Purpose: read in a file
|
Purpose: read in a file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _read_file($filename)
|
function _read_file($filename)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -451,7 +441,6 @@ class Smarty
|
|||||||
Function: _write_file()
|
Function: _write_file()
|
||||||
Purpose: write out a file
|
Purpose: write out a file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _write_file($filename, $contents, $create_dirs = false)
|
function _write_file($filename, $contents, $create_dirs = false)
|
||||||
{
|
{
|
||||||
if($create_dirs)
|
if($create_dirs)
|
||||||
@@ -522,7 +511,6 @@ class Smarty
|
|||||||
Function: _set_error_msg()
|
Function: _set_error_msg()
|
||||||
Purpose: set the error message
|
Purpose: set the error message
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _set_error_msg($error_msg)
|
function _set_error_msg($error_msg)
|
||||||
{
|
{
|
||||||
$this->_error_msg="smarty error: $error_msg";
|
$this->_error_msg="smarty error: $error_msg";
|
||||||
|
@@ -13,7 +13,6 @@ class Smarty_Compiler extends Smarty {
|
|||||||
Function: _traverse_files()
|
Function: _traverse_files()
|
||||||
Purpose: traverse the template files & process each one
|
Purpose: traverse the template files & process each one
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _traverse_files($tpl_dir, $depth)
|
function _traverse_files($tpl_dir, $depth)
|
||||||
{
|
{
|
||||||
$retval = true;
|
$retval = true;
|
||||||
@@ -58,7 +57,6 @@ function _traverse_files($tpl_dir, $depth)
|
|||||||
and execute the compilation for each
|
and execute the compilation for each
|
||||||
one requiring it.
|
one requiring it.
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _process_file($filepath)
|
function _process_file($filepath)
|
||||||
{
|
{
|
||||||
if(preg_match("/^(.+)\/([^\/]+)$/", $filepath, $match)) {
|
if(preg_match("/^(.+)\/([^\/]+)$/", $filepath, $match)) {
|
||||||
@@ -92,7 +90,6 @@ function _process_file($filepath)
|
|||||||
Function: _create_dir_structure
|
Function: _create_dir_structure
|
||||||
Purpose: create full directory structure
|
Purpose: create full directory structure
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _create_dir_structure($dir)
|
function _create_dir_structure($dir)
|
||||||
{
|
{
|
||||||
if (!file_exists($dir)) {
|
if (!file_exists($dir)) {
|
||||||
@@ -113,7 +110,6 @@ function _create_dir_structure($dir)
|
|||||||
Function: _modified_file()
|
Function: _modified_file()
|
||||||
Input: return comparison of modification times of files
|
Input: return comparison of modification times of files
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _modified_file($filepath, $compilepath)
|
function _modified_file($filepath, $compilepath)
|
||||||
{
|
{
|
||||||
if (filemtime($filepath) >= filemtime($compilepath))
|
if (filemtime($filepath) >= filemtime($compilepath))
|
||||||
@@ -125,7 +121,6 @@ function _modified_file($filepath, $compilepath)
|
|||||||
Function: _compile_file()
|
Function: _compile_file()
|
||||||
Input: compile a template file
|
Input: compile a template file
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_file($filepath, $compilepath)
|
function _compile_file($filepath, $compilepath)
|
||||||
{
|
{
|
||||||
if (!($template_contents = $this->_read_file($filepath)))
|
if (!($template_contents = $this->_read_file($filepath)))
|
||||||
@@ -215,7 +210,6 @@ function _compile_file($filepath, $compilepath)
|
|||||||
Function: _process_cached_inserts
|
Function: _process_cached_inserts
|
||||||
Purpose: Replace cached inserts with the actual results
|
Purpose: Replace cached inserts with the actual results
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _process_cached_inserts($results)
|
function _process_cached_inserts($results)
|
||||||
{
|
{
|
||||||
preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
|
preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
|
||||||
@@ -241,7 +235,6 @@ function _process_cached_inserts($results)
|
|||||||
Function: _compile_tag
|
Function: _compile_tag
|
||||||
Purpose: Compile a template tag
|
Purpose: Compile a template tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_tag($template_tag)
|
function _compile_tag($template_tag)
|
||||||
{
|
{
|
||||||
/* Matched comment. */
|
/* Matched comment. */
|
||||||
@@ -333,7 +326,6 @@ function _compile_tag($template_tag)
|
|||||||
Function: _compile_custom_tag
|
Function: _compile_custom_tag
|
||||||
Purpose: compile custom tag
|
Purpose: compile custom tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_custom_tag($tag_command, $tag_args)
|
function _compile_custom_tag($tag_command, $tag_args)
|
||||||
{
|
{
|
||||||
$function = $this->custom_funcs[$tag_command];
|
$function = $this->custom_funcs[$tag_command];
|
||||||
@@ -357,7 +349,6 @@ function _compile_custom_tag($tag_command, $tag_args)
|
|||||||
Function: _compile_insert_tag
|
Function: _compile_insert_tag
|
||||||
Purpose: Compile {insert ...} tag
|
Purpose: Compile {insert ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_insert_tag($tag_args)
|
function _compile_insert_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -381,7 +372,6 @@ function _compile_insert_tag($tag_args)
|
|||||||
Function: _compile_config_load_tag
|
Function: _compile_config_load_tag
|
||||||
Purpose: Compile {config_load ...} tag
|
Purpose: Compile {config_load ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_config_load_tag($tag_args)
|
function _compile_config_load_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -410,7 +400,6 @@ function _compile_config_load_tag($tag_args)
|
|||||||
Function: _compile_include_tag
|
Function: _compile_include_tag
|
||||||
Purpose: Compile {include ...} tag
|
Purpose: Compile {include ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_include_tag($tag_args)
|
function _compile_include_tag($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -450,7 +439,6 @@ function _compile_include_tag($tag_args)
|
|||||||
Function: _compile_section_start
|
Function: _compile_section_start
|
||||||
Purpose: Compile {section ...} tag
|
Purpose: Compile {section ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_section_start($tag_args)
|
function _compile_section_start($tag_args)
|
||||||
{
|
{
|
||||||
$attrs = $this->_parse_attrs($tag_args);
|
$attrs = $this->_parse_attrs($tag_args);
|
||||||
@@ -514,7 +502,6 @@ function _compile_section_start($tag_args)
|
|||||||
Function: _compile_if_tag
|
Function: _compile_if_tag
|
||||||
Purpose: Compile {if ...} tag
|
Purpose: Compile {if ...} tag
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _compile_if_tag($tag_args, $elseif = false)
|
function _compile_if_tag($tag_args, $elseif = false)
|
||||||
{
|
{
|
||||||
/* Tokenize args for 'if' tag. */
|
/* Tokenize args for 'if' tag. */
|
||||||
@@ -619,7 +606,6 @@ function _compile_if_tag($tag_args, $elseif = false)
|
|||||||
Function: _parse_is_expr
|
Function: _parse_is_expr
|
||||||
Purpose: Parse is expression
|
Purpose: Parse is expression
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_is_expr($is_arg, $tokens)
|
function _parse_is_expr($is_arg, $tokens)
|
||||||
{
|
{
|
||||||
$expr_end = 0;
|
$expr_end = 0;
|
||||||
@@ -679,7 +665,6 @@ function _parse_is_expr($is_arg, $tokens)
|
|||||||
Function: _parse_attrs
|
Function: _parse_attrs
|
||||||
Purpose: Parse attribute string
|
Purpose: Parse attribute string
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_attrs($tag_args, $quote = true)
|
function _parse_attrs($tag_args, $quote = true)
|
||||||
{
|
{
|
||||||
/* Tokenize tag attributes. */
|
/* Tokenize tag attributes. */
|
||||||
@@ -753,7 +738,6 @@ function _parse_attrs($tag_args, $quote = true)
|
|||||||
Function: _preg_grep
|
Function: _preg_grep
|
||||||
Purpose: Emulate PHP's preg_grep()
|
Purpose: Emulate PHP's preg_grep()
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _preg_grep($pattern, $array)
|
function _preg_grep($pattern, $array)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
@@ -770,7 +754,6 @@ function _preg_grep($pattern, $array)
|
|||||||
Function: _parse_vars_props
|
Function: _parse_vars_props
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_vars_props(&$tokens)
|
function _parse_vars_props(&$tokens)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
@@ -811,7 +794,6 @@ function _parse_vars_props(&$tokens)
|
|||||||
Function: _parse_var
|
Function: _parse_var
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_var($var_expr)
|
function _parse_var($var_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', substr($var_expr, 1), 2);
|
list($var_ref, $modifiers) = explode('|', substr($var_expr, 1), 2);
|
||||||
@@ -841,7 +823,6 @@ function _parse_var($var_expr)
|
|||||||
Function: _parse_conf_var
|
Function: _parse_conf_var
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_conf_var($conf_var_expr)
|
function _parse_conf_var($conf_var_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', $conf_var_expr, 2);
|
list($var_ref, $modifiers) = explode('|', $conf_var_expr, 2);
|
||||||
@@ -859,7 +840,6 @@ function _parse_conf_var($conf_var_expr)
|
|||||||
Function: _parse_section_prop
|
Function: _parse_section_prop
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_section_prop($section_prop_expr)
|
function _parse_section_prop($section_prop_expr)
|
||||||
{
|
{
|
||||||
list($var_ref, $modifiers) = explode('|', $section_prop_expr, 2);
|
list($var_ref, $modifiers) = explode('|', $section_prop_expr, 2);
|
||||||
@@ -879,7 +859,6 @@ function _parse_section_prop($section_prop_expr)
|
|||||||
Function: _parse_modifiers
|
Function: _parse_modifiers
|
||||||
Purpose:
|
Purpose:
|
||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
|
|
||||||
function _parse_modifiers(&$output, $modifier_string)
|
function _parse_modifiers(&$output, $modifier_string)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
|
Reference in New Issue
Block a user