diff options
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php index 5358d5d2e..9d108d77c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -893,6 +893,31 @@ function filesize_h($size, $dec = 1){ } /** + * return an obfuscated email address in line with $conf['mailguard'] setting + * + * @author Harry Fuecks <hfuecks@gmail.com> + * @author Christopher Smith <chris@jalakai.co.uk> + */ +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 * * @author Andreas Gohr <andi@splitbrain.org> |