add 'mail' attribute to escape modifier

This commit is contained in:
mohrt
2004-04-30 14:50:17 +00:00
parent 448572dfc6
commit 16530ef589
2 changed files with 7 additions and 0 deletions

3
NEWS
View File

@@ -1,3 +1,6 @@
- add 'mail' to escape modifier for safe display of e-mail
addresses (Monte)
- add cycle function attribute "reset" to english docs (Monte)
- enhanced support of numeric constants as variable-expressions (messju)
- add case decentity to smarty_modifier_escape() (Konstantin A. Pelepelin,
messju)

View File

@@ -59,6 +59,10 @@ function smarty_modifier_escape($string, $esc_type = 'html')
case 'javascript':
// escape quotes and backslashes and newlines
return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
case 'mail':
// safe way to display e-mail address on a web page
return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '),$string);
default:
return $string;