You are here

function _my_phone_rules in Phone Number 6

Same name and namespace in other branches
  1. 7 includes/phone.my.inc \_my_phone_rules()

@file CCK Field for Malaysia phone numbers.

3 calls to _my_phone_rules()
my_formatter_default in includes/phone.my.inc
Default formatter for international phone number.
my_formatter_local in includes/phone.my.inc
Local formatter for local phone number.
my_validate_number in includes/phone.my.inc
Verifies that $number is a valid Malaysia phone number.

File

includes/phone.my.inc, line 8
CCK Field for Malaysia phone numbers.

Code

function _my_phone_rules() {
  $rules = array();

  // rule: 'area code, min length, max length'
  // Geographic land line number
  $rules[] = array(
    "2",
    7,
  );

  // Domestic access code to Singapore
  $rules[] = array(
    "3",
    8,
  );

  // Selangor & Federal Territories of Kuala Lumpur & Putrajaya
  $rules[] = array(
    "4",
    7,
  );

  // Kedah, Penang & Perlis
  $rules[] = array(
    "5",
    7,
  );

  // Perak & Cameron Highlands (Pahang)
  $rules[] = array(
    "6",
    7,
  );

  // Melaka, Negeri Sembilan & Muar (Johor)
  $rules[] = array(
    "7",
    7,
  );

  // Johor (except Muar)
  $rules[] = array(
    "80",
    6,
  );

  // Domestic access code to Brunei (East Malaysia only)
  //  $rules[] = array("81", 6);    // reserved
  $rules[] = array(
    "82",
    6,
  );

  // Kuching (Sarawak)
  $rules[] = array(
    "83",
    6,
  );

  // Sri Aman (Sarawak)
  $rules[] = array(
    "84",
    6,
  );

  // Sarikei, Bintangor, Sibu, Kanowit, Song, & Kapit (Sarawak)
  $rules[] = array(
    "85",
    6,
  );

  // Lawas, Limbang, Miri (Sarawak)
  $rules[] = array(
    "86",
    6,
  );

  // Bintulu, Belaga (Sarawak)
  $rules[] = array(
    "87",
    6,
  );

  // Inner District (Sabah) & Federal Territory of Labuan
  $rules[] = array(
    "88",
    6,
  );

  // Kota Kinabalu, Kudat (Sabah)
  $rules[] = array(
    "89",
    6,
  );

  // Lahad Datu, Sandakan, Tawau (Sabah)
  $rules[] = array(
    "9",
    7,
  );

  // Kelantan, Pahang (except Cameron Highlands) & Terengganu
  // Mobile number structure
  $rules[] = array(
    "10",
    7,
  );
  $rules[] = array(
    "11",
    7,
  );
  $rules[] = array(
    "12",
    7,
  );
  $rules[] = array(
    "13",
    7,
  );
  $rules[] = array(
    "14",
    7,
  );
  $rules[] = array(
    "15",
    7,
  );
  $rules[] = array(
    "16",
    7,
  );
  $rules[] = array(
    "17",
    7,
  );
  $rules[] = array(
    "18",
    7,
  );
  $rules[] = array(
    "19",
    7,
  );
  return $rules;
}