You are here

function simplenews_statistics_encoder_simplenews_statistics_decode in Simplenews Statistics 7.2

Same name and namespace in other branches
  1. 7 simplenews_statistics_encoder/simplenews_statistics_encoder.module \simplenews_statistics_encoder_simplenews_statistics_decode()

Implements hook_simplenews_statistics_decode().

File

simplenews_statistics_encoder/simplenews_statistics_encoder.module, line 74
Main simplenews statistics encoder file.

Code

function simplenews_statistics_encoder_simplenews_statistics_decode($id, $key) {
  $type = variable_get('simplenews_statistics_encoder_type', 'md5');
  module_load_include('inc', 'simplenews_statistics_encoder', 'encoder');
  if ($type == 'md5') {
    return simplenews_statistics_encoder_decode_hash($id, $key);
  }
  elseif ($type == 'shorturl') {
    $decoded = simplenews_statistics_encoder_decode($id);
    $salt = variable_get('simplenews_statistics_encoder_salt', 0);
    return $decoded - $salt;
  }
  else {
    return $id;
  }
}