mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Fix formatting.
This commit is contained in:
12
NEWS
12
NEWS
@@ -1,10 +1,8 @@
|
||||
- added custom cache handling function ability (Monte)
|
||||
- added assign attribute to insert function, documented (Monte)
|
||||
- added assign attribute to fetch function, documented (Monte)
|
||||
- fixed bug with fetch testing for local file when http address (Monte)
|
||||
- added assign attribute to math function, documented (Monte)
|
||||
- added assign attribute to counter function, documented (Monte)
|
||||
- fixed bug with counter and skipval setting (Monte)
|
||||
- added custom cache handling function ability. (Monte)
|
||||
- added assign attribute to insert, fetch, math, and counter functions,
|
||||
documented. (Monte)
|
||||
- fixed bug with fetch testing for local file when http address. (Monte)
|
||||
- fixed bug with counter and skipval setting. (Monte)
|
||||
- made {config_load ...} merge globals from each config file only once per
|
||||
scope, thus avoiding several problems. (Andrei)
|
||||
- added {foreach ...} tag that can be used to iterate through
|
||||
|
@@ -542,7 +542,7 @@ function smarty_func_math($args, &$smarty_obj) {
|
||||
}
|
||||
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all("![a-zA-Z][a-zA-Z0-9]*!",$equation,$match);
|
||||
preg_match_all("![a-zA-Z][a-zA-Z0-9]*!",$equation, $match);
|
||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||
|
||||
@@ -564,7 +564,7 @@ function smarty_func_math($args, &$smarty_obj) {
|
||||
$smarty_obj->_trigger_error_msg("math: parameter $key: is not numeric");
|
||||
return;
|
||||
}
|
||||
$equation = preg_replace("/\b$key\b/",$val,$equation);
|
||||
$equation = preg_replace("/\b$key\b/",$val, $equation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ function smarty_func_fetch($args, &$smarty_obj) {
|
||||
}
|
||||
|
||||
|
||||
if(!empty($assign)) {
|
||||
if (!empty($assign)) {
|
||||
ob_start();
|
||||
readfile($file);
|
||||
$smarty_obj->assign($assign,ob_get_contents());
|
||||
@@ -630,12 +630,12 @@ function smarty_func_fetch($args, &$smarty_obj) {
|
||||
Function: smarty_mod_count_characters
|
||||
Purpose: count the number of characters in a text
|
||||
\*======================================================================*/
|
||||
function smarty_mod_count_characters($string,$include_spaces=false) {
|
||||
function smarty_mod_count_characters($string, $include_spaces=false) {
|
||||
|
||||
if ($include_spaces)
|
||||
return(strlen($string));
|
||||
|
||||
return preg_match_all("/[^\s]/",$string,$match);
|
||||
return preg_match_all("/[^\s]/",$string, $match);
|
||||
}
|
||||
|
||||
/*======================================================================*\
|
||||
@@ -656,10 +656,10 @@ function smarty_mod_count_words($string) {
|
||||
Function: smarty_mod_count_sentences
|
||||
Purpose: count the number of sentences in a text
|
||||
\*======================================================================*/
|
||||
function smarty_mod_count_sentences($string,$include_spaces=false) {
|
||||
function smarty_mod_count_sentences($string, $include_spaces=false) {
|
||||
|
||||
// find periods with a word before but not after.
|
||||
return preg_match_all("/[^\s]\.(?!\w)/",$string,$match);
|
||||
return preg_match_all("/[^\s]\.(?!\w)/",$string, $match);
|
||||
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ function smarty_mod_count_sentences($string,$include_spaces=false) {
|
||||
Function: smarty_mod_count_paragraphs
|
||||
Purpose: count the number of sentences in a text
|
||||
\*======================================================================*/
|
||||
function smarty_mod_count_paragraphs($string,$include_spaces=false) {
|
||||
function smarty_mod_count_paragraphs($string, $include_spaces=false) {
|
||||
|
||||
// count \r or \n characters
|
||||
return count( preg_split("/[\r\n]+/",$string) );
|
||||
@@ -693,7 +693,7 @@ function smarty_func_counter($args, &$smarty_obj) {
|
||||
|
||||
if (isset($start))
|
||||
$count[$id] = $start;
|
||||
elseif (!isset($count[$id]))
|
||||
else if (!isset($count[$id]))
|
||||
$count[$id]=1;
|
||||
|
||||
if (!isset($print))
|
||||
@@ -701,9 +701,9 @@ function smarty_func_counter($args, &$smarty_obj) {
|
||||
else
|
||||
$printval[$id]=$print;
|
||||
|
||||
if(!empty($assign)) {
|
||||
if (!empty($assign)) {
|
||||
$printval[$id] = false;
|
||||
$smarty_obj->assign($assign,$count[$id]);
|
||||
$smarty_obj->assign($assign, $count[$id]);
|
||||
}
|
||||
|
||||
if ($printval[$id])
|
||||
@@ -711,12 +711,12 @@ function smarty_func_counter($args, &$smarty_obj) {
|
||||
|
||||
if (isset($skip))
|
||||
$skipval[$id] = $skip;
|
||||
elseif (empty($skipval[$id]))
|
||||
else if (empty($skipval[$id]))
|
||||
$skipval[$id] = 1;
|
||||
|
||||
if (isset($direction))
|
||||
$dir[$id] = $direction;
|
||||
elseif (!isset($dir[$id]))
|
||||
else if (!isset($dir[$id]))
|
||||
$dir[$id] = "up";
|
||||
|
||||
if ($dir[$id] == "down")
|
||||
|
@@ -1024,7 +1024,7 @@ function _run_insert_handler($args)
|
||||
'depth' => $this->_inclusion_depth,
|
||||
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
||||
}
|
||||
if(!empty($args["assign"])) {
|
||||
if (!empty($args["assign"])) {
|
||||
$this->assign($args["assign"],$content);
|
||||
} else {
|
||||
return $content;
|
||||
|
@@ -1024,7 +1024,7 @@ function _run_insert_handler($args)
|
||||
'depth' => $this->_inclusion_depth,
|
||||
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
||||
}
|
||||
if(!empty($args["assign"])) {
|
||||
if (!empty($args["assign"])) {
|
||||
$this->assign($args["assign"],$content);
|
||||
} else {
|
||||
return $content;
|
||||
|
Reference in New Issue
Block a user