This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

So a while back I build a block that would obfuscate emails for concrete5. A limitation of this block was that it had to be added in a block, not in a content block. Taking some code from my block, its pretty easy to build an automatic email obfuscator.

Copy the content blocks view.php to root/blocks/content and open it up. Delete

print $content;

and replace it with

$rand = "<span style=\"display:none;\">";
$rand .= rand(1000000,9999999);
$rand .="</span>"
$emailOrig = array("@");
$emailTo = array("[email protected]");
echo str_replace($emailOrig, $emailTo, $content);

what this code does is it replaces the value in $emailOrig ( which is the @ symbol) with a random value in a span that has display:none applied to it in $content. So all @ are changed to 45453920@ This means that spam bots can't find your email easily, and its preformed automatically.

Important Note: these links are not clickable, so the form a href="mailto:[email protected]" would not work, as the link would be to [email protected], which is an invalid email. Note that this uses a random string to make it impossible to strip characters away, as it would be if it was a static value.

Loading Conversation