function imageblock_admin_settings_form_validate in Image Block 7
Same name and namespace in other branches
- 6 imageblock.admin.inc \imageblock_admin_settings_form_validate()
File
- ./
imageblock.admin.inc, line 28
Code
function imageblock_admin_settings_form_validate($form, &$form_state) {
$values = $form_state['values'];
foreach (array(
'imageblock_max_file_size',
) as $size) {
if (!empty($values[$size]) && !is_numeric(parse_size($values[$size]))) {
form_error($size, t('The "@field" option must contain a valid value. You can either leave the text field empty or enter a string like "512" (bytes), "80K" (kilobytes) or "50M" (megabytes).', array(
'@field' => t('Maximum upload size per file'),
)));
}
}
foreach (array(
'imageblock_max_dimensions',
) as $resolution) {
if (!empty($values[$resolution]) && !preg_match('/^[0-9]+x[0-9]+$/', $values[$resolution])) {
form_set_error($resolution, t('Please specify a resolution in the format WIDTHxHEIGHT (e.g. 640x480).'));
}
}
}