function format_phone_number in Phone 5
Same name and namespace in other branches
- 6 phone.module \format_phone_number()
- 7 phone.module \format_phone_number()
Verification for Phone Numbers.
Parameters
string $countrycode:
string $phonenumber:
Return value
boolean Returns boolean FALSE if the phone number is not valid.
1 call to format_phone_number()
- phone_widget in ./
phone.module - Implementation of hook_widget().
File
- ./
phone.module, line 275 - Defines phone number fields for CCK. Provide some verifications on the phone numbers
Code
function format_phone_number($countrycode, $phonenumber, $field) {
$countrycode = trim($countrycode);
$phonenumber = trim($phonenumber);
if ($countrycode == 'fr' || $countrycode == 'it' || $countrycode == 'ca' || $countrycode == 'uk' || $countrycode == 'ru') {
//drupal_set_message('langue = ' . $countrycode, 'error');
$format_phone_function = 'format_' . $countrycode . '_phone_number';
include_once './' . drupal_get_path('module', 'phone') . '/phone.' . $countrycode . '.inc';
if (function_exists($format_phone_function)) {
return $format_phone_function($phonenumber, $field);
}
else {
return false;
}
}
else {
//Country not taken into account yet
return false;
}
}