You are here

function spamspan_callback in SpamSpan filter 5

callback function for preg_replace_callback

1 string reference to 'spamspan_callback'
spamspan in ./spamspan.module
Central SpamSpan replace function We are aiming for code like this: <span class="spamspan"> <span class="u">user</span> [at] <span class="d">example [dot] com</span> </span>

File

./spamspan.module, line 130
This module implements the spamspan technique (http://www.spamspan.com ) for hiding email addresses from spambots. If javascript is disabled on the client-side, addresses appear as example [at] example [dot] com.

Code

function spamspan_callback($matches) {

  // Replace .'s in the address with [dot]
  $user_name = str_replace(".", " [dot] ", $matches[1]);
  $domain = str_replace(".", " [dot] ", $matches[2]);
  return '<span class="spamspan"><span class="' . variable_get('spamspan_userclass', 'u') . "\">{$user_name}</span>" . variable_get('spamspan_at', ' [at] ') . "<span class=\"" . variable_get('spamspan_domainclass', 'd') . "\">{$domain}</span></span>";
}