Printing spamsafe Email-link
This is my alternative to the ContactAction now part of Wikka v1.1.6.0. It creates a mailto link fairly safe from spam email harvesting robots by outputting the html code using JavaScript. Unlike the ContactAction it allows any email address to be included.To use:
- {{email}} will output the admin email address from wakka.config.php
- {{email user domain}} will output any email address
<?php
/**
* Creates a mailto link (fairly) safe from spam email harvesting bots
* Use: {{email}} will use address from wakka.config.php
* or {{email user domain}}
*
* @package Actions
* @name email
*
*/
if (empty($wikka_vars)) {
// Choose one of the next two lines; 1st allows a hardcoded email address, 2nd users the admin in stored in the config file:
//$wikka_vars = "user example.com"; //Default email, replace @ with a space
$wikka_vars = str_replace("@", " ", $this->GetConfigValue("admin_email"));
}
$pieces = explode(" ", $wikka_vars, 2);
?>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write('<a href=\"mail' + 'to:' + '<?php echo $pieces[0]; ?>' + '@' + '<?php echo $pieces[1]; ?>' + '\">');document.write('<?php echo $pieces[0]; ?>' + '@' + '<?php echo $pieces[1]; ?>' + '</a>');
// End -->
</SCRIPT>
/**
* Creates a mailto link (fairly) safe from spam email harvesting bots
* Use: {{email}} will use address from wakka.config.php
* or {{email user domain}}
*
* @package Actions
* @name email
*
*/
if (empty($wikka_vars)) {
// Choose one of the next two lines; 1st allows a hardcoded email address, 2nd users the admin in stored in the config file:
//$wikka_vars = "user example.com"; //Default email, replace @ with a space
$wikka_vars = str_replace("@", " ", $this->GetConfigValue("admin_email"));
}
$pieces = explode(" ", $wikka_vars, 2);
?>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write('<a href=\"mail' + 'to:' + '<?php echo $pieces[0]; ?>' + '@' + '<?php echo $pieces[1]; ?>' + '\">');document.write('<?php echo $pieces[0]; ?>' + '@' + '<?php echo $pieces[1]; ?>' + '</a>');
// End -->
</SCRIPT>
CategoryUserContributions