You are here

function statistics_menu in Drupal 5

Same name and namespace in other branches
  1. 4 modules/statistics.module \statistics_menu()
  2. 6 modules/statistics/statistics.module \statistics_menu()
  3. 7 modules/statistics/statistics.module \statistics_menu()

Implementation of hook_menu().

File

modules/statistics/statistics.module, line 101
Logs access statistics for your site.

Code

function statistics_menu($may_cache) {
  $items = array();
  $access = user_access('access statistics');
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/logs/hits',
      'title' => t('Recent hits'),
      'description' => t('View pages that have recently been visited.'),
      'callback' => 'statistics_recent_hits',
      'access' => $access,
    );
    $items[] = array(
      'path' => 'admin/logs/pages',
      'title' => t('Top pages'),
      'description' => t('View pages that have been hit frequently.'),
      'callback' => 'statistics_top_pages',
      'access' => $access,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/logs/visitors',
      'title' => t('Top visitors'),
      'description' => t('View visitors that hit many pages.'),
      'callback' => 'statistics_top_visitors',
      'access' => $access,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/logs/referrers',
      'title' => t('Top referrers'),
      'description' => t('View top referrers.'),
      'callback' => 'statistics_top_referrers',
      'access' => $access,
    );
    $items[] = array(
      'path' => 'admin/logs/access',
      'title' => t('Details'),
      'description' => t('View access log.'),
      'callback' => 'statistics_access_log',
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/logs/settings',
      'title' => t('Access log settings'),
      'description' => t('Control details about what and how your site logs.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'statistics_access_logging_settings',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
      'weight' => 3,
    );
  }
  else {
    if (arg(0) == 'user' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) {
      $items[] = array(
        'path' => 'user/' . arg(1) . '/track/navigation',
        'title' => t('Track page visits'),
        'callback' => 'statistics_user_tracker',
        'access' => $access,
        'type' => MENU_LOCAL_TASK,
        'weight' => 2,
      );
    }
    if (arg(0) == 'node' && is_numeric(arg(1)) && variable_get('statistics_enable_access_log', 0)) {
      $items[] = array(
        'path' => 'node/' . arg(1) . '/track',
        'title' => t('Track'),
        'callback' => 'statistics_node_tracker',
        'access' => $access,
        'type' => MENU_LOCAL_TASK,
        'weight' => 2,
      );
    }
  }
  return $items;
}