You are here

function _adsense_check_if_enabled in Google AdSense integration 5.3

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

Helper function to verify if ads are currently enabled

Return value

TRUE if ad display is enabled, FALSE otherwise

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

File

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

Code

function _adsense_check_if_enabled() {
  if (!variable_get('adsense_basic_id', ADSENSE_BASIC_ID_DEFAULT)) {

    // Google AdSense Publisher ID is not configured
    return FALSE;
  }
  if (variable_get('adsense_disable', ADSENSE_DISABLE_DEFAULT)) {
    return FALSE;
  }
  if (variable_get('adsense_test_mode', ADSENSE_TEST_MODE_DEFAULT)) {
    return TRUE;
  }
  if (variable_get('adsense_secret_adtest', ADSENSE_SECRET_ADTEST_DEFAULT)) {
    return TRUE;
  }
  if (user_access('hide adsense')) {
    return FALSE;
  }
  return TRUE;
}