mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
*** empty log message ***
This commit is contained in:
@@ -76,13 +76,13 @@ function smarty_mod_spacify($string, $spacify_char = ' ')
|
||||
}
|
||||
|
||||
|
||||
function smarty_mod_date_format($string, $format)
|
||||
function smarty_mod_date_format($string, $format="%b %e, %Y")
|
||||
{
|
||||
return strftime($format, $string);
|
||||
}
|
||||
|
||||
|
||||
function smarty_mod_string_format($string, $format="%b %e, %Y")
|
||||
function smarty_mod_string_format($string, $format)
|
||||
{
|
||||
return sprintf($format, $string);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ function smarty_mod_replace($string, $search, $replace)
|
||||
return str_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
function smarty_mod_strip_tags($string, $replace_with_space = false)
|
||||
function smarty_mod_strip_tags($string, $replace_with_space = true)
|
||||
{
|
||||
if ($replace_with_space)
|
||||
return preg_replace('!<[^>]*?>!', ' ', $string);
|
||||
|
@@ -391,7 +391,7 @@ class Smarty
|
||||
(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+
|
||||
)
|
||||
(?:\s+(.*))?
|
||||
/x', $template_tag, $match);
|
||||
/xs', $template_tag, $match);
|
||||
list(, $tag_command, $tag_args) = $match;
|
||||
|
||||
/* If the tag name matches a variable or section property definition,
|
||||
@@ -592,6 +592,8 @@ class Smarty
|
||||
|
||||
if (isset($attrs['show'])) {
|
||||
$show_check_code = "{$section_props}['show'] && ";
|
||||
} else {
|
||||
$output .= "{$section_props}['show'] = {$section_props}['loop'] > 0;\n";
|
||||
}
|
||||
|
||||
$output .= "if ($loop_check_code $show_check_code true): ";
|
||||
@@ -858,9 +860,9 @@ class Smarty
|
||||
|
||||
function _parse_var($var_expr)
|
||||
{
|
||||
$custom_mods = explode('|', substr($var_expr, 1));
|
||||
$modifiers = explode('|', substr($var_expr, 1));
|
||||
|
||||
$sections = explode('/', array_shift($custom_mods));
|
||||
$sections = explode('/', array_shift($modifiers));
|
||||
$var_name = array_pop($sections);
|
||||
|
||||
$output = "\$$var_name";
|
||||
@@ -869,42 +871,42 @@ class Smarty
|
||||
$output .= "[\$_sections['$section']['properties']['index']]";
|
||||
}
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_conf_var($conf_var_expr)
|
||||
{
|
||||
$custom_mods = explode('|', $conf_var_expr);
|
||||
$modifiers = explode('|', $conf_var_expr);
|
||||
|
||||
$var_name = substr(array_shift($custom_mods), 1, -1);
|
||||
$var_name = substr(array_shift($modifiers), 1, -1);
|
||||
|
||||
$output = "\$_config['$var_name']";
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_section_prop($section_prop_expr)
|
||||
{
|
||||
$custom_mods = explode('|', $section_prop_expr);
|
||||
$modifiers = explode('|', $section_prop_expr);
|
||||
|
||||
preg_match('!%(\w+)\.(\w+)%!', array_shift($custom_mods), $match);
|
||||
preg_match('!%(\w+)\.(\w+)%!', array_shift($modifiers), $match);
|
||||
$section_name = $match[1];
|
||||
$prop_name = $match[2];
|
||||
|
||||
$output = "\$_sections['$section_name']['properties']['$prop_name']";
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_modifiers(&$output, $custom_mods)
|
||||
function _parse_modifiers(&$output, $modifiers)
|
||||
{
|
||||
foreach ($custom_mods as $modifier) {
|
||||
foreach ($modifiers as $modifier) {
|
||||
$modifier = explode(':', $modifier);
|
||||
$modifier_name = array_shift($modifier);
|
||||
|
||||
|
@@ -391,7 +391,7 @@ class Smarty
|
||||
(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+
|
||||
)
|
||||
(?:\s+(.*))?
|
||||
/x', $template_tag, $match);
|
||||
/xs', $template_tag, $match);
|
||||
list(, $tag_command, $tag_args) = $match;
|
||||
|
||||
/* If the tag name matches a variable or section property definition,
|
||||
@@ -592,6 +592,8 @@ class Smarty
|
||||
|
||||
if (isset($attrs['show'])) {
|
||||
$show_check_code = "{$section_props}['show'] && ";
|
||||
} else {
|
||||
$output .= "{$section_props}['show'] = {$section_props}['loop'] > 0;\n";
|
||||
}
|
||||
|
||||
$output .= "if ($loop_check_code $show_check_code true): ";
|
||||
@@ -858,9 +860,9 @@ class Smarty
|
||||
|
||||
function _parse_var($var_expr)
|
||||
{
|
||||
$custom_mods = explode('|', substr($var_expr, 1));
|
||||
$modifiers = explode('|', substr($var_expr, 1));
|
||||
|
||||
$sections = explode('/', array_shift($custom_mods));
|
||||
$sections = explode('/', array_shift($modifiers));
|
||||
$var_name = array_pop($sections);
|
||||
|
||||
$output = "\$$var_name";
|
||||
@@ -869,42 +871,42 @@ class Smarty
|
||||
$output .= "[\$_sections['$section']['properties']['index']]";
|
||||
}
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_conf_var($conf_var_expr)
|
||||
{
|
||||
$custom_mods = explode('|', $conf_var_expr);
|
||||
$modifiers = explode('|', $conf_var_expr);
|
||||
|
||||
$var_name = substr(array_shift($custom_mods), 1, -1);
|
||||
$var_name = substr(array_shift($modifiers), 1, -1);
|
||||
|
||||
$output = "\$_config['$var_name']";
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_section_prop($section_prop_expr)
|
||||
{
|
||||
$custom_mods = explode('|', $section_prop_expr);
|
||||
$modifiers = explode('|', $section_prop_expr);
|
||||
|
||||
preg_match('!%(\w+)\.(\w+)%!', array_shift($custom_mods), $match);
|
||||
preg_match('!%(\w+)\.(\w+)%!', array_shift($modifiers), $match);
|
||||
$section_name = $match[1];
|
||||
$prop_name = $match[2];
|
||||
|
||||
$output = "\$_sections['$section_name']['properties']['$prop_name']";
|
||||
|
||||
$this->_parse_modifiers($output, $custom_mods);
|
||||
$this->_parse_modifiers($output, $modifiers);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _parse_modifiers(&$output, $custom_mods)
|
||||
function _parse_modifiers(&$output, $modifiers)
|
||||
{
|
||||
foreach ($custom_mods as $modifier) {
|
||||
foreach ($modifiers as $modifier) {
|
||||
$modifier = explode(':', $modifier);
|
||||
$modifier_name = array_shift($modifier);
|
||||
|
||||
|
Reference in New Issue
Block a user