mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
Various fixes and additions.
This commit is contained in:
4
NEWS
4
NEWS
@@ -1,3 +1,7 @@
|
||||
- fixed a bug that could cause parse error with quotes inside literal
|
||||
blocks. (Andrei, Alexander Belonosov)
|
||||
- added 'field_array' attribute to html_select_time function. (Andrei,
|
||||
Michael Caplan)
|
||||
- made cache reading process more efficient. (Monte)
|
||||
- fixed bug, is_cached() now supports new 1.4.6 caching behavior. (Monte)
|
||||
- update FAQ with mailing list Reply-To header FAQ. (Monte)
|
||||
|
@@ -431,13 +431,18 @@ function smarty_func_html_select_time()
|
||||
/* Default values. */
|
||||
$prefix = "Time_";
|
||||
$time = time();
|
||||
$display_hours = true;
|
||||
$display_hours = true;
|
||||
$display_minutes = true;
|
||||
$display_seconds = true;
|
||||
$display_meridian = true;
|
||||
$use_24_hours = true;
|
||||
$use_24_hours = true;
|
||||
$minute_interval = 1;
|
||||
$second_interval = 1;
|
||||
/* Should the select boxes be part of an array when returned from PHP?
|
||||
e.g. setting it to "birthday", would create "birthday[Hour]",
|
||||
"birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
|
||||
Can be combined with prefix. */
|
||||
$field_array = null;
|
||||
|
||||
extract(func_get_arg(0));
|
||||
|
||||
@@ -450,7 +455,12 @@ function smarty_func_html_select_time()
|
||||
$hour_fmt = $use_24_hours ? '%H' : '%I';
|
||||
for ($i = 0; $i < count($hours); $i++)
|
||||
$hours[$i] = sprintf('%02d', $hours[$i]);
|
||||
$html_result .= '<select name="'.$prefix.'Hour">'."\n";
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Hour]">'."\n";
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Hour">'."\n";
|
||||
}
|
||||
$html_result .= smarty_func_html_options(array('output' => $hours,
|
||||
'values' => $hours,
|
||||
'selected' => strftime($hour_fmt, $time),
|
||||
@@ -463,7 +473,12 @@ function smarty_func_html_select_time()
|
||||
for ($i = 0; $i < count($all_minutes); $i+= $minute_interval)
|
||||
$minutes[] = sprintf('%02d', $all_minutes[$i]);
|
||||
$selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
|
||||
$html_result .= '<select name="'.$prefix.'Minute">'."\n";
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Minute]">'."\n";
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Minute">'."\n";
|
||||
}
|
||||
$html_result .= smarty_func_html_options(array('output' => $minutes,
|
||||
'values' => $minutes,
|
||||
'selected' => $selected,
|
||||
@@ -476,7 +491,12 @@ function smarty_func_html_select_time()
|
||||
for ($i = 0; $i < count($all_seconds); $i+= $second_interval)
|
||||
$seconds[] = sprintf('%02d', $all_seconds[$i]);
|
||||
$selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
|
||||
$html_result .= '<select name="'.$prefix.'Second">'."\n";
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Second]">'."\n";
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Second">'."\n";
|
||||
}
|
||||
$html_result .= smarty_func_html_options(array('output' => $seconds,
|
||||
'values' => $seconds,
|
||||
'selected' => $selected,
|
||||
@@ -485,7 +505,12 @@ function smarty_func_html_select_time()
|
||||
}
|
||||
|
||||
if ($display_meridian && !$use_24_hours) {
|
||||
$html_result .= '<select name="'.$prefix.'Meridian">'."\n";
|
||||
$html_result .= '<select name=';
|
||||
if (null !== $field_array) {
|
||||
$html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]">'."\n";
|
||||
} else {
|
||||
$html_result .= '"' . $prefix . 'Meridian">'."\n";
|
||||
}
|
||||
$html_result .= smarty_func_html_options(array('output' => array('AM', 'PM'),
|
||||
'values' => array('am', 'pm'),
|
||||
'selected' => strtolower(strftime('%p', $time)),
|
||||
|
@@ -266,7 +266,7 @@ class Smarty_Compiler extends Smarty {
|
||||
case 'literal':
|
||||
list (,$literal_block) = each($this->_literal_blocks);
|
||||
$this->_current_line_no += substr_count($literal_block, "\n");
|
||||
return "<?php echo '".str_replace("'","\'",$literal_block)."'; ?>\n";
|
||||
return "<?php echo '".str_replace("'", "\'", str_replace("\\", "\\\\", $literal_block))."'; ?>\n";
|
||||
|
||||
case 'php':
|
||||
if ($this->security && !$this->security_settings['PHP_TAGS']) {
|
||||
@@ -401,7 +401,7 @@ class Smarty_Compiler extends Smarty {
|
||||
function _compile_include_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
$arg_list = array();
|
||||
$arg_list = array();
|
||||
|
||||
if (empty($attrs['file'])) {
|
||||
$this->_syntax_error("missing 'file' attribute in include tag");
|
||||
|
@@ -266,7 +266,7 @@ class Smarty_Compiler extends Smarty {
|
||||
case 'literal':
|
||||
list (,$literal_block) = each($this->_literal_blocks);
|
||||
$this->_current_line_no += substr_count($literal_block, "\n");
|
||||
return "<?php echo '".str_replace("'","\'",$literal_block)."'; ?>\n";
|
||||
return "<?php echo '".str_replace("'", "\'", str_replace("\\", "\\\\", $literal_block))."'; ?>\n";
|
||||
|
||||
case 'php':
|
||||
if ($this->security && !$this->security_settings['PHP_TAGS']) {
|
||||
@@ -401,7 +401,7 @@ class Smarty_Compiler extends Smarty {
|
||||
function _compile_include_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
$arg_list = array();
|
||||
$arg_list = array();
|
||||
|
||||
if (empty($attrs['file'])) {
|
||||
$this->_syntax_error("missing 'file' attribute in include tag");
|
||||
|
Reference in New Issue
Block a user