function update_status_settings_validate in Update Status 5.2
Validates the update_status settings form.
Ensures that the email addresses are valid and properly formatted.
File
- ./
update_status.module, line 339
Code
function update_status_settings_validate($form_id, $form_values) {
if (!empty($form_values['notify_emails'])) {
$invalid = array();
foreach (explode("\n", trim($form_values['notify_emails'])) as $email) {
$email = trim($email);
if (!empty($email)) {
if (!valid_email_address($email)) {
$invalid[] = $email;
}
}
}
if (!empty($invalid)) {
if (count($invalid) == 1) {
form_set_error('notify_emails', t('%email is not a valid e-mail address.', array(
'%email' => reset($invalid),
)));
}
else {
form_set_error('notify_emails', t('%emails are not valid e-mail addresses.', array(
'%emails' => implode(', ', $invalid),
)));
}
}
}
}