function _youtube_validate_jsapi_domain in Media: YouTube 7.2
Same name and namespace in other branches
- 7.3 includes/media_youtube.formatters.inc \_youtube_validate_jsapi_domain()
Validation for Js API Origin.
1 string reference to '_youtube_validate_jsapi_domain'
- media_youtube_file_formatter_video_settings in includes/
media_youtube.formatters.inc - Implements hook_file_formatter_FORMATTER_settings().
File
- includes/
media_youtube.formatters.inc, line 229 - File formatters for YouTube videos.
Code
function _youtube_validate_jsapi_domain($element, &$form_state, $form) {
// Check if the value is a url with http/s and no trailing directories.
if (!empty($element['#value']) && !preg_match('/^https?\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}){1,2}$/', $element['#value'])) {
form_error($element, t('Please insert a valid domain in the format http://www.yourdomain.com'));
}
}