You are here

function prod_check_prod_mode_form_validate in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 includes/prod_check.admin.inc \prod_check_prod_mode_form_validate()

Setup site for production mode: validation.

File

includes/prod_check.admin.inc, line 611

Code

function prod_check_prod_mode_form_validate($form, &$form_state) {
  $checks = array(
    'site_mail',
    'webform_default_from_address',
  );
  foreach ($checks as $field) {
    if (!empty($form_state['values'][$field])) {
      if (!valid_email_address($form_state['values'][$field])) {
        form_set_error($field, t('The e-mail address %mail is not valid.', array(
          '%mail' => $form_state['values'][$field],
        )));
      }
    }
  }

  // Google analytics.
  if (!empty($form_state['values']['googleanalytics_account'])) {
    if (!preg_match('/^UA-\\d{4,}-\\d+$/', $form_state['values']['googleanalytics_account'])) {
      form_set_error('googleanalytics_account', t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.'));
    }
  }
}