You are here

function statistics_menu in Drupal 4

Same name and namespace in other branches
  1. 5 modules/statistics/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.module, line 111
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'),
      'callback' => 'statistics_recent_hits',
      'access' => $access,
      'weight' => 3,
    );
    $items[] = array(
      'path' => 'admin/logs/pages',
      'title' => t('top pages'),
      'callback' => 'statistics_top_pages',
      'access' => $access,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/logs/visitors',
      'title' => t('top visitors'),
      'callback' => 'statistics_top_visitors',
      'access' => $access,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/logs/referrers',
      'title' => t('referrers'),
      'callback' => 'statistics_top_referrers',
      'access' => $access,
    );
    $items[] = array(
      'path' => 'admin/logs/access',
      'title' => t('details'),
      'callback' => 'statistics_access_log',
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
  }
  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;
}