You are here

function ultimate_cron_function_settings_form_validate in Ultimate Cron 7

Same name and namespace in other branches
  1. 8 ultimate_cron.admin.inc \ultimate_cron_function_settings_form_validate()
  2. 6 ultimate_cron.admin.inc \ultimate_cron_function_settings_form_validate()

Validate handler for function settings.

File

./ultimate_cron.admin.inc, line 246

Code

function ultimate_cron_function_settings_form_validate($form, &$form_state) {
  $conf =& $form_state['values']['general'];
  $conf['rules'] = trim($conf['rules']);
  $conf['rules'] = $conf['rules'] ? explode(';', $conf['rules']) : array();
  if ($conf['rules']) {
    foreach ($conf['rules'] as &$rule) {
      $rule = trim($rule);
      if (!ultimate_cron_validate_rule($rule)) {
        form_set_error('rules', t('Invalid rule.'));
      }
    }
  }
  else {
    unset($conf['rules']);
  }
}