You are here

function adsense_revenue_sharing_basic_adsense in Google AdSense integration 8

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.

string $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

array|string 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

File

oldcode/revenue_sharing_basic/adsense_revenue_sharing_basic.module, line 39
Main file of the adsense_revenue_sharing_basic module.

Code

function adsense_revenue_sharing_basic_adsense($op, $args = '') {
  static $client_id = NULL;
  switch ($op) {
    case 'settings':
      return [
        '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 = adsense_revenue_sharing_basic_choose_client($args);
      }
      return $client_id;
  }
  return '';
}