You are here

function _adsense_id_settings_validate in Google AdSense integration 6

Same name and namespace in other branches
  1. 5.3 adsense.admin.inc \_adsense_id_settings_validate()
  2. 7 adsense.admin.inc \_adsense_id_settings_validate()

Validate adsense_id_settings form.

1 string reference to '_adsense_id_settings_validate'
adsense_id_settings in ./adsense.admin.inc
Menu callback for the adsense publisher ID settings form.

File

./adsense.admin.inc, line 189
Contains the administrative functions of the adsense module.

Code

function _adsense_id_settings_validate($form, &$form_state) {

  // Trim remaining whitespace.
  $form_state['values']['adsense_basic_id'] = trim($form_state['values']['adsense_basic_id']);

  // Verify it's a valid Adsense publisher ID.
  if (!preg_match('/^pub-[0-9]+$/', $form_state['values']['adsense_basic_id'])) {
    form_set_error('adsense_basic_id', t('A valid Google AdSense Publisher ID is case sensitive and formatted like %id.', array(
      '%id' => 'pub-9999999999999',
    )));
  }
}