mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09:54:27 +02:00
added default modifier
This commit is contained in:
@@ -127,6 +127,15 @@ function smarty_mod_strip_tags($string, $replace_with_space = true)
|
||||
return strip_tags($string);
|
||||
}
|
||||
|
||||
function smarty_mod_default($string,$default="")
|
||||
{
|
||||
if(empty($string))
|
||||
return $default;
|
||||
else
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
/*============================================*\
|
||||
Custom tag functions
|
||||
\*============================================*/
|
||||
|
@@ -77,7 +77,8 @@ class Smarty
|
||||
'date_format' => 'smarty_mod_date_format',
|
||||
'string_format' => 'smarty_mod_string_format',
|
||||
'replace' => 'smarty_mod_replace',
|
||||
'strip_tags' => 'smarty_mod_strip_tags'
|
||||
'strip_tags' => 'smarty_mod_strip_tags',
|
||||
'default' => 'smarty_mod_default'
|
||||
);
|
||||
var $global_assign = array( 'SCRIPT_NAME'
|
||||
);
|
||||
|
@@ -77,7 +77,8 @@ class Smarty
|
||||
'date_format' => 'smarty_mod_date_format',
|
||||
'string_format' => 'smarty_mod_string_format',
|
||||
'replace' => 'smarty_mod_replace',
|
||||
'strip_tags' => 'smarty_mod_strip_tags'
|
||||
'strip_tags' => 'smarty_mod_strip_tags',
|
||||
'default' => 'smarty_mod_default'
|
||||
);
|
||||
var $global_assign = array( 'SCRIPT_NAME'
|
||||
);
|
||||
|
Reference in New Issue
Block a user