uc_usps.countries.inc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * @file
  4. * Contains the map of ISO country codes to USPS Individual Country Listings.
  5. */
  6. /**
  7. * Returns the country name formatted according to the USPS requirements.
  8. *
  9. * USPS uses the ISO 3166 English short names in most cases. This function
  10. * handles the exceptions.
  11. *
  12. * @param $code
  13. * ISO 3166-1 3-digit numerical country code.
  14. *
  15. * @return
  16. * Country name string for use by the USPS International Rate API.
  17. *
  18. * @see http://pe.usps.gov/text/imm/immctry.htm
  19. */
  20. function uc_usps_country_map($code = NULL) {
  21. $countries = array(
  22. 248 => 'Aland Island (Finland)',
  23. 334 => 'Australia', // Heard Island and McDonald Islands
  24. 68 => 'Bolivia',
  25. 535 => 'Bonaire (Netherlands Antilles)',
  26. 92 => 'British Virgin Islands',
  27. 166 => 'Cocos Island (Australia)',
  28. 180 => 'Congo, Democratic Republic of the',
  29. 178 => 'Congo, Republic of the',
  30. 531 => 'Curacao (Netherlands Antilles)',
  31. 384 => "Cote d'Ivoire",
  32. 626 => 'East Timor (Indonesia)',
  33. 238 => 'Falkland Islands',
  34. 260 => 'France', // French Southern Territories
  35. 268 => 'Georgia, Republic of',
  36. 826 => 'Great Britain and Northern Ireland',
  37. 86 => 'Great Britain and Northern Ireland', // British Indian Ocean Territory
  38. 239 => 'Great Britain and Northern Ireland', // South Georgia and the
  39. // South Sandwich Islands
  40. 364 => 'Iran',
  41. 275 => 'Israel', // Palestinian Territory, Occupied
  42. 833 => 'Isle of Man (Great Britain and Northern Ireland)',
  43. 498 => 'Moldova',
  44. 732 => 'Morocco', // Western Sahara
  45. 408 => "Korea, Democratic People's Republic of (North Korea)",
  46. 74 => 'Norway', // Bouvet Island
  47. 744 => 'Norway', // Svalbard and Jan Mayen
  48. 410 => 'Korea, Republic of (South Korea)',
  49. 418 => 'Laos',
  50. 492 => 'Monaco (France)',
  51. 104 => 'Myanmar (Burma)',
  52. 612 => 'Pitcairn Island',
  53. 638 => 'Reunion',
  54. 643 => 'Russia',
  55. 688 => 'Serbia, Republic of',
  56. 652 => 'Saint Barthelemy (Guadeloupe)',
  57. 654 => 'Saint Helena',
  58. 534 => 'Saint Maarten (Dutch) (Netherlands Antilles)',
  59. 663 => 'Saint Martin (French) (Guadeloupe)',
  60. 703 => 'Slovak Republic',
  61. 158 => 'Taiwan',
  62. 834 => 'Tanzania',
  63. 792 => 'Turkey',
  64. 804 => 'Ukraine',
  65. 336 => 'Vatican City',
  66. 862 => 'Venezuela',
  67. 876 => 'Wallis and Futuna Islands',
  68. );
  69. if ($code) {
  70. if (isset($countries[$code])) {
  71. return $countries[$code];
  72. }
  73. else {
  74. return uc_country_get_by_id($code);
  75. }
  76. }
  77. return $countries;
  78. }