You are here

function sms_formatter in SMS Framework 7

Same name and namespace in other branches
  1. 5 sms.module \sms_formatter()
  2. 6.2 sms.module \sms_formatter()

Converts various sms formats into a common format for use in this module.

@todo Decide if the $format parameter is needed.

Parameters

string $number: The sms number to be formatted.

int $format: Undefined.

Return value

string The formatted number.

4 calls to sms_formatter()
sms_sendtophone_form_validate in modules/sms_sendtophone/sms_sendtophone.module
Validate handler for sms_sendtophone_form().
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
Sends confirmation code to user for number verification.

File

./sms.module, line 665
The core of the SMS Framework. Provides gateway management 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;
}