function shurly_validate_custom in ShURLy 7
Same name and namespace in other branches
- 8 shurly.module \shurly_validate_custom()
- 6 shurly.module \shurly_validate_custom()
Validate custom short URL string
Return value
TRUE if valid, FALSE if invalid
3 calls to shurly_validate_custom()
- shurly_boot in ./
shurly.module - Implements hook_boot().
- shurly_create_form_validate in ./
shurly.module - Validation of the main form
- shurly_shorten in ./
shurly.module - API function to shorten a URL @arg $long_url - the long URL to shorten @arg $custom - optional custom short URL
File
- ./
shurly.module, line 840 - description http://www.youtube.com/watch?v=Qo7qoonzTCE
Code
function shurly_validate_custom($custom) {
// check the length of the string
if (strlen($custom) == 0) {
return FALSE;
}
// disallow: #%&@*{}\:;<>?/+.,'"$|`^[] and space character
return preg_match('/[\\/#%&\\@\\*\\{\\}\\:\\;<>\\?\\+ \\.\\,\'\\"\\$\\|`^\\[\\]]/u', $custom) ? FALSE : TRUE;
}