You are here

function eu_cookie_compliance_admin_form_validate in EU Cookie Compliance (GDPR Compliance) 5

Same name and namespace in other branches
  1. 6 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form_validate()
  2. 7.2 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form_validate()
  3. 7 eu_cookie_compliance.admin.inc \eu_cookie_compliance_admin_form_validate()

Validates form for cookie controll popup.

File

./eu_cookie_compliance.module, line 135
This module intends to deal with the EU Directive on Privacy and Electronic Communications that comes into effect in the UK on 26th May 2012.

Code

function eu_cookie_compliance_admin_form_validate($form, &$form_state) {
  global $locale;
  $ln = $locale;
  if (!preg_match('/^[1-9][0-9]{0,4}$/', $form_state['eu_cookie_compliance_' . $ln]['popup_height']) && !empty($form_state['eu_cookie_compliance_' . $ln]['popup_height'])) {
    form_set_error('eu_cookie_compliance_popup_height', t('Height must be an integer value .'));
  }
  if (!preg_match('/^[1-9][0-9]{0,4}$/', $form_state['eu_cookie_compliance_' . $ln]['popup_delay'])) {
    form_set_error('eu_cookie_compliance_popup_delay', t('Delay must be an integer value.'));
  }
  if (!preg_match('/^[1-9][0-9]{0,4}\\%?$/', $form_state['eu_cookie_compliance_' . $ln]['popup_width'])) {
    form_set_error('eu_cookie_compliance_popup_width', t('Width must be an integer or a percentage value.'));
  }
}