You are here

function adsense_get_client_slot_id in Google AdSense integration 6

Same name and namespace in other branches
  1. 5.3 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

string $format: Format of the ad being generated (optional).

Return value

mixed 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 327
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);
}