mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44: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)
|
- enhanced support of numeric constants as variable-expressions (messju)
|
||||||
- add case decentity to smarty_modifier_escape() (Konstantin A. Pelepelin,
|
- add case decentity to smarty_modifier_escape() (Konstantin A. Pelepelin,
|
||||||
messju)
|
messju)
|
||||||
|
@@ -59,6 +59,10 @@ function smarty_modifier_escape($string, $esc_type = 'html')
|
|||||||
case 'javascript':
|
case 'javascript':
|
||||||
// escape quotes and backslashes and newlines
|
// escape quotes and backslashes and newlines
|
||||||
return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
|
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:
|
default:
|
||||||
return $string;
|
return $string;
|
||||||
|
Reference in New Issue
Block a user