function sms_formatter in SMS Framework 6.2
Same name and namespace in other branches
- 5 sms.module \sms_formatter()
- 7 sms.module \sms_formatter()
Converts various sms formats into a common format for use in this module.
Parameters
$number: The sms number
$format: Undefined - @todo: decide if this is needed.
4 calls to sms_formatter()
- sms_sendtophone_form_validate in modules/
sms_sendtophone/ sms_sendtophone.module - sms_send_form_submit in ./
sms.module - Form submission handler for sms_send_form().
- sms_send_form_validate in ./
sms.module - Form validation handler for sms_send_form().
- sms_user_send_confirmation in modules/
sms_user/ sms_user.module
File
- ./
sms.module, line 574 - The core of the SMS Framework. Provides gateway managment and API for sending and receiving SMS messages.
Code
function sms_formatter($number, $format = 1) {
// Remove non-number characters
$number = preg_replace("/[^0-9]/", '', $number);
/*
@todo - the only length specification in the international numbering plan is that
numbers should be a maximum of 15 digits.
http://en.wikipedia.org/wiki/E.164
if (strlen($number) > 16) {
if ($number[0] == 1) {
$number = ltrim($number, 1);
}
else {
return FALSE;
}
}
elseif (strlen($number) < 10) {
return FALSE;
}
*/
return $number;
}