// http://www.celticproductions.net/articles/10/email/php+email+obfuscator.html function munge($address) { $address = strtolower($address); $coded = ""; $unmixedkey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@!#$%&*+-/=?_{|}~."; $inprogresskey = $unmixedkey; $mixedkey=""; $unshuffled = strlen($unmixedkey); for ($i = 0; $i <= strlen($unmixedkey); $i++) { $ranpos = rand(0,$unshuffled-1); $nextchar = $inprogresskey{$ranpos}; $mixedkey .= $nextchar; $before = substr($inprogresskey,0,$ranpos); $after = substr($inprogresskey,$ranpos+1,$unshuffled-($ranpos+1)); $inprogresskey = $before.''.$after; $unshuffled -= 1; } $cipher = $mixedkey; $shift = strlen($address); for ($j=0; $j$coded, 'key'=>$cipher); } add_action('wp_head', 'print_mail_obfuscate_js'); function print_mail_obfuscate_js() { echo << EOS; } function mail_obfuscate_tag_func($atts, $content="") { extract(shortcode_atts(array( 'email'=>false, 'css_class'=>"", ), $atts)); if ($email) { $targetid="mailto-". md5(sprintf("%d:%d", get_the_ID(), time())); extract(munge($email)); return "{$content} "; } return ""; } add_shortcode('mail_obfuscate', 'mail_obfuscate_tag_func');