function javascript_libraries_valid_external_url in JavaScript Libraries Manager 8
Same name and namespace in other branches
- 7 javascript_libraries.module \javascript_libraries_valid_external_url()
Helper function that validates the external url.
Parameters
$url:
Return value
bool
1 call to javascript_libraries_valid_external_url()
- JavascriptLibrariesCustomAddForm::validateForm in src/
Form/ JavascriptLibrariesCustomAddForm.php - Form validation handler.
File
- ./
javascript_libraries.module, line 15 - Toggle the inclusion of Drupal system libraries. Upload and reference custom libraries as well.
Code
function javascript_libraries_valid_external_url($url) {
$parts = parse_url($url);
return $parts && ($parts['scheme'] == 'http' || $parts['scheme'] == 'https') && $parts['host'] && preg_match('@/.+\\.(js|txt)$@i', $parts['path']);
}