You are here

function radioactivity_http_menu in Radioactivity 5

File

plugins/radioactivity_http.module, line 25

Code

function radioactivity_http_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/radioactivity/http_ports',
      'title' => t('HTTP ports'),
      'description' => t('Configure HTTP ports for external access.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'radioactivity_http_ports_list',
      ),
      'access' => user_access(RADIOACTIVITY_PERM_ADMIN),
      'weight' => 30,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/radioactivity/http_port',
      'title' => t('HTTP port editor'),
      'description' => t('Configure HTTP port for external access.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'radioactivity_http_port_edit',
      ),
      'access' => user_access(RADIOACTIVITY_PERM_ADMIN),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/radioactivity/http_port_delete',
      'title' => t('Delete HTTP port'),
      'description' => t('Delete HTTP port for external access.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'radioactivity_http_port_delete',
      ),
      'access' => user_access(RADIOACTIVITY_PERM_ADMIN),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    foreach (_radioactivity_http_get_ports() as $id => $port) {
      $items[] = array(
        'path' => $port['path'],
        'type' => MENU_CALLBACK,
        'callback' => 'radioactivity_http_cb',
        'callback arguments' => array(
          $id,
        ),
        'access' => TRUE,
      );
    }
  }
  return $items;
}