Created
August 3, 2010 19:01
-
-
Save jasonmcleod/506926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Not sure if this has any effect against email scraping bots but it's an idea. | |
It just outputs the string as an array of character codes, then restores it | |
real characters after the page loads. With javascript disabled we fail. :( */ | |
// PHP function /////////////////////////////////// | |
function mask($str) { | |
$mask = ""; | |
for($c=0;$c<strlen($str);$c++) { | |
$mask .= "" . ord($str[$c]) . ","; | |
} | |
return "<span class='mask'>" . $mask . "</span>"; | |
} | |
// end of PHP function //////////////////////////// | |
// jQuery function //////////////////////////////// | |
$(".mask").each(function() { | |
c = $(this).text().split(","); | |
v=""; | |
for(l in c) { | |
v+=(String.fromCharCode(c[l])); | |
} | |
$(this).html(v); | |
}); | |
// end of jQuery function ///////////////////////// | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment