You are here

function adsense_ad_formats in Google AdSense integration 5

Same name and namespace in other branches
  1. 5.3 adsense.module \adsense_ad_formats()
  2. 5.2 adsense.module \adsense_ad_formats()
  3. 6 adsense.module \adsense_ad_formats()
  4. 7 adsense.module \adsense_ad_formats()

This is the array that holds all ad formats. All it has is a multi-dimensional array containing the dimensions as a key, then the description and suffix of Google's javascript ad code. Currently, we do not support duplicate dimensions in ad formats (for example, the same ad dimension cannot repeat for text and graphics, or for ads and ad links

To add a new code:

  • Make sure the dimensions are not in use by a different format
  • Go to Google AdSense . Get the dimensions . Get the code (suffix after the dimensions)
  • Add it below in ascending order (width first, then height)

Return value

returns an array of supported ad formats (desc: description, code: Google Ad code suffix)

5 calls to adsense_ad_formats()
adsense_admin_settings in ./adsense.module
adsense_block in ./adsense.module
Implementation of hook_block().
adsense_get_ad_code in ./adsense.module
_adsense_can_insert_another in ./adsense.module
Determine if AdSense has reached limit on this page. As per Google's policies, a page can have up to 3 ad units and 3 link units.
_adsense_validate_dimensions in ./adsense.module

File

./adsense.module, line 20

Code

function adsense_ad_formats() {
  return array(
    '120x90' => array(
      'type' => ADSENSE_TYPE_LINK,
      'desc' => t('Ad links 4-links 120x90'),
      'code' => '_0ads_al',
    ),
    '120x240' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Vertical banner'),
      'code' => '_as',
    ),
    '120x600' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Skyscraper'),
      'code' => '_as',
    ),
    '125x125' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Button'),
      'code' => '_as',
    ),
    '160x90' => array(
      'type' => ADSENSE_TYPE_LINK,
      'desc' => t('Ad links 4-links 160x90'),
      'code' => '_0ads_al',
    ),
    '160x600' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Wide skyscraper'),
      'code' => '_as',
    ),
    '180x90' => array(
      'type' => ADSENSE_TYPE_LINK,
      'desc' => t('Ad links 4-links 180x90'),
      'code' => '_0ads_al',
    ),
    '180x150' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Small rectangle'),
      'code' => '_as',
    ),
    '200x200' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Small square'),
      'code' => '_as',
    ),
    '234x60' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Half banner'),
      'code' => '_as',
    ),
    '250x250' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Square'),
      'code' => '_as',
    ),
    '300x250' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Medium rectangle'),
      'code' => '_as',
    ),
    '336x280' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Large rectangle'),
      'code' => '_as',
    ),
    '468x15' => array(
      'type' => ADSENSE_TYPE_LINK,
      'desc' => t('Banner ad links 4-links'),
      'code' => '_0ads_al',
    ),
    '468x60' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Banner'),
      'code' => '_as',
    ),
    '728x15' => array(
      'type' => ADSENSE_TYPE_LINK,
      'desc' => t('Wide banner ad links 4-links'),
      'code' => '_0ads_al',
    ),
    '728x90' => array(
      'type' => ADSENSE_TYPE_AD,
      'desc' => t('Leaderboard'),
      'code' => '_as',
    ),
    ADSENSE_SEARCH_BOX => array(
      'type' => ADSENSE_TYPE_SEARCH,
      'desc' => t('AdSense for Search'),
      'code' => '',
    ),
  );
}