mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
Cleanup whitespace.
This commit is contained in:
@@ -114,11 +114,11 @@ function smarty_mod_date_format($string, $format="%b %e, %Y")
|
||||
function smarty_make_timestamp($string)
|
||||
{
|
||||
$time = strtotime($string);
|
||||
if(is_numeric($time) && $time != -1)
|
||||
if (is_numeric($time) && $time != -1)
|
||||
return $time;
|
||||
|
||||
// is mysql timestamp format of YYYYMMDDHHMMSS?
|
||||
if(is_numeric($string) && strlen($string) == 14) {
|
||||
if (is_numeric($string) && strlen($string) == 14) {
|
||||
$time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
|
||||
substr($string,4,2),substr($string,6,2),substr($string,0,4));
|
||||
|
||||
@@ -174,7 +174,7 @@ function smarty_mod_strip_tags($string, $replace_with_space = true)
|
||||
\*======================================================================*/
|
||||
function smarty_mod_default($string, $default="")
|
||||
{
|
||||
if(empty($string))
|
||||
if (empty($string))
|
||||
return $default;
|
||||
else
|
||||
return $string;
|
||||
@@ -503,7 +503,7 @@ function smarty_func_html_select_time()
|
||||
\*======================================================================*/
|
||||
function smarty_func_math($args, $smarty_obj) {
|
||||
// be sure equation parameter is present
|
||||
if(empty($args["equation"])) {
|
||||
if (empty($args["equation"])) {
|
||||
$smarty_obj->_trigger_error_msg("math: missing equation parameter");
|
||||
return;
|
||||
}
|
||||
@@ -511,7 +511,7 @@ function smarty_func_math($args, $smarty_obj) {
|
||||
$equation = $args["equation"];
|
||||
|
||||
// make sure parenthesis are balanced
|
||||
if(substr_count($equation,"(") != substr_count($equation,")")) {
|
||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
||||
$smarty_obj->_trigger_error_msg("math: unbalanced parenthesis");
|
||||
return;
|
||||
}
|
||||
@@ -522,20 +522,20 @@ function smarty_func_math($args, $smarty_obj) {
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||
|
||||
foreach($match[0] as $curr_var) {
|
||||
if(!in_array($curr_var,array_keys($args)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
if (!in_array($curr_var,array_keys($args)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
$smarty_obj->_trigger_error_msg("math: parameter $curr_var not passed as argument");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($args as $key => $val) {
|
||||
if($key != "equation" && $key != "format") {
|
||||
if ($key != "equation" && $key != "format") {
|
||||
// make sure value is not empty
|
||||
if(strlen($val)==0) {
|
||||
if (strlen($val)==0) {
|
||||
$smarty_obj->_trigger_error_msg("math: parameter $key is empty");
|
||||
return;
|
||||
}
|
||||
if(!is_numeric($val)) {
|
||||
if (!is_numeric($val)) {
|
||||
$smarty_obj->_trigger_error_msg("math: parameter $key: is not numeric");
|
||||
return;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ function smarty_func_math($args, $smarty_obj) {
|
||||
|
||||
eval("\$smarty_math_result = ".$equation.";");
|
||||
|
||||
if(empty($args["format"]))
|
||||
if (empty($args["format"]))
|
||||
echo $smarty_math_result;
|
||||
else
|
||||
printf($args["format"],$smarty_math_result);
|
||||
@@ -590,7 +590,7 @@ function smarty_func_fetch($args, &$smarty_obj) {
|
||||
\*======================================================================*/
|
||||
function smarty_mod_count_characters($string,$include_spaces=false) {
|
||||
|
||||
if($include_spaces)
|
||||
if ($include_spaces)
|
||||
return(strlen($string));
|
||||
|
||||
return preg_match_all("/[^\s]/",$string,$match);
|
||||
@@ -645,33 +645,33 @@ function smarty_func_counter() {
|
||||
|
||||
extract(func_get_arg(0));
|
||||
|
||||
if(!isset($id))
|
||||
if (!isset($id))
|
||||
$id = "default";
|
||||
|
||||
if(isset($start))
|
||||
if (isset($start))
|
||||
$count[$id] = $start;
|
||||
elseif(!isset($count[$id]))
|
||||
elseif (!isset($count[$id]))
|
||||
$count[$id]=1;
|
||||
|
||||
if(!isset($print))
|
||||
if (!isset($print))
|
||||
$printval[$id]=true;
|
||||
else
|
||||
$printval[$id]=$print;
|
||||
|
||||
if($printval[$id])
|
||||
if ($printval[$id])
|
||||
echo $count[$id];
|
||||
|
||||
if(isset($skip))
|
||||
if (isset($skip))
|
||||
$skipval[$id] = $skip;
|
||||
elseif(!isset($skipval))
|
||||
elseif (!isset($skipval))
|
||||
$skipval[$id] = 1;
|
||||
|
||||
if(isset($direction))
|
||||
if (isset($direction))
|
||||
$dir[$id] = $direction;
|
||||
elseif(!isset($dir[$id]))
|
||||
elseif (!isset($dir[$id]))
|
||||
$dir[$id] = "up";
|
||||
|
||||
if($dir[$id] == "down")
|
||||
if ($dir[$id] == "down")
|
||||
$count[$id] -= $skipval[$id];
|
||||
else
|
||||
$count[$id] += $skipval[$id];
|
||||
@@ -686,7 +686,7 @@ function smarty_func_counter() {
|
||||
function smarty_func_assign_debug_info($args, &$smarty_obj) {
|
||||
$assigned_vars = $smarty_obj->_tpl_vars;
|
||||
ksort($assigned_vars);
|
||||
if(is_array($smarty_obj->_config[0])) {
|
||||
if (is_array($smarty_obj->_config[0])) {
|
||||
$config_vars = $smarty_obj->_config[0];
|
||||
ksort($config_vars);
|
||||
$smarty_obj->assign("_debug_config_keys",array_keys($config_vars));
|
||||
@@ -726,56 +726,56 @@ function smarty_func_overlib($args, &$smarty_obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($trigger)) { $trigger = "onMouseOver"; }
|
||||
if (empty($trigger)) { $trigger = "onMouseOver"; }
|
||||
|
||||
echo $trigger.'="return overlib(\''.str_replace("'","\'",$text).'\'';
|
||||
if($sticky) { echo ",STICKY"; }
|
||||
if(!empty($caption)) { echo ",CAPTION,'".str_replace("'","\'",$caption)."'"; }
|
||||
if(!empty($fgcolor)) { echo ",FGCOLOR,'$fgcolor'"; }
|
||||
if(!empty($bgcolor)) { echo ",BGCOLOR,'$bgcolor'"; }
|
||||
if(!empty($textcolor)) { echo ",TEXTCOLOR,'$textcolor'"; }
|
||||
if(!empty($capcolor)) { echo ",CAPCOLOR,'$capcolor'"; }
|
||||
if(!empty($closecolor)) { echo ",CLOSECOLOR,'$closecolor'"; }
|
||||
if(!empty($textfont)) { echo ",TEXTFONT,'$textfont'"; }
|
||||
if(!empty($captionfont)) { echo ",CAPTIONFONT,'$captionfont'"; }
|
||||
if(!empty($closefont)) { echo ",CLOSEFONT,'$closefont'"; }
|
||||
if(!empty($textsize)) { echo ",TEXTSIZE,'$textsize'"; }
|
||||
if(!empty($captionsize)) { echo ",CAPTIONSIZE,'$captionsize'"; }
|
||||
if(!empty($closesize)) { echo ",CLOSESIZE,'$closesize'"; }
|
||||
if(!empty($width)) { echo ",WIDTH,'$width'"; }
|
||||
if(!empty($height)) { echo ",HEIGHT,'$height'"; }
|
||||
if(!empty($left)) { echo ",LEFT"; }
|
||||
if(!empty($right)) { echo ",RIGHT"; }
|
||||
if(!empty($center)) { echo ",CENTER"; }
|
||||
if(!empty($above)) { echo ",ABOVE"; }
|
||||
if(!empty($below)) { echo ",BELOW"; }
|
||||
if(!empty($border)) { echo ",BORDER,'$border'"; }
|
||||
if(!empty($offsetx)) { echo ",OFFSETX,'$offsetx'"; }
|
||||
if(!empty($offsety)) { echo ",OFFSETY,'$offsetxy'"; }
|
||||
if(!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; }
|
||||
if(!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; }
|
||||
if(!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; }
|
||||
if(!empty($noclose)) { echo ",NOCLOSE"; }
|
||||
if(!empty($status)) { echo ",STATUS,'".str_replace("'","\'",$status)."'"; }
|
||||
if(!empty($autostatus)) { echo ",AUTOSTATUS"; }
|
||||
if(!empty($autostatuscap)) { echo ",AUTOSTATUSCAP"; }
|
||||
if(!empty($inarray)) { echo ",INARRAY,'$inarray'"; }
|
||||
if(!empty($caparray)) { echo ",CAPARRAY,'$caparray'"; }
|
||||
if(!empty($capicaon)) { echo ",CAPICON,'$capicon'"; }
|
||||
if(!empty($snapx)) { echo ",SNAPX,'$snapx'"; }
|
||||
if(!empty($snapy)) { echo ",SNAPY,'$snapy'"; }
|
||||
if(!empty($fixx)) { echo ",FIXX,'$fixx'"; }
|
||||
if(!empty($fixy)) { echo ",FIXY,'$fixy'"; }
|
||||
if(!empty($background)) { echo ",BACKGROUND,'$background'"; }
|
||||
if(!empty($padx)) { echo ",PADX,'$padx'"; }
|
||||
if(!empty($pady)) { echo ",PADY,'$pady'"; }
|
||||
if(!empty($fullhtml)) { echo ",FULLHTML"; }
|
||||
if(!empty($frame)) { echo ",FRAME,'$frame'"; }
|
||||
if(!empty($timeout)) { echo ",TIMEOUT,'$timeout'"; }
|
||||
if(!empty($function)) { echo ",FUNCTION,'$function'"; }
|
||||
if(!empty($delay)) { echo ",DELAY,'$delay'"; }
|
||||
if(!empty($hauto)) { echo ",HAUTO"; }
|
||||
if(!empty($vauto)) { echo ",VAUTO"; }
|
||||
if ($sticky) { echo ",STICKY"; }
|
||||
if (!empty($caption)) { echo ",CAPTION,'".str_replace("'","\'",$caption)."'"; }
|
||||
if (!empty($fgcolor)) { echo ",FGCOLOR,'$fgcolor'"; }
|
||||
if (!empty($bgcolor)) { echo ",BGCOLOR,'$bgcolor'"; }
|
||||
if (!empty($textcolor)) { echo ",TEXTCOLOR,'$textcolor'"; }
|
||||
if (!empty($capcolor)) { echo ",CAPCOLOR,'$capcolor'"; }
|
||||
if (!empty($closecolor)) { echo ",CLOSECOLOR,'$closecolor'"; }
|
||||
if (!empty($textfont)) { echo ",TEXTFONT,'$textfont'"; }
|
||||
if (!empty($captionfont)) { echo ",CAPTIONFONT,'$captionfont'"; }
|
||||
if (!empty($closefont)) { echo ",CLOSEFONT,'$closefont'"; }
|
||||
if (!empty($textsize)) { echo ",TEXTSIZE,'$textsize'"; }
|
||||
if (!empty($captionsize)) { echo ",CAPTIONSIZE,'$captionsize'"; }
|
||||
if (!empty($closesize)) { echo ",CLOSESIZE,'$closesize'"; }
|
||||
if (!empty($width)) { echo ",WIDTH,'$width'"; }
|
||||
if (!empty($height)) { echo ",HEIGHT,'$height'"; }
|
||||
if (!empty($left)) { echo ",LEFT"; }
|
||||
if (!empty($right)) { echo ",RIGHT"; }
|
||||
if (!empty($center)) { echo ",CENTER"; }
|
||||
if (!empty($above)) { echo ",ABOVE"; }
|
||||
if (!empty($below)) { echo ",BELOW"; }
|
||||
if (!empty($border)) { echo ",BORDER,'$border'"; }
|
||||
if (!empty($offsetx)) { echo ",OFFSETX,'$offsetx'"; }
|
||||
if (!empty($offsety)) { echo ",OFFSETY,'$offsetxy'"; }
|
||||
if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; }
|
||||
if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; }
|
||||
if (!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; }
|
||||
if (!empty($noclose)) { echo ",NOCLOSE"; }
|
||||
if (!empty($status)) { echo ",STATUS,'".str_replace("'","\'",$status)."'"; }
|
||||
if (!empty($autostatus)) { echo ",AUTOSTATUS"; }
|
||||
if (!empty($autostatuscap)) { echo ",AUTOSTATUSCAP"; }
|
||||
if (!empty($inarray)) { echo ",INARRAY,'$inarray'"; }
|
||||
if (!empty($caparray)) { echo ",CAPARRAY,'$caparray'"; }
|
||||
if (!empty($capicaon)) { echo ",CAPICON,'$capicon'"; }
|
||||
if (!empty($snapx)) { echo ",SNAPX,'$snapx'"; }
|
||||
if (!empty($snapy)) { echo ",SNAPY,'$snapy'"; }
|
||||
if (!empty($fixx)) { echo ",FIXX,'$fixx'"; }
|
||||
if (!empty($fixy)) { echo ",FIXY,'$fixy'"; }
|
||||
if (!empty($background)) { echo ",BACKGROUND,'$background'"; }
|
||||
if (!empty($padx)) { echo ",PADX,'$padx'"; }
|
||||
if (!empty($pady)) { echo ",PADY,'$pady'"; }
|
||||
if (!empty($fullhtml)) { echo ",FULLHTML"; }
|
||||
if (!empty($frame)) { echo ",FRAME,'$frame'"; }
|
||||
if (!empty($timeout)) { echo ",TIMEOUT,'$timeout'"; }
|
||||
if (!empty($function)) { echo ",FUNCTION,'$function'"; }
|
||||
if (!empty($delay)) { echo ",DELAY,'$delay'"; }
|
||||
if (!empty($hauto)) { echo ",HAUTO"; }
|
||||
if (!empty($vauto)) { echo ",VAUTO"; }
|
||||
echo ');" onMouseOut="nd();"';
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user