You are here

function adsense_click_menu in Google AdSense integration 5.3

Same name and namespace in other branches
  1. 6 contrib/adsense_click/adsense_click.module \adsense_click_menu()
  2. 7 contrib/adsense_click/adsense_click.module \adsense_click_menu()

Implementation of hook_menu().

File

contrib/adsense_click/adsense_click.module, line 18
Enables Drupal to track and log the clicks on AdSense ads.

Code

function adsense_click_menu($may_cache) {
  $items = array();
  require_once drupal_get_path('module', 'adsense_click') . '/adsense_click.admin.inc';
  require_once drupal_get_path('module', 'adsense_click') . '/adsense_click.logs.inc';
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/adsense/click',
      'title' => t('Clicks'),
      'description' => t('Track the clicks on Adsense ads.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'adsense_click_admin_settings',
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('administer site configuration'),
      'weight' => 9,
    );
    $items[] = array(
      'path' => 'admin/logs/adsense',
      'title' => t('AdSense clicks'),
      'description' => t('Track AdSense clicks.'),
      'callback' => 'adsense_click_log',
      'type' => MENU_NORMAL_ITEM,
      'access' => user_access('view clicks'),
    );
    $items[] = array(
      'path' => 'admin/logs/adsense/top_pages',
      'title' => t('Top pages'),
      'callback' => 'adsense_click_top_pages',
      'type' => MENU_NORMAL_ITEM,
      'access' => user_access('view clicks'),
    );
    $items[] = array(
      'path' => 'admin/logs/adsense/by_day',
      'title' => t('By day'),
      'callback' => 'adsense_click_by_day',
      'type' => MENU_NORMAL_ITEM,
      'access' => user_access('view clicks'),
    );
  }
  else {
    if (variable_get('adsense_click_tracking', ADSENSE_CLICK_TRACKING_DEFAULT)) {
      drupal_add_js(drupal_get_path('module', 'adsense_click') . '/adsense_click.js');
    }
    $items[] = array(
      'path' => 'adsense_click',
      'callback' => 'adsense_click_register',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}