You are here

function revenue_sharing_basic_adsense in Google AdSense integration 7

Same name and namespace in other branches
  1. 5.3 old/revenue_sharing_basic/revenue_sharing_basic.module \revenue_sharing_basic_adsense()
  2. 5.2 revenue_sharing_basic.module \revenue_sharing_basic_adsense()
  3. 6 old/revenue_sharing_basic/revenue_sharing_basic.module \revenue_sharing_basic_adsense()

Interface of the Publisher ID modules.

This is the function that handles the calls by the adsense core to the Publisher ID modules.

Parameters

string $op: Operation being performed, can be one of the following: 'settings' : access to this module's settings form 'client_id': fetch the user's Publisher ID.

array $args: For the 'client_id' operation, this can be the format of the ad being generated, in case there is a need to return a user-configured Slot ID.

Return value

mixed This depends on the operation being performed: 'settings': return array with two fields, the name field contains the name of this module, and the desc field a description. 'client_id' : this can be a string with the publisher ID, when the $args parameter wasn't defined, or an array with two fields, the 'slot' field for the Slot ID and the 'client' field for the Publisher ID

1 string reference to 'revenue_sharing_basic_adsense'
revenue_sharing_basic_requirements in old/revenue_sharing_basic/revenue_sharing_basic.install
Implements hook_requirements().

File

old/revenue_sharing_basic/revenue_sharing_basic.module, line 67
Main file of the revenue_sharing_basic module.

Code

function revenue_sharing_basic_adsense($op, $args = array()) {
  static $client_id = NULL;
  switch ($op) {
    case 'settings':
      return array(
        'name' => 'Revenue sharing',
        'desc' => 'DOES NOT WORK with new code ad units, such as "Managed Ads" or "Custom Search".',
      );
    case 'client_id':
      if (!$client_id) {

        // We cache the client ID on this page load, to make sure all of the
        // client IDs on one page are the same.
        $client_id = revenue_sharing_basic_choose_client($args);
      }
      return $client_id;
  }
  return '';
}