function cck_phone_validate_number in Phone Number 7
Same name and namespace in other branches
- 6 cck_phone.module \cck_phone_validate_number()
Generic validation for Phone Number.
Parameters
string $countrycode:
string $number:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
3 calls to cck_phone_validate_number()
- cck_phone_phone_number_validate in ./
cck_phone.module - An #element_validate callback for the phone_number element.
- _cck_phone_process in ./
cck_phone.module - _cck_phone_validate in ./
cck_phone.module
File
- ./
cck_phone.module, line 927 - Defines phone number fields for CCK. Provide some verifications on the phone numbers
Code
function cck_phone_validate_number($countrycode, $number, $ext = '') {
// We don't want to worry about separators
$number = cck_phone_clean_number($number);
if ($number !== '' && drupal_strlen($number) > CCK_PHONE_PHONE_MAX_LENGTH) {
return FALSE;
}
$ext = cck_phone_clean_number($ext);
if ($ext !== '' && drupal_strlen($ext) > CCK_PHONE_EXTENSION_MAX_LENGTH) {
return FALSE;
}
return TRUE;
}