You are here

function adsense_get_client_slot_id in Google AdSense integration 5.3

Same name and namespace in other branches
  1. 6 adsense.module \adsense_get_client_slot_id()
  2. 7 adsense.module \adsense_get_client_slot_id()

Provides the Google AdSense Publisher ID / slot ID to be used in the ad

If revenue sharing modules are installed, this function will call the appropriate function in those modules.

Parameters

$format: format of the ad being generated (optional)

Return value

If the format parameter is supplied, array with 'client' and 'slot' fields, otherwise just the Publisher ID string is returned

1 call to adsense_get_client_slot_id()
adsense_display in ./adsense.module
Generates the Google AdSense Ad

File

./adsense.module, line 302
Displays Google AdSense ads on Drupal pages

Code

function adsense_get_client_slot_id($format = NULL) {

  // Get the configured function
  $function = variable_get('adsense_id_module', ADSENSE_ID_MODULE_DEFAULT);
  if ($function != ADSENSE_ID_MODULE_DEFAULT) {

    // Call the function
    if (function_exists($function)) {
      $client_id = $function('client_id', $format);
      if ($client_id) {
        return $client_id;
      }
    }
  }
  return variable_get('adsense_basic_id', ADSENSE_BASIC_ID_DEFAULT);
}