This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 
<?php
/**
 * @package Helpers
 * @category Concrete
 * @author Andrew Embler <[email protected]>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

/**
 * Grabs a list of states and provinces commonly used in web forms.
 * @package Helpers
 * @category Concrete
 * @author Andrew Embler <[email protected]>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

defined('C5_EXECUTE') or die("Access Denied.");
class Concrete5_Helper_Lists_StatesProvinces {

    /** Locale for which we currently loaded the data.
    * @var string
    */
    protected $locale = null;

    protected $stateProvinces = array(
    'US' => array(
        'AL' => 'Alabama',
        'AK' => 'Alaska',
        'AZ' => 'Arizona',
        'AR' => 'Arkansas',
        'CA' => 'California',
        'CO' => 'Colorado',
        'CT' => 'Connecticut',
        'DE' => 'Delaware',
        'FL' => 'Florida',
        'GA' => 'Georgia',
        'HI' => 'Hawaii',
        'ID' => 'Idaho',
        'IL' => 'Illinois',
        'IN' => 'Indiana',
        'IA' => 'Iowa',
        'KS' => 'Kansas',
        'KY' => 'Kentucky',
        'LA' => 'Louisiana',
        'ME' => 'Maine',
        'MD' => 'Maryland',
        'MA' => 'Massachusetts',
        'MI' => 'Michigan',
        'MN' => 'Minnesota',
        'MS' => 'Mississippi',
        'MO' => 'Missouri',
        'MT' => 'Montana',
        'NE' => 'Nebraska',
        'NV' => 'Nevada',
        'NH' => 'New Hampshire',
        'NJ' => 'New Jersey',
        'NM' => 'New Mexico',
        'NY' => 'New York',
        'NC' => 'North Carolina',
        'ND' => 'North Dakota',
        'OH' => 'Ohio',
        'OK' => 'Oklahoma',
        'OR' => 'Oregon',
        'PA' => 'Pennsylvania',
        'RI' => 'Rhode Island',
        'SC' => 'South Carolina',
        'SD' => 'South Dakota',
        'TN' => 'Tennessee',
        'TX' => 'Texas',
        'UT' => 'Utah',
        'VT' => 'Vermont',
        'VA' => 'Virginia',
        'WA' => 'Washington',
        'DC' => 'Washington, DC',
        'WV' => 'West Virginia',
        'WI' => 'Wisconsin',
        'WY' => 'Wyoming'
    ),

    'CA' => array(
        'AB' => 'Alberta',
        'BC' => 'British Columbia',
        'MB' => 'Manitoba',
        'NB' => 'New Brunswick',
        'NL' => 'Newfoundland and Labrador',
        'NT' => 'Northwest Territories',
        'NS' => 'Nova Scotia',
        'NU' => 'Nunavut',
        'ON' => 'Ontario',
        'PE' => 'Prince Edward Island',
        'QC' => 'Quebec',
        'SK' => 'Saskatchewan',
        'YT' => 'Yukon'
    ),

    'AU' => array(
        'AAT' => 'Australian Antarctic Territory',
        'ACT' => 'Australian Capital Territory',
        'NT' => 'Northern Territory',
        'NSW' => 'New South Wales',
        'QLD' => 'Queensland',
        'SA' => 'South Australia',
        'TAS' => 'Tasmania',
        'VIC' => 'Victoria',
        'WA' => 'Western Australia',
    ),

    'DE' => array(
        'BW' => 'Baden-Württemberg',
        'BY' => 'Bayern',
        'BE' => 'Berlin',
        'BB' => 'Brandenburg',
        'HB' => 'Bremen',
        'HH' => 'Hamburg',
        'HE' => 'Hessen',
        'MV' => 'Mecklenburg-Vorpommern',
        'NI' => 'Niedersachsen',
        'NW' => 'Nordrhein-Westfalen',
        'RP' => 'Rheinland-Pfalz',
        'SL' => 'Saarland',
        'SN' => 'Sachsen',
        'ST' => 'Sachsen-Anhalt',
        'SH' => 'Schleswig-Holstein',
        'TH' => 'Thüringen'
    ),

    'FR' => array(
        '01' => 'Ain',
        '02' => 'Aisne',
        '03' => 'Allier',
        '04' => 'Alpes-de-Haute-Provence',
        '05' => 'Haute-Alpes',
        '06' => 'Alpes-Maritimes',
        '07' => 'Ardèche',
        '08' => 'Ardennes',
        '09' => 'Ariège',
        '10' => 'Aube',
        '11' => 'Aude',
        '12' => 'Aveyron',
        '13' => 'Bouches-du-Rhône',
        '14' => 'Calvados',
        '15' => 'Cantal',
        '16' => 'Charente',
        '17' => 'Charente-Maritime',
        '18' => 'Cher',
        '19' => 'Corrèze',
        '2A' => 'Corse-du-Sud',
        '2B' => 'Haute-Corse',
        '21' => 'Côte-d\'Or',
        '22' => 'Côte-d\'Armor',
        '23' => 'Creuse',
        '24' => 'Dordogne',
        '25' => 'Doubs',
        '26' => 'Drôme',
        '27' => 'Eure',
        '28' => 'Eure-et-Loir',
        '29' => 'Finistère',
        '30' => 'Gard',
        '31' => 'Haute-Garonne',
        '32' => 'Gers',
        '33' => 'Gironde',
        '34' => 'Hérault',
        '35' => 'Ille-et-Vilaine',
        '36' => 'Indre',
        '37' => 'Indre-et-Loire',
        '38' => 'Isère',
        '39' => 'Jura',
        '40' => 'Landes',
        '41' => 'Loir-et-Cher',
        '42' => 'Loire',
        '43' => 'Haute-Loire',
        '44' => 'Loire-Atlantique',
        '45' => 'Loiret',
        '46' => 'Lot',
        '47' => 'Lot-et-Garonne',
        '48' => 'Lozère',
        '49' => 'Maine-et-Loire',
        '50' => 'Manche',
        '51' => 'Marne',
        '52' => 'Haute-Marne',
        '53' => 'Mayenne',
        '54' => 'Meurthe-et-Moselle',
        '55' => 'Meuse',
        '56' => 'Morbihan',
        '57' => 'Moselle',
        '58' => 'Nièvre',
        '59' => 'Nord',
        '60' => 'Oise',
        '61' => 'Orne',
        '62' => 'Pas-de-Calais',
        '63' => 'Puy-de-Dôme',
        '64' => 'Pyrénées-Atlantiques',
        '65' => 'Hautes-Pyrénées',
        '66' => 'Pyrénées-Orientales',
        '67' => 'Bas-Rhin',
        '68' => 'Haut-Rhin',
        '69' => 'Rhône',
        '70' => 'Haute-Saône',
        '71' => 'Saône-et-Loire',
        '72' => 'Sarthe',
        '73' => 'Savoie',
        '74' => 'Haute-Savoie',
        '75' => 'Paris',
        '76' => 'Seine-Maritime',
        '77' => 'Seine-et-Marne',
        '78' => 'Yvelines',
        '79' => 'Deux-Sèvres',
        '80' => 'Somme',
        '81' => 'Tarn',
        '82' => 'Tarn-et-Garonne',
        '83' => 'Var',
        '84' => 'Vaucluse',
        '85' => 'Vendée',
        '86' => 'Vienne',
        '87' => 'Haute-Vienne',
        '88' => 'Vosges',
        '89' => 'Yonne',
        '90' => 'Territoire de Belfort',
        '91' => 'Essonne',
        '92' => 'Hauts-de-Seine',
        '93' => 'Seine-Saint-Denis',
        '94' => 'Val-de-Marne',
        '95' => 'Val-d\'Oise'
    ),

    'UK' => array(
        'ANGLES' => 'Anglesey',
        'BRECK' => 'Brecknockshire',
        'CAERN' => 'Caernarfonshire',
        'CARMA' => 'Carmathenshire',
        'CARDIG' => 'Cardiganshire',
        'DENBIG' => 'Denbighshire',
        'FLINTS' => 'Flintshire',
        'GLAMO' => 'Glamorgan',
        'MERION' => 'Merioneth',
        'MONMOUTH' => 'Monmouthshire',
        'MONTG' => 'Mongtomeryshire',
        'PEMBR' => 'Pembrokeshire',
        'RADNOR' => 'Radnorshire',
        'ARBERD' => 'Aberdeenshire',
        'ANGUS' => 'Angus',
        'ARGYLL' => 'Argyllshire',
        'AYRSH' => 'Ayrshire',
        'BANFF' => 'Banffshire',
        'BERWICK' => 'Berwickshire',
        'BUTE' => 'Buteshire',
        'CROMART' => 'Cromartyshire',
        'CAITH' => 'Caithness',
        'CLACKM' => 'Clackmannanshire',
        'DUMFR' => 'Dumfriesshire',
        'DUNBART' => 'Dunbartonshire',
        'EASTL' => 'East Lothian',
        'FIFE' => 'Fife',
        'INVERN' => 'Inverness-shire',
        'KINCARD' => 'Kincardineshire',
        'KINROSS' => 'Kinross-shire',
        'KIRKCUD' => 'Kircudbrightshire',
        'LANARK' => 'Lanarkshire',
        'MIDLOTH' => 'Midlothian',
        'MORAY' => 'Morayshire',
        'NAIRN' => 'Nairnshire',
        'ORKNEY' => 'Orkeny',
        'PEEBLESS' => 'Peeblesshire',
        'PERTH' => 'Perthshire',
        'RENFREW' => 'Renfrewshire',
        'ROSSSH' => 'Ross-shire',
        'ROXBURGH' => 'Roxburghshire',
        'SELKIRK' => 'Selkirkshire',
        'SHETLAND' => 'Shetland',
        'STIRLING' => 'Stirlingshire',
        'SUTHER' => 'Sutherland',
        'WESTL' => 'West Lothian',
        'WIGTOWN' => 'Wigtownshire',
        'MERSEYSIDE' => 'Merseyside',
        'BEDS' => 'Bedfordshire',
        'LONDON' => 'London',
        'BERKS' => 'Berkshire',
        'BUCKS' => 'Buckinghamshire',
        'CAMBS' => 'Cambridgeshire',
        'CHESH' => 'Cheshire',
        'CORN' => 'Cornwall',
        'CUMB' => 'Cumberland',
        'DERBY' => 'Derbyshire',
        'DEVON' => 'Devon',
        'DORSET' => 'Dorset',
        'DURHAM' => 'Durham',
        'ESSEX' => 'Essex',
        'GLOUS' => 'Gloucestershire',
        'HANTS' => 'Hampshire',
        'HEREF' => 'Herefordshire',
        'HERTS' => 'Hertfordshire',
        'HUNTS' => 'Huntingdonshire',
        'KENT' => 'Kent',
        'LANCS' => 'Lancashire',
        'LEICS' => 'Leicestershire',
        'LINCS' => 'Lincolnshire',
        'MIDDLE' => 'Middlesex',
        'NORF' => 'Norfolk',
        'NHANTS' => 'Northamptonshire',
        'NTHUMB' => 'Northumberland',
        'NOTTS' => 'Nottinghamshire',
        'OXON' => 'Oxfordshire',
        'RUTL' => 'Rutland',
        'SHROPS' => 'Shropshire',
        'SOM' => 'Somerset',
        'STAFFS' => 'Staffordshire',
        'SUFF' => 'Suffolk',
        'SURREY' => 'Surrey',
        'SUSS' => 'Sussex',
        'WARKS' => 'Warwickshire',
        'WESTMOR' => 'Westmorland',
        'WILTS' => 'Wiltshire',
        'WORCES' => 'Worcestershire',
        'YORK' => 'Yorkshire'
    ),

    'IE' => array(
        'CO ANTRIM' => 'County Antrim',
        'CO ARMAGH' => 'County Armagh',
        'CO DOWN' => 'County Down',
        'CO FERMANAGH' => 'County Fermanagh',
        'CO DERRY' => 'County Londonderry',
        'CO TYRONE' => 'County Tyrone',
        'CO CAVAN' => 'County Cavan',
        'CO DONEGAL' => 'County Donegal',
        'CO MONAGHAN' => 'County Monaghan',
        'CO DUBLIN' => 'County Dublin',
        'CO CARLOW' => 'County Carlow',
        'CO KILDARE' => 'County Kildare',
        'CO KILKENNY' => 'County Kilkenny',
        'CO LAOIS' => 'County Laois',
        'CO LONGFORD' => 'County Longford',
        'CO LOUTH' => 'County Louth',
        'CO MEATH' => 'County Meath',
        'CO OFFALY' => 'County Offaly',
        'CO WESTMEATH' => 'County Westmeath',
        'CO WEXFORD' => 'County Wexford',
        'CO WICKLOW' => 'County Wicklow',
        'CO GALWAY' => 'County Galway',
        'CO MAYO' => 'County Mayo',
        'CO LEITRIM' => 'County Leitrim',
        'CO ROSCOMMON' => 'County Roscommon',
        'CO SLIGO' => 'County Sligo',
        'CO CLARE' => 'County Clare',
        'CO CORK' => 'County Cork',
        'CO KERRY' => 'County Kerry',
        'CO LIMERICK' => 'County Limerick',
        'CO TIPPERARY' => 'County Tipperary',
        'CO WATERFORD' => 'County Waterford'
    ),

    'NL' => array(
        'DR' => 'Drenthe',
        'FL' => 'Flevoland',
        'FR' => 'Friesland',
        'GL' => 'Gelderland',
        'GR' => 'Groningen',
        'LB' => 'Limburg',
        'NB' => 'Noord Brabant',
        'NH' => 'Noord Holland',
        'OV' => 'Overijssel',
        'UT' => 'Utrecht',
        'ZH' => 'Zuid Holland',
        'ZL' => 'Zeeland'
    ),

    'BR' => array(
        'AC' => 'Acre',
        'AL' => 'Alagoas',
        'AM' => 'Amazonas',
        'AP' => 'Amapa',
        'BA' => 'Baia',
        'CE' => 'Ceara',
        'DF' => 'Distrito Federal',
        'ES' => 'Espirito Santo',
        'FN' => 'Fernando de Noronha',
        'GO' => 'Goias',
        'MA' => 'Maranhao',
        'MG' => 'Minas Gerais',
        'MS' => 'Mato Grosso do Sul',
        'MT' => 'Mato Grosso',
        'PA' => 'Para',
        'PB' => 'Paraiba',
        'PE' => 'Pernambuco',
        'PI' => 'Piaui',
        'PR' => 'Parana',
        'RJ' => 'Rio de Janeiro',
        'RN' => 'Rio Grande do Norte',
        'RO' => 'Rondonia',
        'RR' => 'Roraima',
        'RS' => 'Rio Grande do Sul',
        'SC' => 'Santa Catarina',
        'SE' => 'Sergipe',
        'SP' => 'Sao Paulo',
        'TO' => 'Tocatins'
    ),

    'IT' => array(
        'AG' => 'Agrigento',
        'AL' => 'Alessandria',
        'AN' => 'Ancona',
        'AO' => 'Aosta',
        'AR' => 'Arezzo',
        'AP' => 'Ascoli Piceno',
        'AT' => 'Asti',
        'AV' => 'Avellino',
        'BA' => 'Bari',
        'BT' => 'Barletta-Andria-Trani',
        'BL' => 'Belluno',
        'BN' => 'Benevento',
        'BG' => 'Bergamo',
        'BI' => 'Biella',
        'BO' => 'Bologna',
        'BZ' => 'Bolzano',
        'BS' => 'Brescia',
        'BR' => 'Brindisi',
        'CA' => 'Cagliari',
        'CL' => 'Caltanissetta',
        'CB' => 'Campobasso',
        'CI' => 'Carbonia-Iglesias',
        'CE' => 'Caserta',
        'CT' => 'Catania',
        'CZ' => 'Catanzaro',
        'CH' => 'Chieti',
        'CO' => 'Como',
        'CS' => 'Cosenza',
        'CR' => 'Cremona',
        'KR' => 'Crotone',
        'CN' => 'Cuneo',
        'EN' => 'Enna',
        'FM' => 'Fermo',
        'FE' => 'Ferrara',
        'FI' => 'Firenze',
        'FG' => 'Foggia',
        'FC' => 'Forlì-Cesena',
        'FR' => 'Frosinone',
        'GE' => 'Genova',
        'GO' => 'Gorizia',
        'GR' => 'Grosseto',
        'IM' => 'Imperia',
        'IS' => 'Isernia',
        'AQ' => 'L’Aquila',
        'SP' => 'La Spezia',
        'LT' => 'Latina',
        'LE' => 'Lecce',
        'LC' => 'Lecco',
        'LI' => 'Livorno',
        'LO' => 'Lodi',
        'LU' => 'Lucca',
        'MC' => 'Macerata',
        'MN' => 'Mantova',
        'MS' => 'Massa e Carrara',
        'MT' => 'Matera',
        'VS' => 'Medio Campidano',
        'ME' => 'Messina',
        'MI' => 'Milano',
        'MO' => 'Modena',
        'MB' => 'Monza e Brianza',
        'NA' => 'Napoli',
        'NO' => 'Novara',
        'NU' => 'Nuoro',
        'OG' => 'Ogliastra',
        'OT' => 'Olbia-Tempio',
        'OR' => 'Oristano',
        'PD' => 'Padova',
        'PA' => 'Palermo',
        'PR' => 'Parma',
        'PV' => 'Pavia',
        'PG' => 'Perugia',
        'PU' => 'Pesaro e Urbino',
        'PE' => 'Pescara',
        'PC' => 'Piacenza',
        'PI' => 'Pisa',
        'PT' => 'Pistoia',
        'PN' => 'Pordenone',
        'PZ' => 'Potenza',
        'PO' => 'Prato',
        'RG' => 'Ragusa',
        'RA' => 'Ravenna',
        'RC' => 'Reggio Calabria',
        'RE' => 'Reggio Emilia',
        'RI' => 'Rieti',
        'RN' => 'Rimini',
        'RM' => 'Roma',
        'RO' => 'Rovigo',
        'SA' => 'Salerno',
        'SS' => 'Sassari',
        'SV' => 'Savona',
        'SI' => 'Siena',
        'SR' => 'Siracusa',
        'SO' => 'Sondrio',
        'TA' => 'Taranto',
        'TE' => 'Teramo',
        'TR' => 'Terni',
        'TO' => 'Torino',
        'TP' => 'Trapani',
        'TN' => 'Trento',
        'TV' => 'Treviso',
        'TS' => 'Trieste',
        'UD' => 'Udine',
        'VA' => 'Varese',
        'VE' => 'Venezia',
        'VB' => 'Verbano-Cusio-Ossola',
        'VC' => 'Vercelli',
        'VR' => 'Verona',
        'VV' => 'Vibo Valentia',
        'VI' => 'Vicenza',
        'VT' => 'Viterbo'
    ),
    
    'JP' => array(
        '01' => '北海道',
        '02' => '青森県',
        '03' => '岩手県',
        '04' => '宮城県',
        '05' => '秋田県',
        '06' => '山形県',
        '07' => '福島県',
        '08' => '茨城県',
        '09' => '栃木県',
        '10' => '群馬県',
        '11' => '埼玉県',
        '12' => '千葉県',
        '13' => '東京都',
        '14' => '神奈川県',
        '15' => '新潟県',
        '16' => '富山県',
        '17' => '石川県',
        '18' => '福井県',
        '19' => '山梨県',
        '20' => '長野県',
        '21' => '岐阜県',
        '22' => '静岡県',
        '23' => '愛知県',
        '24' => '三重県',
        '25' => '滋賀県',
        '26' => '京都府',
        '27' => '大阪府',
        '28' => '兵庫県',
        '29' => '奈良県',
        '30' => '和歌山県',
        '31' => '鳥取県',
        '32' => '島根県',
        '33' => '岡山県',
        '34' => '広島県',
        '35' => '山口県',
        '36' => '徳島県',
        '37' => '香川県',
        '38' => '愛媛県',
        '39' => '高知県',
        '40' => '福岡県',
        '41' => '佐賀県',
        '42' => '長崎県',
        '43' => '熊本県',
        '44' => '大分県',
        '45' => '宮崎県',
        '46' => '鹿児島県',
        '47' => '沖縄県'
    )

    );

    protected $sortedCountries = array('JP');

    public function reset() {
        $locale = Localization::activeLocale();
        if($locale === $this->locale) {
            return;
        }
        $this->locale = $locale;
        $this->stateProvinces['GB'] = $this->stateProvinces['UK'];
        $stateProvincesFromEvent = Events::fire('on_get_states_provinces_list', $this->stateProvinces);
        if(is_array($stateProvincesFromEvent)) {
            $this->stateProvinces = $stateProvincesFromEvent;
        } else {
            foreach(array_keys($this->stateProvinces) as $country) {
                if (!in_array($country, $this->sortedCountries)) {
                    asort($this->stateProvinces[$country]);
                }
            }
        }
    }

    /** Returns the list of States/Provinces for some countries (States/Provinces are sorted alphabetically).
    * @return array Returns an array whose keys are the country codes and the values are arrays (with keys: State/Province code, values: State/Province names)
    */
    public function getAll() {
        return $this->stateProvinces;
    }

    /** Returns the name of a specified State/Province in a specified Country.
    * @param string $code The State/Province code.
    * @param string $country The Country code.
    * @return string|void Returns the State/Province name (if found), or nothing if not found.
    */
    public function getStateProvinceName($code, $country) {
        if(isset($this->stateProvinces[$country]) && isset($this->stateProvinces[$country][$code])) {
            return $this->stateProvinces[$country][$code];
        }
    }

    /** Returns a list of States/Provinces for a country.
    * @param string $country The country code.
    * @return array|void If the Country is supported, the function returns an array (whose keys are the States/Provinces codes and the values are their names); returns nothing if $country is not supported.
    */
    public function getStateProvinceArray($country) {
        if(isset($this->stateProvinces[$country])) {
            return $this->stateProvinces[$country];
        }
    }

    /** Returns the list of US states.
    * @deprecated
    * @return array Returns an array whose keys are the US State codes and the values are their names.
    */
    public function getStates() {
        return $this->getStateProvinceArray('US');
    }

    /** Returns the list of Canadian provinces.
    * @deprecated
    * @return array Returns an array whose keys are the Canadian Provinces codes and the values are their names.
    */
    public function getCanadianProvinces() {
        return $this->getStateProvinceArray('CA');
    }

}