*** empty log message ***

This commit is contained in:
andrey
2001-01-09 17:50:51 +00:00
parent 6b68978d3c
commit 81f50710ed
3 changed files with 31 additions and 27 deletions

View File

@@ -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); 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); return sprintf($format, $string);
} }
@@ -92,7 +92,7 @@ function smarty_mod_replace($string, $search, $replace)
return str_replace($search, $replace, $string); 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) if ($replace_with_space)
return preg_replace('!<[^>]*?>!', ' ', $string); return preg_replace('!<[^>]*?>!', ' ', $string);

View File

@@ -391,7 +391,7 @@ class Smarty
(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+ (?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+
) )
(?:\s+(.*))? (?:\s+(.*))?
/x', $template_tag, $match); /xs', $template_tag, $match);
list(, $tag_command, $tag_args) = $match; list(, $tag_command, $tag_args) = $match;
/* If the tag name matches a variable or section property definition, /* If the tag name matches a variable or section property definition,
@@ -592,6 +592,8 @@ class Smarty
if (isset($attrs['show'])) { if (isset($attrs['show'])) {
$show_check_code = "{$section_props}['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): "; $output .= "if ($loop_check_code $show_check_code true): ";
@@ -858,9 +860,9 @@ class Smarty
function _parse_var($var_expr) 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); $var_name = array_pop($sections);
$output = "\$$var_name"; $output = "\$$var_name";
@@ -869,42 +871,42 @@ class Smarty
$output .= "[\$_sections['$section']['properties']['index']]"; $output .= "[\$_sections['$section']['properties']['index']]";
} }
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; return $output;
} }
function _parse_conf_var($conf_var_expr) 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']"; $output = "\$_config['$var_name']";
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; return $output;
} }
function _parse_section_prop($section_prop_expr) 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]; $section_name = $match[1];
$prop_name = $match[2]; $prop_name = $match[2];
$output = "\$_sections['$section_name']['properties']['$prop_name']"; $output = "\$_sections['$section_name']['properties']['$prop_name']";
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; 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 = explode(':', $modifier);
$modifier_name = array_shift($modifier); $modifier_name = array_shift($modifier);

View File

@@ -391,7 +391,7 @@ class Smarty
(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+ (?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | (?>[^"\' ]+))+
) )
(?:\s+(.*))? (?:\s+(.*))?
/x', $template_tag, $match); /xs', $template_tag, $match);
list(, $tag_command, $tag_args) = $match; list(, $tag_command, $tag_args) = $match;
/* If the tag name matches a variable or section property definition, /* If the tag name matches a variable or section property definition,
@@ -592,6 +592,8 @@ class Smarty
if (isset($attrs['show'])) { if (isset($attrs['show'])) {
$show_check_code = "{$section_props}['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): "; $output .= "if ($loop_check_code $show_check_code true): ";
@@ -858,9 +860,9 @@ class Smarty
function _parse_var($var_expr) 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); $var_name = array_pop($sections);
$output = "\$$var_name"; $output = "\$$var_name";
@@ -869,42 +871,42 @@ class Smarty
$output .= "[\$_sections['$section']['properties']['index']]"; $output .= "[\$_sections['$section']['properties']['index']]";
} }
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; return $output;
} }
function _parse_conf_var($conf_var_expr) 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']"; $output = "\$_config['$var_name']";
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; return $output;
} }
function _parse_section_prop($section_prop_expr) 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]; $section_name = $match[1];
$prop_name = $match[2]; $prop_name = $match[2];
$output = "\$_sections['$section_name']['properties']['$prop_name']"; $output = "\$_sections['$section_name']['properties']['$prop_name']";
$this->_parse_modifiers($output, $custom_mods); $this->_parse_modifiers($output, $modifiers);
return $output; 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 = explode(':', $modifier);
$modifier_name = array_shift($modifier); $modifier_name = array_shift($modifier);