mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add 'mail' attribute to escape modifier
This commit is contained in:
3
NEWS
3
NEWS
@@ -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)
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user