From 16530ef5894c4725798917c8828cc042f15972ba Mon Sep 17 00:00:00 2001 From: mohrt Date: Fri, 30 Apr 2004 14:50:17 +0000 Subject: [PATCH] add 'mail' attribute to escape modifier --- NEWS | 3 +++ libs/plugins/modifier.escape.php | 4 ++++ 2 files changed, 7 insertions(+) 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;