You are here

function antispam_load in AntiSpam 7

Same name and namespace in other branches
  1. 6 antispam.module \antispam_load()

Implements hook_load().

File

./antispam.module, line 555
Primary hook implementations for the Antispam module.

Code

function antispam_load($arg, &$map, $index) {
  if (!is_numeric($map[2])) {

    // Node and comment ids are always numeric!
    return FALSE;
  }
  $content_type = $map[1];
  if ($content_type == 'node') {
    if (!($map[2] = node_load($map[2]))) {
      return FALSE;
    }
  }
  if ($content_type == 'comment') {
    if (!($map[2] = comment_load($map[2]))) {
      return FALSE;
    }
  }
  $op = $map[3];
  if ($op == 'publish' || $op == 'unpublish') {
    $map[0] = 'antispam_callback_set_published_status';
  }
  elseif ($op == 'submit-spam' || $op == 'submit-ham') {
    $map[0] = 'antispam_callback_set_spam_status';
  }
  return $map[$index];
}