You are here

function spamicide_menu in Spamicide 5

Same name and namespace in other branches
  1. 6 spamicide.module \spamicide_menu()
  2. 7 spamicide.module \spamicide_menu()

@file This module provides yet another tool to eliminate spam.

Related topics

File

./spamicide.module, line 20
This module provides yet another tool to eliminate spam.

Code

function spamicide_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/spamicide',
      'title' => t('Spamicide'),
      'description' => t('Administer how and where Spamicide is used.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spamicide_admin_form',
      ),
      'access' => user_access('administer spamicide'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {

    // Some non cachable menu items for disabling/deleting Spamicide forms
    // start with arg(3) == 'spamicide' for faster short circuit
    if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'spamicide' && arg(3) == 'spamicide_form' && arg(4) == 'delete' && !is_null(arg(5))) {
      $items[] = array(
        'path' => 'admin/settings/spamicide/spamicide_form/delete/' . arg(5),
        'title' => t('Delete'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'spamicide_delete_confirm',
          arg(5),
          TRUE,
        ),
        'type' => MENU_CALLBACK,
      );
    }
    if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'spamicide' && arg(3) == 'spamicide_form' && arg(4) == 'add' && !is_null(arg(5))) {
      $items[] = array(
        'path' => 'admin/settings/spamicide/spamicide_form/add/' . arg(5),
        'title' => t('Add Spamicide to ' . arg(5)),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'spamicide_admin_add_form_id',
          arg(5),
          TRUE,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}