| 1 |
<?php |
| 2 |
$wpInsertGeoLocation = 'DEFAULT'; |
| 3 |
function wp_insert_countries_init() { |
| 4 |
global $wpInsertGeoLocation; |
| 5 |
include(WP_INSERT_DIR.'/includes/common/geoip/geoip.inc'); |
| 6 |
$geoIP = geoip_open(WP_INSERT_DIR.'/includes/common/geoip/GeoIP.dat', GEOIP_MEMORY_CACHE); |
| 7 |
$wpInsertGeoLocation = geoip_country_code_by_addr($geoIP, $_SERVER["REMOTE_ADDR"]); |
| 8 |
geoip_close($geoIP); |
| 9 |
} |
| 10 |
add_action('init', 'wp_insert_countries_init'); |
| 11 |
|
| 12 |
function wp_insert_get_countries() { |
| 13 |
$data = array( |
| 14 |
array('value' => 'AP', 'text' => 'Asia/Pacific Region'), |
| 15 |
array('value' => 'EU', 'text' => 'Europe'), |
| 16 |
array('value' => 'AD', 'text' => 'Andorra'), |
| 17 |
array('value' => 'AE', 'text' => 'United Arab Emirates'), |
| 18 |
array('value' => 'AF', 'text' => 'Afghanistan'), |
| 19 |
array('value' => 'AG', 'text' => 'Antigua and Barbuda'), |
| 20 |
array('value' => 'AI', 'text' => 'Anguilla'), |
| 21 |
array('value' => 'AL', 'text' => 'Albania'), |
| 22 |
array('value' => 'AM', 'text' => 'Armenia'), |
| 23 |
array('value' => 'AN', 'text' => 'Netherlands Antilles'), |
| 24 |
array('value' => 'AO', 'text' => 'Angola'), |
| 25 |
array('value' => 'AQ', 'text' => 'Antarctica'), |
| 26 |
array('value' => 'AR', 'text' => 'Argentina'), |
| 27 |
array('value' => 'AS', 'text' => 'American Samoa'), |
| 28 |
array('value' => 'AT', 'text' => 'Austria'), |
| 29 |
array('value' => 'AU', 'text' => 'Australia'), |
| 30 |
array('value' => 'AW', 'text' => 'Aruba'), |
| 31 |
array('value' => 'AZ', 'text' => 'Azerbaijan'), |
| 32 |
array('value' => 'BA', 'text' => 'Bosnia and Herzegovina'), |
| 33 |
array('value' => 'BB', 'text' => 'Barbados'), |
| 34 |
array('value' => 'BD', 'text' => 'Bangladesh'), |
| 35 |
array('value' => 'BE', 'text' => 'Belgium'), |
| 36 |
array('value' => 'BF', 'text' => 'Burkina Faso'), |
| 37 |
array('value' => 'BG', 'text' => 'Bulgaria'), |
| 38 |
array('value' => 'BH', 'text' => 'Bahrain'), |
| 39 |
array('value' => 'BI', 'text' => 'Burundi'), |
| 40 |
array('value' => 'BJ', 'text' => 'Benin'), |
| 41 |
array('value' => 'BM', 'text' => 'Bermuda'), |
| 42 |
array('value' => 'BN', 'text' => 'Brunei Darussalam'), |
| 43 |
array('value' => 'BO', 'text' => 'Bolivia'), |
| 44 |
array('value' => 'BR', 'text' => 'Brazil'), |
| 45 |
array('value' => 'BS', 'text' => 'Bahamas'), |
| 46 |
array('value' => 'BT', 'text' => 'Bhutan'), |
| 47 |
array('value' => 'BV', 'text' => 'Bouvet Island'), |
| 48 |
array('value' => 'BW', 'text' => 'Botswana'), |
| 49 |
array('value' => 'BY', 'text' => 'Belarus'), |
| 50 |
array('value' => 'BZ', 'text' => 'Belize'), |
| 51 |
array('value' => 'CA', 'text' => 'Canada'), |
| 52 |
array('value' => 'CC', 'text' => 'Cocos (Keeling) Islands'), |
| 53 |
array('value' => 'CD', 'text' => 'The Democratic Republic of the Congo'), |
| 54 |
array('value' => 'CF', 'text' => 'Central African Republic'), |
| 55 |
array('value' => 'CG', 'text' => 'Congo'), |
| 56 |
array('value' => 'CH', 'text' => 'Switzerland'), |
| 57 |
array('value' => 'CI', 'text' => 'Cote D\'Ivoire'), |
| 58 |
array('value' => 'CK', 'text' => 'Cook Islands'), |
| 59 |
array('value' => 'CL', 'text' => 'Chile'), |
| 60 |
array('value' => 'CM', 'text' => 'Cameroon'), |
| 61 |
array('value' => 'CN', 'text' => 'China'), |
| 62 |
array('value' => 'CO', 'text' => 'Colombia'), |
| 63 |
array('value' => 'CR', 'text' => 'Costa Rica'), |
| 64 |
array('value' => 'CU', 'text' => 'Cuba'), |
| 65 |
array('value' => 'CV', 'text' => 'Cape Verde'), |
| 66 |
array('value' => 'CX', 'text' => 'Christmas Island'), |
| 67 |
array('value' => 'CY', 'text' => 'Cyprus'), |
| 68 |
array('value' => 'CZ', 'text' => 'Czech Republic'), |
| 69 |
array('value' => 'DE', 'text' => 'Germany'), |
| 70 |
array('value' => 'DJ', 'text' => 'Djibouti'), |
| 71 |
array('value' => 'DK', 'text' => 'Denmark'), |
| 72 |
array('value' => 'DM', 'text' => 'Dominica'), |
| 73 |
array('value' => 'DO', 'text' => 'Dominican Republic'), |
| 74 |
array('value' => 'DZ', 'text' => 'Algeria'), |
| 75 |
array('value' => 'EC', 'text' => 'Ecuador'), |
| 76 |
array('value' => 'EE', 'text' => 'Estonia'), |
| 77 |
array('value' => 'EG', 'text' => 'Egypt'), |
| 78 |
array('value' => 'EH', 'text' => 'Western Sahara'), |
| 79 |
array('value' => 'ER', 'text' => 'Eritrea'), |
| 80 |
array('value' => 'ES', 'text' => 'Spain'), |
| 81 |
array('value' => 'ET', 'text' => 'Ethiopia'), |
| 82 |
array('value' => 'FI', 'text' => 'Finland'), |
| 83 |
array('value' => 'FJ', 'text' => 'Fiji'), |
| 84 |
array('value' => 'FK', 'text' => 'Falkland Islands (Malvinas)'), |
| 85 |
array('value' => 'FM', 'text' => 'Federated States of Micronesia'), |
| 86 |
array('value' => 'FO', 'text' => 'Faroe Islands'), |
| 87 |
array('value' => 'FR', 'text' => 'France'), |
| 88 |
array('value' => 'FX', 'text' => 'France Metropolitan'), |
| 89 |
array('value' => 'GA', 'text' => 'Gabon'), |
| 90 |
array('value' => 'GB', 'text' => 'United Kingdom'), |
| 91 |
array('value' => 'GD', 'text' => 'Grenada'), |
| 92 |
array('value' => 'GE', 'text' => 'Georgia'), |
| 93 |
array('value' => 'GF', 'text' => 'French Guiana'), |
| 94 |
array('value' => 'GH', 'text' => 'Ghana'), |
| 95 |
array('value' => 'GI', 'text' => 'Gibraltar'), |
| 96 |
array('value' => 'GL', 'text' => 'Greenland'), |
| 97 |
array('value' => 'GM', 'text' => 'Gambia'), |
| 98 |
array('value' => 'GN', 'text' => 'Guinea'), |
| 99 |
array('value' => 'GP', 'text' => 'Guadeloupe'), |
| 100 |
array('value' => 'GQ', 'text' => 'Equatorial Guinea'), |
| 101 |
array('value' => 'GR', 'text' => 'Greece'), |
| 102 |
array('value' => 'GS', 'text' => 'South Georgia and the South Sandwich Islands'), |
| 103 |
array('value' => 'GT', 'text' => 'Guatemala'), |
| 104 |
array('value' => 'GU', 'text' => 'Guam'), |
| 105 |
array('value' => 'GW', 'text' => 'Guinea-Bissau'), |
| 106 |
array('value' => 'GY', 'text' => 'Guyana'), |
| 107 |
array('value' => 'HK', 'text' => 'Hong Kong'), |
| 108 |
array('value' => 'HM', 'text' => 'Heard Island and McDonald Islands'), |
| 109 |
array('value' => 'HN', 'text' => 'Honduras'), |
| 110 |
array('value' => 'HR', 'text' => 'Croatia'), |
| 111 |
array('value' => 'HT', 'text' => 'Haiti'), |
| 112 |
array('value' => 'HU', 'text' => 'Hungary'), |
| 113 |
array('value' => 'ID', 'text' => 'Indonesia'), |
| 114 |
array('value' => 'IE', 'text' => 'Ireland'), |
| 115 |
array('value' => 'IL', 'text' => 'Israel'), |
| 116 |
array('value' => 'IN', 'text' => 'India'), |
| 117 |
array('value' => 'IO', 'text' => 'British Indian Ocean Territory'), |
| 118 |
array('value' => 'IQ', 'text' => 'Iraq'), |
| 119 |
array('value' => 'IR', 'text' => 'Islamic Republic of Iran'), |
| 120 |
array('value' => 'IS', 'text' => 'Iceland'), |
| 121 |
array('value' => 'IT', 'text' => 'Italy'), |
| 122 |
array('value' => 'JM', 'text' => 'Jamaica'), |
| 123 |
array('value' => 'JO', 'text' => 'Jordan'), |
| 124 |
array('value' => 'JP', 'text' => 'Japan'), |
| 125 |
array('value' => 'KE', 'text' => 'Kenya'), |
| 126 |
array('value' => 'KG', 'text' => 'Kyrgyzstan'), |
| 127 |
array('value' => 'KH', 'text' => 'Cambodia'), |
| 128 |
array('value' => 'KI', 'text' => 'Kiribati'), |
| 129 |
array('value' => 'KM', 'text' => 'Comoros'), |
| 130 |
array('value' => 'KN', 'text' => 'Saint Kitts and Nevis'), |
| 131 |
array('value' => 'KP', 'text' => 'Democratic People\'s Republic of Korea'), |
| 132 |
array('value' => 'KR', 'text' => 'Republic of Korea'), |
| 133 |
array('value' => 'KW', 'text' => 'Kuwait'), |
| 134 |
array('value' => 'KY', 'text' => 'Cayman Islands'), |
| 135 |
array('value' => 'KZ', 'text' => 'Kazakhstan'), |
| 136 |
array('value' => 'LA', 'text' => 'Lao People\'s Democratic Republic'), |
| 137 |
array('value' => 'LB', 'text' => 'Lebanon'), |
| 138 |
array('value' => 'LC', 'text' => 'Saint Lucia'), |
| 139 |
array('value' => 'LI', 'text' => 'Liechtenstein'), |
| 140 |
array('value' => 'LK', 'text' => 'Sri Lanka'), |
| 141 |
array('value' => 'LR', 'text' => 'Liberia'), |
| 142 |
array('value' => 'LS', 'text' => 'Lesotho'), |
| 143 |
array('value' => 'LT', 'text' => 'Lithuania'), |
| 144 |
array('value' => 'LU', 'text' => 'Luxembourg'), |
| 145 |
array('value' => 'LV', 'text' => 'Latvia'), |
| 146 |
array('value' => 'LY', 'text' => 'Libyan Arab Jamahiriya'), |
| 147 |
array('value' => 'MA', 'text' => 'Morocco'), |
| 148 |
array('value' => 'MC', 'text' => 'Monaco'), |
| 149 |
array('value' => 'MD', 'text' => 'Republic of Moldova'), |
| 150 |
array('value' => 'MG', 'text' => 'Madagascar'), |
| 151 |
array('value' => 'MH', 'text' => 'Marshall Islands'), |
| 152 |
array('value' => 'MK', 'text' => 'Macedonia'), |
| 153 |
array('value' => 'ML', 'text' => 'Mali'), |
| 154 |
array('value' => 'MM', 'text' => 'Myanmar'), |
| 155 |
array('value' => 'MN', 'text' => 'Mongolia'), |
| 156 |
array('value' => 'MO', 'text' => 'Macau'), |
| 157 |
array('value' => 'MP', 'text' => 'Northern Mariana Islands'), |
| 158 |
array('value' => 'MQ', 'text' => 'Martinique'), |
| 159 |
array('value' => 'MR', 'text' => 'Mauritania'), |
| 160 |
array('value' => 'MS', 'text' => 'Montserrat'), |
| 161 |
array('value' => 'MT', 'text' => 'Malta'), |
| 162 |
array('value' => 'MU', 'text' => 'Mauritius'), |
| 163 |
array('value' => 'MV', 'text' => 'Maldives'), |
| 164 |
array('value' => 'MW', 'text' => 'Malawi'), |
| 165 |
array('value' => 'MX', 'text' => 'Mexico'), |
| 166 |
array('value' => 'MY', 'text' => 'Malaysia'), |
| 167 |
array('value' => 'MZ', 'text' => 'Mozambique'), |
| 168 |
array('value' => 'NA', 'text' => 'Namibia'), |
| 169 |
array('value' => 'NC', 'text' => 'New Caledonia'), |
| 170 |
array('value' => 'NE', 'text' => 'Niger'), |
| 171 |
array('value' => 'NF', 'text' => 'Norfolk Island'), |
| 172 |
array('value' => 'NG', 'text' => 'Nigeria'), |
| 173 |
array('value' => 'NI', 'text' => 'Nicaragua'), |
| 174 |
array('value' => 'NL', 'text' => 'Netherlands'), |
| 175 |
array('value' => 'NO', 'text' => 'Norway'), |
| 176 |
array('value' => 'NP', 'text' => 'Nepal'), |
| 177 |
array('value' => 'NR', 'text' => 'Nauru'), |
| 178 |
array('value' => 'NU', 'text' => 'Niue'), |
| 179 |
array('value' => 'NZ', 'text' => 'New Zealand'), |
| 180 |
array('value' => 'OM', 'text' => 'Oman'), |
| 181 |
array('value' => 'PA', 'text' => 'Panama'), |
| 182 |
array('value' => 'PE', 'text' => 'Peru'), |
| 183 |
array('value' => 'PF', 'text' => 'French Polynesia'), |
| 184 |
array('value' => 'PG', 'text' => 'Papua New Guinea'), |
| 185 |
array('value' => 'PH', 'text' => 'Philippines'), |
| 186 |
array('value' => 'PK', 'text' => 'Pakistan'), |
| 187 |
array('value' => 'PL', 'text' => 'Poland'), |
| 188 |
array('value' => 'PM', 'text' => 'Saint Pierre and Miquelon'), |
| 189 |
array('value' => 'PN', 'text' => 'Pitcairn Islands'), |
| 190 |
array('value' => 'PR', 'text' => 'Puerto Rico'), |
| 191 |
array('value' => 'PS', 'text' => 'Palestinian Territory'), |
| 192 |
array('value' => 'PT', 'text' => 'Portugal'), |
| 193 |
array('value' => 'PW', 'text' => 'Palau'), |
| 194 |
array('value' => 'PY', 'text' => 'Paraguay'), |
| 195 |
array('value' => 'QA', 'text' => 'Qatar'), |
| 196 |
array('value' => 'RE', 'text' => 'Reunion'), |
| 197 |
array('value' => 'RO', 'text' => 'Romania'), |
| 198 |
array('value' => 'RU', 'text' => 'Russian Federation'), |
| 199 |
array('value' => 'RW', 'text' => 'Rwanda'), |
| 200 |
array('value' => 'SA', 'text' => 'Saudi Arabia'), |
| 201 |
array('value' => 'SB', 'text' => 'Solomon Islands'), |
| 202 |
array('value' => 'SC', 'text' => 'Seychelles'), |
| 203 |
array('value' => 'SD', 'text' => 'Sudan'), |
| 204 |
array('value' => 'SE', 'text' => 'Sweden'), |
| 205 |
array('value' => 'SG', 'text' => 'Singapore'), |
| 206 |
array('value' => 'SH', 'text' => 'Saint Helena'), |
| 207 |
array('value' => 'SI', 'text' => 'Slovenia'), |
| 208 |
array('value' => 'SJ', 'text' => 'Svalbard and Jan Mayen'), |
| 209 |
array('value' => 'SK', 'text' => 'Slovakia'), |
| 210 |
array('value' => 'SL', 'text' => 'Sierra Leone'), |
| 211 |
array('value' => 'SM', 'text' => 'San Marino'), |
| 212 |
array('value' => 'SN', 'text' => 'Senegal'), |
| 213 |
array('value' => 'SO', 'text' => 'Somalia'), |
| 214 |
array('value' => 'SR', 'text' => 'Suriname'), |
| 215 |
array('value' => 'ST', 'text' => 'Sao Tome and Principe'), |
| 216 |
array('value' => 'SV', 'text' => 'El Salvador'), |
| 217 |
array('value' => 'SY', 'text' => 'Syrian Arab Republic'), |
| 218 |
array('value' => 'SZ', 'text' => 'Swaziland'), |
| 219 |
array('value' => 'TC', 'text' => 'Turks and Caicos Islands'), |
| 220 |
array('value' => 'TD', 'text' => 'Chad'), |
| 221 |
array('value' => 'TF', 'text' => 'French Southern Territories'), |
| 222 |
array('value' => 'TG', 'text' => 'Togo'), |
| 223 |
array('value' => 'TH', 'text' => 'Thailand'), |
| 224 |
array('value' => 'TJ', 'text' => 'Tajikistan'), |
| 225 |
array('value' => 'TK', 'text' => 'Tokelau'), |
| 226 |
array('value' => 'TM', 'text' => 'Turkmenistan'), |
| 227 |
array('value' => 'TN', 'text' => 'Tunisia'), |
| 228 |
array('value' => 'TO', 'text' => 'Tonga'), |
| 229 |
array('value' => 'TL', 'text' => 'Timor-Leste'), |
| 230 |
array('value' => 'TR', 'text' => 'Turkey'), |
| 231 |
array('value' => 'TT', 'text' => 'Trinidad and Tobago'), |
| 232 |
array('value' => 'TV', 'text' => 'Tuvalu'), |
| 233 |
array('value' => 'TW', 'text' => 'Taiwan'), |
| 234 |
array('value' => 'TZ', 'text' => 'United Republic of Tanzania'), |
| 235 |
array('value' => 'UA', 'text' => 'Ukraine'), |
| 236 |
array('value' => 'UG', 'text' => 'Uganda'), |
| 237 |
array('value' => 'UM', 'text' => 'United States Minor Outlying Islands'), |
| 238 |
array('value' => 'US', 'text' => 'United States'), |
| 239 |
array('value' => 'UY', 'text' => 'Uruguay'), |
| 240 |
array('value' => 'UZ', 'text' => 'Uzbekistan'), |
| 241 |
array('value' => 'VA', 'text' => 'Holy See (Vatican City State)'), |
| 242 |
array('value' => 'VC', 'text' => 'Saint Vincent and the Grenadines'), |
| 243 |
array('value' => 'VE', 'text' => 'Venezuela'), |
| 244 |
array('value' => 'VG', 'text' => 'British Virgin Islands'), |
| 245 |
array('value' => 'VI', 'text' => 'U.S. Virgin Islands'), |
| 246 |
array('value' => 'VN', 'text' => 'Vietnam'), |
| 247 |
array('value' => 'VU', 'text' => 'Vanuatu'), |
| 248 |
array('value' => 'WF', 'text' => 'Wallis and Futuna'), |
| 249 |
array('value' => 'WS', 'text' => 'Samoa'), |
| 250 |
array('value' => 'YE', 'text' => 'Yemen'), |
| 251 |
array('value' => 'YT', 'text' => 'Mayotte'), |
| 252 |
array('value' => 'RS', 'text' => 'Serbia'), |
| 253 |
array('value' => 'ZA', 'text' => 'South Africa'), |
| 254 |
array('value' => 'ZM', 'text' => 'Zambia'), |
| 255 |
array('value' => 'ME', 'text' => 'Montenegro'), |
| 256 |
array('value' => 'ZW', 'text' => 'Zimbabwe'), |
| 257 |
array('value' => 'A1', 'text' => 'Anonymous Proxy'), |
| 258 |
array('value' => 'A2', 'text' => 'Satellite Provider'), |
| 259 |
array('value' => 'O1', 'text' => 'Other'), |
| 260 |
array('value' => 'AX', 'text' => 'Aland Islands'), |
| 261 |
array('value' => 'GG', 'text' => 'Guernsey'), |
| 262 |
array('value' => 'IM', 'text' => 'Isle of Man'), |
| 263 |
array('value' => 'JE', 'text' => 'Jersey'), |
| 264 |
array('value' => 'BL', 'text' => 'Saint Barthelemy'), |
| 265 |
array('value' => 'MF', 'text' => 'Saint Martin') |
| 266 |
); |
| 267 |
return $data; |
| 268 |
} |
| 269 |
?> |