function video_validate_preset_name in Video 7
Same name and namespace in other branches
- 7.2 modules/video_ui/video.preset.inc \video_validate_preset_name()
Verify the syntax of the given prefix name.
Borrowed from the user.module. :)
2 calls to video_validate_preset_name()
- video_preset_import_validate in modules/
video_ui/ video.preset.inc - Validation for the preset import form.
- _video_preset_name_validate in modules/
video_ui/ video.preset.inc - Validation for the preset form.
File
- modules/
video_ui/ video.preset.inc, line 758
Code
function video_validate_preset_name($name) {
if (!$name) {
return t('You must enter a preset.');
}
if (video_preset_name_exists($name)) {
return t('The preset name %name is already taken.', array(
'%name' => $name,
));
}
if (strpos($name, ' ') !== FALSE) {
return t('The preset name cannot contain a space.');
}
if (is_numeric($name[0])) {
return t('The preset name cannot begin with a number.');
}
if (preg_match('/[^a-z0-9_]/i', $name)) {
return t('The preset name contains an illegal character.');
}
if (drupal_strlen($name) > VIDEO_PRESET_MAX_LENGTH) {
return t('The preset name %name is too long: it must be %max characters or less.', array(
'%name' => $name,
'%max' => VIDEO_PRESET_MAX_LENGTH,
));
}
}