You are here

function adsense_menu in Google AdSense integration 5

Same name and namespace in other branches
  1. 5.3 adsense.module \adsense_menu()
  2. 5.2 adsense.module \adsense_menu()
  3. 6 adsense.module \adsense_menu()
  4. 7 adsense.module \adsense_menu()

Implementation of hook_menu().

File

./adsense.module, line 126

Code

function adsense_menu($may_cache) {
  $items = array();
  $access = user_access('view clicks');
  if ($may_cache) {
    if (variable_get(ADSENSE_CLICK_TRACKING, 0)) {
      $items[] = array(
        'path' => 'admin/logs/adsense',
        'title' => t('AdSense clicks'),
        'description' => t('Track AdSense clicks.'),
        'callback' => 'adsense_click_log',
        'type' => MENU_NORMAL_ITEM,
        'access' => $access,
      );
      $items[] = array(
        'path' => 'admin/logs/adsense/top_pages',
        'title' => t('Top pages'),
        'callback' => 'adsense_click_top_pages',
        'type' => MENU_NORMAL_ITEM,
        'access' => $access,
      );
      $items[] = array(
        'path' => 'admin/logs/adsense/by_day',
        'title' => t('By day'),
        'callback' => 'adsense_click_by_day',
        'type' => MENU_NORMAL_ITEM,
        'access' => $access,
      );
    }
    $items[] = array(
      'path' => 'admin/settings/adsense',
      'title' => t('Google AdSense'),
      'description' => t('Configure Google AdSense.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'adsense_admin_settings',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    $items[] = array(
      'path' => 'adsense/counter',
      'callback' => 'adsense_counter',
      'access' => true,
      'type' => MENU_CALLBACK,
    );
  }
  $items[] = array(
    'path' => ADSENSE_SEARCH_PATH,
    'callback' => 'adsense_search',
    'access' => user_access('access adsense search result page'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}