Last active
December 18, 2015 19:08
-
-
Save UmeshSingla/5830378 to your computer and use it in GitHub Desktop.
Country, State, Timezone List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_country_state_list($c = '',$only_country = FALSE) { | |
$countries = array( | |
'select_one' => __('Select one...', 'rtPanel'), | |
'AF' => __('Afghanistan', 'rtPanel'), | |
'AX' => __('Åland Islands', 'rtPanel'), | |
'AL' => __('Albania', 'rtPanel'), | |
'DZ' => __('Algeria', 'rtPanel'), | |
'AS' => __('American Samoa', 'rtPanel'), | |
'AD' => __('Andorra', 'rtPanel'), | |
'AO' => __('Angola', 'rtPanel'), | |
'AI' => __('Anguilla', 'rtPanel'), | |
'AQ' => __('Antarctica', 'rtPanel'), | |
'AG' => __('Antigua and Barbuda', 'rtPanel'), | |
'AR' => __('Argentina', 'rtPanel'), | |
'AM' => __('Armenia', 'rtPanel'), | |
'AW' => __('Aruba', 'rtPanel'), | |
'AU' => __('Australia', 'rtPanel'), | |
'AT' => __('Austria', 'rtPanel'), | |
'AZ' => __('Azerbaijan', 'rtPanel'), | |
'BS' => __('Bahamas', 'rtPanel'), | |
'BH' => __('Bahrain', 'rtPanel'), | |
'BD' => __('Bangladesh', 'rtPanel'), | |
'BB' => __('Barbados', 'rtPanel'), | |
'BY' => __('Belarus', 'rtPanel'), | |
'BE' => __('Belgium', 'rtPanel'), | |
'BZ' => __('Belize', 'rtPanel'), | |
'BJ' => __('Benin', 'rtPanel'), | |
'BM' => __('Bermuda', 'rtPanel'), | |
'BT' => __('Bhutan', 'rtPanel'), | |
'BO' => __('Bolivia', 'rtPanel'), | |
'BA' => __('Bosnia and Herzegovina', 'rtPanel'), | |
'BW' => __('Botswana', 'rtPanel'), | |
'BR' => __('Brazil', 'rtPanel'), | |
'IO' => __('British Indian Ocean Territory', 'rtPanel'), | |
'VG' => __('British Virgin Islands', 'rtPanel'), | |
'BN' => __('Brunei', 'rtPanel'), | |
'BG' => __('Bulgaria', 'rtPanel'), | |
'BF' => __('Burkina Faso', 'rtPanel'), | |
'BI' => __('Burundi', 'rtPanel'), | |
'KH' => __('Cambodia', 'rtPanel'), | |
'CM' => __('Cameroon', 'rtPanel'), | |
'CA' => __('Canada', 'rtPanel'), | |
'CV' => __('Cape Verde', 'rtPanel'), | |
'KY' => __('Cayman Islands', 'rtPanel'), | |
'CF' => __('Central African Republic', 'rtPanel'), | |
'TD' => __('Chad', 'rtPanel'), | |
'CL' => __('Chile', 'rtPanel'), | |
'CN' => __('China', 'rtPanel'), | |
'CX' => __('Christmas Island', 'rtPanel'), | |
'CC' => __('Cocos (Keeling) Islands', 'rtPanel'), | |
'CO' => __('Colombia', 'rtPanel'), | |
'KM' => __('Comoros', 'rtPanel'), | |
'CG' => __('Congo (Brazzaville)', 'rtPanel'), | |
'CD' => __('Congo (Kinshasa)', 'rtPanel'), | |
'CK' => __('Cook Islands', 'rtPanel'), | |
'CR' => __('Costa Rica', 'rtPanel'), | |
'HR' => __('Croatia', 'rtPanel'), | |
'CU' => __('Cuba', 'rtPanel'), | |
'CY' => __('Cyprus', 'rtPanel'), | |
'CZ' => __('Czech Republic', 'rtPanel'), | |
'DK' => __('Denmark', 'rtPanel'), | |
'DJ' => __('Djibouti', 'rtPanel'), | |
'DM' => __('Dominica', 'rtPanel'), | |
'DO' => __('Dominican Republic', 'rtPanel'), | |
'EC' => __('Ecuador', 'rtPanel'), | |
'EG' => __('Egypt', 'rtPanel'), | |
'SV' => __('El Salvador', 'rtPanel'), | |
'GQ' => __('Equatorial Guinea', 'rtPanel'), | |
'ER' => __('Eritrea', 'rtPanel'), | |
'EE' => __('Estonia', 'rtPanel'), | |
'ET' => __('Ethiopia', 'rtPanel'), | |
'FK' => __('Falkland Islands', 'rtPanel'), | |
'FO' => __('Faroe Islands', 'rtPanel'), | |
'FJ' => __('Fiji', 'rtPanel'), | |
'FI' => __('Finland', 'rtPanel'), | |
'FR' => __('France', 'rtPanel'), | |
'GF' => __('French Guiana', 'rtPanel'), | |
'PF' => __('French Polynesia', 'rtPanel'), | |
'TF' => __('French Southern Territories', 'rtPanel'), | |
'GA' => __('Gabon', 'rtPanel'), | |
'GM' => __('Gambia', 'rtPanel'), | |
'GE' => __('Georgia', 'rtPanel'), | |
'DE' => __('Germany', 'rtPanel'), | |
'GH' => __('Ghana', 'rtPanel'), | |
'GI' => __('Gibraltar', 'rtPanel'), | |
'GR' => __('Greece', 'rtPanel'), | |
'GL' => __('Greenland', 'rtPanel'), | |
'GD' => __('Grenada', 'rtPanel'), | |
'GP' => __('Guadeloupe', 'rtPanel'), | |
'GU' => __('Guam', 'rtPanel'), | |
'GT' => __('Guatemala', 'rtPanel'), | |
'GG' => __('Guernsey', 'rtPanel'), | |
'GN' => __('Guinea', 'rtPanel'), | |
'GW' => __('Guinea-Bissau', 'rtPanel'), | |
'GY' => __('Guyana', 'rtPanel'), | |
'HT' => __('Haiti', 'rtPanel'), | |
'HN' => __('Honduras', 'rtPanel'), | |
'HK' => __('Hong Kong', 'rtPanel'), | |
'HU' => __('Hungary', 'rtPanel'), | |
'IS' => __('Iceland', 'rtPanel'), | |
'IN' => __('India', 'rtPanel'), | |
'ID' => __('Indonesia', 'rtPanel'), | |
'IR' => __('Iran', 'rtPanel'), | |
'IQ' => __('Iraq', 'rtPanel'), | |
'IE' => __('Republic of Ireland', 'rtPanel'), | |
'IM' => __('Isle of Man', 'rtPanel'), | |
'IL' => __('Israel', 'rtPanel'), | |
'IT' => __('Italy', 'rtPanel'), | |
'CI' => __('Ivory Coast', 'rtPanel'), | |
'JM' => __('Jamaica', 'rtPanel'), | |
'JP' => __('Japan', 'rtPanel'), | |
'JE' => __('Jersey', 'rtPanel'), | |
'JO' => __('Jordan', 'rtPanel'), | |
'KZ' => __('Kazakhstan', 'rtPanel'), | |
'KE' => __('Kenya', 'rtPanel'), | |
'KI' => __('Kiribati', 'rtPanel'), | |
'KW' => __('Kuwait', 'rtPanel'), | |
'KG' => __('Kyrgyzstan', 'rtPanel'), | |
'LA' => __('Laos', 'rtPanel'), | |
'LV' => __('Latvia', 'rtPanel'), | |
'LB' => __('Lebanon', 'rtPanel'), | |
'LS' => __('Lesotho', 'rtPanel'), | |
'LR' => __('Liberia', 'rtPanel'), | |
'LY' => __('Libya', 'rtPanel'), | |
'LI' => __('Liechtenstein', 'rtPanel'), | |
'LT' => __('Lithuania', 'rtPanel'), | |
'LU' => __('Luxembourg', 'rtPanel'), | |
'MO' => __('Macao S.A.R., China', 'rtPanel'), | |
'MK' => __('Macedonia', 'rtPanel'), | |
'MG' => __('Madagascar', 'rtPanel'), | |
'MW' => __('Malawi', 'rtPanel'), | |
'MY' => __('Malaysia', 'rtPanel'), | |
'MV' => __('Maldives', 'rtPanel'), | |
'ML' => __('Mali', 'rtPanel'), | |
'MT' => __('Malta', 'rtPanel'), | |
'MH' => __('Marshall Islands', 'rtPanel'), | |
'MQ' => __('Martinique', 'rtPanel'), | |
'MR' => __('Mauritania', 'rtPanel'), | |
'MU' => __('Mauritius', 'rtPanel'), | |
'YT' => __('Mayotte', 'rtPanel'), | |
'MX' => __('Mexico', 'rtPanel'), | |
'FM' => __('Micronesia', 'rtPanel'), | |
'MD' => __('Moldova', 'rtPanel'), | |
'MC' => __('Monaco', 'rtPanel'), | |
'MN' => __('Mongolia', 'rtPanel'), | |
'ME' => __('Montenegro', 'rtPanel'), | |
'MS' => __('Montserrat', 'rtPanel'), | |
'MA' => __('Morocco', 'rtPanel'), | |
'MZ' => __('Mozambique', 'rtPanel'), | |
'MM' => __('Myanmar', 'rtPanel'), | |
'NA' => __('Namibia', 'rtPanel'), | |
'NR' => __('Nauru', 'rtPanel'), | |
'NP' => __('Nepal', 'rtPanel'), | |
'NL' => __('Netherlands', 'rtPanel'), | |
'AN' => __('Netherlands Antilles', 'rtPanel'), | |
'NC' => __('New Caledonia', 'rtPanel'), | |
'NZ' => __('New Zealand', 'rtPanel'), | |
'NI' => __('Nicaragua', 'rtPanel'), | |
'NE' => __('Niger', 'rtPanel'), | |
'NG' => __('Nigeria', 'rtPanel'), | |
'NU' => __('Niue', 'rtPanel'), | |
'NF' => __('Norfolk Island', 'rtPanel'), | |
'KP' => __('North Korea', 'rtPanel'), | |
'MP' => __('Northern Mariana Islands', 'rtPanel'), | |
'NO' => __('Norway', 'rtPanel'), | |
'OM' => __('Oman', 'rtPanel'), | |
'PK' => __('Pakistan', 'rtPanel'), | |
'PW' => __('Palau', 'rtPanel'), | |
'PS' => __('Palestinian Territory', 'rtPanel'), | |
'PA' => __('Panama', 'rtPanel'), | |
'PG' => __('Papua New Guinea', 'rtPanel'), | |
'PY' => __('Paraguay', 'rtPanel'), | |
'PE' => __('Peru', 'rtPanel'), | |
'PH' => __('Philippines', 'rtPanel'), | |
'PN' => __('Pitcairn', 'rtPanel'), | |
'PL' => __('Poland', 'rtPanel'), | |
'PT' => __('Portugal', 'rtPanel'), | |
'PR' => __('Puerto Rico', 'rtPanel'), | |
'QA' => __('Qatar', 'rtPanel'), | |
'RE' => __('Reunion', 'rtPanel'), | |
'RO' => __('Romania', 'rtPanel'), | |
'RU' => __('Russia', 'rtPanel'), | |
'RW' => __('Rwanda', 'rtPanel'), | |
'BL' => __('Saint Barthélemy', 'rtPanel'), | |
'SH' => __('Saint Helena', 'rtPanel'), | |
'KN' => __('Saint Kitts and Nevis', 'rtPanel'), | |
'LC' => __('Saint Lucia', 'rtPanel'), | |
'MF' => __('Saint Martin (French part)', 'rtPanel'), | |
'PM' => __('Saint Pierre and Miquelon', 'rtPanel'), | |
'VC' => __('Saint Vincent and the Grenadines', 'rtPanel'), | |
'WS' => __('Samoa', 'rtPanel'), | |
'SM' => __('San Marino', 'rtPanel'), | |
'ST' => __('São Tomé and Príncipe', 'rtPanel'), | |
'SA' => __('Saudi Arabia', 'rtPanel'), | |
'SN' => __('Senegal', 'rtPanel'), | |
'RS' => __('Serbia', 'rtPanel'), | |
'SC' => __('Seychelles', 'rtPanel'), | |
'SL' => __('Sierra Leone', 'rtPanel'), | |
'SG' => __('Singapore', 'rtPanel'), | |
'SK' => __('Slovakia', 'rtPanel'), | |
'SI' => __('Slovenia', 'rtPanel'), | |
'SB' => __('Solomon Islands', 'rtPanel'), | |
'SO' => __('Somalia', 'rtPanel'), | |
'ZA' => __('South Africa', 'rtPanel'), | |
'GS' => __('South Georgia/Sandwich Islands', 'rtPanel'), | |
'KR' => __('South Korea', 'rtPanel'), | |
'ES' => __('Spain', 'rtPanel'), | |
'LK' => __('Sri Lanka', 'rtPanel'), | |
'SD' => __('Sudan', 'rtPanel'), | |
'SR' => __('Suriname', 'rtPanel'), | |
'SJ' => __('Svalbard and Jan Mayen', 'rtPanel'), | |
'SZ' => __('Swaziland', 'rtPanel'), | |
'SE' => __('Sweden', 'rtPanel'), | |
'CH' => __('Switzerland', 'rtPanel'), | |
'SY' => __('Syria', 'rtPanel'), | |
'TW' => __('Taiwan', 'rtPanel'), | |
'TJ' => __('Tajikistan', 'rtPanel'), | |
'TZ' => __('Tanzania', 'rtPanel'), | |
'TH' => __('Thailand', 'rtPanel'), | |
'TL' => __('Timor-Leste', 'rtPanel'), | |
'TG' => __('Togo', 'rtPanel'), | |
'TK' => __('Tokelau', 'rtPanel'), | |
'TO' => __('Tonga', 'rtPanel'), | |
'TT' => __('Trinidad and Tobago', 'rtPanel'), | |
'TN' => __('Tunisia', 'rtPanel'), | |
'TR' => __('Turkey', 'rtPanel'), | |
'TM' => __('Turkmenistan', 'rtPanel'), | |
'TC' => __('Turks and Caicos Islands', 'rtPanel'), | |
'TV' => __('Tuvalu', 'rtPanel'), | |
'VI' => __('U.S. Virgin Islands', 'rtPanel'), | |
'UM' => __('US Minor Outlying Islands', 'rtPanel'), | |
'UG' => __('Uganda', 'rtPanel'), | |
'UA' => __('Ukraine', 'rtPanel'), | |
'AE' => __('United Arab Emirates', 'rtPanel'), | |
'GB' => __('United Kingdom', 'rtPanel'), | |
'US' => __('United States', 'rtPanel'), | |
'UY' => __('Uruguay', 'rtPanel'), | |
'UZ' => __('Uzbekistan', 'rtPanel'), | |
'VU' => __('Vanuatu', 'rtPanel'), | |
'VA' => __('Vatican', 'rtPanel'), | |
'VE' => __('Venezuela', 'rtPanel'), | |
'VN' => __('Vietnam', 'rtPanel'), | |
'WF' => __('Wallis and Futuna', 'rtPanel'), | |
'EH' => __('Western Sahara', 'rtPanel'), | |
'YE' => __('Yemen', 'rtPanel'), | |
'ZM' => __('Zambia', 'rtPanel'), | |
'ZW' => __('Zimbabwe', 'rtPanel') | |
); | |
// States set to array() are blank i.e. the country has no use for the state field. | |
$states = array('AU', 'BR', 'CA', 'CN', 'HK', 'HU', 'HZ', 'ID', 'IN', 'MY', 'NZ', 'TH', 'US', 'ZA'); | |
$states['AU'] = array( | |
'ACT' => __( 'Australian Capital Territory', 'rtPanel' ), | |
'NSW' => __( 'New South Wales', 'rtPanel' ), | |
'NT' => __( 'Northern Territory', 'rtPanel' ), | |
'QLD' => __( 'Queensland', 'rtPanel' ), | |
'SA' => __( 'South Australia', 'rtPanel' ), | |
'TAS' => __( 'Tasmania', 'rtPanel' ), | |
'VIC' => __( 'Victoria', 'rtPanel' ), | |
'WA' => __( 'Western Australia', 'rtPanel' ) | |
); | |
$states['BR'] = array( | |
'AC' => __( 'Acre', 'rtPanel' ), | |
'AL' => __( 'Alagoas', 'rtPanel' ), | |
'AP' => __( 'Amapá', 'rtPanel' ), | |
'AM' => __( 'Amazonas', 'rtPanel' ), | |
'BA' => __( 'Bahia', 'rtPanel' ), | |
'CE' => __( 'Ceará', 'rtPanel' ), | |
'DF' => __( 'Distrito Federal', 'rtPanel' ), | |
'ES' => __( 'Espírito Santo', 'rtPanel' ), | |
'GO' => __( 'Goiás', 'rtPanel' ), | |
'MA' => __( 'Maranhão', 'rtPanel' ), | |
'MT' => __( 'Mato Grosso', 'rtPanel' ), | |
'MS' => __( 'Mato Grosso do Sul', 'rtPanel' ), | |
'MG' => __( 'Minas Gerais', 'rtPanel' ), | |
'PA' => __( 'Pará', 'rtPanel' ), | |
'PB' => __( 'Paraíba', 'rtPanel' ), | |
'PR' => __( 'Paraná', 'rtPanel' ), | |
'PE' => __( 'Pernambuco', 'rtPanel' ), | |
'PI' => __( 'Piauí', 'rtPanel' ), | |
'RJ' => __( 'Rio de Janeiro', 'rtPanel' ), | |
'RN' => __( 'Rio Grande do Norte', 'rtPanel' ), | |
'RS' => __( 'Rio Grande do Sul', 'rtPanel' ), | |
'RO' => __( 'Rondônia', 'rtPanel' ), | |
'RR' => __( 'Roraima', 'rtPanel' ), | |
'SC' => __( 'Santa Catarina', 'rtPanel' ), | |
'SP' => __( 'São Paulo', 'rtPanel' ), | |
'SE' => __( 'Sergipe', 'rtPanel' ), | |
'TO' => __( 'Tocantins', 'rtPanel' ) | |
); | |
$states['CA'] = array( | |
'AB' => __( 'Alberta', 'rtPanel' ), | |
'BC' => __( 'British Columbia', 'rtPanel' ), | |
'MB' => __( 'Manitoba', 'rtPanel' ), | |
'NB' => __( 'New Brunswick', 'rtPanel' ), | |
'NF' => __( 'Newfoundland', 'rtPanel' ), | |
'NT' => __( 'Northwest Territories', 'rtPanel' ), | |
'NS' => __( 'Nova Scotia', 'rtPanel' ), | |
'NU' => __( 'Nunavut', 'rtPanel' ), | |
'ON' => __( 'Ontario', 'rtPanel' ), | |
'PE' => __( 'Prince Edward Island', 'rtPanel' ), | |
'QC' => __( 'Quebec', 'rtPanel' ), | |
'SK' => __( 'Saskatchewan', 'rtPanel' ), | |
'YT' => __( 'Yukon Territory', 'rtPanel' ) | |
); | |
$states['CN'] = array( | |
'CN1' => __( 'Yunnan / 云南', 'rtPanel' ), | |
'CN2' => __( 'Beijing / 北京', 'rtPanel' ), | |
'CN3' => __( 'Tianjin / 天津', 'rtPanel' ), | |
'CN4' => __( 'Hebei / 河北', 'rtPanel' ), | |
'CN5' => __( 'Shanxi / 山西', 'rtPanel' ), | |
'CN6' => __( 'Inner Mongolia / 內蒙古', 'rtPanel' ), | |
'CN7' => __( 'Liaoning / 辽宁', 'rtPanel' ), | |
'CN8' => __( 'Jilin / 吉林', 'rtPanel' ), | |
'CN9' => __( 'Heilongjiang / 黑龙江', 'rtPanel' ), | |
'CN10' => __( 'Shanghai / 上海', 'rtPanel' ), | |
'CN11' => __( 'Jiangsu / 江苏', 'rtPanel' ), | |
'CN12' => __( 'Zhejiang / 浙江', 'rtPanel' ), | |
'CN13' => __( 'Anhui / 安徽', 'rtPanel' ), | |
'CN14' => __( 'Fujian / 福建', 'rtPanel' ), | |
'CN15' => __( 'Jiangxi / 江西', 'rtPanel' ), | |
'CN16' => __( 'Shandong / 山东', 'rtPanel' ), | |
'CN17' => __( 'Henan / 河南', 'rtPanel' ), | |
'CN18' => __( 'Hubei / 湖北', 'rtPanel' ), | |
'CN19' => __( 'Hunan / 湖南', 'rtPanel' ), | |
'CN20' => __( 'Guangdong / 广东', 'rtPanel' ), | |
'CN21' => __( 'Guangxi Zhuang / 广西壮族', 'rtPanel' ), | |
'CN22' => __( 'Hainan / 海南', 'rtPanel' ), | |
'CN23' => __( 'Chongqing / 重庆', 'rtPanel' ), | |
'CN24' => __( 'Sichuan / 四川', 'rtPanel' ), | |
'CN25' => __( 'Guizhou / 贵州', 'rtPanel' ), | |
'CN26' => __( 'Shaanxi / 陕西', 'rtPanel' ), | |
'CN27' => __( 'Gansu / 甘肃', 'rtPanel' ), | |
'CN28' => __( 'Qinghai / 青海', 'rtPanel' ), | |
'CN29' => __( 'Ningxia Hui / 宁夏', 'rtPanel' ), | |
'CN30' => __( 'Macau / 澳门', 'rtPanel' ), | |
'CN31' => __( 'Tibet / 西藏', 'rtPanel' ), | |
'CN32' => __( 'Xinjiang / 新疆', 'rtPanel' ) | |
); | |
$states['HK'] = array( | |
'HONG KONG' => __( 'Hong Kong Island', 'rtPanel' ), | |
'KOWLOON' => __( 'Kowloon', 'rtPanel' ), | |
'NEW TERRITORIES' => __( 'New Territories', 'rtPanel' ) | |
); | |
$states['HU'] = array( | |
'BK' => __( 'Bács-Kiskun', 'rtPanel' ), | |
'BE' => __( 'Békés', 'rtPanel' ), | |
'BA' => __( 'Baranya', 'rtPanel' ), | |
'BZ' => __( 'Borsod-Abaúj-Zemplén', 'rtPanel' ), | |
'BU' => __( 'Budapest', 'rtPanel' ), | |
'CS' => __( 'Csongrád', 'rtPanel' ), | |
'FE' => __( 'Fejér', 'rtPanel' ), | |
'GS' => __( 'Győr-Moson-Sopron', 'rtPanel' ), | |
'HB' => __( 'Hajdú-Bihar', 'rtPanel' ), | |
'HE' => __( 'Heves', 'rtPanel' ), | |
'JN' => __( 'Jász-Nagykun-Szolnok', 'rtPanel' ), | |
'KE' => __( 'Komárom-Esztergom', 'rtPanel' ), | |
'NO' => __( 'Nógrád', 'rtPanel' ), | |
'PE' => __( 'Pest', 'rtPanel' ), | |
'SO' => __( 'Somogy', 'rtPanel' ), | |
'SZ' => __( 'Szabolcs-Szatmár-Bereg', 'rtPanel' ), | |
'TO' => __( 'Tolna', 'rtPanel' ), | |
'VA' => __( 'Vas', 'rtPanel' ), | |
'VE' => __( 'Veszprém', 'rtPanel' ), | |
'ZA' => __( 'Zala', 'rtPanel' ) | |
); | |
$states['HZ'] = array( | |
'AK' => __( 'Auckland', 'rtPanel' ), | |
'BP' => __( 'Bay of Plenty', 'rtPanel' ), | |
'CT' => __( 'Canterbury', 'rtPanel' ), | |
'HB' => __( 'Hawke’s Bay', 'rtPanel' ), | |
'MW' => __( 'Manawatu-Wanganui', 'rtPanel' ), | |
'MB' => __( 'Marlborough', 'rtPanel' ), | |
'NS' => __( 'Nelson', 'rtPanel' ), | |
'NL' => __( 'Northland', 'rtPanel' ), | |
'OT' => __( 'Otago', 'rtPanel' ), | |
'SL' => __( 'Southland', 'rtPanel' ), | |
'TK' => __( 'Taranaki', 'rtPanel' ), | |
'TM' => __( 'Tasman', 'rtPanel' ), | |
'WA' => __( 'Waikato', 'rtPanel' ), | |
'WE' => __( 'Wellington', 'rtPanel' ), | |
'WC' => __( 'West Coast', 'rtPanel' ) | |
); | |
$states['ID'] = array( | |
'AC' => __( 'Daerah Istimewa Aceh', 'rtPanel' ), | |
'SU' => __( 'Sumatera Utara', 'rtPanel' ), | |
'SB' => __( 'Sumatera Barat', 'rtPanel' ), | |
'RI' => __( 'Riau', 'rtPanel' ), | |
'KR' => __( 'Kepulauan Riau', 'rtPanel' ), | |
'JA' => __( 'Jambi', 'rtPanel' ), | |
'SS' => __( 'Sumatera Selatan', 'rtPanel' ), | |
'BB' => __( 'Bangka Belitung', 'rtPanel' ), | |
'BE' => __( 'Bengkulu', 'rtPanel' ), | |
'LA' => __( 'Lampung', 'rtPanel' ), | |
'JK' => __( 'DKI Jakarta', 'rtPanel' ), | |
'JB' => __( 'Jawa Barat', 'rtPanel' ), | |
'BT' => __( 'Banten', 'rtPanel' ), | |
'JT' => __( 'Jawa Tengah', 'rtPanel' ), | |
'JI' => __( 'Jawa Timur', 'rtPanel' ), | |
'YO' => __( 'Daerah Istimewa Yogyakarta', 'rtPanel' ), | |
'BA' => __( 'Bali', 'rtPanel' ), | |
'NB' => __( 'Nusa Tenggara Barat', 'rtPanel' ), | |
'NT' => __( 'Nusa Tenggara Timur', 'rtPanel' ), | |
'KB' => __( 'Kalimantan Barat', 'rtPanel' ), | |
'KT' => __( 'Kalimantan Tengah', 'rtPanel' ), | |
'KI' => __( 'Kalimantan Timur', 'rtPanel' ), | |
'KS' => __( 'Kalimantan Selatan', 'rtPanel' ), | |
'KU' => __( 'Kalimantan Utara', 'rtPanel' ), | |
'SA' => __( 'Sulawesi Utara', 'rtPanel' ), | |
'ST' => __( 'Sulawesi Tengah', 'rtPanel' ), | |
'SG' => __( 'Sulawesi Tenggara', 'rtPanel' ), | |
'SR' => __( 'Sulawesi Barat', 'rtPanel' ), | |
'SN' => __( 'Sulawesi Selatan', 'rtPanel' ), | |
'GO' => __( 'Gorontalo', 'rtPanel' ), | |
'MA' => __( 'Maluku', 'rtPanel' ), | |
'MU' => __( 'Maluku Utara', 'rtPanel' ), | |
'PA' => __( 'Papua', 'rtPanel' ), | |
'PB' => __( 'Papua Barat', 'rtPanel' ) | |
); | |
$states['IN'] = array( | |
'AP' => __( 'Andra Pradesh', 'rtPanel' ), | |
'AR' => __( 'Arunachal Pradesh', 'rtPanel' ), | |
'AS' => __( 'Assam', 'rtPanel' ), | |
'BR' => __( 'Bihar', 'rtPanel' ), | |
'CT' => __( 'Chhattisgarh', 'rtPanel' ), | |
'GA' => __( 'Goa', 'rtPanel' ), | |
'GJ' => __( 'Gujarat', 'rtPanel' ), | |
'HR' => __( 'Haryana', 'rtPanel' ), | |
'HP' => __( 'Himachal Pradesh', 'rtPanel' ), | |
'JK' => __( 'Jammu and Kashmir', 'rtPanel' ), | |
'JH' => __( 'Jharkhand', 'rtPanel' ), | |
'KA' => __( 'Karnataka', 'rtPanel' ), | |
'KL' => __( 'Kerala', 'rtPanel' ), | |
'MP' => __( 'Madhya Pradesh', 'rtPanel' ), | |
'MH' => __( 'Maharashtra', 'rtPanel' ), | |
'MN' => __( 'Manipur', 'rtPanel' ), | |
'ML' => __( 'Meghalaya', 'rtPanel' ), | |
'MZ' => __( 'Mizoram', 'rtPanel' ), | |
'NL' => __( 'Nagaland', 'rtPanel' ), | |
'OR' => __( 'Orissa', 'rtPanel' ), | |
'PB' => __( 'Punjab', 'rtPanel' ), | |
'RJ' => __( 'Rajasthan', 'rtPanel' ), | |
'SK' => __( 'Sikkim', 'rtPanel' ), | |
'TN' => __( 'Tamil Nadu', 'rtPanel' ), | |
'TR' => __( 'Tripura', 'rtPanel' ), | |
'UT' => __( 'Uttaranchal', 'rtPanel' ), | |
'UP' => __( 'Uttar Pradesh', 'rtPanel' ), | |
'WB' => __( 'West Bengal', 'rtPanel' ), | |
'AN' => __( 'Andaman and Nicobar Islands', 'rtPanel' ), | |
'CH' => __( 'Chandigarh', 'rtPanel' ), | |
'DN' => __( 'Dadar and Nagar Haveli', 'rtPanel' ), | |
'DD' => __( 'Daman and Diu', 'rtPanel' ), | |
'DL' => __( 'Delhi', 'rtPanel' ), | |
'LD' => __( 'Lakshadeep', 'rtPanel' ), | |
'PY' => __( 'Pondicherry (Puducherry)', 'rtPanel' ) | |
); | |
$states['MY'] = array( | |
'JHR' => __( 'Johor', 'rtPanel' ), | |
'KDH' => __( 'Kedah', 'rtPanel' ), | |
'KTN' => __( 'Kelantan', 'rtPanel' ), | |
'MLK' => __( 'Melaka', 'rtPanel' ), | |
'NSN' => __( 'Negeri Sembilan', 'rtPanel' ), | |
'PHG' => __( 'Pahang', 'rtPanel' ), | |
'PRK' => __( 'Perak', 'rtPanel' ), | |
'PLS' => __( 'Perlis', 'rtPanel' ), | |
'PNG' => __( 'Pulau Pinang', 'rtPanel' ), | |
'SBH' => __( 'Sabah', 'rtPanel' ), | |
'SWK' => __( 'Sarawak', 'rtPanel' ), | |
'SGR' => __( 'Selangor', 'rtPanel' ), | |
'TRG' => __( 'Terengganu', 'rtPanel' ), | |
'KUL' => __( 'W.P. Kuala Lumpur', 'rtPanel' ), | |
'LBN' => __( 'W.P. Labuan', 'rtPanel' ), | |
'PJY' => __( 'W.P. Putrajaya', 'rtPanel' ) | |
); | |
$states['NZ'] = array( | |
'NL' => __( 'Northland', 'rtPanel' ), | |
'AK' => __( 'Auckland', 'rtPanel' ), | |
'WA' => __( 'Waikato', 'rtPanel' ), | |
'BP' => __( 'Bay of Plenty', 'rtPanel' ), | |
'TK' => __( 'Taranaki', 'rtPanel' ), | |
'HB' => __( 'Hawke’s Bay', 'rtPanel' ), | |
'MW' => __( 'Manawatu-Wanganui', 'rtPanel' ), | |
'WE' => __( 'Wellington', 'rtPanel' ), | |
'NS' => __( 'Nelson', 'rtPanel' ), | |
'MB' => __( 'Marlborough', 'rtPanel' ), | |
'TM' => __( 'Tasman', 'rtPanel' ), | |
'WC' => __( 'West Coast', 'rtPanel' ), | |
'CT' => __( 'Canterbury', 'rtPanel' ), | |
'OT' => __( 'Otago', 'rtPanel' ), | |
'SL' => __( 'Southland', 'rtPanel') | |
); | |
$states['TH'] = array( | |
'TH-37' => __( 'Amnat Charoen (อำนาจเจริญ)', 'rtPanel' ), | |
'TH-15' => __( 'Ang Thong (อ่างทอง)', 'rtPanel' ), | |
'TH-14' => __( 'Ayutthaya (พระนครศรีอยุธยา)', 'rtPanel' ), | |
'TH-10' => __( 'Bangkok (กรุงเทพมหานคร)', 'rtPanel' ), | |
'TH-38' => __( 'Bueng Kan (บึงกาฬ)', 'rtPanel' ), | |
'TH-31' => __( 'Buri Ram (บุรีรัมย์)', 'rtPanel' ), | |
'TH-24' => __( 'Chachoengsao (ฉะเชิงเทรา)', 'rtPanel' ), | |
'TH-18' => __( 'Chai Nat (ชัยนาท)', 'rtPanel' ), | |
'TH-36' => __( 'Chaiyaphum (ชัยภูมิ)', 'rtPanel' ), | |
'TH-22' => __( 'Chanthaburi (จันทบุรี)', 'rtPanel' ), | |
'TH-50' => __( 'Chiang Mai (เชียงใหม่)', 'rtPanel' ), | |
'TH-57' => __( 'Chiang Rai (เชียงราย)', 'rtPanel' ), | |
'TH-20' => __( 'Chonburi (ชลบุรี)', 'rtPanel' ), | |
'TH-86' => __( 'Chumphon (ชุมพร)', 'rtPanel' ), | |
'TH-46' => __( 'Kalasin (กาฬสินธุ์)', 'rtPanel' ), | |
'TH-62' => __( 'Kamphaeng Phet (กำแพงเพชร)', 'rtPanel' ), | |
'TH-71' => __( 'Kanchanaburi (กาญจนบุรี)', 'rtPanel' ), | |
'TH-40' => __( 'Khon Kaen (ขอนแก่น)', 'rtPanel' ), | |
'TH-81' => __( 'Krabi (กระบี่)', 'rtPanel' ), | |
'TH-52' => __( 'Lampang (ลำปาง)', 'rtPanel' ), | |
'TH-51' => __( 'Lamphun (ลำพูน)', 'rtPanel' ), | |
'TH-42' => __( 'Loei (เลย)', 'rtPanel' ), | |
'TH-16' => __( 'Lopburi (ลพบุรี)', 'rtPanel' ), | |
'TH-58' => __( 'Mae Hong Son (แม่ฮ่องสอน)', 'rtPanel' ), | |
'TH-44' => __( 'Maha Sarakham (มหาสารคาม)', 'rtPanel' ), | |
'TH-49' => __( 'Mukdahan (มุกดาหาร)', 'rtPanel' ), | |
'TH-26' => __( 'Nakhon Nayok (นครนายก)', 'rtPanel' ), | |
'TH-73' => __( 'Nakhon Pathom (นครปฐม)', 'rtPanel' ), | |
'TH-48' => __( 'Nakhon Phanom (นครพนม)', 'rtPanel' ), | |
'TH-30' => __( 'Nakhon Ratchasima (นครราชสีมา)', 'rtPanel' ), | |
'TH-60' => __( 'Nakhon Sawan (นครสวรรค์)', 'rtPanel' ), | |
'TH-80' => __( 'Nakhon Si Thammarat (นครศรีธรรมราช)', 'rtPanel' ), | |
'TH-55' => __( 'Nan (น่าน)', 'rtPanel' ), | |
'TH-96' => __( 'Narathiwat (นราธิวาส)', 'rtPanel' ), | |
'TH-39' => __( 'Nong Bua Lam Phu (หนองบัวลำภู)', 'rtPanel' ), | |
'TH-43' => __( 'Nong Khai (หนองคาย)', 'rtPanel' ), | |
'TH-12' => __( 'Nonthaburi (นนทบุรี)', 'rtPanel' ), | |
'TH-13' => __( 'Pathum Thani (ปทุมธานี)', 'rtPanel' ), | |
'TH-94' => __( 'Pattani (ปัตตานี)', 'rtPanel' ), | |
'TH-82' => __( 'Phang Nga (พังงา)', 'rtPanel' ), | |
'TH-93' => __( 'Phatthalung (พัทลุง)', 'rtPanel' ), | |
'TH-56' => __( 'Phayao (พะเยา)', 'rtPanel' ), | |
'TH-67' => __( 'Phetchabun (เพชรบูรณ์)', 'rtPanel' ), | |
'TH-76' => __( 'Phetchaburi (เพชรบุรี)', 'rtPanel' ), | |
'TH-66' => __( 'Phichit (พิจิตร)', 'rtPanel' ), | |
'TH-65' => __( 'Phitsanulok (พิษณุโลก)', 'rtPanel' ), | |
'TH-54' => __( 'Phrae (แพร่)', 'rtPanel' ), | |
'TH-83' => __( 'Phuket (ภูเก็ต)', 'rtPanel' ), | |
'TH-25' => __( 'Prachin Buri (ปราจีนบุรี)', 'rtPanel' ), | |
'TH-77' => __( 'Prachuap Khiri Khan (ประจวบคีรีขันธ์)', 'rtPanel' ), | |
'TH-85' => __( 'Ranong (ระนอง)', 'rtPanel' ), | |
'TH-70' => __( 'Ratchaburi (ราชบุรี)', 'rtPanel' ), | |
'TH-21' => __( 'Rayong (ระยอง)', 'rtPanel' ), | |
'TH-45' => __( 'Roi Et (ร้อยเอ็ด)', 'rtPanel' ), | |
'TH-27' => __( 'Sa Kaeo (สระแก้ว)', 'rtPanel' ), | |
'TH-47' => __( 'Sakon Nakhon (สกลนคร)', 'rtPanel' ), | |
'TH-11' => __( 'Samut Prakan (สมุทรปราการ)', 'rtPanel' ), | |
'TH-74' => __( 'Samut Sakhon (สมุทรสาคร)', 'rtPanel' ), | |
'TH-75' => __( 'Samut Songkhram (สมุทรสงคราม)', 'rtPanel' ), | |
'TH-19' => __( 'Saraburi (สระบุรี)', 'rtPanel' ), | |
'TH-91' => __( 'Satun (สตูล)', 'rtPanel' ), | |
'TH-17' => __( 'Sing Buri (สิงห์บุรี)', 'rtPanel' ), | |
'TH-33' => __( 'Sisaket (ศรีสะเกษ)', 'rtPanel' ), | |
'TH-90' => __( 'Songkhla (สงขลา)', 'rtPanel' ), | |
'TH-64' => __( 'Sukhothai (สุโขทัย)', 'rtPanel' ), | |
'TH-72' => __( 'Suphan Buri (สุพรรณบุรี)', 'rtPanel' ), | |
'TH-84' => __( 'Surat Thani (สุราษฎร์ธานี)', 'rtPanel' ), | |
'TH-32' => __( 'Surin (สุรินทร์)', 'rtPanel' ), | |
'TH-63' => __( 'Tak (ตาก)', 'rtPanel' ), | |
'TH-92' => __( 'Trang (ตรัง)', 'rtPanel' ), | |
'TH-23' => __( 'Trat (ตราด)', 'rtPanel' ), | |
'TH-34' => __( 'Ubon Ratchathani (อุบลราชธานี)', 'rtPanel' ), | |
'TH-41' => __( 'Udon Thani (อุดรธานี)', 'rtPanel' ), | |
'TH-61' => __( 'Uthai Thani (อุทัยธานี)', 'rtPanel' ), | |
'TH-53' => __( 'Uttaradit (อุตรดิตถ์)', 'rtPanel' ), | |
'TH-95' => __( 'Yala (ยะลา)', 'rtPanel' ), | |
'TH-35' => __( 'Yasothon (ยโสธร)', 'rtPanel' ) | |
); | |
$states['US'] = array( | |
'AL' => __( 'Alabama', 'rtPanel' ), | |
'AK' => __( 'Alaska', 'rtPanel' ), | |
'AZ' => __( 'Arizona', 'rtPanel' ), | |
'AR' => __( 'Arkansas', 'rtPanel' ), | |
'CA' => __( 'California', 'rtPanel' ), | |
'CO' => __( 'Colorado', 'rtPanel' ), | |
'CT' => __( 'Connecticut', 'rtPanel' ), | |
'DE' => __( 'Delaware', 'rtPanel' ), | |
'DC' => __( 'District Of Columbia', 'rtPanel' ), | |
'FL' => __( 'Florida', 'rtPanel' ), | |
'GA' => __( 'Georgia', 'rtPanel' ), | |
'HI' => __( 'Hawaii', 'rtPanel' ), | |
'ID' => __( 'Idaho', 'rtPanel' ), | |
'IL' => __( 'Illinois', 'rtPanel' ), | |
'IN' => __( 'Indiana', 'rtPanel' ), | |
'IA' => __( 'Iowa', 'rtPanel' ), | |
'KS' => __( 'Kansas', 'rtPanel' ), | |
'KY' => __( 'Kentucky', 'rtPanel' ), | |
'LA' => __( 'Louisiana', 'rtPanel' ), | |
'ME' => __( 'Maine', 'rtPanel' ), | |
'MD' => __( 'Maryland', 'rtPanel' ), | |
'MA' => __( 'Massachusetts', 'rtPanel' ), | |
'MI' => __( 'Michigan', 'rtPanel' ), | |
'MN' => __( 'Minnesota', 'rtPanel' ), | |
'MS' => __( 'Mississippi', 'rtPanel' ), | |
'MO' => __( 'Missouri', 'rtPanel' ), | |
'MT' => __( 'Montana', 'rtPanel' ), | |
'NE' => __( 'Nebraska', 'rtPanel' ), | |
'NV' => __( 'Nevada', 'rtPanel' ), | |
'NH' => __( 'New Hampshire', 'rtPanel' ), | |
'NJ' => __( 'New Jersey', 'rtPanel' ), | |
'NM' => __( 'New Mexico', 'rtPanel' ), | |
'NY' => __( 'New York', 'rtPanel' ), | |
'NC' => __( 'North Carolina', 'rtPanel' ), | |
'ND' => __( 'North Dakota', 'rtPanel' ), | |
'OH' => __( 'Ohio', 'rtPanel' ), | |
'OK' => __( 'Oklahoma', 'rtPanel' ), | |
'OR' => __( 'Oregon', 'rtPanel' ), | |
'PA' => __( 'Pennsylvania', 'rtPanel' ), | |
'RI' => __( 'Rhode Island', 'rtPanel' ), | |
'SC' => __( 'South Carolina', 'rtPanel' ), | |
'SD' => __( 'South Dakota', 'rtPanel' ), | |
'TN' => __( 'Tennessee', 'rtPanel' ), | |
'TX' => __( 'Texas', 'rtPanel' ), | |
'UT' => __( 'Utah', 'rtPanel' ), | |
'VT' => __( 'Vermont', 'rtPanel' ), | |
'VA' => __( 'Virginia', 'rtPanel' ), | |
'WA' => __( 'Washington', 'rtPanel' ), | |
'WV' => __( 'West Virginia', 'rtPanel' ), | |
'WI' => __( 'Wisconsin', 'rtPanel' ), | |
'WY' => __( 'Wyoming', 'rtPanel' ), | |
'AA' => __( 'Armed Forces (AA)', 'rtPanel' ), | |
'AE' => __( 'Armed Forces (AE)', 'rtPanel' ), | |
'AP' => __( 'Armed Forces (AP)', 'rtPanel' ), | |
'AS' => __( 'American Samoa', 'rtPanel' ), | |
'GU' => __( 'Guam', 'rtPanel' ), | |
'MP' => __( 'Northern Mariana Islands', 'rtPanel' ), | |
'PR' => __( 'Puerto Rico', 'rtPanel' ), | |
'UM' => __( 'US Minor Outlying Islands', 'rtPanel' ), | |
'VI' => __( 'US Virgin Islands', 'rtPanel' ), | |
); | |
$states['ZA'] = array( | |
'EC' => __( 'Eastern Cape', 'rtPanel' ) , | |
'FS' => __( 'Free State', 'rtPanel' ) , | |
'GP' => __( 'Gauteng', 'rtPanel' ) , | |
'KZN' => __( 'KwaZulu-Natal', 'rtPanel' ) , | |
'LP' => __( 'Limpopo', 'rtPanel' ) , | |
'MP' => __( 'Mpumalanga', 'rtPanel' ) , | |
'NC' => __( 'Northern Cape', 'rtPanel' ) , | |
'NW' => __( 'North West', 'rtPanel' ) , | |
'WC' => __( 'Western Cape', 'rtPanel' ) | |
); | |
if ($c == '') { | |
return $countries; | |
} elseif ($c != '') { | |
if(!$only_country){ | |
$selected_country = ''; | |
if (strlen($c) > 2) { | |
foreach ($countries as $cc => $country) { | |
if ($country == $c) { | |
$selected_country = $cc; | |
} | |
} | |
} | |
else | |
$selected_country = $c; /* Assuming that none of the countries name is 2 character long, it must be the country key */ | |
if ($selected_country != '' && in_array($selected_country, $states)) { | |
global $states; | |
return $states[$selected_country]; | |
} elseif (!in_array($selected_country, $states)) | |
return NULL; | |
} | |
/* If $only_country is set to true, it will return only country name */ | |
if($only_country){ | |
return $countries[$c]; | |
} | |
} | |
} // End of Function | |
// Timezone | |
function formatOffset($offset) { | |
$hours = $offset / 3600; | |
$remainder = $offset % 3600; | |
$sign = $hours > 0 ? '+' : '-'; | |
$hour = (int) abs($hours); | |
$minutes = (int) abs($remainder / 60); | |
if ($hour == 0 AND $minutes == 0) { | |
$sign = ' '; | |
} | |
return $sign . str_pad($hour, 2, '0', STR_PAD_LEFT) .':'. str_pad($minutes,2, '0'); | |
} | |
/* Get Timezone List */ | |
function get_timzone_list(){ | |
$utc = new DateTimeZone('UTC'); | |
$dt = new DateTime('now', $utc); | |
$options = ''; | |
foreach(DateTimeZone::listIdentifiers() as $tz) { | |
$current_tz = new DateTimeZone($tz); | |
$offset = $current_tz->getOffset($dt); | |
$transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp()); | |
$abbr = $transition[0]['abbr']; | |
$options .= '<option value="' .$tz. '">' .$tz. ' [' .$abbr. ' '. formatOffset($offset). ']</option>'; | |
} | |
return $options; | |
} | |
/* Filter Timezone List */ | |
function rtp_filter_timzone_callback($country_code){ | |
if(!empty($country_code)){ | |
$utc = new DateTimeZone('UTC'); | |
$dt = new DateTime('now', $utc); | |
if($country_code !='' && $country_code != '#'){ | |
$timezone_list = ''; | |
$filtered_timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code); | |
foreach($filtered_timezone as $timezone){ | |
$current_tz = new DateTimeZone($timezone); | |
$offset = $current_tz->getOffset($dt); | |
$transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp()); | |
$abbr = $transition[0]['abbr']; | |
$timezone_list .='<option value="' .$timezone. '">' .$timezone. ' [' .$abbr. ' '. formatOffset($offset). ']</option>'; | |
} | |
return $timezone_list; | |
}else | |
return get_timzone_list(); | |
} | |
die(1); | |
} | |
//Examples for the function | |
$countries = get_country_state_list(); /* Returns an Array of all countries */ | |
$country_code = "IN"; | |
$country_name = get_country_state_list($country_code, TRUE); //Return Country Name for the Country Code | |
$states = get_country_state_list($country_code); //Where IN is country code for India, You can pass any thing if there is a state list it returns a array, otherwise "No States" | |
$timezone_list = rtp_filter_timzone_callback(); // returns a list of all timezones if null is given as an argument/ otherwise list of timezone for the specific country as an option value which can be directly echoed in a select dropdown | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment