Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Created November 15, 2012 23:10
Show Gist options
  • Save Pleiades/4082216 to your computer and use it in GitHub Desktop.
Save Pleiades/4082216 to your computer and use it in GitHub Desktop.
Obfuscate an Email Address
function munge_mail_shortcode( $atts , $content=null ) {
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';';
return '<a href="mailto:'.$encodedmail.'">'.$encodedmail.'</a>';
}
add_shortcode('mailto', 'munge_mail_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment