You are here

function sms_formatter in SMS Framework 5

Same name and namespace in other branches
  1. 6.2 sms.module \sms_formatter()
  2. 7 sms.module \sms_formatter()
4 calls to sms_formatter()
sms_send_form_submit in ./sms.module
Performs a simple send on submit.
sms_send_form_validate in ./sms.module
sms_user_send_confirmation in modules/sms_user/sms_user.module
sms_validate_number in ./sms.module

File

./sms.module, line 295
The core of the SMS Framework. Provides gateway managment and API for sending and receiving SMS messages.

Code

function sms_formatter($number) {

  // Remove non-number characters
  $number = preg_replace("/[^0-9]/", '', $number);
  if (strlen($number) > 16) {
    if ($number[0] == 1) {
      $number = ltrim($number, 1);
    }
    else {
      return FALSE;
    }
  }
  elseif (strlen($number) < 10) {
    return FALSE;
  }
  return $number;
}