From 00a7b5ad8c432fcfb4f394ab300d802a0fe4c35c Mon Sep 17 00:00:00 2001 From: Esther Brunner Date: Fri, 2 Sep 2005 17:05:27 +0200 Subject: function obfuscate($email) moved to common.php; used in parser and some plugins darcs-hash:20050902150527-283c4-dae58038c70aacb000f535e8173fa263ba774f52.gz --- inc/common.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 5358d5d2e..9d108d77c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -892,6 +892,31 @@ function filesize_h($size, $dec = 1){ return round($size, $dec) . ' ' . $sizes[$i]; } +/** + * return an obfuscated email address in line with $conf['mailguard'] setting + * + * @author Harry Fuecks + * @author Christopher Smith + */ +function obfuscate($email) { + global $conf; + + switch ($conf['mailguard']) { + case 'visible' : + $obfuscate = array('@' => ' [at] ', '.' => ' [dot] ', '-' => ' [dash] '); + return strtr($email, $obfuscate); + + case 'hex' : + $encode = ''; + for ($x=0; $x < strlen($email); $x++) $encode .= '&#x' . bin2hex($email{$x}).';'; + return $encode; + + case 'none' : + default : + return $email; + } +} + /** * Return DokuWikis version * -- cgit v1.2.3