You are here

function textimage_menu in Textimage 5

Same name and namespace in other branches
  1. 5.2 textimage.module \textimage_menu()
  2. 6.2 textimage.module \textimage_menu()
  3. 7.3 textimage.module \textimage_menu()
  4. 7.2 textimage.module \textimage_menu()

Implementation of hook_menu().

File

./textimage.module, line 78

Code

function textimage_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => file_directory_path() . '/textimage',
      'callback' => 'textimage_image',
      'access' => true,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage',
      'title' => t('Text Image'),
      'description' => t('Configure text to image preset functions.') . (module_exists('captcha') ? ' ' . t('Set the options for image based captchas.') : ''),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_settings_form',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/settings',
      'title' => t('Settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_settings_form',
      ),
      'access' => user_access('administer site configuration'),
      'weight' => 0,
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/list',
      'title' => t('List presets'),
      'callback' => 'textimage_preset_list',
      'access' => user_access('administer site configuration'),
      'weight' => 1,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/new',
      'title' => t('New preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_edit',
        'new',
      ),
      'access' => user_access('administer site configuration'),
      'weight' => 2,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/preset',
      'title' => t('Edit Preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_edit',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    if (module_exists('captcha')) {
      $items[] = array(
        'path' => 'admin/settings/textimage/captcha',
        'title' => t('Captcha display'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'textimage_captcha_settings_form',
        ),
        'access' => user_access('administer site configuration'),
        'weight' => 5,
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  else {
    $suffix = arg(2) != null ? '/' . arg(2) : '';
    $items[] = array(
      'path' => '_textimage/image' . $suffix,
      'title' => t('textimage'),
      'callback' => '_textimage_captcha_image',
      'access' => user_access('access textimages'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/preset/' . arg(4) . '/delete',
      'title' => t('Edit Preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_delete_confirm',
        arg(4),
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/textimage/preset/' . arg(4) . '/flush',
      'title' => t('Flush Preset Cache'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_flush_confirm',
        arg(4),
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}