I've wrote this tag to encode e-mail links to prevent for spam.
{NOSPAM_EMAIL:mail@adress.tld} will produce
Code: Select all
<a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">mail<span>@</span>adress<span>.</span>tld</a>
UPDATE
it's better now
![Smile :-)](./images/smilies/icon_smile.gif)
You can use now:
{NOSPAM_EMAIL:mail@adress.tld:linktext} this will produce
Code: Select all
<a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">linktext</a>
just paste the code into a file inside the frontend_render folder and use the tag in your contentparts.
greetings marcus
Code: Select all
<?php
/********************************************
titel: {NOSPAM_EMAIL} Replacement-Tag
description: 1.{NOSPAM_EMAIL:mail@adress.tld}
this tag will encode your emailadress to hexcode
the output looks like this:
<a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">mail<span>@</span>adress<span>.</span>tld</a>
2.{NOSPAM_EMAIL:mail@adress.tld:Linktext}
the output looks like this:
<a href="mailto:%6D%61%69%6C%40%61%64%72%65%73%73%2E%74%6C%64">linktext/a>
notice: these two vars replace @ and . with the chars you prefer like this: mail (at) adress (dot) tdl
$ats = "(at)";
$dots = "(dot)";
look at this too:
http://www.phpwcms.de/forum/viewtopic.php?t=4819
author: Marcus Obst
last modified: 07.02.2006
********************************************/
function no_spam($mail,$alt='') {
// these vars replace the @s and dots
$ats = "<span>@</span>";
$dots = "<span>.</span>";
$str = "";
$a = unpack("C*", $mail);
foreach ($a as $b)
$str .= sprintf("%%%X", $b);
$enc_mail = str_replace("@",$ats,$alt);
$enc_mail = str_replace(".",$dots,$enc_mail);
$str = "<a href=\"mailto:" . $str . "\">" . $enc_mail . "</a>";
return $str;
}
if( ! ( strpos($content["all"],'{NOSPAM_EMAIL')==false ) ) {
//$content["all"] = str_replace('{NAV_LIST_ALL}','{NAV_LIST_ALL:0:navcontainer}',$content["all"]);
$content["all"] = preg_replace('/\{NOSPAM_EMAIL:([\w|@|.|\-|_|\+]+)\}/','{NOSPAM_EMAIL:$1:$1}',$content["all"]);
$content["all"] = preg_replace('/\{NOSPAM_EMAIL:([\w|@|.|\-|_|\+]+):(.*?)\}/e','no_spam("$1","$2")',$content["all"]);
}
?>