You are here

function spam_operations_callback in Spam 5.3

Same name and namespace in other branches
  1. 6 spam.module \spam_operations_callback()

Callback function for admin mass editing spam. Mark as spam.

1 string reference to 'spam_operations_callback'
spam_spam_operations in ./spam.module
Implementation of hook_spam_operations().

File

./spam.module, line 1436

Code

function spam_operations_callback($spam, $op) {
  foreach ($spam as $content) {
    $pieces = explode('-', $content);
    if (strlen($pieces[0]) && is_numeric($pieces[1]) && strlen($op)) {
      $func = "spam_{$op}";
      if (function_exists($func)) {
        spam_log(SPAM_VERBOSE, 'spam_operations_callback', t('bulk update @op', array(
          '@op' => $op,
        )), $pieces[0], $pieces[1]);
        $func($pieces[0], $pieces[1]);
      }
      else {
        spam_log(SPAM_LOG, 'spam_operations_callback', t('no such function (@func), failed op(@op)', array(
          '@func' => $func,
          '@op' => $op,
        )), $pieces[0], $pieces[1]);
      }
    }
    else {
      spam_log(SPAM_LOG, 'spam_operations_callback', t('unexpected error: content_type(@type) content_id(@id) op(@op)', array(
        '@type' => $pieces[0],
        '@id' => $pieces[1],
        '@op' => $op,
      )));
    }
  }
}