You are here

function _simplenews_statistics_replace_url in Simplenews Statistics 6.2

Same name and namespace in other branches
  1. 6.3 simplenews_statistics.module \_simplenews_statistics_replace_url()
  2. 6 simplenews_statistics.module \_simplenews_statistics_replace_url()
  3. 7.2 simplenews_statistics.module \_simplenews_statistics_replace_url()
  4. 7 simplenews_statistics.module \_simplenews_statistics_replace_url()

Alter link to go through statistics

File

./simplenews_statistics.module, line 271
Gathers newsletter statistics.

Code

function _simplenews_statistics_replace_url($match, $nid, $mail) {
  if (substr($match, 0, 1) == "#") {
    return $match;
  }
  require_once drupal_get_path('module', 'simplenews_statistics') . '/rc4.inc';
  $pars = 'nid=' . $nid . '&mail=' . $mail . '&url=' . $match;
  $pars = rc4Encrypt(simplenews_private_key(), $pars);
  $pars_hash = md5($pars);
  return url('simplenews/statistics/click', array(
    'absolute' => TRUE,
    'query' => array(
      'p' => _simplenews_statistics_encode_parameter($pars),
      'h' => _simplenews_statistics_encode_parameter($pars_hash),
    ),
  ));
}