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 custom cache handling function ability. (Monte)
|
||||||
- added assign attribute to insert function, documented (Monte)
|
- added assign attribute to insert, fetch, math, and counter functions,
|
||||||
- added assign attribute to fetch function, documented (Monte)
|
documented. (Monte)
|
||||||
- fixed bug with fetch testing for local file when http address (Monte)
|
- fixed bug with fetch testing for local file when http address. (Monte)
|
||||||
- added assign attribute to math function, documented (Monte)
|
- fixed bug with counter and skipval setting. (Monte)
|
||||||
- added assign attribute to counter function, documented (Monte)
|
|
||||||
- fixed bug with counter and skipval setting (Monte)
|
|
||||||
- made {config_load ...} merge globals from each config file only once per
|
- made {config_load ...} merge globals from each config file only once per
|
||||||
scope, thus avoiding several problems. (Andrei)
|
scope, thus avoiding several problems. (Andrei)
|
||||||
- added {foreach ...} tag that can be used to iterate through
|
- 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
|
// 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',
|
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
'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");
|
$smarty_obj->_trigger_error_msg("math: parameter $key: is not numeric");
|
||||||
return;
|
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();
|
ob_start();
|
||||||
readfile($file);
|
readfile($file);
|
||||||
$smarty_obj->assign($assign,ob_get_contents());
|
$smarty_obj->assign($assign,ob_get_contents());
|
||||||
@@ -630,12 +630,12 @@ function smarty_func_fetch($args, &$smarty_obj) {
|
|||||||
Function: smarty_mod_count_characters
|
Function: smarty_mod_count_characters
|
||||||
Purpose: count the number of characters in a text
|
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)
|
if ($include_spaces)
|
||||||
return(strlen($string));
|
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
|
Function: smarty_mod_count_sentences
|
||||||
Purpose: count the number of sentences in a text
|
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.
|
// 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
|
Function: smarty_mod_count_paragraphs
|
||||||
Purpose: count the number of sentences in a text
|
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
|
// count \r or \n characters
|
||||||
return count( preg_split("/[\r\n]+/",$string) );
|
return count( preg_split("/[\r\n]+/",$string) );
|
||||||
@@ -693,7 +693,7 @@ function smarty_func_counter($args, &$smarty_obj) {
|
|||||||
|
|
||||||
if (isset($start))
|
if (isset($start))
|
||||||
$count[$id] = $start;
|
$count[$id] = $start;
|
||||||
elseif (!isset($count[$id]))
|
else if (!isset($count[$id]))
|
||||||
$count[$id]=1;
|
$count[$id]=1;
|
||||||
|
|
||||||
if (!isset($print))
|
if (!isset($print))
|
||||||
@@ -701,9 +701,9 @@ function smarty_func_counter($args, &$smarty_obj) {
|
|||||||
else
|
else
|
||||||
$printval[$id]=$print;
|
$printval[$id]=$print;
|
||||||
|
|
||||||
if(!empty($assign)) {
|
if (!empty($assign)) {
|
||||||
$printval[$id] = false;
|
$printval[$id] = false;
|
||||||
$smarty_obj->assign($assign,$count[$id]);
|
$smarty_obj->assign($assign, $count[$id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($printval[$id])
|
if ($printval[$id])
|
||||||
@@ -711,12 +711,12 @@ function smarty_func_counter($args, &$smarty_obj) {
|
|||||||
|
|
||||||
if (isset($skip))
|
if (isset($skip))
|
||||||
$skipval[$id] = $skip;
|
$skipval[$id] = $skip;
|
||||||
elseif (empty($skipval[$id]))
|
else if (empty($skipval[$id]))
|
||||||
$skipval[$id] = 1;
|
$skipval[$id] = 1;
|
||||||
|
|
||||||
if (isset($direction))
|
if (isset($direction))
|
||||||
$dir[$id] = $direction;
|
$dir[$id] = $direction;
|
||||||
elseif (!isset($dir[$id]))
|
else if (!isset($dir[$id]))
|
||||||
$dir[$id] = "up";
|
$dir[$id] = "up";
|
||||||
|
|
||||||
if ($dir[$id] == "down")
|
if ($dir[$id] == "down")
|
||||||
|
@@ -1024,7 +1024,7 @@ function _run_insert_handler($args)
|
|||||||
'depth' => $this->_inclusion_depth,
|
'depth' => $this->_inclusion_depth,
|
||||||
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
||||||
}
|
}
|
||||||
if(!empty($args["assign"])) {
|
if (!empty($args["assign"])) {
|
||||||
$this->assign($args["assign"],$content);
|
$this->assign($args["assign"],$content);
|
||||||
} else {
|
} else {
|
||||||
return $content;
|
return $content;
|
||||||
|
@@ -1024,7 +1024,7 @@ function _run_insert_handler($args)
|
|||||||
'depth' => $this->_inclusion_depth,
|
'depth' => $this->_inclusion_depth,
|
||||||
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
'exec_time' => $this->_get_microtime() - $debug_start_time);
|
||||||
}
|
}
|
||||||
if(!empty($args["assign"])) {
|
if (!empty($args["assign"])) {
|
||||||
$this->assign($args["assign"],$content);
|
$this->assign($args["assign"],$content);
|
||||||
} else {
|
} else {
|
||||||
return $content;
|
return $content;
|
||||||
|
Reference in New Issue
Block a user