You are here

function antispam_moderator_operations in AntiSpam 6

Same name and namespace in other branches
  1. 7 antispam.admin.inc \antispam_moderator_operations()

Moderation queue operations.

4 calls to antispam_moderator_operations()
antispam_confirm_multiple_operation in ./antispam.admin.inc
List the selected items and verify that the admin really wants to delete them.
antispam_confirm_multiple_operation_submit in ./antispam.admin.inc
confirm_form callback; perform the actual operation against selected content.
antispam_moderation_form in ./antispam.admin.inc
antispam_moderation_form_validate in ./antispam.admin.inc
Form API callback; Validate the moderation queue form.

File

./antispam.admin.inc, line 337

Code

function antispam_moderator_operations($mode, $submode) {

  // Build operations array; based on current mode.
  if ($mode == 'nodes') {
    $operations = array(
      'submit-spam' => array(
        'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit selected nodes as spam') : t('Mark selected nodes as spam'),
        'confirm' => variable_get('antispam_connection_enabled', 1) ? t('Are you sure you want to submit these nodes as spam?') : t('Are you sure you want to mark these nodes as spam?'),
        'button' => variable_get('antispam_connection_enabled', 1) ? t('Submit nodes as spam') : t('Mark nodes as spam'),
      ),
      'submit-ham' => array(
        'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit selected nodes as ham') : t('Mark selected nodes as ham'),
        'confirm' => variable_get('antispam_connection_enabled', 1) ? t('Are you sure you want to submit these nodes as ham?') : t('Are you sure you want to mark these nodes as ham?'),
        'button' => variable_get('antispam_connection_enabled', 1) ? t('Submit nodes as ham') : t('Mark nodes as ham'),
      ),
      'publish' => array(
        'title' => t('Publish selected nodes'),
        'confirm' => t('Are you sure you want to publish these nodes?'),
        'button' => t('Publish nodes'),
      ),
      'unpublish' => array(
        'title' => t('Unpublish selected nodes'),
        'confirm' => t('Are you sure you want to unpublish these nodes?'),
        'button' => t('Unpublish nodes'),
      ),
      'delete' => array(
        'title' => t('Delete selected nodes'),
        'confirm' => t('Are you sure you want to delete these nodes and all their comments?'),
        'button' => t('Delete nodes'),
        'warning' => t('This action cannot be undone.'),
      ),
    );
  }
  else {
    if ($mode == 'comments') {
      $operations = array(
        'submit-spam' => array(
          'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit selected comments as spam') : t('Mark selected comments as spam'),
          'confirm' => variable_get('antispam_connection_enabled', 1) ? t('Are you sure you want to submit these comments as spam?') : t('Are you sure you want to mark these comments as spam?'),
          'button' => variable_get('antispam_connection_enabled', 1) ? t('Submit comments as spam') : t('Mark comments as spam'),
        ),
        'submit-ham' => array(
          'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit selected comments as ham') : t('Mark selected comments as ham'),
          'confirm' => variable_get('antispam_connection_enabled', 1) ? t('Are you sure you want to submit these comments as ham?') : t('Are you sure you want to mark these comments as ham?'),
          'button' => variable_get('antispam_connection_enabled', 1) ? t('Submit comments as ham') : t('Mark comments as ham'),
        ),
        'publish' => array(
          'title' => t('Publish selected comments'),
          'confirm' => t('Are you sure you want to publish these comments?'),
          'button' => t('Publish comments'),
        ),
        'unpublish' => array(
          'title' => t('Unpublish selected comments'),
          'confirm' => t('Are you sure you want to unpublish these comments?'),
          'button' => t('Unpublish comments'),
        ),
        'delete' => array(
          'title' => t('Delete selected comments'),
          'confirm' => t('Are you sure you want to delete these comments and all their replies?'),
          'button' => t('Delete comments'),
          'warning' => t('This action cannot be undone.'),
        ),
      );
    }
    else {

      // Unknown mode!
      return array();
    }
  }

  // Unset redundant operations; based on current submode.
  if ($submode == 'spam') {
    unset($operations['submit-spam']);
  }
  else {
    if ($submode == 'unpublished') {
      unset($operations['unpublish']);
    }
    else {
      if ($submode == 'published') {
        unset($operations['publish']);
      }
      else {

        // Unknown submode!
        return array();
      }
    }
  }
  return $operations;
}