You are here

function _spamspan_callback_mailto in SpamSpan filter 6

Same name and namespace in other branches
  1. 7 spamspan.module \_spamspan_callback_mailto()

The callback functions for preg_replace_callback

Replace an email addresses which has been found with the appropriate <span> tags

Parameters

$matches: An array containing parts of an email address or mailto: URL.

Return value

The span with which to replace the email address

1 string reference to '_spamspan_callback_mailto'
spamspan in ./spamspan.module
Scan text and replace email addresses with span tags

File

./spamspan.module, line 151
This module implements the spamspan technique (http://www.spamspan.com ) for hiding email addresses from spambots.

Code

function _spamspan_callback_mailto($matches) {

  // take the mailto: URL in $matches[2] and split the query string
  // into its component parts, putting them in $headers as
  // [0]=>"header=contents" etc.  We cannot use parse_str because
  // the query string might contain dots.
  $headers = preg_split('/[&;]/', parse_url($matches[2], PHP_URL_QUERY));

  // if no matches, $headers[0] will be set to '' so $headers must be reset
  if ($headers[0] == '') {
    $headers = array();
  }
  return _spamspan_output($matches[3], $matches[4], $matches[5], $headers);
}