diff --git a/NEWS b/NEWS index ac31c77e..572b350d 100644 --- a/NEWS +++ b/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) diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php index 5bef8b43..1f441688 100644 --- a/libs/plugins/modifier.escape.php +++ b/libs/plugins/modifier.escape.php @@ -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;