You are here

function antispam_menu in AntiSpam 7

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

Implements hook_menu().

File

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

Code

function antispam_menu() {
  $items = array();
  $moderator_types = antispam_get_moderator_types();

  // New menu block.
  $items['admin/config/spamprevention'] = array(
    'title' => 'AntiSpam',
    'description' => 'Use the anti-spam service to protect your site from spam.',
    'position' => 'right',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'access administration pages',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );

  // A menu item for the menu block.
  $items['admin/config/spamprevention/antispam'] = array(
    'title' => t('AntiSpam'),
    'description' => t('Use the anti-spam service to protect your site from spam.'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'antispam_settings_form',
    ),
    'access arguments' => array(
      'administer antispam settings',
    ),
    'file' => 'antispam.admin.inc',
    // Needs to be normal to show up.
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/content/antispam/overview'] = array(
    'title' => 'Overview',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
    'file' => 'antispam.admin.inc',
  );
  $items['admin/content/antispam/nodes'] = array(
    'title' => 'Nodes',
    'page callback' => 'antispam_callback_queue',
    'page arguments' => array(
      'nodes',
    ),
    'access callback' => '_antispam_is_node_moderator',
    'access arguments' => array(
      $moderator_types,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
    'file' => 'antispam.admin.inc',
  );
  $items['admin/content/antispam/nodes/spam'] = array(
    'title' => 'Spam',
    'page callback' => 'antispam_callback_queue',
    'page arguments' => array(
      'nodes',
    ),
    'access callback' => '_antispam_is_node_moderator',
    'access arguments' => array(
      $moderator_types,
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
    'file' => 'antispam.admin.inc',
  );
  $items['admin/content/antispam/nodes/unpublished'] = array(
    'title' => 'Unpublished nodes',
    'page callback' => 'antispam_callback_queue',
    'page arguments' => array(
      'nodes',
      'unpublished',
    ),
    'access callback' => '_antispam_is_node_moderator',
    'access arguments' => array(
      $moderator_types,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
    'file' => 'antispam.admin.inc',
  );
  $items['admin/content/antispam/nodes/published'] = array(
    'title' => 'Published nodes',
    'page callback' => 'antispam_callback_queue',
    'page arguments' => array(
      'nodes',
      'published',
    ),
    'access callback' => '_antispam_is_node_moderator',
    'access arguments' => array(
      $moderator_types,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
    'file' => 'antispam.admin.inc',
  );
  if (module_exists('comment')) {
    $items['admin/content/antispam/comments'] = array(
      'title' => 'Comments',
      'page callback' => 'antispam_callback_queue',
      'page arguments' => array(
        'comments',
      ),
      'access callback' => '_antispam_is_moderator',
      'access arguments' => array(
        $moderator_types,
        'comments',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
      'file' => 'antispam.admin.inc',
    );
    $items['admin/content/antispam/comments/spam'] = array(
      'title' => 'Spam',
      'page callback' => 'antispam_callback_queue',
      'page arguments' => array(
        'comments',
      ),
      'access callback' => '_antispam_is_moderator',
      'access arguments' => array(
        $moderator_types,
        'comments',
      ),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
      'file' => 'antispam.admin.inc',
    );
    $items['admin/content/antispam/comments/unpublished'] = array(
      'title' => 'Unpublished comments',
      'page callback' => 'antispam_callback_queue',
      'page arguments' => array(
        'comments',
        'unpublished',
      ),
      'access callback' => '_antispam_is_moderator',
      'access arguments' => array(
        $moderator_types,
        'comments',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
      'file' => 'antispam.admin.inc',
    );
    $items['admin/content/antispam/comments/published'] = array(
      'title' => 'Published comments',
      'page callback' => 'antispam_callback_queue',
      'page arguments' => array(
        'comments',
        'published',
      ),
      'access callback' => '_antispam_is_moderator',
      'access arguments' => array(
        $moderator_types,
        'comments',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
      'file' => 'antispam.admin.inc',
    );
  }
  $items['admin/content/antispam/statistics'] = array(
    'title' => 'Statistics',
    'page callback' => 'antispam_callback_queue',
    'page arguments' => array(
      'statistics',
    ),
    'access callback' => '_antispam_is_moderator',
    'access arguments' => array(
      $moderator_types,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 3,
    'file' => 'antispam.admin.inc',
  );
  $item = array(
    'title' => 'switch content status',
    'page callback' => 'antispam_page',
    'page arguments' => array(
      0,
      1,
      2,
      3,
    ),
    'load arguments' => array(
      '%map',
      '%index',
    ),
    'access callback' => 'antispam_access_callback',
    'access arguments' => array(
      0,
      1,
      2,
      3,
    ),
  );
  foreach (array(
    'publish',
    'unpublish',
    'submit-spam',
    'submit-ham',
  ) as $op) {
    $items['antispam/%antispam/%/' . $op] = $item;
  }
  return $items;
}