src/Control/Email/Email.php
public static function obfuscate($email, $method = 'visible')
    {
        switch ($method) {
            case 'direction':
                Requirements::customCSS('span.codedirection { unicode-bidi: bidi-override; direction: rtl; }', 'codedirectionCSS');

                return '<span class="codedirection">' . strrev($email) . '</span>';
            case 'visible':
                $obfuscated = array('@' => ' [at] ', '.' => ' [dot] ', '-' => ' [dash] ');

                return strtr($email, $obfuscated);
            case 'hex':
                $encoded = '';
                for ($x = 0; $x < strlen($email); $x++) {
                    $encoded .= '&#x' . bin2hex($email{$x}) . ';';
                }

                return $encoded;
            default:
                user_error('Email::obfuscate(): Unknown obfuscation method', E_USER_NOTICE);

                return $email;
        }
    }
public static function obfuscate($email, $method = 'visible')
    {
        switch ($method) {
            case 'direction':
                Requirements::customCSS('span.codedirection { unicode-bidi: bidi-override; direction: rtl; }', 'codedirectionCSS');

                return '<span class="codedirection">' . strrev($email) . '</span>';
            case 'visible':
                $obfuscated = array('@' => ' [at] ', '.' => ' [dot] ', '-' => ' [dash] ');

                return strtr($email, $obfuscated);
            case 'hex':
                $encoded = '';
                for ($x = 0; $x < strlen($email); $x++) {
                    $encoded .= '&#x' . bin2hex($email{$x}) . ';';
                }

                return $encoded;
            default:
                user_error('Email::obfuscate(): Unknown obfuscation method', E_USER_NOTICE);

                return $email;
        }
    }
public static function obfuscate ( $ email , $ method = 'visible' ) { switch ( $ method ) { case 'direction' : Requirements :: customCSS ( 'span.codedirection { unicode-bidi: bidi-override; direction: rtl; }' , 'codedirectionCSS' ) ; return '<span class="codedirection">' . strrev ( $ email ) . '</span>' ; case 'visible' : $ obfuscated = array ( '@' => ' [at] ' , '.' => ' [dot] ' , '-' => ' [dash] ' ) ; return strtr ( $ email , $ obfuscated ) ; case 'hex' : $ encoded = '' ; for ( $ x = 0 ; $ x < strlen ( $ email ) ; $ x ++ ) { $ encoded .= '&#x' . bin2hex ( $ email { $ x } ) . ';' ; } return $ encoded ; default : user_error ( 'Email::obfuscate(): Unknown obfuscation method' , E_USER_NOTICE ) ; return $ email ; } }
Encode an email-address to protect it from spambots.
At the moment only simple string substitutions,
which are not 100% safe from email harvesting.

@param string $email Email-address
@param string $method Method for obfuscating/encoding the address
- 'direction': Reverse the text and then use CSS to put the text direction back to normal
- 'visible': Simple string substitution ('@' to '[at]', '.' to '[dot], '-' to [dash])
- 'hex': Hexadecimal URL-Encoding - useful for mailto: links
@return string
Encode an email - address to protect it from spambots . At the moment only simple string substitutions which are not 100% safe from email harvesting .