You are here

function hu_validate_number in Phone Number 7

Verifies that $number is a valid nine digit Hungarian phone number.

Parameters

$number: Digits only value.

$ext: Digits only value.

$error: The error message to shown to user. Available parameters to use in the error message are

  • "%countrycode": the alpha-2 CC
  • "%phone_input": the original number input by user (could be invalid)
  • "%max_length": allowed maximum length of the phone number

Return value

boolean TRUE if it is a valid phone number for that country, FALSE otherwise.

File

includes/phone.hu.inc, line 85
CCK Field for Hungarian phone numbers.

Code

function hu_validate_number($number, $ext = '', &$error) {

  // Don't need to check for extension because it has been checked by generic validation as all digits, unless has special format/requirements
  // We don't want to worry about separators
  $number = cck_phone_clean_number($number);
  $result = hu_parts($number);
  if (isset($result['error'])) {

    // t() is no needed
    $error = $result['error'];
    return FALSE;
  }
  return true;
}